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
1806.00638
1
1806
2018-06-02T14:05:24
On Minrank and Forbidden Subgraphs
[ "cs.DS", "cs.IT", "math.CO", "cs.IT" ]
The minrank over a field $\mathbb{F}$ of a graph $G$ on the vertex set $\{1,2,\ldots,n\}$ is the minimum possible rank of a matrix $M \in \mathbb{F}^{n \times n}$ such that $M_{i,i} \neq 0$ for every $i$, and $M_{i,j}=0$ for every distinct non-adjacent vertices $i$ and $j$ in $G$. For an integer $n$, a graph $H$, and a field $\mathbb{F}$, let $g(n,H,\mathbb{F})$ denote the maximum possible minrank over $\mathbb{F}$ of an $n$-vertex graph whose complement contains no copy of $H$. In this paper we study this quantity for various graphs $H$ and fields $\mathbb{F}$. For finite fields, we prove by a probabilistic argument a general lower bound on $g(n,H,\mathbb{F})$, which yields a nearly tight bound of $\Omega(\sqrt{n}/\log n)$ for the triangle $H=K_3$. For the real field, we prove by an explicit construction that for every non-bipartite graph $H$, $g(n,H,\mathbb{R}) \geq n^\delta$ for some $\delta = \delta(H)>0$. As a by-product of this construction, we disprove a conjecture of Codenotti, Pudl\'ak, and Resta. The results are motivated by questions in information theory, circuit complexity, and geometry.
cs.DS
cs
On Minrank and Forbidden Subgraphs Ishay Haviv∗ Abstract The minrank over a field F of a graph G on the vertex set {1, 2, . . . , n} is the minimum pos- sible rank of a matrix M ∈ Fn×n such that Mi,i 6= 0 for every i, and Mi,j = 0 for every distinct non-adjacent vertices i and j in G. For an integer n, a graph H, and a field F, let g(n, H, F) denote the maximum possible minrank over F of an n-vertex graph whose complement con- tains no copy of H. In this paper we study this quantity for various graphs H and fields F. For finite fields, we prove by a probabilistic argument a general lower bound on g(n, H, F), which yields a nearly tight bound of Ω(√n/ log n) for the triangle H = K3. For the real field, we prove by an explicit construction that for every non-bipartite graph H, g(n, H, R) ≥ nδ for some δ = δ(H) > 0. As a by-product of this construction, we disprove a conjecture of Code- notti, Pudl´ak, and Resta. The results are motivated by questions in information theory, circuit complexity, and geometry. 1 Introduction An n × n matrix M over a field F is said to represent a digraph G = (V, E) with vertex set V = 6= 0 for every i, and Mi,j = 0 for every distinct i, j such that (i, j) /∈ E. The {1, 2, . . . , n} if Mi,i minrank of G over F, denoted minrkF(G), is the minimum possible rank of a matrix M ∈ Fn×n representing G. The definition is naturally extended to (undirected) graphs by replacing every edge with two oppositely directed edges. It is easy to see that for every graph G the minrank parameter is sandwiched between the independence number and the clique cover number, that is, α(G) ≤ minrkF(G) ≤ χ(G). For example, minrkF(Kn) = 1 and minrkF(Kn) = n for every field F. The minrank parameter was introduced by Haemers in 1979 [16], and since then has attracted a significant attention motivated by its various applications in information theory and in theoretical computer science (see, e.g., [17, 7, 32, 26, 25, 19, 10]). In this work we address the extremal behavior of the minrank parameter of n-vertex graphs whose complements are free of a fixed forbidden subgraph. For two graphs G and H, we say that G is H-free if G contains no subgraph, induced or not, isomorphic to H. For an integer n, a graph H, and a field F, let g(n, H, F) denote the maximum of minrkF(G) taken over all n-vertex graphs G whose complement G is H-free. Our purpose is to study the quantity g(n, H, F) where H and F are fixed and n is growing. ∗School of Computer Science, The Academic College of Tel Aviv-Yaffo, Tel Aviv 61083, Israel. 1 1.1 Our Contribution We provide bounds on g(n, H, F) for various graph families and fields. We start with a simple upper bound for a forest H. Proposition 1.1. For every integer n, a field F, and a nontrivial forest H on h vertices, g(n, H, F) ≤ h − 1. Equality holds whenever H is a tree and n ≥ h − 1. We next provide a general lower bound on g(n, H, F) for a graph H and a finite field F. To state it, we need the following notation. For a graph H with h ≥ 3 vertices and f ≥ 3 edges define γ(H) = h−2 f−1 and γ0(H) = minH′ γ(H′), where the minimum is taken over all subgraphs H′ of H with at least 3 edges. Theorem 1.2. For every graph H with at least 3 edges there exists c = c(H) > 0 such that for every integer n and a finite field F, g(n, H, F) ≥ c · n1−γ0(H) log(n · F) . Note that for every finite field F, the quantity g(n, H, F) grows with n if and only if H is not a forest. Indeed, if H is a forest then g(n, H, F) is bounded by some constant by Proposition 1.1, whereas otherwise H satisfies γ0(H) < 1 and thus, by Theorem 1.2, g(n, H, F) ≥ Ω(nδ) for some δ = δ(H) > 0. Note further that for the case H = K3, which is motivated by a question in information theory (see Section 1.2), Theorem 1.2 implies that g(n, K3, F) ≥ Ω(cid:16) √n log n(cid:17) (1) for every fixed finite field F. This is tight up to a plog n multiplicative term (see Proposition 3.8). Theorem 1.2 is proved by a probabilistic argument based on the Lov´asz Local Lemma [13]. The proof involves an approach of Spencer [29] to lower bounds on off-diagonal Ramsey numbers and a technique of Golovnev, Regev, and Weinstein [15] for estimating the minrank of random graphs. As our final result, we show that for every non-bipartite graph H there are H-free graphs with low minrank over the real field R. Theorem 1.3. For every non-bipartite graph H there exists δ = δ(H) > 0 such that for every sufficiently large integer n, there exists an n-vertex H-free graph G such that minrkR(G) ≤ n1−δ. This theorem is proved by an explicit construction from the family of generalized Kneser graphs, whose minrank was recently studied in [18]. It is known that every n-vertex graph G satisfies for every field F (see, e.g., [23, Remark 2.2]). This combined with the graphs given in Theorem 1.3 implies the following (explicit) lower bound on g(n, H, R) for non-bipartite graphs H. minrkF(G) · minrkF(G) ≥ n (2) Corollary 1.4. For every non-bipartite graph H there exists δ = δ(H) > 0 such that for every sufficiently large integer n, g(n, H, R) ≥ nδ. As another application of Theorem 1.3, we disprove a conjecture of Codenotti, Pudl´ak, and Resta [11] motivated by Valiant's approach to circuit lower bounds [31] (see Section 1.2). 2 1.2 Applications The study of the quantity g(n, H, F) is motivated by questions in information theory, circuit com- plexity, and geometry. We gather here several applications of our results. Shannon Capacity. For an integer k and a graph G on the vertex set V, let Gk denote the graph on the vertex set Vk in which two distinct vertices (u1, . . . , uk) and (v1, . . . , vk) are adjacent if for every 1 ≤ i ≤ k it holds that ui and vi are either equal or adjacent in G. The Shannon capacity of a graph G, introduced by Shannon in 1956 [28], is defined as the limit c(G) = limk→∞ (α(Gk))1/k. This graph parameter is motivated by information theory, as it measures the zero-error capacity of a noisy communication channel represented by G. An upper bound on c(G), known as the Lov´asz ϑ-function, was introduced in [22], where it was used to show that the Shannon capacity of the cycle on 5 vertices satisfies c(C5) = √5, whereas its independence number is 2. Haemers introduced the minrank parameter in [16, 17] and showed that it forms another upper bound on c(G) and that for certain graphs it is tighter than the ϑ-function. In general, computing the Shannon capacity of a graph seems to be a very difficult task, and its exact value is not known even for small graphs such as the cycle on 7 vertices. The question of determining the largest possible Shannon capacity of a graph with a given independence number is widely open. In fact, it is not even known if the Shannon capacity of a graph with independence number 2 can be arbitrarily large [3]. Interestingly, Erd os, McEliece, and Taylor [14] have shown that this question is closely related to determining an appropriate multicolored Ramsey number, whose study in [33] implies that there exists a graph G with α(G) = 2 and c(G) > 3.199. A related question, originally asked by Lov´asz, is that of determining the maximum possible ϑ-function of an n-vertex graph with independence number 2. This maximum is known to be Θ(n1/3), where the upper bound was proved by Kashin and Konyagin [20, 21], and the lower bound was proved by Alon [2] via an explicit construction. Here we consider the analogue question of determining the maximum possible minrank, over any fixed finite field F, of an n-vertex graph with independence number 2. Since the latter is precisely g(n, K3, F), our bound in (1) implies that the minrank parameter is weaker than the ϑ-function with respect to the general upper bounds that they provide on the Shannon capacity of n-vertex graphs with independence number 2. In 1977, Valiant [31] proposed the matrix rigidity ap- The Odd Alternating Cycle Conjecture. proach for proving superlinear circuit lower bounds, a major challenge in the area of circuit com- plexity. Roughly speaking, the rigidity of a matrix M ∈ Fn×n for a constant ε > 0 is the minimum number of entries that one has to change in M in order to reduce its rank over F to at most ε · n. Valiant showed in [31] that matrices with large rigidity can be used to obtain superlinear lower bounds on the size of logarithmic depth arithmetic circuits computing linear transformations. With this motivation, Codenotti, Pudl´ak, and Resta [11] raised in the late nineties the Odd Al- ternating Cycle Conjecture stated below, and proved that it implies, if true, that certain explicit circulant matrices have superlinear rigidity. By an alternating odd cycle we refer to a digraph which forms a cycle when the orientation of the edges is ignored, and such that the orientation of the edges alternates with one exception. 3 Conjecture 1.5 (The Odd Alternating Cycle Conjecture [11]). For every field F there exist ε > 0 and an odd integer ℓ such that every n-vertex digraph G with minrkF(G) ≤ ε · n contains an alternating cycle of length ℓ. Codenotti et al. [11] proved that the statement of Conjecture 1.5 does not hold for ℓ = 3 over any field F. Specifically, they provided an explicit construction of n-vertex digraphs G, free of alternating triangles, with minrkF(G) ≤ O(n2/3) for every field F. For the undirected case, which is of more interest to us, a construction of [11] implies that there are n-vertex triangle-free graphs G such that minrkF(G) ≤ O(n3/4) for every field F (see [8, Section 4.2] for a related construction over the binary field as well as for an application of such graphs from the area of index coding). Note that this yields, by (2), that g(n, K3, F) ≥ Ω(n1/4). In contrast, for the real field and the cycle on 4 vertices, it was shown in [11] that every n-vertex C4-free graph G satisfies minrkR(G) > n 6 . Yet, the question whether every n-vertex digraph with sublinear minrank contains an alternating cycle of odd length ℓ ≥ 5 was left open in [11] for every field. Our Theorem 1.3 implies that for every odd ℓ there are (undirected) Cℓ-free graphs G with sublinear minrkR(G), and in particular disproves Conjecture 1.5 for the real field R. Nearly Orthogonal Systems of Vectors. A system of nonzero vectors in Rm is said to be nearly orthogonal if any set of three vectors of the system contains an orthogonal pair. It was proved by Rosenfeld [27] that every such system has size at most 2m. An equivalent way to state this, is that every n-vertex graph represented by a real positive semidefinite matrix of rank smaller than n 2 contains a triangle. Note that the positive semidefiniteness assumption is essential in this result, as follows from the aforementioned construction of [11] of n-vertex triangle-free graphs G with minrkR(G) ≤ O(n3/4). A related question was posed by Pudl´ak in [24]. He proved there that for some ε > 0, every n-vertex graph represented by a real positive semidefinite matrix of rank at most ε · n contains a cycle of length 5. Pudl´ak asked whether the assumption that the matrix is positive semidefinite can be omitted. Our Theorem 1.3 applied to H = C5 implies that there are C5-free graphs G with sublinear minrkR(G), and thus answers this question in the negative. 1.3 Outline The rest of the paper is organized as follows. In Section 2 we present the simple proof of Propo- sition 1.1. In Section 3 we provide some background on sparse-base matrices from [15] and then prove Theorem 1.2. In the final Section 4, we prove Theorem 1.3. 2 Forests In this section we prove Proposition 1.1. We use an argument from one of the proofs in [5]. Proof of Proposition 1.1: Fix a nontrivial h-vertex forest H and a field F. It suffices to consider the case where H is a tree, as otherwise H is a subgraph of some h-vertex tree H′, and since every H-free graph is also H′-free, we have g(n, H, F) ≤ g(n, H′, F). 4 Our goal is to show that every n-vertex graph G whose complement G is H-free satisfies minrkF(G) ≤ h − 1. Let G be such a graph. We claim that G is (h − 2)-degenerate, that is, ev- ery subgraph of G contains a vertex of degree at most h − 2. Indeed, otherwise G has a subgraph G′ all of whose degrees are at least h − 1, and one can find a copy of H in G′ as follows: First iden- tify an arbitrary vertex of G′ with an arbitrary vertex of H, and then iteratively identify a vertex of G′ with a leaf added to the being constructed copy of the tree H. The process succeeds since H has h vertices and every vertex of G′ has degree at least h − 1. As is well known, the fact that G is (h − 2)-degenerate implies that G is (h − 1)-colorable, so we get that minrkF(G) ≤ χ(G) ≤ h − 1, as required. We finally observe that the bound is tight whenever H is a tree and n ≥ h − 1. Indeed, let G be the n-vertex complete ⌈ n h−1⌉-partite graph, that has h − 1 vertices in each of its parts, except possibly one of them. Its complement G is a disjoint union of cliques, each of size at most h − 1, and is thus H-free. Since α(G) = χ(G) = h − 1, it follows that minrkF(G) = h − 1 for every field F, completing the proof. 3 A General Lower Bound on g(n, H, F) In this section we prove Theorem 1.2 and discuss its tightness for H = K3. We start with some needed preparations. 3.1 Lov´asz Local Lemma The Lov´asz Local Lemma [13] stated below is a powerful probabilistic tool in Combinatorics (see, e.g., [6, Chapter 5]). We denote by [N] the set of integers from 1 to N. Lemma 3.1. [Lov´asz Local Lemma [13]] Let A1, . . . , AN be events in an arbitrary probability space. A digraph D = (V, E) on the vertex set V = [N] is called a dependency digraph for the events A1, . . . , AN if for every i ∈ [N], the event Ai is mutually independent of the events Aj with j 6= i and (i, j) /∈ E. Suppose that D = (V, E) is a dependency digraph for the above events and suppose that there are real numbers x1, . . . , xN ∈ [0, 1) such that Pr [Ai] ≤ xi · ∏ (i,j)∈E (1 − xj) for all i ∈ [N]. Then, with positive probability no event Ai holds. 3.2 Sparse-base Matrices Here we review several notions and lemmas due to Golovnev, Regev, and Weinstein [15]. For a matrix M over a field F, let s(M) denote its sparsity, that is, the number of its nonzero entries. We say that a matrix M over F with rank k contains an ℓ-sparse column (row) basis if M contains k linearly independent columns (rows) with a total of at most ℓ nonzero entries. We first state a lemma that provides an upper bound on the number of matrices with sparse column and row bases. Lemma 3.2 ([15]). The number of rank k matrices in Fn×n that contain ℓ-sparse column and row bases is at most (n · F)6ℓ. 5 The following lemma relates the sparsity of a matrix with nonzero entries on the main diagonal to its rank. Lemma 3.3 ([15]). For every rank k matrix M ∈ Fn×n with nonzero entries on the main diagonal, s(M) ≥ n2 4k . We also need the following notion. An (n, k, s, ℓ)-matrix over a field F is a matrix in Fn×n of rank k and sparsity s that contains ℓ-sparse column and row bases and has nonzero entries on the 4k . For integers n,k be the collection that n . This main diagonal. Note that by Lemma 3.3, an (n, k, s, ℓ)-matrix exists only if s ≥ n2 n, k, s′ and a field F (which will always be clear from the context), let M(s′) consists of all (n′, k′, s′, 2s′k′ collection is motivated by the following lemma. n′ )-matrices over F for all n′ ∈ [n] and k′ ∈ [k] such that k′ n′ ≤ k Lemma 3.4 ([15]). Every matrix in Fn×n with rank at most k and nonzero entries on the main diagonal has a principal sub-matrix that lies in M(s′) n,k for some s′. Now, for integers n, k, s′, let P (s′) n,k be the collection that consists of all pairs (M, R) such that, for some n′ ∈ [n], M is an n′ × n′ matrix in M(s′) n,k and R is an n′-subset of [n]. Observe that Lemma 3.4 implies that for every digraph G on the vertex set [n] with minrkF(G) ≤ k there exist s′ and a pair (M, R) in P (s′) n,k such that M represents the induced subgraph G[R] of G on R, with respect to the natural order of the vertices in R (from smallest to largest). The following lemma provides an upper bound on the size of P (s′) n,k . Lemma 3.5. For every integers n, k, s′, P (s′) Proof: To bound the size of P (s′) pairs (M, R) where M is an (n′, k′, s′, 2s′k′ are at most (n′ · F)12s′ k′/n′ such matrices M, each of which occurs in ( n n,k , we consider for every n′ ∈ [n] and k′ ∈ [k] such that k′ n′) pairs of P (s′) n the n′ )-matrix and R is an n′-subset of [n]. By Lemma 3.2 there n,k . It follows n,k ≤ (n · F)24s′ k/n. n′ ≤ k that n′,k′(cid:18) n n′(cid:19) · (n′ · F)12s′ k′/n′ ≤ n2 · max P (s′) n,k ≤ ∑ n′,k′ (cid:0)n3n′ · (n′ · F)12s′ k′/n′(cid:1) ≤ max ≤ max n′,k′ (cid:0)(n · F)12s′ k′/n′+12s′k′/n′(cid:1) ≤ (n · F)24s′ k/n, ≤ max n′,k′ (cid:0)nn′ · (n′ · F)12s′ k′/n′(cid:1) n′,k′ (cid:0)(n · F)3n′+12s′k′/n′(cid:1) where in the fifth inequality we have used the relation s′ ≥ n′2 we have used k′ n′ ≤ k n . 4k′ from Lemma 3.3, and in the sixth 3.3 Proof of Theorem 1.2 We prove the following theorem and then derive Theorem 1.2. Recall that for a graph H with h ≥ 3 vertices and f ≥ 3 edges, we denote γ(H) = h−2 f−1. We also let exp(x) stand for ex. 6 Theorem 3.6. For every graph H with at least 3 edges there exists c = c(H) > 0 such that for every integer n and a finite field F, g(n, H, F) ≥ c · n1−γ(H) log(n · F) . Proof: Fix a graph H with h ≥ 3 vertices and f ≥ 3 edges and denote γ = γ(H) = h−2 > 0. The f−1 proof is via the probabilistic method. Let ~G ∼ ~G(n, p) be a random digraph on the vertex set [n] where each directed edge is taken randomly and independently with probability p. Set q = 1 − p. Let G be the (undirected) graph on [n] in which two distinct vertices i, j are adjacent if both the directed edges (i, j) and (j, i) are included in ~G. Notice that every two distinct vertices are adjacent in G with probability p2 independently of the adjacencies between other vertex pairs. To prove the theorem, we will show that for a certain choice of p the random graph G satisfies with positive probability that its complement G is H-free and that minrkF(G) > k, where k = c1 · n1−γ ln (n · F) (3) for a constant c1 > 0 that depends only on H. To do so, we define two families of events as follows. First, for every set I ⊆ [n] of size I = h, let AI be the event that the induced subgraph of G on I contains a copy of H. Observe that Pr [AI] ≤ h! · (1 − p2) f = h! · (1 − (1 − q)2) f ≤ h! · (2q) f . Second, consider the collection P = ∪s′∈[n2]P (s′) n,k (see Section 3.2). Recall that every element of P is a pair (M, R) such that, for some n′ ∈ [n], M is an n′ × n′ matrix over F and R is an n′-subset of [n]. Denote Ns′ = P (s′) n,k . By Lemma 3.5, combined with (3), we have Ns′ ≤ (n · F)24s′ k/n = exp(24c1 · s′ · n−γ). (4) Let S = {s′ ∈ [n2] Ns′ ≥ 1}. By Lemma 3.3, for every s′ ∈ S and an n′ × n′ matrix of rank k′ in M(s′) n , we have that n,k where n′ ∈ [n], k′ ∈ [k], and k′ n′ ≤ k n′ n′ k′ ≥ 4 · n′ 4 · s′ ≥ n k = n′ · nγ · ln(n · F) 4c1 . (5) Now, for every pair (M, R) ∈ P, let BM,R be the event that the matrix M represents over F the induced subgraph ~G[R] of ~G on R with respect to the natural order of the vertices in R. For M to represent ~G[R] we require that for every distinct i, j such that Mi,j 6= 0, there is an edge in ~G from the ith to the jth vertex of R. Hence, for M ∈ Fn′×n′ of sparsity s′ and an n′-subset R of [n], Pr [BM,R] = ps′−n′ ≤ ps′/2 = (1 − q)s′/2 ≤ exp(−qs′/2), where for the first inequality we have used the inequality s′ ≥ 2n′ which follows from (5) for every sufficiently large n. We claim that it suffices to prove that with positive probability none of the events AI and BM,R holds. Indeed, this implies that there exists an n-vertex digraph ~G that does not satisfy any of 7 these events. Since the AI's are not satisfied it immediately follows that the complement G of the (undirected) graph G associated with ~G is H-free. We further claim that minrkF(G) > k. To see this, assume by contradiction that there exists a matrix M ∈ Fn×n of rank at most k that represents G, and thus, in particular, represents ~G. By Lemma 3.4, such an M has a principal n′ × n′ sub- matrix M′ ∈ M(s′) n,k for some n′ and s′. Hence, for some n′-subset R of [n], the matrix M′ represents ~G[R] with respect to the natural order of the vertices in R, in contradiction to the fact that the event BM′,R with (M′, R) ∈ P does not hold. To prove that with positive probability none of the events AI and BM,R holds, we apply the Lov´asz Local Lemma (Lemma 3.1). To this end, construct a (symmetric) dependency digraph D = (V, E) whose vertices represent all the events AI and BM,R, and whose edges are defined as follows. • An AI-vertex and an AI′ -vertex are joined by edges (in both directions) if I ∩ I′ ≥ 2. Notice that the events AI and AI′ are independent when I ∩ I′ < 2. • An AI-vertex and a BM,R-vertex are joined by edges if there are distinct i, j ∈ I ∩ R for which the entry of M that corresponds to the edge (i, j) is nonzero. Notice that the events AI and BM,R are independent when such i and j do not exist. • Every two distinct BM,R-vertices are joined by edges. Clearly, each event is mutually independent of all other events besides those adjacent to it in D, and thus D is a dependency digraph for our events. Observe that every AI-vertex is adjacent to at most (h 2) · nh−2 AI′-vertices. Additionally, every BM,R-vertex, where M is an n′ × n′ matrix of sparsity s′, is adjacent to at most (s′ − n′) · ( n h−2) < s′ · nh−2 AI-vertices. Finally, every vertex of D is adjacent to at most Ns′ BM,R-vertices with M ∈ M(s′) n,k (that is, s(M) = s′). To apply Lemma 3.1 we assign a number in [0, 1) to each vertex of D. Define 2) · ( n h−2) ≤ (h q = c2 · n−γ, x = c3 · n−γ· f , and xs′ = exp(−c4 · s′ · n−γ) for every s′ ∈ S, where c2, c3, c4 > 0 are constants, depending only on H, to be determined. We assign the number x to every AI-vertex, and the number xs′ to every BM,R-vertex with s(M) = s′. We present now the conditions of Lemma 3.1. For every AI-vertex, recalling that Pr [AI] ≤ h! · (2q) f , we require h! · (2q) f ≤ x · (1 − x)(h 2)·nh−2 (1 − xs′)Ns′ . · ∏ s′∈S (6) Similarly, for every BM,R-vertex with s(M) = s′, recalling that Pr [BM,R] ≤ exp(−qs′/2), we re- quire exp(−qs′/2) ≤ xs′ · (1 − x)s′·nh−2 (1 − xs′)Ns′ . · ∏ s′∈S (7) To complete the proof, it suffices to show that the constants c1, c2, c3, c4 > 0 can be chosen in a way that satisfies the inequalities (6) and (7). Consider the following three constraints: 1. c2 > 2 · (2c3 + c4), 2. c3 ≥ h! · (2c2) f · exp(3), and 8 3. c4 ≥ 32 · c1. It is easy to see that it is possible to choose the constants under the above constraints. Indeed, by f ≥ 3, for a sufficiently small choice of c2 > 0 one can take c3 with, say, an equality in Item 2 so that some c4 > 0 satisfies Item 1. Then, c1 can be chosen as a positive constant satisfying Item 3. We show now that such a choice satisfies (6) and (7) for every sufficiently large n. Note that we use below several times the inequality 1 − α ≥ exp(−2α), which holds for any α ∈ [0, 1/2]. First, use (4) and the condition c4 ≥ 32 · c1 to obtain that exp((24c1 − c4) · s′ · n−γ) ≤ ∑ xs′ · Ns′ ≤ ∑ ∑ s′∈S s′∈S s′∈S where the third inequality follows by s′ ≥ nγ·ln(n·F) which we get from (5), and the fourth by S ≤ n2. Considering the term ∏s′∈S (1 − xs′)Ns′ , which appears in both (6) and (7), we derive that exp(−8c1 · s′ · n−γ) ≤ ∑ s′∈S exp(−2 ln n) ≤ 1, 4c1 (1 − xs′ )Ns′ ≥ ∏ s′∈S For inequality (6), observe that ∏ s′∈S exp(−2xs′ · Ns′ ) = exp(cid:16) − 2 · ∑ s′∈S xs′ · Ns′(cid:17) ≥ exp(−2). x · (1 − x)(h 2)·nh−2 · ∏ s′∈S (1 − xs′)Ns′ ≥ x · exp(cid:16) − 2x ·(cid:18)h 2(cid:19) · nh−2(cid:17) · exp(−2) = c3 · n−γ· f · exp(cid:16) − 2c3 · n−γ· f ·(cid:18)h ≥ h! · (2c2) f · n−γ· f · exp(cid:16)1 − 2c3 ·(cid:18)h ≥ h! · (2q) f , 2(cid:19) · nh−2 − 2(cid:17) 2(cid:19) · n−γ(cid:17) where for the second inequality we use c3 ≥ h! · (2c2) f · exp(3) and γ = h−2 use the assumption that n is sufficiently large. For inequality (7), observe that f−1, and for the third we xs′ · (1 − x)s′·nh−2 · ∏ s′∈S (1 − xs′ )Ns′ ≥ xs′ · exp(−2x · s′ · nh−2) · exp(−2) = exp(−c4 · s′ · n−γ) · exp(−2c3 · n−γ· f · s′ · nh−2) · exp(−2) = exp(−(2c3 + c4) · s′ · n−γ − 2) ≥ exp(−(c2/2) · s′ · n−γ) = exp(−qs′/2), where for the second equality we again use the definition of γ, and for the second inequality we use the condition c2 > 2 · (2c3 + c4), the fact that s′ · n−γ = ω(1) by (5), and the assumption that n is sufficiently large. This completes the proof. We can derive now Theorem 1.2. Recall that γ0(H) = minH′ γ(H′), where the minimum is over all subgraphs H′ of H with at least 3 edges. Proof of Theorem 1.2: For a graph H with h ≥ 3 vertices and f ≥ 3 edges, let H′ be a subgraph of H with at least 3 edges such that γ0(H) = γ(H′). By Theorem 3.6 there exists c > 0 such that g(n, H′, F) ≥ c · n1−γ0(H) log(n · F) 9 for every integer n and a finite field F. Since every H′-free graph is also H-free, it follows that g(n, H, F) ≥ g(n, H′, F) and we are done. 3.4 The Minrank of Graphs with Small Independence Number For an integer t ≥ 3, g(n, Kt, F) is the maximum possible minrank over F of an n-vertex graph with independence number smaller than t. For this case we derive the following corollary. Corollary 3.7. For every t ≥ 3 there exists c = c(t) > 0 such that for every integer n and a finite field F, g(n, Kt, F) ≥ c · n1− 2 t+1 log(n · F) . Proof: Apply Theorem 1.2 to the graph H = Kt, and notice that γ0(Kt) = γ(Kt) = t−2 ( t 2)−1 = 2 t+1. For H = K3, we observe that our lower bound on g(n, K3, F) is nearly tight. Proposition 3.8. There exist constants c1, c2 > 0 such that for every integer n and a finite field F, √n log(n · F) ≤ g(n, K3, F) ≤ c2 ·r n log n . c1 · Proof: For the lower bound apply Corollary 3.7 with t = 3. To prove the upper bound we need a result of Ajtai et al. [1] which says that every triangle-free n-vertex graph has an independent set of size Ω(pn · log n). By repeatedly omitting such independent sets it follows that the chromatic number of such a graph is O(pn/ log n). Now, let G be an n-vertex graph whose complement G is triangle-free. We get that minrkF(G) ≤ χ(G) ≤ O(pn/ log n), as required. 4 Non-bipartite Graphs In this section we show that for every non-bipartite graph H there are H-free graphs with low minrank over R, confirming Theorem 1.3. We start with the case where H is an odd cycle, and since every non-bipartite graph contains an odd cycle the general result follows easily. The proof is by an explicit construction from the following family of graphs. Definition 4.1. For integers m ≤ s ≤ d, the graph K<(d, s, m) is defined as follows: the vertices are all the s-subsets of [d], and two distinct sets A, B are adjacent if A ∩ B < m. The minrank of such graphs over finite fields was recently studied in [18] using tools from [4]. The proof technique of [18] can be used for the real field as well, as shown below. Proposition 4.2. For every integers m ≤ s ≤ d, minrkR(K<(d, s, m)) ≤ s−m ∑ i=0 (cid:18)d i(cid:19). 10 Proof: Let f : {0, 1}d × {0, 1}d → R be the function defined by xiyi − j(cid:17) s−1 j=m(cid:16) ∏ f (x, y) = d ∑ i=1 for every x, y ∈ {0, 1}d. Expanding f as a linear combination of monomials, the relation z2 = z for z ∈ {0, 1} implies that one can reduce to 1 the exponent of each variable occuring in a monomial. It follows that f can be represented as a multilinear polynomial in the 2d variables of x and y. By combining terms involving the same monomial in the variables of x, one can write f as f (x, y) = R ∑ i=1 gi(x)hi(y) for an integer R and functions gi, hi : {0, 1}d → R, i ∈ [R], such that the gi's are distinct multilinear monomials of total degree at most s − m in d variables. It follows that R ≤ ∑s−m Now, let M1 and M2 be the 2d × R matrices whose rows are indexed by {0, 1}d and whose columns are indexed by [R], defined by (M1)x,i = gi(x) and (M2)x,i = hi(x). Then, the matrix M = M1 · MT Finally, let V be the vertex set of K<(d, s, m), that is, the collection of all s-subsets of [d], and identify every vertex A ∈ V with an indicator vector cA ∈ {0, 1}d in the natural way. We claim that the matrix M restricted to V × V represents the graph K<(d, s, m). Indeed, for every A, B ∈ V we have 2 has rank at most R and for every x, y ∈ {0, 1}d it holds that Mx,y = f (x, y). i=0 (d i ). McA,cB = f (cA, cB) = s−1 j=m(cid:16)A ∩ B − j(cid:17). ∏ Hence, for every A ∈ V we have A = s and thus McA,cA 6= 0, whereas for every distinct non- adjacent A, B ∈ V we have m ≤ A ∩ B ≤ s − 1 and thus McA,cB = 0. Since the restriction of M to V × V has rank at most R it follows that minrkR(K<(d, s, m)) ≤ R, and we are done. We turn to identify graphs K<(d, s, m) with no short odd cycles. For this purpose, take an even integer d, s = d 2 , and m = ε · d for a small constant ε > 0. Every path in these graphs is a sequence of d 2 -subsets of [d] such that the intersection size of every two consecutive sets is small. This implies, for a sufficiently small ε, that the sets in the even positions of the path are almost disjoint from the first set, whereas the sets in the odd positions of the path share with it many elements, hence such a graph contains no short odd cycle. This is shown formally in the following lemma. Lemma 4.3. Let ℓ ≥ 3 be an odd integer. For every even integer d and an integer m ≤ d K<(d, d 2 , m) contains no odd cycle of length at most ℓ. 2ℓ , the graph Proof: Fix an odd integer ℓ ≥ 3, an even integer d, and an integer m ≤ d 2ℓ . We prove that for every odd integer ℓ′, such that 3 ≤ ℓ′ ≤ ℓ, the graph K<(d, d 2 , m) contains no cycle of length ℓ′. For such an ℓ′, let A1, A2, . . . , Aℓ′ be a sequence of ℓ′ vertices in the graph, i.e., d 2 -subsets of [d]. Assuming that for every i ≤ ℓ′ − 1 the vertices Ai and Ai+1 are adjacent in the graph, that is, Ai ∩ Ai+1 < m, our goal is to show that A1 and Aℓ′ are not. 11 To this end, we argue that for every i, such that 0 ≤ i ≤ ℓ′−1 2 , we have A1 ∩ A2i+1 ≥ d 2 − 2i · m. (8) We prove this claim by induction on i. The case i = 0 follows immediately from A1 = d that (8) holds for i − 1, that is, A1 ∩ A2i−1 ≥ d 2 − (2i − 2) · m. Observe that this implies that 2 . Assume A1 ∩ A2i = A1 ∩ A2i ∩ A2i−1 + A1 ∩ A2i ∩ A2i−1 ≤ A2i−1 ∩ A2i + A1 ∩ A2i−1 ≤ m + A1 − A1 ∩ A2i−1 ≤ m + 2 −(cid:16) d d 2 − (2i − 2) · m(cid:17) = (2i − 1) · m, where in the second inequality we have used A2i−1 ∩ A2i < m. We proceed by proving (8) for i. Observe that A1 ∩ A2i+1 = A2i+1 − A1 ∩ A2i+1 = A2i+1 − A1 ∩ A2i+1 ∩ A2i − A1 ∩ A2i+1 ∩ A2i ≥ d 2 − m − A1 ∩ A2i, where we have used A2i ∩ A2i+1 < m. Notice that A1 ∩ A2i = d − A1 ∪ A2i = d − (A1 + A2i − A1 ∩ A2i) = A1 ∩ A2i. It follows that A1 ∩ A2i+1 ≥ completing the proof of (8). Finally, applying (8) to i = ℓ′−1 d 2 − m − A1 ∩ A2i ≥ d 2 − m − (2i − 1) · m = d 2 − 2i · m, 2 , using the assumption m ≤ d d d 2 − ℓ′ · m + m ≥ 2 − ℓ · m + m ≥ m, d 2 − (ℓ′ − 1) · m = 2ℓ , we get that A1 ∩ Aℓ′ ≥ hence A1 and Aℓ′ are not adjacent in the graph K<(d, d no cycle of length ℓ′, as desired. 2 , m). It thus follows that the graph contains Equipped with Proposition 4.2 and Lemma 4.3, we obtain the following. Theorem 4.4. For every odd integer ℓ ≥ 3 there exists δ = δ(ℓ) > 0 such that for every sufficiently large integer n, there exists an n-vertex graph G with no odd cycle of length at most ℓ such that minrkR(G) ≤ n1−δ. Proof: Fix an odd integer ℓ ≥ 3. For an integer d divisible by 2ℓ, consider the graph G = K<(d, d 2ℓ . By Lemma 4.3, G contains no odd cycle of length at most ℓ. As for the minrank, Proposition 4.2 implies that 2 , m) where m = d minrkR(G) ≤ d/2−m ∑ i=0 (cid:18)d i(cid:19) ≤ 2H( 1 2− m d )·d = 2H( 1 2− 1 2ℓ )·d, 12 where H stands for the binary entropy function. Since G has V = ( d d/2) = 2(1−o(1))·d vertices, 2ℓ ) < 1 − δ we have minrkR(G) ≤ V1−δ for every sufficiently for any δ > 0 such that H( 1 large integer d. The proof is completed by considering, for every sufficiently large integer n, some n-vertex subgraph of the graph defined above, where d is the smallest integer divisible by 2ℓ such that n ≤ ( d 2 − 1 d/2). Now, Theorem 1.3 follows easily from Theorem 4.4. Proof of Theorem 1.3: Let H be a non-bipartite graph. Then, for some odd integer ℓ ≥ 3, the cycle Cℓ is a subgraph of H. By Theorem 4.4, there exists δ > 0 such that for every sufficiently large integer n, there exists an n-vertex Cℓ-free graph G satisfying minrkR(G) ≤ n1−δ. Since every Cℓ-free graph is also H-free, the result follows. Remark 4.5. As mentioned in the introduction, Theorem 1.3 implies a lower bound on g(n, H, R) for every non-bipartite graph H (see Corollary 1.4). We note that upper bounds on certain Ramsey numbers can be used to derive upper bounds on g(n, H, F) for a general field F. For example, it was shown in [12] that for every ℓ ≥ 3, every n-vertex Cℓ-free graph has an independent set of size Ω(n1−1/k) for k = ⌈ ℓ 2⌉ (see [9, 30] for slight improvements). By repeatedly omitting such independent sets it follows that the chromatic number of such a graph is O(n1/k). This implies that every n-vertex graph G whose complement is Cℓ-free satisfies minrkF(G) ≤ χ(G) ≤ O(n1/k), hence g(n, Cℓ, F) ≤ O(n1/k). Acknowledgements We are grateful to Alexander Golovnev and Pavel Pudl´ak for useful discussions and to the anony- mous referees for their valuable suggestions. References [1] M. Ajtai, J. Koml ´os, and E. Szemer´edi. A note on Ramsey numbers. J. Comb. Theory, Ser. A, 29(3):354–360, 1980. [2] N. Alon. Explicit Ramsey graphs and orthonormal labelings. Electr. J. Comb., 1(R12), 1994. [3] N. Alon. Graph powers. In B. Bollob´as, editor, Contemporary Combinatorics, Bolyai Society Mathematical Studies, pages 11–28. Springer, 2002. [4] N. Alon, L. Babai, and H. Suzuki. Multilinear polynomials and Frankl–Ray-Chaudhuri– Wilson type intersection theorems. J. Comb. Theory, Ser. A, 58(2):165–180, 1991. [5] N. Alon, M. Krivelevich, and B. Sudakov. Maxcut in H-free graphs. Combinatorics, Probability and Computing, 14(5-6):629–647, 2005. [6] N. Alon and J. H. Spencer. The Probabilistic Method. Wiley Publishing, 4th edition, 2016. [7] Z. Bar-Yossef, Y. Birk, T. S. Jayram, and T. Kol. Index coding with side information. In FOCS, pages 197–206, 2006. 13 [8] A. Blasiak, R. Kleinberg, and E. Lubetzky. Broadcasting with side information: Bounding and approximating the broadcast rate. IEEE Trans. Information Theory, 59(9):5811–5823, 2013. [9] Y. Caro, Y. Li, C. C. Rousseau, and Y. Zhang. Asymptotic bounds for some bipartite graph: complete graph Ramsey numbers. Discrete Mathematics, 220(1-3):51–56, 2000. [10] E. Chlamt´ac and I. Haviv. Linear index coding via semidefinite programming. Combinatorics, Probability & Computing, 23(2):223–247, 2014. Preliminary version in SODA'12. [11] B. Codenotti, P. Pudl´ak, and G. Resta. Some structural properties of low-rank matrices related to computational complexity. Theor. Comput. Sci., 235(1):89–107, 2000. Preliminary version in ECCC'97. [12] P. Erd os, R. J. Faudree, C. C. Rousseau, and R. H. Schelp. On cycle-complete graph Ramsey numbers. J. Graph Theory, 2(1):53–64, 1978. [13] P. Erd os and L. Lov´asz. Problems and results on 3-chromatic hypergraphs and some related questions. In A. Hajnal, R. Rado, and V. T. S ´os, editors, Infinite and Finite Sets, pages 609–627. North-Holland, Amsterdam, 1975. [14] P. Erd os, R. J. McEliece, and H. Taylor. Ramsey bounds for graph products. Pacific J. Math., 37(1):45–46, 1971. [15] A. Golovnev, O. Regev, and O. Weinstein. The minrank of random graphs. In Randomization and Approximation Techniques in Computer Science (RANDOM), pages 46:1–46:13, 2017. [16] W. Haemers. On some problems of Lov´asz concerning the Shannon capacity of a graph. IEEE Trans. Inform. Theory, 25(2):231–232, 1979. [17] W. Haemers. An upper bound for the Shannon capacity of a graph. In Algebraic methods in graph theory, Vol. I, II (Szeged, 1978), volume 25 of Colloq. Math. Soc. J´anos Bolyai, pages 267–272. North-Holland, Amsterdam, 1981. [18] I. Haviv. On minrank and the Lov´asz theta function. In Approximation Algorithms for Combi- natorial Optimization Problems (APPROX), 2018. To appear. [19] I. Haviv and M. Langberg. H-wise independence. In Innovations in Theoretical Computer Science (ITCS'13), pages 541–552, 2013. [20] B. S. Kashin and S. V. Konyagin. Systems of vectors in Hilbert space. In Number theory, mathematical analysis, and their applications, volume 157 of Trudy Mat. Inst. Steklov., pages 64– 67. 1981. [21] S. V. Konyagin. Systems of vectors in Euclidean space and an extremal problem for polyno- mials. Mat. Zametki, 29(1):63–74, 1981. [22] L. Lov´asz. On the Shannon capacity of a graph. IEEE Trans. Inform. Theory, 25(1):1–7, 1979. [23] R. Peeters. Orthogonal representations over finite fields and the chromatic number of graphs. Combinatorica, 16(3):417–431, 1996. 14 [24] P. Pudl´ak. Cycles of nonzero elements in low rank matrices. Combinatorica, 22(2):321–334, 2002. [25] P. Pudl´ak, V. R odl, and J. Sgall. Boolean circuits, tensor ranks, and communication complex- ity. SIAM J. Comput., 26(3):605–633, 1997. [26] S. Riis. Information flows, graphs and their guessing numbers. Electr. J. Comb., 14(1), 2007. [27] M. Rosenfeld. Almost orthogonal lines in Ed. DIMACS Series in Discrete Math., 4:489–492, 1991. [28] C. E. Shannon. The zero error capacity of a noisy channel. Institute of Radio Engineers, Trans- actions on Information Theory, IT-2:8–19, 1956. [29] J. Spencer. Asymptotic lower bounds for Ramsey functions. Discrete Mathematics, 20:69–76, 1977. [30] B. Sudakov. A note on odd cycle-complete graph Ramsey numbers. Electr. J. Comb., 9(1), 2002. [31] L. G. Valiant. Graph-theoretic arguments in low-level complexity. In Mathematical Foundations of Computer Science (MFCS), 6th Symposium, pages 162–176, 1977. [32] L. G. Valiant. Why is Boolean complexity theory difficult? In Poceedings of the London Mathe- matical Society symposium on Boolean function complexity, volume 169, pages 84–94, 1992. [33] X. Xu, X. Zheng, G. Exoo, and S. P. Radziszowski. Constructive lower bounds on classical multicolor Ramsey numbers. Electr. J. Comb., 11(1), 2004. 15
1805.10708
1
1805
2018-05-27T23:01:25
Distributed Treewidth Computation
[ "cs.DS" ]
Of all the restricted graph families out there, the family of low treewidth graphs has continuously proven to admit many algorithmic applications. For example, many NP-hard algorithms can be solved in polynomial time on graphs of constant treewidth. Other algorithmic techniques, such as Baker's technique, partition the graph into components of low treewidth. Therefore, computing the treewidth of a graph remains an important problem in algorithm design. For graphs of constant treewidth, linear-time algorithms are known in the classical setting, and well as $\text{polylog}(n)$-time parallel algorithms for computing an $O(1)$-approximation to treewidth. However, nothing is yet known in the distributed setting. In this paper, we give near-optimal algorithms for computing the treewidth on a distributed network. We show that for graphs of constant treewidth, an $O(1)$-approximation to the treewidth can be computed in near-optimal $\tilde O(D)$ time, where $D$ is the diameter of the network graph. In addition, we show that many NP-hard problems that are tractable on constant treewidth graphs can also be solved in $\tilde O(D)$ time on a distributed network of constant treewidth. Our algorithms make use of the shortcuts framework of Ghaffari and Haeupler [SODA'16], which has proven to be a powerful tool in designing near-optimal distributed algorithms for restricted graph networks, such as planar graphs, low-treewidth graphs, and excluded minor graphs.
cs.DS
cs
Distributed Treewidth Computation Jason Li1 1 Carnegie Mellon University, [email protected] Abstract Of all the restricted graph families out there, the family of low treewidth graphs has continu- ously proven to admit many algorithmic applications. For example, many NP-hard algorithms can be solved in polynomial time on graphs of constant treewidth. Other algorithmic techniques, such as Baker's technique, partition the graph into components of low treewidth. Therefore, computing the treewidth of a graph remains an important problem in algorithm design. For graphs of constant treewidth, linear-time algorithms are known in the classical setting, and well as polylog(n)-time parallel algorithms for computing an O(1)-approximation to treewidth. How- ever, nothing is yet known in the distributed setting. In this paper, we give near-optimal algorithms for computing the treewidth on a distributed network. We show that for graphs of constant treewidth, an O(1)-approximation to the treewidth can be computed in near-optimal O(D) time, where D is the diameter of the network graph. In addition, we show that many NP-hard problems that are tractable on constant treewidth graphs can also be solved in O(D) time on a distributed network of constant treewidth. Our algorithms make use of the shortcuts framework of Ghaffari and Haeupler [SODA'16], which has proven to be a powerful tool in designing near-optimal distributed algorithms for restricted graph networks, such as planar graphs, low-treewidth graphs, and excluded minor graphs. Introduction 1 In recent years, there has been an increasing interest in fast distributed algorithms on restricted √ graph families. Part of this recent action stemmed from the widespread lower bound of Ω( n+D) for distributed algorithms on general graphs [5], which holds for many basic graph optimization problems. By restricting the graph networks to exclude the pathological lower bound instances in [5], researchers have found success in beating the lower bound on nontrivial families of graph networks. For example, there are now distributed MST algorithms running in near-optimal O(D · no(1)) time on planar graphs, bounded treewidth graphs, and graphs with small mixing time [7, 10, 11, 8]. Adding onto this line of work, this paper investigates many algorithmic problems on graphs networks of bounded treewidth and gives efficient distributed algorithms running in near-optimal O(D) 1 rounds on these networks, where D is the diameter of the network graph. The concept of treewidth, which dates back to the study of graph minors of Robertson and Seymour [18], has proven fruitful in the quest for efficient classical algorithms for computationally intractable problems. For problems of bounded treewidth, many difficult, NP-hard problems can be solved in polynomial time. Then, with the increasing popularity of the parallel PRAM model, the classical bounded treewidth algorithms were adapted to run in parallel [15, 16]. However, until this paper, nothing was yet known in the distributed setting. 1.1 Results Our main result is a distributed O(1)-approximation algorithm to compute the treewidth of a network graph in O(kO(k) D) rounds of the CONGEST model, where k is the treewidth of the 1 We use O(·) notation to hide polylogarithmic factors in n. © Jason Li; licensed under Creative Commons License CC-BY 42nd Conference on Very Important Topics (CVIT 2016). Editors: John Q. Open and Joan R. Access; Article No. 23; pp. 23:1–23:26 Leibniz International Proceedings in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany 23:2 Distributed Treewidth Computation with Applications network graph G. To state this result in an approximation setting, we say that the algorithm distinguishes the instances where tw(G) > k and the instances tw(G) ≤ O(k). (cid:73) Theorem 1. Given a network graph G and integer k, there is a distributed algorithm running in O(kO(k) D) rounds and either correctly concludes that tw(G) > k, or correctly concludes that tw(G) ≤ 7k + 4. Every node in the network should know the conclusion of the algorithm. Of course, to approximate the treewidth of a network graph G, we simply run the above algorithm with increasing values of k = 1, 2, 3, . . . until the algorithm outputs "tw(G) ≤ 7k + 4"; the running time will be dominated by the last, successful k. Also, observe that the diameter factor, D, is necessary in the running time. Intuitively, this is because treewidth is a global property of a graph; in other words, one cannot say anything about the treewidth by only looking at a local neighborhood around a vertex. For example, given any approximation factor α, consider the network graph consisting of a path of length Ω(n) with a clique of size 2α attached to one end. For the information of the 2α-clique to reach the node v on the other end of the path, the number of rounds required is at least the length of the path, which is Ω(n). Before the 2α-clique reaches node v, the only nodes that v can possibly learn in the network form a path, which has treewidth 1. Therefore, for node v to distinguish between treewidth 1 (the path without the clique) and treewidth 2α − 1 (the path with the clique attached), Ω(n) rounds are needed. Hence, to obtain an α-approximation, Ω(n) = Ω(D) rounds are necessary. Our distributed algorithm follows the outline of the parallel algorithm of Lagergren [15], which approximates the treewidth in kO(k)polylog(n) parallel time. The algorithm of [15] makes repeated calls to an algorithm that finds vertex disjoint paths between two given vertices. Our main technical contribution is a distributed algorithm solving this vertex disjoint paths problem on a graph network of treewidth k in O(kO(1) D) time. This algorithm resembles the parallel vertex disjoint paths problem [14], but new ideas are required to construct a distributed algorithm. Our main insight is in viewing the algorithm of [14] in a graph contraction-based setting, and then applying the recent technology of partwise aggregation in distributed computing [7, 9, 14]. Outside of this subroutine, we adapt the framework of [15], which computes a treewidth decomposition given this subroutine, to the distributed setting. (cid:73) Lemma 2. Given a graph G = (V, E) of treewidth at most k and two vertices s, t ⊆ V , we can either find k vertex-disjoint s-t paths, or output an s-t node cut of size less than k, in O(kO(1) D) rounds. In the former case, every node knows whether it is on a path, and if so, its predecessor and successor on that path. In the latter case, every node knows the fact that k vertex-disjoint paths do not exist, as well as whether it is in the node cut. Perhaps more importantly, the algorithm of Theorem 1 also outputs a distributed version of a treewidth decomposition. Using this decomposition, we can solve many computationally difficult problems on bounded treewidth graph networks like in the classical setting. (cid:73) Theorem 3. Let G be a graph network with treewidth k. The problems maximum independent set, minimum vertex cover, chromatic number, and minimum dominating set can be solved in O(kO(k) D) rounds on network G. We remark that we can extend Theorem 3 to solve many other optimization problems that are tractable on bounded-treewidth graphs. 1.2 Related Work The shortcuts framework was introduced by Ghaffari and Haeupler [7], who used it to solve MST and (1 + )-approximate minimum cut on planar graphs in near-optimal O(D) time. This framework was expanded on in [10, 11], generalizing these algorithms to run on bounded-genus J. Li 23:3 and bounded-treewidth graphs in O(D) time. Lately, [13] studied the shortcuts framework on minor-free graphs, leading to O(D 2)-round distributed algorithms for these problems on graphs excluded a fixed minor. Efficient algorithms that do not use the shortcuts framework also exist. Recently, Ghaffari et al. [8] give a distributed algorithm for MST in time proportional to the mixing time of the network graph. For well-mixing graphs, such as expanders and random graphs, the algorithm runs in 2O(√log n log log n) time. The graph-theoretic property treewidth was introduced in Robertson and Seymour's study of graph minors [18]. Since then, it has seen many algorithmic applications in solving NP- hard problems, such as maximum independent set and chromatic number, efficiently on bounded treewidth graphs; for an extensive study, see [17]. The algorithmic problem of computing or approximating the treewidth of a graph has also been studied extensively. Computing the treewidth exactly is NP-hard [2], but admits an √ O( log k) approximation in polynomial time [1, 6], where k is the treewidth of the input graph. For small values of k, faster algorithms were known since the work of Robertson and Seymour [18]. Bodlaender [3] gave the first linear-time algorithm for fixed k, running in 2O(k3) n time. In the par- allel setting, computing an O(1)-approximation of the treewidth can be done in kO(k)polylog(n) time using O(n) processors [15, 16]. Preliminaries 2 All of our algorithms work under the CONGEST model of distributed computing. There is a network G = (V, E) of n nodes and diameter D. On each synchronous round, every node can send an O(log n)-bit message to each of its neighbors in G, possibly a different message to each neighbor. We assume that between synchronous rounds, every node can perform unbounded local computation. Throughout the paper, G will always represent the graph network, and D its diameter. Given any graph H, let V (H) and E(H) denote the vertices and edges of H. For a vertex v ∈ V , denote N(v) as the neighbors of v in G. For a vertex set S ⊆ V , denote N(S) as the neighbor of set S in G, i.e., the vertices in V − S with a neighbor in S, and define N[S] := N(S) ∪ S. A path in H is a sequence of vertices such that adjacent vertices are neighbors in H. A path is simple if no vertex appears twice on the path. For vertices s, t ∈ V , an s-t path is a (not necessarily simple) path connecting s and t, and a vertex set S is called a vertex cut if it intersects every s-t path in G. Lastly, for a positive integer r, let [r] denote the set {1, 2, . . . , r} of positive integers from 1 to r. 2.1 Partwise and Subgraph Aggregation The shortcuts framework of Ghaffari and Haeupler [7] has proved fruitful in designing distributed algorithms on restricted graph families. The inner workings of shortcuts is not necessary for the scope of this paper. Rather, we abstract out the primary task that is accomplished through the shortcuts framework, which we define as Partwise Aggregation (PA), following [9]. (cid:73) Definition 4 (Partwise Aggregation [9]). Let G = (V, E) be a network graph, and let P = (P1, . . . , PP) be a collection of pairwise disjoint and connected subsets Pi ⊆ V , called parts. For each part Pi, every node v ∈ Pi knows the set N(v) ∩ Pi, i.e., which of its neighbors belong i Pi has an integer xv of O(log n) bits, and let ⊕ be an associative function operating on integers of length O(log n). Every node in Pi wants to xv, i.e., the aggregate ⊕ of all of the values xv in Pi. We call such a task partwise aggregation with operator ⊕. to its part. Suppose that every node v ∈ S learn the valueL v∈Pi CVIT 2016 23:4 Distributed Treewidth Computation with Applications The power of the shortcuts framework is that it allows us to solve this partwise aggregation (PA) problem quickly, especially if the network graph G has special structure. We provide an intuitive description below, referring the reader to [7] for more details. In an ideal case, if for every part Pi, the diameter of G[Pi] is O(D), then every part Pi can simply aggregate inside G[Pi] in O(D) rounds. The trouble is when the diameter of G[Pi] much larger than D, the diameter of G. The shortcuts framework resolves this issue by allowing these "long and skinny" parts to borrow edges from the rest of the network G to aid in their partwise aggregation. For a part Pi, the borrowed edges Hi should satisfy the property that the diameter of G[Pi] ∪ Hi is now comparable to the diameter of G. On the other hand, it is not ideal for a single edge in G to be borrowed by too many parts, since it would induce "congestion" along the edge. The shortcuts framework computes an appropriate set Hi of borrowed edges for each part Pi while satisfying two conditions: (i) the diameter of G[Pi] ∩ Hi is small for each Pi, and (ii) no edge in G appears in too many Hi. Each part Pi then executes its aggregation on the graph G[Pi] ∩ Hi. A recent line of work [10, 11, 13] has built on the initial shortcuts framework of [7], leading to near-optimal PA algorithms for many special classes of graphs. (cid:73) Theorem 5 ([7, 10, 11, 13]). For any associative operator ⊕, we can solve the partwise aggreg- ation problem in O(QG) rounds, where QG is a parameter that depends on the graph G and its diameter D, as follows: √ 1. For all graphs G, QG = O( n + D). √ 2. If G has genus g, QG = O( g + 1D). 3. If G has treewidth k, QG = O(kD). 4. If G excludes a fixed minor H, QG = O(f(H) · D 2), where f is a function depending only on H. We will define a PA round to be one iteration of PA, where every node participating in PA initially knows its part ID, its value xv, and the common operator ⊕, and at the end, every node learns the aggregate ⊕ of its part. Observe that the well-studied broadcast procedure can be formulated as a PA problem: if a leader node v in a part Pi wants to broadcast its value x, then we set xv ← x, xu ← −∞ (more precisely, some O(log n)-bit encoding of −∞) for all u ∈ Pi − v, and ⊕ to be the max function. The PA round assumes that every node knows the ID of its part. Often, we will not have this luxury: each node does not know its part ID, but only which of its neighbors also belong to its part, and in some cases, only a subset of this. Below, we formulate an aggregation task with this weaker assumption, and show that it can be solved using O(log n) iterations of PA as defined in Definition 4. (cid:73) Definition 6 (Subgraph Aggregation). Let G = (V, E) be a network graph, let P = (P1, . . . , PP) be a collection of parts, and for each Pi ∈ P, let Hi be a connected subgraph of G on the nodes in Pi, not necessarily the induced graph G[Pi]. Suppose that for each subgraph Hi, every node in V (Hi) knows its neighbors in the subgraph Hi and nothing else. Suppose that every node i Pi has an integer xv of O(log n) bits, and let ⊕ be an associative function operating xv, i.e., the aggregate ⊕ of all of the values xv in Pi. We call such a task subgraph aggregation with operator ⊕. v ∈ S on integers of length O(log n). Every node in Pi wants to learn the value L v∈Pi Likewise, we define SA round to be one iteration of subgraph aggregation (SA), where every node v ∈ Pi knows its neighbors in Hi, its value xv, and the common operator ⊕, and at the end, learns the aggregate ⊕ of its part. The following lemma shows that while SA has a weaker assumption, it is no harder than partwise aggregation modulo an O(log n) factor. While this result has been implied in the literature, e.g., in [12], this is the first time it has been stated explicitly. We defer the proof of the following lemma to Appendix A. J. Li 23:5 (cid:73) Lemma 7. One SA round can be solved in O(log n) PA rounds. Combining Lemma 7 with Theorem 5 gives the following corollary for treewidth k graphs, which is the result we will use in this paper. Since SA solves a stronger problem than PA or broadcast, we will only use the term SA for the rest of the paper. In fact, the following corollary will be the only result in this section that is used for the rest of the paper. (cid:73) Corollary 8. On a graph network of treewidth k, one SA round can be solved in O(kD) rounds. 2.2 SA Helper Routines Our main algorithms will use the following routines, all of which reduce to computing O(log n) rounds of SA. The proof of the statement below is deferred to Appendix A. (cid:73) Lemma 9 (Spanning Tree). Given a connected subgraph H ⊆ G of the network graph, we can compute a spanning tree of G in O(log n) SA rounds. Every node knows its neighbors of the spanning tree. (cid:73) Lemma 10 (Rooted Tree Aggregation). Consider a tree T in G. Given a root vr ∈ V (T), we can compute the tree T rooted at vr in O(log n) SA rounds, so that every node in V (T) − vr knows its parent in the tree T rooted at vr. Moreover, if each node vi knows an integer xi, and a common associative operator ⊕, then we can let each node vi learn the subtree aggregate j∈T (vi) xj, where T(vi) is the subtree rooted at vi, i.e., all nodes in T whose path to the root L contains vi. (cid:73) Lemma 11 (Path Aggregation). Consider a directed path P = {v1, . . . , v'} in G, where each node vi knows its predecessor and successor on the path. In O(log n) SA rounds, each node vi can learn the value of i, its index in the path. Moreover, if each node vi knows an integer xi and j≤i xj and a common associative operator ⊕, we can let each node vi learn the prefix aggregateL suffix aggregateL j≥i xj. (cid:73) Lemma 12 (s-t Path). Given a connected subgraph H ⊆ G and two vertices s, t ∈ V , we can compute a directed s-t path in G in O(log n) SA rounds. Every node knows whether it is on the path, and if so, its predecessor and successor nodes on that path. The Vertex-disjoint Paths Algorithm 3 This section is devoted to proving the following lemma. It is the most technical section of the paper, as well as our main technical contribution. (cid:73) Lemma 13. Given a graph G = (V, E) of treewidth at most k and two vertices s, t ⊆ V , we can either find k vertex-disjoint s-t paths, or output an s-t node cut of size less than k, in O(kO(1) D) rounds. In the former case, every node knows whether it is on a path, and if so, its predecessor and successor on that path. In the latter case, every node knows the fact that k vertex-disjoint paths do not exist, as well as whether it is in the node cut. When we are talking about graph algorithms in general, not necessarily in the distributed setting, we will use the term vertices. When talking about actual nodes in a distributed network, we will use the term nodes. This is to distinguish between graphs (in the graph-theoretic sense) and the physical graph network. Often times, it is simpler to first explain an algorithm in a classical setting, and then adapt it to run on a distributed network. For most of this section, we will take this approach, explaining our distributed implementation in gray boxes. CVIT 2016 23:6 Distributed Treewidth Computation with Applications 1 2 1 1 1 , . . . , u' and the node set v 1 , . . . , v' with a complete bipartite graph Kr,r. Before introducing our distributed algorithm, we first make one important transformation of the network graph that will be useful later on. Define G' to be the following graph: for each node v ∈ G, we add r corresponding nodes v , . . . , v' in G'. For each v ∈ G, we connect the nodes v , . . . , v' in a clique Kr, and for each edge (u, v) in G, we connect the 1 node set u We would like to simulate the network G' using the network G. In particular, we show how to simulate a T-round algorithm on the network G' in O(' T) rounds on the original network G. We let every node v ∈ V (G) in the original network simulate the nodes v , . . . , v' in G'. That is, node v performs the computations that nodes v , . . . , v' perform in the algorithm on G'. Observe that two nodes ui, vj ∈ V (G') can communicate in G' iff either u = v, or the nodes u, v ∈ V (G) that simulate them can communicate in G. If u = v, then since the same node u simulates ui and vj, no communication between nodes in G is needed. If u 6= v, then the edge (u, v) ∈ E(G) in the original network is responsible for ' 2 communicating edges in G', namely the edges (ui, vj) for i, j ∈ [']. Therefore, for each round of the algorithm on G', 2 messages in G' through the edge (u, v) ∈ E(G). we can take ' It is easy to see that the diameter of G' is also D. The claim below, whose proof is deferred to Appendix B, bounds the treewidth of G'. By Corollary 8, one SA round on G' can be solved in O(k'D) rounds on O(k'D), and the above argument shows that it can be simulated in O(k' (cid:73) Claim 14. If G has treewidth k, then G' has treewidth O(k'). 2 rounds to pass the at most ' 3 D) rounds on G. For the rest of this section, we will always either run our distributed algorithm directly on G, or run it first on G' for some ' and then simulate it on G. In the latter case, we will simply state that the algorithm is run on G'; simulating it on G is implied. The algorithm models off of the one of [14] for approximating the treewidth in a parallel model. However, new ideas are required to adapt the algorithm in a distributed model. In particular, as we will see, we need to adopt a graph contraction-based approach to support the use of SA. The algorithm is iterative and represents the original Ford-Fulkerson algorithm for maximum flow. It maintains a set of disjoint s-t paths, and, on each iteration, either increases the number of disjoint paths by one through an augmenting path step, or certifies that it is not possible to reach k disjoint paths. On the first iteration, the algorithm simply needs to find a single s-t path. This can be done by Lemma 12. On a general iteration, for the rest of this section, we assume that the algorithm knows r vertex-disjoint paths for 1 ≤ r < k, and needs to find r + 1 vertex-disjoint paths. In the distributed setting, we assume that each node in a path knows its neighbor(s) on the path. We now make each node on a path learn its index on the path; this can be accomplished with Lemma 11 (on network G). In addition, we would like to assign each of the r paths a unique path ID in [r], known to all nodes in the path. This can be accomplished on network G as follows: first, each node sets xv ← ID(v) if v belongs in a path, or −∞ otherwise. Then, we compute the maximum xv inside G using SA. The (unique) node u with xv = maxv xv notifies this event to all nodes in its path P using SA. We assign path P the ID r, known to all its nodes. Then, all nodes in path P drop out of the future path ID computations (i.e., they set xv ← −∞ from now on). There are r − 1 paths left; we iterate with r ← r − 1 until we are done. J. Li 23:7 3.1 The Residual Graph Recall the setting: the algorithm knows r vertex-disjoint paths and tries to find r + 1 vertex- disjoint paths. Our algorithm maintains a reachability graph, a directed graph with a source s and sink t, such that there is an augmenting path in G iff t is reachable from s in this directed graph. Its construction is directly modeled off of the residual graph from the Ford-Fulkerson algorithm and is similar to the "graph decomposition into bridges" in [14]. In general, directed reachability is a hard problem in distributed models and even parallel models, but we will exploit the special structure of the residual graph in the k-vertex disjoint paths problem in order to compute s → t reachability efficiently. Construction of the reachability graph. The steps in our construction are illustrated in Figure 1. First, we construct a directed graph G0 res which represents the residual graph in the Ford-Fulkerson algorithm following the standard reduction from the vertex-disjoint paths for each vertex v ∈ V − {s, t}, create problem to the (directed) edge-disjoint paths problem: two vertices vin and vout with a directed edge (arc) (vin, vout), and for each (undirected) edge (u, v) ∈ E, add the two arcs (uout, vin) and (vout, uin). The following fact follows from standard analysis of the Ford-Fulkerson algorithm. (cid:73) Fact 15. There is an augmenting path in G iff there is a directed s → t path in G0 res. We now modify the Ford-Fulkerson residual graph G0 res as follows: for each vertex v ∈ V not on one of the r vertex-disjoint paths, we contract the vertices {vin, vout} into a single vertex v. The resulting graph is our residual graph Gres. (cid:73) Corollary 16. There is an augmenting path in G iff there is a directed s → t path in Gres. Proof. Observe that this contraction does not create new, simple s → t paths, since given any simple directed s → t path P in Gres, for each vertex v ∈ P not on one of the r vertex-disjoint paths, replace the occurrence of v with vin, vout in that order; the resulting path is a directed s → t path P in G0 res. Clearly, since we only contract vertices, we do not destroy any s → t paths. Therefore, there is a directed s → t path in Gres iff there is one in G0 res, and the statement (cid:74) follows from the equivalence in Fact 15. In fact, since there is always a t → s path in Gres, we can translate this statement in terms of strong connectivity. (cid:73) Corollary 17. There is an augmenting path in G iff s and t are strongly connected in Gres. The notion of strongly connected components forms the basis of our distributed algorithm. Throughout the algorithm, such as in the next step, we will modify the reachability graph in ways such that s and t are strongly connected after the contraction iff they were strongly connected before. 1 2 ∈ V (G , v , t Let Gres denote the graph Gres with its arcs replaced by undirected edges (with parallel 2 as follows: the edges removed). Observe that we can "embed" Gres as a subgraph of G nodes vin, vout ∈ V (Gres) map to v 1 2), and the nodes s, t map to s 1. Therefore, 2. From now on, every time we say the distributed we can simulate the network Gres using G algorithm runs on the network Gres, we mean that it runs on G For each connected component B in G −S G −S j V (Pj), we also have B ⊆ V (Gres); we call B a bridge in Gres, following the terminology of [14]. Suppose we number the bridges B1, B2, . . .. We claim that Bi is strongly connected in the Gres. Indeed, for each edge (u, v) in the graph res, so the contracted vertices j V (Pj), the two arcs (uout, vin), (vout, uin) are present in G0 2 with this embedding. CVIT 2016 23:8 Distributed Treewidth Computation with Applications s t s t vin vout vB2 β1 vin vout s β2 t s t vB1 Figure 1 Top left: the graph G with source s and sink t. The black vertices mark the one existing path found so far. Top right: The residual graph G0 res from the Ford-Fulkerson algorithm. Bottom left: The reachability graph GR vertices only. The two ellipses are the bridges. Bottom right: The same reachability graph GR. The red arcs mark a directed s → t path, which corresponds to a valid augmenting path. u, v in Gres are connected by both arcs (u, v) and (v, u). Since Bi is connected by such bi-directed arcs, it is strongly connected in Gres. We now proceed to contruct a reachability graph GR. First, for each bridge Bi, contract it into a single vertex βi, since Bi is strongly connected, this does not change whether or not s and t are strongly connected. For each edge (u, v) in one of the r current paths where u is to the left of v, we remove the arc (vout, uin). This does not affect the SCCs, since uin is still reachable from vout along the path vout → vin → uout → uin. For each of the r existing vertex-disjoint paths P in G, the set of vertices {vin, vout} in the reachability graph now form a directed path from t to s; see Figure 1. We number these directed paths P1, . . . , Pr. For each such directed path Pi and two vertices u, v ∈ V (Pi), we say that u is to the left of v if v can reach u on the directed path Pj. Equivalently, we say that v is to the right of u. We also form a linear ordering of V (Pj) ∪ {−∞, +∞}, where u < v iff u is to the left of v, and v > −∞ and v < +∞ for all v ∈ V (Pj). Also, for each j ∈ [r], arrange Pj in rightward order as v1, . . . , vPj (so that v1 is adjacent to s), and for each i ∈ [Pj], define π(vi) := i, the index of vi on the path Pj. j Pj) ∪ {βi : bridge Bi}, constitutes our The resulting directed graph, whose vertices are (S that we can communicate within each bridge Bi using SA. Initially, every node inS reachability graph GR. For the distributed setting, the motivation for viewing the bridges Bi as single vertices βi is j V (Pj) broadcasts to its neighbors the fact that it belongs to some Pj. Then, for each bridge Bi, each node in VBi knows that its neighbors in Bi are precisely the neighbors from which it did not receive a broadcast. This knowledge is exactly what is needed for a single SA round. Construction of the bridge graph. J. Li 23:9 We next construct the bridge graph similarly to [14]. For a bridge Bi and a path Pj, let lj i be the leftmost ingoing neighbor of βi on Pj in GR, (βi) ∩ Pj) according or −∞ if such a neighbor does not exist. In other words, lj to the linear ordering of Pj, or −∞ if the set N(Bi) ∩ Pj is empty. Similarly, let rj i be the rightmost outgoing neighbor of Bi on Pj, or ∞ if such a neighbor does not exist. In other words, i − 1; i ≥ lj (βi) ∩ Pj). Observe that, by the construction of GR, we always have rj + i = max(N rj GR see Figure 1. i = min(N− GR By Lemma 11, we can assume that each node v ∈ Pj knows its index on the path. Then, in 2k SA rounds, every node in every bridge Bi can learn the values lj i . First, every node on Pj broadcasts its index to all its neighbors in Gres. Then, for each bridge Bi, every node v ∈ Bi sets xl v as the minimum index received from an in-neighbor of Pj in Gres, and v as the maximum index received from an out-neighbor of Pj in Gres. Then, in two sets xr SA rounds, every node learns the minimum xl v within its bridge, which are the values li v and maximum xr i and rj j and ri j. We now construct the bridge graph GB. 1. The vertices of GB is the set {βi : Bi is a bridge}. 2. For two bridges Bi, Bx and j ∈ [r], add an arc (βi, βx) to a set Dj if: a. For some path Py, ly x ≤ ry i . Intuitively, this means that we can reach Bx from Bi in GR by traveling leftward from ry i to ly x along path Py. b. We have rj x > rj i . Intuitively, this means that we make "progress" along path Pj, in that we can now reach a vertex in Pj further to the right. c. There is no βz such that βz satisfies the above two conditions, and either rj x, or x and ID(Bz) > ID(Bx). In other words, ties are broken by ID (assume that each z > rj z = rj rj bridge has a unique ID). For each Dj, we add all arc in Dj to GB. We say that a node βi is s-reachable if there is a node in Bi with s as an in-neighbor. Likewise, we say that a node βi is t-reachable if there is a node in Bi with t as an out-neighbor. x and rj We can compute the arc set Dj in a distributed fashion, such that for each βi, every node in Bi knows the arc (βi, βx) ∈ Dj, if any. We assume that every bridge Bx has x for all j ∈ [k]. First, each node v ∈ Bx broadcasts the value computed the values lj x), ID(Bx)) to each in-neighbor in Gres on a path Py. Then, every path Py computes (π(rj a prefix maximum of the values (π(rj x), ID(Bx)) sent on the previous step. By maximum, we mean lexicographic, so ties are broken by highest ID(Bx); if nothing is sent over a given prefix, then the maximum is −∞ with an arbitrary ID. By Lemma 11, this maximum can be computed in parallel for each Pj in O(log n) SA rounds. At this point, for each y ∈ [k] and node v ∈ Py, we have computed the maximum rj x ≤ v. We now have every node v ∈ Py broadcast this maximum over all nodes βx with ly x), ID(Bx)) to its in-neighbors in Gres. Finally, every bridge Bi computes the maximum (π(rj (π(rj x), ID(Bx)) received by one of its nodes through a SA round. If the maximum value rj satisfies rj i , then every node in Bi now knows the arc (βi, βx) in Dj. x > rj x x We remark that our bridge graph contruction is slightly different from the one in [14], in order to make it more amenable to distributed computing. We have a statement similar to Theorem 4.1 from [14], stating an equivalence between the residual graph and the bridge graph. By Fact 15, this equivalence also extends to augmenting paths in G. Because the proof resembles the one in [14], we defer it to Appendix B. CVIT 2016 23:10 Distributed Treewidth Computation with Applications (cid:73) Lemma 18. There is an augmenting path between s and t in G iff there exists s-reachable βi and t-reachable βx and a directed βi → βx path in GB. Like in [14], our next goal is to determine whether there is an s → t path in GB. Of course, since directed reachability is a difficult problem in general, we need to exploit the special structure of GB. [14] proceeds by iteratively shortcutting the graph, while we proceed using contraction. This deviation from [14] is the main technical contribution of the paper. From now on, we abuse notation, sometimes referring to Dj as the directed graph whose arcs are precisely Dj. Observe that for each j ∈ [r], every vertex has out-degree at most 1 in Dj. Also, the directed graph Dj is acyclic, since an arc βi → βx implies that rj i . It follows that Dj is composed of rooted trees, where the arcs point from away from the leaves towards the root. We now show that every rooted tree in Dj is in fact strongly connected in GR. (cid:73) Claim 19. Suppose βi and βx belong in the same rooted tree in Dj. Then, βi and βx are strongly connected in Gres. Proof. It suffices to prove the statement for pairs βi, βx where arc (βi, βx) exists in Dj. By condition 2(a) in the construction of GB, there ia a path Py with ly i . Therefore, from βi, we move to ry x, then i − 1), and finally back to βi, showing strong connectivity. (cid:74) along Pj to lj With the bridge graph GB computed, our two remaining steps are: (i) determine if there exists s-reachable βi and t-reachable βx and a directed βi → βx path in GB, and (ii) return an augmenting path or a node separator of size r, depending on the outcome of (i). i , then (left) along Py to ly i (since rj x, and then to βx. From βx, we can move to rj x ≤ ry For the rest of this section, we will shift our main focus from the classical setting to the distributed setting. That is, we will explain our algorithm from a distributed point of view, rather than commenting on distributed implementations in gray boxes. x > rj x > rj i ≥ lj 3.2 Solving the Bridge Graph Our distributed algorithm differs from the one in [14] by using a contraction-based approach, rather than a shortcutting-based one. A high-level outline of our algorithm is as follows. First, we contract every rooted tree of D1, or equivalently, every connected component in D1, the underlying undirected graph of D1. We now recompute the bridge graph with the corresponding bridges of each connected component merged into a single super-bridge in Gres. We repeat this process for the remaining j ∈ [r]: contract every connected component in Dj, recompute the bridge graph, and repeat. The lemma below states the desired property of the contraction algorithm. The proof is deferred to Appendix B due to its length. (cid:73) Lemma 20. At the end of the contraction algorithm, there exists s-reachable βi and t-reachable βx that contract to the same vertex iff s and t are strongly connected in Gres. First, for each j ∈ [r], in the distributed computation of the bridge graph GB, we can augment the computation of the arc (βi, βx) in Dj (if any) so that for each Bi, not only do the nodes know βx, but also (i) ID(Bx), (ii) the minimum2 value y ∈ [r] for which ly i , and (iii) the value π(ly x); this simply requires broadcasting the auxiliary information on each step, and breaking ties by value of y. Observe that since βi and βx belong in the same SCC in Gres, so do all nodes v ∈ Py with ly We now describe our algorithm for contracting the connected components in D1. Our next 1 C in Gres spanning the goal is to find, for each connected component C in D1, a subgraph H x ≤ v ≤ ry i . x ≤ ry 2 It is not important that this is minimum and not maximum or even arbitrary. However, we assume minimum because uniqueness will make our analysis easier to present. J. Li 23:11 bridges Bi whose nodes βi are in that component. Every node in the subgraph should know its neighbors in the subgraph. Moreover, this subgraph should be a tree, a property that will be useful later for recovery. For each arc (βi, βx) in C, consider the corresponding pair (ly i into H i ) as mentioned above. We x, ry want to connect together all nodes v ∈ Py with ly x ≤ v ≤ ry 1 C. In other words, each node v ∈ Py should know whether there exists an (ly x < v ≤ ry i ; if so, the node i ) pair such that ly x, ry v connects to its leftward adjacent node on Pj. We accomplish this task as follows: first, every bridge Bi with an arc (βi, βx) in D1 and corresponding pair (ly x) to node i , which is necessarily adjacent to Bi in Gres. Then, for each y ∈ [r], the nodes on Py compute ry x) values. It is clear that for each node v ∈ Py, there exists a suffix minimum of the sent π(ly (ly i iff the suffix minimum at v is strictly less than π(v). Therefore, v joins x, ry its leftward neighbor iff its suffix minimum is less than π(v). i ) sends the value π(ly x < v ≤ ry i ) with ly x, ry Observe that if node v has suffix minimum exactly π(v), then node v is at the left endpoint x is exactly π(ly x = ly x0. i ) pair. We claim that the converse is true. of some (ly (cid:73) Claim 21. Suppose the arc (βi, βx) exists in D1, and consider the minimum y ∈ [r] such that x ≤ ry x). Moreover, there does not exist an arc i . Then, the suffix minimum at ly ly (βi0 , βx0) in D1 such that x 6= x0 and ly Proof. Suppose the first statement is false. Then, there is some other arc (βi0 , βx0) in Dj such 1 that ly x and ID(Bx0) > ID(Bx). Then, 1 i , βx0 violates condition 2(c) for (βi, βx) in the definition since ly 1 1 of the bridge graph, contradiction. The other case, assuming that either r x = r x0 and ID(Bx) > ID(Bx0) is symmetric: we have βx violating condition 2(c) for (βi0 , βx0). For the second statement, if such an arc (βi0 , βx0) exists, then without loss of generality, assume that x and ID(Bx0) > ID(Bx) (we swap x and x0 otherwise). Then, since 1 either r x0 ≤ ly (cid:74) ly 1 x0 > r x, we can apply the proof of the first statement to get a contradiction. i0. Assume that either r i and r x0 ≤ ly x0 ≤ ly x ≤ ry x ≤ ry 1 x0, or r x0 ≥ r 1 1 x, or r 1 x, or r 1 x0 > r 1 x0 = r 1 x0 = r 1 x > r 1 x > r x, ry This finishes the edges of H 1 C within each Pj. Of course, we can repeat the above in parallel for each connected component C in D1. We now augment the above computation so that when computing suffix minimum, the value ID(Bx) is recovered along with the minimum π(ly x). Then, if a node v ∈ Py has suffix minimum exactly π(v), then v connects to its neighbor(s) in Bx in 1 C, where C is the component containing βx. Then, for each arc (βi, βx) in D1 and minimum y H 1 for which ly C, where C is the component containing βi. 1 Finally, within each bridge Bi, add a spanning tree of Bi into the corresponding subgraph H C using Lemma 9. This concludes our construction of the subgraph for each connected component in D1. i , the bridge Bi connects to ry x ≤ ry i in H We now prove some properties of the subgraphs H 1 C. The tree property below does not help us in the contraction phase, but it will help in recovering paths in the recovery phase. (cid:73) Claim 22. The subgraphs H 1. For every connected component C in D1, there is a subgraph spanning (precisely) the bridges 1 C satisfy the following properties: in C. 2. Any two subgraphs are disjoint. 3. Every subgraph is a tree. i → ly x on Py and the path ry Proof. Claim 21 implies the following statement: for any two arcs (βi, βx), (βi0 , βx0) in D1, either x0 on Py are disjoint, or x = x0. If x = x0, then the arcs the path ry (βi, βx), (βi0 , βx0) belong to the same connected component in D1. Therefore, if (βi, βx), (βi0 , βx0) i → ly belong to different connected components, then the segments ry x0 do not 1 intersect. It is easy to see by the algorithm that each constructed H C is disjoint. This proves (1) and (2). i0 → ly x and ry i0 → ly CVIT 2016 23:12 Distributed Treewidth Computation with Applications 1 r 1 1 r 2 1 r 3 1 r 4 1 r 5 B1/β1 D1 D1 B4/β4 D1 B2/β2 B5/β5 7 2 l 7 r 1 7 l 5 7 r 4 D1 B3/β3 9 4 l 1 r 1 1 r 2 9 r 2 9 r 3 1 r 3 1 r 4 B1/β1 B1/β1 B4/β4 B4/β4 B2/β2 B2/β2 1 r 5 B5/β5 B5/β5 7 2 l 7 r 1 7 l 5 7 r 4 B3/β3 B3/β3 9 4 l 9 r 2 9 r 3 P1 P7 P9 P1 P7 P9 Figure 2 Top: the bridges Bi with their relevant edges li red edges mark the arcs in D1 connecting the βi. Bottom: the subgraph H1 component {β1, β2, β3, β4, β5} in D1. j, rj i in green and blue. The dotted C for the connected For property (3), fix a subgraph H 1 C is acyclic. Suppose we take H 1 C by construction. Therefore, the subgraph H C. For each βi ∈ C, the corresponding bridge Bi induces 1 1 C is acyclic iff the graph obtained by a tree in H 1 contracting each bridge Bi in H C and contract each Bi into a vertex βi, so that the new graph, called H, is now a subgraph of GR. To prove that H is acyclic, we start with D1 and transform it into H while preserving the acyclicity of D1. For each βx ∈ C 1 with positive in-degree in D1, let βx1 , . . . , βx' be the in-neighbors of βi. In H C, the algorithm 1 C; in addition, for each βxi, the adds the union of the (now undirected) paths ry xi algorithm adds an edge connecting Bxi to ry . The set of edges added is a tree connecting the vertices βx, βx1 , . . . , βx' of H; call this tree Tx. For each βx in D1, we delete the edges (βx, βxi) in D1 and add T (as well as any extra vertices). Since we always delete a tree and add back a 1 C, proving tree, the graph remains acyclic. At the end, we have added exactly the edges in H (cid:74) that H 1 C is connected by property (1), so it is a tree. 1 C is acyclic. Lastly, H x to H → ly xi 1 Since the subgraphs H 1 C are disjoint, they serve as the nodes after contracting every connected component of D1 in the classical algorithm, and we can communicate within each contracted component in one SA round. We would like to continue this algorithm for j = 2, . . . , r, always maintaining subgraphs H j C that are trees spanning the super-bridges in the connected components of Dj, but we run into the following obstacle: when constructing the subgraph on the next 1 C inside the paths Pj. iteration, we might reuse edges in E(H Reusing these edges may destroy the tree property of H j C. We fix this problem as follows. Our goal is to construct a graph G 2r , . . . , vr, (the same way Gres embeds into G connected together in a clique, with each node vj sharing the same neighbors as v. Let us call + embeds into (Gres)r and Gres embeds into G, which means this network G that G C) ∩ E(S 2). Replace each node in v ∈S j Pj), i.e., the edges in H + that "embeds" into G j Pj with r copies v + embeds into G We run the algorithm on G + instead, which we then simulate on G. For the first iteration j = 1, every node v i Pi. This way, in future iteration j = 2, . . . , r, we always have a fresh set of nodes, namely the nodes vj, to use in iteration j. For 1 now takes the role of node v ∈ S +. Observe that G 2r. 1 J. Li 23:13 takes the role of node v ∈S iteration j = 2 . . . , r, we repeat the algorithm for j = 1 with three main differences: (i) before the iteration, every super-bridge is now the nodes in some H j−1 C , (ii) we do not add a spanning tree inside each bridge, since we already have one from iteration j − 1, and (iii) every node vj now i Pi. Since our algorithm emulates the classical algorithm, we know by Lemma 20 that after all r iterations, there is a directed s → t path iff there is an s-reachable bridge and a t-reachable bridge in the same subgraph H r C. Our next goal is to, depending on this outcome, either find an augmenting path in Gres or find an s-t node cut of size at most r. 3.3 Finding an Augmenting Path C. If there exists a subgraph H r First of all, it is easy to test if there exists a subgraph H r C with both an s-reachable and t-reachable bridge: in two SA rounds, the s-reachable bridges and the t-reachable bridges broadcast in their subgraphs H r C with both s-reachable and t-reachable bridges, then we show how find an augmenting path in Gres. Note that this task is not trivial, since while there exists a (unique) path from the s-reachable and t-reachable bridges in H r C, this path may go rightward along a path Pj, which is not allowed. 1 C, there already exist an s-reachable bridge Bs and a t-reachable bridge Bt. Let βx be the "root" of the component (tree) C in D1, i.e., the 1 C only goes left along unique βx with no out-arc in D1. The unique path from Bs to Bx in H the paths Pj, since every time we travel along an arc in D1 from Bs to Bx, we traverse leftward along one path Pj from one bridge to another. Moreover, we can compute this path in O(log n) SA rounds using Lemma 12. Next, we "trim" the path by removing all edges completely inside Bs or Bx. For illustration, suppose first that in some H 1 x > r If Bx = Bt, then we skip the next step; otherwise, since there is a path from Bt to Bx in t ≥ l 1 1 1 t . Therefore, we can extend t . Combining this with r D1, we have r 1 1 this path from Bx to travel left from r t , and then enter Bt. Again, by using Lemma 12, we x to l can establish this path in O(log n) SA rounds, and then trim it by removing all edges completely inside Bx or Bt. Finally, we connect the ends of the Bs-Bx and Bx-Bt paths inside Bx, which can be done in O(log n) SA rounds. t − 1 gives r 1 x ≥ l 1 Lastly, it remains to connect node s to the Bs-end of the path, and to connect the Bt-end of the path to t. Again, these take O(log n) SA rounds. C , H r−1 C , . . . , H C C C In general, we process the graphs in reverse order H r 1 C. For a graph H j C case above, treating the connected components of H j−1 1 first repeat the algorithm for the H the contracted bridges. Observe that all edges outside any component H j−1 along the paths Pj. We now erase all edges inside each traversed component H j−1 the two broken endpoints in H j−1 + that only travels left along paths Pj. P The last issue is that unlike the H C, we as C must travel leftward and connect on the next iteration. At the end, we have constructed a path are r copies of each node inS Then, for each node v ∈S + may not be simple. Indeed, since there j Pj, a single arc in some Pj can be traversed left up to r times, once in each copy. We can fix this issue with the following "shortcutting" step: first, number the + using Lemma 11, and suppose every other node gets value xv := 0. nodes on P j Pj, every node {v , . . . , vr} updates xvi ← maxh xvh, which can be , . . . , vr are connected by a clique. Then, every node v ∈ P + done in one round since the nodes v computes a prefix maximum of the xu values in the path. For each v ∈ P +, if this maximum is + can be pruned before xv is reached; see Figure 3. Therefore, greater than xv, then the path P node v ∈ P + back into G, giving our desired simple augmenting path in Gres. Lastly, translating the augmenting path in Gres to r + 1 vertex-disjoint paths in G can be done as in the Ford-Fulkerson algorithm. +. Finally, we collapse the graph G + drops out of the path P 1 C case, this path P 1 1 + from 1 to P CVIT 2016 23:14 Distributed Treewidth Computation with Applications 7 6 15 5 14 4 13 3 12 15 14 13 Figure 3 Left: the path P +. Right: collapsing the path P +; the numbers are the updated xv values. C with both an s-reachable and t-reachable bridge, then there is no 3.4 Finding a Node Cut If there is no subgraph H r augmenting path, so the algorithm needs to find an s-t node cut S of size at most k. C containing an s-reachable bridge. For each bridge Bi to learn whether or not Bi ∈ Bs, we have every node inside a bridge that is C; the bridges Bi ∈ Bs are precisely the ones that adjacent to s broadcast to its subgraph H r receive such a broadcast. Let Bs denote all bridges Bi inside some subgraph H r construction is presented in the proof of Theorem 4.1 in [14]. For path Pj, let w0 j over all bridges Bi ∈ B. Necessarily, w0 ri corresponding to Pj; let wj be this node v. If this node does not exist, i.e., ri bridges Bi ∈ B, then let wj be the first node on Pj (the one adjacent to s). We now present a set of k nodes, one from each Pk, that form an s-t node cut; a similar j be the rightmost j = vin for some v on the vertex-disjoint path in Gres j = −∞ for all We now show how to compute the nodes wj for each j ∈ [r]. First, every bridge Bi ∈ Bs i ; then, every node in v ∈ Pj sets xv to be its index on Pj if it is notified, and notifies node rj 1 otherwise. The nodes in Pj then compute aggregate maximum of the values xv. Finally, the node v ∈ Pj whose index is exactly its value xv becomes wj. (cid:73) Lemma 23. The set {w1, . . . , wr} is a node cut of G. Proof. First, we would like to extend Lemma 20 to the following statement: at the end of the contraction algorithm, an s-reachable βi and a (not necessarily t-reachable) vertex βx contract to the same vertex iff s and Bi are strongly connected in Gres. To do so, imagine changing the graph Gres as follows: remove all arcs from any bridge to t and add a single arc from a vertex in Bx to t. With this modification, the graphs GR and GB do not change, but now, only βx is t-reachable; applying Lemma 20 proves the statement. From now on, we forget this modification, i.e., we stick with the original Gres. Observe that the distributed algorithm follows the contraction algorithm of Lemma 20; in C contains the bridges Bi whose vertices βi get contracted to a single particular, every subgraph H r vertex in the contraction algorithm. Therefore, the bridges Bi ∈ B are precisely the βi that get contracted to the same vertex as some s-reachable bridge. By the statement at the beginning of this proof, these bridges Bi are precisely those strongly connected to s. The rest of our proof resembles the last paragraph of the proof of Theorem 4.1 in [14]. Suppose for contradiction that there is a simple s-t path P in G − {w1, . . . , wr}. Consider the j Pj. At some point, we must have two vertices j Pj adjacent on this subsequence such that for the paths Pj, Pj0 containing v and v0 respectively, we have v < wj and v0 > wj0. The vertices v, v0 cannot be adjacent in P, so there must be vertices inside a single bridge Bi in between the occurrences of v and v0 on P. This i0 for some Bi0 ∈ B, vertex wj is reachable bridge Bi satisfies lj subsequence of vertices in P that are also inS v, v0 ∈S i > wj0. Since wj = rj i < wj and rj0 J. Li 23:15 from s. Therefore, vertex lj strongly connected in Gres. In particular, Bi ∈ B, so wj0 ≥ rj0 the assumption that rj0 i is also reachable from s, and so is Bi, which means that s and Bi are i by definition of wj0, contradicting (cid:74) i > wj0. This finishes the k-vertex disjoint paths algorithm and Lemma 2. 3.5 Running on Multiple Subgraphs We have proved our main result of this section, Lemma 2, restated below for reference. Below, we state some modifications of this result that are more directly useful in the next section. (cid:73) Lemma 2. Given a graph G = (V, E) of treewidth at most k and two vertices s, t ⊆ V , we can either find k vertex-disjoint s-t paths, or output an s-t node cut of size less than k, in O(kO(1) D) rounds. In the former case, every node knows whether it is on a path, and if so, its predecessor and successor on that path. In the latter case, every node knows the fact that k vertex-disjoint paths do not exist, as well as whether it is in the node cut. First, we obtain a generalization where we want to find vertex-disjoint paths between two sets of nodes, not just s, t, within a connected subgraph of G, not G itself. Moreover, this formulation includes forbidden nodes, those which cannot appear in any vertex-disjoint path. (cid:73) Corollary 24. Given a graph G = (V, E) of treewidth k, a set U ⊆ V such that G[U] is connected, and three disjoint vertex sets A, B ⊆ V − U and X ⊆ U, we can either find k vertex- disjoint A-B paths whose internal nodes belong in G[U] − X, or conclude that k vertex-disjoint paths do not exist, in O(kO(1) D) rounds. In the positive case, every vertex knows whether it is on a path, and if so, its predecessor and successor on that path. In the negative case, every vertex knows the fact that k vertex-disjoint paths do not exist. Proof. The subgraph is not an issue, because any simulated network G[U]' in the algorithm is a subgraph of G', so we can simulate network G[U]' on G' first, and then on G. To address the A-B paths modification, imagine adding a node s whose neighbors are precisely A, and a node t whose neighbors are precisely B. The virtual nodes s, t do not exist in the network, but observe that through the algorithm of Lemma 2, the only times when nodes s and t are active are (i) when we compute prefix/suffix aggregates on at most k paths, and (ii) when we compute a path with s and/or t as an endpoint, in an attempt to find an augmenting path. In case (i), for each path Py, the node v ∈ Py with π(v) = 2 (i.e., the node to the immediate right of s) can take the role of s in prefix computations; likewise, the node with π(v) = Py − 1 can take the role of t in suffix computations.3 In case (ii), the nodes in A and B, which are in the network, can take the role of nodes s and t. For example, if we have an s-reachable bridge and we want a path from s to a specific node v in the bridge Bi, then we instead compute a path from a node in N(s) ∩ Bi to v. Lastly, the forbidden node set X is also not a problem: when computing the bridges Bi, these (cid:74) nodes purposefully do not join any bridge. The next generalization really emphasizes the power of the shortcuts framework: suppose, instead, that we want to solve k vertex-disjoint paths on a subgraph H ⊆ G. Actually, we want to solve multiple instances of the problem on vertex-disjoint subgraphs H1, . . . , H'. Then, we can solve them all simultaneously in O(kO(1) D) rounds! 3 The corner case Py = 2 can be ignored, since we can greedily choose the single edge from s to t as a path. Likewise, if any nodes in A and B are adjacent, we can greedily choose them as vertex-disjoint paths. CVIT 2016 23:16 Distributed Treewidth Computation with Applications (cid:73) Corollary 25. Given multiple instances (Ui, Ai, Bi, Xi) in Corollary 24 such that the node sets Ui are disjoint, we can, simultaneously for each (Ui, Ai, Bi, Xi), either find k vertex-disjoint Ai-Bi paths whose internal nodes belong in G[Ui]− Xi, or conclude that k vertex-disjoint paths do not exist, in O(kO(1) Proof. For each instance (Ui, Ai, Bi, Xi), every step of the algorithm either runs on network G[Ui], or on G[Ui]'i for some 'i ≤ k. Since the networks G[Ui]'i are disjoint subgraphs of Gk for different Ui, we simulate every network G[Ui] or G[Ui]'i on Gk. Therefore, on each step, the SA tasks of the different instances can be simultaneously solved on Gk in O(kO(1) D) rounds, which is then simulated on G in O(kO(1) (cid:74) D) total rounds. D) rounds. Algorithm Outside Disjoint Paths 4 In this section, we provide the rest of the algorithm for approximating treewidth, which uses the k-vertex disjoint paths problem as a subroutine. It is a combination of the efficient sequential and parallel algorithms in [16, 15]. It will make repeated calls to the algorithm of Corollary 25, the corollary of Lemma 2 in the previous section. The treewidth approximation algorithm, which is recursive, uses the concept of graph separ- ators, defined below. (cid:73) Definition 26 (Separation). Let G = (V, E) be a graph and let A, B, S ⊆ V . We say that S separates G into A and B if A, B, S partition V and N(A) ⊆ S and N(B) ⊆ S. Note that A and B are not necessarily connected, which means that there could be multiple choices for A and B. In addition, for disjoint X, Y ⊆ S, we say that S is an X-Y separator if there exist A, B ⊆ V with X ⊆ A, Y ⊆ B such that S separates G into A and B. (cid:73) Definition 27 (Balanced Separation). Let G = (V, E) be a graph and let X ⊆ V . A set S ⊆ V is an (X, α)-balanced separator of G if there exist A, B ⊆ V such that S separates G into A and B and A ∩ X,B ∩ X ≤ αX. When X = V , we omit the X, using the term α-balanced separator instead. The following well-known fact states that if G has bounded treewidth, then it admits constant- sized balanced separators for any X ⊆ V . (cid:73) Lemma 28 (Lemma 7.20 of [4]). Let G = (V, E) be a graph of treewidth k. For any set X ⊆ V , there exists an (X, 2/3)-balanced separator of G of size k + 1. The algorithm is recursive, always running on an instance (U, X) with U ⊆ V , X ⊆ N[U], and X ≤ 7k + 4. It starts with (U, X) = (V,∅). The algorithm has two cases, depending on whether the current recursion depth is odd or even (the initial instance (V,∅) has recursion depth 0). The even case finds a balanced separator S of size ≤ k + 1 in the graph G[U],4 separating the current graph into components whose sizes are a constant fraction smaller, and for each component U0 of vertices, recursively calls (U0, N[U0] ∩ (X ∪ S)). This guarantees the algorithm O(log n) recursion depth, but comes at a cost: the size of X increases by ≤ k + 1 upon the next recursion call (to the odd case). This increase is remedied in the odd case below, which on input (U, X) finds a set S that separates G[U] into components, each with ≤ 2 3X vertices in X, and for each component U0 of vertices, recursively calls (U0, N[U0] ∩ (X ∪ S)). If X ≥ 6k + 4, then 3(6k+4)+(k+1) = X− k− 1 (U0, N[U0]∩(X ∪ S)) ≤ 2 3 , 3X+S = X− 1 3X+S ≤ X− 1 4 Of course, if no such balanced separator S is found, the algorithm can immediately exit and conclude that tw(G) > k. J. Li 23:17 so the size of X is reduced by k + 1. Thus, by alternating the recursion between odd and even depth, we can maintain the invariant X ≤ 6k + 4 while reducing the size of U by a constant on every two iterations. The distributed implementation runs through the recursion tree in parallel. Namely, it proceeds in T super-rounds, where T is the maximum recursion depth of the recursive algorithm. On super-round t ∈ [T], the distributed algorithm processes all instances (U, X) at recursion depth t. Here, we will use the crucial property that the sets U in this recursion layer are connected and pairwise disjoint. 4.1 Odd Recursion Depth In this case, our goal is to reduce the size of X sufficiently. We know by Lemma 28, there exists an (X, 2/3)-balanced separator in G. Suppose S is this separator, which separates G into A and B such that A ∩ X,B ∩ X ≤ (2/3)X. If we let Y := A ∩ X and Z := B ∩ X, then this means that Y ,Z ≤ 2 3X and the set S contains X − (Y ∪ Z) and is an Y -Z separator. The algorithm proceeds by trying all possible values of Y and Z and finding such a set S. The algorithm for odd recursion depth proceeds as follows. For all partitions X0, Y, Z of X with Y ,Z ≤ 2 3X, try to find an Y -Z separator in the graph G[U]−X0 of size ≤ (k+1)−X0, which is an instance of (k+1−X0)-Vertex Disjoint Paths. If no such separator is found over all Y, Z, terminate the algorithm and output the conclusion that tw(G) > k. Else, for partition X0, Y, Z and Y -Z separator S0, let S := X0 ∪ S0, and for each component U0 of vertices in G[U] − S, recursively call (U0, N[U0] ∩ (X ∪ S)). If the graph G[U] − S is empty, then this recursion branch terminates. Like the above algorithm, the distributed algorithm iterates over all O(3k) partitions X0, Y, Z. We can elect a leader in U to decide which partition X0, Y, Z to try next, and broadcast it to the other nodes in U using SA. For (k + 1 − X0)-Vertex Disjoint Paths, one difficulty is that we want our computation to depend on X (cid:40) U and yet run only on nodes in U, since only the sets U are disjoint over instances, not X. This is the reason for the specifications of Corollary 25. In fact, we simply solve (k + 1 − X0)-Vertex Disjoint Paths using Corollary 25 with parameters (A, B, X) := (Y, Z, X0), taking time O(kO(1) D). 4.2 Even Recursion Depth In this case, our goal is to separate the current graph into components a constant factor smaller, in order to bound the recursion depth by O(log n). We first introduce the concept of splitters from [15]. (cid:73) Definition 29 (B-splitter). For a rooted, spanning tree T ⊆ G[U], a set of vertices R ⊆ U is a B-splitter if R ≤ n/B and every connected component in T − R has less than B vertices. For a vertex v ∈ U, define desc(v) and children(v) as the children and descendants of v, respectively. Define sub_size(v) as the number of vertices in the subtree rooted at v. Let R be all the vertices v ∈ U satisfying the following condition: 1 + X u∈children(v) (sub_size(u) mod B) > k. (cid:73) Theorem 30 (Theorem 9.2 in [15]). The set R defined above is an R-splitter. CVIT 2016 23:18 Distributed Treewidth Computation with Applications The distributed algorithm first computes an arbitrary spanning tree T of G[U], e.g., by computing an MST with arbitrary weights following [7], and roots it at an arbitrary vertex. At this point, every node knows its parent and children in the rooted tree. To compute the set R, each node v ∈ U first computes the size of its subtree in T; this can be done in O(log n) SA rounds using tree aggregation techniques in [12]. Then, each node broadcasts sub_size(v) to its parent node in a single round, so that each node can determine whether it joins R. The rest of this even recursion section is based on [16]. For each vertex r ∈ R, we define wr := sub_size(r) − X and for R0 ⊆ R, wR0 := P P r∈R0 wr. In other words, wr is the number of vertices v for which r is the first vertex in R encountered on the path from v to the root. Also, observe that r∈R wr = U. The following lemma states that if a separator X does not intersect R, then the values wr approximately determine the size of a separated component. (cid:73) Lemma 31 (Lemma 2 in [16]). Consider a set X ⊆ U with X ≤ k and X ∩ R = ∅ which separates G into A and B. Then, sub_size(r0), r0∈desc(r)∩R A − w(A ∩ R) ≤ kB, and the same holds for B. We compute an R-splitter with B := n/(12k), so that R ≤ 12k. By Lemma 28, there exists an (X, 2/3)-balanced separator of G into A and B. If X ∩ R = ∅, then by Lemma 31, w(A ∩ R) ≤ A + kB ≤ (2/3)U + (1/12)U = (9/12)U, and the same holds for B. Therefore, letting Y := A ∩ R and Z := B ∩ R, we conclude that there exists a partition Y, Z of R with w(Y ), w(Z) ≤ (9/12)U that admits a Y -Z separator in G[U] − R of size ≤ k + 1. The algorithm tries all possible such Y, Z and tries to find a separator for each. If a separator S is found, then by Lemma 31, A ≤ w(A ∩ R) + kB ≤ (9/12)U + (1/12)U = (10/12)U, so S is an (X, 10/12)-balanced separator, giving us the necessary constant factor decrease. Otherwise, if no S is found, we must have X ∩ R 6= ∅. In this case, we brute-force over which one of the R ≤ 12k vertices belongs in X. If we guess r ∈ R, then we would like to solve the instance (U − r, X), except we look for a separator of size k instead of k + 1. It is possible for U − r to be disconnected, in which case only the largest component still needs to be separated, since the other components have size ≤ (1/2)U. Therefore, if U0 is the largest component of G[U] − r, then we solve the instance (U0, N[U0] ∩ X) with k decreased by 1. This is a recursion that is completely contained inside the (U, X) instance; it has nothing to do with the main recursion, so it does not distinguish between even and odd recursion levels. Overall, an instance with value k results in ≤ 12k recursive instances of value k − 1. A straightforward induction shows that this recursion tree has size ≤ kO(k). The values wr can be computed in a distributed setting as follows: every node r ∈ R sets xr := wr and every other node v ∈ V − R sets xv := 0. Then, every node computes u∈desc(v) xu in O(log n) shortcut rounds using tree aggregation techniques in [12]. Since every node r ∈ R already knows sub_size(r), it can locally compute wr = sub_size(r) − P P u∈desc(r) xu. The recursion within each (U, X) instance is done sequentially, which results in kO(k) se- J. Li 23:19 quential calls to s-Vertex Disjoint Paths for s ≤ k + 1, taking total time O(kO(k)). 5 Applications This section proves Theorem 3, restated below. (cid:73) Theorem 3. Let G be a graph network with treewidth k. The problems maximum independent set, minimum vertex cover, chromatic number, and minimum dominating set can be solved in O(kO(k) D) rounds on network G. For conciseness, we only provide a distributed algorithm for maximum independent set; the algorithms for the other problems are straightforward modifications. We first introduce our notation for treewidth decompositions. A treewidth decomposition of a graph G is a tree T whose vertices, called bags, are subsets of V (G). The tree T satisfies three properties: (i) the union of vertices over all bags equals V (G); (ii) for each v ∈ V , the set of bags containing v is connected in T ; (iii) for each edge (u, v) ∈ E(G), there is a bag containing both u and v. The treewidth of a graph G is the minimum k such that there exists a tree decomposition T of G whose bag sizes are at most k + 1. 5.1 The Classical Algorithm Let us now sketch the traditional algorithm for maximum independent set on bounded treewidth graphs. For an input graph G of treewidth k, the algorithm first computes a treewidth decom- position of the graph with bag sizes bounded by O(k). Then, the algorithm applies dynamic programming on this treewidth decomposition; we sketch this dynamic program below. This presentation of the dynamic programming algorithm is not the most standard or the most effi- cient, but it will translate more smoothly when we adapt it to the distributed setting. Root the tree T at a root vertex r ∈ V (T ). For each vertex The dynamic program. v ∈ V (T ), let its bag be Bv. For each bag Bv and subset I ⊆ Bv, we will define dynamic programming states Join(Bv, I). For each vertex v ∈ V (T ) − {r} and its parent p ∈ V (T ) in the rooted tree T , for subsets Iv ⊆ Bv and Ip ⊆ Bp, we will define dynamic programming states Extend(Bv, Iv, Bp, Ip). These are defined as follows: 1. For each vertex v ∈ V (T ) that is a leaf in the rooted tree T and each Iv ⊆ Bv, Join(Bv, Iv) := Iv if Iv is an independent set in G[Bv], − ∞ otherwise (1) Our goal is for the optimal size of the independent set to be the best value of Join(Br, Ir), i.e., maxBr⊆Iv Join(Br, Ir). Clearly, if r is a leaf (i.e., the tree T is a single vertex), then this is true. Otherwise, we will define Join for non-leaf vertices later. 2. For each vertex v ∈ V (T ) − {r} and its parent p, and each Iv ⊆ Bv, Ip ⊆ Bp, Extend(Bv, Iv, Bp, Ip) := Join(Bv, Iv) + Ip − Iv if Iv ∩ (Bv ∩ Bp) = Ip ∩ (Bv ∩ Bp) (2) and Iv, Ip are independent sets in G[Bv], G[Bp], − ∞ otherwise In other words, we try to extend the state Iv in Bp to the state Ip in Bp, but this is only valid if the sets Iv, Ip agree on the vertices shared by Bv and Bp, namely Bv ∩ Bp. CVIT 2016 23:20 Distributed Treewidth Computation with Applications 3. For each non-leaf vertex p, let children(p) denote the children of p in T . For each Ip ⊆ Bp, Join(Bp, Ip) := Ip + X (Extend(Bv, Iv, Bp, Ip) − Ip) max Iv⊆Bv v∈children(p) if Ip is an independent set in G[Bp], − ∞ otherwise (3) It is a routine exercise in algorithm design on bounded treewidth graphs to argue that this algorithm is correct. The main observation is that in the dynamic program, once Join(Bp, Ip) "forgets" the vertices in Bv − Bp for some v ∈ children(p), these vertices never appear again on any Join(Bp0 , Ip0) for any p0 on the path from p to the root r, due to property (ii) of the treewidth decomposition. Recovering the solution. Thus, maxIr⊆Br Join(Br, Ir) =: OP T is the size of the maximum independent set in G. To compute the actual maximum independent set, we follow the traditional procedure of "reversing" the dynamic program, starting from the root r: r , pick an arbitrary set Ir ⊆ Br that satisfies Join(Br, Ir) = OP T, i.e., 1. For I∗ I∗ r := arg max Ir⊆Br Join(Br, Ir). (4) 2. For each non-leaf vertex p and each v ∈ children(p), define (cid:0)Extend(Bv, Iv, B∗ p(cid:1) . I∗ v := arg max Iv⊆Bv 3. At the end, the returned maximum independent set isS p) − I∗ p , I∗ (5) v∈V (T ) I∗ v. 5.2 Distributed Implementation Suppose the input (and network) graph G has treewidth t. We first run the treewidth algorithm of Theorem 1, computing a treewidth decomposition with maximum bag size O(k). However, one immediate issue is that the nodes in each bag The first attempt is to adapt the treewidth algorithm of Theorem 1 into computing an actual treewidth decomposition. However, one caveat is that the nodes in each bagof the treewidth decomposition may not be connected in the network G. Therefore, when performing the stand- ard dynamic programming over a treewidth decomposition, the nodes in a bag cannot directly communicate with each other. We resolve this issue by exploiting the special structure of the treewidth algorithm of Section 4. Recall that the algorithm is recursive: on each recursive instance (U, X), it either terminates prematurely, concluding that tw(G) > k, or finds a node set S of size ≤ k + 1 and, for each connected component U0 in G[U] − S, recursively calls (U0, N[U0] ∩ (X ∪ S)). In Section 4, we observed several properties of the algorithm that will be helpful, listed below. 1. For each layer of the recursion depth, the sets U in the instances (U, X) are connected and node-disjoint. 2. For each instance (U, X) in the algorithm, X ⊆ N[U]. 3. If instance (U, X) computes separator S ⊆ U, then every recursive instance (U0, X0) called by this instance has N[U0] ∩ S 6= ∅. 4. The tree in the treewidth decomposition has depth O(log n). 5. Every leaf instance (U, X) in the recursion tree has U ≤ k +1, since the computed separator S satisfies S ≤ k + 1, and G[U] − S must be empty to end this recursion branch. We now specify a tree decomposition T "implicitly" produced by the algorithm of Section 4. For each instance (U, X) that produces separator S, create a bag BU,X in T with vertices X ∪ S. J. Li 23:21 The children of this bag are the bags produced by all recursive instances (U0, X0) called by (U, X). It is clear by the algorithm of Section 4 that T is a treewidth decomposition with maximum bag size O(k). We would like to apply dynamic programming on this treewidth decomposition T in a distributed fashion. Modifications. We first augment the algorithm of Theorem 1, so that for each layer of the recursion, for each (U, X) in that layer, all nodes v ∈ V know: (i) the depth of that layer, (ii) the ID of U, set to be the smallest ID of a node in U, and (iii) the set X of size O(k). Moreover, if S is the separator computed at instance (U, X), then for each instance (U0, X0) called recursively at this instance, exactly one of the nodes in N[U0]∩ S knows the ID of U0 and its neighbors in U0; we say that node v is in charge of U0. It is clear that all of this can be done in kO(1)polylog(n) SA rounds. The dynamic program. With this, we implement the dynamic program of Section 5.1 "bottom-up", from layer T := Θ(log n) to (the single instance in) layer 0 in that order. For layer t ∈ [T], for each instance (U, X) in that layer, perform the following: 1. If no nodes in U have received anything so far, then instance (U, X) is a leaf in the recursion tree. In this case, the computed separator S in instance (U, X) is exactly U, so the bag corresponding to (U, X) has node set X ∪ S = X ∪ U. The nodes in U first learn each other's IDs as well as the IDs in X; this can be achieved because (i) U ≤ k + 1, (ii) U is connected, (iii) X ⊆ N[U], and (iv) X = O(t). The bag BU,X for this instance is a leaf in T and has node set X ∪ U, so for each IU,X ⊆ BU,X, we compute Join(BU,X , IU,X) according to (1). This is 2O(k) values, one for each IU,X ⊆ BU,X; we then broadcast all of the Join(BU,X , IU,X) pairs to N[U]. In total, this takes 2O(k) distributed rounds. 2. Otherwise, (U, X) must have called some recursive instances after computing its separator S. Any such instance (U0, X0) satisfies N[U0] ∩ S 6= ∅, and instance (U0, X0) has already broadcasted all Join(BU0,X0 , IU0,X0) pairs to the unique node in U in charge of U0. For each node v ∈ U and recursive instance (U0, X0) such that v is in charge of U0, node v locally computes, according to (2), Extend(BU0,X0 , IU0,X0 , BU,X , IU,X) for each X ⊆ BU,X , X0 ⊆ BU0,X0 . Note that a node can receive from multiple (U0, X0), but it can locally compute all such states simultaneously. Then, for each IU,X ⊆ BU,X, each node v locally computes the sum X max IU0 ,X0⊆BU0 ,X0 (Extend(BU0,X0 , IU0,X0 , BU,X , IU,X) − IU,X) , where the sum is taken over all instances (U0, X0) such that v is in charge of U0, and then the nodes in U compute an aggregate sum of all these values. Finally, each node can locally compute Join(BU,X , IU,X) for each IU,X ⊆ BU,X using (3). In total, this step takes 2O(k) SA rounds. Recovering the solution. To recover the actual maximum independent set, we again follow the process in Section 5.1. This time, we process the layers from layer 0 to layer T. 1. For the initial depth 0 with instance (U, X), recall that all nodes in U have learned Join(BU,X , IU,X) for all IU,X ⊆ BU,X. All nodes in U compute I∗ ties lexicographically (so that all nodes in U can agree upon the same I∗ cast the set I∗ whether it belongs to I∗ (U0, X0), node v locally computes I∗ neighbors in U0. All of this can be done in O(k) distributed rounds. U,X according to (4), where the arg max breaks U,X), and then broad- U,X to their neighbors. Since X ∪ S ⊆ N[U], each node in X ∪ S can learn U,X. Then, for each node v ∈ U in charge of a recursive instance U0,X0 to its U0,X0 according to (5), and sends the set I∗ CVIT 2016 23:22 Distributed Treewidth Computation with Applications 2. For each instance (U0, X0) called by instance (U, X), the nodes in U0 adjacent to the node in charge of (U0, X0) have received I∗ U0,X0 to all nodes in U0, taking O(k) SA rounds. Then each node in U0 in charge of a recursive instance performs the same as above. U0,X0. These nodes broadcast the set I∗ At the end, every node in V knows whether it belongs to the maximum independent set U,X I∗ U,X. This completes the distributed implementation, which runs in 2O(k) log n SA rounds. This concludes Theorem 3. S 1 2 References Eyal Amir. Efficient approximation for triangulation of minimum treewidth. In Proceedings of the Seventeenth conference on Uncertainty in artificial intelligence, pages 7–15. Morgan Kaufmann Publishers Inc., 2001. Stefan Arnborg, Derek G Corneil, and Andrzej Proskurowski. Complexity of finding em- beddings in ak-tree. SIAM Journal on Algebraic Discrete Methods, 8(2):277–284, 1987. 3 Hans L Bodlaender. A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM Journal on computing, 25(6):1305–1317, 1996. 4 Marek Cygan, Fedor V Fomin, Łukasz Kowalik, Daniel Lokshtanov, Dániel Marx, Marcin Pilipczuk, Michał Pilipczuk, and Saket Saurabh. Parameterized algorithms, volume 3. Springer, 2015. 5 Atish Das Sarma, Stephan Holzer, Liah Kor, Amos Korman, Danupon Nanongkai, Gopal Pandurangan, David Peleg, and Roger Wattenhofer. Distributed verification and hardness of distributed approximation. In STOC, pages 363–372, 2011. 6 Uriel Feige, MohammadTaghi Hajiaghayi, and James R Lee. Improved approximation algorithms for minimum weight vertex separators. SIAM Journal on Computing, 38(2):629– 657, 2008. 7 Mohsen Ghaffari and Bernhard Haeupler. Distributed algorithms for planar networks ii: Low-congestion shortcuts, mst, and min-cut. In Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, pages 202–219. Society for Industrial and Applied Mathematics, 2016. 9 8 Mohsen Ghaffari, Fabian Kuhn, and Hsin-Hao Su. Distributed mst and routing in almost mixing time. In Proceedings of the ACM Symposium on Principles of Distributed Comput- ing, pages 131–140. ACM, 2017. Bernhard Haeupler, D Ellis Hershkowitz, and David Wajc. Round-and message-optimal distributed part-wise aggregation. arXiv preprint arXiv:1801.05127, 2018. Bernhard Haeupler, Taisuke Izumi, and Goran Zuzic. Low-congestion shortcuts without embedding. In Proceedings of the 2016 ACM Symposium on Principles of Distributed Com- puting, pages 451–460. ACM, 2016. Bernhard Haeupler, Taisuke Izumi, and Goran Zuzic. Near-optimal low-congestion short- cuts on bounded parameter graphs. In International Symposium on Distributed Computing, pages 158–172. Springer, 2016. Bernhard Haeupler and Jason Li. Faster distributed shortest path approximations via shortcuts. arXiv preprint arXiv:1802.03671, 2018. Bernhard Haeupler, Jason Li, and Goran Zuzic. Minor excluded network families admit fast distributed algorithms. arXiv preprint arXiv:1801.06237, 2018. Samir Khuller and Baruch Schieber. Efficient parallel algorithms for testing k and finding disjoint s-t paths in graphs. SIAM Journal on Computing, 20(2):352–375, 1991. Jens Lagergren. Efficient parallel algorithms for graphs of bounded tree-width. Journal of Algorithms, 20(1):20–44, 1996. 10 11 12 13 14 15 J. Li 16 17 Bruce A Reed. Finding approximate separators and computing tree width quickly. In Proceedings of the twenty-fourth annual ACM symposium on Theory of computing, pages 221–228. ACM, 1992. Bruce A Reed. Algorithmic aspects of tree width. In Recent advances in algorithms and combinatorics, pages 85–107. Springer, 2003. 18 Neil Robertson and Paul D. Seymour. Graph minors. ii. algorithmic aspects of tree-width. Journal of algorithms, 7(3):309–322, 1986. A Omitted Proofs in Section 2 Proof (Lemma 7). Let H1, . . . , H' be the connected, disjoint subgraphs in an SA instance. The reduction from SA to PA uses the Heads/Tails clustering technique from parallel graph contrac- tion algorithms. We sketch the Heads/Tails clustering algorithm below, which, given a graph, contracts each connected component into a single vertex. For O(log n) rounds, each vertex flips Heads/Tails with probability 1/2 each and broadcasts the flip to its neighbors. If a vertex flips Tails and has a neighbor with Heads, it notifies one of its Heads neighbors. Afterwards, every Heads vertex and its Tails neighbors who notified it contract into a single vertex. Following the standard analysis, w.h.p., every connected component contracts to a single vertex after O(log n) iterations. Now we describe the distributed SA algorithm. As input, each node in each subgraph Hi knows its neighbors in that subgraph. Our goal is for the nodes in each Hi to agree on a common ID, unique to each Hi. Then, a single round of PA solves the desired aggregation task. At a high level, we want to run a distributed version of the Heads/Tails algorithm on the graph H1 ∪ ··· ∪ H'. On each iteration, for each vertex v in the contracted graph, the nodes in the original graph that contracted to v form a part for a PA round. In particular, every node in a part should know its (unique) part ID. At the beginning, each node is its own part, and it can set its part ID to be its node ID. We now describe each of O(log n) steps of the clustering algorithm. In O(1) PA rounds, each part collectively decides on a Heads/Tails flip for that part. Then, every node broadcasts its part ID and its flip to all its neighbors in its own subgraph. Then, in O(1) PA rounds, any node that received a Heads flip from a neighbor, and whose own part flipped Tails, notifies its part of the part ID received by such a neighbor. Then, each part that flipped Tails collectively decides on a common part ID (e.g., the minimum one) and sets its own part ID to be that one. The new parts are the nodes with a common part ID; clearly, every part is still connected. Finally, after O(log n) iterations, each taking O(1) PA rounds, all nodes within each subgraph Hi contracted to a single vertex in the Heads/Tails algorithm, which means that they have agreed on a common (cid:74) part ID. Proof (Lemma 9). We can assign arbitrary weights to the edges of H use the MST algorithm of [7], which runs a modified Boruvka's algorithm with the current contracted components as the (cid:74) parts; for details, see [7, 12]. u whose aggregateL aggregateL Proof (Lemma 10). Computing subtree aggregation in the tree rooted at vr is covered in [12]. To determine the parent of each node except the root, we can set xi ← 1 for each node vi with sum as the aggregate. For each node vi ∈ V (T) − vr, its parent is precisely the unique neighbor (cid:74) j∈T (u) xj is larger than the aggregateL j∈T (vi) xj at vi. j∈T (vi) xj is exactly the prefix aggregateL Proof (Lemma 11). For prefix aggregation, let v' be the root of the tree P. Then, subtree j≤i xj, so we can apply Lemma 10. For each node vi to learn the index i, we set xi ← 1 for all i so that value i is exactly the prefix 23:23 CVIT 2016 23:24 Distributed Treewidth Computation with Applications aggregateL j≤i xj. Finally, for suffix aggregation, we compute subtree aggregates with v1 as the (cid:74) root instead. Proof (Lemma 12). First, compute a spanning tree T ⊆ H using Lemma 9. Root the tree T at t, and set xs ← 1 and xv ← 0 for all other nodes v ∈ V (H)− s. Now compute subtree aggregates with sum as the operator. Observe that a node has nonzero subtree sum iff it is on the path from 6= 0 sends a message to its parent in the rooted tree, so (cid:74) s to t. Finally, each node v withP that every node on the path learns its predecessor and successor. j∈Tv 1 Omitted Proofs in Section 3 B Proof (Claim 14). Since G has treewidth k, there exists a treewidth decomposition with max- imum bag size k + 1. We now construct a treewidth decomposition5 T of G' with maximum bag size (k+1)', which is sufficient to prove the claim. Starting from T , for each v ∈ G, we replace all occurrences of v in bags in T with the vertices v , . . . , v'. Clearly, the maximum bag size is now at most (k + 1)'. We now claim that the new decomposition T 0 is a treewidth decomposition of G'. Property (i) is clearly satisfied. For property (1), for each vertex vr ∈ V (G'), the set of bags containing it is precisely the set of bags containing v in T , which is connected, proving property (2). Finally, for property (3), for vertices ui, vj ∈ V (G') adjacent in G', either (i) u = v, in which case any bag containing u in T contains both ui and vj, or (ii) u 6= v, in which case there must be a bag in T containing both u and v, and this bag in T 0 contains both ui and vj. (cid:74) Proof (Lemma 18). By Corollary 17, the existence of an augmenting path is equivalent to s and t being strongly connected in Gres. Since the transformation from Gres to GR preserves SCCs, this is also equivalent to s and t being strongly connected in GR. Also, there is always a t → s path in GR, so strong connectivity of s and t is equivalent to the existence of a directed s → t path in GR. Therefore, we prove the following statement instead: there is a directed s → t path in GR iff there exists s-reachable βi and t-reachable βx and a directed βi → βx path in GB. The rest of the proof resembles the proof of Theorem 4.1 in [14]. For the if direction, suppose there is a directed βi → βx path in GB from s-reachable βi to t-reachable βx; we will transform this path into an s → t path in GR. We replace each arc (βj, βj0) with a directed path from βj to βj0 in GR as follows. By definition of GB, there is y ∈ [r] satisfying ry j ), the left path along Py from ry j0 , βj0). Finally, add the arcs (s, βi) and (βx, t) to the path, completing the s → t path. For the only if direction, suppose there is a directed s → t path P in GR; without loss of generality, assume that P is simple. A simple path in GR consists of vertices βi with a leftward path along some Pj in between every two consecutive βi. Let the βi vertices on P be βx1 , . . . , βx' from left to right; by definition, βx1 is s-reachable and βx' is t-reachable. We now construct a (not necessarily simple) path from βx1 to possibly a different t-reachable vertex in GB. For i ∈ [' − 1], let yi be such that the path P travels along Pyi from βxi to βxi+1, and let y' be an arbitrary integer in [r]. First, set x01 ← x1. Then, one by one, for i from 2 to ', we will such that (i) either βx0 replace the vertex βxi with a vertex βx0 ) i−1 , βx0 ≥ ryi . Note that condition (ii) is satisfied by definition for exists in GB, and (ii) we have ryi x0 i = 1. j0. We replace arc (βj, βj0) with the path composed of the arc (βj, ry j0, and finally the arc (ly Fix an i ∈ [2, ' − 1]; we assume that the invariant is satisfied at i. Since ryi x0 x0, we can to βxi+1 along path Pyi. Consider the arc (xi, x0) ∈ Dyi+1; we first assume that travel from βx0 it exists. By condition 2(c) of the construction of the bridge graph with βxi+1 as βz, we have ≥ ryi or the arc (βx0 i−1 = βx0 i j ≥ ly j to ly i xi i i i i 5 For our definition of treewidth and treewidth decomposition, we refer the reader to Section 5. J. Li 23:25 i ' ' i+1 ← βx0 Since βx' is t-reachable, we have ry maintains the two properties for index i + 1. x0 ≥ ryi+1 ryi+1 the two properties for index i + 1. xi+1; otherwise, we contradict condition 2(c). Therefore, setting βx0 Now suppose arc (xi, x0) does not exist in Dyi+1. Then, we must have ryi+1 i+1 ← βx0 maintains xi+1; otherwise, βxi+1 satisfies conditions 2(a) and 2(b) of the bridge graph, so an arc in Dyi+1 must exist. Therefore, setting βx0 = Py for all y ∈ [r], i.e., the rightmost out-neighbor = Py', vertex βx0 ≥ ry' is also t-reachable. We of vertex βx is t on each path Py. Since ry' x0 '−1, obtaining our desired path in GB from remove duplicates from the sequence βx0 2 , . . . , βx0 1 , βx0 (cid:74) s-reachable βx1 to some t-reachable vertex. Proof (Lemma 20). We define iteration i of the contraction algorithm as the iteration where B be the bridge graph after iteration i ∈ [r], the components of Dj are contracted. Also, let Gi and G j be the edge set Dj in Gi B. 0 B := GB, and let Di x0 ≥ ryi+1 x' x' j For the if direction, we temporarily abuse notation, referring to vertices βi in GR and Gj For the only if direction, we first show that if two vertices βi, βx contract to the same vertex, then the bridges Bi, Bx are strongly connected in Gres. Before the contraction algorithm begins (i.e., before iteration 1), this is clearly true. On iteration i, suppose the statement holds for the bridge graph right before iteration i. Iteration i contracts the bridges inside each connected component of Di−1 , which, by Claim 19, is strongly connected. Therefore, the statement holds after iteration i as well. Applying induction on i proves the statement at the end of the algorithm. Finally, taking βi and βx to be an s-reachable and t-reachable vertex finishes the only if direction. B as (super-) bridges as well as Bi. For bridge βi, consider all directed simple paths in GR that start from βi and end at some t-reachable bridge. Define dist(βi) to be the minimum possible number of bridges βx on such a path, minus 1. In particular, dist(βi) = ∞ iff there is no such path, and dist(βi) = 0 iff βi is t-reachable. Also, for bridges βi, βx, we say that βi can directly reach βx in GR if there is a directed βi → βx path in GR with no other bridges inside. We now prove, by induction on d ≥ 0, that all bridges βi with dist(βi) = d contract to the a vertex containing an t-reachable bridge. Since s and t are strongly connected in Gres, there is an s-reachable bridge βi with finite dist(βi), proving the if direction. The base case d = 0 is trivial; we now consider the case d = 1. Suppose a bridge βi satisfies dist(βi) = 1. Then, exiting from bridge βi, we can move left along some path Py and then enter x = Pj for all an t-reachable bridge βx. Note that a t-reachable bridge necessarily satisfies rj j ∈ [r], i.e., the rightmost out-neighbor of bridge βx is t on each path Pj. By definition of GB, this means that for all j, there is an arc in Dj from βi to βx, or possibly a different t-reachable bridge due to tie-breaking. In particular, this arc is in D1, so on iteration 1 of the algorithm, βi and βx already contract to the same vertex. Now suppose dist(βi) = d + 1 for d ≥ 1. First, if βi contracts to the same component as some other βx with dist(βx) ≤ d, then by induction, βx contracts to a component containing a t-reachable bridge. βi contracts to this same component, completing the inductive step. Otherwise, consider the directed path P from βi to t in GR achieving dist(βi) = d + 1, and suppose βi, βx0 , βy are the first three bridges on P. Suppose that, from βx0 to βy, the path P x0 ≥ lj y. Furthermore, either the walks left along path Pj in GR; in particular, this means that rj x ≥ rj arc (βi, βx0) is in Dj, or some arc (βi, βx) exists in Dj such that rj x0 and βi can directly x ≥ rj x0 ≥ lj reach βx in GR; in the former case, we set x := x0. The inequalities rj y imply that βx can directly reach βy, and since dist(βy) = d − 1, we have dist(βx) ≤ d. Now consider iteration j of the algorithm, which contracts all connected components in Dj in Gj−1 B . Before iteration j, let βi0 and βx0 in Gj−1 B denote the super-bridges that βi and βx have contracted to; we assume βi0 6= βx0, since otherwise we are in the first case. Observe that the corresponding super-bridge Bi0 can still directly reach Bx0. In particular, if βx00 is the super-bridge for which (βi0 , βx00) is an arc in Dj−1 x0 ≥ rj y. In particular, some original bridge βx1 that contracts x00 ≥ lj y, which again implies that dist(βx1) ≤ d. Then, to the super-bridge βx0 satisfies rj x ≥ lj x1 = rj x00 ≥ rj , then rj j CVIT 2016 23:26 Distributed Treewidth Computation with Applications on iteration j, super-bridges βi0 , βx0 contract together, so bridges βi, βx1 contract to the same super-bridge. The fact that dist(βx1) ≤ d completes the inductive step. (cid:74)
1004.5600
1
1004
2010-04-30T19:42:14
On the (Im)possibility of Preserving Utility and Privacy in Personalized Social Recommendations
[ "cs.DS" ]
With the recent surge of social networks like Facebook, new forms of recommendations have become possible -- personalized recommendations of ads, content, and even new social and product connections based on one's social interactions. In this paper, we study whether "social recommendations", or recommendations that utilize a user's social network, can be made without disclosing sensitive links between users. More precisely, we quantify the loss in utility when existing recommendation algorithms are modified to satisfy a strong notion of privacy called differential privacy. We propose lower bounds on the minimum loss in utility for any recommendation algorithm that is differentially private. We also propose two recommendation algorithms that satisfy differential privacy, analyze their performance in comparison to the lower bound, both analytically and experimentally, and show that good private social recommendations are feasible only for a few users in the social network or for a lenient setting of privacy parameters.
cs.DS
cs
On the (Im)possibility of Preserving Utility and Privacy in Personalized Social Recommendations Ashwin Machanavajjhala [email protected] Aleksandra Korolova [email protected] Atish Das Sarma [email protected] 0 1 0 2 r p A 0 3 ] S D . s c [ 1 v 0 0 6 5 . 4 0 0 1 : v i X r a ABSTRACT With the recent surge of social networks like Facebook, new forms of recommendations have become possible -- personal- ized recommendations of ads, content, and even new social and product connections based on one's social interactions. In this paper, we study whether "social recommendations", or recommendations that utilize a user's social network, can be made without disclosing sensitive links between users. More precisely, we quantify the loss in utility when existing recommendation algorithms are modified to satisfy a strong notion of privacy called differential privacy. We propose lower bounds on the minimum loss in utility for any recom- mendation algorithm that is differentially private. We also propose two recommendation algorithms that satisfy differ- ential privacy, analyze their performance in comparison to the lower bound, both analytically and experimentally, and show that good private social recommendations are feasible only for a few users in the social network or for a lenient setting of privacy parameters. 1. INTRODUCTION Making recommendations or suggestions to users to in- crease their degree of engagement is a common practice for websites. For instance, Facebook recommends friends to existing users, Amazon suggests products, and Netflix rec- ommends movies, in each case with the goal of making as relevant a recommendation to the user as possible. Recom- mending the right content, product, or ad to an individual is one of the most important tasks in today's web companies. With the boom in social networking many companies are striving to incorporate the likes and dislikes of an individ- ual's social neighborhood. There has been much research and industrial activity to solve two problems: (a) recom- mending content, products, ads not only based on the indi- vidual's prior history but also based on the history of those the individual trusts [12, 2], and (b) recommending others whom the individual might trust. Recommendations based on social connections are especially effective for users who have seen very few movies, bought only a couple of products, or never clicked on ads; while traditional recommender sys- tems default to generic recommendations, a social-network aware system can provide useful recommendations based on active friends. Companies like TrustedOpinion1 and SoMR2 generate content and ad recommendations by leveraging so- cial networks. In fact, Facebook3, Yahoo!4 and Google5 are opening their social networks to third party developers to encourage social network-aware recommender systems. In addition, a social network might want to use a different underlying social network, such as one derived from e-mail records or Instant Messenger connections, to suggest friends (e.g. Facebook already uses contacts imported from an ad- dress book as suggestions). Social connections could also be used to recommend products or advertisements to users -- Netflix (or Opentable or Yelp) could recommend movies (or restaurants) to a subscriber based on her friends' activities and ratings. In fact, rather than using the entire social graph, the system could use only a subset of trusted edges for that application (for instance, a user might only trust the movie recommendations of a subset of her friends). However, these improved recommendations based on so- cial connections come at a cost -- a recommendation can potentially lead to a privacy breach by revealing sensitive information. For instance, while the social network links might be public, both the user-product links and the user- user-trust links must be kept secret. (Knowing that your friend doesn't trust your judgement about books might be a breach of privacy). Similarly, revealing an edge in an e- mail graph, or revealing that a particular user purchased a sensitive product, constitutes a potentially serious breach of user privacy. Recommendations can indeed lead to such privacy breaches even without the use of social connections in the recommendation algorithm [5]. The privacy concerns posed by recommender systems and use of the social network graph have been at the forefront of industry discussion on the topic. In 2007, Facebook attempted to incorporate the product purchases made by one's friends into the stream of news one receives while visiting the site through a product called Beacon. Their launch showed that people interact with many websites and products in a way that they would not want their friends to know about, leading to several privacy lawsuits, and an eventual complete removal of the 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. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Copyright 200X ACM X-XXXXX-XX-X/XX/XX ...$5.00. 1http://www.trustedopinion.com/ 2http://www.somrnetworks.com/ 3http://developers.facebook.com/connect.php 4http://developer.yahoo.com/yos/intro/ 5http://www.google.com/friendconnect/ feature by Facebook. In this paper, we present the first theoretical study of the privacy-utility trade-offs in social recommender systems. While there are many different settings where social recom- mendations are used (friend/product recommendations, or trust propagation), and each leads to a slightly different for- mulation of the privacy problem (the sensitive information is different in each case), all these problems have the fol- lowing common structure -- recommendations are made on a graph where some subset of edges are sensitive. For clar- ity of exposition, we ignore (by and large) scenario specific constraints, and focus on the following general model. We consider a graph where all the edges are sensitive, and an algorithm that recommends a single node v in the graph to some target node u. We assume that the algorithm is based on a utility function that encodes the "goodness" of recommending each node in the graph to this target node. Suggestions for utility functions include number of common neighbors, weighted paths and PageRank distributions [21]. We consider an attacker who wishes to deduce the existence of a single edge (x, y) in the graph by passively observing the recommendation (v, u). We measure the privacy of the algo- rithm using differential privacy -- the ratio of the likelihoods of the algorithm recommending (v, u) on the graphs with the edge (x, y) and without the edge (x, y), respectively. In this setting, we ask the question: to what extent can edge recommendations be accurate while preserving differential privacy? Our Contributions and Overview. In this paper we present the following results on the accuracy of differentially private social recommendations. • We present a trade-off between the accuracy and pri- vacy of any social recommendation algorithm that is based on any general utility function. This trade-off shows an inevitable lower bound on the privacy pa- rameter  that must be incurred by an algorithm that wishes to guarantee any constant-factor approximation of the maximum utility. (Section 4) • We present lower bounds on accuracy and privacy for algorithms based on specific utility functions previ- ously suggested for recommending edges in a social network -- number of common neighbors and weighted paths [21]. Our trade-offs for these specific utility func- tions present stronger lower bounds than the general one that is applicable for all utility functions. (Section 5) • We adapt two well known privacy preserving algo- rithms from the differential privacy literature for the problem of social recommendations. The first (which we call Laplace), is based on adding random noise drawn from a Laplace distribution to the utility vector [8] and then recommending the highest utility node. The second (Exponential), is based on exponential smooth- ing [15]. We analyze and compare the accuracy of the two algorithms and comment on their relative merits. (Section 6) • We perform experiments on a real graph using the number of common neighbors utility function. The experiments compare the algorithms Laplace, Expo- nential, and our lower bound. Our experiments sug- gest three takeaways: (i) For most nodes, the lower bounds suggest that there is a huge inevitable trade- off between privacy and accuracy when making social recommendations; (ii) The more natural Laplace algo- rithm performs as well as Exponential; and (iii) For a large fraction of nodes, both Laplace and Exponential almost achieve the maximum accuracy level suggested by our theoretical lower bound. (Section 7) • We briefly consider the setting when an algorithm may not know (or be able to compute efficiently) the entire utility vector. We recognize that both Laplace and Ex- ponential algorithms assume the knowledge of all the utilities (for every node) when recommending to a tar- get node. We propose and analyze a sampling based linear smoothing algorithm that does not require all utilities to be pre-computed. We conclude by men- tioning several directions for future work. (Section 8) We now discuss related work and then formalize the mod- els and definitions in Section 3. 2. RELATED WORK Several papers propose that the social connections avail- able can be effectively utilized for enhancing online appli- cations [12, 2]. Golbeck [10] uses the trust relationships expressed through social connections for personalized movie recommendations and shows that the accuracy of the ratings outperform those produced by a collaborative filtering algo- rithm not utilizing the social graph. Mislove et al. [16] at- tempt an integration of web search with social networks and explore the use of trust relationships, such as social links, to thwart unwanted communication [17]. Approaches incorpo- rating trust models into recommender systems are gaining momentum both in academic research [25], [18], [23], and in real products. Examples include, Chorus6, which provides social app recommendations for the iPhone; Fruggo.com7, a social e-commerce site; and WellNet's8 online social net- working program for health care coordination9. Calandrino et al. [5] demonstrate that algorithms that recommend products based on a friends' purchases have very practical privacy concerns: "passive observations of Ama- zon.com's recommendations are sufficient to make valid in- ferences about individuals' purchase histories". McSherry et al. [14] show how to adapt the leading algorithms used in the Netflix prize for movie recommendations to make privacy- preserving recommendations. Their work does not apply to algorithms that rely on the underlying social graph be- tween users, as the user-user connections have not been re- leased as part of the Netflix competition. Aımeur et al. [1] study the problem of personalized recommendations in gen- eral. Dwork et al. [9] pose the problem of constructing differentially private analysis of social networks. Toubiana et al. [24] propose a framework for privacy preserving tar- geted advertising -- while targeting based on user history is considered, targeting based on social interactions is not considered. A related and independent work [4] considers the problem of mining top-k frequent item-set. Although they consider mechanisms analogous to the ones we propose, since we solve 6http://www.envionetworks.com/ 7http://fruugo.com/ 8http://www.wellnet.com/ 9www.medicalnewstoday.com/articles/118628.php two different problems, the focus of their analysis, notion of utility, and conclusions substantially differ from ours. 3. MODEL In this section, we describe the model for privacy-preserving social recommendations. We first define a social recommen- dation algorithm and then mention notions of monotonicity and accuracy of an algorithm. We then define axioms fol- lowed by typical utility functions that such algorithms are based on. Finally, we define differential privacy. 3.1 Social Recommendation Algorithm i Let G = (V, E) be the graph that describes the social net- work. Each recommendation is an edge (i, r), where node i is recommended to the target node r. Given a graph G, and a target node r, we denote the utility of recommending node i to node r by uG,r . Further, we assume that a recommen- dation algorithm R is a probability vector on all nodes. Let pG,r denote the probability of recommending node i to node i r in graph G by a specified algorithm. When the graph G and the source node r are clear from context, we drop G and r from the notation -- ui denotes the utility of recommend- ing i, and pi denotes the probability that R recommends i. We further define umax = maxi ui. i ui · pi) of each recommendation. We consider algorithms that attempt to maximize the ex- If we assume (without loss of generality) that the utility of the least useful recommendation is 0, the accuracy of such an algorithm can be defined as: pected utility ((cid:80) . umax Definition 1 (cid:80) uipi (Accuracy). An algorithm A is said to be (1 − δ)-accurate if given any set of utilities ui (for all i) denoted by (cid:126)u, A recommends node i with probability pi such that (1 − δ) = min(cid:126)u Therefore, an algorithm is said to be (1 − δ)-accurate if for any utility vector, the algorithm's expected utility is at least (1−δ) times the utility of the highest utility node in the given utility vector. It is easy to check that for the case when the utility of the least useful recommendation is umin, in all of our subsequent discussions, the definition of accuracy we use is equivalent to accuracy defined as the fraction of the difference between umax and umin. Scale Invariance of Sensitivity and Utility Func- tions. We initiate a small discussion on what happens when the utility values for all potential recommendable nodes are scaled by a multiplicative factor, or changed by an addi- tive constant. Intuitively, since the scale of utilities is chosen arbitrarily, one would expect the algorithms and the anal- ysis to be invariant to such numeric changes. However, be- cause of the constraints imposed by the desire to be privacy- preserving, where the privacy-preservation is with respect to a presence or absence of a particular edge, the scale invari- ance assumptions require a more careful articulation. In particular, the crucial point of interaction between the pri- vacy requirement and the utility function is the concept of sensitivity, denoted by ∆f , which is the maximum change in a utility vector (cid:126)u that can occur due to an addition or removal of one edge in the graph. Observe that if we scale a utility function by a multiplicative constant, the sensitivity of the utility function is scaled as well by the same constant. Without loss of generality, and for ease of subsequent expo- sition, we assume that ∆f = 1, an assumption that implies that the magnitudes of the utilities are now meaningful, as the higher utility magnitude corresponds to more edges that need to be added or removed in the graph in order to achieve it. Equivalently, we could have chosen to let the utilities be scale invariant, but would then need to compute and reason in terms of the sensitivity of the utility function. Another property that is natural of a recommendation algorithm is monotonicity: Definition 2 (Monotonicity). An algorithm is said to be monotonic if ∀i, j, ui ≥ uj implies that pi ≥ pj. 3.2 Axioms on Utility Functions We now define two axioms that we believe should be sat- isfied by any meaningful utility function in the context of recommendations on a social network. These axioms are later used in proving our theoretical results. Our axioms are inspired by the work of [21] and the specific utility functions they consider, which include: number of common neighbors, sum of weighted paths, and PageRank based utility mea- sures. Axiom 1 (Exchangeability). Let G be a graph and let h be an isomorphism on the nodes giving graph Gh, s.t. for target node r, h(r) = r. Then ∀i : uG,r i = uGh,r h(i) . This axiom captures the intuition that the utility of a node i should not depend on the node's name. Rather, its utility with respect to target node r only depends on the structural properties of the graph, and so, nodes that are isomorphic from the perspective of the target node r should have the same utility. V (G), such that S = β, and(cid:80) (Concentration Axiom). There exists S ⊂ i∈V (G) ui. i∈S ui ≥ Ω(1)(cid:80) Axiom 2 This says that there are some β nodes that together have at least a constant fraction of the total utility mass. This ax- iom is likely to be satisfied for small enough β, since usually there are some nodes that are very good for recommendation and many that are not so good. In the subsequent lower bound sections, we only consider monotonic algorithms for utility functions that satisfy the exchangeability axiom as well as the concentration axiom for a reasonable choice of β. A running example throughout the paper of a utility func- tion that satisfies these axioms in practical settings and is often deployed [21] is that of the number of common neigh- bors utility function: given a target node r and a graph G, the common neighbors utility metric assigns a utility uG,r i = c(i, r), where c(i, r) is the number of common neigh- bors between i and r. 3.3 Differential privacy Differential privacy [6] is a strong definition of privacy that is based on the following principle: an algorithm pre- serves the privacy of an entity if the algorithm's output is not sensitive to the presence or absence of the entity's infor- mation in the input data set. In our setting of graph-based social recommendations, we wish to maintain the presence (or absence) of an edge in the graph private. Hence, the privacy definition can be formally stated as follows. Definition 3. A recommendation algorithm R satisfies -differential privacy if for any pair of graphs G and G(cid:48) that differ in one edge (i.e., G = G(cid:48) + {e} or vice versa) and every set of possible recommendations S, P r[R(G) ∈ S] ≤ exp() × P r[R(G (cid:48) ) ∈ S] (1) where the probabilities are over the random coins of R. Differential privacy has been widely used in the privacy liter- ature [3, 8, 13, 15, 7], since it is even resilient to adversaries who know all but one edges in the graph, and guarantees privacy for multiple runs of the algorithm. While weaker notions of privacy have also been considered in the litera- ture, in this paper we focus on the strong differential privacy definition only. Since in social recommendations protecting privacy is extremely important, it seems reasonable to first explore and understand the strongest notions of privacy. In this paper, we only consider the utility of a single social recommendation. We note that in this setting, we can relax the differential privacy definition such that Equation 1 only holds for graphs G and G(cid:48) that differ in an edge e that is not incident on r, the target of the recommendation. This mirrors the natural setting where (a) one recommendation is made to the attacker (r), (b) only the target node (the attacker) sees the recommendation. By considering G and G(cid:48) that differ in e = (i, r), the adversary can only learn about his neighborhood (which he is aware of to start with) and not learn whether two legitimate nodes in the graph are connected. While we consider a single recommendation throughout the paper, we use the relaxed variant of differ- ential privacy only in Sections 5 and 7. 4. GENERAL LOWER BOUND In this section we prove a lower bound on the privacy parameter  on any differentially private recommendation algorithm that (a) achieves a constant accuracy and (b) is based on any utility function that satisfies the exchangeabil- ity and concentration. Let us first sketch the proof technique for the lower bound using the number of common neighbors utility metric, and then state the lower bound for a general utility metric. An interested reader can find the full proofs in the Appendix. Recall that given a target node r and a graph G, the common neighbors utility metric assigns a utility uG,r i = c(i, r), where c(i, r) is the number of common neighbors between i and r. The nodes in any graph can be split into two groups -- V r hi, nodes which have a high utility for the target node r and V r lo, nodes that have a low utility. In the case of common neighbors, all nodes i in the 2-hop neighborhood of r (who have at least one common neighbor with r) can be part of V r hi and the rest in V r lo. Since the recommendation algorithm has to achieve a constant accuracy, it has to recommend one of the high utility nodes with constant probability. hi, but there are many nodes in V r By the concentration axiom, there are only a few nodes in V r lo; in the case of com- mon neighbors, node r may only have 10s or 100s of 2-hop neighbors in a graph of millions of users. Hence, there exists a node i in the high utility group and a node (cid:96) in the low utility group such that Γ = pi/p(cid:96) is very large (Ω(n)). At this point, we show that we can carefully modify the graph G by adding and/or deleting a small number (t) of edges in such a way that the node (cid:96) with the smallest probability of being recommended in G becomes the node with the highest utility in G(cid:48). By the exchangeability axiom, we can show that there always exist some t edges that make this possi- ble. For instance in the common neighbors case, we can do this by adding edges between a node i and t of r's neigh- bors, where t > maxi c(i, r). It now follows from differential privacy that  ≥ 1 t log Γ More generally, let V r hi be the set of nodes 1, . . . , k each of which have utility ui > (1− c)umax, and let V r lo be the nodes k + 1, . . . , n each of which have ui ≤ (1 − c)umax utility of being recommended to target node r. Recall that umax is the utility of the highest utility node. Let t be the number of edge alterations required to turn a node with the smallest probability of being recommended from the low utility group into a node of maximum utility in the modified graph. The following lemma states the main trade-off relationship be- tween the accuracy parameter δ and the privacy parameter  of a recommendation algorithm. Lemma 1.  ≥ 1 t δ ) + ln( n−k (cid:0)ln( c−δ k+1 )(cid:1) This lemma gives us a lower bound on the privacy guar- antee  in terms of the utility parameter δ. Equivalently, Corollary 1. 1 − δ ≤ 1 − c(n−k) n−k+(k+1)et By using the concentration axiom with parameter β we can prove the following. Lemma 2. For (1 − δ) = Ω(1) and β = o(n/ log n),  ≥ log n − o(log n) t (2) This expression can be intuitively interpreted as follows: in order to achieve good accuracy with a reasonable amount of privacy (where  is independent of n), either the number of nodes with high utility needs to be very large (i.e. β needs to be very large, Ω(n/ log n)), or the number of steps needed to bring up any node's utility to the highest utility needs to be large (i.e. t needs to be large, Ω(log n)). We shall use this relationship from Lemma 2 in the sub- sequent section to prove stronger lower bounds for specific utility functions. Below we mention a generic lower bound that applies to any utility function. Note that we only need an upper bound on t. The tighter upper bound we are able to prove on t, the better lower bound we get for . Using the exchangeability axiom, we can show that t ≤ 4∗ dmax in any graph. Consider the highest utility node and the lowest utility node, say x and y respectively. These nodes can be interchanged by deleting all of x's current edges, adding edges from x to y's neighbors, and doing the same for y. This requires at most 4 ∗ dmax changes. Hence, Theorem 1. For a graph with maximum degree dmax = α log n, a differentially private algorithm can guarantee con- stant accuracy only if (cid:18) 1 4  ≥ 1 α − o(1) (cid:19) (3) In the next section, we present stronger lower bounds for two well studied utility functions -- common neighbors and weighted paths. 5. LOWER BOUNDS FOR SPECIFIC UTIL- ITY FUNCTIONS In this section, we start from Lemma 2 and prove stronger lower bounds for specific utility functions by proving stronger upper bounds on t. Proofs and more details can be found in the Appendix. 5.1 Common neighbors lower bound Consider a graph and a target node r. As we saw in the previous section, we can make any node x have the highest utility by adding edges to all of r's neighbors. If dr is r's degree, it suffices to add t = dr + O(1) edges to make a node the highest utility node. We state the following theorem for a more general version of common neighbors utility function below. Theorem 2. Let U be a utility function that depends only on and is monotonically increasing with c(x, y), the number of common neighbors between x and y. A recommendation algorithm based on U that guarantees any constant approx- imation to utility for target node r has a lower bound on privacy given by  ≥ 1−o(1) where dr = α log n. α As we will show in Section 7, this is a very strong lower bound. Since a significant fraction of nodes in real-world graphs have small dr (due to a power law degree distribu- tion), we can expect no algorithm based on common neigh- bors utility to be both accurate on most nodes and satisfy differential with a reasonable . 5.2 Weighted Paths A natural extension of the common neighbors utility func- tion and one whose usefulness is supported by the literature [21], is the weighted path utility function, defined as score(s, y) =(cid:80)inf l=2 γl−1paths(l) (s,y), (s,y) denotes the number of length l paths from where paths(l) s to y. Typically, one would consider using small values of γ, such as γ = 0.005, so that the weighted paths score is a "smoothed version" of the common neighbors score. Again let r be the target node. To make node y the highest utility node, we add edges such that y has cdr common neighbors with r. Now, the goal is to choose c > 1 such that this alone is sufficient to ensure that y has the highest utility. This is done by showing that (a) no other node has more than dr common neighbors with r, and (b) the utility derived from paths of length ≥ 3 cannot offset the additional common neighbors between y and r (for suitably small γ). Finally, we show that this requires adding only t < dr + 2 ∗ (c − 1) + O(1). Theorem 3. For weighted paths based utility functions with parameter γ, we have t ≤ (1 + o(1))dr when making ). Therefore, for recommendations for node r, if γ = o( an algorithm to guarantee constant approximation to utility, the privacy must be  ≥ 1 α (1 − o(1)) where dr = α log n. dmax 1 6. PRIVACY-PRESERVING RECOMMENDA- TION ALGORITHMS There has been a wealth of literature on developing differ- entially private algorithms [3, 8, 15]. In this section we will adapt two well known tools, Laplace noise addition [8] and exponential smoothing [15], to our problem. For the pur- pose of this section, we will assume that given a graph and a target node, our algorithm has access to (or can efficiently compute) the utilities ui for all other nodes in the graph. Given this vector of utilities, our goal is to compute a vec- i ui · pi is maximized, tor of probabilities pi such that (a)(cid:80) and (b) differential privacy is satisfied. Clearly, maximum accuracy is achieved by recommending the node with utility umax. However, it is well known that any algorithm that satisfies differential privacy must recom- mend every node, even the ones that have zero utility, with a non-zero probability [20]. Indeed, suppose for graph G and target node r, an algorithm assigns 0 probability to some node x with utility uG,r and a positive probability to some . Transform G into G(cid:48) as follows: node y, with utility uG,r connect x to all of y's neighbors in G and disconnect x from all its neighbors in G. Do the same for y. This in turns cre- ates an isomorphism h between G and G(cid:48), where h(r) = r. Hence, by the exchangeability axiom, the algorithm will rec- ommend y with 0 probability. Thus, there is a path from G to G(cid:48) of length t such that py goes from a positive number to 0. This leads to a breach of differential privacy. x y The following two algorithms ensure differential privacy: 6.1 Exponential mechanism The exponential mechanism creates a smooth probability distribution from the utility vector and then samples from that. ∆f ui /(cid:80)n Definition 4. Exponential mechanism: Given nodes with utilities (u1, . . . , ui, . . . , un), algorithm AE() recom- mends node i with probability ∆f uk , where  ≥ 0 is the privacy parameter, e and ∆f is the sensitivity of the utility function10. k=1 e   Theorem 4. [15] AE() guarantees  differential privacy. 6.2 Laplace mechanism Unlike the exponential mechanism, the Laplace mecha- nism mimics the optimal mechanism. It first adds random noise drawn from a Laplace distribution, and like the opti- mal mechanism, picks the node with the maximum noise- infused utility. Definition 5. Laplace mechanism: Given nodes with utilities (u1, . . . , ui, . . . , un), algorithm AL() first computes a modified utility vector (u(cid:48) i = ui + r where r is a random variable chosen from the Laplace distri- bution with scale ( ∆f  )11 independently at random for each i. Then, AL() recommends node z whose noisy utility is maximal among all nodes, i.e. z = arg maxi u(cid:48) i. n) as follows: u(cid:48) 1, . . . , u(cid:48) Theorem 5. AL() guarantees  differential privacy. Proof. The proof follows from the privacy proof of the Laplace mechanism in the context of publishing privacy- preserving histograms [8] by observing that one could treat each node as a histogram bin and release the noisy count for the value in that bin, u(cid:48) i. Since AL() is effectively doing post-processing by releasing only the name of the bin with the highest noisy count, the algorithm remains private. 10∆f = maxr maxG,G(cid:48):G=G(cid:48)+e (cid:126)uG,r − (cid:126)uG(cid:48),r 11In this distribution, the pdf at y is 2∆f exp(−y/∆f )  An astute reader might remark at this point that the Laplace mechanism as stated does not satisfy the mono- tonicity property that we relied upon in our lower bound proofs. Indeed, the Laplace mechanism satisfies the prop- erty only in expectation; however, that is not an obstacle to our analysis since in order to meaningfully compare the per- formance of Laplace mechanism with other mechanisms and with the theoretical bound on performance, we would need to evaluate its expected, rather than one-time, performance. 6.3 Exponential vs Laplace Mechanisms It is natural to ask whether there is an equivalence be- tween the two approaches of transforming a non-private al- gorithm to a privacy-preserving algorithm or how they would compare, perhaps depending on the setting. We present pre- liminary results on comparing the utilities when there are only two possible recommendations (n = 2). The theorem is stated below and the proof can be found in the Appendix. Theorem 6. Let UE and UL denote the utilities achieved by AE() and AL() on input vector (u1, u2), respectively. Wlog, assume u1 ≥ u2. Then UE = u1 and UL = u1(1 − 1 2 e−(u1−u2) − (u1−u2) (u1−u2) 4e(u1−u2) ) 4e(u1−u2 ) ) + u2( 1 2 e−(u1−u2) + eu1 eu1 +eu2 +u2 eu2 eu1 +eu2 To our knowledge, in the course of the proof we give the first explicit closed form expression for the probabilities of each of the two nodes being recommended by Laplace mech- anism (the work of [19] gives a formula that does not apply to our setting). Although the expressions for UE and UL are difficult to compare by eye-balling, by plugging in various values of u1 and u2 into the formulas, one infers that the Exponen- tial mechanism slightly outperforms the Laplace mechanism, when  is very small and the difference between u1 and u2 is large. We leave it for future work to simplify these as well as extend the analysis to the n > 2 case. Implementation efficiency. The Laplace mechanism is more intuitive than the Exponential mechanism, and more likely to receive executive buy-in in a real-world environ- ment. Furthermore, it has the advantage that it can be implemented more easily than the Exponential mechanism. AL requires computing the noisy utilities and then selecting the node with the highest noisy utility, which takes linear time. AE requires first computing a set of smoothed utilities and then sampling from the probability distribution induced by them, which can be accomplished in linear time using the alias-urn method suggested by [22], but likely slightly less practically efficiently than AL. 7. UTILITY ACHIEVABLE IN PRACTICE ON A REAL GRAPH In this section we present experimental results on a real graph and for the # of common neighbors utility function. The experiments compare the algorithms Laplace, Exponen- tial, and our lower bound. Our experiments suggest three takeaways: (i) For most nodes, the lower bounds suggest that there is a huge inevitable trade-off between privacy and accuracy when making social recommendations; (ii) The more natural Laplace mechanism performs as well as the Ex- ponential mechanism; and (iii) For a large fraction of nodes, the accuracy achieved by Laplace and Exponential mecha- nisms does not substantially differ from the best possible accuracy suggested by our theoretical lower bound. 7.1 Experimental Setup For our experiments we use the Wikipedia vote network [11] available from Stanford Network Analysis Package12. Some users in Wikipedia are administrators, who have ac- cess to additional technical features. Users are elected to be administrators via a public vote of other users and ad- ministrators. The Wikipedia vote network consists of all users participating in the elections (either casting a vote or being vote on), since inception of Wikipedia until January 2008. We turn the network of [11] into an undirected net- work, where each node represents a user and an edge from node i to node j represents that user i voted on user j or user j voted on user i. This obtained network consists of 7,115 nodes and 100,762 edges. Although the Wikipedia vote network is publicly available, and hence the edges in it are not private, we believe that the graph itself exhibits the structure and properties of some of the graphs in which one would want to preserve privacy, such as the graph of social connections and people's product purchases. For each pair of nodes in the social network, except nodes that share an edge, we compute the number of common neighbors they have in the Wikipedia vote network. Then, assuming we will make one recommendation for each node in the graph, we compute the expected accuracy of recommen- dation for that node. For the Exponential mechanism and the theoretical bound, given the utilities of recommending each node to a given node v, we can compute the expected accuracy and the theoretical bound on accuracy exactly. For the Laplace mechanism, we compute its expected accuracy by running 1, 000 independent trials of the Laplace mecha- nism, and averaging the utilities obtained in those trials, for each node in the graph.13 7.2 Exponential vs Laplace in practice We first observe in Figure 1 that for all nodes in the Wikipedia vote network, the Laplace mechanism achieves nearly identical accuracy as the Exponential mechanism. This confirms our hypothesis of Section 6 that Exponential and Laplace mechanisms are nearly equivalent in practical settings, and implies that one can use the more intuitive and easily implementable Laplace mechanism in practice. 7.3 Social Recommendations: Good or Pri- vate? We now proceed to evaluate the accuracy of the Exponen- tial mechanism and compare it with the best accuracy one can hope to achieve using a privacy-preserving recommen- dation algorithm, as computed according to our theoretical bound of Corollary 1. For ease of visual presentation, we assume that we do not care about node identities; we number the nodes in decreas- ing order of the accuracy one can hope for when making the recommendation for that node, as predicted by the the- oretical bound. For each node, the graph in Figure 2 shows the theoretical bound and the accuracy achieved by the Ex- 12http://snap.stanford.edu/data/wiki-Vote.html 13Out of the 7,115 nodes, there are 60 nodes that have no common neighbors with anyone except nodes they are al- ready connected to. We omit those nodes from our analysis. Figure 1: Accuracy achieved by Exponential and Laplace mechanisms on Wikipedia vote network using # of common neighbors as a measure of utility. The x-axis represents the node number, the y-axis - the ac- curacy of recommendation for that node. The top graph is for desired privacy guarantee of  = 0.1, the bottom - for  = 0.5. Figure 2: Accuracy achieved by Exponential mecha- nisms and predicted by theoretical bound on Wikipedia vote network using # of common neighbors as a measure of utility. The x-axis represents the node number, the y- axis - the expected accuracy of recommendation for that node. The top graph is for desired privacy guarantee of  = 0.1, the bottom - for  = 0.5. ponential mechanism. Due to our chosen numbering of the nodes, the theoretical bound is a smooth monotonically de- creasing function of the node number, whereas the achieved accuracy is not necessarily monotonically decreasing (and thus, in places, does not appear as a line). As can be seen in Figure 2 and Figure 3, for some nodes, the Exponential mechanism performs quite well, achieving nearly perfect accuracy. However, the number of such nodes is fairly small - the Exponential mechanism achieves better than 0.9 approximation for less than 1.5% of the nodes when  = 0.1 and less than 21% of the nodes when  = 0.5, it achieves better than 0.8 approximation for less than 2% of the nodes when  = 0.1 and less than 25.5% of the nodes when  = 0.5. This matches the intuition that by making the privacy requirement more lenient, one can hope to make better quality recommendations for more nodes; however, this also pinpoints the fact that for most nodes, the Expo- nential mechanism does not achieve good accuracy. Although there is a possibility that one could develop bet- ter privacy-preserving recommendation mechanisms than Ex- ponential or Laplace, this experiment shows that for a large number of target nodes, our theoretical bound limits the best accuracy one can hope to achieve privately quite severely. For example, for  = 0.1, no privacy-preserving algorithm can hope to achieve a better than 70% accuracy for more than 9% of the nodes. This finding throws into serious ques- tion the feasibility of developing social recommendation al- gorithms that are both accurate and privacy-preserving for many real-world settings. Finally, in practice, it is the least connected nodes that are likely to benefit most from receiving high quality rec- ommendations. However, our experiments suggest that the low degree nodes are also the most vulnerable to receiv- ing low accuracy recommendations due to needs of privacy- preservation: see Figure 4 for an illustration of how accuracy depends on the degree of the node. This further suggests that, in practice, one has to make a choice between preserv- ing accuracy vs preserving privacy. 7.4 Are AE and AL good enough for utility func- tion based on common neighbors? As we have experimentally observed in Figure 2, the Ex- ponential mechanism achieves good accuracy compared to the best achievable accuracy predicted by our theoretical bound. We can formalize this statement rigorously as fol- lows (proved in the Appendix): Lemma 3. Let AE denote the accuracy of the Exponential mechanism, and AO denote the upper bound on the accuracy that can be achieved by any privacy-preserving algorithm. Then, for utility functions based on the number of common neighbors between two nodes, AE k+1 , where k is the AO number of nodes with non-zero utility. ≥ 1 Furthermore, Lemma 4. For utility vector of the form ≥ k u = (umax, . . . , umax, 0, . . . , 0), AE AO number of nodes with non-zero utility, k+1 , where k is the For real-world graphs, we expect the number of nodes with non-zero utility k to be fairly small, and thus, the Expo- Figure 3: Performance of the Exponential mechanisms and predicted by theoretical bound on Wikipedia vote network using # of common neighbors as a measure of utility. The x-axis represents the accuracy, the y-axis - the expected percentage of nodes for whom that accu- racy of recommendation is achieved (or predicted by the theoretical bound). The top graph is for desired privacy guarantee of  = 0.1, the bottom - for  = 0.5. nential mechanism to achieve a good approximation to the best possible accuracy achievable by a privacy-preserving so- cial recommendation algorithm. Furthermore, observe that Corollary 1 merely gives an upper bound on accuracy achiev- able in a privacy-preserving manner, but it might be the case that tighter lower bounds can be obtained. Hence, in many ways, the Exponential and Laplace mechanisms are repre- sentative of the class of good privacy-preserving mechanisms one can hope for. 8. EXTENSIONS AND FUTURE WORK 8.1 Vertex privacy and non-monotone algo- rithms We considered the setting of graph based social recom- mendations where we wished to maintain private the infor- mation about the presence or absence of an edge in the graph but our reasoning and results can easily be generalized to a setting where we would like to protect the entire identity of a node. To achieve that, one would need to strengthen the definition of the recommendation algorithm satisfying dif- ferential privacy to consider graphs that differ in one node, rather than one edge, and adjust the value of t, the number of edge alterations to turn a node from the low utility group into a node of maximum utility, respectively. Furthermore, our results can be generalized to social rec- ommendation algorithms that do not satisfy the monotonic- ity property. For clarity of exposition, we omit the exact statements and proofs of lemmas analogous to Lemmas 1 Figure 4: Accuracy achieved by Exponential mechanism and predicted by Theoretical Bound as a function of node degree,  = 0.5 and 2 but remark that the statement formulations and our qualitative conclusions will remain essentially unchanged, with the exception of the meaning of variable t. Without the monotonicity property, t would correspond to the num- ber of edge alterations necessary to exchange the node with the smallest probability of being recommended and the node with the highest utility, rather than to the number of edge alterations necessary to make the node with the smallest probability of being recommended into the node with the highest utility, leading to a higher value for t. 8.2 What if utility vectors are unknown? Both the differentially private algorithms we considered in Section 6 assume the knowledge of the entire utility vec- tor. This assumption cannot be made in social networks for various reasons. Firstly, computing as well as storing the utility of n2 pairs is prohibitively expensive, when dealing with graphs of several hundred million nodes. Secondly, even if one could compute and store them, these graphs change at staggering rates, therefore, utility vectors are also con- stantly changing. We believe that this is a very important and interesting problem. In this section, we explore a simple algorithm that assumes no knowledge of the utility vector; it only assumes that sampling from the utility vector can be done efficiently. 8.2.1 Suppose we are given an algorithm A which is a γ ap- proximation in terms of utility, and not provably private. We show how to modify the algorithm A to guarantee dif- ferential privacy, while still preserving, to some extent, the utility approximation of A. The proof of the following the- orem, and a note, are placed in the appendix. Sampling and Linear Smoothing Definition 6. Given algorithm A = (p1, . . . , pi, . . . , pn), n + algorithm AS(x) recommends node i with probability 1−x xpi, where 0 ≤ x ≤ 1 is a parameter. Theorem 7. AS(x) guarantees ln(1 + nx 1−x )-differential privacy and a xγ approximation of utility. Another idea worth exploring is perturbing the input graph (by adding/deleting a fraction of possible edges) and then sampling and recommending from it. What is the rela- tionship between the extent of perturbation and the util- ity/privacy guarantees? 8.3 Future Work Several interesting questions remain unexplored in this work. While we have considered some specific utility func- tions in this paper, it would be nice to look more. Further, our motivation was to look at the most stringent require- ment in terms of privacy; however, a natural question is to understand utility-privacy trade-offs for certain typical graphs that arise in social networks. This paper only considers lower bounds and algorithms for making one single recommendation. It would be very interesting, and important, to explore how the effect on pri- vacy compounds with multiple recommendations. Further, some edges can be more sensitive than others. Perhaps the solution should be methodological - enable opt-in/opt-out settings to specify which nodes/edges are private. A closer look at such dependences is required. Also, most works on making recommendations deal with static databases. Social networks clearly change over time (and rather rapidly). This raises several issues, such as not being able to assume the utility vector is known, sensi- tivity changing, privacy impacts of dynamic databases etc. Dealing with such temporal graphs and understanding there trade-offs would be very interesting. Finally, it would certainly be interesting to extend these results for weaker notions of privacy than differential pri- vacy. For instance, some privacy notions previously defined include k-anonymity, (, δ)-differential privacy, and relaxing the adversary's background knowledge to just the general statistics of the graph. 9. ACKNOWLEDGMENTS The authors are grateful to Arpita Ghosh and Tim Rough- garden for thought-provoking discussions. 10. REFERENCES [1] E. Aımeur, G. Brassard, J. M. Fernandez, and F. S. Mani Onana. Alambic: a privacy-preserving recommender system for electronic commerce. Int. J. Inf. Secur., 7(5):307 -- 334, 2008. [2] R. Andersen, C. Borgs, J. T. Chayes, U. Feige, A. D. Flaxman, A. Kalai, V. S. Mirrokni, and M. Tennenholtz. Trust-based recommendation systems: an axiomatic approach. In WWW, pages 199 -- 208, 2008. [3] B. Barak, K. Chaudhuri, C. Dwork, S. Kale, F. McSherry, and K. Talwar. Privacy, accuracy and consistency too: A holistic solution to contingency table release. In PODS, 2007. [4] R. Bhaskar, S. Laxman, A. Smith, and A. Thakurta. Personal communication, 2010. [5] L. Calandrino, A. Narayanan, E. Felten, and V. Shmatikov. Don't review that book: Privacy risks of collaborative filtering. Manuscript, 2009. [6] C. Dwork. Differential privacy. In ICALP, 2006. [7] C. Dwork. Differential privacy: A survey of results. In TAMC, pages 1 -- 19, 2008. [8] C. Dwork, F. McSherry, K. Nissim, and A. Smith. Calibrating noise to sensitivity in private data analysis. In TCC, pages 265 -- 284, 2006. [9] C. Dwork and A. Smith. Differential privacy for statistics: What we know and what we want to learn. In NCHS/CDC Data Confidentiality Workshop, 2008. [10] J. Golbeck. Generating predictive movie recommendations from trust in social networks. In iTrust, pages 93 -- 104, 2006. [11] J. Leskovec, D. Huttenlocher, and J.Kleinberg. Predicting positive and negative links in online social networks. In WWW, 2010. [12] H. Ma, I. King, and M. R. Lyu. Learning to recommend with social trust ensemble. In SIGIR, pages 203 -- 210, 2009. [13] A. Machanavajjhala, D. Kifer, J. Abowd, J. Gehrke, and L. Vihuber. Privacy: From theory to practice on the map. In ICDE, 2008. [14] F. McSherry and I. Mironov. Differentially private recommender systems: building privacy into the net. In KDD, pages 627 -- 636, 2009. [15] F. McSherry and K. Talwar. Mechanism design via differential privacy. In FOCS, pages 94 -- 103, 2007. [16] A. Mislove, K. P. Gummadi, and P. Druschel. Exploiting social networks for internet search. In Proceedings of the 5th Workshop on Hot Topics in Networks (HotNets'06), November 2006. [17] A. Mislove, A. Post, K. P. Gummadi, and P. Druschel. Ostra: Leverging trust to thwart unwanted communication. In Proceedings of the 5th Symposium on Networked Systems Design and Implementation (NSDI'08), April 2008. [18] M. Montaner, B. L´opez, and J. L. d. l. Rosa. Opinion-based filtering through trust. In CIA '02: Proceedings of the 6th International Workshop on Cooperative Information Agents VI, pages 164 -- 178, London, UK, 2002. Springer-Verlag. [19] S. Nadarajah and S. Kotz. On the linear combination of laplace random variables. Probab. Eng. Inf. Sci., 19(4):463 -- 470, 2005. [20] K. Nissim. Private data analysis via output perturbation. In Privacy-Preserving Data Mining: Models and Algorithms, pages 383 -- 414. Springer, 2008. [21] D. L. Nowell and J. Kleinberg. The link prediction problem for social networks. In CIKM, pages 556 -- 559, 2003. [22] J. Peterson, Arthur V. and R. A. Kronmal. On mixture methods for the computer generation of random variables. The American Statistician, 36(3):184 -- 191, 1982. [23] G. Swamynathan, C. Wilson, B. Boe, K. Almeroth, and B. Y. Zhao. Do social networks improve e-commerce?: a study on social marketplaces. In WOSP '08: Proceedings of the first workshop on Online social networks, pages 1 -- 6, New York, NY, USA, 2008. ACM. [24] V. Toubiana, A. Narayanan, D. Boneh, H. Nissenbaum, and S. Barocas. Adnostic: Privacy preserving targeted advertising. In NDSS, 2010. [25] C.-N. Ziegler and G. Lausen. Analyzing correlation between trust and user similarity in online communities. In Proceedings of Second International Conference on Trust Management, pages 251 -- 265. Springer-Verlag, 2004. Or (for small enough β) APPENDIX Proof of Lemma 1 Proof. We initiate the analysis with a simple claim. Claim 1. In order to achieve (1 − δ) accuracy, at least c−δ c of the probability weight has to go to nodes in the high utility group, so there exists a node x in the low utility group of G1 that is recommended with probability of at most c(n−k) , e.g. pG1 x ≤ δ δ c(n−k) . p+umax + (1 − c)umaxp− ≥(cid:80) Proof. Denote by p+ and p− the total probability that goes to high/low utility nodes, respectively, and observe that i uipi ≥ (1 − δ)umax and p+ + p− ≤ 1, hence, p+ > c−δ c , p− ≤ δ c . We now continue the proof of Lemma 1. Let G2 be the graph that turns x, found according to the Claim above, into a node of highest utility by addition of t edges. By differential privacy, we have p p In order to achieve (1 − δ) accuracy on G2, at least c−δ of the probability weight has to go to nodes in the high utility group, and hence by monotonicity P r[xG2] > c−δ c(k+1) . Combining the previous three inequalities, we obtain: c ≤ et. G2 x G1 x (c−δ)(n−k) (k+1)δ = c−δ c(k+1) c(n−k) δ < p p ≤ et, hence G2 x G1 x (cid:0)ln(  ≥ 1 t c − δ δ ) + ln( n − k k + 1 )(cid:1) This completes the proof. Proof of Lemma 2 (cid:16) 1 − 1 (cid:17) Proof. We first use the concentration axiom to prove the following claim. Claim 2. If c = , then k = O(β log n) where log n (cid:17) β is the parameter of the concentration axiom. (cid:16) log n . Let the total utility mass be U =(cid:80) Proof. Now consider the case when c = Therefore, k is the number of nodes that have utility at least umax i ui. Since by concentration, the β highest utility nodes add up to a total utility mass of Ω(1)∗ U , we have umax ≥ Ω( U β ). There- fore, k, the number of nodes with utility at least umax log n is at most U log n umax which is at most O(β log n). 1 − 1 log n . We now prove the Lemma using Lemma 1 and Claim 2. Substituting these in the expression, if we need 1− c(n−k) to be Ω(1), then require (k + 1)et to be Ω(n − k). (Notice that if (k + 1)et = o(n − k), then n−k+(k+1)et ≥ c − o(1), which is 1 − o(1).). Therefore, if we want an algorithm to obtain constant approximation in utility, i.e. (1 − δ) = Ω(1), then we need the following (assuming β to be small): c(n−k) n−k+(k+1)et (O(β log n))et = Ω((n − O(β log n)) Simplifying et = Ω( n β log n )  ≥ log n − log β − log log n t  ≥ log n − o(log n) t Proof of Theorem 2 Proof. Lower Bound for Common Neighbors We formalize the intuition in terms of an upper bound on t in the following claim. Claim 3. For common neighbors based utility functions, when recommendations for r are being made, we have t ≤ dr + 2, where dr is the degree of node r. Proof. Observe that if the number of common neighbors is the measure of the utility of recommendation, then one can make any zero utility node, say x, for source node r into a max utility node by adding dr edges to all of r's neighbors and additionally adding two more edges (one each from r and x) to some node with small utility. This is because the highest utility node has at most dr common neighbors with r (one of which could potentially be x). Further, adding these edges cannot increase the number of common neighbors for any other node beyond dr. We now use this to get the theorem immediately by re- placing t in the expression stated previously. Proof of Theorem 3 Proof. Lower Bound for Sum of Weighted Paths The number of paths of length l between two nodes is at most dl−1 max. Let x be the highest utility node and let y be the node we wish to make the highest utility node after adding certain edges. If we are making recommendations for node r, then the maximum number of common neighbors with r is at most dr. ux ≤ γdr term as well.) Currently denote the utility of x by ux. We know that max. (In fact one can tighten the second We rewire the graph as follows. Any (c−1)dr nodes (other than y and the source node r) are picked; here c > 1 is to be determined later. Both r and y are connected to these (c − 1)dr nodes. Additionally, y is connected to all of r's dr neighbors. Therefore, we now get the following. (cid:80)inf l=3 γl−1dl−1 uy ≥ γcdr Now we wish to bound by above the utility of any other node in the network in this rewired graph. Notice that every other node still has at most dr paths of length 2 with the source. Further, there are only two nodes in the graph that have degree more than dmax + 1, and they have degree at most (c + 1)dmax. Therefore, the number of paths of length l for l ≥ 3 for any node is at most ((c+1)dmax)2·(dmax +1)l−3. This can be further tightened to ((c + 1)dmax)2 · (dmax)l−3. We therefore get the following for any x in the rewired graph, Let p(cid:48)(cid:48) i = 1−x n + xpi. We have (cid:48)(cid:48) n + x, ≤ p 1 − x n i ≤ 1 − x n(cid:88) k uk = 1 and(cid:80) pkuk = γ. 1 − x n n(cid:88) ( k=1 (cid:48)(cid:48) k = )uk+ k=1 The utility of AS is since 0 ≤ pi ≤ 1. n(cid:88) where we use(cid:80) U (AS) = k=1 ukp xpkuk = 1 − x n +xγ ≥ xγ, For the privacy guarantee, note again that the upper and lower bounds on p(cid:48) i hold for any graph and utility function. Therefore, the change in the probability of recommending i for any two graphs G and G(cid:48) that differ in exactly one edge is at most pi(G) pi(G(cid:48)) ≤ x + 1−x n 1−x n = 1 + nx 1 − x . Therefore, AS is ln(1+ nx plete the proof. 1−x )-differentially private. This com- Further, note, to guarantee 2- differentially privacy for 1−x ) = AS(x), we need to set the parameter x so that ln(1 + nx 2c ln n (rewriting  = c ln n), namely n2c − 1 x = n2c − 1 + n . The algorithm AS guarantees a utility of at least xγ. Proof of Lemma 3 Proof. Suppose the variations on the common neighbor functions permitted are ui = di/z, where di is the number of common neighbors node i has with the target node, and z is a scaling constant. Pick c = 1, meaning that all nodes except k have zero utility. Then UO ≤ umax(1 − δ) ≤ umax(1 − n−k+(k+1)eumax ) = umax n−k+(k+1)eumax . (k+1)eumax n−k ezumax Under our restricted privacy definition, the sensitivity of the scaled number of common neighbors utility function is 1 z . UE ≥ umax eumax Hence UE k+1 and exponential algorithm gives a (k + 1) UO approximation of utility, which could be a fairly good ap- proximation, if k is small compared to n, which is what we expect, in real-world social network graphs. n−k+kezumax = umax ≥ 1 n−k+keumax ≥ umax eumax n−k+(k+1)eumax . ux ≤ γdr + (c + 1)2 ∞(cid:88) l=3 γl−1dl−1 max Now consider the case where γ < 1 dmax . We get ux ≤ γdr + (c + 1)2γ2d2 1 − γdmax We now want uy ≥ ux. This reduces to max (c − 1) ≥ (c + 1)2γdmax 1 − γdmax 1 Now if γ = o( ) then it is sufficient to have (c − 1) = Ω(γdmax) which can be achieved even with c = 1 + o(1). Now notice that we only added dr + 2(c − 1)dr edges to the graph. This completes the proof of the theorem. dmax 1 Comment on relationship between common neigh- bors and weighted paths: Since common neighbors is an extreme case of weighted paths (as γ → 0), we are able to obtain the same lower bound (up to o(1) terms) when γ is made small (in particular, γ ≈ o( ). Can one ob- tain (perhaps weaker) lower bounds when say γ = Θ( )? Notice that the proof only needs (c − 1) ≥ (c+1)2γdmax . We 1−γdmax then get a lower bound of  ≥ 1 2c−1 ) where dr = α log n. Setting γdmax = s, for some constant s, we can find the smallest c that satisfies the expression (c − 1) ≥ (c+1)2s . 1−s Notice that this does give a nontrivial lower bound (i.e. a lower bound tighter than the generic one presented in the previous section), as long as s is a sufficiently small constant. α ( 1−o(1) dmax dmax 1 Proof of Theorem 6 Proof. Utility of Laplace for n = 2: Suppose we have two elements, with utility t1 and t2, respectively, where t1 ≥ t2 wlog. (cid:90) ∞ −∞ Let φX (t) denote the characteristic function of the Laplace distribution, it is known that φX (t) = 1 1+b2t2 . Moreover, it is known that if X1 and X2 are independently distributed random variables, then φX1+X2 (t) = φX1 (t)φX2 (t) = Using the inversion formula, we can compute the pdf of X = X1 + X2 as follows: 1 (1+b2t2)2 . fX (x) = F (cid:48) X (x) = 1 2π −itxφX (t)dt e 4 e−x( 2 For x > 0, the pdf of X1 + X2 is fX (x) = 1 the cdf is FX (x) = 1 − 1 What is the probability that element 1 is recommended? It's the P r[t1 + X1 > t2 + X2] = P r[X2 − X1 < t1 − t2] = 2 e−(t1−t2) − (t1−t2) 1 − 1 4 e−(t1−t2)( 2 4e(t1−t2 ) Hence, the Laplace mechanism recommends node 1 with  + (t1 − t2)) = 1 − 1 4b (1 + x  + x). b and b )e− x probability 1 − 1 2 −(t1−t2) − (t1 − t2) 4e(t1−t2) , e from which the desired statement about AL's utility fol- lows. Proof of Theorem 7 Proof. Sampling and Linear Smoothing
1610.00575
1
1610
2016-10-03T14:49:10
Facility Leasing with Penalties
[ "cs.DS" ]
In this paper we study the facility leasing problem with penalties. We present a primal-dual algorithm which is a 3-approximation, based on the algorithm by Nagarajan and Williamson for the facility leasing problem and on the algorithm by Charikar et al. for the facility location problem with penalties.
cs.DS
cs
Facility Leasing with Penalties Murilo S. de Lima∗1, Mário C. San Felice† 2, and Orlando Lee‡ 1 1Institute of Computing, University of Campinas (Unicamp) 2Institute of Mathematics and Statistics, University of São Paulo (USP) September 22, 2018 Abstract In this paper we study the facility leasing problem with penalties. We present a primal- dual algorithm which is a 3-approximation, based on the algorithm by Nagarajan and Williamson for the facility leasing problem [NW13] and on the algorithm by Charikar et al. for the facility location problem with penalties [CKMN01]. 1 Introduction In the facility location problem, one is given a set F of facilities, an opening cost for each facility, a set D of clients and a metric distance function d between facilities and clients. The objective is to choose a subset of the facilities to open and an assignment between clients and facilities, so to minimize the cost of opening the facilities plus the sum of the distances be- tween each client and the corresponding assigned facility. This is an NP-hard problem, and it does not have a polynomial-time algorithm with approximation factor smaller than 1.463 un- less P = NP [Svi02]. Currently the best approximation factor is 1.488, due to an algorithm by Li [Li13]. In the facility location problem with penalties, we may not assign a client j to a facility if we choose to pay a penalty πj. I.e., we must select a subset of the facilities to open, and a subset of the clients we assign to open facilities; we are going to pay the penalties for the remaining of the clients. The cost of a solution is, therefore, the cost of opening the selected facilities, plus the distance between the client and its corresponding facility for each assigned client, plus the penalty cost for each unassigned client. Clearly the facility location problem reduces to this problem if we set πj = ∞ for every client j. Currently it is known a 1.5148-approximation algorithm for this problem [LDXX15]; however, there is a simpler 3-approximation algorithm by Charikar et al. [CKMN01]. Also, if the penalties obey a submodular function, then there is a 2-approximation algorithm [LDXX15]. In the facility leasing problem, client requests are distributed along the time, and instead of opening facilities permanently, we may lease each facility for one of K different durations δ1, . . . , δK . The cost for leasing a facility for δk units of time depends on the facility position, as in the traditional facility location problem, but also on the leasing type k. Additionally, it is reasonable to suppose that the leasing costs respect an economics of scale: the leasing cost per unit of time decreases with the leasing duration, for a fixed facility location. A facility lease may begin at any moment in the time. Then, we wish to select a set of facility leases that cover the client requests and minimizes the leasing costs plus the distance between each client and ∗[email protected] Supported by FAPESP PhD Scholarship Process 2014/18781-1, and CNPq PhD Schol- arship Process 142161/2014-4. †[email protected] Supported by CAPES PNPD scholarship 1522390. ‡[email protected] Partially supported by Bolsa de Produtividade do CNPq Process 311373/2015-1, and Edital Universal CNPq Process 477692/2012-5. 1 the facility lease that serves each of its requests. This problem was proposed by Nagarajan and Williamson, who presented a simple 3-approximation primal-dual algorithm [NW13]. In this paper, we study the combination of the previous two problems, which we call the facility leasing problem with penalties (PFLe). In this problem, facilities are leased in- stead of permanently opened, as in the facility leasing problem, and some clients may be left unassigned by paying for the penalty cost. We obtain a 3-approximation algorithm by combin- ing the algorithm by Nagarajan and Williamson for the facility leasing problem [NW13] and the algorithm by Charikar et al. for the facility location problem with penalties [CKMN01]. The leveraging scheme by Li et al. [LDXX15] implies that, for any covering problem with an α-approximation algorithm, there is a (1 − e−1/α)−1-approximation algorithm for the corre- sponding covering problem with submodular penalties. Combining this with the algorithm by Nagarajan and Williamson (α = 3), one may obtain a 3.5277-approximation algorithm for the facility leasing problem with submodular penalties. Note that our algorithm obtains a better approximation ratio for the linear case. 2 Notation and Problem Definition Let [K] := {1, . . . , K} be the set of lease types. We denote a facility lease by a triple f = (pf , kf , tf ), where pf ∈ V is the point where f is located, kf ∈ [K] is the leasing type for f , and tf ∈ Z+ is the instant of time in which the lease for f begins. We write F := F × [K] × Z+ so to simplify our notation. Similarly, we denote a client by a triple j = (pj , πj , tj), where pj ∈ V is the point where j is located, πj ∈ R+ is the penalty for not assigning a facility lease to j, and tj is the instant in which j arrives. In order to simplify our notation, we write δf instead of δ(kf ), and γf instead of γ(pf , kf ), for a facility lease f = (pf , kf , tf ) ∈ F. Also, for f = (pf , kf , tf ) ∈ F and j = (pj, πj , tj) ∈ V × R+ × Z+, we define the distance between j and f to be d(j, f ) := (cid:26) d(pj , pf ) ∞ if tj ∈ [tf , tf + δf ), otherwise. I.e., the distance between client j and facility lease f is infinity if the facility lease does not cover tj. Problem PFLe(V, d, F, K, γ, δ, D): The input consists of a set of points V , a distance function d : V × V 7→ R+ between the points of V satisfying symmetry and triangle inequality, a set F ⊆ V of potential facilities, an integer K > 0 that represents the number of lease types, a cost γ(p, k) ∈ R+ for leasing facility p ∈ F with leasing type k ∈ [K], a function δ : [K] 7→ N that maps each lease type to a length in days, and a set D ⊆ V × R+ × Z+ of clients in the form j = (pj , πj , tj). The goal is to find a set X ⊆ F := F × [K] × Z+ of facility leases in the form f = (pf , kf , tf ), and a function a : D 7→ X ∪ {null} that maps each client j to an active facility leasing f ∈ X such that tj ∈ [tf , tf + δf ) or to null, so to minimize Xf ∈X γf + Xj∈D:a(j)6=null d(j, a(j)) + Xj∈D:a(j)=null πj. 2 3 Primal-Dual Formulation • Primal: minimize Pf ∈F γf · yf +Pj∈DPf ∈F d(j, f ) · xjf +Pj∈D πj · zj subject to xjf ≤ yf xf j + zj ≥ 1 ∀f ∈ F, j ∈ D ∀j ∈ D P f ∈F tj ∈[tf ,tf +δf ) xf j , yf , zj ∈ {0, 1} ∀f ∈ F, j ∈ D (Variable yf indicates whether facility f was leased, variable xjf indicates whether client j was served by facility lease f , and variable zj indicates whether the algorithm decided to pay the penalty associated with not serving j with a facility lease.) • Dual relaxation: maximize Pj∈D αj subject to Pj∈D(αj − d(j, f ))+ ≤ γf ∀f ∈ F αj ≤ πj ∀j ∈ D αj ≥ 0 ∀j ∈ D (Economical interpretation: each client j is willing to pay αj to connect itself to some facility lease. Part of this value covers the distance to the facility; the other part is a contribution to pay for leasing the facility. However, the client is not willing to pay more than its penalty.) 4 Algorithm Our algorithm is based on the algorithm by Nagarajan and Williamson for the facility leasing problem [NW13], and on the algorithm by Charikar et al. for the facility location problem with penalties [CKMN01]. We say that a client j reaches a facility lease f if αj ≥ d(j, f ). or or (a) αj = d(j, f ) for some j ∈ S and f ∈ X set αj ← 0 for every j ∈ D increase αj uniformly for every j ∈ S until Algorithm Primal-DualPFLe(V, d, F, K, γ, δ, D) 01 02 X ← ∅, S ← D 03 while S 6= ∅ do 04 05 06 07 08 09 10 11 12 13 14 15 16 (c) αj = πj for some j ∈ S build the graph GX with X ← X ∪ {f ∈ F \ X : f satisfies (b)} S ← S \ {j ∈ S : αj ≥ πj or j reaches some f ∈ X} (b) γf = Pj∈D(αj − d(j, f ))+ for some f ∈ F \ X V [GX ] ← X E[GX ] ← {(f, f ′) : ∃j ∈ D : j reaches both f and f ′} build a maximal independent set X ′ in GX greedily in decreasing order of δ X ← {(pf , kf , tf − δk), f, (pf , kf , tf + δk) : f ∈ X ′} 3 17 18 19 20 21 22 for every j ∈ D do if j reaches some f ∈ X then a(j) ← arg minf ′∈ X{d(j, f ′)} else a(j) ← null return ( X, a) The algorithm maintains a dual variable αj for each client j ∈ D, a set X of temporarily leased facilities, and a set S of the clients whose dual variable still is being increased, which is initialized with the whole set of clients D. The increasing pauses when either: (a) a client reaches an already temporarily leased facility, (b) the sum of the contributions towards a facility lease pays for its cost or (c) the dual variable reaches the penalty cost for some client. We then add to X the facilities that reach condition (b). Also, we remove from S the clients that reach some temporarily leased facility or whose dual variable pays for the penalty cost, and then proceed the increasing of the remaining dual variables until S becomes empty. After that initial phase, we build an interference graph GX between the facility leases in X. Graph GX has vertex set X and has an edge between facilities f and f ′ if there is some client that reaches both f and f ′. Then, we order set X by decreasing order of lease duration and build a maximal independent set X ′ in a greedily manner; i.e., we visit set X in that order and add a facility f to X ′ if there is no other facility lease f ′ ∈ X ′ reached by some client that reaches f . Thus X ′ satisfies the following properties: 1. Every client reaches at most one facility lease in X ′; 2. If facility leases f and f ′ in X are reached by the same client j, and if f ′ ∈ X ′, then δf ≤ δf ′. However, note that there may be some client j that reaches some f in X but is not covered by any facility lease in X ′. But then remember that some f ′ ∈ X ′ shares a reaching client j′ with f , thus δf ≤ δf ′ and the intervals covered by facility leases f and f ′ overlap. Then, since we buy X, which has three copies of f ′, beginning at instants tf ′ − δf ′, tf ′ and tf ′ + δf ′ , we have that the interval formed by those three facilities, which is [tf ′ − δf ′ , tf ′ + 2δf ′), is a superset of interval [tf , tf + δf ), and therefore one of them covers tj. Finally, if some client j does not reach any facility lease in X, then its dual variable pays for its penalty and we set a(j) to null. Also, note that, although the number of potential facility leases is infinite, the algorithm may be implemented in finite time, which is also polynomial in the input size: it is enough to consider, for every facility point, a lease beginning at each instant in which we have a client request. 5 Analysis In this section we analyze the approximation factor of algorithm Primal-DualPFLe. First note that, since the conditions (a), (b) and (c) correspond to constraints of the relax- ation of the dual program, we have that α is a feasible dual solution. Therefore, by weak duality, we have that αj ≤ opt(V, d, F, K, γ, δ, D). Xj∈D We will show, then, that the cost of the primal solution ( X, a) returned by the algorithm is at most 3 times the cost of the dual solution, and thus our algorithm is a 3-approximation to problem PFLe. 4 For every client j ∈ D, we define numbers αC j , αF j , and αP j in the following manner: 1. If j reaches some f ∈ X ′, then let αC j := d(j, f ), αF j := αj − d(f, j), αP j := 0; 2. If j does not reach any facility lease in X ′ but reaches some f ∈ X, then we let 3. Finally, if j does not reach any facility lease in X, then we let αC j := αj , αF j := 0, αP j := 0; αC j := 0, αF j := 0, αP j := αj . Note that, either case, we have that αj = αC j + αF j + αP j . Now, first let us bound the facility leasing cost. Note that, by construction, we have that, for every f ∈ X ′, every client that reaches f reaches only f in X ′. Also, by case (b) of the algorithm, the leasing cost of f is totally paid by contributions from clients that reach f . Therefore, we have that Xf ∈X ′ γf = Xj∈D αF j . Since X, which is the set of facility leases actually bought by the algorithm, consists of three copies of each facility lease in X ′, we have that Xf ∈ X γf ≤ 3 · Xj∈D αF j . Now we bound the penalty cost. We have that a client j has a(j) set to null if and only if it j . Also, due to case (c) of the algorithm, does not reach any facility lease in X, and then αj = αP we have that αj = πj. Thus, it is straightforward to conclude that Xj∈D:a(j)=null πj = Xj∈D αP j . Finally, we have to bound the client connection cost. Let DX ′ be the set of clients that reach some facility in X ′. Note that those clients are connected to the closest facility lease in X. Since every such client j reaches some f ∈ X ′, we have that d(j, a(j)) ≤ d(j, f ) = αC j . Now let j be some client that reaches some f ∈ X but does not reach any facility lease in X ′. There must be some f ′ ∈ X ′ and some j′ that reaches both f and f ′, by construction of X ′. But then we must have that αj ≥ αj′, since when αj′ stopped increasing it reached both f and f ′, and αj reached f when it stopped increasing. Then, since j′ reaches both f and f ′, we have that αj′ ≥ d(j′, f ) and αj′ ≥ d(j′, f ′). Since one of the three copies of f ′ in X must cover tj, by triangle inequality, we have that d(j, a(j)) ≤ d(j, f ′) ≤ d(j, f ) + d(j′, f ) + d(j′, f ′) ≤ αj + αj′ + αj′ ≤ 3 · αj = 3 · αC j . Summing up the previous inequalities, we have that Xf ∈ X γf + Xj∈D:a(j)6=null d(j, a(j)) + Xj∈D:a(j)=null πj ≤ 3 · Xj∈D and we conclude the following theorem. αj ≤ 3 · opt(V, d, F, K, γ, δ, D), Theorem 1: Algorithm Primal-DualPFLe is a 3-approximation. 5 References [CKMN01] M. Charikar, S. Khuller, D. M. Mount, and G. Narasimhan. Algorithms for facility location problems with outliers. In SODA'01: Proceedings of the 12th Annual ACM- SIAM Symposium on Discrete Algorithms, pages 642 -- 651, 2001. [LDXX15] Y. Li, D. Du, N. Xiu, and D. Xu. Improved approximation algorithms for the facility location problems with linear/submodular penalties. Algorithmica, 73(2):460 -- 482, 2015. [Li13] [NW13] [Svi02] S. Li. A 1.488 approximation algorithm for the uncapacitated facility location prob- lem. Information and Computation, 222:45 -- 58, 2013. C. Nagarajan and D. P. Williamson. Offline and online facility leasing. Discrete Optimization, 10(4):361 -- 370, 2013. M. Sviridenko. An improved approximation algorithm for the metric uncapacitated facility location problem. In W. J. Cook and A. S. Schulz, editors, Integer Program- ming and Combinatorial Optimization, volume 2337 of Lecture Notes in Computer Science, pages 240 -- 257. Springer Berlin Heidelberg, 2002. 6
1909.12441
1
1909
2019-09-27T00:02:57
Total Least Squares Regression in Input Sparsity Time
[ "cs.DS", "cs.LG", "stat.ML" ]
In the total least squares problem, one is given an $m \times n$ matrix $A$, and an $m \times d$ matrix $B$, and one seeks to "correct" both $A$ and $B$, obtaining matrices $\hat{A}$ and $\hat{B}$, so that there exists an $X$ satisfying the equation $\hat{A}X = \hat{B}$. Typically the problem is overconstrained, meaning that $m \gg \max(n,d)$. The cost of the solution $\hat{A}, \hat{B}$ is given by $\|A-\hat{A}\|_F^2 + \|B - \hat{B}\|_F^2$. We give an algorithm for finding a solution $X$ to the linear system $\hat{A}X=\hat{B}$ for which the cost $\|A-\hat{A}\|_F^2 + \|B-\hat{B}\|_F^2$ is at most a multiplicative $(1+\epsilon)$ factor times the optimal cost, up to an additive error $\eta$ that may be an arbitrarily small function of $n$. Importantly, our running time is $\tilde{O}( \mathrm{nnz}(A) + \mathrm{nnz}(B) ) + \mathrm{poly}(n/\epsilon) \cdot d$, where for a matrix $C$, $\mathrm{nnz}(C)$ denotes its number of non-zero entries. Importantly, our running time does not directly depend on the large parameter $m$. As total least squares regression is known to be solvable via low rank approximation, a natural approach is to invoke fast algorithms for approximate low rank approximation, obtaining matrices $\hat{A}$ and $\hat{B}$ from this low rank approximation, and then solving for $X$ so that $\hat{A}X = \hat{B}$. However, existing algorithms do not apply since in total least squares the rank of the low rank approximation needs to be $n$, and so the running time of known methods would be at least $mn^2$. In contrast, we are able to achieve a much faster running time for finding $X$ by never explicitly forming the equation $\hat{A} X = \hat{B}$, but instead solving for an $X$ which is a solution to an implicit such equation. Finally, we generalize our algorithm to the total least squares problem with regularization.
cs.DS
cs
Total Least Squares Regression in Input Sparsity Time∗ Huaian Diao† Zhao Song‡ David P. Woodruff§ Xin Yang¶ Abstract F +kB − bBk2 F . We In the total least squares problem, one is given an m × n matrix A, and an m × d matrix B, and one seeks to "correct" both A and B, obtaining matrices bA and bB, so that there exists an X satisfying the equation bAX = bB. Typically the problem is overconstrained, meaning that m ≫ max(n, d). The cost of the solution bA, bB is given by kA − bAk2 give an algorithm for finding a solution X to the linear system bAX = bB for which the cost kA− bAk2 is eO(nnz(A) + nnz(B)) + poly(n/ǫ)· d, where for a matrix C, nnz(C) denotes its number of non- F is at most a multiplicative (1 + ǫ) factor times the optimal cost, up to an additive error η that may be an arbitrarily small function of n. Importantly, our running time zero entries. Importantly, our running time does not directly depend on the large parameter m. As total least squares regression is known to be solvable via low rank approximation, a natural approach is to invoke fast algorithms for approximate low rank approximation, obtaining F + kB − bBk2 matrices bA and bB from this low rank approximation, and then solving for X so that bAX = bB. However, existing algorithms do not apply since in total least squares the rank of the low rank approximation needs to be n, and so the running time of known methods would be at least mn2. In contrast, we are able to achieve a much faster running time for finding X by never explicitly forming the equation bAX = bB, but instead solving for an X which is a solution to an implicit such equation. Finally, we generalize our algorithm to the total least squares problem with regularization. 9 1 0 2 p e S 7 2 ] S D . s c [ 1 v 1 4 4 2 1 . 9 0 9 1 : v i X r a ∗A preliminary version of this paper appeared in NeurIPS 2019. †[email protected]. Northeast Normal University. ‡[email protected]. University of Washington. This work was partly done while Zhao Song was visiting the Simons Institute for the Theory of Computing. §[email protected]. Carnegie Mellon University. David Woodruff would like to thank support from the Office of Naval Research (ONR) grant N00014-18-1-2562. This work was also partly done while David Woodruff was visiting the Simons Institute for the Theory of Computing. ¶[email protected]. University of Washington. 1 Introduction In the least squares regression problem, we are given an m × n matrix A and an m × 1 vector b, and we seek to find an x ∈ Rn which minimizes kAx − bk2 2. A natural geometric interpretation is that there is an unknown hyperplane in Rn+1, specified by the normal vector x, for which we have m points on this hyperplane, the i-th of which is given by (Ai,hAi, xi), where Ai is the i-th row of A. However, due to noisy observations, we do not see the points (Ai,hAi, xi), but rather only see the point (Ai, bi), and we seek to find the hyperplane which best fits these points, where we measure (squared) distance only on the (n + 1)-st coordinate. This naturally generalizes to the setting in which B is an m × d matrix, and the true points have the form (Ai, AiX) for some unknown n × d matrix X. This setting is called multiple-response regression, in which one seeks to find X to minimize kAX − Bk2 F is its squared Frobenius norm, i.e., the sum of squares of each of its entries. This geometrically corresponds to the setting when the points live in a lower n-dimensional flat of Rn+d, rather than in a hyperplane. F , where for a matrix Y , kY k2 While extremely useful, in some settings the above regression model may not be entirely realistic. For example, it is quite natural that the matrix A may also have been corrupted by measurement noise. In this case, one should also be allowed to first change entries of A, obtaining a new m × n matrix bA, then try to fit B to bA by solving a multiple-response regression problem. One should again be penalized for how much one changes the entries of A, and this leads to a popular formulation F + kbAX − Bk2 known as the total least squares optimization problem min bA,X kA − bAk2 F . Letting C = [A, B], one can more compactly write this objective as min bC=[ bA, bB] kC − bCk2 F , where it is required that the columns of bB are in the column span of bA. Total least squares can naturally capture many scenarios that least squares cannot. For example, imagine a column of B is a large multiple λ · a of a column a of A that has been corrupted and sent to 0. Then in least squares, one needs to pay λ2kak2 2, but in total least squares one can "repair A" to contain the column a, and just pay kak2 2. We refer the reader to [MVH07] for an overview of total least squares. There is also a large amount of work on total least squares with regularization [RG04, LPT09, LV14]. Notice that bC has rank n, and therefore the optimal cost is at least kC − Cnk2 that the last d columns are in the column span of the first n columns, then the optimal solution bC to total least squares problem is equal to Cn, and so the total least squares cost is the cost of the best rank-n approximation to C. In this case, and only in this case, there is a closed-form solution. However, in general, this need not be the case, and kC − Cnk2 F may be strictly smaller than the total least squares cost. Fortunately, though, it cannot be much smaller, since one can take the first n columns of Cn, and for each column that is not linearly independent of the remaining columns, we can replace it with an arbitrarily small multiple of one of the last d columns of Cn which is not in the span of the first n columns of Cn. Iterating this procedure, we find that there is a solution to the total least squares problem which has cost which is arbitrarily close to kC − Cnk2 F . We describe this procedure in more detail below. F , where Cn is the best rank-n approximation to C. If, in the optimal rank-n approximation Cn, one has the property The above procedure of converting a best rank-n approximation to an arbitrarily close solution to the total least squares problem can be done efficiently given Cn, so this shows one can get an arbitrarily good approximation by computing a truncated singular value decompostion (SVD), which is a standard way of solving for Cn in O(m(n+d)2) time. However, given the explosion of large-scale datasets these days, this running time is often prohibitive, even for the simpler problem of multiple response least squares regression. Motivated by this, an emerging body of literature has looked at the sketch-and-solve paradigm, where one settles for randomized approximation algorithms which run in much faster, often input sparsity time. Here by input-sparsity, we mean in time linear in the 1 number nnz(C) of non-zero entries of the input description C = [A, B]. By now, it is known, for example, how to output a solution matrix X to multiple response least squares regression satisfying kAX − Bk2 F , in nnz(A) + nnz(B) + poly(nd/ǫ) time. This algorithm works for arbitrary input matrices A and B, and succeeds with high probability over the algorithm's random coin tosses. For a survey of this and related results, we refer the reader to [Woo14]. F ≤ (1 + ǫ) minX ′ kAX′ − Bk2 Given the above characterization of total least squares as a low rank approximation problem, it is natural to ask if one can directly apply sketch-and-solve techniques to solve it. Indeed, for low rank approximation, it is known how to find a rank-k matrix bC for which kC − bCk2 F ≤ (1 + ǫ)kC − Ckk2 in time nnz(C) + m · k2/ǫ [ACW17], using the fastest known results. Here, recall, we assume m ≥ n + d. From an approximation point of view, this is fine for the total least squares problem, since this means after applying the procedure above to ensure the last d columns of bC are in the span of the first n columns, and setting k = n in the low rank approximation problem, our cost will be at most (1 + ǫ)kC − Cnk2 F + η, where η can be made an arbitrarily small function of n. Moreover, the optimal total least squares cost is at least kC − Cnk2 F , so our cost is a (1 + ǫ)-relative error approximation, up to an arbitarily small additive η. F Unfortunately, this approach is insufficient for total least squares, because in the total least squares problem one sets k = n, and so the running time for approximate low rank approximation becomes nnz(C)+m·n2/ǫ. Since n need not be that small, the m·n2 term is potentially prohibitively large. Indeed, if d ≤ n, this may be much larger than the description of the input, which requires at most mn parameters. Note that just outputting bC may take m · (n + d) parameters to describe. However, as in the case of regression, one is often just interested in the matrix X or the hyperplane x for ordinary least squares regression. Here the matrix X for total least squares can be described using only nd parameters, and so one could hope for a much faster running time. 1.1 Our Contributions Our main contribution is to develop a (1 + ǫ)-approximation to the total least squares regression F ≤ (1 + ǫ)kC − Cnk2 not need to write such matrices down, as it is only interested in outputting the solution X to the rank-n approximation to C, and η is an arbitrarily small function of n. Importantly, we achieve a problem, returning a matrix X ∈ Rn×d for which there exist bA ∈ Rm×n and bB ∈ Rm×d for which bAX = bB and kC − bCk2 F + η, where C = [A, B], bC = [bA, bB], Cn is the best running time of eO(nnz(A) + nnz(B)) + poly(n/ǫ) · d. Notice that this running time may be faster than the time it takes even to write down bA and bB. Indeed, although one can write A and B down in nnz(A) + nnz(B) time, it could be that the algorithm can only efficiently find an bA and a bB that are dense; nevertheless the algorithm does equation bAX = bB. This is motivated by applications in which one wants generalization error. Given X, and a future y ∈ Rn, one can compute yX to predict the remaining unknown d coordinates of the extension of y to n + d dimensions. Our algorithm is inspired by using dimensionality reduction techniques for low rank approx- imation, such as fast oblivious "sketching" matrices, as well as leverage score sampling. The rough idea is to quickly reduce the low rank approximation problem to a problem of the form minrank - n Z∈Rd1×s1 k(D2CD1)Z(S1C) − D2CkF , where d1, s1 = O(n/ǫ), D2 and D1 are row and column subset selection matrices, and S1 is a so-called CountSketch matrix, which is a fast oblivi- ous projection matrix. We describe the matrices D1, D2, and S1 in more detail in the next section, though the key takeaway message is that (D2CD1), (S1C), and (D2C) are each efficiently com- putable small matrices with a number of non-zero entries no larger than that of C. Now the problem is a small, rank-constrained regression problem for which there are closed form solutions for Z. We then need additional technical work, of the form described above, in order to find an X ∈ Rn×d 2 sketching methods have not been applied to the total least squares problem before, and we consider this application to be one of the main contributions of this paper. given Z, and to ensure that X is the solution to an equation of the form bAX = bB. Surprisingly, fast We carefully bound the running time at each step to achieve eO(nnz(A) + nnz(B) + poly(n/ǫ)d) overall time, and prove its overall approximation ratio. Our main result is Theorem 3.10. We also generalize the theorem to the important case of total least squares regression with regularization; see Theorem 3.12 for a precise statement. We empirically validate our algorithm on real and synthetic data sets. As expected, on a number of datasets the total least squares error can be much smaller than the error of ordinary least squares regression. We then implement our fast total least squares algorithm, and show it is roughly 20− 40 times faster than computing the exact solution to total least squares, while retaining 95% accuracy. Notation. For a function f , we define eO(f ) to be f · logO(1)(f ). For vectors x, y ∈ Rn, let hx, yi :=Pn square matrix. Let kAkF denote the Frobenius norm of a matrix A, i.e., kAkF = (PiPj A2 i=1 xiyi denote the inner product of x and y. Let nnz(A) denote the number of nonzero entries of A. Let det(A) denote the determinant of a square matrix A. Let A⊤ denote the transpose of A. Let A† denote the Moore-Penrose pseudoinverse of A. Let A−1 denote the inverse of a full rank i,j)1/2. Sketching matrices play an important role in our algorithm. Their usefulness will be further explained in Section 3. The reader can refer to Appendix B for detailed introduction. 2 Problem Formulation We first give the precise definition of the exact (i.e., non-approximate) version of the total least squares problem, and then define the approximate case. Definition 2.1 (Exact total least squares). Given two matrices A ∈ Rm×n, B ∈ Rm×d, let C = [A, B] ∈ Rm×(n+d). The goal is to solve the following minimization problem: X∈Rn×d,∆A∈Rm×n,∆B∈Rm×d k[∆A, ∆B]kF min subject to (A + ∆A)X = (B + ∆B) (1) It is known that total least squares problem has a closed form solution. For a detailed discussion, see Appendix E. It is natural to consider the approximate version of total least squares: Definition 2.2 (Approximate total least squares problem). Given two matrices A ∈ Rm×n and B ∈ Rm×d, let OPT = minrank −n C ′ kC′ − [A, B]kF , for parameters ǫ > 0, δ > 0. The goal is to output X′ ∈ Rn×d so that there exists A′ ∈ Rm×n such that k[A′, A′X′] − [A, B]kF ≤ (1 + ǫ) OPT +δ. One could solve total least squares directly, but it is much slower than solving least squares (LS). We will use fast randomized algorithms, the basis of which are sampling and sketching ideas [CW13, NN13, MM13, Woo14, RSW16, PSW17, SWZ17, CCLY19, CLS19, LSZ19, SWY+19, SWZ19a, SWZ19b, SWZ19c, DJS+19], to speed up solving total least squares in both theory and in practice. The total least squares problem with regularization is also an important variant of this prob- lem [LV10]. We consider the following version of the regularized total least squares problem. Definition 2.3 (Approximate regularized total least squares problem). Given two matrices A ∈ Rm×n and B ∈ Rm×d and λ > 0, let OPT = minU∈Rm×n,V ∈Rn×(n+d) kU V − [A, B]k2 F + λkV k2 F , for parameters ǫ > 0, δ > 0. The goal is to output X′ ∈ Rn×d so that there exist A′ ∈ Rm×n F + λkUk2 3 Algorithm 1 Our Fast Total Least Squares Algorithm 1: procedure FastTotalLeastSquares(A, B, n, d, ǫ, δ) 2: s1 ← O(n/ǫ), s2 ← O(n/ǫ), d1 ← eO(n/ǫ), d2 ← eO(n/ǫ) Choose S1 ∈ Rs1×m to be a CountSketch matrix, then compute S1C ⊲ Definition B.1 ⊲ Reduce n + d to O(n/ǫ) if d > Ω(n/ǫ) then Choose D⊤1 ∈ Rd1×(n+d) to be a leverage score sampling and rescaling matrix according ⊲ We do not need to use matrix D1 to the rows of (S1C)⊤, then compute CD1 ⊲ Theorem 3.10 else Choose D⊤1 ∈ R(n+d)×(n+d) to be the identity matrix rows of CD1 Choose D2 ∈ Rd2×m to be a leverage score sampling and rescaling matrix according to the Z2 ← minrank −n Z∈Rd1×s1 kD2CD1ZS1C − D2CkF ⊲ Theorem D.1 A, B, π ← Split(CD1, Z2, S1C, n, d, δ/ poly(m)), X ← minkAX − BkF if Need CFTLS then ⊲ For experiments to evaluate the cost ⊲ Lemma 3.8 ⊲ bC = CD1Z2S1C ; C = S2bC ⊲ bA = bC∗,[n], bB = bC∗,[n+d]\[n]; A = S2bA, B = S2bB 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 16: 17: 18: 19: 20: 21: Evaluate(CD1, Z2, S1C, X, π, δ/ poly(m)) return X 13: 14: procedure Split(CD1, Z2, S1C, n, d, δ) 15: Choose S2 ∈ Rs2×m to be a CountSketch matrix C ← (S2 · CD1) · Z2 · S1C A ← C∗,[n], B ← C∗,[n+d]\[n] T ← ∅, π(i) = −1 for all i ∈ [n] for i = 1 → n do if A∗,i is linearly dependent of A∗,[n]\{i} then π(i) ← j return A, B, π 22: 23: procedure Evaluate(CD1, Z2, S1C, X, π, δ) 24: bC ← CD1Z2S1C, bA ← bC∗,[n], bB ← C∗,[n+d]\[n] for i = 1 → n do if π(i) 6= −1 then bA∗,i ← bA∗,i + δ · bB∗,π(i) return k[bA, bAX] − CkF 25: 26: 27: 28: j ← minj∈[d]\T{B∗,j is linearly independent of A}, A∗,i ← A∗,i +δ·B∗,j, T ← T ∪{j}, ⊲ π : [n] → {−1} ∪ ([n + d]\[n]) ⊲ Appendix F.9 , U′ ∈ Rm×n and V ′ ∈ Rn×(n+d) satisfying k[A′, A′X′]− U′V ′k2 (1 + ǫ) OPT +δ. F ≤ δ and k[A′, A′X′]− [A, B]k2 F ≤ 3 Fast Total Least Squares Algorithm We present our algorithm in Algorithm 1 and give the analysis here. Readers can refer to Table 1 to check notations in Algorithm 1. To clearly give the intuition, we present a sequence of approxi- mations, reducing the size of our problem step-by-step. We can focus on the case when d ≫ Ω(n/ǫ) and the optimal solution bC to program (6) has the form [bA, bAbX] ∈ Rm×(n+d). For the other case when d = O(n/ǫ), we do not need to use the sampling matrix D1. In the case when the solution does not have the form [bA, bAbX], we need to include Split in the algorithm, since it will perturb 4 Table 1: Notations in Algorithm 1 Matrix Dim. Comment S1 Not. Value Comment O(n/ǫ) #rows in S1 s1 d1 d2 s2 eO(n/ǫ) #columns in D1 D1 eO(n/ǫ) #rows in D2 O(n/ǫ) #rows in S2 D2 S2 Z2 Rs1×m CountSketch matrix Rn×d1 Leverage score sampling matrix Rd2×m Leverage score sampling matrix Rs2×m CountSketch matrix for fast regression Rs1×d1 Low rank approximation solution matrix Split, we can handle all cases. some columns in bA with arbitrarily small noise to make sure bA has rank n. By applying procedure Fix A ∈ Rm×n and B ∈ Rm×d. Let OPT = minrank −n C ′∈Rm×(n+d) kC′ − [A, B]kF . By using techniques in low-rank approximation, we can find an approximation of a special form. More precisely, let S1 ∈ Rs1×m be a CountSketch matrix with s1 = O(n/ǫ). Then we claim that it is sufficient to look at solutions of the form U S1C. Claim 3.1 (CountSketch matrix for low rank approximation problem). With probability 0.98, min rank −n U∈Rm×s1 kU S1C − Ck2 F ≤ (1 + ǫ)2 OPT2 . We provide the proof in Appendix F.1. We shall mention that we cannot use leverage score sampling here, because taking leverage score sampling on matrix C would take at least nnz(C)+(n+ d)2 time, while we are linear in d in the additive term in our running time eO(nnz(C)) + d· poly(n/ǫ). Let U1 be the optimal solution of the program minU∈Rm×s1 kU S1C − Ck2 F , i.e., U1 = arg min rank −n U∈Rm×s1 kU S1C − Ck2 F . (2) If d is large compared to n, then program (2) is computationally expensive to solve. So we can apply sketching techniques to reduce the size of the problem. Let D⊤1 ∈ Rd1×(n+d) denote a lever- age score sampling and rescaling matrix according to the columns of S1C, with d1 = eO(n/ǫ) nonzero entries on the diagonal of D1. Let U2 ∈ Rm×s1 denote the optimal solution to the problem minrank −n U∈Rm×s1 kU S1CD1 − CD1k2 U2 = arg F , i.e., rank −n U∈Rm×s1 kU S1CD1 − CD1k2 min F . (3) Then the following claim comes from the constrained low-rank approximation result (Theorem D.1). Claim 3.2 (Solving regression with leverage score sampling). Let U1 be defined in Eq. (2), and let U2 be defined in Eq. (3). Then with probability 0.98, kU2S1C − Ck2 F ≤ (1 + ǫ)2kU1S1C − Ck2 F . We provide the proof in Appendix F.2. We now consider how to solve program (3). We observe that Claim 3.3. U2 ∈ colspan(CD1). We can thus consider the following relaxation: given CD1, S1C and C, solve: min rank −n Z∈Rd1×s1 kCD1ZS1C − Ck2 F . (4) 5 By setting CD1Z = U , we can check that program (4) is indeed a relaxation of program (3). Let Z1 be the optimal solution to program (4). We show the following claim and delayed the proof in F.3. Claim 3.4 (Approximation ratio of relaxation). With probability 0.98, kCD1Z1S1C − Ck2 F ≤ (1 + O(ǫ)) OPT2 . However, program (4) still has a potentially large size, i.e., we need to work with an m × d1 matrix CD1. To handle this problem, we again apply sketching techniques. Let D2 ∈ Rd2×m be a leverage score sampling and rescaling matrix according to the matrix CD1 ∈ Rm×d1, so that D2 has d2 = eO(n/ǫ) nonzeros on the diagonal. Now, we arrive at the small program that we are going to directly solve: min rank −n Z∈Rd1×s1 kD2CD1ZS1C − D2Ck2 F . (5) We shall mention that here it is beneficial to apply leverage score sampling matrix because we only need to compute leverage scores of a smaller matrix CD1, and computing D2C only involves sampling a small fraction of the rows of C. On the other hand, if we were to use the CountSketch matrix, then we would need to touch the whole matrix C when computing D2C. Overall, using leverage score sampling at this step can reduce the constant factor of the nnz(C) term in the running time, and may be useful in practice. Let rank-n Z2 ∈ Rd1×s1 be the optimal solution to this problem. Claim 3.5 (Solving regression with a CountSketch matrix). With probability 0.98, kCD1Z2S1C − Ck2 We provide the proof in Appendix F.4. Our algorithm thus far is as follows: we compute matrices S1, D1, D2 accordingly, then solve F ≤ (1 + ǫ)2kCD1Z1S1C − Ck2 F program (5) to obtain Z2. At this point, we are able to obtain the low rank approximation bC = CD1 · Z2 · S1C. We show the following claim and delayed the proof in Appendix F.5. Claim 3.6 (Analysis of bC). With probability 0.94, kbC − Ck2 F ≤ (1 + O(ǫ)) OPT2 . Let bC = [bA, bB] where bA ∈ Rm×n and bB ∈ Rm×d. However, if our goal is to only output a matrix X so that bAX = bB, then we can do this faster by not computing or storing the matrix bC. Let S2 ∈ Rs2×m be a CountSketch matrix with s2 = O(n/ǫ). We solve a regression problem: min X∈Rn×d kS2bAX − S2bBk2 F . optimal solution to the above problem. Notice that S2bA and S2bB are computed directly from CD1, Z2, S1C and S2. Let X be the Claim 3.7 (Approximation ratio guarantee). Assume bC = [bA, bAbX] for some bX ∈ Rn×d. Then with probability at least 0.9, k[bA, bAX] − [A, B]k2 F ≤ (1 + O(ǫ)) OPT2 . 6 We provide the proof in Appendix F.6. small multiple of one of the last d columns that cannot be spanned to the first n columns until the first n columns are full rank. Formally, we have If the assumption bC = [bA, bAbX] in Claim 3.7 does not hold, then we need to apply procedure Split. Because rank(bC) = n from our construction, if the first n columns of bC cannot span the last d columns, then the first n columns of bC are not full rank. Hence we can keep adding a sufficiently Lemma 3.8 (Analysis of procedure Split). Fix s1 = O(n/ǫ), s2 = O(n/ǫ), d1 = eO(n/ǫ). Given CD1 ∈ Rm×d1, Z2 ∈ Rd1×s1, and S1C ∈ Rs1×(n+d) so that bC := CD1·Z2·S1C has rank n, procedure SPLIT (Algorithm 1) returns A ∈ Rs2×n and B ∈ Rs2×d in time O(nnz(C) + d · poly(n/ǫ)) so that there exists X ∈ Rn×d satisfying A · X = B. Moreover, letting bA be the matrix computed in lines (24) to (27), then with probability 0.99, We provide the proof in Appendix F.7. Now that we have A and B, and we can compute X by k[bA, bAX] − CkF ≤ kbC − CkF + δ. solving the regression problem minX∈Rn×d kAX − Bk2 F . We next summarize the running time. Ommitted proofs are in Appendix F.8. Lemma 3.9 (Running time analysis). Procedure FastTotalLeastSquares in Algorithm 1 runs in time eO(nnz(A) + nnz(B) + d · poly(n/ǫ)). To summarize, Theorem 3.10 shows the performance of our algorithm. Ommitted proofs are in Appendix F.10. Theorem 3.10 (Main Result). Given two matrices A ∈ Rm×n and B ∈ Rm×d, letting OPT = rank −n C ′∈Rm×(n+d) kC′ − [A, B]kF , min we have that for any ǫ ∈ (0, 1), there is an algorithm (procedure FastTotalLeastSquares in Algorithm 1) that runs in eO(nnz(A) + nnz(B)) + d· poly(n/ǫ) time and outputs a matrix X ∈ Rn×d such that there is a matrix bA ∈ Rm×n satisfying that holds with probability at least 9/10, where δ > 0 is arbitrarily small. k[bA, bAX] − [A, B]kF ≤ (1 + ǫ) OPT +δ Remark 3.11. The success probability 9/10 in Theorem 3.10 can be boosted to 1 − δ for any δ > 0 in a standard way. Namely, we run our FTLS algorithm O(log(1/δ)) times where in each run we use independent randomness, and choose the solution found with the smallest cost. Note that for any fixed output X, the cost k[ ¯A, ¯AX] − [A, B]kF can be efficiently approximated. To see this, let S be a CountSketch matrix with O(ǫ−2) rows. Then kS[ ¯A, ¯AX] − S[A, B]kF = (1 ± ǫ)k[ ¯A, ¯AX] − [A, B]kF with probability 9/10 (see, for example Lemma 40 of [CW13] ). We can compute kS[ ¯A, ¯AX] − S[A, B]kF in time O(d · poly(n/ǫ)), and applying S can be done in nnz(A) + nnz(B) time. We can then amplify the success probability by taking O(log(1/δ)) independent estimates and taking the median of the estimates. This is a (1± ǫ)-approximation with probability at least 1− O(δ/ log(1/δ)). We run our FTLS algorithm O(log(1/δ)) times, obtaining outputs X 1, . . . , X O(log(1/δ)) and for each X i, apply the method above to estimate its cost. Since for each X i our estimate to the cost is within 1 ± ǫ with probability at least 1 − O(δ/(log(1/δ)), by a union bound the estimates for all X i are within 1 ± ǫ with probability at least 1 − δ/2. Since also the solution with minimal cost is a 1 ± ǫ approximation with probability at least 1 − δ/2, by a union bound we can achieve 1 − δ probability with running time eO(log2(1/δ)) · (nnz(A) + nnz(B) + d · poly(n/ǫ))). 7 We further generalize our algorithm to handle regularization. Ommitted proofs can be found in Appendix G. Theorem 3.12 (Algorithm for regularized total least squares). Given two matrices A ∈ Rm×n and B ∈ Rm×d and λ > 0, letting OPT = U∈Rm×n,V ∈Rn×(n+d) kU V − [A, B]k2 min F + λkUk2 F + λkV k2 F , we have that for any ǫ ∈ (0, 1), there is an algorithm (procedure FastRegularizedTotalLeast- Squares in Algorithm 3) that runs in eO(nnz(A) + nnz(B) + d · poly(n/ǫ)) time and outputs a matrix X ∈ Rn×d such that there is a matrix bA ∈ Rm×n, bU ∈ Rm×n and bV ∈ Rn×(n+d) satisfying k[bA, bAX] − bUbV k2 k[bA, bAX] − [A, B]k2 F ≤ δ and with probability 9/10, F + λkbUk2 F ≤ (1 + ǫ) OPT +δ. F + λkbV k2 4 Experiments We conduct several experiments to verify the running time and optimality of our fast total least squares algorithm 1. Let us first recall the multiple-response regression problem. Let A ∈ Rm×n and B ∈ Rm×d. In this problem, we want to find X ∈ Rn×d so that AX ∼ B. The least squares method (LS) solves the following optimization program: cLS := min X∈Rn×d,∆B∈Rm×d k∆Bk2 F , On the other hand, the total least squares method (TLS) solves the following optimization program: subject to AX = B + ∆B. cTLS := rank −n C ′∈Rm×(n+d) kC′ − [A B]kF . min The fast total least squares method (FTLS) returns X ∈ Rn×d, which provides an approximation C′ = [bA bAX] to the TLS solution, and the cost is computed as cFTLS = kC′ − Ck2 Our numerical tests are carried out on an Intel Xeon E7-8850 v2 server with 2.30GHz and 4GB F . RAM under Matlab R2017b. 1 4.1 A Toy Example We first run our FTLS algorithm on the following toy example, for which we have the analytical solution exactly. Let A ∈ R3×2 be A11 = A22 = 1 and 0 everywhere else. Let B ∈ R3×1 be B3 = 3 and 0 everywhere else. We also consider the generalization of this example with larger dimension in Appendix H. The cost of LS is 9, since AX can only have non-zero entries on the first 2 coordinates, so the 3rd coordinate of AX − B must have absolute value 3. Hence the cost is at least 9. Moreover, a cost 9 can be achieved by setting X = 0 and ∆B = −B. However, for the TLS algorithm, the cost is only 1. Consider ∆A ∈ R3×2 where A11 = −1 and 0 everywhere else. Then C′ := [(A + ∆A), B] has rank 2, and kC′ − CkF = 1. 1The code can be found at https://github.com/yangxinuw/total_least_squares_code. 8 2.5 2 1.5 1 0.5 0 0 TLS LS FTLS 0.9 FTLS 0.6 FTLS 0.3 FTLS 0.1 20 40 60 80 100 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 TLS LS FTLS 0.9 FTLS 0.6 FTLS 0.3 FTLS 0.1 0 20 40 60 80 100 2.5 2 1.5 1 0.5 0 0 TLS LS FTLS 0.9 FTLS 0.6 FTLS 0.3 FTLS 0.1 20 40 60 80 100 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 TLS LS FTLS 0.9 FTLS 0.6 FTLS 0.3 FTLS 0.1 20 40 60 80 100 Figure 1: Running time and accuracy of our FTLS algorithms. The left 2 figures are for the sparse matrix. The right 2 pictures are for the Gaussian matrix. (Left) The y-axis is the running time of each algorithm (counted in seconds); the x-axis is the size of the matrix. (Right) The y-axis is cost-TLS/cost-other, where cost-other is the cost achieved by other algorithms. (Note we want to minimize the cost); the x-axis is the size of the matrix. We first run experiments on this small matrix. Since we know the solution of LS and TLS exactly in this case, it is convenient for us to compare their results with that of the FTLS algorithm. When we run the FTLS algorithm, we sample 2 rows in each of the sketching algorithms. The experimental solution of LS is CLS = diag(0, 1, 3) which matches the theoretical solution. The cost is 9. The experimental solution of TLS is CTLS = diag(1, 1, 0) which also matches the theoretical result. The cost is 1. FTLS is a randomized algorithm, so the output varies. We post several outputs: CFTLS =  .06 −.01 −.01 .99 .76 .01 .25 .00 2.79  ,   .14 −.26 −.22 −.26 .91 −.06 −.67 −.20 2.82   These solutions have cost of 1.55 and 1.47. We run the FTLS multiple times to analyze the distribution of costs. Experimental result, which can be found in Appendex I, shows that FTLS is a stable algorithm, and consistently performs better than LS. We also consider a second small toy example. Let A still be a 10 × 5 matrix and B be a 10 × 1 vector. Each entry A(i, j) is chosen i.i.d. from the normal distribution N (0, 1), and each entry B(i) is chosen from N (0, 3). Because entries from A and B have different variance, we expect the results of LS and TLS to be quite different. When we run the FTLS algorithm, we sample 6 rows. We run FTLS 1000 times, and compute the distribution of costs. The results of this experiment, which is in Appendex I, again demonstrates the stability of the algorithm. 4.2 Large Scale Problems We have already seen that FTLS works pretty well on small matrices. We next show that the fast total least squares method also provides a good estimate for large scale regression problems. The setting for matrices is as follows: for k = 5, 10,··· , 100, we set A to be a 20k × 2k matrix where A(i, i) = 1 for i = 1,··· , 2k and 0 everywhere else, and we set B to be a 20k × 1 vector where B(2k + 1) = 3 and 0 elsewhere. As in the small case, the cost of TLS is 1, and the cost of LS is 9. Recall that in the FTLS algorithm, we use Count-Sketch/leverage scores sampling/Gaussian sketches to speed up the algorithm. In the experiments, we take sample density ρ = 0.1, 0.3, 0.6, 0.9 respectively to check our performance. The left 2 pictures in Figure 1 show the running time together with the ratio TLS/FTLS for different sample densities. 9 Method Cost C-std Time T-std Method Cost C-std Time T-std 0.05 TLS 0.0002 LS 0.0058 FTLS 0.9 0.0033 FTLS 0.6 0.0022 FTLS 0.3 0.0024 FTLS 0.1 Method Cost C-std Time T-std 0 0 0.0002 0.0003 0.0007 0.0016 1.12 0.0012 0.16 0.081 0.046 0.034 0.10 106 0.10 0.10 0.10 0.10 0.16 TLS 0.001 LS 0.025 FTLS 0.9 0.01 FTLS 0.6 0.005 FTLS 0.3 0.004 FTLS 0.1 Method Cost C-std Time T-std 1.36 0.0012 0.30 0.17 0.095 0.074 0 0 0.0032 0.0050 0.01 0.03 0.93 666 0.93 0.94 0.95 0.99 TLS LS FTLS 0.9 FTLS 0.6 FTLS 0.3 FTLS 0.1 1.85 2794 1.857 1.858 1.864 1.885 0 0 0.001 0.002 0.006 0.019 29.44 0.0022 3.12 1.62 0.77 0.60 1.44 0.001 0.081 0.054 0.027 0.017 TLS LS FTLS 0.9 FTLS 0.6 FTLS 0.3 FTLS 0.1 0.550 303 0.553 0.558 0.558 0.732 0 0 0.003 0.011 0.054 0.227 125.38 0.019 21.313 13.115 7.453 4.894 82.9 0.02 1.867 1.303 1.237 0.481 Table 2: Up Left: Airfoil Self-Noise. Up Right: Red wine. Down Left: White wine. Down Right: Insurance Company Benchmark. C-std is the standard deviation for cost. T-std is the standard deviation for running time. We can see that the running time of FTLS is significantly smaller than that of TLS. This is because the running time of TLS depends heavily on m, the size of matrix A. When we apply sketching techniques, we significantly improve our running time. The fewer rows we sample, the faster the algorithm runs. We can see that FTLS has pretty good performance; even with 10% sample density, FTLS still performs better than LS. Moreover, the more we sample, the better accuracy we achieve. The above matrix is extremely sparse. We also consider another class of matrices. For k = 5, 10,··· , 100, we set A to be a 20k × 2k matrix where A(i, j) ∼ N (0, 1); we set B to be a 20k × 1 vector where B(i) ∼ N (0, 3). As in previous experiments, we take sample densities of ρ = 0.1, 0.3, 0.6, 0.9, respectively, to check our performance. The results of this experiment are shown in the right 2 pictures in Figure 1. We see that compared to TLS, our FTLS sketching-based algorithm significantly reduces the running time. FTLS is still slower than LS, though, because in the FTLS algorithm we still need to solve a LS problem of the same size. However, as discussed, LS is inadequate in a number of applications as it does not allow for changing the matrix A. The accuracy of our FTLS algorithms is also shown. We also conducted experiments on real datasets from the UCI Machine Learning Repository [DKT17]. We choose datasets with regression task. Each dataset consists of input data and output data. To turn it into a total least squares problem, we simply write down the input data as a matrix A and the output data as a matrix B, then run the corresponding algorithm on (A, B). We have four real datasets : Airfoil Self-Noise [UCIa] in Table 2(a), Wine Quality Red wine [UCIc, CCA+09] in Table 2(b), Wine Quality White wine [UCIc, CCA+09] in Table 2(c), Insurance Company Bench- mark (COIL 2000) Data Set [UCIb, PS] From the results„ we see that FTLS also performs well on real data: when FTLS samples 10% of the rows, the result is within 5% of the optimal result of TLS, while the running time is 20− 40 times faster. In this sense, FTLS achieves the advantages of both TLS and LS: FTLS has almost the same accuracy as TLS, while FTLS is significantly faster. 10 References [ACW17] Haim Avron, Kenneth L. Clarkson, and David P. Woodruff. Sharper bounds for regular- ized 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. [ALS+18] Alexandr Andoni, Chengyu Lin, Ying Sheng, Peilin Zhong, and Ruiqi Zhong. Sub- In ICML. arXiv preprint space embedding and linear regression with orlicz norm. arXiv:1806.06430, 2018. [BWZ16] Christos Boutsidis, David P Woodruff, and Peilin Zhong. Optimal principal compo- nent analysis in distributed and streaming models. In Proceedings of the 48th Annual ACM SIGACT Symposium on Theory of Computing (STOC), pages 236 -- 249. ACM, https://arxiv.org/pdf/1504.06729, 2016. [CCA+09] Paulo Cortez, António Cerdeira, Fernando Almeida, Telmo Matos, and José Reis. Mod- eling wine preferences by data mining from physicochemical properties. Decision Support Systems, 47(4):547 -- 553, 2009. [CCF02] Moses Charikar, Kevin Chen, and Martin Farach-Colton. Finding frequent items in data streams. In Automata, Languages and Programming, pages 693 -- 703. Springer, 2002. [CCLY19] Michael B Cohen, Ben Cousins, Yin Tat Lee, and Xin Yang. A near-optimal algorithm for approximating the john ellipsoid. In COLT, 2019. [CLS19] Michael B Cohen, Yin Tat Lee, and Zhao Song. Solving linear programs in the current In Proceedings of the 51st Annual ACM Symposium on matrix multiplication time. Theory of Computing (STOC). https://arxiv.org/pdf/1810.07896.pdf, 2019. [CW87] [CW13] Don Coppersmith and Shmuel Winograd. Matrix multiplication via arithmetic progres- sions. In Proceedings of the nineteenth annual ACM symposium on Theory of computing, pages 1 -- 6. ACM, 1987. Kenneth L. Clarkson and David P. Woodruff. Low rank approximation and regression in input sparsity time. In Symposium on Theory of Computing Conference, STOC'13, Palo Alto, CA, USA, June 1-4, 2013, pages 81 -- 90. https://arxiv.org/pdf/1207.6365, 2013. [CWW19] Kenneth L. Clarkson, Ruosong Wang, and David P Woodruff. Dimensionality reduction for tukey regression. In ICML. arXiv preprint arXiv:1904.05543, 2019. [DJS+19] Huaian Diao, Rajesh Jayaram, Zhao Song, Wen Sun, and David P. Woodruff. Optimal sketching for kronecker product regression and low rank approximation. In NeurIPS, 2019. [DKT17] Dua Dheeru and Efi Karra Taniskidou. UCI machine learning repository, 2017. [DMM06a] Petros Drineas, Michael W. Mahoney, and S. Muthukrishnan. Sampling algorithms for l2 regression and applications. In Proceedings of the Seventeenth Annual ACM-SIAM Symposium on Discrete Algorithm, SODA '06, pages 1127 -- 1136, Philadelphia, PA, USA, 2006. Society for Industrial and Applied Mathematics. 11 [DMM06b] Petros Drineas, Michael W. Mahoney, and S. Muthukrishnan. Subspace sampling and relative-error matrix approximation: Column-row-based methods. In Algorithms - ESA 2006, 14th Annual European Symposium, Zurich, Switzerland, September 11-13, 2006, Proceedings, pages 304 -- 314, 2006. [DMMS11] Petros Drineas, Michael W Mahoney, S Muthukrishnan, and Tamás Sarlós. Faster least squares approximation. Numerische mathematik, 117(2):219 -- 249, 2011. [DSSW18] Huaian Diao, Zhao Song, Wen Sun, and David P. Woodruff. Sketching for kronecker product regression and p-splines. AISTATS, 2018. [FT07] Shmuel Friedland and Anatoli Torokhti. Generalized rank-constrained matrix approxi- mations. SIAM Journal on Matrix Analysis and Applications, 29(2):656 -- 659, 2007. [LHW17] Xingguo Li, Jarvis Haupt, and David Woodruff. Near optimal sketching of low-rank tensor regression. In Advances in Neural Information Processing Systems, pages 3466 -- 3476, 2017. [LPT09] [LSZ19] [LV10] [LV14] [MM13] Shuai Lu, Sergei V Pereverzev, and Ulrich Tautenhahn. Regularized total least squares: computational aspects and error bounds. SIAM Journal on Matrix Analysis and Appli- cations, 31(3):918 -- 941, 2009. Yin Tat Lee, minimization https://arxiv.org/pdf/1905.04447.pdf, 2019. Zhao Song, and Qiuyi Zhang. in the current matrix multiplication Solving time. empirical risk In COLT. Jörg Lampe and Heinrich Voss. Solving regularized total least squares problems based on eigenproblems. Taiwanese Journal of Mathematics, 14(3A):885 -- 909, 2010. Jorg Lampe and Heinrich Voss. Large-scale dual regularized total least squares. Elec- tronic Transactions on Numerical Analysis, 42:13 -- 40, 2014. Xiangrui Meng and Michael W Mahoney. Low-distortion subspace embeddings in In Proceedings of input-sparsity time and applications to robust linear regression. the forty-fifth annual ACM symposium on Theory of computing, pages 91 -- 100. ACM, https://arxiv.org/pdf/1210.3135, 2013. [MVH07] Ivan Markovsky and Sabine Van Huffel. Overview of total least-squares methods. Signal processing, 87(10):2283 -- 2302, 2007. [NN13] Jelani Nelson and Huy L Nguyên. Osnap: Faster numerical linear algebra algorithms via sparser subspace embeddings. In 2013 IEEE 54th Annual Symposium on Foundations of Computer Science (FOCS), pages 117 -- 126. IEEE, https://arxiv.org/pdf/1211.1002, 2013. [PS] P. van der Putten and M. van Someren. Coil challenge 2000: The insurance company case. Technical report. [PSW17] Eric Price, Zhao Song, and David P. Woodruff. Fast regression with an ℓ∞ guarantee. In ICALP, 2017. [RG04] Rosemary A Renaut and Hongbin Guo. Efficient algorithms for solution of regularized total least squares. SIAM Journal on Matrix Analysis and Applications, 26(2):457 -- 476, 2004. 12 [RSW16] Ilya Razenshteyn, Zhao Song, and David P Woodruff. Weighted low rank approxima- tions with provable guarantees. In Proceedings of the 48th Annual Symposium on the Theory of Computing (STOC), 2016. [SWY+19] Zhao Song, Ruosong Wang, Lin F. Yang, Hongyang Zhang, and Peilin Zhong. Efficient symmetric norm regression via linear sketching. In NeurIPS, 2019. [SWZ17] Zhao Song, David P Woodruff, and Peilin Zhong. Low rank approximation with en- trywise ℓ1-norm error. In Proceedings of the 49th Annual Symposium on the Theory of Computing (STOC). ACM, https://arxiv.org/pdf/1611.00898, 2017. [SWZ19a] Zhao Song, David P Woodruff, and Peilin Zhong. Average case column subset selection for entrywise ℓ1-norm loss. In NeurIPS, 2019. [SWZ19b] Zhao Song, David P Woodruff, and Peilin Zhong. Relative error tensor low rank ap- proximation. In SODA. https://arxiv.org/pdf/1704.08246, 2019. [SWZ19c] Zhao Song, David P Woodruff, and Peilin Zhong. Towards a zero-one law for column subset selection. In NeurIPS, 2019. [TZ12] [UCIa] [UCIb] Mikkel Thorup and Yin Zhang. Tabulation-based 5-independent hashing with applica- tions to linear probing and second moment estimation. SIAM Journal on Computing, 41(2):293 -- 331, 2012. UCI. Airfoil self-noise. In . https://archive.ics.uci.edu/ml/datasets/Airfoil+Self-Noise, . Insurance UCI. https://archive.ics.uci.edu/ml/datasets/Insurance+Company+Benchmark+%28COIL+2000%29, . benchmark data set. company (coil 2000) In . [UCIc] UCI. Wine quality. In . https://archive.ics.uci.edu/ml/datasets/Wine+Quality, . [VHV91] Sabine Van Huffel and Joos Vandewalle. The total least squares problem: computational aspects and analysis, volume 9. Siam, 1991. [Wil12] Virginia Vassilevska Williams. Multiplying matrices faster than coppersmith-winograd. In Proceedings of the forty-fourth annual ACM symposium on Theory of computing (STOC), pages 887 -- 898. ACM, 2012. [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. 13 Appendix A Notation In addition to O(·) notation, for two functions f, g, we use the shorthand f . g (resp. &) to indicate that f ≤ Cg (resp. ≥) for an absolute constant C. We use f h g to mean cf ≤ g ≤ Cf for constants c, C. B Oblivious and Non-oblivious sketching matrix In this section we introduce techniques in sketching. In order to optimize performance, we introduce multiple types of sketching matrices, which are used in Section 3. In Section B.1, we provide the definition of CountSketch and Gaussian Transforms. In Section B.2, we introduce leverage scores and sampling based on leverage scores. B.1 CountSketch and Gaussian Transforms CountSketch matrix comes from the data stream literature [CCF02, TZ12]. Definition B.1 (Sparse embedding matrix or CountSketch transform). A CountSketch transform is defined to be Π = ΦD ∈ Rm×n. Here, D is an n × n random diagonal matrix with each diagonal entry independently chosen to be +1 or −1 with equal probability, and Φ ∈ {0, 1}m×n is an m × n binary matrix with Φh(i),i = 1 and all remaining entries 0, where h : [n] → [m] is a random map such that for each i ∈ [n], h(i) = j with probability 1/m for each j ∈ [m]. For any matrix A ∈ Rn×d, ΠA can be computed in O(nnz(A)) time. To obtain the optimal number of rows, we need to apply Gaussian matrix, which is another well-known oblivious sketching matrix. Definition B.2 (Gaussian matrix or Gaussian transform). Let S = 1√m · G ∈ Rm×n where each entry of G ∈ Rm×n is chosen independently from the standard Gaussian distribution. For any matrix A ∈ Rn×d, SA can be computed in O(m · nnz(A)) time. We can combine CountSketch and Gaussian transforms to achieve the following: Definition B.3 (CountSketch + Gaussian transform). Let S′ = SΠ, where Π ∈ Rt×n is the CountSketch transform (defined in Definition B.1) and S ∈ Rm×t is the Gaussian transform (defined in Definition B.2). For any matrix A ∈ Rn×d, S′A can be computed in O(nnz(A) + dtmω−2) time, where ω is the matrix multiplication exponent. B.2 Leverage Scores We do want to note that there are other ways of constructing sketching matrix though, such as through sampling the rows of A via a certain distribution and reweighting them. This is called leverage score sampling [DMM06b, DMM06a, DMMS11]. We first give the concrete definition of leverage scores. Definition B.4 (Leverage scores). Let U ∈ Rn×k have orthonormal columns with n ≥ k. We will use the notation pi = u2 2 is referred to as the i-th leverage score of U . i /k, where u2 i = ke⊤i Uk2 14 Next we explain the leverage score sampling. Given A ∈ Rn×d with rank k, let U ∈ Rn×k be an orthonormal basis of the column span of A, and for each i let k · pi be the squared row norm of the i-th row of U . Let pi denote the i-th leverage score of U . Let β > 0 be a constant and q = (q1,··· , qn) denote a distribution such that, for each i ∈ [n], qi ≥ βpi. Let s be a parameter. Construct an n×s sampling matrix B and an s×s rescaling matrix D as follows. Initially, B = 0n×s and D = 0s×s. For the same column index j of B and of D, independently, and with replacement, pick a row index i ∈ [n] with probability qi, and set Bi,j = 1 and Dj,j = 1/√qis. We denote this procedure Leverage score sampling according to the matrix A. Leverage score sampling is efficient in the sense that leverage score can be efficiently approxi- mated. Theorem B.5 (Running time of over-estimation of leverage score, Theorem 14 in [NN13]). For any ǫ > 0, with probability at least 2/3, we can compute 1 ± ǫ approximation of all leverage scores of matrix A ∈ Rn×d in time eO(nnz(A) + rωǫ−2ω) where r is the rank of A and ω ≈ 2.373 is the exponent of matrix multiplication [CW87, Wil12]. In Section C we show how to apply matrix sketching to solve regression problems faster. In Section D, we give a structural result on rank-constrained approximation problems. C Multiple Regression Linear regression is a fundamental problem in Machine Learning. There are a lot of attempts trying to speed up the running time of different kind of linear regression problems via sketching matrices [CW13, MM13, PSW17, LHW17, DSSW18, ALS+18, CWW19]. A natural generalization of linear regression is multiple regression. We first show how to use CountSketch to reduce to a multiple regression problem: Theorem C.1 (Multiple regression, [Woo14]). Given A ∈ Rn×d and B ∈ Rn×m, let S ∈ Rs×n denote a sampling and rescaling matrix according to A. Let X∗ denote arg minX kAX − Bk2 F and X′ denote arg minX kSAX − SBk2 F . If S has s = O(d/ǫ) rows, then we have that kAX′ − Bk2 F ≤ (1 + ǫ)kAX∗ − Bk2 F holds with probability at least 0.999. The following theorem says leverage score sampling solves multiple response regression: Theorem C.2 (See, e.g., the combination of Corollary C.30 and Lemma C.31 in [SWZ19b]). Given A ∈ Rn×d and B ∈ Rn×m, let D ∈ Rn×n denote a sampling and rescaling matrix according to A. Let X∗ denote arg minX kAX − Bk2 F . If D has O(d log d + d/ǫ) non-zeros in expectation, that is, this is the expected number of sampled rows, then we have that F and X′ denote arg minX kDAX − SBk2 kAX′ − Bk2 F ≤ (1 + ǫ)kAX∗ − Bk2 F holds with probability at least 0.999. D Generalized Rank-Constrained Matrix Approximation We state a tool which has been used in several recent works [BWZ16, SWZ17, SWZ19b]. 15 Theorem D.1 (Generalized rank-constrained matrix approximation, Theorem 2 in [FT07]). Given matrices A ∈ Rn×d, B ∈ Rn×p, and C ∈ Rq×d, let the singular value decomposition (SVD) of B be B = UBΣBV ⊤B and the SVD of C be C = UCΣCV ⊤C . Then B†(UBU⊤B AVCV ⊤C )kC† = arg min rank −k X∈Rp×qkA − BXCkF where (UBU⊤B AVC V ⊤C )k ∈ Rn×d is of rank at most k and denotes the best rank-k approximation to UBU⊤B AVCV ⊤C ∈ Rn×d in Frobenius norm. Moreover, (UBU⊤B AVCV ⊤C )k can be computed by first computing the SVD decomposition of UBU⊤B AVCV ⊤C in time O(nd2), then only keeping the largest k coordinates. Hence B†(UBU⊤B AVC V ⊤C )kC† can be computed in O(nd2 + np2 + qd2) time. E Closed Form for the Total Least Squares Problem Markovsky and Huffel [MVH07] propose the following alternative formulation of total least squares problem. rank −n C ′∈Rm×(n+d) kC′ − CkF min (6) When program (1) has a solution (X, ∆A, ∆B), we can see that (1) and (6) are in general equivalent by setting C′ = [A + ∆A, B + ∆B]. However, there are cases when program (1) fails to have a solution, while (6) always has a solution. V21 V22(cid:21) where V11 ∈ Rn×n and V22 ∈ Rd×d. As discussed, a solution to the total least squares problem can sometimes be written in closed form. Letting C = [A, B], denote the singular value decomposition (SVD) of C by U ΣV ⊤, where Σ = diag(σ1,··· , σn+d) ∈ Rm×(n+d) with σ1 ≥ σ2 ≥ ··· ≥ σn+d. Also we represent (n + d)× (n + d) matrix V as (cid:20)V11 V12 Clearly bC = U diag(σ1,··· , σn, 0,··· , 0)V ⊤ is a minimizer of program (6). But whether a solution to program (1) exists depends on the singularity of V22. In the rest of this section we introduce different cases of the solution to program (1), and discuss how our algorithm deals with each case. E.1 Unique Solution We first consider the case when the Total Least Squares problem has a unique solution. Theorem E.1 (Theorem 2.6 and Theorem 3.1 in [VHV91]). If σn > σn+1, and V22 is non-singular, then the minimizer bC is given by U diag(σ1,··· , σn, 0,··· , 0)V ⊤, and the optimal solution bX is given by −V12V −1 22 . Our algorithm will first find a rank n matrix C′ = [A′, B′] so that kC′ − CkF is small, then solve a regression problem to find X′ so that A′X′ = B′. In this sense, this is the most favorable case to work with, because a unique optimal solution bC exists, so if C′ approximates bC well, then the regression problem A′X′ = B′ is solvable. E.2 Solution exists, but is not unique If σn = σn+1, then it is still possible that the Total Least Squares problem has a unique solution, although this time, the solution bX is not unique. Theorem E.2 is a generalization of Theorem E.1. 16 Algorithm 2 Least Squares and Total Least Squares Algorithms 1: procedure LeastSquares(A, B) 2: X ← minX kAX − BkF CLS ← [A, AX] return CLS 3: 4: 5: procedure TotalLeastSquares(A, B) 6: CTLS ← minrank −n C ′ kC − C′kF return CTLS 7: Theorem E.2 (Theorem 3.9 in [VHV91]). Let p ≤ n be a number so that σp > σp+1 = ··· = σn+1. Let Vp be the submatrix that contains the last d rows and the last n − p + d columns of V . If Vp is non-singular, then multiple minimizers bC = [bA, bB] exist, and there exists bX ∈ Rn×d so that bAbX = bB. We can also handle this case. As long as the Total Least Squares problem has a solution bX, we are able to approximate it by first finding C′ = [A′, B′] and then solving a regression problem. E.3 Solution does not exist has no solution. the cost of program (1). But there are cases where this cost is not approchable in program (1). F , where bC is the optimal solution to program (6), always lower bounds Notice that the cost kbC−Ck2 Theorem E.3 (Lemma 3.2 in [VHV91]). If V22 is singular, letting bC denote [bA, bB], then bAX = bB Theorem E.3 shows that even if we can compute bC precisely, we cannot output X, because the first n columns of bC cannot span the rest d columns. In order to generate a meaningful result, our algorithm will perturb C′ by an arbitrarily small amount so that A′X′ = B′ has a solution. This will introduce an arbitrarily small additive error in addition to our relative error guarantee. F Omitted Proofs in Section 3 F.1 Proof of Claim 3.1 Proof. Let C∗ be the optimal solution of minrank −n C ′∈Rm×(n+d) kC′ − [A, B]kF . Since rank(C∗) = n ≪ m, there exist U∗ ∈ Rm×s1 and V ∗ ∈ Rs1×(n+d) so that C∗ = U∗V ∗, and rank(U∗) = rank(V ∗) = n. Therefore Now consider the problem formed by multiplying by S1 on the left, min V ∈Rs1×(n+d) kU∗V − Ck2 F = OPT2 . min V ∈Rs1×(n+d) kS1U∗V − S1Ck2 F . Letting V ′ be the minimizer to the above problem, we have V ′ = (S1U∗)†S1C. 17 Thus, we have min rank −n U∈Rm×s1 kU S1C − Ck2 F F F ≤ kU∗(S1U∗)†S1C − Ck2 = kU∗V ′ − Ck2 ≤ (1 + ǫ)kS1U∗V ′ − S1Ck2 ≤ (1 + ǫ)kS1U∗V ∗ − S1Ck2 ≤ (1 + ǫ)2kU∗V ∗ − Ck2 = (1 + ǫ)2 OPT2 F F F where the first step uses the fact that U∗(S1U∗)†S1 ∈ Rm×s1 with rank n, the second step is the definition of V ′, the third step follows from the definition of the Count-Sketch matrix S1 and Theorem C.1, the fourth step uses the optimality of V ′, and the fifth step again uses Theorem C.1. F.2 Proof of Claim 3.2 Proof. We have kU2S1C − Ck2 F ≤ (1 + ǫ)kU2S1CD1 − CD1k2 ≤ (1 + ǫ)kU1S1CD1 − CD1k2 ≤ (1 + ǫ)2kU1S1C − Ck2 F , F F where the first step uses the property of a leverage score sampling matrix D1, the second step follows from the definition of U2 (i.e., U2 is the minimizer), and the last step follows from the property of the leverage score sampling matrix D1 again. F.3 Proof of Claim 3.4 Proof. From Claim 3.2 we have that U2 ∈ colspan(CD1). Hence we can choose Z so that CD1Z = U2. Then by Claim 3.1 and Claim 3.2, we have kCD1ZS1C − Ck2 F = kU2S1C − Ck2 F ≤ (1 + ǫ)4 OPT2 . Since Z1 is the optimal solution, the objective value can only be smaller. F.4 Proof of Claim 3.5 Proof. Recall that Z1 = arg minrank −n Z∈Rd1×s1 kCD1ZS1C − Ck2 F . Then we have kCD1Z2S1C − Ck2 F ≤ (1 + ǫ)kD2CD1Z2S1C − D2Ck2 ≤ (1 + ǫ)kD2CD1Z1S1C − D2Ck2 ≤ (1 + ǫ)2kCD1Z1S1C − Ck2 F , F F where the first step uses the property of the leverage score sampling matrix D2, the second step follows from the definition of Z2 (i.e., Z2 is a minimizer), and the last step follows from the property of the leverage score sampling matrix D2. 18 F.5 Proof of Claim 3.6 Proof. kbC − Ck2 F = kCD1 · Z2 · S1C − Ck2 ≤ (1 + ǫ)2kCD1Z1S1C − Ck2 ≤ (1 + O(ǫ)) OPT2 F F where the first step is the definition of bC, the second step is Claim 3.5, and the last step is Claim 3.4. F.6 Proof of Claim 3.7 Proof. By the condition that bC = [bA bAbX], bB = bAbX, hence bX is the optimal solution to the program minX∈Rn×d kbAX − bBk2 F . Hence by Theorem C.1, with probability at least 0.99, Therefore Then it follows from Claim 3.6. kbAX − bBk2 k[bA, bAX] − [A, B]k2 F ≤ (1 + ǫ)kbAbX − bBk2 F = k[bA, bB] − Ck2 F = 0 F = kbC − Ck2 F . F.7 Proof of Lemma 3.8 Proof. Proof of running time. Let us first check the running time. We can compute C = S2 · bC by first computing S2 · CD1, then computing (S2CD1) · Z2, then finally computing S2CD1Z2S1C. Notice that D1 is a leverage score sampling matrix, so nnz(CD1) ≤ nnz(C). So by Definition B.1, we can compute S2 · CD1 in time O(nnz(C)). All the other matrices have smaller size, so we can do matrix multiplication in time O(d· poly(n/ǫ)). Once we have C, the independence between columns in A can be checked in time O(s2 · n). The FOR loop will be executed at most n times, and inside each loop, line (21) will take at most d linear independence checks. So the running time of the FOR loop is at most O(s2 · n) · n · d = O(d · poly(n/ǫ)). Therefore the running time is as desired. Proof of Correctness. We next argue the correctness of procedure Split. Since rank(bC) = n, with high probability rank(C) = rank(S2·bC) = n. Notice that B is never changed in this subroutine. In order to show there exists an X so that AX = B, it is sufficient to show that at the end of procedure Split, rank(A) = rank(C), because this means that the columns of A span each of the columns of C, including B. Indeed, whenever rank(A∗,[i]) < i, line 25 will be executed. Then by doing line 26, the rank of A will increase by 1, since by the choice of j, A∗,i + δ · B∗,j is independent form A∗,[i−1]. Because rank(C) = n, at the end of the FOR loop we will have rank(A) = n. Finally let us compute the cost. In line (10) we use δ/ poly(m), and thus δ2 k[bA, bB] − bCk2 F ≤ poly(m) · kbBk2 F ≤ δ2. (7) We know that X is the optimal solution to the program minX∈Rn×d kS2bAX − S2bBk2 Theorem C.1, with probability 0.99, F . Hence by kbAX − bBk2 F ≤ (1 + ǫ) min X∈Rn×d kS2bAX − S2bBk2 F = 0. 19 which implies bAX = bB. Hence we have k[bA, bAX] − CkF ≤ k[bA, bAX] − bCkF + kbC − CkF = k[bA, bB] − bCkF + kbC − CkF ≤ δ + kbC − CkF where the first step follows by triangle inequality, and the last step follows by (7). F.8 Proof of Lemma 3.9 Proof. We bound the time of each step: 1. Construct the s1 × m Count-Sketch matrix S1 and compute S1C with s1 = O(n/ǫ). This step takes time nnz(C) + d · poly(n/ǫ). 2. Construct the (n + d) × d1 leverage sampling and rescaling matrix D1 with d1 = eO(n/ǫ) nonzero diagonal entries and compute CD1. This step takes time eO(nnz(C) + d · poly(n/ǫ)). 3. Construct the d2 × m leverage sampling and rescaling matrix D2 with d2 = eO(n/ǫ) nonzero diagonal entries. This step takes time eO(nnz(C) + d · poly(n/ǫ)) according to Theorem B.5. 4. Compute Z2 ∈ Rd1×s1 by solving the rank-constrained system: rank −n Z∈Rd1×s1 kD2CD1ZS1C − D2Ck2 F . min Note that D2CD1 has size eO(n/ǫ) × eO(n/ǫ), S1C has size O(n/ǫ) × (n + d), and D2C has size eO(n/ǫ) × (n + d), so according to Theorem D.1, we have an explicit closed form for Z2, and the time taken is d · poly(n/ǫ). 5. Run procedure Split to get A ∈ Rs2×n and B ∈ Rs2×d with s2 = O(n/ǫ). By Lemma 3.8, this step takes time O(nnz(C) + d · poly(n/ǫ)). 6. Compute X by solving the regression problem minX∈Rn×d kAX−Bk2 F in time O(d·poly(n/ǫ)). This is because X = (A)†B, and A has size O(n/ǫ)×n, so we can compute (A)† in time O((n/ǫ)ω) = poly(n/ǫ), and then compute X in time O((n/ǫ)2 · d) since B is an O(n/ǫ) × d matrix. Notice that nnz(C) = nnz(A) + nnz(B), so we have the desired running time. F.9 Procedure Evaluate In this subsection we explain what procedure Evaluate does. Ideally, we would like to apply procedure Split on the matrix bC directly so that the linear system bAX = bB has a solution. However, bC has m rows, which is computationally expensive to work with. So in the main algorithm we actually apply procedure Split on the sketched matrix S2bC. When we need to compute the cost, we shall redo the operations in procedure Split on bC to split bC correctly. This is precisely what we are doing in lines (24) to (27). F.10 Putting it all together Proof. The running time follows from Lemma 3.9. For the approximation ratio, let bA, A be defined as in Lemma 3.8. From Lemma 3.8, there exists X ∈ Rn×d satisfying AX = B. Since X is obtained from solving the regression problem kAX − Bk2 F , we also have AX = B. Hence with probability 0.9, where the first step uses Lemma 3.8 and the second step uses Claim 3.6. Rescaling ǫ gives the k[bA, bAX] − CkF ≤ δ + kbC − CkF ≤ δ + (1 + O(ǫ)) OPT, desired statement. 20 Algorithm 3 Our Fast Total Least Squares Algorithm with Regularization 3: 4: 5: 6: 7: 8: ⊲ Theorem G.7 rows of CS⊤2 1: procedure FastRegularizedTotalLeastSquares(A, B, n, d, λǫ, δ) 2: s1 ← eO(n/ǫ), s2 ← eO(n/ǫ), , s3 ← eO(n/ǫ), d1 ← eO(n/ǫ) Choose S1 ∈ Rs1×m to be a CountSketch matrix, then compute S1C Choose S2 ∈ Rs2×(n+d) to be a CountSketch matrix, then compute CS⊤2 Choose D1 ∈ Rd1×m to be a leverage score sampling and rescaling matrix according to the bZ1, bZ2 ← arg minZ1∈Rn×s1 ,Z2∈Rs2×n kD1CS⊤2 Z2Z1S1C − D1Ck2 F + λkZ1S1Ck2 ⊲ Theorem G.2 A, B, π ← Split(CS⊤2 , bZ1, bZ2, S1C, n, d, δ/ poly(m)), X ← minkAX − BkF return X Choose S3 ∈ Rs3×m to be a CountSketch matrix C ← (S3 · CS⊤2 ) · bZ2 · bZ1 · S1C A ← C∗,[n], B ← C∗,[n+d]\[n] T ← ∅, π(i) = −1 for all i ∈ [n] for i = 1 → n do ⊲ bC = CS⊤2 bZ2bZ1S1C ; C = S3bC ⊲ bA = bC∗,[n], bB = bC∗,[n+d]\[n]; A = S3bA, B = S3bB 9: procedure Split(CS⊤2 , bZ1, bZ2, S1C, n, d, δ) F + λkD1CS⊤2 Z2k2 ⊲ Lemma 3.8 F if A∗,i is linearly dependent of A∗,[n]\{i} then j ← minj∈[d]\T{B∗,j is linearly independent of A}, A∗,i ← A∗,i +δ·B∗,j, T ← T ∪{j}, π(i) ← j return A, B, π 10: 11: 12: 13: 14: 15: 16: 17: ⊲ π : [n] → {−1} ∪ ([n + d]\[n]) G Extension to regularized total least squares problem In this section we provide our algorithm for the regularized total least squares problem and prove its correctness. Recall our regularized total least squares problem is defined as follows. OPT := min bA∈Rm×n,X∈Rn×d,U∈Rm×n,V ∈Rn×(n+d)kU V − [A, B]k2 subject to [bA, bAX] = U V F + λkUk2 F + λkV k2 F (8) Definition G.1 (Statistical Dimension, e.g., see [ACW17]). For λ > 0 and rank k matrix A, the statistical dimension of the ridge regression problem with regularizing weight λ is defined as sdλ(A) := Xi∈[k] 1 1 + λ/σ2 i where σi is the i-th singular value of A for i ∈ [k]. Notice that sdλ(A) is decreasing in λ, so we always have sdλ(A) ≤ sd0(A) = rank(A). Lemma G.2 (Exact solution of low rank approximation with regularization, Lemma 27 of [ACW17]). Given positive integers n1, n2, r, s, k and parameter λ ≥ 0. For C ∈ Rn1×r, D ∈ Rs×n2, B ∈ Rn1×n2, the problem of finding min ZR∈Rr×k,ZS∈Rk×s kCZRZSD − Bk2 F + λkCZRk2 F + λkZS Dk2 F , 21 and the minimizing of CZR ∈ Rn1×k and ZSD ∈ Rk×n2, can be solved in O(n1r · rank(C) + n2s · rank(D) + rank(D) · n1(n2 + rC)) time. Theorem G.3 (Sketching for solving ridge regression, Theorem 19 in [ACW17]). Fix m ≥ n. For A ∈ Rm×n, B ∈ Rn×d and λ > 0, consider the rigid regression problem min X∈Rn×d kAX − Bk2 F + λkXk2 F . Let S ∈ Rs×m be a CountSketch matrix with s = eO(sdλ(A)/ǫ) = eO(n/ǫ), then with probability 0.99, min X∈Rn×d kSAX − SBk2 F + λkXk2 F ≤ (1 + ǫ) min X∈Rn×d kAX − Bk2 F + λkXk2 F Moreover, SA, SB can be computed in time O(nnz(A) + nnz(B)) + eO(cid:0)(n + d)(sdλ(A)/ǫ + sdλ(A)2)(cid:1) . We claim that it is sufficient to look at solutions of the form CS⊤2 Z2Z1S1C. Claim G.4 (CountSketch matrix for low rank approximation problem). Given matrix C ∈ Rm×(n+d). Let OPT be defined as in (8). For any ǫ > 0, let S1 ∈ Rs1×m, S2 ∈ Rs2×m be the sketching matrices defined in Algorithm 3, then with probability 0.98, min Z1∈Rn×s1 ,Z2∈Rs2×n kCS⊤2 Z2Z1S1C − Ck2 F + λkCS⊤2 Z2k2 F + λkZ1S1Ck2 F ≤ (1 + ǫ)2 OPT . Proof. Let U∗ ∈ Rm×n and V ∗ ∈ Rn×(n+d) be the optimal solution to the program (8). Consider the following optimization problem: min V ∈Rn×(n+d) kU∗V − Ck2 F + λkV k2 F (9) Clearly V ∗ ∈ Rn×(n+d) is the optimal solution to program (9), since for any solution V ∈ Rn×(n+d) to program (9) with cost c, (U∗, V ) is a solution to program (8) with cost c + λkU∗k2 F . Program (9) is a ridge regression problem. Hence we can take a CountSketch matrix S ∈ Rs1×m with s1 = eO(n/ǫ) to obtain (10) min V ∈Rn×(n+d) kS1U∗V − S1Ck2 F + λkV k2 F Let V1 ∈ Rn×(n+d) be the minimizer of the above program, then we know V1 =(cid:20)S1U∗√λIn(cid:21)†(cid:20)S1C 0 (cid:21) , which means V1 ∈ Rn×(n+d) lies in the row span of S1C ∈ Rs1×(n+d). Moreover, by Theorem G.3, with probability at least 0.99 we have kU∗V1 − Ck2 F + λkV1k2 F ≤ (1 + ǫ)kU∗V ∗ − Ck2 F + λkV ∗k2 F (11) 22 Now consider the problem min U∈Rm×n kU V1 − Ck2 F + λkUk2 F (12) Let U0 ∈ Rm×n be the minimizer of program (12). Similarly, we can take a CountSketch matrix S2 ∈ Rs2×(n+d) with s2 = eO(n/ǫ) to obtain F + λkUk2 Let U1 ∈ Rm×n be the minimizer of program (13), then we know U⊤1 =(cid:20)S2V ⊤1√λIn(cid:21)†(cid:20)S2C⊤ 0 (cid:21) , U∈Rm×n kU V1S⊤2 − CS⊤2 k2 (13) min F which means U1 ∈ Rm×n lies in the column span of CS⊤2 ∈ Rm×s2. Moreover, with probability at least 0.99 we have kU1V1 − Ck2 F + λkU1k2 F ≤ (1 + λ) · (kU0V1 − Ck2 ≤ (1 + λ) · (kU∗V1 − Ck2 F + λkU0k2 F ) F + λkU∗k2 F ) (14) where the first step we use Theorem G.3 and the second step follows that U0 is the minimizer. F + λkU1k2 F + (kU1V1 − Ck2 F + (1 + ǫ)(kU∗V1 − Ck2 Now let us compute the cost. kU1V1 − Ck2 = λkV1k2 ≤ λkV1k2 ≤ (1 + ǫ) ·(cid:0)λkU∗k2 ≤ (1 + ǫ) ·(cid:0)λkU∗k2 ≤ (1 + ǫ)2 · (kU∗V ∗ − Ck2 = (1 + ǫ)2 OPT F F + λkV1k2 F + λkU1k2 F ) F + λkU∗k2 F ) F )(cid:1) F + λkV1k2 F + (kU∗V1 − Ck2 F )(cid:1) F + (1 + ǫ)2 · (kU∗V ∗ − Ck2 F + λkV ∗k2 F + λkV ∗k2 F ) F + λkU∗k2 where the second step follows from (14), the fourth step follows from (11), and the last step follows from the definition of U∗ ∈ Rm×n, V ∗ ∈ Rn×(n+d). Finally, since V1 ∈ Rn×(n+d) lies in the row span of S1C ∈ Rs1×(n+d) and U1 ∈ Rm×n lies in the column span of CS⊤2 ∈ Rm×s2, there exists Z∗1 ∈ Rn×s1 and Z∗2 ∈ Rs2×n so that V1 = Z∗1 S1C ∈ Rn×(n+d) and U1 = CS⊤2 Z∗2 ∈ Rm×n. Then the claim stated just follows from (Z∗1 , Z∗2 ) are also feasible. Now we just need to solve the optimization problem min Z1∈Rn×s1 ,Z2∈Rs2×n kCS⊤2 Z2Z1S1C − Ck2 F + λkCS⊤2 Z2k2 F + λkZ1S1Ck2 F (15) The size of this program is quite huge, i.e., we need to work with an m× d2 matrix CS⊤2 . To handle this problem, we again apply sketching techniques. Let D1 ∈ Rd1×m be a leverage score sampling and rescaling matrix according to the matrix CS2 ∈ Rm×s2, so that D1 has d1 = eO(n/ǫ) nonzeros on the diagonal. Now, we arrive at the small program that we are going to directly solve: F + λkZ1S1Ck2 Z1∈Rn×s1 ,Z2∈Rs2×n kD1CS⊤2 Z2Z1S1C − D1Ck2 F + λkD1CS⊤2 Z2k2 (16) min F We have the following approximation guarantee. 23 Claim G.5. Let (Z∗1 , Z∗2 ) be the optimal solution to program (15). Let (bZ1, bZ2) be the optimal solution to program (16). With probability 0.96, kCS⊤2 bZ2bZ1S1C − Ck2 ≤(1 + ǫ)2(kCS⊤2 Z∗2 Z∗1 S1C − Ck2 F + λkCS⊤2 bZ2k2 F + λkbZ1S1Ck2 F F + λkCS⊤2 Z∗2k2 F + λkZ∗1 S1Ck2 F ) Proof. This is because kCS⊤2 bZ2bZ1S1C − Ck2 F + λkCS⊤2 bZ2k2 ≤(1 + ǫ)(cid:16)kD1CS⊤2 bZ2bZ1S1C − D1Ck2 ≤(1 + ǫ)(cid:16)kD1CS⊤2 bZ2bZ1S1C − D1Ck2 ≤(1 + ǫ)(cid:16)kD1CS⊤2 Z∗2 Z∗1 S1C − D1Ck2 ≤(1 + ǫ)2(cid:16)kCS⊤2 Z∗2 Z∗1 S1C − Ck2 F F + λkbZ1S1Ck2 F + λkD1CS⊤2 bZ2k2 F + λkD1CS⊤2 bZ2k2 F + λkD1CS⊤2 Z∗2k2 F F(cid:17) + λkbZ1S1Ck2 F(cid:17) F + λkbZ1S1Ck2 F(cid:17) F + λkZ∗1 S1Ck2 F + λkCS⊤2 Z∗2k2 F(cid:17) F + λkZ∗1 S1Ck2 where the first step uses property of the leverage score sampling matrix D1, the third step follows score sampling matrix D1. from (bZ1, bZ2) are minimizers of program (16), and the fourth step again uses property of the leverage Let bU = CS⊤2 bZ2,bV = bZ1S1C and bC = bUbV . Combining Claim G.4 and Claim G.5 together, we get with probability at least 0.91, kbUbV − [A, B]k2 F + λkbUk2 F + λkbV k2 F ≤ (1 + ǫ)4 OPT (17) If the first n columns of bC can span the whole matrix bC, then we are in good shape. In this case we have: Claim G.6 (Perfect first n columns). Let S3 ∈ Rs3×m be the CountSketch matrix defined in Algo- rithm 3. Write bC as [bA, bB] where bA ∈ Rm×n and bB ∈ Rm×d. If there exists bX ∈ Rn×d so that bB = bAbX, let ¯X ∈ Rn×d be the minimizer of minX∈Rn×d kS3bAX − S3bBk2 F , then with probability 0.9, Proof. We have with probability 0.99, k[bA, bA ¯X] − [A, B]k2 kbA ¯X − bBk2 F + λkbUk2 F + λkbV k2 F ≤ (1 + ǫ)kbAbX − bBk2 F = 0 F ≤ (1 + ǫ)4 OPT where the first step follows from Theorem C.1 and the second step follows from the assumption. Recall that bC = bUbV , so k[bA, bA ¯X] − [A, B]k2 =kbUbV − [A, B]k2 F + λkbUk2 F + λkbUk2 F + λkbV k2 F + λkbV k2 F F ≤ (1 + ǫ)4 OPT where the last step uses (17). However, if bC does not have nice structure, then we need to apply our procedure Split, which would introduce the additive error δ. Overall, by rescaling ǫ, our main result is summarized as follows. 24 Theorem G.7 (Restatement of Theorem 3.12, algorithm for the regularized total least squares problem). Given two matrices A ∈ Rm×n and B ∈ Rm×d and λ > 0, letting OPT = min U∈Rm×n,V ∈Rn×(n+d) kU V − [A, B]k2 F + λkUk2 F + λkV k2 F , we have that for any ǫ ∈ (0, 1), there is an algorithm that runs in eO(nnz(A) + nnz(B) + d · poly(n/ǫ)) time and outputs a matrix X ∈ Rn×d such that there is a matrix bA ∈ Rm×n, bU ∈ Rm×n and bV ∈ Rn×(n+d) satisfying that k[bA, bAX] − bUbV k2 k[bA, bAX] − [A, B]kF + λkbUk2 F ≤ δ and F + λkbV k2 F ≤ (1 + ǫ) OPT +δ H Toy Example We first run our FTLS algorithm on the following toy example, for which we have an analytical solution exactly. Let A ∈ Rm×n be Aii = 1 for i = 1,··· , n and 0 everywhere else. Let B ∈ Rm×1 be Bn+1 = 3 and 0 everywhere else. The cost of LS is 9, since AX can only have non-zero entries on the first n coordinates, so the (n + 1)-th coordinate of AX − B must have absolute value 3. Hence the cost is at least 9. Moreover, a cost 9 can be achieved by setting X = 0 and ∆B = −B. However, for the TLS algorithm, the cost is only 1. Consider ∆A ∈ Rm×n where A11 = −1 and 0 everywhere else. Then C′ := [(A + ∆A), B] does have rank n, and kC′ − CkF = 1. For a concrete example, we set m = 10, n = 5. That is, C := [A, B] =   1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   We first run experiments on this small matrix. Because we know the solution of LS and TLS exactly in this case, it is convenient for us to compare their results with that of the FTLS algorithm. When we run the FTLS algorithm, we sample 6 rows in all the sketching algorithms. The experimental solution of LS is CLS which is the same as the theoretical solution. The cost is 9. The experimental solution of TLS is CTLS which is also the same as the theoretical result. The cost is 1. 25 CLS =   1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   CTLS =   0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   FTLS is a randomized algorithm, so the output varies. We post several outputs:   0 0 0 0 0 0 0 0 0 0.5 0.5 0 0 0 0 0 0 0 1 0 0.1 −0.3 0 0 0 −0.9 2.7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 CFTLS = This solution has a cost of 4.3.   0 0 0   0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.7 0 0 0 0   0 0 0 0 0 0 0 0 0 0.09 0.09 0 0.27 0 0 0 0 0.82 0.82 0 2.45   0.5 −0.5 −0.5 0.5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bCFTLS = 0 0 0 0 This solution has a cost of 5.5455. CFTLS = This solution has a cost of 3.4. 0.5   0 0 0 0 0 0 0 0 0 0.5 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 −0.9 0 0 0 0 0 0 0 0 26 I More Experiments Figure 2 shows the experimental result described in Section 4.1. It collects 1000 runs of our FTLS algorithm on 2 small toy examples. In both figures, the x-axis is the cost of the FTLS algorithm, measured by kC′ − Ck2 F where C′ is the output of our FTLS algorithm; the y-axix is the frequency of each cost that is grouped in suitable range. Figure 2: Cost distribution of our fast least squares algorithm on toy examples. The x-axis is the cost for FTLS. (Note that we want to minimize the cost); the y-axis is the frequency of each cost. (Left) First toy example, TLS cost is 1, LS cost is 9. (Right) Second toy example, TLS cost is 1.30, LS cost is 40.4 27
1702.02321
2
1702
2017-04-18T01:39:24
Position Heaps for Parameterized Strings
[ "cs.DS" ]
We propose a new indexing structure for parameterized strings, called parameterized position heap. Parameterized position heap is applicable for parameterized pattern matching problem, where the pattern matches a substring of the text if there exists a bijective mapping from the symbols of the pattern to the symbols of the substring. We propose an online construction algorithm of parameterized position heap of a text and show that our algorithm runs in linear time with respect to the text size. We also show that by using parameterized position heap, we can find all occurrences of a pattern in the text in linear time with respect to the product of the pattern size and the alphabet size.
cs.DS
cs
Position Heaps for Parameterized Strings Diptarama1, Takashi Katsura1, Yuhei Otomo1, Kazuyuki Narisawa1, and Ayumi Shinohara1 1Graduate School of Information Sciences, Tohoku University, , 6-6-05 Aramaki Aza Aoba, Aoba-ku, Sendai, Japan, {diptarama@shino., katsura@shino., otomo@shino., narisawa@, ayumi@}ecei.tohoku.ac.jp November 16, 2018 Abstract We propose a new indexing structure for parameterized strings, called parame- terized position heap. Parameterized position heap is applicable for parameterized pattern matching problem, where the pattern matches a substring of the text if there exists a bijective mapping from the symbols of the pattern to the symbols of the substring. We propose an online construction algorithm of parameterized position heap of a text and show that our algorithm runs in linear time with respect to the text size. We also show that by using parameterized position heap, we can find all occurrences of a pattern in the text in linear time with respect to the product of the pattern size and the alphabet size. 1 Introduction String matching problem is to find occurrences of a pattern string in a text string. Formally, given a text string t and a pattern string p over an alphabet Σ, output all positions at which p occurs in t. Suffix tree and suffix array are most widely used data structures and provide many applications for various string matchings (see e.g. [11, 6]). Ehrenfeucht et al. [8] proposed an indexing structure for string matching, called a position heap. Position heap uses less memory than suffix tree does, and provides efficient search of patterns by preprocessing the text string, similarly to suffix tree and suffix array. A position heap for a string t is a sequence hash tree [4] for the ordered set of all suffixes of t. In [8], the suffixes are ordered in the ascending order of length, and the proposed construction algorithm processes the text from right to left. Later, Kucherov [13] considered the ordered set of suffixes in the descending order of length and proposed a linear-time online construction algorithm based on the Ukkonen's algorithm [16]. Nakashima et al. [14] proposed an algorithm to construct a position heap for a set of strings, where the input is given as a trie of the set. Gagie et al. [10] proposed a position heap with limited height and showed some relations between position heap and suffix array. The parameterized pattern matching that focuses on a structure of strings is intro- duced by Baker [2]. Let Σ and Π be two disjoint sets of symbols. A string over Σ ∪ Π is 1 called a parameterized string (p-string for short). In the parameterized pattern matching problem, given p-strings t and p, find positions of substrings of t that can be transformed into p by applying one-to-one function that renames symbols in Π. The parameterized pattern matching is motivated by applying to the software maintenance [1, 2, 3], the plagiarism detection [9], the analysis of gene structure [15], and so on. Similar to the basic string matching problem, some indexing structures that support the parameterized pattern matching are proposed, such as parameterized suffix tree [2], structural suffix tree [15], and parameterized suffix array [7, 12]. In this paper, we propose a new indexing structure called parameterized position heap for the parameterized pattern matching. The parameterized position heap is a sequence hash tree for the ordered set of prev-encoded [2] suffixes of a parameterized string. We give an online construction algorithm of a parameterized position heap based on Kucherov's algorithm [13] that runs in O(n log (Σ + Π)) time and an algorithm that runs in O(m log (Σ + Π) + mΠ + occ) time to find the occurrences of a pattern in the text, where n is the length of the text, m is the length of the pattern, Σ is the number of constant symbols, Σ is the number of parameter symbols, and occ is the number of occurrences of the pattern in the text. 2 Notation Let Σ and Π be two disjoint sets of symbols. Σ is a set of constant symbols and Π is a set of parameter symbols. An element of Σ∗ is called a string, and an element of (Σ ∪ Π)∗ is called a parameterized string, or p-string for short. For a p-string w = xyz, x, y, and z are called prefix, substring, and suffix of w, respectively. w denotes the length of w, and w[i] denotes the i-th symbol of w for 1 ≤ i ≤ w. The substring of w that begins at position i and ends at position j is denoted by w[i : j] for 1 ≤ i ≤ j ≤ w. Moreover, let w[: i] = w[1 : i] and w[i :] = w[i : w] for 1 ≤ i ≤ w. The empty p-string is denoted by ε, that is ε = 0. For convenience, let w[i : j] = ε if i > j. Let N denote the set of all non-negative integers. Given two p-strings w1 and w2, w1 and w2 are a parameterized match or p-match, denoted by w1 ≈ w2, if there exists a bijection f from the symbols of w1 to the symbols of w2, such that f is identity on the constant symbols [2]. We can determine whether w1 ≈ w2 or not by using an encoding called prev-encoding defined as follows. Definition 1 (Prev-encoding [2]). For a p-string w over Σ ∪ Π, the prev-encoding for w, denoted by prev (w), is a string x of length w over Σ ∪ N defined by w[i] x[i] = 0 i − max{j w[j] = w[i] and 1 ≤ j < i} if w[i] ∈ Σ, if w[i] ∈ Π and w[i] (cid:54)= w[j] for 1 ≤ j < i, otherwise. For any p-strings w1 and w2, w1 ≈ w2 if and only if prev (w1) = prev (w2). For example, given Σ = {a, b} and Π = {u, v, x, y}, s1 = uvuvauuvb and s2 = xyxyaxxyb are p-matches where prev (w1) = prev (w2) = 0022a314b. The parameterized pattern matching is a problem to find occurrences of a p-string pattern in a p-string text defined as follows. 2 (a) (b) (c) (a) A sequence hash tree for (aab, ab, bba, baa, aaba, baaba). (b) A posi- Figure 1: tion heap for a string abbaabaabaabab, (c) An augmented position heap for a string abbaabaabaabab. Maximal-reach pointers for mrp(i) (cid:54)= i are illustrated by doublet arrows. Definition 2 (Parameterized pattern matching [2]). Given two p-strings, text t and pattern p, find all positions i in t such that t[i : i + p − 1] ≈ p. For example, let us consider a text t = uvaubuavbv and a pattern p = xayby over Σ = {a, b} and Π = {u, v, x, y}. Because p ≈ t[2 : 6] and p ≈ t[6 : 10], we should output 2 and 6. Throughout this paper, let t be a text of length n and p be a pattern of length m. 3 Position Heap In this section, we briefly review the position heap for strings. First we introduce the sequence hash tree that is a trie for hashing proposed by Coffman and Eve [4]. Each edge of the trie is labeled by a symbol and each node can be identified with the string obtained by concatenating all labels found on the path from root to the node. Definition 3 (Sequence Hash Tree). Let W = (w1, . . . , wn) be an ordered set of strings over Σ and Wi = (w1, . . . , wi) for 1 ≤ i ≤ n. A sequence hash tree SHT (W) = (Vn, En) for W is a trie over Σ defined recursively as follows. Let SHT (Wi) = (Vi, Ei). Then, (cid:40) SHT (Wi) = ({ε},∅) (Vi−1 ∪ {pi}, Ei−1 ∪ {(qi, c, pi)}) (if i = 0) , (if 1 ≤ i ≤ n) . where pi is the shortest prefix of wi such that pi c = wi[pi]. If no such pi exists, then Vi = Vi−1 and Ei = Ei−1. (cid:54)∈ Vi−1, and qi = wi[1 : pi− 1], Each node in a sequence hash tree stores one or several indices of strings in the input set. An example of a sequence hash tree is shown in Fig. 1 (a). The position heap proposed by Ehrenfeucht et al. [8] is a sequence hash tree for the ordered set of all suffixes of a string. Two types of position heap are known. The first one is proposed by Ehrenfeucht et al. [8], that constructed by the ordered set of suffixes in ascending order of length and the second one is proposed by Kucherov [13], which constructed in descending order. We adopt the Kucherov [13] type and his online 3 1.abb2.ab3.bba4.baa5.aaba6.baabaababaa1346251234567891011121314abbaabaabaabab1847105, 132, 141136129aaaaaabbbbbb1234567891011121314abbaabaabaabab1847105, 132, 141136129aaaaaabbbbbb (a) (b) Figure 2: Let Σ = {a}, Π = {x, y} and t = xaxyxyxyyaxyx. (a) A parameterized position heap PPH (t). Broken arrows denote suffix pointers. (b) An augmented parameterized position heap APPH (t). Parameterized maximal-reach pointers for pmrp(i) (cid:54)= i are illustrated by doublet arrows. construction algorithm for constructing position heaps for parameterized strings in Section 4. Here we recall the definition of the position heap by Kucherov. Definition 4 (Position Heap [13]). Given a string t ∈ Σn, let St = (t[1 :], t[2 :], . . . , t[n :]) be the ordered set of all suffixes of t except ε in descending order of length. The position heap PH (t) for t is SHT (St). Each node except the root in a position heap stores either one or two integers those are beginning positions of corresponding suffixes. We call them regular node and double node respectively. Assume that i and j are positions stored by a double node v in PH (t) where i < j, i and j are called the primary position and the secondary position respectively. Fig. 1 (b) shows an example of a position heap. In order to find occurrences of the pattern in O(m + occ) time, Ehrenfeucht et al. [8] and Kucherov [13] added additional pointer called maximal-reach pointer to the position heap and called this extended data structure as augmented position heap. An example of an augmented position heap is showed in Fig. 1 (c). 4 Parameterized Position Heap In this section, we propose a new indexing structure called parameterized position heap. It is based on the position heap proposed by Kucherov [13]. 4.1 Definition and Property of Parameterized Position Heap The parameterized position heap is a sequence hash tree [4] for the ordered set of prev-encoded suffixes in the descending order of length. Definition 5 (Parameterized Position Heap). Given a p-string t ∈ (Σ ∪ Π)n, let St = (prev (t[1 :]), prev (t[2 :]), . . . , prev (t[n :])) be the ordered set of all prev-encoded suffixes of the p-string t except ε in descending order of length. The parameterized position heap PPH (t) for t is SHT (St). 4 1234567891011121314xaxyxyxyyaxyxy10a2022221a43222a0022221a432230022221a43224002221a4322500221a432260021a43227001a4322801a032290a032210a00221100221200213001403, 1362100a1, 148794, 125, 110011122aԋ3, 1362100a1, 148794, 125, 110011122aԋ Fig. 2 (a) shows an example of a parameterized position heap. A parameterized position heap PPH (t) for a p-string t of length n consists of the root and nodes that corresponds to prev (t[1 :]), prev (t[2 :]), . . . , prev (t[n :]), so PPH (t) has at most n+1 nodes. Each node in PPH (t) holds either one or two of beginning positions of corresponding p-suffixes similar to the standard position heaps. We can specify each node in PPH (t) by its primary position, its secondary position, or the string obtained by concatenating labels found on the path from the root to the node. Different from standard position heap, prev (t[i :]) = prev (t)[i :] does not necessarily hold for some cases. For example, for t = xaxyxyxyyaxyxy, prev (t[3 :]) = 0022221a4322 while prev (t)[3 :] = 0222221a4322. Therefore, the construction and matching algorithms for the standard position heaps cannot be directly applied for the parameterized position heaps. However, we can similar properties to construct parameterized position heaps efficiently. Lemma 1. For i and j, where 1 ≤ i ≤ j ≤ n, if prev (t[i : j]) is represented in PPH (t), then a prev-encoded string for any substring of t[i : j] is also represented in PPH (t). Proof. First we will show that prev-encoding of any prefix of t[i : j] is represented in PPH (t). From the definition of prev-encoding, prev (t[i : j])[1 : i − j] = prev (t[i : j − 1]). In other words, prev (t[i : j − 1]) is a prefix of prev (t[i : j]). From the definition of PPH (t), prefixes of prev (t[i : j]) are represented in PPH (t). Therefore, prev (t[i : j − 1]) is represented in PPH (t). Similarly, prev (t[i : j − 2]), ··· , prev (t[i : i]) are represented in PPH (t). Next, we will show that prev-encoding of any suffix of t[i : j] is represented in PPH (t). From the above discussion, there are positions b0 < b1 < ··· < bj−i = i in t such that prev (t[bk : bk + k]) = prev (t[i : i + k]). From the definition of parameterized position heap, prev (t[b1 + 1 : b1 + 1]) is represented in PPH (t). Since prev (t[bk + 1 : bk + k]) is a prefix of prev (t[bk+1 + 1 : bk+1 + k + 1]) for 0 < k < j − i, if prev (t[bk + 1 : bk + k]) is represented in PPH (t) then prev (t[bk+1 + 1 : bk+1 + k + 1]) is also represented in PPH (t) recursively. Therefore, prev (t[bj−i + 1 : bj−i + j − i]) = prev (t[i + 1 : j]) is represented in PPH (t). Similarly, prev (t[i + 2 : j]), ··· , prev (t[j : j]) are represented in PPH (t). Since any prefix and suffix of prev (t[i : j]) is represented in PPH (t), we can say that any substring of prev (t[i : j]) is represented in PPH (t) by induction. 4.2 Online Construction Algorithm of Parameterized Position Heap In this section, we propose an online algorithm that constructs parameterized position heaps. Our algorithm is based on Kucherov's algorithm, although it cannot be applied easily. The algorithm updates PH (t[1 : k]) to PH (t[1 : k + 1]) when t[k + 1] is read, where 1 ≤ k ≤ n−1. Updating of the position heap begins from a special node, called the active node. A position specified by the active node is called the active position. At first, we show that there exists a position similar to the active position in the parameterized position heap. Lemma 2. If j is a secondary position of a double node in a parameterized position heap, then j + 1 is also a secondary position. 5 Proof. Let i be the primary position and j be the secondary position of node v, where i < j. This means there is a position h such that prev (t[i : h]) = prev (t[j :]). By Lemma 1, there is a node that represents prev (t[i + 1 : h]). Since prev (t[j + 1 :]) = prev (t[i + 1 : h]), then j + 1 will be the secondary positions of node prev (t[i + 1 : h]). Lemma 2 means that there exists a position s which splits all positions in t[1 : n] into two intervals, similar to the active position in [13]. Positions in [1 : s − 1] and [s : n] are called primary and secondary positions, respectively. We also call the position s as active position. Assume we have constructed PPH (t[1 : k]) and we want to construct PPH (t[1 : k + 1]) from PPH (t[1 : k]). The primary positions 1, . . . , s − 1 in PPH (t[1 : k]) become primary positions also in PPH (t[1 : k + 1]), because prev (t[i : k]) = prev (t[i : k + 1])[1 : k− 1 + 1] holds for 1 ≤ i ≤ s − 1. Therefore, we do not need to update the primary positions. On the other hand, the secondary positions s, . . . , k require some modifications. When inserting a new symbol, two cases can occur. The first case is that prev (t[i : k + 1]) is not represented in PPH (t[1 : k]). In this case, a new node prev (t[i : k + 1]) is created as a child node of prev (t[i : k]) and position i becomes the primary position of the new node. The second case is that prev (t[i : k + 1]) was already represented in PPH (t[1 : k]). In this case, the secondary position i that is stored in prev (t[i : k]) currently should be moved to the child node prev (t[i : k + 1]), and position i becomes the secondary position of this node. From Lemma 1, if the node prev (t[i : k]) has an edge to the node prev (t[i : k + 1]), prev (t[i + 1 : k]) also has an edge to prev (t[i + 1 : k + 1]). Therefore, there exists r, with 1 ≤ s ≤ r ≤ k, that splits the interval [s : k] into two subintervals [s : r − 1] and [r : k], such that the node prev (t[i : k]) does not have an edge to prev (t[i : k + 1]) for s ≤ i ≤ r − 1, and does have such an edge for r ≤ i ≤ k. The above analysis leads to the following lemma that specifies the modifications from PPH (t[1 : k]) to PPH (t[1 : k + 1]). Lemma 3. Given t ∈ (Σ ∪ Π)n, consider PPH (t[1 : k]) for k < n. Let s be the active position, stored in the node prev (t[s : k]). Let r ≥ s be the smallest position such that node prev (t[r : k]) has an outgoing edge labeled with prev (t[r : k + 1])[k − r + 2]. PPH (t[1 : k + 1]) can be obtained by modifying PPH (t[1 : k]) in the following way: 1. For each node prev (t[i : k]), s ≤ i < r, create a new child prev (t[i : k + 1]) linked by an edge labeled prev (t[i : k + 1])[k − i + 2]. Delete the secondary position i from the node prev (t[i : k]) and assign it as the primary position of the new node prev (t[i : k + 1]), 2. For each node prev (t[i : k]), r ≤ i ≤ k, move the secondary position i from the node prev (t[i : k]) to the node prev (t[i : k + 1]). Moreover, r will be the active position in PPH (t[1 : k + 1]). Proof. Consider the first case that i be a secondary position in PPH (t[1 : k]) and s ≤ i < r. From the definition of r, there is no node prev (t[i : k + 1]) in PPH (t[i : k]). Therefore, i will be a primary position of the node prev (t[i : k + 1]) in PPH (t[1 : k + 1]). We can update the position heap from PPH (t[1 : k]) to PPH (t[1 : k + 1]) by delete i 6 (a) (b) An example of updating a parameterized position heap, from (a) Figure 3: PPH (xaxyyxyx) to (b) PPH (xaxyyxyxx). The updated positions are colored red. The secondary positions 6 and 7 in PPH (xaxyyxyx) are become primary positions in PPH (xaxyyxyxx), while the secondary position 8 in PPH (xaxyyxyx) is become a secondary position of another node in PPH (xaxyyxyxx). The active position is updated from 6 to 8. from secondary position of the node prev (t[i : k]) and create a new node prev (t[i : k + 1]) and assign i to its primary position for the case s ≤ i < r. Next case, i be a secondary position in PPH (t[1 : k]) and r ≤ i ≤ k. In this case, there is a node prev (t[i : k + 1]) in PPH (t[i : k]) and the node prev (t[i : k + 1]) is also represented in PPH (t[i : k + 1]). Therefore, i will be a secondary position of the node prev (t[i : k + 1]) in PPH (t[1 : k + 1]). We can update the position heap from PPH (t[1 : k]) to PPH (t[1 : k + 1]) by delete i from secondary position of the node prev (t[i : k]) and assign i as secondary position of the node prev (t[i : k + 1]) for the case r ≤ i ≤ k. Since position i for 1 ≤ i < r be a primary position in PPH (t[1 : k + 1]) and position i for r ≤ i ≤ k + 1 be a secondary position in PPH (t[1 : k + 1]), r will be the active position in PPH (t[1 : k + 1]). Fig. 3 show an example of updating a parameterized position heap. The modifications specified by Lemma 3 need to be applied to all secondary positions. In order to perform these modifications efficiently, we use parameterized suffix pointers. Definition 6 (Parameterized Suffix Pointer). For each node prev (t[i : j]) of PPH (t), the parameterized suffix pointer of prev (t[i : j]) is defined by psp(prev (t[i : j])) = prev (t[i + 1 : j]). By Lemma 1, whenever the node prev (t[i : j]) exists, the node prev (t[i + 1 : j]) exists too. This means that psp(prev (t[i : j])) always exists. During the construction of the parameterized position heap, let ⊥ be the auxiliary node that works as the parent of root and is connected to root with an edge labeled with any symbol c ∈ Σ∪ 0. We define psp(root) = ⊥. 7 3,720a1,845,6012ԋ3620a1,94,8750112ԋ1 Algorithm 1: Parameterized position heap online construction algorithm Input: A p-string t ∈ (Σ ∪ Π)n Output: A parameterized position heap PPH (t) 1 create root and ⊥ nodes; 2 psp(root) = ⊥; 3 child (⊥, c) = root for c ∈ Σ ∪ {0}; 4 currentNode = root; 5 s = 1; 6 for i = 1 to n do 7 c = normalize(prev (t)[i], depth(currentNode)); lastCreateNode = undefined; while child (currentNode, c) = null do 8 9 10 11 12 13 14 15 16 17 18 19 create newnode; prim(newnode) = s; child (currentNode, c) = newnode; if lastCreateNode (cid:54)= undefined then psp(lastCreateNode) = newnode; lastCreateNode = newnode; currentNode = psp(currentNode); c = normalize(prev (t)[i], depth(currentNode)); s = s + 1; currentNode = child (currentNode, c); if lastCreateNode (cid:54)= undefined then psp(lastCreateNode) = currentNode; 20 while s ≤ n do 21 22 23 sec(currentNode) = s; currentNode = psp(currentNode); s = s + 1; When s is the active position in PPH (t[1 : k]), we call prev (t[s : k]) the active node. If no node holds a secondary position, root becomes the active node and the active position is set to k + 1. The nodes for the secondary positions s, s + 1, . . . , k can be visited by traversing with the suffix pointers from the active node. Thus, the algorithm only has to memorize the active position and the active node in order to visit any other secondary positions. Updating PPH (t[1 : k]) to PPH (t[1 : k + 1]) specified by Lemma 3 is processed as the following procedures. The algorithm traverses with the suffix pointers from the active node till the node that has the outgoing edge labeled with prev (t[i : k + 1])[k − i + 2] is found, which is i = r. For each traversed node, a new node is created and linked by an edge labeled with prev (t[i : k + 1])[k − i + 2] to each node. A suffix pointer to this new node is set from the previously created node. When the node that has the outgoing edge labeled with prev (t[i : k + 1])[k − i + 2] is traversed, the algorithm moves to the node that is led to by this edge, and a suffix pointer to this node is set from the last created node, then the algorithm assigns this node to be the active node. A pseudocode of our proposed construction algorithm is given as Algorithm 1. prim(v) and sec(v) denotes primary and secondary positions of v, respectively. From 8 the property of prev-encoding, prev (t[i + 1 : k + 1])[k − i + 1] = prev (t[i : k + 1])[k − i + 2] if prev (t[i : k + 1])[k − i + 2] ∈ Σ or prev (t[i : k + 1])[k − i + 2] ≤ k − i and prev (t[i + 1 : k])[k − i + 1] = 0 otherwise. Therefore, we use a function normalize(c, j) that returns c if c ∈ Σ or c ≤ j and returns 0 otherwise. The construction algorithm consists of n iterations. In the i-th iteration, the algorithm read t[i] and make PPH (t[1 : i]). In the i-th iteration, the traversal of the suffix pointers as explained above is done. Since the depth of the current node decreases by traversing a suffix pointer, the number of the nodes that can be visited by traversal is O(n). For each traversed node, all the operations such as creating a node, an edge and updating position can be done in O(log (Σ + Π)). Therefore, the total time for the traversals is O(n log (Σ + Π)). From the above discussion, the following theorem is obtained. Theorem 1. Given t ∈ (Σ∪ Π)n, Algorithm 1 constructs PPH (t) in O(n log (Σ + Π)) time and space. 4.3 Augmented Parameterized Position Heaps We will describe augmented parameterized position heaps, the parameterized position heaps with an additional data structure called the parameterized maximal-reach point- ers similar to the maximal-reach pointers for the position heap [8]. The augmented parameterized position heap gives an efficient algorithm for parameterized pattern matching. Definition 7 (Parameterized Maximal-Reach Pointer). For a position i on t, a param- eterized maximal-reach pointer of pmrp(i) is a pointer from node i to the deepest node whose path label is a prefix of prev (t[i :]). Obviously, if i is a secondary position, then pmrp(i) is node i itself. We assume that the parameterized maximal-reach pointer for a double node applies to the primary position of this node. Fig. 2 (b) shows an example of an augmented parameterized position heap. Given a prev-encoded p-string prev (w) represented in an augmented parameterized position heap APPH (t) and a position 1 ≤ i ≤ n, we can determine whether prev (w) is a prefix of prev (t[i :]) or not in O(1) time by checking whether pmrp(i) is a descendant of prev (w) or not. It can be done in O(1) time by appropriately preprocessing APPH (t) [5]. Parameterized maximal-reach pointers can be computed by using parameterized suffix pointers, similar to [13]. Algorithm 2 shows an algorithm to compute parameterized maximal-reach pointers. pmrp(i) is computed iteratively for i = 1, 2,··· , n. Assume that we have computed pmrp(i) for some i. Let pmrp(i) = prev (t[i : l]). Obviously, prev (t[i + 1 : l]) is a prefix of the string represented by pmrp(i + 1). Thus, in order to compute pmrp(i + 1), we should extend the prefix prev (t[i + 1 : l]) = psp(prev (t[i : l])) in PPH (t) until we found l(cid:48) such that node prev (t[i + 1 : l(cid:48)]) does not have outgoing edge labeled with prev (t[i + 1 :])[l(cid:48) − i + 1] and set pmrp(i + 1) = prev (t[i + 1 : l(cid:48)]). In this time, we need re-compute prev (t[i + 1 :]) by replacing prev (t[i + 1 :])[j] with 0 if we found that prev (t[i + 1 :])[j] ≥ j. The total number of extending prev (t[i + 1 : l]) in the algorithm is at most n because both i and l always increase in each iteration. In each 9 Algorithm 2: Augmented parameterized position heap construction algorithm Input: A p-string t ∈ (Σ ∪ Π)n and PPH (t) Output: An augmented parameterized position heap APPH (t) 1 let t[n + 1] = $ where $ is a symbol that does not appear in t elsewhere; 2 currentNode = root; 3 l = 1; 4 for i = 1 to n do 5 c = normalize(prev (t)[l], l − i); while child (currentNode, c) (cid:54)= null do 6 7 8 9 10 11 currentNode = child (currentNode, c); l = l + 1; c = normalize(prev (t)[l], l − i); pmrp(i) = currentNode; currentNode = psp(currentNode); iteration, operations such as traversing a child node can be done in O(log (Σ + Π)). Therefore, we can get the following theorem. Theorem 2. Parameterized maximal-reach pointers for PPH (t) can be computed in O(n log (Σ + Π)) time. 4.4 Parameterized Pattern Matching with Augmented Parameterized Position Heaps Ehrenfeucht et al. [8] and Kucherov [13] split a pattern p into segments q1, q2,··· , qk, then compute occurrences of q1q2 ··· qj iteratively for j = 1,··· , k. The correctness depends on a simple fact that for strings x = t[i : i + x − 1] and y = t[i + x : i + x + y − 1] implies xy = t[i : i + xy − 1]. However, when x, y, and t are p-strings, prev (x) = prev (t[i : i + x − 1]) and prev (y) = prev (t[i + x : i + x + y − 1]) does not necessarily implies prev (xy) = prev (t[i : i + xy − 1]). Therefore, we need to modify the matching algorithm for parameterized strings. Let x, y and w be p-strings such that w = xy, prev (x) = prev (w[: x]) and prev (y) = prev (w[x + 1 :]). Let us consider the case that prev (xy) (cid:54)= prev (w). From prev (x) = prev (w[: x]) and prev (y) = prev (w[x + 1 :]), x and y have the same struc- ture of w[: x] and w[x + 1 :], respectively. However, the parameter symbols those are prev-encoded into 0 in prev (y) and prev (w[x + 1 :]), might be encoded differ- ently in prev (xy) and prev (w), respectively. Therefore, we need to check whether prev (xy)[x + i] = prev (w)[x + i] if prev (y)[i] = 0. Given prev (xy) and the set of positions of 0 in prev (y), Z = {i 1 ≤ i ≤ y such that prev (y)[i] = 0}. We need to verify whether prev (xy)[x + i] = prev (w)[x + i] or not for i ∈ Z. Since the size of Z is at most Π, this computation can be done in O(Π) time. A pseudocode of proposed matching algorithm for the parameterized pattern matching problem is shown in Algorithm 3. Des APPH (t)(u) denotes the set of all descendants of node u in APPH (t) including node u itself. The occurrences of p in t have the following properties on APPH (t). 10 Algorithm 3: Parameterized pattern matching algorithm with APPH Input: t ∈ (Σ ∪ Π)n , p ∈ (Σ ∪ Π)m, and APPH (t) Output: The list ans of position i such that prev (p) = prev (t[i : i + m − 1]) 1 let w be the longest prefix of prev (p) represented in APPH (t) and u be the node 2 if w = m then represents w; 3 4 5 6 v = root; for i = 1 to m do v = child (v, prev (p)[i]); if pmrp(v) ∈ Des APPH (t)(u) then add prim(v) to ans; add all primary and sedondary position of decendants of u to ans; 7 8 else 9 v = root; i = 1, j = 1; while i ≤ w do v = child (v, prev (p)[i]); i = i + 1; if pmrp(v) = u then add prim(v) to ans; while i (cid:54)= m do j = i, v = root; Z = empty list; while i (cid:54)= m do c = normalize(prev (p)[i], i − j); if child (v, c) = null then break; if c = 0 then add i to Z; v = child (v, c); i = i + 1; if v = root then return empty list; foreach i(cid:48) ∈ ans do 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 if i = m then if pmrp(i(cid:48) + j − 1) /∈ Des APPH (t)(v) then remove i(cid:48) from ans; if pmrp(i(cid:48) + j − 1) (cid:54)= v then remove i(cid:48) from ans; if normalize(prev (t)[i(cid:48) + Z[k] − 1], Z[k] − 1) (cid:54)= prev (p)[Z[k]] then else for k = 1 to Z do remove i(cid:48) from ans; 32 33 return ans; Lemma 4. If prev (p) is represented in APPH (t) as a node u then p occurs at position i iff pmrp(i) is u or its descendant. Proof. Let u be a node represents prev (p). Assume p occurs at position i in t and represented in APPH (t) as prev (t[i : k]). Since either prev (t[i : k]) is a prefix of prev (p) or prev (p) is a prefix of prev (t[i : k]), then i is either an ancestor or descendant of u. 11 (a) (b) Figure 4: Examples of finding occurrence positions of a pattern using an augmented parameterized position heap PPH (xaxyxyxyyaxyxy). (a) Finding xyxy (prev (xyxy) = 0022). (b) Finding axyx (prev (axyx) = a002). For both cases pmrp(i) is a descendant of u, because p occurs at position i. Next let i be a node such that pmrp(i) is a descendant of u and represents prev (t[i : k]). In this case, prev (p) is a prefix of prev (t[i : k]). Therefore p occurs at i. Lemma 5. Assume prev (p) is not represented in APPH (t). We can split p into q1, q2,··· , qk such that qj is the longest prefix of prev (p[q1 ··· qj−1 + 1 :]) that is repre- sented in APPH (t). If p occurs at position i in t, then pmrp(i +q1 ··· qj−1) is the node prev (qj) for 1 ≤ j < k and pmrp(i + q1 ··· qk−1) is the node prev (qk) or its descendant. Proof. Let p = q1q2 ··· qk occurs at position i in t. Since prev (q1) is a prefix of prev (p), then pmrp(i) is the node that represents prev (q1) or its descendant. However, if pmrp(i) is a descendant of node prev (q1), then we can extend q1 which contradicts with the definition of q1. Therefore, pmrp(i) is the node represents prev (q1). Similarly for 1 < j < k, prev (qj) is a prefix of prev (p[q1 ··· qj−1 + 1 :]) and occurs at position i + q1 ··· qj−1 in t. Therefore, pmrp(i + q1 ··· qj−1) is the node represents prev (qj). Last, since qk is a suffix of p, then pmrp(i + q1 ··· qj−1) can be the node prev (qk) or its descendant. Algorithm 3 utilizes Lemmas 4 and 5 to find occurrences of p in t by using APPH (t). First, if prev (p) is represented in APPH (t) then the algorithm will output all position i such that pmrp(i) is a node prev (p) or its descendant. Otherwise, it will split p into q1q2 ··· qk and find their occurrences as described in Lemma 5. The algorithm also checks whether prev (q1 ··· qj) occurs in t or not in each iteration as described the above. Examples of parameterized pattern matching by using an augmented position heap In Fig. 4 (a) we want are given in Fig. 4. Let t = xaxyxyxyyaxyxy be the text. to find the occurrence positions of a pattern p1 = xyxy in t. In this case, since prev (p1) = 0022 is represented in PPH (t), The algorithm outputs all positions i such that pmrp(i) is the node 0022 or its descendants, those are 3, 4, 5, and 11. On the other hand, Fig. 4 (b) shows how to find the occurrence positions of a pattern p2 = axyx in t. In this case, prev (p2) = a002 is not represented in PPH (t). Therefore, The algorithm finds the longest prefix of prev (p2) that is represented in PPH (i), which is prev (p2)[1 : 2] = a0. We can see that prmp(2) = pmrp(10) = a0, then we save 12 3, 1362100a1, 148794, 125, 110011122aԋ3, 1362100a1, 148794, 125, 110011122aԋ3, 1362100a1, 148794, 125, 110011122aԋ positions 2 and 10 as candidates to ans. Next, The algorithm finds the node that represents the longest prefix of prev (p2[3 :]) = 00 which is prev (p2[3 :]) = 00 itself. Since both of pmrp(2 + p2[1 : 2]) = pmrp(4) and pmrp(10 + p2[1 : 2]) = pmrp(12) is descendants of the node 00, prev (t[2 : 5][3]) = prev (t[10 : 13][3]) = prev (p2)[[3]] = 0, and prev (t[2 : 5][4]) = prev (t[10 : 13][4]) = prev (p2)[4] = 2, then the algorithm outputs 2 and 10. The time complexity of the matching algorithm is as follow. Theorem 3. Algorithm 3 runs in O(m log (Σ + Π) + mΠ + occ) time. Proof. It is easily seen that we can compute line 4 to 7 in O(m log (Σ + Π) + occ) time. Assume that p can be decomposed into q1, q2, ··· , qk such that q1 is the longest prefix of p and qi is the longest prefix of prev (p[q1 ··· qj−1 + 1 :]) represented in APPH (t). The loop for line 15 consists of k − 1 iterations. In the loop line 18 in j-th iteration, qj+1 is extended up to reach qj+1 length. This can be computed in O(qj+1 log (Σ + Π)) time. After k − 1 iterations, the total number of extending of qj+1 does not exceed m, j=2qj < m. In the loop for line 25, the algorithm verifies elements of ans. because Σk In j-th iteration, the size of ans is at most qj. Thus, after k − 1 iterations, the total number of elements verified in line 25 does not exceed m by the same reason for that of line 18. In each verification in line 25, the number of checks for line 27 and 29 is at most qj. Therefore, it can be computed from line 25 to 32 in O(mΠ) time. 5 Conclusion and Future Work For the parameterized pattern matching problem, we proposed an indexing structure called a parameterized position heap. Given a p-string t of length n over a constant size alphabet, the parameterized position heap for t can be constructed in O(n log (Σ + Π)) time by our construction algorithm. We also proposed an algorithm for the parameterized pattern matching problem. It can be computed in O(m log (Σ + Π) + mΠ + occ) time using parameterized position heaps with parameterized maximal-reach pointers. Gagie et al. [10] showed an interesting relationship between position heap and suffix array of a string. We will examine this relation for parameterized position heap and parameterized suffix array [7, 12] as a future work. References [1] B. S. Baker. A program for identifying duplicated code. Computing Science and Statistics, 24:49 -- 57, 1992. [2] B. S. Baker. A theory of parameterized pattern matching: algorithms and applica- tions. In Proc. 25th annual ACM symposium on Theory of computing, pages 71 -- 80, 1993. [3] B. S. Baker. Parameterized pattern matching: Algorithms and applications. Journal of Computer and System Sciences, 52(1):28 -- 42, 1996. 13 [4] E. G. Coffman and J. Eve. File structures using hashing functions. Commun. ACM, 13(7):427 -- 432, 1970. [5] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms. MIT press, 1990. [6] M. Crochemore and W. Rytter. Jewels of Stringology: Text Algorithms. World Scientific, 2003. [7] S. Deguchi, F. Higashijima, H. Bannai, S. Inenaga, and M. Takeda. Parameterized suffix arrays for binary strings. In Proceedings of the Prague Stringology Conference 2008, pages 84 -- 94, Czech Technical University in Prague, Czech Republic, 2008. [8] A. Ehrenfeucht, R. M. McConnell, N. Osheim, and S.-W. Woo. Position heaps: A simple and dynamic text indexing data structure. Journal of Discrete Algorithms, 9(1):100 -- 121, 2011. [9] K. Fredriksson and M. Mozgovoy. Efficient parameterized string matching. Infor- mation Processing Letters, 100(3):91 -- 96, 2006. [10] T. Gagie, W.-K. Hon, and T.-H. Ku. New Algorithms for Position Heaps, pages 95 -- 106. Springer Berlin Heidelberg, Berlin, Heidelberg, 2013. [11] D. Gusfield. Algorithms on Strings, Trees and Sequences: Computer Science and Computational Biology. Cambridge University Press, 1997. [12] T. I, S. Deguchi, H. Bannai, S. Inenaga, and M. Takeda. Lightweight Parameterized Suffix Array Construction, pages 312 -- 323. Springer Berlin Heidelberg, Berlin, Heidelberg, 2009. [13] G. Kucherov. On-line construction of position heaps. Journal of Discrete Algorithms, 20:3 -- 11, 2013. StringMasters 2011 Special Issue. [14] Y. Nakashima, T. I, S. Inenaga, H. Bannai, and M. Takeda. The Position Heap of a Trie, pages 360 -- 371. Springer Berlin Heidelberg, Berlin, Heidelberg, 2012. [15] T. Shibuya. Generalization of a suffix tree for rna structural pattern matching. Algorithmica, 39(1):1 -- 19, 2004. [16] E. Ukkonen. On-line construction of suffix trees. Algorithmica, 14(3):249 -- 260, 1995. 14
1307.2724
1
1307
2013-07-10T09:13:35
The technique of in-place associative sorting
[ "cs.DS" ]
In the first place, a novel, yet straightforward in-place integer value-sorting algorithm is presented. It sorts in linear time using constant amount of additional memory for storing counters and indices beside the input array. The technique is inspired from the principal idea behind one of the ordinal theories of "serial order in behavior" and explained by the analogy with the three main stages in the formation and retrieval of memory in cognitive neuroscience: (i) practicing, (ii) storage and (iii) retrieval. It is further improved in terms of time complexity as well as specialized for distinct integers, though still improper for rank-sorting. Afterwards, another novel, yet straightforward technique is introduced which makes this efficient value-sorting technique proper for rank-sorting. Hence, given an array of n elements each have an integer key, the technique sorts the elements according to their integer keys in linear time using only constant amount of additional memory. The devised technique is very practical and efficient outperforming bucket sort, distribution counting sort and address calculation sort family of algorithms making it attractive in almost every case even when space is not a critical resource.
cs.DS
cs
The technique of in-place associative sorting A. Emre CETIN July 3, 2018 Abstract In the first place, a novel, yet straightforward in-place integer value-sorting al- gorithm is presented. It sorts in linear time using constant amount of additional memory for storing counters and indices beside the input array. The technique is inspired from the principal idea behind one of the ordinal theories of "serial order in behavior" and explained by the analogy with the three main stages in the forma- tion and retrieval of memory in cognitive neuroscience: (i) practicing, (ii) storage and (iii) retrieval. It is further improved in terms of time complexity as well as specialized for distinct integers, though still improper for rank-sorting. Afterwards, another novel, yet straightforward technique is introduced which makes this efficient value-sorting technique proper for rank-sorting. Hence, given an array of n elements each have an integer key, the technique sorts the elements ac- cording to their integer keys in linear time using only constant amount of additional memory. The devised technique is very practical and efficient outperforming bucket sort, distribution counting sort and address calculation sort family of algorithms making it attractive in almost every case even when space is not a critical resource. keywords: associative sort, in-situ permutation sort, stimulation sort, linear time sorting. 1 1 Introduction The adjective "associative" derived from two facts where the first one will be realized with the description of the technique. The second one is that, although it replaces all derivatives of the content based sorting algorithms such as distribution counting sort [15,16], address calculation sort [17 -- 22] and bucket sort [23, 24] on a RAM, it seems to be more efficient on a"content addressable memory" (CAM) known as "associative memory" which in one word time find a matching segment in tag portion of the word and reaches the remainder of the word [29]. In the current version of associative sort developed on a RAM, the nodes of the imaginary subspace (tagged words) and the integers of the array space (untagged words) are processed sequentially which will be a matter of one word time for a CAM to retrieve previous or next tagged or untagged word. An integer value-sorting algorithm puts an array of integers into ascending or descend- ing order by their values, whereas a rank-sorting algorithm puts an array of elements (satellite information) into ascending or descending order by their numeric keys, each of which is an integer. It is possible that a rank-sorting algorithm can be used in place of a value-sorting algorithm, since if each element of the array to be sorted is itself an integer and used as the key, then rank-sorting degenerates to value-sorting, but the converse is not always true. The technique described in this study is suitable for arrays where the elements are laid out in contiguous locations of the memory. Zero-based indexing is considered while accessing the elements, e.g., A[0] and A[n − 1] are the first and last elements of the array, respectively, where n is the number of elements of the array. Nervous system is considered to be closely related and described with the "serial order in behavior" in cognitive neuroscience [6, 7] with three basic theories which cover almost 2 all abstract data types used in computer science. These are chaining theory, positional theory and ordinal theory [8]. Chaining theory is the extension of reflex-chaining or response-chaining theory, where each response becomes the stimulus for the next. From an information processing per- spective, comparison based sorting algorithms that sort the arrays by making a series of decisions relying on comparing keys can be classified under chaining theory. Each com- parison becomes the stimulus for the next. Hence, keys themselves are associated with each other. Some important examples are quick sort [9], shell sort [10], merge sort [11] and heap sort [12]. Positional theory assumes order is stored by associating each element with its position in the sequence. The order is retrieved by using each position to cue its associated element. Conventional (Von Neumann) computers store and retrieve order using this method, through routines accessing separate addresses in memory. Content-based sorting algorithms where decisions rely on the contents of the keys can be classified under this theory. Each key is associated with a position depending on its content. Some important examples are distribution counting sort [15, 16], address calculation sort [17 -- 22], bucket sort [23, 24] and radix sort [23 -- 26]. Ordinal theory assumes order is stored along a single dimension, where that order is defined by relative rather than absolute values on that dimension. Order can be retrieved by moving along the dimension in one or the other direction. This theory need not assume either the item-item nor position-item associations of chaining and positional theories respectively [8]. One of the ordinal theories of serial order in behavior is that of Shiffrin and Cook [27] which suggests a model for short-term forgetting of item and order information of 3 the brain. It assumes associations between elements and a "node", but only the nodes are associated with one another. By moving inwards from nodes representing the start and end of the sequence, the associations between nodes allow the order of items to be reconstructed [8]. The first technique presented in this study is in-place associative integer sorting [1 -- 4]. Inspired from the ordinal model of Shiffrin and Cook, the technique assumes the associations are between the integers in the array space and the nodes in an imaginary linear subspace (ILS) that spans a predefined range of integers. The range of the integers spanned by the ILS is upper bounded by the number of integers n but may be smaller and can be located anywhere provided that its boundaries do not cross over that of the array. This makes the technique in-place, i.e., beside the input array, only a constant amount of memory locations are used for storing counters and indices. An association between an integer of the array space and the ILS is created by a node using a monotone bijective hash function that maps the integers in the predefined interval to the ILS. When a particular distinct integer is mapped to the ILS, a node is created reserving all the bits of the integer except for the most significant bit (MSB) which is used to tag the word as a node of the ILS for interrogation purposes. The reserved bits become the record of the node which then be used to count (practice) other occurrences of the particular integer that created the node. When all the key of the predefined interval are practiced, the nodes can be stored at the beginning of the array (short-term memory) retaining their relative order together with the information (cue) required to construct the sorted permutation of the practiced interval. Afterwards, the short-term memory is processed and the sorted permutation of the practiced interval is retrieved over the array space in linear time using only constant amount of additional memory. 4 Another ordinal theory is the original perturbation model of Estes [28]. Although proposed to provide a reasonable qualitative fit of the forgetting dynamics of the short term memory [8] in cognitive neuroscience, the principle idea behind the method is that the order of the elements is inherent in the cyclic reactivation of the elements, i.e., reactivations lead to reordering of the elements. In-place associative integer sorting technique is an efficient in-place integer value- sorting algorithm, though not suitable for rank-sorting. Therefore, in-place associative permutation sort [5] technique is developed combining the principle idea behind the origi- nal perturbation model with the technique of associative integer sorting making it suitable for rank-sorting. 2 Definitions The definition of rank-sorting is: given an array S of n elements, S[0], S[1], . . . , S[n − 1] each have an integer key, the problem is to sort the elements of the array according to their integer keys. To prevent repeating statements like "key of the element S[i]", S[i] is used to refer the key. The definition of value-sorting is: given an array S of n integers, S[0], S[1], . . . , S[n−1], the problem is to sort the integers according to their values. In other words, the elements of the array are integers and used as the keys. To prevent confusion, the term "integer" is used while describing value-sorting tech- niques, whereas "key" is used for rank-sorting. The notations used throughout the study are: (i) Universe of keys is assumed U = [0 . . . 2w − 1] where w is the fixed word length. (ii) Maximum and minimum keys of an array are, max(S) = max(aa ∈ S) and 5 min(S) = min(aa ∈ S), respectively. Hence, range of the keys is, m = max(S) − min(S) + 1. (iii) The notation B ⊂ A is used to indicated that B is a proper subset of A. (iv) For two arrays S1 and S2, max(S1) < min(S2) implies S1 < S2. 3 In-place Associative Integer Sorting The most critical phase of associative integer sorting is derived from the cycle leader permutation (in-situ permutation) approach. Hence, a separate section is devised for it. 3.1 Cycle Leader Permutation Given n distinct integer keys S[0 . . . n−1] each in the range [δ, δ+m−1] where δ = min(S), if m = n and S is the sorted permutation, then there is a bijective relation i = S[i] − δ between each key and its position. From contradiction, i 6= S[i] − δ implies that the key S[i] is not at its exact position. Its exact position can be calculated by j = S[i] − δ. Therefore, the simple monotone bijective hash function j = S[i] − δ that maps the keys to j ∈ [0, n − 1] can sort the array in O(n) time using O(1) constant space. This is cycle leader permutation where S is re-arranged by following the cycles of a permutation π. First S[0] is sent to its final position π(0) (calculated by j = S[i] − δ). Then the element that was in π(0) is sent to its final position π(π(0)). The process proceeds in this way until the cycle is closed, that is until the key addressing the first position is found which means that the association 0 = S[0] − δ is constructed between the key and its position. Then the iterator is increased to continue with the key of S[1]. At the end, when all the cycles of S[i] for i = 0, 1.., n − 1 are processed, all the keys are in their exact position and the association i = S[i] − δ is constructed between the keys and their position resulting 6 in the sorted permutation of the array. 3.2 In-place Associative Distinct Key Sorting If we look at the cycle leader permutation closer, we can interpret the technique en- tirely different. We are indeed creating an imaginary linear subspace Im[0 . . . n − 1] over S[0 . . . n − 1] where the relative basis of this imaginary linear subspace (ILS) coincides with that of the array space in the physical memory. The ILS spans a predefined interval of the range of keys and this interval is upper bounded by the number of keys n. Since the range of the keys m is equal to n, it spans the entire range of the keys. The association between the array space and the ILS is created by a node using the monotone bijective hash function j = S[i] − δ that maps a particular key to the ILS. Since ILS is defined over the array space, mapping a distinct key to the ILS is just an exchange operation from where a node is created. When a node is created for a particular key, the redun- dancy due to the association between the key and the position of the node releases the word allocated for the key in the physical memory. Hence, we can clear the node and set its tag bit, for instance its most significant bit (MSB) to discriminate it as a node for interrogation purposes, and use the remaining w − 1 bits of the node for any other purpose. When we want the key back to array space from the ILS, we can use the inverse of hash function and get the key back by S[i] = i + δ to the array space through the node. However, we don't use free bits of a node for other purposes during cycle leader permutation because it is known that all the keys are distinct and only one key can be mapped to a location creating a node. Therefore, instead of tagging the word as node using its MSB, we use the key itself to tag the word "implicitly" as node, since when a key is mapped to the imaginary subspace, it will always satisfy the monotone bijective 7 hash function i = S[i] − δ. Hence, the keys are "implicitly practiced" in this case. This interpretation immediately motivates a rank-sorting algorithm for distinct keys. Consider the problem of sorting n distinct keys S[0 . . . n−1] each in the range [δ, δ+m−1]. If m > n, it is not possible to construct a monotone bijective hash function that maps all the keys of the array into j ∈ [0, n−1] without collisions and additional storage space [33]. However, a bijective hash function can be constructed as a partial function that assigns all the keys in the range [δ, δ + n − 1] to exactly one element in j ∈ [0, n − 1]. Hence, a cycle leader permutation only for the keys in the range [δ, δ + n − 1] with the hash function j = S[i] − δ can sort these keys in the ILS Im[0 . . . n − 1] over S[0 . . . n − 1]. The hashed keys are said "implicitly practiced" and always satisfy the monotone bijective hash function i = S[i] − δ. After implicitly practicing the keys in the predefined interval, the next step is to separate the array into practiced and unpracticed keys. This is simply a partitioning problem where we store implicitly practiced keys at the beginning of the array. However, instead of using a pivot for partitioning, we partition the keys that satisfy the hash function i = S[i] − δ. Hence, we obtain a simple two step sorting algorithm for distinct keys: (i). find min(S) and max(S) and initialize δ = min(S), δ′ = max(S), nd = 0; n′ d = 0; (ii). implicitly practice all the distinct keys of the interval [δ, δ+n−1]. We can count the number of implicitly practiced keys in nd and find the minimum of the unpracticed keys in δ′ ; (iii). store all the implicitly practiced keys (that satisfy i = S[i] − δ) at the beginning of the array; 8 (iv). If nd = n exit. Otherwise, set S = S[nd − 1 . . . n − 1], n = n − nd, δ = δ′, δ′ = max(S), reset nd and goto step (ii). The algorithm sorts an array of n elements S[0 . . . n−1] each have a distinct integer key in the range [0, m − 1] using O(1) extra space in O(n + m) time for the worst, O(m) time for the average (uniformly distributed keys) and O(n) time for the best case. Therefore, the ratio m n defines the efficiency (time-space trade-offs) letting very large arrays to be sorted in-place. The algorithm is surprisingly effective and efficient. Comparisons with Ω(n log n) quick sort [9, 25] and merge sort [13] and heap sort [12, 14] which take O(n log n) time on all inputs showed that associative sort for distinct keys is superior than all (up to 20 times) provided that m n ≤ c log n where c ≈ 4 for heap sort and merge sort. Quick sort gave worser results (c ≈ 8) for distinct keys. These results are consistent with m calculated theoretically making average case time complexity of the algorithm less than lower-bound of comparison-based sorting algorithms, i.e., O(m) < Ω(n log n). Another very important meaning of this inequality is that, since it does not require additional space other than a constant amount, no matter how large is the array, the proposed algorithm will sort faster than all provided that m = O(n log n). Comparisons with value-sorting version of distribution counting sort (frequency count- ing sort [23]) showed that associative sort for distinct keys is superior in every case. This is expectable considering memory allocation overload of distribution counting sort since time-complexities of both algorithms are the same. The performance of the algorithm is even asymptotically better than 2 lines of code referred in textbooks for sorting n distinct integers from [0 . . . n − 1] with indexing an auxiliary array B of the same size as the input A with keys of A by B[A[i]] = A[i] for i = 0, 1, . . . , n − 1, and then reconstructing sorted 9 permutation of A back by A[i] = B[i] for i = 0, 1, . . . , n − 1, which is possibly due to time-consuming memory allocation of the auxiliary array. It is compared with radix sort [23 -- 26] and bucket sort, as well. The results showed that it is superior than radix sort when m n ≤ 8 and faster than bucket sort for n distinct integer keys S[0...n − 1] each in the range [0, n − 1]. Finally, the dependency of the efficiency of the technique on the distribution of the keys is only O(n) which means it replaces all the methods based on address calculation [17 -- 22], that are known to be very efficient when the keys have known (usually uniform) distribution and require additional space more or less proportional to n [26]. 3.3 In-place Associative Integer Sorting The technique introduced above that sorts distinct keys can be generalized to arrays with repeating integers if we consider using released w − 1 bits of a node for other purposes. The generalized version becomes a value-sorting algorithm whereas the former was a rank-sorting algorithm. Henceforth, the term "integer" will be used instead of "key". The main difficulties of all distributive sorting algorithms is that, when the integers are distributed using a hash function according to their content, several integers may be clustered around a loci, and several may be mapped to the same location. These problems are solved by inherent three basic phases of in-place associative integer sorting [1] namely (i) practicing, (ii) storage and (iii) retrieval. We will consider the problem of sorting n integers S[0 . . . n − 1] each in the range [δ, δ + m − 1]. If m > n, it is not possible to construct a monotone bijective hash function that maps all the integers of the array into j ∈ [0, n − 1] without collisions and additional storage space. However, a bijective hash function can be constructed as a partial function 10 that assigns all the integers in the range [δ, δ+n−1] to exactly one element in j ∈ [0, n−1]. 3.3.1 Practicing It is assumed that associations are between the integers in the array space and the nodes in an imaginary linear subspace (ILS) that spans a predefined range of integers. The ILS can be defined anywhere on the array space S[0 . . . n − 1] provided that its boundaries do not cross over that of the array. The range of the integers spanned by the ILS is upper bounded by the number of integers n revealing the asymptotic power of the technique with increasing n with respect to the range of integers. However, an ILS may be smaller and can be located anywhere over the array space making the technique in-place, i.e., beside the input array, only a constant amount of memory locations are used for storing counters and indices. An association between an integer and the ILS is created by a node using a monotone bijective hash function that maps the integers in the predefined interval to the ILS. Therefore, the monotone bijective hash function is a partial function that assigns to each distinct integer in a predefined interval to exactly one node of the ILS. Since ILS is defined over the array space, mapping a distinct integer to the imaginary subspace is just an exchange operation from where a node is created. This is "practicing a distinct integer of an interval". Once a node is created, the redundancy due to the association between the integer and the position of the node (the position where the integer is mapped) releases the word allocated to the integer in the physical memory except for most significant bit (MSB) which tags the word as a node for interrogation purposes. Hence, the integer is said to be sent to the ILS thorugh the node. Nevertheless, the tag bit discriminates the word as a node and the position of the node lets the integer be retrieved back through the node from the ILS using the inverse hash function. This is "integer retrieval" through the node from ILS. All the bits of the node except the tag bit can be cleared and used 11 to store any information. Hence, they are the "record" of the node and the information stored in the record is the "cue" by which cognitive neuro-scientists describe the way that the brain recalls the successive items in an order during retrieval. For instance, it will be foreknown from the tag bit that a node has already been created while another occurrence of that particular integer is being practiced providing the opportunity to count other occurrences using the record. The process of counting an other occurrence of a particular integer is "practicing an idle integer of an interval". Repeating this process for all the integers of an interval is "practicing an interval", i.e., rehearsing used by cognitive neuro- scientists to describe the way that the brain manipulates the sequence before storing in a short (or long) term memory. Practicing all the integers of an interval does not need to alter the value of other occurrences. Only the first occurrence is altered while being practiced from where a node is created. All other occurrences of that particular integer remain in the array space but become meaningless. That is why they are "idle integers". Furthermore, practicing does not need to alter the position of idle integers as well, unless another distinct integer creates a node exactly at the position of an idle integer while being practiced. In such a case, the idle integer is moved to the former position of the integer that creates the new node in its place. This makes associative sort unstable, i.e., equal integers may not retain their original relative order. However, an imaginary subspace can create other subspaces and associations using the idle integers that were already practiced by manipulating either their position or value or both. Hence, a part of linear algebra and related fields of mathematics can be applied on subspaces to solve such problems. From information processing perspective, practicing is a derivative of cycle leader permutation (Section 3.1) where the nodes and the keys that are out of the practiced interval are treated specially. Processing the array from left to right for i = 0, 1, . . . n − 1, 12 if S[i] is a node (tagged word) or a key that is out of the practiced interval (S[i] − δ ≥ n) increase the iterator i and start over with S[i]. Otherwise, it is an integer that is to be practiced (S[i] − δ < n). Therefore, the monotone bijective hash function j = S[i] − δ maps the keys to j ∈ [0, n − 1]. If the integer S[j] at the target is a node, then increase the record of the node by one, increase the iterator i by one and start over with S[i]. This is "practicing an idle integer of an interval", because the idle integer S[i] is practiced by its node S[j]. On the other hand, if S[j] is not a node, then S[i] is the first occurrence that will create the node. Therefore, copy S[j] over S[i] and then clear S[j] and set its MSB making it a node of ILS releasing its w − 1 bits free. This is "practicing a distinct integer of an interval" where a node is created with an empty record of w − 1 bits. In such a case, j < i implies that the integer that was at S[j] (now at S[i]) was processed before. Therefore, increase the iterator i by one and start over with S[i]. On the other hand, j ≥ i implies that the integer that was at S[j] (now at S[i]) has not been processed yet. Hence, start over with S[i] without increasing the iterator i to continue with it. 3.3.2 Storage Once all the integers in the predefined interval are practiced, the nodes are spread over the ILS depending on the distribution of the integers with relative order. The next step is to store the nodes in a systematic way closing the distance between them to a direction retaining their relative order with respect to each other. This is the storage phase of associative sort where the received, processed and combined information required to construct the sorted permutation of the practiced interval is stored in the short-term memory (beginning of the array). When the nodes are moved, it is not possible to retain the associations between the nodes of the ILS and the integers of the array space because the position of each node cues the recall of the corresponding integer and retrieve it 13 from the ILS using the inverse hash function. This motivates the idea to further use the record of a node to store the node's former position, or maybe its relative position with respect to the ILS or how much that node is moved relative to its absolute or relative position or the other integers. Unfortunately, this requires a record of a particular node is enough to store both the positional information of the node and the number of idle integers practiced by that node. This is statistically impossible, but, as mentioned before, further associations can be created using the idle integers that were already practiced by manipulating either their position or value or both. Hence, if the record is enough, it can store together the positional information and the number of practiced idle integers, whereas an idle integer can be associated accompanying the node to supply additional space to store the positional information if the record is not enough. Let us assume for a moment that our universe of integers is U = [0 . . . 2w−1 − 1] where w is the fixed word length and n ≤ 2w−1. We know that other occurrences of a particular integer can be counted (practiced) using w − 1 bits (record) of a node. If we decide to write the absolute position of a node into its record during storage, we need log n bits of the record. Hence, it is logical to think that we can count up to 2w−1−log n − 1 idle integers with the record of a node during practicing. Fortunately, this is not the case. We can count using all w − 1 bits of the record during practicing, and while storing the nodes at the beginning of the array (short-term memory), we can get an idle integer immediately after the node that has practiced at least 2w−1−log n idle integers and write the absolute position of that node over the accompanying idle integer. In such a case, the record of the node (predecessor of the idle integer) only stores the number of practiced idle integers. This definition immediately reminds one of the aforementioned main difficulties of all distributive sorting algorithms. When the keys are distributed using a hash function 14 according to their content, several of them may be clustered around a loci. In such a case, how an idle integer can be inserted immediately after a particular node if there are several nodes immediately before and after that particular node during storing? The answer is in the pigeonhole principle. Pigeonhole principle says that, Corollary 3.1. Given n ≤ 2w−1 integers S[0 . . . n − 1], the maximum number of distinct integers that may occur contemporary in S at least 2w−1−log n times is, ⌈ n 2w−1−log n ⌉ (3.1) Hence, if the size of the array is say n = 2w−1, the maximum number of distinct integers that may occur contemporary in S at least 1 time is n. But the node itself represents the first occurrence which creates it. Therefore, Corollary 3.2. The maximum number of nodes that each can practice at least 2w−1−log n idle integers and hence need an idle integer immediately after itself during storage is equal to, and upper bounded by n/2. This means that, ǫ = ⌈ n/2 2w−1−log n ⌉ (3.2) Corollary 3.3. If the integers that are in the predefined interval [δ, δ + n − ǫ − 1] are practiced to Im[ǫ . . . n − 1] over S[ǫ . . . n − 1] where ǫ ∈ [0, n 2 ] is calculated by Eqn.3.2, then there will be ǫ integers in S[0 . . . ǫ − 1] either idle or unpracticed (out of the practiced interval) which will prevent collisions while inserting idle integers immediately after the nodes that has practiced at least 2w−1−log n idle integers during storage. 15 3.3.3 Retrieval Finally, the sorted permutation of the practiced interval is constructed in the array space, using the information stored in the short-term memory. This is the retrieval phase of associative sort. It is known that if the record is enough, it stores both the position of the node and the number of practiced idle integers. If not, an associated idle integer accompanying the node stores the position of the node, whereas the record (predecessor of the idle integer) stores the number of practiced idle integers. If the number of occur- rences of a particular integer is ni, then there are ni − 1 idle integers in the array space. But the nodes represent the first integers that are mapped into the imaginary subspace through themselves. If all the idle integers are grouped on the right side of the short-term memory, then one can process the information in the short-term memory from right to left and distinguish whether there is an idle integer (untagged word) accompanying its predecessor (the node on the left side of the idle integer). An idle integer implies that it is accompanying the node on its left for additional storage. In such a case, the positional information is read from the idle integer, whereas the number of practiced idle integers is read from the record of the node. If there is not an idle integer accompanying the node, both the positional information and the number of practiced idle integers are read from the record of the node. Afterwards, the positional information cues the recall of the integer using the inverse hash function. This is "integer retrieval" from ILS. Hence, the retrieved integer can be copied on the array space as many as it occurrs. At this point, we have two options: sequential and recursive versions which will be described next. 16 3.3.4 Overall Algorithm Consider n ≤ 2w−1 integers S[0...n − 1] each in the range [0, 2w−1 − 1]. All the integers in the range [δ, δ + n − ǫ − 1] will be practiced to Im[ǫ, n − 1] over S[ǫ, n − 1] where δ = min(S) and ǫ is calculated using Eqn. 3.2. Assume that there are nd nodes, nc idle integers practiced by those nd nodes and n′ d = n − (nd + nc) unpracticed integers that are out of the practiced interval. All these can be counted during practicing. Furthermore, the minimum δ′ of the unpracticed integers can be found as well during practicing. While nd nodes are being stored at the beginning of the array (short-term memory) closing the distance between them in order of precedence, if the record of a node is enough, i.e., the node has practiced less than 2w−1−log n idle integers, we write the absolute (former) position of the node into its record together with the number of practiced idle integers. Otherwise, we search to the right and get the first idle integer immediately after the node and write the absolute position of that node over the idle integer. Let us assume that ǫ′ nodes are counted that have practiced at least 2w−1−log n idle integers and needed an idle integer during storage. At the end, nd nodes and ǫ′ idle integers are stored in the short- term memory S[0 . . . nd + ǫ′ − 1] with the necessary information required to construct the sorted permutation of the practiced interval. On the other hand, nc − ǫ′ idle integers and n′ d = n − (nd + nc) unpracticed integers are distributed disorderly in S[nd + ǫ′ . . . n − 1]. 3.3.5 Sequential Version Selecting the pivot equal to δ + n−ǫ−1, if nc −ǫ′ idle integers and n′ d unpracticed integers that are distributed disorderly in S[nd+ǫ′ . . . n−1] are partitioned, then nc−ǫ′ idle integers come immediately after the short-term memory resulting in S[0 . . . nd + nc − 1]. Hence, it is immediate from here that the information in the short-term memory S[0 . . . nd + ǫ′ − 1] 17 can be processed from right to left backwards and the integers practiced by each node can be copied over S[0 . . . nd + nc − 1] right to left backwards without collision with the short-term memory. 3.3.6 Recursive Version We can recursively practice and store saving nd, ǫ′ and δ in stack space. Although the exact number of integers to be sorted in the next level of recursion is n′ d, the overall number of integers in that recursion is n = n′ d + nc − ǫ′ where nc − ǫ′ of them are idle integers of the previous recursion and meaningless. However, these idle integers increase the interval of range of integers spanned by the ILS improving the overall time complexity in each level of recursion. The recursion can continue until no any integer exists. In the last recursion, retrieval phase can begin to construct the sorted permutation of nd + nc integers from nd + ǫ′ records stored in the short term memory S[0 . . . nd + ǫ′ − 1] of that recursion and expand over S[0 . . . n − 1] right to left backwards. Each level of recursion should return the total number of integers copied on the array to the higher level to let it know where it will start to expand its interval. It should be noticed that, in the recursive version of the technique, there is no need to partition nc − ǫ′ idle integers from n′ d unpracticed integers. Hence, one step is canceled improving the overall efficiency. 3.3.7 Relaxing the Restrictions The technique of associative sorting is explained restricting the universe of integers to U = [0 . . . 2w−1 − 1] where w is the fixed word length and n ≤ 2w−1. When an integer is first practiced, a node is created releasing w bits of the integer free. One bit is used to tag the word as a node. Hence, it is reasonable to doubt that the tag bit limits the universe of integers because all the integers should be untagged and in 18 the range [0, 2w−1 − 1] before being practiced. Of course we always have the option to use additional n bits to tag the nodes. However, we can, (i) partition S into 2 disjoint sublists S1 < 2w−1 ≤ S2 in O(n) time with well known in-place partitioning algorithms as well as in a stable manner with [30], (ii) shift all the integers of S2 by −2w−1, sort S1 and S2 associatively and shift S2 by 2w−1. There are other methods to overcome this problem. For instance, (i) sort the sublist S[0 . . . (n/ log n) − 1] using the optimal in-place merge sort [31], (ii) compress S[0 . . . (n/ log n) − 1] by Lemma 1 of [32] generating Ω(n) free bits, (iii) sort S[(n/ log n) . . . n − 1] associatively using Ω(n) free bits as tag bits, (iv) uncompress S[0 . . . (n/ log n)−1] and merge the two sorted sublists in-place in linear time by [31]. If practicing a distinct integer lets us to use its w − 1 bits to practice other occurrences of that particular integer, we have w − 1 free bits by which we can count up to 2w−1 occurrences including the node that represents the first integer that created the node. Hence, it is reasonable to doubt again that there is another restriction on the size of the arrays, i.e., n ≤ 2w−1 under the assumption that an integer may always occur more than 2w−1 times for an array of n > 2w−1. But an array can be divided into two parts in O(1) time and those parts can be merged in-place in linear time by [31] after sorted associatively. 3.3.8 Complexity From complexity point of view, associative sort shows similar characteristics with distri- bution counting sort [15, 16] and bucket sort [23, 24]. It sorts n integers S[0 . . . n − 1] each in the range [0, m − 1] using O(1) extra space in O(m + n) time for the worst, O(m) time 19 for the average (uniformly distributed integers) and O(n) time for the best case. The ratio m n defines the efficiency (time-space trade-offs) of the algorithm letting very larges arrays to be sorted in-place. The complexity of the algorithm depends on the number and the range of the integers. It is known that the algorithm is capable of sorting in each iteration (or recursion) the integers in the range [δ, δ + n − ǫ − 1] where ǫ is defined by Eqn. 3.2 and upper bounded by n/2. If we restrict our problem to sorting n integers S[0 . . . n−1] each in the range [0, n−1], the worst case is when n = 2w−1 and the complexity is the recursion T (n) = T ( n 2 ) + O(n) yielding T (n) = O(n). On the other hand, if we look at Eqn. 3.2 closer, we see that ǫ = 0 when log n < w 2 . This means that, the best case is when n < 2w/2 which implies ǫ = 0 and the complexity is exactly T (n) = O(n) in this case. For the general case, we should consider the problem of sorting n integers S[0 . . . n − 1] each in the range [δ, δ + m − 1] where m > n. Practically it is always possible that n − 1 of the integers be in the range [δ, δ + n − ǫ − 1]. This is the best case and the algorithm sorts the integers in O(n) time. On the contrary, fixing ǫ always to its maximum n/2, if there is only 1 integer available in each practiced interval until the last, in any jth step, the only integer s ∈ S that will be sorted satisfies s < jn−(j−1) 2 which implies that the last alone integer satisfies s < jn−(j−1) 2 ≤ m from where we can calculate j by j ≤ 2m−1 n−1 . In such a case, the time complexity is O(n) + O(n − 1) + . . . + O(n − j) < (j + 1)O(n) yielding O(2m + n). The average case is more difficult to estimate. However, fixing ǫ always to its maximum n/2 will let us to assert that the integers in the range [δ, δ + n 2 − 1] will be sorted in each step. On the other hand, if the integers are uniformly distributed, defining β = m n , we can say that n 2β integers will be in the range [δ, δ + n 2 − 1] in each step. Therefore, the 20 algorithm will sort n 2β of the integers in O(n) time in each pass. This will continue until all the integers are sorted and the overall time complexity is, O(n)(cid:0) (2β − 1) 2β + (2β − 1)2 (2β)2 + . . . + (2β − 1)k−1 (2β)k−1 (cid:1) (3.3) which means the algorithm is upper bounded by 2βO(n) or 2O(m) in the average case. 3.3.9 Empirical Tests Practical comparisons for 1 million 32 bit integers with quick sort showed that associative sort is roughly 2 times faster for uniformly distributed integers when m = n. When m n = 10 performances are same. When m n = 1 10 associative sort becomes more than 3 times faster than quick sort. If the distribution is exponential, associative sort shows better performance up to m n ≈ 25 when compared with quick sort. Practical comparisons for 1 million 32 bit integers showed that radix sort is 2 times faster for uniformly distributed integers when m = n. However, associative sort is slightly better than radix sort when m n = 1 10 . Further decreasing the ratio to m n = 1 100 , associative sort becomes more than 2 times faster than radix sort. Practical comparisons for 1 million 32 bit integers showed that associative sort is 2 times faster than bucket sort with each bucket of size one hence distribution counting sort for m n = 1. Associative sort is still slightly better but the performances get closer when m n decreases. On the other hand, value-sorting version of distribution counting sort is 2 times faster than associative sort for m n = 1. Similarly, performances get closer when m n decreases. Even omitting its space efficiency for a moment, associative sort asymptotically out- performs all content based sorting algorithms when n is large relative to m. 21 3.4 Improved In-place Associative Integer Sorting With a very simple revision, the associative sorting technique can be improved theoreti- cally and practically. The only cost of the improved version is that a recursive implemen- tation is not possible. The tag bit discriminates the word as a node in the array space after practicing. During storage where the nodes are stored at the beginning of the array in order of precedence, the positional information (log n bits) of a node is stored either in its record or in an idle integer accompanying the node. However, ignoring all the MSBs of the array, if only the records (w − 1 bits) of the nodes are stored at the beginning of the array (short- term memory), there will be unmoved nd nodes (tagged words) spread over the array space with relative order and nd records in the short-term memory (S[0, . . . nd − 1]) with the same order after storage. Hence, a one-to-one correspondence is obtained with the stored records and the nodes of the array. This means that, selecting the pivot equal to δ + n − 1, if nc idle integers and n′ d unpracticed integers that are distributed disorderly in S[nd . . . n − 1] are partitioned, then nc idle integers come immediately after the short- term memory resulting in S[0 . . . nd + nc − 1]. Hence, retrieval phase can search the overall array from right to left backwards for the first node, retrieve the integer from the imaginary subspace through that node using its position and inverse of hash function, read its number of occurrences from its record S[nd − 1] and copy over S[0 . . . nd + nc − 1] right to left backwards without collision with the short-term memory. Afterwards, the tag bit of the processed node can be cleared and a new search to the left can be carried for the next node which will correspond to the next record S[nd − 2] of the short-term memory. This can continue until all the integers are retrieved resulting in the sorted permutation of the practiced integers. 22 As the position of the node is not required during storage, there is no need to get an idle integer immediately after a node that has practiced at least 2w−1−log n idle integers. This means that ǫ is always zero. Hence, the improved version is capable of practicing the integers in the interval [δ, δ + n − 1] in each iteration. Therefore, while the former technique was capable of sorting integers that satisfy S[i] − δ + ǫ < n, the improved version sorts the integers that satisfy S[i] − δ < n in each iteration. Hence, n integers S[0, . . . n − 1] each in the range [δ, δ + n − 1] can be sorted exactly in O(n) time regardless of the number of the integers. 3.5 Improved In-place Associative Distinct Integer Sorting The improved associative integer sorting technique can be easily specialized for distinct integers. Given n distinct integers S[0...n − 1] each in the range [δ, δ + m − 1], a monotone bijective super hash function can be constructed as a partial function that assigns each integer in the range [δ, δ + (w − 1)n − 1] to exactly one element in j ∈ [0, n − 1] and one element in k ∈ [0, (w − 1) − 1], j = (S[i] − δ) div (w − 1) if S[i] − δ < (w − 1)n k = (S[i] − δ) mod (w − 1) if S[i] − δ < (w − 1)n (3.4) (3.5) where mod is the remainder modulo. In this case, w −1 integers may collide and mapped to the same node created at j ∈ [0, n − 1] (Eqn. 3.4) in the ILS. But we can use w − 1 free bits of a record to encode which of w − 1 distinct integers are mapped to the same node by setting their corresponding bit determined by k (Eqn. 3.5). In other words, now the ILS is two dimensional over the array space where the first dimension along the array designates the node position and the second dimension along the bits of the node uniquely determines the integers which are mapped to the ILS through that node. 23 Once all the distinct integers in the predefined interval are practiced, ignoring all the MSBs of the array, if only the records (w − 1 bits) of the nodes are stored at the beginning of the array (short-term memory) in order of precedence, there will be unmoved nd nodes (tagged words) spread over the array space, and nd records in the short-term memory (S[0 . . . nd − 1]) with the same order after storage. Hence, selecting the pivot equal to δ + (w − 1)n − 1, if nc idle integers and n′ d unpracticed integers that are distributed disorderly in S[nd . . . n − 1] are partitioned, then nc idle integers come immediately after the short-term memory resulting in S[0 . . . nd + nc − 1]. Hence, the sorted permutation of the practiced interval can be retrieved by searching the nodes (tagged words) of the array backwards. When a tagged word (node) is found, the base of the integers mapped to that node can be calculated using the position of the node and the inverse of Eqn.3.4. Then, the position of the bits that are equal to 1 in the corresponding record S[nd − 1] uniquely determine (with the inverse of Eqn.3.5) the integers mapped to the same node from most significant to least and each can be copied over S[0 . . . nd + nc − 1] right to left backwards without collision with the short-term memory. As a result, an algorithm is obtained that sorts n distinct integers S[0 . . . n − 1] each in the range [0, m−1] in exactly O(n) time if m < (w −1)n. Otherwise, it sort in O(n+ m w−1) time for the worst, O( m w−1) time for the average (uniformly distributed keys) and O(n) time for the best case using only O(1) extra space. 4 In-place Associative Permutation Sort In-place associative integer sorting introduced in the previous section is a value-sorting algorithm except the one for distinct integer keys (Section 3.2). All others are not suitable for rank-sorting which is the main objective of all sorting algorithms. In this section, in- 24 place associative permutation technique will be introduced making the former technique suitable for rank-sorting without degrading its performance. Although proposed to provide a reasonable qualitative fit of the forgetting dynamics of the short term memory [8] in cognitive neuroscience, the idea behind the original perturbation model of Estes [28] is that the order of the elements is inherent in the cyclic reactivation of the elements, i.e., reactivations lead to reordering of the elements. Hence, when the idea behind the perturbation model is combined with the original technique of associative integer sorting, in-place associative permutation sort is obtained where the order of the practiced interval is inherent in the cyclic reactivation of all the keys of the array. The technique consists of three phases namely (i) practicing, (ii) permutation (reactivation) and (iii) restoring. The term "reactivation" immediately reminds the cycle leader permutation because when each key is sent to its final position it reactivates the key that was there. Associative permutation sort is based on a very simple idea: if nd + nc keys of a predefined interval become consecutive, distinct and in the range [0, nd + nc − 1], and if each new distinct value of a modified key corresponds to its rank with respect to others pointing its exact position in the sorted permutation, then the overall array can be reactivated with a special form of cycle leader permutation that rearranges the practiced (and modified) keys at the beginning of array in order. 4.1 Practicing Only two new steps are added to practicing phase of associative integer sorting (Sec- tion 3.3.1) before permutation (reactivation) phase. These are (i) accumulation and (ii) re-practicing steps. 25 In accumulation step, all the records of the nodes are accumulated from left to right. Hence, at the end, each record of a particular node keeps the exact position of the last idle key practiced by that node. As mentioned previously, an ILS can create other subspaces and associations using the idle keys that were already practiced by manipulating either their position or value or both. Hence, it is logical to use the nodes of ILS as discrete hash functions that define the values of idle keys when they are re-practiced using the same monotone bijective hash function. This is the re-practicing step. When an idle key is remapped to its node, it can obtain its exact position (ticket) from the record of its node. The record of the node will be decreased by one for each re-practiced idle key. This means that, when all the idle keys of a particular node are re-practiced, the value of the node will point its exact position in the sorted permutation as well, of course when its MSB is ignored. Hence, when all the idle keys of all the nodes are re-practiced, all the idle keys and all the nodes (ignoring their MSB) will become consecutive, distinct and in the range [0, nd + nc − 1] pointing to their exact position in the sorted permutation. 4.2 Permutation (Reactivation) After practicing, if the tag bits of the nodes are ignored, a simple cycle leader permutation can trivially rearrange the practiced keys at the beginning of array in order. Unsurpris- ingly each node precedes its own idle keys after this rearrangement. This simply puts the elements (satellite information) of the keys in order. However, the modified keys should be restored to their original values unless one intentionally wishes to normalize the keys and put all of them in the range [0, n − 1] at the end. Hence, the cycle leader permu- tation (reactivation) should take care of the nodes since the position of the nodes before 26 reactivation is used to recall the key and retrieve it from the ILS using the inverse hash function. This immediately lets us to assert that if it would be possible to rearrange the practiced interval at the beginning of the array with each node storing its former position in its record, then it would be possible to restore all the modified keys to their original values. A node has a record of w − 1 bits which stores the node's exact position before the reactivation. Hence, while a node is being moved to its exact position, its former position can be overwritten into its record as the cue which can be used to recall the key using the inverse hash function. But, from information processing perspective, how one can distinguish the nodes that are already moved, from the nodes that are not moved yet in such a case? The idle and unpracticed keys (that are out of the practiced interval) are the solution to this problem. If a node is not at its exact position, then it is evident that either an idle or a key that is out of the practiced interval will address the position of that node. Hence, a special outer cycle leader permutation that only reactivates the idle keys and the keys that are out of the practiced interval will ensure that the corresponding one will be moved to the actual position of the node giving a chance to start an inner cycle leader permutation that reactivates only the nodes and ensures that the nodes will be moved to their exact position storing their former position in their record as the cue. Once a node is moved to its exact position, there can not be any other outer cycle leader which will address that particular position. If another node is available where that particular node is moved, then the inner cycle leader permutation can continue with that node. However, if an idle or an unpracticed key is encountered, then the inner cycle leader permutation terminates and the outer cycle leader permutation continues. From information processing perspective, associative permutation (reactivation) phase is a derivative of cycle leader permutation (Section 3.1) where the nodes, practiced idle 27 keys and unpracticed keys (that are out of the practiced interval) are treated specially. Processing the array from left to right for i = 0, 1, . . . n−1, if S[i] is a node (tagged word), do nothing, increase the iterator i and start over with S[i]. If S[i] is a key that is out of the practiced interval (S[i] − δ ≥ n), exchange S[i] with S[k] starting with k = nd + nc, and increase k every time a key out of the practiced interval is moved to its new position. Besides, set j = k − 1 and start over with S[i] if it is either an idle or a key that is out of practiced interval. On the other hand, if S[i] is an idle key (S[i] − δ < n), implicitly practice it by exchanging S[i] with S[j] where j = S[i] and start over with S[i] if it is either an idle or a key that is out of practiced interval. If the key that came to S[i] from j is a node, in other words, if the idle key or the key that is out of the practiced interval is moved to a position where a node is there, then start an inner cycle permutation that reactivates only the nodes until a new idle key or a key that is out of the practiced interval is encountered. To do this, clear MSB of the node S[i] and read where it point by p = S[i]. Copy S[p] over S[i] and write the former position j of the node by S[p] = j and set MSB of S[p] making it a node. Now S[i] is the new key to be processed and j = p is where it came from. If S[i] is a node again, continue the cycle leader permutation. However, if S[i] is an idle key or a key that is out of the practiced interval, start over with S[i]. 4.3 Restoring With a final scan of the short-term memory (S[0 . . . nd + nc − 1]), one can obtain the exact values of practiced keys from their preceding nodes (tagged words). Each node stores its absolute position in its record (w − 1 bits) and cues the recall of the key using the inverse hash function. The value of the key can be copied over all the succeeding keys until a new node is found or the short-term memory ends. 28 4.4 Empirical Tests Practical comparisons for arrays up to one million integer keys all in the range [0, n−1] on a Pentium machine with radix sort and bucket sort indicate that associative permutation sort is slower roughly 2 times than radix sort and slower roughly 3 times than bucket sort. On the other hand, it is faster than quick sort for the same arrays roughly 1.5 times. Although its time complexity is similar to that of in-place associative sort [1] and practically slower, in-place associative permutation sort is proposed for integer key sorting problem. Hence, it sorts n records S[0 . . . n − 1] each have an integer key in the range [0, m − 1] with m > n using O(1) extra space in O(n + m) time for the worst, O(m) time for the average (uniformly distributed keys) and O(n) time for the best case. Remark 4.1. Associative permutation sort technique is on-line in a manner that after each iteration, the keys in the range [δ, δ + n − 1] are sorted at the beginning of the array and ready to be used. 5 Conclusions The technique of associative sorting is presented. In-place associative permutation sort technique is proposed which solves the main difficulties of distributive sorting algorithms by its inherent three basic steps namely (i) practicing, (ii) permutation and (iii) restoring. It is very simple and straightforward and around 30 lines of C code is enough. From time complexity point of view, both techniques show similar characteristics with bucket sort and distribution counting sort. They sorts the integers/keys associatively in O(m) time for the average (uniformly distributed keys) and O(n) time for the best case. Although its worst case time complexity is O(n + m), it is upper bounded by O(n2) 29 for arrays where m > n2. On the other hand, it requires only O(1) additional space, making it time-space efficient compared to bucket sort and distribution counting sort. The ratio m n defines its efficiency (time-space trade-offs) letting very large arrays to be sorted in-place. Furthermore, the dependency of the efficiency on the distribution of the keys is O(n) which means it replaces all the methods based on address calculation, that are known to be very efficient when the keys have known (usually uniform) distribution and require additional space more or less proportional to n. Hence, in-place associative permutation sort asymptotically outperforms all content based sorting algorithms making them attractive in almost every case even when space is not a critical resource. The technique seems to be very flexible, efficient and applicable for other problems as well, such as hashing, searching, succinct data structures, gaining space, etc. The only drawback of associative permutation sort is that it is unstable. However, as mentioned before, an imaginary subspace can create other subspaces and associations using the idle integers that were already practiced by manipulating either their position or value or both. Hence, different approaches can be developed to solve problems such as stability. 6 Discussion Associative permutation sort first finds the minimum of the array and starts with the keys in [min(S), min(S) + n − 1]. However, instead of starting with this interval, omitting the MSBs, if we consider a word as w − 1 bits and the most significant ⌈log n⌉ bits of a word as the key and the remaining bits as the satellite information, the problem reduces to sorting n integer keys S[0 . . . n − 1] each in the range [0, 2⌈log n⌉ − 1]. Since it is possible that 2⌈log n⌉ − 1 > n − 1, the keys in [n, 2⌈log n⌉ − 1] become the keys that are out of the 30 practiced interval. As a result, when the keys are sorted according to their most significant ⌈log n⌉ bits, in-place associative most significant ⌈log n⌉ radix sort is obtained. After the array is sorted according to their most significant ⌈log n⌉ bits, the idle keys are grouped and each group is preceded by the corresponding node that has practiced them. Hence, each group can be sorted sequentially or recursively assuming the satellite information as the key. If itself is used, it becomes an algorithm based on hash-and-conquer paradigm in contrast to divide-and-conquer. However, size of subgroups decreases and it may not be efficient when the ratio of range of keys in each subgroup to size of that subgroup, i.e., m n increases. Hence, other strategies may need to be developed after the first pass. References [1] A.E. Cetin, "In-place associative integer sorting", arXiv:1209.0572v2 [cs.DS] [2] A.E. Cetin, "Improved in-place associative integer sorting", arXiv:1209.3668v1 [cs.DS] [3] A.E. Cetin, "Sorting distinct integer keys using in-place associative sort", arXiv:1209.1942v2 [cs.DS] [4] A.E. Cetin, "Sorting distinct integers using improved in-place associative sort", arXiv:1209.4714v1 [cs.DS] [5] A.E. Cetin, "In-place associative permutation sort", arXiv:arXiv:1210.1771v1 [cs.DS] [6] K.S. Lashley, "The problem of serial order in behavior", in Cerebral Mechanisms in Behavior, ed. LA Jeffress, John Wiley & Sons, 1966. 31 [7] K.S. Lashley, "In search of the engram", IEEE Transactions on Electronic Computer, Vol. EC-15, no. 4, 1966. [8] R.N.A. Henson, "Short-term memory for serial order: The start-end model", Cognitive Psychology, Vol. 36, pp. 73 - 137, 1998. [9] C.A.R Hoare, "Quicksort", Comput. J., Vol. 5, pp. 10 - 16, 1962. [10] D.L. Shell, "A High Speed Sorting Procedure", Communications of ACM, Vol. 2, pp. 30 - 32, 1959. [11] A. Burnetas, D. Solow, R. Agrawal, "An analysis and implementation of an efficient in-place bucket sort", Acta Informatica, Vol. 34, pp. 687 - 700, 1997. [12] J. Williams, "Heapsort", Communications of the ACM, Vol. 7, pp. 347 - 348. [13] Anonymous, "Merge Sort", Wikipedia, 2012. [14] A. Levitin, The Design and Analysis of Algorithms. Addison-Wesley, 2007. [15] H.H. Seward, Information Sorting in the Application of Electronic Digital Computers to Business Operations, Master's thesis, MIT Digital Computer Laboratory, Report R- 232, Cambridge, 1954. [16] W. Feurzig, "Algorithm 23, mathsort", Commun. ACM, Vol. 3, pp. 601 - 602, 1960. [17] E.J. Isaac, R.C. Singleton, "Sorting by address calculation", Journal of the ACM, Vol. 3, pp. 169 - 174, 1956. [18] M.E. Tarter, R.A. Kronmal, "Non-uniform key distribution and address calculation sorting", Proc. ACM Nat'l Conf. 21, 1966. 32 [19] I. Flores, "Computer time for address calculation sorting", Journal of the ACM, Vol. 7, pp. 389 - 409, 1960. [20] B. Jones, "A variation on sorting by address calculation", Communications of the ACM , Vol. 13, pp. 105 - 107, 1970. [21] G. Gupta, "Sorting by hashing and inserting", Proc. ACM Annual Computer Science Conf. 17, pp. 409 - 409, 1989. [22] F. Suraweera, J.M. Al-Anzy, "Analysis of a modified address calculation sorting algorithm", Comput. J. Vol. 31, pp. 561 - 563, 1988. [23] H.M. Mahmoud, Sorting, A Distribution Theory, John Wiley and Sons, 2000. [24] T.H. Cormen, C.E. Leiserson, R.L. Rivest, C. Stein, Introduction to Algorithms, The MIT Press, 2001. [25] R. Sedgewick, Algorithms in C, Parts 1-4: Fundamentals, Data Structures, Sorting, Searching, Addison-Wesley, 1997. [26] D.E. Knuth, The Art of Computer Programming, Volume 3: Sorting and Searching, Addison-Wesley, 1973. [27] R. Shiffrin, J. Cook, "Short-term forgetting of item and order information", Journal of Verbal Learning and Verbal Behavior, Vol. 17, pp. 189 - 218, 1978. [28] W.K. Estes, A.W. Melton, E. Martin, "An associative basis for coding and organi- zation in memory", Coding processes in human memory (pp. 161-190). Washington, 1972. [29] A.G. Hanlon, "Content-addressable and associative memory systems", IEEE Trans- actions on Electronic Computer, Vol. EC-15, pp. 509 - 521, 1966. 33 [30] J. Katajainen, T. Pasanen, "Stable minimum space partitioning in linear time", BIT Numerical Mathematics, Vol. 32, pp. 580 - 585, 1992. [31] J. Salowe, W. Steiger, "Simplifed stable merging tasks", Journal of Algorithms, Vol. 8, pp. 557 - 571, 1987. [32] G. Franceschini, S. Muthukrishnan, M. Patrascu, "Radix sorting with no extra space", ESA'07 Proc. 15th annual European conference on Algorithms, pp. 194 - 205, 2007. [33] D. Belazzougui, P. Boldi, R. Pagh, S. Vigna, "Monotone Minimal Perfect Hashing: Searching a Sorted Table with O(1) Accesses", SODA '09 Proc. of the twentieth Annual ACM-SIAM Symposium on Discrete Algorithms , pp. 785-794. [34] HK Rosen, Handbook of Discrete and Combinatorial Mathematics, CRC Press, 2000. 34
1802.06748
3
1802
2019-05-25T19:33:09
Breaking the Linear-Memory Barrier in MPC: Fast MIS on Trees with Strongly Sublinear Memory
[ "cs.DS" ]
Recently, studying fundamental graph problems in the \emph{Massively Parallel Computation (MPC) framework, inspired by the MapReduce paradigm, has gained a lot of attention. An assumption common to a vast majority of approaches is to allow $\widetilde{\Omega}(n)$ memory per machine, where $n$ is the number of nodes in the graph and $\widetilde{\Omega}$ hides polylogarithmic factors. However, as pointed out by Karloff et al. [SODA'10] and Czumaj et al. [STOC'18], it might be unrealistic for a single machine to have linear or only slightly sublinear memory. In this paper, we thus study a more practical variant of the MPC model which only requires substantially sublinear or even subpolynomial memory per machine. In contrast to the linear-memory MPC model and also to streaming algorithms, in this low-memory MPC setting, a single machine will only see a small number of nodes in the graph. We introduce a new and strikingly simple technique to cope with this imposed locality. In particular, we show that the Maximal Independent Set (MIS) problem can be solved efficiently, that is, in $O(\log^3 \log n)$ rounds, when the input graph is a tree. This constitutes an almost exponential speed-up over the low-memory MPC algorithm in $O(\sqrt{\log n})$-algorithm in a concurrent work by Ghaffari and Uitto [SODA'19] and substantially reduces the local memory from $\widetilde{\Omega}(n)$ required by the recent $O(\log \log n)$-round MIS algorithm of Ghaffari et al. [PODC'18] to $n^{\alpha}$ for any $\alpha>0$, without incurring a significant loss in the round complexity. Moreover, it demonstrates how to make use of the all-to-all communication in the MPC model to almost exponentially improve on the corresponding bound in the $\mathsf{LOCAL}$ and $\mathsf{PRAM}$ models by Lenzen and Wattenhofer [PODC'11].
cs.DS
cs
Breaking the Linear-Memory Barrier in MPC: Fast MIS on Trees with Strongly Sublinear Memory Sebastian Brandt Manuela Fischer Jara Uitto ETH Zurich ETH Zurich ETH Zurich & Uni. Freiburg [email protected] [email protected] [email protected] Abstract Recently, studying fundamental graph problems in the Massively Parallel Computation (MPC) framework, inspired by the MapReduce paradigm, has gained a lot of attention. An assumption common to a vast majority of approaches is to allow (cid:101)Ω(n) memory per machine, where n is the number of nodes in the graph and (cid:101)Ω hides polylogarithmic factors. However, as pointed out by Karloff et al. [SODA'10] and Czumaj et al. [STOC'18], it might be unrealistic for a single machine to have linear or only slightly sublinear memory. In this paper, we thus study a more practical variant of the MPC model which only requires substantially sublinear or even subpolynomial memory per machine. In contrast to the linear-memory MPC model and also to streaming algorithms, in this low-memory MPC setting, a single machine will only see a small number of nodes in the graph. We introduce a new and strikingly simple technique to cope with this imposed locality. √ In particular, we show that the Maximal Independent Set (MIS) problem can be solved efficiently, that is, in O(log3 log n) rounds, when the input graph is a tree. This constitutes an almost exponential log n)-algorithm in a concurrent work by Ghaffari speed-up over the low-memory MPC algorithm in (cid:101)O( and Uitto [SODA'19] and substantially reduces the local memory from (cid:101)Ω(n) required by the recent O(log log n)-round MIS algorithm of Ghaffari et al. [PODC'18] to nε for any ε > 0, without incurring a significant loss in the round complexity. Moreover, it demonstrates how to make use of the all-to-all communication in the MPC model to almost exponentially improve on the corresponding bound in the LOCAL and PRAM models by Lenzen and Wattenhofer [PODC'11]. 9 1 0 2 y a M 5 2 ] S D . s c [ 3 v 8 4 7 6 0 . 2 0 8 1 : v i X r a 1 Introduction Parallel Computation Paradigms for Massive Data: When confronted with huge data sets, purely sequential approaches become untenably inefficient. To address this issue, several parallel computation frameworks specially tailored for processing large scale data have been introduced. Inspired by the MapReduce paradigm [DG08], Karloff, Suri, and Vassilvitskii [KSV10] proposed the Massively Parallel Computation (MPC) model, which was later refined in many works [GSZ11, BKS14, ANOY14, BKS17, C(cid:32)LM+17]. Massively Parallel Computation Model: In the MPC model, an input instance of size N is dis- tributed across M machines with local memory of size S each. The computation proceeds in rounds, each round consisting of local computation at the machines interleaved with global communication (also called shuffling, adopting the MapReduce terminology) between the machines. In the shuffling step, every machine is allowed to send as many messages to as many machines as it wants, as long as for every machine the total size of sent and received messages does not exceed its local memory capacity. The quantity of main interest is the round complexity: the number of rounds needed until the problem is solved, that is, until every machine outputs its part of the solution. This measure constitutes a good estimate for the actual running time, as local computation is presumed to be negligible compared to the cost-intensive shuffling, which requires a massive amount of data to be transferred between machines. Sublinear Memory Constraint: Note that S ≥ N leads to a degenerate case that allows for a trivial solution. Indeed, as the data fits into the local memory of a single machine, the input can be loaded there, and a solution can be computed locally. Due to the targeted application of MPC in the presence of massive data sets, thus large N , it is often crucial that S is not only smaller than N but actually substantially sublinear in N . The total memory M · S in the system has to be at least N , so that the input actually fits onto the machines, but ideally not much larger. Summarized, one requires S = (cid:101)O (N ε) memory on each of the M = (cid:101)O need essentially linear in n -- for instance, (cid:101)Ω(n) or mildly sublinear like n1−o(1) -- memory per machine, this assumption. Note that for sparse graphs with N = (cid:101)O(n) edges, this violates the sublinear memory explicitly restricting the attention to dense graphs with N =(cid:101)Ω(n1+ε) edges, as to ensure sublinearity in where n is the number of nodes in the input graph1. We refer to [BDH18] for a brief discussion of Sublinear Memory for Graph Problems: Basically all known MPC techniques for graph problems (cid:16) N 1−ε(cid:48)(cid:17) machines, for 0 < ε(cid:48) ≤ ε < 1. constraint, getting close to the degenerate regime. This issue has been artificially circumvented by N while still not having to relinquish the nice property that (essentially) all nodes fit into the memory of a single machine [KSV10]. Besides being a stretch of the definition, this additionally imposed condition of denseness of the input graph does not seem to be realistic. In fact, as recently also pointed out by [C(cid:32)LM+17], most practical large graphs are sparse. For instance in the Internet, most of the nodes have a small degree. Even for dense graphs, where in theory the sublinear memory constraint is met, practicability of the parameter range does not need to be ensured; linear or slightly sublinear in n might be prohibitively large. Furthermore, it is a very natural question to ask whether there is a fundamental reason why the known techniques get stuck at the near-linear barrier. One important aspect of our work is, from the theory perspective, that it breaks this threshold and thereby opens up a whole new unexplored domain of research questions. Low-Memory MPC Model: We study a more realistic regime of the parameters for problems on large graphs, captured by the following low-memory MPC model. 1In the context of graph problems, it is typical to assume that all incident edges of a node are stored on the same machine, resulting in two copies of an edge, one for each endpoint. We refer to [PRS16, Section 1.1] for a thorough discussion. Also see the remark at the end of this section. 1 Low-Memory MPC Model for Graph Problems: The input is a graph G = (V, E) with n nodes and m edges of size N = (cid:101)O(n + m). Given M = (cid:16) N 1+α(cid:48) machines with local memory S = (cid:101)O (nε) each, for arbitrary constants ε > 0 and α(cid:48) ≥ 0, we (cid:101)O (cid:17) S raise the question of what problems on G can be solved efficiently -- that is, in poly log log n rounds. Note that for sparse graphs, this condition exactly matches the sublinear memory constraint, and hence does not allow a trivial solution, as opposed to the setting with linear memory. We point out that low memory variants of the MPC model have been studied before [PPR+12, CPPU15], resulting in O(log n)-round algorithms for a variety of problems. For many of the fundamental graph problems, however, O(log n) is often particularly easy to achieve, for instance by directly adopting LOCAL algo- rithms. We thus restrict our attention to "efficient" algorithms, which we define to be a poly log log n function, given that the state-of-the-art algorithms in the MPC model tend to end in this regime of round complexities. Note that no general super-constant lower bounds are known [RVW16]. Concurrent Related Work: Until very recently, MPC research had focused on linear-memory algo- rithms. After (a preliminary version of) this work, the low-memory setting gained a lot of attention. This led to a variety of new results for graph problems in this model. We briefly outline recent developments that have taken place after this work. In a follow-up work, [BBD+19] devise MIS and matching algo- rithms in uniformly sparse graphs in O(log2 log n) rounds. In independent concurrent works, Ghaffari and Uitto [GU19] and Onak [Ona18] provide algorithms for the problems of maximal independent set and log log n)- √ log n) rounds. In [CFG+18], Chang et al. develop an O( matching in general graphs in (cid:101)O( √ round low-memory MPC algorithm for (∆ + 1)-list coloring. Remark 1.1. If a node cannot be stored on a single machine, as its degree is larger than S, one has to introduce some sort of a workaround, e.g., have several smaller-degree copies of the same node on several separate machines. In the end of Section 2, we argue how to get rid of this issue, in our problem setting, by a clean-up phase in the very beginning. To make the statements and arguments more readable, we throughout think of this clean-up as having taken place already. Instead, one could also work with the simplifying assumption that every machine has S = (cid:101)O (nε + ∆) memory, so that this issue does not arise in the first place. 1.1 Limitations of Linear-Memory MPC Techniques In the following, we briefly overview recent techniques from the world of Massive Parallel Computation algorithms, and give some indications as to why they are likely to fail in the low-memory setting. The restriction to substantially sublinear memory, to the best of our knowledge, indeed rules out all the known MPC techniques, which seem to hit a boundary at roughly S = (cid:101)Ω(n): moving from essentially linear to significantly sublinear memory incurs an exponential overhead in their round complexity, regardless of the density of the graph. This blow-up in the running time gives rise to the question of to what extent this near-linear memory is necessary for efficient algorithms. (Direct) PRAM/LOCAL Simulation: One easy way of devising MPC algorithms is by shoehorning parallel or distributed algorithms into the MPC setting. For not too resource-heavy PRAM algorithms, there is also a standard simulation technique [KSV10, GSZ11] that automatically transforms them into MPC algorithms. This approach, however, suffers from several shortcomings. First and foremost, the reduction leads to an Ω(log n) round complexity, which is exponentially above our efficiency threshold. Round Compression: Another similar technique, called round compression, introduced by Assadi and Khanna [AK17, Ass17], provides a generic way of compressing several rounds of a distributed algorithm into fewer MPC rounds, resulting in an (almost) exponential speed-up. However, this method heavily relies on storing intermediate values, leading to a blow-up of the memory. In particular, when requiring the algorithm to run in poly log log n rounds, superlinear memory per machine seems inevitable. 2 Filtering: The idea of the filtering technique [LMSV11, KMVV15] is to reduce the size of the input by carefully removing a large amount of edges from the input graph that do not contribute to the (optimal) solution of the problem. This reduction is done by either randomly sampling the edges, or by deterministically choosing sets of relevant edges, so that the resulting (partial) problem instance fits on a single machine, and hence can be solved there. This requires significantly superlinear memory, or logarithmically many rounds if memory is getting close to the linear regime. Moreover, the approach seems to get stuck fundamentally at S =(cid:101)Ω(n), since it relies on one machine eventually seeing the whole (filtered) graph. Coresets: One very recent and promising direction for MPC graph algorithms is the one of (randomized composable) coresets [AK17,ABB+19], in some sense building on the filtering approach. The idea is that not all the information of the graph is needed to (approximately) solve the problem. One thus can get rid of unimportant parts of the information. Solving the problem on this core, one then can derive a perfect solution or a good approximation to it, at much lower cost. This solution, however, is found by loading the coreset (or parts of it) on one machine, and then locally computing a solution, which again seems to be stuck at S =(cid:101)Ω(n), for similar reasons as the filtering approach. 1.2 Local Techniques for Low-Memory MPC In this section, we propose a direction that seems to be promising to pursue in order to devise efficient MPC algorithms in the substantially sublinear memory regime. Inherent Locality and Local Algorithms: The low-memory MPC model, as compared to the tradi- tional MPC graph model and the streaming setting, suffers from inherent locality: Since the memory of a single machine is too small to fit all the nodes simultaneously, it will never be able to have a global view of all the nodes in the graph. When devising techniques, we thus need to deal with this intrinsic local view of the machines. It seems natural to borrow ideas from local distributed graph algorithms, which are designed exactly to cope with this locality restriction. A direct simulation, however, in most cases only results in Ω(poly log n)-round algorithms. The problem is that these algorithms do not make use of the additional power of the MPC model, the global all-to-all communication, as the communication in those message-passing-based models is restricted to neighboring nodes. Local Meets Global: We propose a strikingly simple technique to enhance local-inspired approaches with global communication, in order to arrive at efficient algorithms in the world of low-memory MPC which are exponentially faster than their local counterparts and whose memory requirements are polyno- mially smaller per machine than their traditional MPC counterparts. We describe this technique in the context of the MIS problem on trees, even though it is more general. 1.3 Our Results In this paper, we focus on the Maximal Independent Set (MIS) problem, one of the most fundamental local graph problems. We propose efficient and surprisingly simple algorithms for the case of trees, which is particularly interesting for the following reason. While trees admit a trivial solution in the linear-memory MPC model, this cheat will not work in our low-memory setting. In some sense, it thus is the easiest non-trivial case, which makes it the most natural starting point for further studies. In fact, we strongly believe that our techniques can be extended to more general graph families and problems2. We provide two different efficient algorithms for MIS on trees. Our first algorithm in Theorem 1.2 is strikingly simple and intuitive, but comes with a small overhead in the total memory of the system, meaning that M · S is superlinear in the input size n. 2Indeed, there is a follow-up work generalizing our approach from trees to uniformly sparse graphs and from MIS only to MIS and maximal matching [BFU18b, BBD+19]. 3 trees in the low-memory setting, that is, with S = (cid:101)O (nε) local memory on each of M = (cid:101)O(cid:0)n1−ε/3(cid:1) Theorem 1.2. There is an O(log2 log n)-round MPC algorithm that w.h.p.3 computes an MIS on n-node machines, for any 0 < ε < 1. Our second algorithm in Theorem 1.3 gets rid of this overhead at the cost of a factor of log log n in the running time. trees in the low-memory setting, that is, with S = (cid:101)O (nε) local memory on each of M = (cid:101)O(cid:0)n1−ε(cid:1) Theorem 1.3. There is an O(log3 log n)-round MPC algorithm that w.h.p. computes an MIS on n-node machines, for any 0 < ε < 1. The algorithms in Theorems 1.2 and 1.3 almost match the conditional lower bound of Ω(log log n) for MIS (on general graphs) due to Ghaffari, Kuhn, and Uitto [GKU19], which holds unless there is an o(log n)-round low-memory MPC algorithm for connected components. This, in turn, is believed to be impossible under a popular conjecture [YV18]. Our algorithms improve almost exponentially on the (cid:101)O( √ √ log n)-round low-memory MPC algorithms in concurrent works -- for bounded-arboricity by Onak [Ona18] and for general graphs by Ghaffari and Uitto [GU19] -- as well as on the algorithms directly adopted from the PRAM/LOCAL model: an O(log n)- round algorithm for general graphs due to Luby [Lub86] and independently Alon, Babai, Itai [ABI86], log n · log log n)-round algorithm for trees by Lenzen and Wattenhofer [LW11]. Note that and the O( for rooted trees, the PRAM/LOCAL algorithm by Cole and Vishkin [CV86] directly gives rise to an O(log∗ n)-round low-memory MPC algorithm. or even n1/poly log log n (see Corollary 1.4) while not incurring a significant loss in the round complexity, compared to the recent O(log log n)-round MIS algorithm by Ghaffari et al. [GGK+18]. Moreover, our result shows that the local memory can be reduced substantially from (cid:101)Ω(n) to nε range for S as given in Theorems 1.2 and 1.3, that is, S = (cid:101)O(nα), where α > 0 is an arbitrary constant. (cid:101)O(cid:0)n1−ε/3(cid:1) machines with S = (cid:101)O (nε) local memory each in O(cid:0) 1 However, ε does not need to be a constant. Indeed, we can even go to subpolynomial memory S = no(1). ε · log2 log n(cid:1) MPC rounds. Corollary 1.4. For any ε = Ω (1/poly log log n), an MIS on an n-node tree can be computed on M = Throughout the paper, when we mention the low-memory MPC setting, we refer to the parameter 1.4 Our Approach in a Nutshell In the following, we give a short (and slightly imprecise) sketch of the steps of our algorithm. Our approach is based on the shattering technique which recently has gained a lot of attention in the LOCAL model of distributed computing [BEPS16] and goes back to the early nineties [Bec91]. The idea of shattering is to randomly break the graph into several significantly smaller components by computing a partial solution. The problem on the remaining components then is solved by a post-shattering algorithm. Shattering The goal of our shattering technique is to compute an independent set such that after the removal of these independent set nodes and all their neighbors, the remaining graph, w.h.p., consists of components of size at most poly log n. This is done in two steps: first, the maximum degree, w.h.p., is reduced to poly log n using the iterated subsample-and-conquer method, and then a local shattering algorithm is applied to this low-degree graph. I) Degree Reduction via Iterated Subsample-and-Conquer Our subsample-and-conquer method will w.h.p. reduce the maximum degree of a graph polynomially, from ∆ to roughly ∆1/(1+ε), as long as ∆ = Ω(poly log n). After O(log1+ε log ∆) iterations, the degree of our graph drops to poly log n. 3As usual, w.h.p. stands for with high probability, and means with probability at least 1 − n−c, for any c ≥ 1. 4 Subsample: We sample the nodes independently with probability roughly ∆ 1+ε , where ∆ is an up- per bound on the current maximum degree4 of the graph. This subsampling step guarantees, roughly speaking, the following three very desirable properties of the graph G(cid:48) induced by the sampled nodes. − 1 i) The diameter of each connected component of G(cid:48) is bounded by O(log∆ n). ii) The number of nodes in each connected component of G(cid:48) is at most nε/3. iii) Every node with degree ∆1/(1+ε) or higher in G has many neighbors in G(cid:48). Conquer: We find a random MIS in all the connected components of G(cid:48) in parallel. This can be done by gathering the connected components5, locally picking one of the two 2-colorings of this tree uniformly at random, and adding the black, say, nodes to the MIS. We will see that properties i) and ii) are crucial to ensure that the gathering can be done efficiently. In particular, storing the components on a single machine is possible due to the small size of the components, and the gathering is fast due to the small diameter. Because of property iii), the randomness in the choice of the MIS in every connected component, as well as the tree structure, all high-degree nodes in the original graph (sampled or not), w.h.p., will have an adjacent independent set node and thus, are removed from the graph for the next iteration. II) Low-Degree Local Shattering Once the degree has dropped to ∆(cid:48) = poly log n, we apply the shattering part of the LOCAL MIS algo- rithm of Ghaffari [Gha16], which runs in O(log ∆(cid:48)) = O(log log n) rounds and w.h.p. leads to connected components of size poly∆(cid:48) · log n = poly log n in the remainder graph. Observe that the simulation of this algorithm in the MPC model is straightforward. Post-Shattering We gather the connected components of size poly log n and solve the remaining problem locally. 2 Algorithm Overview and Roadmap In this section, we give the formal statements we need to prove our main result, and provide an overview of the structure of the remainder of the paper. We start with a result that is repeatedly used to gather all nodes of a connected component onto one machine, provided that they fit there. It will come in two variants, which naturally give rise to Theorems 1.2 and 1.3, respectively. The proof is deferred to Section 4 (part a)) and the full version [BFU18a] (part b)). Lemma 2.1 (Gathering). Let G be an n-node graph and G(cid:48) any n(cid:48)-node subgraph of G consisting of connected components of size at most k = O(cid:0)nε/3(cid:1) and diameter at most d. Then there are a) an O(log d)-round low-memory MPC algorithm with M = (cid:101)O(cid:0)n1−ε/3(cid:1) machines and b) an O(log d · log log n)-round low-memory MPC algorithm with M = (cid:101)O(cid:0)n1−ε(cid:1) machines, if n(cid:48) · d3 = O(n), that compute an assignment of nodes to machines so that all the nodes of a connected component of G(cid:48) are on the same machine. Next, we will provide the results corresponding to the two main parts of our algorithm, the shattering and the post-shattering. 4Note that in the MPC model it is easy to keep track of the maximum degree. 5Gathering the connected components means loading all the nodes of a connected component onto the same machine. 5 Lemma 2.2 (Shattering). There are a) an O(log log n · log log ∆)-round low-memory MPC algorithm that uses M = (cid:101)O(n1−α/3) machines b) an O(log2 log n · log log ∆)-round low-memory MPC algorithm with M = (cid:101)O(n1−α) machines and that compute an independent set on an n-node tree with maximum degree ∆ so that the remainder graph, after removal of the independent set nodes and their neighbors, w.h.p. has only components of size at most poly log n. The proof of this Shattering Lemma can be found in Section 3. The following Post-Shattering Lemma is a direct consequence of the Gathering Lemma. Lemma 2.3 (Post-Shattering). There are a) an O(log k)-round low-memory MPC algorithm with M = (cid:101)O(cid:0)n1−ε/3(cid:1) machines and b) an O(log k · log log n)-round low-memory MPC algorithm with M = (cid:101)O(cid:0)n1−ε(cid:1) machines that find an MIS in an n-node graph consisting of connected components of size k = O(cid:0)nε/3(cid:1). Proof. By Lemma 2.1, we can gather the connected components in O(log k) rounds. Then, an MIS of each connected component can be computed locally. Note that Theorem 1.1 by Ghaffari [Gha16] certifies that the number of nodes remaining after our shattering process can be made small enough to satisfy the conditions required by Lemma 2.1. Note that the naive simulation of the corresponding LOCAL post-shattering algorithm [Gha16, PS92] √ would lead to a round complexity of 2O( log log n). We now put together the results to prove Theorems 1.2 and 1.3. Proof of Theorems 1.2 and 1.3. We apply the shattering algorithm from Lemma 2.2 to get an indepen- dent set, with connected components of size k = poly log n in the remainder graph. Then we run the post-shattering algorithm from Lemma 2.3 to find an MIS in all these components. The combination of the initial independent set found by the shattering and all the MIS found by the post-shattering results in an MIS in the original tree. Memory per Machine below ∆: If the degree of a node is larger than the local memory, one needs to store several lower-degree copies of this node on different machines. Here, we give a short argument for why one can assume without loss of generality that all incident edges of a node are stored on the same machine. Notice that in a tree with n nodes, there can be at most n1−ε/2 nodes with degree at least nε/2. If we now just ignore all these high-degree nodes and find an MIS among the remaining nodes, the resulting graph, after removal of all MIS nodes and their neighbors, has at most n1−ε/2 nodes. Repeating this argument roughly 2/ε times gives an MIS in the whole input graph. 3 Shattering Lemma 3.1 (Iterated Subsample-and-Conquer). There are a) an O(log1+ε log ∆)-round low-memory MPC algorithm with M = (cid:101)O(n1−α/3) machines and b) an O(log1+ε log ∆ · log log n)-round low-memory MPC algorithm with M = (cid:101)O(n1−α) machines that compute an independent set on an n-node tree with maximum degree ∆ such that the remainder graph, after removal of the independent set nodes and their neighbors, w.h.p. has maximum degree poly log n. 6 The proof of this lemma can be found in Section 3.1. Lemma 3.2 (Low-Degree Local Shattering [Gha16]). There is an O(log ∆)-round LOCAL algorithm that computes an independent set on an n-node graph with maximum degree ∆ so that the remainder graph, after removal of all nodes in the independent set and their neighbors, w.h.p. has connected components of size poly∆ · log n. We now combine these two results to prove Lemma 2.2. Proof of Lemma 2.2. We apply the algorithm of Lemma 3.1, w.h.p. yielding an independent set with a remainder graph that has maximum degree ∆(cid:48) = poly log n. On this low-degree graph, we simulate the LOCAL algorithm of Lemma 3.2 in a straight-forward manner, which takes O(log ∆(cid:48)) = O(log log n) rounds and w.h.p. leaves us with connected components of size poly∆(cid:48) · log n = poly log n. 3.1 Degree Reduction via Iterated Subsampling We prove the following result, and then show how it can be used to prove Lemma 3.1. For the purposes of the proof of Lemma 3.3 we assume that ∆ is a large enough poly log n in order to be able to apply Lemma 2.1. Notice that from the perspective of the final runtime, the exponent of the logarithm turns into a constant factor hidden in the O-notation. Lemma 3.3. There are a) an O(log log n)-round low-memory MPC algorithm with M = (cid:101)O(n1−α/3) machines and b) an O(log2 log n)-round low-memory MPC algorithm with M = (cid:101)O(n1−α) machines that compute an independent set on an n-node tree G with maximum degree ∆ = Ω(poly log n) such that the remainder graph, after removal of the independent set nodes and their neighbors, w.h.p. has maximum degree at most ∆(1+δ(cid:48))δ, for some δ = Θ (1/(1 + ε)) and any δ(cid:48) > 0. Proof. We first outline the algorithm and then slowly go through the steps of the algorithm again while proving its key properties. Algorithm: Every node is sampled independently with probability ∆−δ into a set V (cid:48). The connected components of G(cid:48) = G[V (cid:48)] are gathered by Lemma 2.1, and one of the two 2-colorings is picked uniformly at random, independently for every connected component. This can be done locally. All the black nodes, say, are added to the MIS, and are removed from the graph along with their neighbors. See Fig. 1 in Section 4.2. Subsampling: We first prove that the random subsampling leads to nice properties of the graph induced by subsampled nodes. Claim 3.4. After the subsampling, w.h.p., the following holds. i) Every connected component of G(cid:48) has diameter O(cid:0) 1 δ · log∆ n(cid:1). ii) Every connected component of G(cid:48) consists of nO((1−δ)/δ) nodes. (cid:16) ∆(1+δ(cid:48))δ(cid:17) iii) Every node with degree Ω in G has degree Ω(poly log n) in G(cid:48). Proof. Consider an arbitrary path of length (cid:96) = Ω(cid:0) 1 δ · log∆ n(cid:1) in G. This path is in G(cid:48) only if all its nodes also the diameter of every connected component, in G(cid:48) is bounded by O(cid:0) 1 δ · log∆ n(cid:1). Since the degree among the subsampled nodes is bounded by O(cid:0)∆1−δ(cid:1), w.h.p., which is a simple application of Chernoff are subsampled into V (cid:48), which happens with probability at most ∆−δ·(cid:96) = 1 polyn . A union bound over all -- at most n2 many -- paths in the tree T shows that, w.h.p., the length of every path, and hence in particular 7 Figure 1: Consider a non-subsampled high-degree node v. While most of its neighbors will not be subsampled (gray nodes), there will still be many, say k, subsampled neighbors. Since we are in a tree, all the subtrees G1, . . . Gk of subsampled neighbors of v are disjoint and thus colored independently. Node v will thus, w.h.p., see at least one black neighbor. This node will be added to the MIS, leading to the removal of v from the graph. and union bound, it follows that every connected component consists of at most O(cid:0)∆(1−δ)·(cid:96)(cid:1) = nO((1−δ)/δ) (cid:16) ∆(1+δ(cid:48))δ(cid:17) nodes. Finally, another simple Chernoff and union bound argument shows that every node with degree = Ω(poly log n) neighbors in G(cid:48), which concludes the Ω proof of Claim 3.4. Gathering: Since G(cid:48) consists of components that have a low diameter by Claim 3.4 i) and that are small enough to fit on a single machine by Claim 3.4 ii) -- provided that δ = Θ (1/(1 + ε)) is chosen such that the components have size O(cid:0)nε/3(cid:1) -- we can gather them efficiently by Lemma 2.1, in either O(log log n) in the graph G has at least Ω (cid:16) ∆δ(cid:48)·δ(cid:17) or O(log2 log n) rounds. The random MIS can then be easily computed locally. Random MIS: It remains to show that every high-degree node in G, w.h.p., has at least one adjacent node that joins the random MIS, which leads to the removal of this high-degree node from the graph. Note that this is trivially true for all subsampled nodes, by maximality of an MIS. Now consider an arbitrary non-subsampled node v with degree Ω and its Ω(poly log n) subsampled neighbors, by Claim 3.4 iii). Observe that, since we are in a tree and thus in particular in a triangle-free graph, there cannot be edges between these neighbors. Therefore no two neighbors of a non-subsampled node belong to the same connected component in G(cid:48), which means that all the neighbors in V (cid:48) of v are colored independently, and hence are added to an MIS independently with probability 1/2. By the Chernoff inequality, w.h.p. at least one of v's neighbors must have been added to an MIS, and a union bound over all nodes concludes the proof of the degree reduction, and hence of Lemma 3.3. (cid:16) ∆(1+δ(cid:48))δ(cid:17) Proof of Lemma 3.1. Follows from log 1 (1+δ(cid:48))δ log ∆ = log1+ε log ∆ many applications of Lemma 3.3. 4 Gathering Connected Components In this section, we provide a proof of the Gathering Lemma in Lemma 2.1. Our approach is essentially a tuned version of the Hash-to-Min algorithm by Chitnis et al. [CDSMR13] and the graph exponentiation idea by Lenzen and Wattenhofer [LW10]. Notice that, however, Chitnis et al. only show an O(log n) bound for the round complexity; it is not possible to just use their method as a black box. The section is divided into two subsections, where we first give a simple and fast but memory-inefficient algorithm and then present a slightly slower algorithm that only needs a constant space overhead. In very recent works, independent of this paper, Andoni et al. [ASS+18] and Assadi et al. [ASW18] studied, among other problems, finding connected components in the low-memory setting of MPC. In 8 ······u1u2ukG2GkG1v (a) (b) Figure 2: We illustrate the gathering algorithm with help of the tree depicted in Fig. 2a. The edges added by node u are illustrated in Fig. 2b by dashed arcs. Fig. 2c displays how the edges added by nodes v1 and v2, drawn as dashed arcs, shortcut the shortest path between nodes s and t. (c) particular, Andoni et al. give algorithms to find connected components and to root a forest with constant success probability, with O(m) total memory in time O(log d · log log n). While their results are more general, ours have the advantages of being (arguably) much simpler and deterministic. Furthermore, to turn their algorithm to work with high probability, the straightforward approach requires a logarithmic overhead in the total memory. We present the naive gathering algorithm in Section 4.1 and the in-space gathering in Section 4.2. 4.1 Naive Gathering We first present the algorithm. The underlying idea of the algorithm is to find a minimum-ID6 node within every component and to create a virtual graph that connects all the nodes of that component to this minimum-ID node, the leader. Gathering Algorithm: In every round, every node u completes its 1-hop neighborhood to a clique. Once a round is reached in which there are no more edges to be added, u stops and selects its minimum-ID neighbor as its leader. We refer to Fig. 2 in Section 4.2 for an illustration. Observe that once there is a round in which u does not add any edges, the component of u forms a clique, and thus all nodes in this component have the same leader, namely the minimum-ID node in this clique. Next, we prove that this algorithm terminates quickly. Claim 4.1. The gathering algorithm takes O(log d) rounds on a graph with diameter d. Proof. Consider any shortest path u1, . . . , u(cid:96) of length 2 ≤ (cid:96) ≤ d. After the first round, every ui gets connected to ui−2 and ui+2 for 2 < i < (cid:96)−1. Thus, the diameter of the new graph is at most (cid:100)2d/3(cid:101). After O(log d) iterations, the diameter within each component has reduced to 1, and the algorithm halts. It remains to show that not too many edges are added, so that the virtual graph of any component still fits into the memory of a single machine. Claim 4.2. The number of edges in the virtual graph created by the gathering algorithm in a component of size k is O(k3). Proof. During the execution of the algorithm, each node in a component may create an edge between any other two nodes in the corresponding component, thus at most k3. 6We assume without loss of generality that every node has a unique identifier. If not, every node can draw an O(log n)-bit identifier at random, which w.h.p. will be unique. 9 uv1v2st Since we require the components to be of size at most O(nε/3), the previous claim guarantees that the virtual graph of any connected component indeed fits into the memory. So as to not overload any machine with too many components, we assume that the shuffling distributes the components to the machines in an arbitrary feasible way, e.g., greedily7. Remark 4.3. A weakness of the gathering algorithm is that we need O(k3) memory to store a connected component of size k, even if this component originally just consisted of as few as k − 1 edges. This is because a single edge can exist on up to k machines. In the worst case, the required memory is blown up by a power 3. This leads to a super-linear overall memory requirement, that is, we need roughly N 1+2ε/3 total memory in the system. Notice that this can be implemented either by adding more machines or by adding more memory to the machines, since we do not care on which machines the resulting components lie, as long as they fit the memory. 4.2 In-Space-Gathering in Trees The simple and naive gathering algorithm can be very wasteful in terms of space usage over the whole system. In this section, we provide a fine-tuned version of the gathering method that works, asymptoti- cally, in space, thereby proving part b) of Lemma 2.1. In other words, the total space requirement drops to O(n). Informally, our algorithm first turns every connected component into a rooted tree and then determines which nodes are contained in the same tree component by making sure that each node learns the ID of the root of its tree. For the latter part, we prove the following. Lemma 4.4. There is an O(log d)-round low-memory MPC algorithm that works in an n-node forest of rooted trees with maximum diameter d and, for every node, determines the root of the corresponding tree. The algorithm requires M = O(cid:0)n1−ε(cid:1) machines. Proof. Let parent(v) denote the parent of node v and define parent(r) = r for a root node r. Consider the following pointer-forwarding algorithm that is run in parallel for every node v. In every round, for every child u of v, we set parent(u) := parent(v). The process terminates once v points to a root, i.e., to a node r for which parent(r) = r. Notice that after every step, following the parent pointers still leads to the root node. Let (v1, v2, . . . , vk) be the directed path from node v1 to the root r = vk of its subtree in round t. After one round of the algorithm, every vi is connected to vmin{i+2,k}. Thus, the length of the path is at most (cid:100)k/2(cid:101). After O(log k) = O(log d) rounds the algorithm terminates yielding the claim. Root a Tree: Given Lemma 4.4, what remains to show for our algorithm is how to root a tree. The idea is to once more use the graph exponentiation method to learn an (cid:96)-hop neighborhood of a node in log (cid:96) steps. However, in order to prevent the space requirement from getting out of hand, each node performs only a bounded number of exponentiation steps, after which all nodes that already know their parent in the output orientation are removed from the graph. Then this process is iterated until at most one node (per connected component) remains. Tree-Rooting Algorithm A: In the following, we give a formal description of an algorithm A for rooting a tree of diameter d. The algorithm takes an integer B as input parameter that describes the initial memory budget for each node v, i.e., an upper bound on the number of edges that v may add before the first node removal. The execution of A is subdivided in phases i = 0, 1, . . . which consist of O(log d) rounds each. Set B0 = B. Phase i of A: In phase i, each node v does the following: In round 0, node v sets its local budget Bv to Bi. In each following round j = 1, 2, . . ., node v first connects its 1-hop neighborhood to a clique by adding edges between all its neighbors that are not 7An alternative and simple way to prevent overloading is to add an O(log n) factor of memory per machine and consider a random assignment of components to machines as a balls-into-bins process. 10 connected yet, but it does so only if the number of added edges is at most Bv. Then v updates its local budget by decreasing Bv by the number of edges that v added. If Bv was not large enough to connect v's 1-hop neighborhood to a clique, then v does not add any edges in round j. This concludes the description of round j, of which there are O(log d) many. Denote the tree at the beginning of phase i by Ti, and for each neighbor u of v, denote the set of u(v). Phase i concludes with a number of special rounds: nodes that are closer to u than v in Ti by Si First, v checks whether it has a neighbor u(cid:48) in Ti with the following properties: i) Si u(v) is contained in the current 1-hop neighborhood of v, for each neighbor u of v in Ti satisfying u (cid:54)= u(cid:48). ii) Si u(cid:48)(v) is not (entirely) contained in the current 1-hop neighborhood of v. If such a neighbor u(cid:48) exists (which, by definition, is unique), then v sets parent(v) = u(cid:48). Second, v removes all edges that it added during phase i (regardless of whether a parent is set). Third, v is removed from Ti if it already chose its parent, i.e., if it set parent(v). Fourth, the budget per node is updated, by setting Bi+1 = Bi · ni/ni+1, where ni and ni+1 are the numbers of nodes of Ti and Ti+1, respectively. This concludes the description of phase i. We execute this process until at most one node remains. Termination of A: Since in each phase (at the very least) all leaves are removed, this process eventually terminates. It is straightforward to check that if a node v chooses its parent u(cid:48) = parent(v) in phase i, then any neighbor u (cid:54)= u(cid:48) of v in Ti also chooses its parent in phase i, and, what is more, u chooses v as its parent (which, combined with the following observations, shows that the orientation of the input tree induced by the parent choices of the nodes yields indeed a rooted tree). Hence, given the above process, one of two things happens in the end: either exactly one node remains, or all nodes are removed but there is exactly one pair of nodes that chose each other as their parent. In the former case, no action has to be taken, as the remaining node is simple the root of our rooted tree. In order to handle the latter case, we add a simple fifth special round at the end of each phase i: Each node v removed in phase i checks whether the node it chose as its parent chose v as its parent. If this is the case, then the node with the higher id removes its choice of parent and becomes the root node of the input tree. See Fig. 3 for an illustration of algorithm A. 11 (a) The leaves have only one neighbor, which be- comes their parent. Nodes u1, u2, and v do not have enough budget to add edges. (b) Once the leaves are removed once, enough bud- get is freed for nodes u1 and u2 to add edges that connect their neighbors. (c) Once nodes u1 and u2 know that v is their parent, node v can focus its budget to the remainder of the tree illustrated by the gray area. Figure 3: An illustration of the (local) steps performed by algorithm A. For the sake of this example, assume that the initial budget is 2. As illustrated in Fig. 3a, leaves are always able to determine their parent. Assuming that the tree has non-leaf minimum degree 3, removing all the leaves at least roughly doubles the budget of all nodes. Thus, in the second step, illustrated in Fig. 3b, nodes with degree at most 4 are able to complete their 1-hop neighborhoods into a clique. Small subtrees rooted at (or connected to) v are removed quickly in our process, as illustrated in Fig. 3c, and therefore, node v requires large subtrees to survive for many phases. Running Time of A: We present a number of lemmas in order to determine the runtime of algorithm A. Here, a subtree T (v) rooted at some node v corresponds to the descendants of v in the rooted tree T returned by A (or in the rooted subtree of T induced by the nodes of some Ti). Lemma 4.5. Consider some arbitrary phase i, and let T (v) be the subtree of Ti rooted at v. If T (v) ≤ √ Bi, then v chooses its parent in phase i and is removed from the tree. an edge between nodes from T (v). Since T (v) ≤ √ Proof. Let k be some arbitrary non-negative integer, and consider any node u in T (v) with distance at least 2k to v. Observe that, according to A, the distance between any two nodes in Ti decreases by a factor of at most 2 per round. Hence, after round k of phase i, all nodes contained in the 1-hop neighborhood of u are actually also contained in T (v). Thus, each edge that u would have added if it had connected its 1-hop neighborhood to a clique in each of the rounds 1, . . . , k + 1, disregarding any budget constraints, is Bi, the number of edges between nodes from T (v) is bounded from above by Bi; it follows that u had enough budget to indeed connect its 1-hop neighborhood to a clique in each round up to and including round k + 1. Now consider any node w whose distance to v in Ti is at least 2k, but at most 2k+1− 1. Let w0, . . . , wk be nodes on the unique path between v and w with distance 20, . . . , 2k to v. Due to the observations above, it is straightforward to check that, in each round 1 ≤ h ≤ k, node wh−1 connects node wh to v, while in round k + 1, node wk connects node u to v. Since the depth of T (v) is upper bounded by log d, it follows that after log d rounds, all nodes from T (v) are contained in v's 1-hop neighborhood. Hence, v will choose the only neighbor that is not contained in T (v) as its parent, and v is removed in phase i. Since k was chosen arbitrarily, the lemma statement follows. Lemma 4.6. Let T be a rooted tree with n nodes and diameter at most d. Let 1 ≤ α ≤ n, and let C be the set of nodes v with the property that T (v) ≤ α. Then, C ≥ n · (α/(d + α)). 12 vu1u2···vu1u2···vu1u2··· Proof. Assign one dollar to each node that is not contained in a subtree of size at most α. Every such node then distributes its dollar evenly among all of its descendants in C. Note that, for each leaf node w of the tree obtained from T by deleting all nodes in C, the number of descendants of w in C is at least α since otherwise w would be in C, by the definition of C. Hence, all nodes that are not contained in C have at least α descendants in C. Consider then any node v ∈ C. Since the diameter of the tree is d, node v can have at most d ancestors in T . Every ancestor of v distributes at most 1/α dollars to v and therefore, v receives at most d/α dollars. As the amount of dollars did not change during its redistribution from nodes not contained in C to nodes in C, we can conclude that C·(d/α) ≥ n−C which implies that C ≥ n·(α/(d+α)). Lemma 4.7. Assume that the input parameter B for our algorithm A satisfies B ≥ d3. Then the runtime of A on trees with n nodes and diameter d is O(log d · log log n). Proof. Observe that the sequence B0, B1, . . . of budgets at the beginning of phases 0, 1, . . . is monotonically non-decreasing, by definition. Hence, Bi ≥ d3 for all phases i. Now consider some arbitrary phase i, and let ni denote the number of nodes of Ti. By Lemma 4.5 and Lemma 4.6, the number of nodes that are removed in phase i is at least ni · ( Bi)). Thus, for the new budget Bi+1, it holds by definition that Bi/(d + √ √ (cid:18) d + (cid:19) √ Bi Bi+1 ≥ Bi · 1 1 − √ √ Bi d+ Bi = Bi · 3 ≥ B 2 i d . d , which implies Bi+5 ≥ B2 Since, as observed above, d ≤ B1/3 √ i . Recall that in Bi/d)-fraction of nodes is removed. Thus, after O(log log n) phases, all nodes each phase i, at least a ( (except possibly for one node) have been removed and the termination condition of A is satisfied. Since every phase takes O(log d) time, the claim follows. , we obtain Bi+1 ≥ B7/6 i i Now we have all the ingredients to prove the second part of Lemma 2.1. It is a simple corollary of the following theorem. Theorem 4.8. Consider a forest F of n nodes where every tree is of diameter at most d. There is an MPC algorithm that finds the connected components of F in time O(log d·log log n) where M·S = O(n·d3). Proof. Imagine that we run algorithm A in parallel on all trees of the input forest F , with input parameter B = d3. There are only two parts of A that are of a global nature, i.e., where the actions of nodes do not depend on their immediate neighborhood: the termination condition that all nodes, possibly except for one, have been removed, and the part where the node's budgets are updated from Bi to Bi+1. The former is easily adapted to the case of forests; each node simply terminates when itself or all its neighbors are removed. Regarding the updating of the budget, we adapt the tree rooting algorithm as follows: we still set the new budget Bi+1 to Bi · ni/ni+1, but now ni and ni+1 denote the total number of nodes (i.e., in all trees of the forest) that have not been removed yet at the beginning of phase i, resp. phase i + 1. In the following, we verify that Lemmas 4.5, 4.6, and 4.7 also hold for forests instead of trees. In the case of Lemma 4.5, this is obvious as the argumentation is local and thus also applies to forests. Lemma 4.6 trivially also holds for forests since the lemma statement holds for all trees in the forest. Finally, since the argumentation of the proof of Lemma 4.7 does not make use of the fact that the input graph is a tree except when applying Lemmas 4.5 and 4.6, it follows that Lemma 4.7 also holds for forests. Hence, our adapted tree rooting algorithm actually transforms the forest into a rooted forest in time O(log d · log log n). Now we can apply Lemma 4.4, and, e.g., color each component with the color of the root node, thereby marking the connected components. Due to the runtime given in Lemma 4.4, our total runtime is still O(log d · log log n). It remains to show that the claimed memory constraints are satisfied. Due to the space guarantee given in Lemma 4.4, it is sufficient to show that the memory overhead induced by adding edges during 13 the execution of out forest rooting algorithm does not exceed the allowed amount. Thus, consider the number of edges added in an arbitrary phase i. Since each node adds at most as many edges as its budget allows, i.e., at most Bi edges, the total number of edges added in phase i is upper bounded by ni · Bi. By the definition of Bj+1, we have nj+1 · Bj+1 = nj · Bj, for any phase j. Hence, the value of ni · Bi is the same for every phase i, and we obtain ni · Bi = n0 · B0 = n · d3. Therefore, the number of edges added in any phase i does not exceed n· d3, and since all added edges are removed again at the end of each phase, the lemma statement follows. Remark 4.9. In the analysis, we implicitly assumed that edges incident on nodes are always added only once. It could, however, be the case that some node is "unlucky" and many of its neighbors add a copy of the same edge many times. This misfortune could potentially result in adding nε copies of the same (virtual) edge, which could, in turn, overload the memory per machine constraint on the machines containing these unlucky nodes. For the sake of simplicity, we decided to leave this problem to the shuffling algorithm of the underlying MPC framework that can, for example, load the nodes onto the machines greedily after each communication step. Since the total memory constraint is satisfied, this is always feasible. Alternatively, the shuffling algorithm could simply drop duplicate messages. 14 5 Open Questions In this paper, we introduced a variant of the MPC model in which the standard assumption of S =(cid:101)Ω(n) memory per machine is removed. General Graphs: We showed that in the case of the MIS problem on trees this assumption is not necessary: Restricting the memory to nε per machine still allows an O(log2 log n)-round algorithm. The first intriguing open problem follows. P1 Devise a low-memory MPC algorithm that finds an MIS in general graphs in time poly log log n. Other Fundamental Graph Problems: As an MIS of the line graph8 corresponds to a Maximal Matching in the original graph, an MIS algorithm usually directly gives rise to a Maximal Matching algorithm. In the MPC framework, however, it might not even be possible to store the line graph, which seems to complicate the simulation of the MIS algorithm on the line graph. hard. the linear , i.e., a graph where the edges of the input graph correspond to nodes in the line graph, in memory. To the best of our knowledge, the field of Maximal Matching in the MPC world is wide open. Naturally, there are many other standard graph problems some of which we list here. P2 Devise an efficient low-memory MPC algorithm for the Maximal Matching problem. P4 Devise an efficient low memory MPC algorithm for the (∆ + 1)-coloring problem. P5 Devise an efficient low memory MPC algorithm for the (2∆ − 1)-edge-coloring problem. P4 Devise an efficient low memory MPC algorithm that finds an O(1)-coloring in time O(log d) in trees. References [ABB+19] [ABI86] [AK17] Sepehr Assadi, MohammadHossein Bateni, Aaron Bernstein, Vahab S. Mirrokni, and Cliff Stein. Coresets meet EDCS: algorithms for matching and vertex cover on massive graphs. In Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2019, San Diego, California, USA, January 6-9, 2019, pages 1616 -- 1635, 2019. Noga Alon, L´aszl´o 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. [Ass17] [ASS+18] Sepehr Assadi. 1709.04599, 2017. Simple round compression for parallel vertex cover. arXiv preprint: A. Andoni, C. Stein, Z. Song, Z. Wang, and P. Zhong. Parallel Graph Connectivity in Log Diameter Rounds. the Proceedings of the Symposium on Foundations of Computer Science (FOCS), pages 674 -- 685, 2018. 8A line graph is a graph with a node for every edge in the input graph, and an edge between two nodes if the corresponding edges are incident. 15 [ASW18] S. Assadi, X. Sun, and O. Weinstein. Massively Parallel Algorithms for Finding Well- Connected Components in Sparse Graphs. ArXiv e-prints, 2018. [BBD+19] Soheil Behnezhad, Sebastian Brandt, Mahsa Derakhshan, Manuela Fischer, Mohammad- Taghi Hajiaghayi, Richard M. Karp, and Jara Uitto. Massively parallel computation of matching and mis in sparse graphs. Proceedings of the International Symposium on Princi- ples of Distributed Computing (PODC), 2019. [BDH18] Soheil Behnezhad, Mahsa Derakhshan, and MohammadTaghi Hajiaghayi. Brief announce- ment: Semi-mapreduce meets congested clique. arXiv preprint arXiv:1802.10297, 2018. [Bec91] J´ozsef Beck. An algorithmic approach to the Lov´asz local lemma. Random Structures & Algorithms, 2(4):343 -- 365, 1991. [BEPS16] Leonid Barenboim, Michael Elkin, Seth Pettie, and Johannes Schneider. The Locality of Distributed Symmetry Breaking. Journal of the ACM (JACM), 63(3):20, 2016. [BFU18a] Sebastian Brandt, Manuela Fischer, and Jara Uitto. Breaking the linear-memory barrier in mpc: Fast mis on trees with strongly sublinear memory. arXiv:1802.06748, 2018. [BFU18b] Sebastian Brandt, Manuela Fischer, and Jara Uitto. Matching and MIS for uniformly sparse graphs in the low-memory MPC model. CoRR, abs/1807.05374, 2018. [BKS14] Paul Beame, Paraschos Koutris, and Dan Suciu. Skew in parallel query processing. In Pro- ceedings of the 33rd ACM SIGMOD-SIGACT-SIGART symposium on Principles of database systems, pages 212 -- 223. ACM, 2014. [BKS17] Paul Beame, Paraschos Koutris, and Dan Suciu. Communication steps for parallel query processing. Journal of the ACM (JACM), 64(6):40, 2017. [CDSMR13] Laukik Chitnis, Anish Das Sarma, Ashwin Machanavajjhala, and Vibhor Rastogi. Finding In ICDE '13, pages 50 -- 61. connected components in map-reduce in logarithmic rounds. IEEE Computer Society, 2013. [CFG+18] Yi-Jun Chang, Manuela Fischer, Mohsen Ghaffari, Jara Uitto, and Zufan Zheng. The complexity of (δ + 1) coloring in congested clique, massively parallel computation, and centralized local computation. arXiv preprint arXiv:1808.08419, abs/1808.08419, 2018. [C(cid:32)LM+17] Artur Czumaj, Jakub (cid:32)Lacki, Aleksander Madry, Slobodan Mitrovi´c, Krzysztof Onak, and Piotr Sankowski. Round compression for parallel matching algorithms. arXiv preprint: 1707.03478, 2017. [CPPU15] Matteo Ceccarello, Andrea Pietracaprina, Geppino Pucci, and Eli Upfal. Space and time efficient parallel graph decomposition, clustering, and diameter approximation. In the Pro- ceedings of the Symposium on Parallel Algorithms and Architectures (SPAA), pages 182 -- 191, 2015. [CV86] Richard Cole and Uzi Vishkin. Deterministic Coin Tossing and Accelerating Cascades: Micro and Macro Techniques for Designing Parallel Algorithms. In Symposium on Theory of Computing, pages 206 -- 219, 1986. [DG08] Jeffrey Dean and Sanjay Ghemawat. Mapreduce: simplified data processing on large clusters. Communications of the ACM, 51(1):107 -- 113, 2008. 16 [GGK+18] Mohsen Ghaffari, Themis Gouleakis, Christian Konrad, Slobodan Mitrovic, and Ronitt Ru- binfeld. Improved massively parallel computation algorithms for mis, matching, and vertex cover. In Proceedings of the International Symposium on Principles of Distributed Comput- ing (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), 2016. [GKU19] Mohsen Ghaffari, Fabian Kuhn, and Jara Uitto. personal communication, 2019. [GSZ11] [GU19] Michael T Goodrich, Nodari Sitchinava, and Qin Zhang. Sorting, searching, and simulation in the mapreduce framework. In International Symposium on Algorithms and Computation, pages 374 -- 383. Springer, 2011. Mohsen Ghaffari and Jara Uitto. Sparsifying distributed algorithms with ramifications in massively parallel computation and centralized local computation. In the Proceedings of ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1636 -- 1653, 2019. [KMVV15] Ravi Kumar, Benjamin Moseley, Sergei Vassilvitskii, and Andrea Vattani. Fast greedy al- gorithms in mapreduce and streaming. ACM Transactions on Parallel Computing (TOPC), 2(3):14, 2015. [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. [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. [Lub86] [LW10] [LW11] [Ona18] Michael Luby. A Simple Parallel Algorithm for the Maximal Independent Set Problem. SIAM Journal on Computing, 15(4):1036 -- 1053, 1986. Christoph Lenzen and Roger Wattenhofer. Brief Announcement: Exponential Speed-Up of Local Algorithms Using Non-Local Communication. In 29th Symposium on Principles of Distributed Computing (PODC), Zurich, Switzerland, July 2010. Christoph Lenzen and Roger Wattenhofer. MIS on Trees. In Proceedings of the International Symposium on Principles of Distributed Computing (PODC), pages 41 -- 48, 2011. Krzysztof Onak. Round compression for parallel graph algorithms in strongly sublinear space. CoRR, abs/1807.08745, 2018. [PPR+12] Andrea Pietracaprina, Geppino Pucci, Matteo Riondato, Francesco Silvestri, and Eli Upfal. In Proceedings of the International Space-round tradeoffs for mapreduce computations. Conference on Supercomputing, pages 235 -- 244. ACM, 2012. [PRS16] [PS92] Gopal Pandurangan, Peter Robinson, and Michele Scquizzato. Fast distributed algorithms for connectivity and mst in large graphs. In Proceedings of the 28th ACM Symposium on Parallelism in Algorithms and Architectures, pages 429 -- 438. ACM, 2016. Alessandro Panconesi and Aravind Srinivasan. Improved distributed algorithms for color- ing and network decomposition problems. In Proceedings of the Symposium on Theory of Computing (STOC), pages 581 -- 592. ACM, 1992. 17 [RVW16] [YV18] Tim Roughgarden, Sergei Vassilvitskii, and Joshua R Wang. Shuffles and circuits:(on lower bounds for modern parallel computation). In Proceedings of the 28th ACM Symposium on Parallelism in Algorithms and Architectures, pages 1 -- 12. ACM, 2016. Grigory Yaroslavtsev and Adithya Vadapalli. Massively parallel algorithms and hardness for single-linkage clustering under lp distances. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmassan, Stockholm, Sweden, July 10-15, 2018, pages 5596 -- 5605, 2018. 18
1810.10965
1
1810
2018-10-18T13:18:49
Towards a compact representation of temporal rasters
[ "cs.DS" ]
Big research efforts have been devoted to efficiently manage spatio-temporal data. However, most works focused on vectorial data, and much less, on raster data. This work presents a new representation for raster data that evolve along time named Temporal k^2 raster. It faces the two main issues that arise when dealing with spatio-temporal data: the space consumption and the query response times. It extends a compact data structure for raster data in order to manage time and thus, it is possible to query it directly in compressed form, instead of the classical approach that requires a complete decompression before any manipulation. In addition, in the same compressed space, the new data structure includes two indexes: a spatial index and an index on the values of the cells, thus becoming a self-index for raster data.
cs.DS
cs
Towards a compact representation of temporal rasters (cid:63) Ana Cerdeira-Pena1, Guillermo de Bernardo1,2, Antonio Farina1, Jos´e R. Param´a1, and Fernando Silva-Coira1 1 Universidade da Coruna, Fac. Inform´atica, CITIC, Spain 2 Enxenio S.L. Abstract. Big research efforts have been devoted to efficiently manage spatio-temporal data. However, most works focused on vectorial data, and much less, on raster data. This work presents a new representation for raster data that evolve along time named Temporal k2raster. It faces the two main issues that arise when dealing with spatio-temporal data: the space consumption and the query response times. It extends a com- pact data structure for raster data in order to manage time and thus, it is possible to query it directly in compressed form, instead of the classical approach that requires a complete decompression before any manipula- tion. In addition, in the same compressed space, the new data structure includes two indexes: a spatial index and an index on the values of the cells, thus becoming a self-index for raster data. 1 Introduction Spatial data can be represented using either a raster or a vector data model [6]. Basically, vector models represent the space using points and lines connecting those points. They are used mainly to represent man-made features. Raster models represent the space as a tessellation of disjoint fixed size tiles (usually squares), each one storing a value. They are traditionally used in engineering, modeling, and representations of real-word elements that were not made by men, such as pollution levels, atmospheric and vapor pressure, temperature, precipitations, wind speed, land elevation, satellite imagery, etc. Temporal evolution of vectorial data has been extensively studied, with a large number of data structures to index and/or store spatio-temporal data. Examples are the 3DR-tree [14], HR-tree [10], the MVR-tree [13], or PIST [3]. In [9] the classical Map Algebra of Tomlin for managing raster data is ex- tended to manage raster data with a temporal evolution. The conceptual solution (cid:63) Funded in part by European Union's Horizon 2020 research and innovation pro- gramme under the Marie Sklodowska-Curie grant agreement No 690941 (project BIRDS); by Xunta de Galicia/FEDER-UE [CSI: ED431G/01 and GRC: ED431C 2017/58]; by MINECO-AEI/FEDER-UE [Datos 4.0: TIN2016-78011-C4-1-R; Ve- locity: TIN2016-77158-C4-3-R; and ETOME-RDFD3: TIN2015-69951-R]; and by MINECO-CDTI/FEDER-UE [INNTERCONECTA: uForest ITC-20161074]. is simple, instead of considering a matrix, it considers a cube, where each slice of the temporal dimension is the raster corresponding to one time instant. Most real systems capable of managing raster data, like Rasdaman, Grass, or even R are also capable of managing time-series of raster data. These systems, as well as raster representation formats such as NetCDF (standard format of the OGC3) and GeoTiff, rely on classic compression methods such as run length encoding, LZW, or Deflate to reduce the size of the data. The use of these compression methods poses an important drawback to access a given datum or portion of the data, since the dataset must be decompressed from the beginning. Compact data structures [7, 11] are capable of storing data in compressed form and enable us to access a given datum without the need for decompressing from the beginning. In most cases, compact data structures are equipped with an index that provides fast access to data. There are several compact data structures designed to store raster data [2, 8]. In this work, we extend one of those compact data structures, the k2raster [8], to support representing time-series of rasters. 2 Related work In this section, we first revise the k2tree, a compact data structure that can be used to represent binary matrices. Then, we also present several compact data structures for representing raster data containing integers in the cells. We pay special attention to discuss one of them, the k2raster, which is the base of our proposal Temporal k2raster (T−k2raster). k2tree: The k2tree [5] was initially designed to represent web graphs, but it also allows to represent binary matrices, that is, rasters where the cells contain only a bit value. It is conceptually a non-balanced k2-ary tree built from the binary matrix by recursively dividing it into k2 submatrices of the same size. First, the original matrix is divided into k2 submatrices of size n2/k2, being n×n the size of the matrix. Each submatrix generates a child of the root whose value is 1 if it contains at least one 1, and 0 otherwise. The subdivision continues recursively for each node representing a submatrix that has at least one 1, until the submatrix is full of 0s, or until the process reaches the cells of the original matrix (i.e., submatrices of size 1×1). The k2tree is compactly stored using just two bitmaps T and L. T stores all the bits of the conceptual k2tree, except the last level, following a level-wise traversal: first the bit values of the children of the root, then those in the second level, and so on. L stores the last level of the tree. It is possible to obtain any cell, row, column, or window of the matrix very efficiently, by running rank and select operations [7] over the bitmaps T and L. k3tree: The k3tree [2] is obtained by simply adding a third dimension to the k2tree, and thus, it conceptually represents a binary cube. This can be trivially done by using the same space partitioning and representation techniques from the k2tree, yet applied to cubes rather than to matrices. 3 http://www.opengeospatial.org/standards/netcdf Thus, each 1 in the binary cube represents a tuple (cid:104)x, y, z(cid:105), where (x, y) are the coordinates of the cell of the raster and z is the value stored in that cell. k2acc: The k2acc [2] representation for a raster dataset is composed by as many k2trees as different values can be found in the raster. Given t different values in the raster: v1 < v2 < . . . < vt, k2acc contains K1, K2, . . . , Kt k2trees, where each Ki has a value 1 in those cells whose value is v ≤ vi. 2D-1D mapping: In [12], it is presented a method that uses a space-filling curve to reduce the raster matrix to an array, and the use of one dimensional index (for example a B-tree) over that array to access the data. k2raster: k2raster has proven to be superior in both space and query time [12, 8] to all the other compact data structures for storing rasters. In [8], it was also compared with NetCDF. It drew slightly worse space needs than the compressed version (that uses Deflate) of NetCDF, but queries performed noticeably faster. k2raster is based in the same partitioning method of the k2tree, that is, it recursively subdivides the matrix into k2 submatrices and builds a conceptual tree representing these subdivisions. Now, in each node, instead of having a single bit, it contains the minimum and maximum values of the corresponding submatrix. The subdivision stops when the minimum and maximum values of the submatrix are equal, or when the process reaches submatrices of size 1×1. Again the conceptual tree is compactly represented using, in addition to binary bitmaps, efficient encoding schemes for integer sequences. More in detail, let n×n be the size of the input matrix. The process begins by obtaining the minimum and maximum values of the matrix. If these values are different, they are stored in the root of the tree, and the matrix is divided into k2 submatrices of size n2/k2. Each submatrix produces a child node of the root storing its minimum and maximum values. If these values are the same, that node becomes a leaf, and the corresponding submatrix is not subdivided anymore. Otherwise, this procedure continues recursively until the maximum and minimum values are the same, or the process reaches a 1×1 submatrix. Figure 1 shows an example of the recursive subdivision (top) and how the conceptual tree is built (centre-top), where the minimum and maximum values of each submatrix are stored at each node. The root node corresponds to the original raster matrix, nodes at level 1 correspond to submatrices of size 4×4, and so on. The last level of the tree corresponds to cells of the original matrix. Note, for instance, that all the values of the bottom-right 4×4 submatrix are equal; thus, its minimum and maximum values are equal, and it is not further subdivided. This is the reason why the last child of the root node has no children. The compact representation includes two main parts. The first one represents the topology of the tree (T ) and the second one stores the maximum/minimum values at the nodes (Lmin/Lmax). The topology is represented as in the k2tree, except that the last level (L) is not needed. The maximum/minimum values are differentially encoded with respect to the values stored at the parent node. Again, these values are stored as arrays following the same method of the k2tree, that is, following the same level-wise order of the conceptual tree. By using differential Fig. 1. Example (using k = 2) of integer raster matrix (top), conceptual tree of the k2raster, conceptual tree with differential encoding, and final representation of the raster matrix. Lmax and Lmin contain the maximum and minimum values of each node following a level-wise order and using differential encoding. encoding, the numbers become smaller. Directly Addressable Codes (DACs) [4] take advantage of this, and at the same time, provide direct access. The last two steps to create the final representation of the example matrix are also illustrated in Figure 1. In the center-bottom and bottom parts, we respectively show the tree with the differences for both the maximum and minimum values, and the data structures that compose the final representation of the k2raster. Therefore, the original raster matrix is compactly stored using just a bitmap T , which represents the tree topology, and a pair of integer arrays (Lmax and Lmin), which contain the minimum and maximum values stored at the tree. Note that when the raster matrix contains uniform areas, with large areas of equal or similar values, this information can be stored very compactly using differential encoding and DACs. The maximum/minimum values provide indexation of the stored values, this technique is usually known as lightweight indexation. It is possible to query the structure only decompressing the affected areas. Queries can be efficiently computed navigating the conceptual tree by running rank and select operations on T and, in parallel, accessing the arrays Lmax and Lmin. 455335663266333333333345554444335544443335444444344444Step19:25:35:34:35:35:54:433456:26:63:33:33:21 1110 1010 0100 1011 Tree(T): 90345 0233 0333 0010 0122 0011 0100 1022 1100 2021Local maximumvalues(Lmax): 2301 2 0 0 0 00Local mínimum values(LMin): 98777777666655669:59:76:56:67:765569778333234434335663266333333333345554444335544443335444444344444Step29877777766665566663266333333333345554444335544443335444444344444Step39877777766665566663266333333333354444544443335444444344444Step49877777766665566Level0 (root)Level1Level2Level39:24:10:01:00:00:25:222103:00:43:13:13:00:30:23:03:12:201100221000110011220Level0 (root)Level1Level2Level3rootLevel1Level2Level3Conceptual treeof thek2-rasterConceptual treeof thek2-raster (usingdifferentialencoding)Final representation 3 T−k2raster: A temporal representation for raster data Let M be a raster matrix of size n×n that evolves along time with a timeline of size τ time instants. We can define M= (cid:104)M1, M2, . . . , Mτ(cid:105) as the sequence of raster matrices Mi of size n×n for each time instant i ∈ [1, τ ]. A rather straightforward baseline representation for the temporal raster ma- trix M can be obtained by simply representing each raster matrix Mi in a compact way with a k2raster. In this section we use a different approach. The idea is to use sampling at regular intervals of size tδ. That is, we represent with a k2raster all the raster matrices Ms, s = 1 + i tδ, i ∈ [0, (τ − 1)/tδ]. We will refer to those Mi rasters as snapshots of M at time i. The tδ − 1 raster matrices Mt, t ∈ [s + 1, s + tδ − 1] that follow a snapshot Ms are encoded using Ms as a reference. The idea is to create a modified k2raster(cid:48) to represent Mt where, at each step of the construction process, the values in the submatrices are encoded as differences with respect to the corresponding submatrices in Ms rather than as differences with respect to the parent node as usual in a regular k2raster. With this modification, we still expect to encode small gaps for the maximum and minimum values in each node of the conceptual tree of Mt. Yet, in addition, when a submatrix in Mt is identical to the same submatrix in Ms, or when all the values in both submatrices differ only in a unique gap value α, we can stop the recursive splitting process and simply have to keep a reference to the corresponding submatrix of Ms and the gap α (when they are identical, we simply set α = 0). In practice, keeping that reference is rather cheap as we only have to mark, in the conceptual tree of Mt, that the subtree rooted at a given node p has the same structure of the one from the conceptual tree of Ms. For such purpose, in the final representation of k2raster(cid:48), we include a new bitmap eqB, aligned to the zeroes in T . That is, if we have T [i] = 0 (node with no children), we set eqB[rank0(T, i)] ← 1,4 and set Lmax[i] ← α. Also, if we have T [i] = 0, we also can set eqB[rank0(T, i)] ← 0 and Lmax[i] ← β (where β is the gap between the maximum values of both submatrices) to handle the case in which the maximum and minimum values in the corresponding submatrix are identical (as in a regular k2raster). The overall construction process of the k2raster(cid:48) for the matrix Mt related to the snapshot Ms can be summarized as follows. At each step of the recursive process, we consider a submatrix of Mt and the related submatrix in Ms. Let the corresponding maximum and minimum values of the submatrix of Mt be maxt and mint, and those of Ms be maxs and mins respectively. Therefore: -- If maxt and mint are identical (or if we reach a 1×1 submatrix), the recursive process stops. Being zt the position in the final bitmap T , we set T [zt] ← 0, eqB[rank0[T, zt]] ← 0, and Lmax[zt] ← (maxt − maxs).5 4 From now on, asume rankb(B, i) returns the number of bits set to b in B[0, i − 1], and rankb(B, 0) = 0. Note that the first index of T , eqB, Lmax, and Lmin is 0. 5 Since in k2raster(cid:48) we have to deal both with positive and negative values, we actually apply a zig-zag encoding for the gaps (maxt − maxs). -- If all the values in Ms and Mt differ only in a unique value α (or if they are identical, hence α = 0), we set T [zt] ← 0, eqB[rank0[T, zt]] ← 1, and Lmax[zt] ← (maxt − maxs). -- Otherwise, we split the submatrix Mt into k2 parts and continue recursively. We set T [zt] ← 1, and, as in the regular k2raster, Lmax[zt] ← (maxt−maxs), and Lmin[rank1(zt)] ← (mint − mins). Fig. 2. Structures involved in the creation of a T−k2raster considering τ = 3. Figure 2 includes an example of the structures involved in the construction of a T−k2raster over a temporal raster of size 8×8, with τ = 3. The raster matrix corresponding to the first time instant becomes a snapshot that is represented exactly as the k2raster in Figure 1. The remaining raster matrices Ms+1 and Ms+2 are represented with two k2raster(cid:48) that are built taking Ms as a refer- ence. We have highlighted some particular nodes in the differential conceptual trees corresponding to Ms+1 and Ms+2. (i) the shaded node labeled (cid:104)0: 0(cid:105) in Ms+1 indicates that the first 4×4 submatrix of both Ms and Ms+1 are identical. Therefore, node (cid:104)0: 0(cid:105) has no children, and we set: T [2] ← 0, eqB[1] ← 1, and Lmax[2] ← 0. (ii) the shaded node labeled (cid:104)1: 1(cid:105) in Ms+2 illustrates the case in which all the values of a given submatrix are increased by α ← 1. In this case values (cid:104)6, 6, 5, 5(cid:105) in Ms become (cid:104)7, 7, 6, 6(cid:105) in Ms+2. Again, the recursive traversal stops at that node, and we set: T [8] ← 0, eqB[3] ← 1, and Lmax[8] ← 1 (values are increased by 1). (iii) the shaded node labeled (cid:104)1: 2(cid:105) in Ms+1 corresponds 663266333333333345554444335544443335444444344444Ms(snapshot)774477444333333345554444335544443345544444444444Ms+19877875577777755776643446666444445554444335544443345644444445444Ms+2987777776666556698777777666655660:10:00:00:00:10:01:00:01:00:00:0110010001:11:11:00:01:210000:09:25:35:34:35:35:54:433456:26:63:33:33:20:10:00:00:00:10:02:00:02:00:00:02:12:11:01:12:30:10:01:10:00:011001110211121009:59:76:56:67:7655697783332344343351 0111 0010 0001 00100 0101 1110 0000 0010 1000 1010 10001 100 0 1 0 1 00 0 101 00 0eqBestá alineado con 0s en T eqB= 0 si min y máxiguales en el nodoeqB= 1, mismos valores que snapshot1 1111 0000 1010 0001 00100 0202 0010 2211 0000 0020 1111 2111 1011 1010 20101 1100 1 0 1 0 1010 0 0 101 00 01 1110 1010 0100 1011 90345 0233 0333 0010 0122 0011 0100 1022 1100 20212301 2 0 0 0 00T: Lmax: LMin: rootL1L2L3T: Lmax: LMin: eqB: T: Lmax: LMin: eqB: rootL1L2L3L1L2L3root to the node labeled (cid:104)3: 2(cid:105) in Ms. In this case, when we sum the maximum and minimum values of both nodes we obtain that that node in Ms+1 has the same maximum and minimum values (set to 4). Consequently the recursive process stops again. In this case, we set T [7] ← 0, eqB[3] ← 0, and Lmax[7] ← 1. 4 Querying temporal raster data In this section, we show two basic queries over T−k2raster. Obtaining a cell value in a time instant: This query retrieves the value of a cell (r, c) of the raster at time instant t: v ← getCellV alue(r, c, t). For solving this query, there are two cases: if t is represented by a snapshot, then the algorithm to obtain a cell in the regular k2raster is used, otherwise, a synchronized top- down traversal of the trees representing that time instant (Mt) and the closest previous snapshot (Ms) is required. Focusing on the second case, the synchronized traversal inspects the two nodes at each level corresponding to the submatrix that contains the queried cell. The problem is that due to parts of Mt or Ms having the same value, the shape of the trees representing them can be different. Therefore, it is possible that one of the two traversals reaches a leaf, whereas the other does not. In such a case, the traversal that did not reach a leaf, continues, but the process must remember the value in the reached leaf, since that is the value that will be added or subtracted to the value found when the continued traversal reaches a leaf. Indeed, we have three cases: (a) the processed submatrix of Mt is uniform, (b) the original submatrix of Ms is uniform and, (c) the processed submatrix after applying the differences with the snapshot has the same value in all cells. case. To obtain the value stored at cell invoked as getCell(n, r, c, 1, 1, Lmaxs[0], Lmaxt[0]), assuming that the cell at position (0,0) of the raster is that in the upper-left corner. the raster matrix Mt, Algorithm 1 shows (r, c) of the pseudocode of this it is zs is used to store the current position in the bitmap T of Ms (Ts) during the downward traversal at any given step of the algorithm, similarly, zt is the position in T of Mt (Tt). When zs (zt) has a −1 value, it means that the traversal reached a leaf and, in maxvals (maxvalt) the algorithm keeps the maximum value stored at that leaf node. Note that, Ts, Tt, Lmaxs, Lmaxt, and k are global variables. In lines 1-11, the algorithm obtains the child of the processed node that contains the queried cell, provided that in a previous step, the algorithm did not reach a leaf node (signaled with zs/zt set to −1). In maxvals (maxvalt), the algorithm stores the maximum value stored in that node. If the condition in line 12 is true, the algorithm has reached a leaf in both trees, and thus the values stored in maxvals and maxvalt are added/subtracted to obtain the final result. If the condition of line 15 is true, the algorithm reaches a leaf in the snapshot. This is signaled by setting zs to −1 and then a recursive call continues the process. The If in line 19 treats the case of reaching a leaf in Mt. If the condition of line 20 is true, the algorithm uses bitmap eqB to check if the uniformity is in Algorithm 1: getCell(n, r, c, zs, zt, maxvals, maxvalt) returns the value at cell (r, c) 1 if zs (cid:54)= −1 then 5 6 end 7 if zt (cid:54)= −1 then zs ← (rank1(Ts, zs) − 1) · k2 + 1 zs ← zs + (cid:98)r/(n/k)(cid:99) · k + (cid:98)c/(n/k)(cid:99) +1 vals ← Lmaxs[zs − 1] maxvals ← maxvals − vals zt ← (rank1(Tt, zt) − 1) · k2+1 zt ← zt + (cid:98)r/(n/k)(cid:99) · k + (cid:98)c/(n/k)(cid:99) +1 maxvalt ← Lmaxt[zt − 1]) 2 3 4 8 9 16 20 21 22 23 24 10 11 end 12 if (zs > Ts or zs = −1 or Ts[zs] = 0) and (zt > Tt or zt = −1 or Tt[zt] = 0) then /* Both leafs */ return maxvals + ZigZag Decoded(maxvalt) 13 14 end 15 else if zs > Ts or zs = −1 or Ts[zs] = 0 then /* Leaf in Snapshot */ zs ← −1 return getCell(n/k, r mod (n/k), c mod (n/k), zs, zt, maxvals, maxvalt) 17 18 end 19 else if zt > Tt or zt = −1 or Tt[zt] = 0 then /* Leaf in time instant */ if zt (cid:54)= −1 and Tt[zt] = 0 then eq ← eqB[rank0(Tt, zt)] if eq = 1 then zt ← −1 ; else return maxvals + ZigZag Decoded(maxvalt) ; end return getCell(n/k, r mod (n/k), c mod (n/k), zs, zt, maxvals, maxvalt) 25 26 end 27 else /* Both internal nodes */ 28 29 end return getCell(n/k, r mod (n/k), c mod (n/k), zs, zt, maxvals, maxvalt) the original Mt submatrix or if it is in the submatrix resulting from applying the differences between the corresponding submatrix in Ms and Mt. A 1 in eqB implies the latter case, and this is solved by setting zt to −1 and performing a recursive call. A 0 means that the treated original submatrix of Mt has the same value in all cells, and that value can be obtained adding/subtracting the values stored in maxvals and maxvalt, since the unique value in the submatrix of Mt is encoded as a difference with respect to the maximum value of the same submatrix of Ms, and thus the traversal ends. The last case is that the treated nodes are not leaves, that simply requires a recursive call. Retrieving cells with range of values in a time instant: (cid:104)[ri, ci](cid:105) ← getCells(vb, ve, r1, r2, c1, c2, t) obtains from the raster of the time instant t, the positions of all cells within a region [r1, r2] × [c1, c2] containing values in the range [vb, ve]. Again, if t is represented with a snapshot, the query is solved with the normal algorithm of the k2raster. Otherwise, as in the previous query, the search involves a synchronized top-down traversal of both trees. This time requires two main changes: (i) the traversal probably requires following several branches of both trees, since the queried region can overlap the submatrices corresponding to several nodes of the tree, (ii) at each level, the algorithm has to check whether the maximum and minimum values in those submatrices are compatible with the queried range, discarding those that fall outside the range of values sought. 5 Experimental evaluation In this section we provide experimental results to show how T−k2raster handles a dataset of raster data that evolve along time. We discuss both the space requirements of our representation and its performance at query time. We used several synthetic and real datasets to test our representation, in or- der to show its capabilities. All the datasets are obtained from the TerraClimate collection [1], that contains high-resolution time series for different variables, including temperature, precipitations, wind speed, vapor pressure, etc. All the variables in this collection are taken in monthly snapshots, from 1958 to 2017. Each snapshot is a 4320×8640 grid storing values with 1/24◦ spatial resolution. From this collection we use data from two variables: TMAX (maximum temper- ature) is used to build two synthetic datasets, and VAP (vapor pressure) is com- pressed directly using our representation. Variable TMAX is a bad scenario for our approach, since most of the cells change their value between two snapshots. In this kind of dataset, our T−k2raster would not be able to obtain good com- pression. Hence, we use TMAX to generate two synthetic datasets that simulate a slow, and approximately constant, change rate, between two real snapshots. We took the snapshots for January and February 2017 and built two synthetic datasets called T 100 and T 1000, simulating 100 and 1000 intermediate steps between both snapshots; however, note that to make comparisons easier we only take the first 100 time steps in both datasets. We also use a real dataset, VAP, that contains all the monthly snapshots of the variable VAP from 1998 to 2017. Note that, although we choose a rather small number of time instants in our ex- periments, the performance of our proposal is not affected by this value: it scales linearly in space with the number of time instants, and query times should be unaffected as long as the change rate is similar. We compared our representation with two baseline implementations. The first, called k2raster6 is a representation that stores just a full snapshot for each time instant, without trying to take advantage of similarities between close time instants. The second baseline implementation, NetCDF, stores the different raster datasets in NetCDF format, using straightforward algorithms on top of the NetCDF library7 (v.4.6.1) to implement the query operations. Note that NetCDF is a classical representation designed mainly to provide compression, through the use of Deflate compression over the data. Therefore, it is not designed to efficiently answer indexed queries. We tested cell value queries (getCellValue) and range queries (getCells). We generated sets of 1000 random queries for each query type and configuration: 1000 random cell value queries per dataset, and sets of 1000 random range 6 https://gitlab.lbd.org.es/fsilva/k2-raster 7 https://www.unidata.ucar.edu/software/netcdf/ queries for different spatial window sizes (ranging from 4×4 windows to the whole matrix), and different ranges of values (considering cells with 1 to 4 possible values). To achieve accurate results, when the total query time for a query set was too small, we repeated the full query set a suitable number of times (in practice, 100 or 1000 times) and measured the average time per query. All tests were run on an Intel (R) Core TM i7-3820 CPU @ 3.60GHz (4 cores) with 10MB of cache and 64GB of RAM, over Ubuntu 12.04.5 LTS with kernel 3.2.0-126 (64 bits). The code is compiled using gcc 4.7 with -O9 optimizations. T−k2raster (varying tδ) 20 6 10 8 4 k2raster 50 NetCDF (varying deflate level) 0 2 5 9 T 100 398.2 407.0 429.6 456.7 584.4 820.8 769.3 14241.3 615.3 539.5 528.0 T 1000 170.4 152.5 151.2 154.6 196.2 304.6 Table 1. Space requirements (in MB) of T−k2raster, k2raster and NetCDF over synthetic datasets. 496.6 14241.3 435.0 344.7 323.6 Table 1 displays the space requirements for the datasets T 100 and T 1000 in all the representations. We tested our T−k2raster with several sampling intervals tδ, and also show the results for NetCDF using several deflate levels, from level 0 (no compression) to level 9. Our representation achieves the best compression results in both datasets, especially in T 1000, as expected, due to the slower change rate. In T 100, our approach achieves the best results for tδ = 4, since as the number of changes increases our differential approach becomes much less efficient. In T 1000, the best results are also obtained for a relatively small tδ (6-8), but our proposal is still smaller than k2raster for larger tδ. NetCDF is only competitive when compression is applied, otherwise it requires roughly 20 times the space of our representations. In both datasets, NetCDF with compression enabled becomes smaller than the k2raster representation, but T−k2raster is able to obtain even smaller sizes. Fig. 3. Space/time trade-off on T 100 and T 1000 datasets for cell value queries. Figure 3 shows the space/time trade-off for the datasets T 100 and T 1000 in cell value queries. We show the results only for NetCDF with compression enabled (deflate level 2 and 5), and for T−k2raster with a sampling interval of 6 and 50. The T−k2raster is slower than the baseline k2raster, but is much smaller if a good tδ is selected. Note that we use two extreme sampling intervals to show 0.1 1 10 100 1000 10000 100000 300 400 500 600 700 800 900 1000query time (µs/query)space (Mbytes)T_100T-k2rasterk2rasterNetCDF 0 100 200 300 400 500 600space (Mbytes)T_1000T-k2rasterk2rasterNetCDF the consistency of query times, since in practice only the best approach in space would be used for a given dataset. In our experiments we work with a fixed tδ, but straightforward heuristics could be used to obtain an space-efficient T−k2raster without probing for different periods: for instance, the number of nodes in the tree of differences and in the snapshot is known during construction, so a new snapshot can be built whenever the size of the tree of differences increases above a given threshold. T−k2raster 50 6 3.6 5.1 3.8 5.5 222.9 429.3 248.1 489.4 T 100 k2raster 2.8 3.6 163.9 301.7 NetCDF 2 6130 6240 9610 9340 5 10070 10100 15330 14790 T−k2raster 50 6 3.3 3.5 3.4 3.5 207.1 228.9 213.4 234.3 T 1000 k2raster 2.5 2.6 167.6 172.7 NetCDF 2 6160 6160 9370 9510 5 10020 10100 15110 15240 wnd rng 16 256 1 4 1 4 ALL 1 111450 126220 78250 443830 580660 79650 89380 63350 436400 568730 Table 2. Range query times over T 100 and T 1000 datasets. Times shown in µs/query for different spatial windows (wnd) and range of values (rng). Table 2 shows an extract of the range query times for all the representations in datasets T 100 and T 1000. We only include here the results for T−k2raster with a tδ of 6 and 50, and for NetCDF with deflate level 2 and 5, since query times with the other parameters report similar conclusions. We also show the results for some relevant spatial window sizes and ranges of values. In all the cases, T−k2raster is around 50% slower than k2raster, due to the need of querying two trees to obtain the results. However, the much smaller space requirements of our representation compensate for this query time overhead, especially in T 1000. NetCDF, that is not designed for this kind of queries, cannot take advantage of spatial windows or ranges of values, so it is several orders of magnitude slower than the other approaches. The last query set (ALL) involves retrieving all the cells in the raster that have a given value (i.e. the spatial window covers the complete raster). In this context, NetCDF must traverse and decompress the whole raster, but our representation cannot take advantage of its spatial indexing capabilities, so this provides a fairer comparison. Nevertheless, both T−k2raster and k2raster are still several times faster than NetCDF in this case, and our proposal remains very close in query times to the k2raster baseline. Figure 4 (left) shows the space/time trade-off for the real dataset VAP. Re- sults are similar to those obtained for the previous datasets: our representation, T−k2raster, is a bit slower in cell value queries than k2raster, but also requires significantly less space. The NetCDF baseline is much slower, even if it becomes competitive in space when deflate compression is applied. Finally, Figure 4 (right) displays the query times for all the alternatives in range queries over the VAP dataset. The k2raster is again a bit faster than the T−k2raster, as expected, but the time overhead is within 50%. NetCDF is much slower, especially in queries involving small windows, as it has to traverse and decompress a large part of the dataset just to retrieve the values in the window. T−k2raster 50 6 k2raster wnd rng 4 1 2 3 4 16 1 2 3 4 64 1 2 3 4 2.2 2.0 1.9 1.7 4.3 3.7 3.3 2.9 26.4 21.1 16.8 16.2 2.2 2.0 1.8 1.7 4.2 3.7 3.4 3.0 26.1 21.6 17.3 16.6 256 1 2 3 4 239.6 242.5 207.2 218.7 181.7 187.9 142.2 146.5 1.6 1.4 1.3 1.3 3.1 2.7 2.4 2.2 19.5 16.1 12.9 12.6 179.4 161.0 140.3 112.9 NetCDF 2 5570 5530 5580 5550 5670 5630 5660 5720 6150 6140 6130 6220 8720 8660 8590 8300 5 9520 9430 9430 9470 9670 9730 9660 9740 10470 10440 10450 10660 14820 14640 14430 14020 ALL 1 60400 62900 46200 411700 552500 Fig. 4. Results for VAP dataset. Left plot shows space/time tradeoff for cell value queries. Right table shows query times for range queries. Times in µs/query. Note that even if the window covers the complete raster, T−k2raster and k2raster achieve significantly better query times. 6 Conclusions and future work In this work we introduce a new representation for time-evolving raster data. Our representation, called T−k2raster, is based on a compact data structure for raster data, the k2raster, that we extend to efficiently manage time series. Our proposal takes advantage of similarities between consecutive snapshots in the series, so it is especially efficient in datasets where few changes occur between consecutive time instants. The T−k2raster provides spatial and temporal indexing capabilities, and is also able to efficiently filter cells by value. Results show that, in datasets where the number of changes is relatively small, our representation can compress the raster and answer queries very efficiently. Even if its space efficiency depends on the dataset change rate, the T−k2raster is a good alternative to compress raster data with high temporal resolution, or slowly-changing datasets, in small space. As future work, we plan to apply to our representation some improvements that have already been proposed for the k2raster, such as the use of specific compression techniques in the last level of the tree. We also plan to develop an adaptive construction algorithm, that selects an optimal, or near-optimal, distribution of snapshots to maximize compression. 0.1 1 10 100 1000 10000 100000 50 100 150 200 250 300query time (µs/query)space (Mbytes)VAP cell value queriesT-k2rasterk2rasterNetCDF References 1. Abatzoglou, J.T., Dobrowski, S.Z., Parks, S.A., Hegewisch, K.C.: Terraclimate, a high-resolution global dataset of monthly climate and climatic water balance from 1958 -- 2015. Scientific Data 5(170191) (2017) 2. de Bernardo, G., ´Alvarez-Garc´ıa, S., Brisaboa, N.R., Navarro, G., Pedreira, O.: Compact Querieable Representations of Raster Data. In: Proceedings of the International Symposium on String Processing and Information Retrieval (SPIRE). pp. 96 -- 108 (2013) 3. Botea, V., Mallett, D., Nascimento, M.A., Sander, J.: Pist: An efficient and prac- tical indexing technique for historical spatio-temporal point data. GeoInformatica 12(2), 143 -- 168 (2008) 4. Brisaboa, N.R., Ladra, S., Navarro, G.: DACs: Bringing direct access to variable- length codes. Information Processing and Management 49(1), 392 -- 404 (2013) 5. Brisaboa, N.R., Ladra, S., Navarro, G.: Compact representation of web graphs with extended functionality. Information Systems 39(1), 152 -- 174 (2014) 6. Couclelis, H.: People manipulate objects (but cultivate fields): Beyond the raster- vector debate in GIS. In: Proceedings of GIS: from space to territory - theories and methods of spatio-temporal reasoning. pp. 65 -- 77 (1992) 7. Jacobson, G.: Succinct static data structures. Ph.D. thesis, Carnegie-Mellon (1988) 8. Ladra, S., Param´a, J.R., Silva-Coira, F.: Scalable and queryable compressed storage structure for raster data. Information Systems (72), 179 -- 204 (2017) 9. Mennis, J., Viger, R., Tomlin, C.D.: Cubic map algebra functions for spatio- temporal analysis. Cartography and Geographic Information Science 32(1), 17 -- 32 (2005) 10. Nascimento, M.A., Silva, J.R.O.: Towards historical R-trees. In: Proceedings of the 1998 ACM symposium on Applied Computing, SAC'98. pp. 235 -- 240. ACM (1998) 11. Navarro, G.: Compact Data Structures -- A practical approach. Cambridge Uni- versity Press (2016) 12. Pinto, A., Seco, D., Guti´errez, G.: Improved queryable representations of rasters. In: Proceedings of the 2017 Data Compression Conference (DCC). pp. 320 -- 329 (2017) 13. Tao, Y., Papadias, D.: MV3R-tree: A spatio-temporal access method for timestamp and interval queries. In: Proceedings of the 27th International Conference on Very Large Data Bases (VLDB). pp. 431 -- 440 (2001) 14. Vazirgiannis, M., Theodoridis, Y., Sellis, T.K.: Spatio-temporal composition and indexing for large multimedia applications. ACM Multimedia Systems Journal 6(4), 284 -- 298 (1998)
1611.06222
2
1611
2017-07-24T13:21:13
Approximate Near Neighbors for General Symmetric Norms
[ "cs.DS", "cs.CG", "cs.LG", "math.MG" ]
We show that every symmetric normed space admits an efficient nearest neighbor search data structure with doubly-logarithmic approximation. Specifically, for every $n$, $d = n^{o(1)}$, and every $d$-dimensional symmetric norm $\|\cdot\|$, there exists a data structure for $\mathrm{poly}(\log \log n)$-approximate nearest neighbor search over $\|\cdot\|$ for $n$-point datasets achieving $n^{o(1)}$ query time and $n^{1+o(1)}$ space. The main technical ingredient of the algorithm is a low-distortion embedding of a symmetric norm into a low-dimensional iterated product of top-$k$ norms. We also show that our techniques cannot be extended to general norms.
cs.DS
cs
Approximate Near Neighbors for General Symmetric Norms Alexandr Andoni Columbia University Huy L. Nguyen Northeastern University Aleksandar Nikolov University of Toronto [email protected] [email protected] [email protected] Ilya Razenshteyn MIT CSAIL [email protected] Erik Waingarten Columbia University [email protected] July 25, 2017 Abstract We show that every symmetric normed space admits an efficient nearest neighbor search data structure with doubly-logarithmic approximation. Specifically, for every n, d = no(1), and every d-dimensional symmetric norm k · k, there exists a data structure for poly(log log n)-approximate nearest neighbor search over k·k for n-point datasets achieving no(1) query time and n1+o(1) space. The main technical ingredient of the algorithm is a low-distortion embedding of a symmetric norm into a low-dimensional iterated product of top-k norms. We also show that our techniques cannot be extended to general norms. 7 1 0 2 l u J 4 2 ] S D . s c [ 2 v 2 2 2 6 0 . 1 1 6 1 : v i X r a Introduction 1 The Approximate Near Neighbor problem (ANN) is defined as follows. The input is a dataset P lying in a metric space (X, dX), a distance threshold r > 0, and a desired approximation c > 1. The goal is to preprocess P so that, given a query point q ∈ X, with the promise that at least one of the data points is within distance r, output a data point within distance cr from q. The ANN problem is an important tool in modern data analysis, and, at the same time, is a source of many exciting theoretical developments, see, e.g., the survey in [And16]. In many applications, the metric is defined on d-dimensional real vectors Rd. Depending on the relation between the dimension d and the number of data points n, two main regimes have emerged: low- and high-dimensional. The low-dimensional regime corresponds to d = o(log n); hence algorithms can afford to be exponential in the dimension. In the low-dimensional regime, efficient ANN algorithms are known for any metric space [Cla99, KR02, KL04, BKL06]. In this paper, we focus on the high-dimensional regime, when ω(log n) ≤ d ≤ no(1), which is relevant for many applications. The best-studied metrics are the Hamming ('1) and the Euclidean ('2) distances. There are good reasons for this: '1 and '2 are very common in applications and admit very efficient algorithms based on hashing, in particular, Locality-Sensitive Hashing (LSH) [IM98, AI06] and its data-dependent versions [AINR14, AR15]. Hashing-based algorithms for ANN over '1/'2 have now been the subject of a two-decade-long line of work, leading to a very good understanding of algorithms and their limitations. All such algorithms for c-approximate ANN obtain space n1+ρu+o(1) and query time nρq+o(1) for some exponents ρu and ρq < 1 dependent on c; e.g., the most recent paper [ALRW17] gives tight time–space trade-offs for every approximation factor c > 1.1 We point the reader to [HIM12] and [ALRW17], which summarize the state of affairs of the high-dimensional ANN over '1/'2. A practical perspective is presented in the surveys [WSSJ14, WLKC15]. Beyond '1 and '2, the landscape of ANN is much more mysterious, despite having received significant attention. In 1998, [Ind01] showed an efficient data structure for '∞ for c = O(log log d) approximation. There are a few extensions of this result to other metrics, some of which proceed via embedding a metric into '∞ (see Section 1.3). However, we are still very far from having a general recipe for ANN data structures for general metrics with a non-trivial approximation; this is in stark contrast with the success of the low-dimensional regime. This state of affairs motivates the following broad question. Problem 1. For a given approximation c > 1, which metric spaces allow efficient ANN algorithms? An algorithm for general metrics is highly desirable both in theory and in practice. From the theoretical perspective, we are interested in a common theory of ANN algorithms for a wide class of distances. Such a theory would yield data structures (or impossibility results) for a variety of important distance measures for which we still do not know efficient ANN algorithms (e.g., matrix norms, the Earth Mover's Distance (EMD), the edit distance, etc.). Perhaps even more tantalizing is understanding what exactly makes some distances harder than others, and how to quantify that hardness. From the practical perspective, it is also desirable to have a generic algorithm: one that either uses the underlying distance measure as a black box, or provides a "knob" to easily specialize to any desired distance. In practice, one must oftentimes tune the distance to the specifics of the application, and hence algorithms that allow such tuning without major re-implementations are preferred. In this paper, we focus on the following important case of Problem 1. 1The exact dependence, for '2, is that one can achieve any ρu, ρq ≥ 0 satisfying c2√ ρq + (c2 − 1)√ ρu = √ 2c2 − 1. 1 Problem 2. Solve Problem 1 for high-dimensional normed spaces. Norms are important for two reasons. First, most metric spaces arising in applications are actually norms (e.g., the Earth-Mover Distance [NS07]). Second, norms are geometrically nicer than general metrics, so there is hope for a coherent theory (e.g., for the problems of sketching and streaming norms, see the generic results of [AKR15, BBC+15]). Using embeddings into '2 [Joh48, Bal97], one can solve ANN for any norm with approximation O 0 < ε < 1/2 is a constant; however, no better results are known in general. (cid:17), space n1+ε, and query time nε, where (cid:16)pd/ε 1.1 Our main result In this paper we nearly settle Problem 2 for symmetric norms, i.e., norms that are invariant under all permutations and changes of signs of the coordinates of a vector. We show the following general result: Theorem 1.1. For every n, d = no(1), and every d-dimensional symmetric norm k · k, there exists a data structure for ANN over k · k for n-point datasets with approximation (log log n)O(1) space n1+o(1), and query time no(1). We note that the techniques behind Theorem 1.1 cannot be extended to general norms; see details in Section 1.6. 1.2 Why symmetric norms? The class of symmetric norms is, in some sense, a sweet spot. On the one hand, symmetric norms are mathematically nice and, as we show, allow for a clean characterization that leads to an efficient ANN data structure (see the proof overview from Section 1.4). On the other hand, symmetric norms vastly generalize 'p distances and enable many new interesting examples, some of which arise in applications. We first consider the following two examples of symmetric norms, which are crucial for the subsequent discussion. The first important example is the top-k norm: the sum of k largest absolute values of the coordinates of a vector; k = 1 corresponds to '∞, while k = d corresponds to '1. Another rich set of examples is that of Orlicz norms: for any non-zero convex function G : R+ → R+ such that G(0) = 0, we define the unit ball of a norm k · kG to be: x ∈ Rd (cid:12)(cid:12)(cid:12) n dX i=1 G(cid:0)xi(cid:1) ≤ 1o . Clearly, for 1 ≤ p < ∞ the 'p norm is Orlicz via G(t) = tp. In statistics and machine learning, Orlicz norms are known as M-estimators (for the case of convex losses) [CW15]. A specific example is the Huber loss. Even though non-convex losses do not correspond to norms, our algorithm still can handle them (see Section 3). Other examples of symmetric norms used in applications include: • k-support norm [AFS12] used for the sparse regression problem; its unit ball is the convex hull of • box-Θ norm [MPS14] (again, used for sparse regression), defined for 0 < a < b ≤ c and Θ = {θ ∈ {x x is k-sparse,kxk2 ≤ 1}, [a, b]d kθk1 ≤ c} as kxk = minθ∈Θ , and its dual; (cid:18)Pd x2 i θi i=1 (cid:19)1/2 2 (cid:12)(cid:12)(cid:12) x1 + x2 = x • K-functional [DMS93] used to show tight tail bounds, defined for t > 0 as kxk = minnkx1k1 + t · • k · k1,2,s norms [KW16] used for dimension reduction, defined as kxk =(cid:0)P , where S1 is the set of s largest absolute values of coordinates of x, S2 is the set of next s largest coordinates, etc. i kxSik2 1 (cid:1)1/2 kx2k2 o , Finally, we show two simple ways to construct many interesting examples of symmetric norms. Let 0 = a0 ≤ a1 ≤ a2 ≤ . . . ≤ ad be a non-decreasing sub-additive2 sequence. We can define two norms associated with it [BS88]: a minimal norm is defined as and a maximal norm is equal to kxk = max ak · (average of the largest k absolute values of the coordinates of x) , 1≤k≤d dX (ak − ak−1) · (k-th largest absolute value of a coordinate of x) . kxk = k=1 The minimal norm is the smallest norm such that for every k one has: (cid:13)(cid:13)(cid:13)(1, 1, . . . , 1 } {z k (cid:13)(cid:13)(cid:13) = ak. , 0, 0, . . . , 0) Similarly, the maximal norm is the largest such norm. Minimal norms will provide hard examples of symmetric norms that preclude some simple(r) approaches to ANN (see Section B.1). We also note that the dual (with respect to the standard dot product) of any symmetric norm is symmetric as well. d(cid:1). 1.3 Prior work: ANN for norms beyond '1 and '2 For norms beyond '1 and '2, the cornerstone result in ANN is a data structure for '∞ due to Indyk [Ind01]. For every ε > 0, the data structure achieves space n1+ε, query time no(1), and approximation Oε(log log d). This is a doubly-exponential improvement over embeddings of '∞ into '1/'2 which require distortion Ω(cid:0)√ It is well-known [Woj91] that any d-dimensional normed space embeds into '∞ with distortion (1 + ε), which raises the question: can we combine this embedding with the result from [Ind01] to solve ANN for any norm? It turns out that the answer is negative: accommodating a norm of interest may require embedding into a very high-dimensional '∞. In the worst case, we need 2Oε(d) dimensions, and this bound is known to be tight [Bal97], even for spaces as simple as '2. Even though this approach would give a non-trivial approximation of O(log log 2O(d)) = O(log d), the resulting data structure has query time which is exponential in d; thus, this approach is interesting only for the low-dimensional regime d = o(log n). The result of [Ind01] has been extended as follows. In [Ind02, Ind04, AIK09, And09] it was shown how to build data structures for ANN over arbitrary 'p-products of metrics given that there exists an ANN data structure for every factor. Recall that the 'p-product of metric spaces M1, M2, . . . , Mk is a metric space with the ground set M1 × M2 × . . . × Mk and the following distance function: d(cid:0)(x1, x2, . . . , xk), (y1, y2, . . . , yk)(cid:1) = (cid:13)(cid:13)(cid:13)(cid:0)dM1(x1, y1), dM2(x2, y2), . . . , dMk(xk, yk)(cid:1)(cid:13)(cid:13)(cid:13)p . 2For every n, m, one has an+m ≤ an + am. 3 In a nutshell, if we can build efficient ANN data structures for every Mi with approximation c, there exist an efficient data structure for ANN over the product space with approximation O(c · log log n). Note that the above also implies ANN for the standard 'p, though for this case a better approximation O(log log d) is possible via randomized embeddings into '∞ [And09]. For small values of p, one can also get c = 2O(p) [NR06, BG15] using different techniques. 1.4 Overview of the proof of Theorem 1.1 We prove Theorem 1.1 in three steps. • First, we build a data structure for d-dimensional top-k norms. We proceed by constructing a randomized embedding into d-dimensional '∞ with constant distortion, and then invoke the data structure for ANN over '∞ from [Ind01]. Our embedding is a refinement of the technique of max-p-stable distributions used in [And09] to embed 'p into '∞. Surprisingly, the technique turns out to be very general, and can handle top-k norms as well an arbitrary Orlicz norm. While this technique can handle even arbitrary symmetric norms (see Appendix B), there exist symmetric norms, for which this approach leads to merely a logΩ(1) d-approximation, which is exponentially worse than the bound we are aiming at (see Section B.1). • To bypass the above limitation and obtain the desired (log log n)O(1)-approximation, we show the following structural result: any d-dimensional symmetric norm allows a constant-distortion (deterministic) embedding into a low-dimensional iterated product of top-k norms. More specifically, the host space Y is an '∞-product of dO(1) copies of the '1-product of X1, X2, . . . , Xd, where Xk is Rd equipped with the top-k norm. The dimension of Y is dO(1) which is significantly better than the bound 2Ω(d) necessary to embed symmetric norms (even '2) into '∞. It is exactly this improvement over the naïve approach that allows us to handle any dimension d = no(1) as opposed to the trivial o(log n). • Finally, we use known results [Ind02, And09], which allow us to construct a data structure for ANN over a product space if we have ANN data structures for the individual factors. Each such step incurs an additional log log n factor in the resulting approximation. Since we have built a data structure for top-k norms, and can embed a symmetric norm into an iterated product of top-k norms, we are done! Embeddings into iterated product spaces have been successfully used before for constructing data structures for ANN over Fréchet distance [Ind02], edit distance [Ind04], and Ulam distance [AIK09]. Theorem 1.1 gives yet another confirmation of the power of the technique. 1.5 Optimality of Theorem 1.1 There remains one aspects of Theorem 1.1 that can potentially be improved: the approximation factor (log log n)O(1). One of the bottlenecks for our algorithm is the ANN data structure for '∞ from [Ind01], which gives O(log log d) approximation. This bound is known to be tight [ACP08, KP12] for certain models of computation (in particular, for decision trees, which captures the result of [Ind01]). Thus, going beyond approximation Ω(log log d) in Theorem 1.1 might be hard; however, it remains entirely possible to improve the approximation from (log log n)O(1) to O(log log d), which we leave as an open question. 4 1.6 Lower bounds for general norms The second step of the proof of Theorem 1.1 (see Section 1.4) shows how to embed any d-dimensional symmetric norm into a universal normed space of dimension dO(1) with a constant distortion. In contrast, we show that for general norms a similar universal construction is impossible. More formally, for a fixed 0 < ε < 1/3, suppose U is a normed space such that for every d-dimensional normed space X there exists a randomized linear embedding of X into U with distortion O(d1/2−ε). dΩε(1)(cid:17). By John's theorem [Joh48], d-dimensional '2 is Then, U must have dimension at least exp(cid:16) d, so our lower bound is tight up to sub-polynomial factors. See a universal space for distortion Section 6 for details. √ To take this a step further, it would be highly desirable to prove stronger hardness results for ANN over general norms. One approach would be to show that such a norm X has high robust expansion, which is a property used to deduce ANN lower bounds [PTW10, ALRW17]. There exist metrics M that have high robust expansion, such as the shortest path metric of a spectral expander (see Appendix C). To obtain a hard norm, it suffices to embed such an N-point metric M into a logO(1) N-dimensional norm with a constant distortion. The result of [Mat96] shows that there exist N-point metrics M which cannot be embedded into any norm of dimension N o(1). However, these metrics are not expanders, and for expanders such a dimension reduction procedure might be possible. 3 1.7 Other related work: dealing with general norms The recent result of [BBC+15] completely characterizes the streaming complexity of any symmetric norm. Even though many symmetric norms (including '∞) are hard in the streaming model, the state of affairs with ANN is arguably much nicer. In particular, our results imply that all symmetric norms have highly efficient ANN data structures. We also point out that streaming algorithms for the special case of Orlicz norms have been studied earlier [BO10]. Another related work is [AKR15], which shows that for norms, the existence of good sketches is equivalent to uniform embeddability into '2. Sketches are known to imply efficient ANN data structures, but since many symmetric norms do not embed into '2 uniformly, we conclude that ANN is provably easier than sketching for a large class of norms. Finally, we also mention the work of [AV15], who study ANN under the class of high-dimensional distances which are Bregman divergences. These results are somewhat disjoint since the Bregman divergences are not norms. 2 Preliminaries 2.1 Norms and products We denote non-negative real numbers by R+. For any subset A ⊆ R, we let χA : R → {0, 1} be the indicator function of A. Let X be a normed space over Rd. We denote BX the unit ball of X, and k · kX the norm of X. We denote X∗ the dual norm of X with respect to the standard dot product h·,·i, i.e kxkX∗ = sup{hx, yi : y ∈ BX}. For a vector x ∈ Rd we define x = (x1,x2, . . . ,xd) to be the vector of the absolute values of the coordinates of x. For a positive integer d and 1 ≤ p ≤ ∞, we denote 'd p the space Rd equipped with the standard 'p norm, which we denote by k · kp. 3In a recent work, Naor [Nao17] showed that this approach is impossible. He shows that embedding an N-point spectral expander with constant distortion into any normed space requires poly(N) dimensions. 5 Definition 2.1. For any vector x ∈ Rd, we let x∗ = Px be the vector obtained by applying the permutation matrix P to x so coordinates of x∗ are sorted in non-increasing absolute value. Definition 2.2 (Symmetric norm). A norm k · kX : Rd → R is symmetric if for every x ∈ Rd, kxkX = = kx∗kX. (cid:13)(cid:13)(cid:13)x(cid:13)(cid:13)(cid:13)X See the introduction for examples of symmetric norms. We note once again that the dual norm of a symmetric norm is also symmetric. A natural way to combine norms is via product spaces, which we will heavily exploit in this paper. spaces. We define the 'p-product space, denoted L Definition 2.3 (Product space). Let 1 ≤ p ≤ ∞. Let (X1, dX1), (X2, dX2), . . . , (Xk, dXk) be metric 'p Xi, to be a metric space whose ground set is X1×X2×. . .×Xk, and the distance function is defined as follows: the distance between (x1, x2, . . . , xk) and (x0 k) is defined as the 'p norm of the vector(cid:0)dX1(x1, x0 2), . . . , dXk(xk, x0 1), dX2(x1, x0 2, . . . , x0 k)(cid:1). 1, x0 Next we define the top-k norm: Definition 2.4. For any k ∈ [d], the top-k norm, k · kT (k) : Rd → R, is the sum of the absolute values of the top k coordinates. In other words, kxkT (k) = x∗ i, kX i=1 where x∗ is the vector obtained in Definition 2.1. Definition 2.5. Given vectors x, y ∈ Rd, we say x weakly majorizes y if for all k ∈ [d], kX i=1 i ≥ kX x∗ i=1 y∗ i . Lemma 2.6 (Theorem B.2 in [MOA11]). If x, y ∈ Rd where x weakly majorizes y, then for any symmetric norm k · kX, kxkX ≥ kykX . Definition 2.7. For i ∈ [d], let ξ(i) ∈ Rd be the vector {z } ξ(i) = (1, . . . , 1 , 0, . . . , 0 {z } ) i d−i consisting of exactly i 1's, and d − i 0's. 2.2 ANN for '∞ and '∞-products We will crucially use the following two powerful results of Indyk. The first result is for the standard d-dimensional '∞ space. Theorem 2.8 ([Ind01, Theorem 1]). For any ε ∈ (0, 1/2), there exists a data structure for ANN for n-points datasets in the 'd∞ space with approximation O time O(d · log n). (cid:17), space O(d · n1+ε), and query (cid:16) log log d ε 6 The second is a generalization of the above theorem, which applies to an '∞-product of k metrics X1, . . . Xk, and achieves approximation O(log log n). It only needs black-box ANN schemes for each metric Xi. Theorem 2.9 ([Ind02, Theorem 1]). Let X1, X2, . . . , Xk be metric space, and let c > 1 be a real number. Suppose that for every 1 ≤ i ≤ k and every n there exists a data structure for ANN for n-point datasets from Xi with approximation c, space S(n) ≥ n, query time Q(n), and probability of success 0.99. Then, for every ε > 0, there exists ANN under Lk '∞ M with: • O(ε−1 log log n) approximation, • O(Q(n) log n + dk log n) query time, where d is the time to compute distances in each Xi, and • S(n) · O(knε) space/preprocessing. Strictly speaking, we need to impose a technical condition on the ANN for each Xi - that it reports the point with the smallest priority - which is satisfied in all our scenarios; see [Ind02, Section 2] for details. Also, the original statement of [Ind02] gave a somewhat worse space bound. The better space results simply from a better analysis of the algorithm, as was observed in [AIK09]; we include a proof in Appendix A. 3 ANN for Orlicz and top-k norms Before showing a data structure for general symmetric norms, we give an algorithm for general Orlicz norms. We then show how to apply these ideas to top-k norms. This restricted setting has a simple analysis and illustrates one of the main techniques used in the rest of the paper. A similar approach was used in prior work to construct randomized embeddings of 'p norms into '∞, and solve the ANN search problem; here we show that these techniques are in fact applicable in much greater generality. Lemma 3.1. Let k · kG be an Orlicz norm. For every D, α > 1 and every µ ∈ (0, 1/2) there exists a randomized linear map f : Rd → Rd such that for every x ∈ Rd: • if kxkG ≤ 1, then Prf • if kxkG > αD, then Prf h(cid:13)(cid:13)f(x)(cid:13)(cid:13)∞ ≤ 1i ≥ µ; h(cid:13)(cid:13)f(x)(cid:13)(cid:13)∞ > D i ≥ 1 − µα. Proof. Let the distribution D over R+ have the following CDF F : R+ → [0, 1]: F(t) = Pr u∼D[u ≤ t] = 1 − µG(t). Consider the following randomized linear map f : Rd → Rd: (cid:18) x1 x2 u2 (cid:19) xd ud where u1, . . . , ud ∼ D are i.i.d. samples from D. Suppose that kxkG ≤ 1. Then, Pd u1 , . . . , , (x1, x2, . . . , xd) f7→ i=1 G(xi) ≤ 1. This, in turn, implies: hkf(x)k∞ ≤ 1i = Pr f dY i=1 Pr ui∼D (cid:20)(cid:12)(cid:12)(cid:12)(cid:12) xi ui (cid:21) (cid:12)(cid:12)(cid:12)(cid:12) ≤ 1 dY i=1 = Pd i=1 G(xi) ≥ µ. µG(xi) = µ 7 Now suppose that kxkG > αD. This, together with the convexity of G(·), implies: (cid:18)xi (cid:19) αD G ≥ α. (cid:18)xi (cid:19) dX i=1 G ≥ (1 − α)G(0) + α · dX (cid:20)(cid:12)(cid:12)(cid:12)(cid:12) xi (cid:12)(cid:12)(cid:12)(cid:12) ≤ D dY (cid:21) i=1 = ui i=1 Pr ui∼D D dY i=1 Thus, we have: hkf(x)k∞ ≤ D i = Pr f Pd i=1 G(xi/D) ≤ µα. µG(xi/D) = µ Theorem 3.2. For every d-dimensional Orlicz norm k · kG and every ε ∈ (0, 1/2), there exists a data structure for ANN over k·kG, which achieves approximation O and query time O (dnε). Proof. Let P ⊂ Rd be a dataset of n points. Consider the data structure which does the following: 1. For all 1 ≤ i ≤ nε, we independently apply the randomized linear map f from Lemma 3.1 (cid:17) using space O(cid:0)dn1+ε(cid:1) (cid:16) log log d ε2 with parameters µ = n−ε, D = O (cid:17), and α = 2 (cid:16) log log d Pi = {fi(x) x ∈ P} ε ε. We define to be the image of the dataset under fi, where fi is the i-th independent copy of f. 2. For each 1 ≤ i ≤ nε, we use Theorem 2.8 to build a data structure for ANN over '∞ with approximation D for dataset Pi. We refer to the i-th data structure as Ti. Each Ti occupies space O(dn1+ε) and achieves approximation D with query time O(d log n). To answer a query q ∈ Rd, we query Ti with fi(q) for each i ∈ [nε]. Let xi be the point returned by Ti, and let pi ∈ P be the pre-image of xi under fi, so that fi(pi) = xi. If for some Ti, the point returned satisfies kpi − qkG ≤ αD, then we return pi. • If there exists some p ∈ P with kp − qkG ≤ 1, then by Lemma 3.1, with probability 1 − (1 − n−ε)nε ≥ 3 5, some fi has kfi(p− q)k∞ ≤ 1. Since fi is linear, kfi(p)− fi(q)k∞ ≤ 1 as well. • Let i ∈ [nε] be an index where some p ∈ P with kp− qkG ≤ 1 has kfi(p)− fi(q)k∞ ≤ 1. Every other p0 ∈ P with kp0 − qkG ≥ αD satisfies Prhkfi(p0) − fi(q)k∞ ≤ D i ≤ 1 n2 . A union bound over at most n points with distance greater than αD to q shows that except n, Ti returns some pi ∈ P with kpi − qkG ≤ αD. Thus, the total with probability at most 1 The total query time is O (dnε · log n) and the total space used is O(cid:0)dn1+2ε(cid:1). This data structure probability of success of the data structure is at least 3 (cid:17). Decreasing ε by a constant factor, we get the desired (cid:16) log log d 5 − 1 n. achieves approximation αD = O guarantees. ε2 8 Remark. The construction of the randomized embedding in Lemma 3.1 and the data structure from Theorem 3.2 work in a somewhat more general setting, rather than just for Orlicz norms. For a fixed norm k · k, we can build a randomized map f : Rd → Rd with the guarantees of Lemma 3.1 if there exists a non-decreasing G: R+ → R+ where G(0) = 0, G(t) → ∞ as t → ∞, and for every x ∈ Rd: • if kxk ≤ 1, thenPd • if kxk ≥ αD, thenPd i=1 G(xi) ≤ 1, and (cid:16)xi D (cid:17) ≥ α. i=1 G The data structure itself just requires the existence of a randomized linear map satisfying the conditions of Lemma 3.1. We now describe how to obtain a data structure for ANN for any top-k norm. Lemma 3.3. Fix any k ∈ [d]. For every D, α > 1 and every µ ∈ (0, 1/2), there exists a randomized linear map f : Rd → Rd such that for every x ∈ Rd: • if kxkT (k) ≤ 1, then Prf • if kxkT (k) > αD, then Prf hkf(x)k∞ ≤ 1i ≥ µ; hkf(x)k∞ > D i ≥ 1 − µα−1. Proof. We define G: R+ → R+ where for every x ∈ Rd, k ,∞)(t) If kxkT (k) ≤ 1, there are at most k coordinates where xi ≥ 1 i=1 G G(t) = t · χ[ 1 i ≥ αD. Therefore,Pd 1. If kxkT (k) ≥ αD, thenPk i=1 x∗ proof now follows in the same way as Lemma 3.1. k. Therefore,Pd (cid:16)x∗ (cid:17) ≥Pk i D i=1 G (cid:16)x∗ i=1 G(xi) ≤ kxkT (k) ≤ (cid:17) ≥ α − 1. The i D Lemma 3.3 gives us a data structure for any top-k norm with approximation O(log log d) applying Theorem 3.2. One could imagine using a similar argument to design an algorithm for general symmetric norms. This idea indeed works and yields an algorithm with approximation eO(log d) for a general symmetric norm (see Appendix B for a detailed analysis of this approach). However, we show this strategy √ cannot achieve an approximation better than Ω( log d) (see the end of the same Appendix B). 4 Embedding symmetric norms into product spaces In this section, we construct an embedding of general symmetric norms into product spaces of top-k norms. To state the main result of this section, we need the following definition. Definition 4.1. For any c1, . . . , cd ≥ 0, let Ld '1 T (c) ⊂ Rd2 be the space given by the seminorm T,1 · Rd2 → R where for x = (x1, . . . , xd) ∈ Rd2 and x1, . . . , xd ∈ Rd: dX k · k(c) kxk(c) T,1 = ckkxkkT (k). k=1 9 Ld Theorem 4.2 (Embedding into a product space). For any constant δ ∈ (0, 1/2), any symmetric '1 T (c) where norm k · kX : Rd → R can be embedded linearly with distortion 1 + δ into Lt + such that for every x ∈ Rd, t = dO(log(1/δ)δ−1). In particular, there exists c ∈ Rt×d '∞ dX ! '∞ k=1 ci,kkxkT (k) ≤ (1 + δ)kxkX . The vectors inLt (1 − δ)kxkX ≤ max i∈[t] Ld '1 T (c) ⊂ Rtd2 can be broken up into td blocks of d coordinates each. The embedding referenced above will simply map x ∈ Rd into Rtd2 by making each of the td many blocks equal to a copy of x. The non-trivial part of the above theorem is setting the constants ci,k for i ∈ [t] and k ∈ [d] so (1) holds. Before going on to give the proof of Theorem 4.2, we establish some definitions and propositions which will be used in the proof. For the subsequent sections, let β ∈ (1, 2) be considered a constant close to 1. Definition 4.3 (Levels and Level Vectors). For any fixed vector x ∈ Rd and any k ∈ Z, we define level k with respect to x as Bk(x) = {i ∈ [d] β−k−1 < xi ≤ β−k}. Additionally, we let bk(x) = Bk(x) be the size of level k with respect to x. The level vector of x, V (x) ∈ Rd is given by (1) V (x) = (βk, . . . , βk b−k(x) times } } , βk−1, . . . , βk−1 b−k+1(x) times {z } , . . . , β−k, . . . , β−k bk(x) times {z {z , 0, . . . 0) where k is some integer such that all non-zero coordinates lie in some level between −k and k. We say the i-th level vector Vi(x) ∈ Rd is given by } Vi(x) = (β−i, . . . , β−i bi(x) times , 0, . . . , 0). {z The notation used for level vectors appears in [BBC+15]; however, we refer to level k as the coordinates of x lying in (β−k−1, β−k]; whereas [BBC+15] refers to level k as the coordinates of x lying in [βk−1, βk). Definition 4.4. Fix some τ > 0. For any vector x ∈ Rd, let C(x) ∈ Rd be the vector where each i ∈ [d] sets ( C(x)i = xi ≥ τ xi < τ . xi 0 Proposition 4.5 (Proposition 3.4 in [BBC+15]). Let k · kX be any symmetric norm and x ∈ Rd be any vector. Then 1 β kV (x)kX ≤ kxkX ≤ kV (x)kX . Proposition 4.6. Let k · kX be any symmetric norm. For any vector x ∈ Rd, kxkX − τ d ≤ kC(x)kX ≤ kxkX . Proof. Note that x weakly majorizes C(x), so kC(x)kX ≤ kxkX. For the other direction, let v = x − C(x). Then v has all coordinates with absolute value at most τ, so τ dξ(1) weakly majorizes v. Therefore, kxkX ≤ kC(x)kX + kvkX ≤ kC(x)kX + τ d. 10 Intuitively, the above two propositions say that up to multiplicative loss β and additive loss τ d in the norm of the vector, we may assume that all coordinates are exactly βj for j ≥ logβ(τ). Thus, if x ∈ Rd, then kxkX − τ d ≤ kV (C(x))kX ≤ βkxkX . d2 , so when kxkX ≤ 1 there are at most 2 logβ d non-empty levels in If additionally, we let τ = β V (C(x)). Definition 4.7 (Rounded counts vector). Fix any level vector x ∈ Rd. The rounded counts vector of x, W(x) ∈ Rd is given by y where the y ∈ Rd is constructed using the following procedure: 1: Initialize y = (0, . . . , 0) ∈ Rd and c = d. 2: for k = −∞, . . . , 2 logβ(d) − 1 do 3: 4: 5: 6: 7: 8: 9: end for 10: Return y Let j ∈ Z+ be the integer where βj−1 < bk(x) ≤ βj. if c ≥ bβjc then Set the first bβjc zero-coordinates of y with β−k. Update c ← c − bβ−kc. if bk(x) ≥ 0 then end if end if Intuitively, W(x) represents the level vector of x where we ignore coordinates smaller than β d2 , and additionally, we round the counts of coordinates to powers of β. Lemma 4.8. For every vector x ∈ Rd and any symmetric norm k · kX, kxkX − τ d ≤ kW(V (C(x)))kX ≤ β2kxkX . Proof. The bound kxkX − τ d ≤ kW(V (C(x)))kX follows by combining Proposition 4.5 and Propo- sition 4.6, as well as the monotonicity of norms. The bound kW(V (C(x)))kX ≤ β2kxkX follows from Proposition 4.5, Proposition 4.6, as well as Lemma 3.5 from [BBC+15]. In order to simplify notation, we let R: Rd → Rd given by R(x) = W(V (C(x))). Definition 4.9. Let the set L ⊂ Rd+ be given by L = {y ∈ Rd+ y1 ≥ . . . yd ≥ 0}. Additionally, for an arbitrary symmetric norm k · kX with dual norm k · kX∗, we let the set R ⊂ L be given by R = {R(y) ∈ Rd+ y ∈ L ∩ BX∗}. Definition 4.10. Fix a vector y ∈ L \ {0} (y has non-negative, non-increasing coordinates). Let the maximal seminorm with respect to y, k · ky : Rd → R be the seminorm where for every x ∈ Rd, kxky = hx∗, yi. We first show there exists some setting of c ∈ Rd such that we may compute kxky as ⊕d Lemma 4.11. For every vector y ∈ L \ {0}, there exists c1, . . . , cd ≥ 0 where for all x ∈ Rd, '1T (c). kxky = kxk(c) T,1. 11 Proof. For k ∈ [d], we let ck = yk − yk+1, where yd+1 = 0. dX dX dX dX ! hx∗, yi = x∗ iyi = x∗ i i=1 i=1 k=i ck = ck k=1 ! i x∗ kX i=1 dX k=1 = ckkxkT (k) Given Lemma 4.11, it suffices to show that for an arbitrary symmetric norm k · kX, we may compute kxkX (with some distortion) as a maximum over many maximal seminorms. In the following lemma, we show that taking the maximum over maximal norms from R suffices, but gives sub-optimal parameters. We then improve the parameters to prove Theorem 4.2. Lemma 4.12. Let k · kX be an arbitrary symmetric norm and let k · kX∗ be its dual norm. Then for any kxkX ≤ 1, kxkX − τ d ≤ max y∈R kxky ≤ β2kxkX . Proof. Without loss of generality, we rescale the norm so that ke1kX∗ = 1, where e1 is the first standard basis vector. Consider any x ∈ Rd with kxkX ≤ 1. Then since k · kX is symmetric, we may assume without loss of generality that all coordinates of x are non-negative and in non-increasing order. Thus for each y ∈ L ∩ {0}, we have kxky = hx, yi. The lower bound simply follows from the fact that R(z), other than coordinates less than τ, is monotonically above z, and all coordinates in x are non-negative. More specifically, y∈R hx, yi + τ d, hx, R(z)i + τ d = max kxkX = sup hx, zi ≤ sup z∈L∩BX∗ z∈L∩BX∗ where τ d comes from the fact that because kxkX ≤ 1, every coordinate of x is at most 1. On the other hand, we have y∈R hx, yi = β2 max max y∈R hx, y β2i ≤ β2 sup z∈BX∗ hx, zi = β2kxkX , where we used the fact that k y β2kX∗ ≤ 1 by Lemma 4.8. '∞ ⊕d 1−τ d ≤ β3 (where we used the fact τ = β Given Lemma 4.12, it follows that we may linearly embed X into ⊕t '1 T (c) where t = R, d and that 1 + β/d ≤ β for a large enough with distortion β2 d). The embedding follows by copying the vector x into the t spaces ⊕d '1T (c) corresponding to each vector y ∈ R given in Lemma 4.11. The one caveat is that this embedding requires t copies of ⊕d 2 logβ d many levels, and each contains has number of coordinates being some value in {βi}logβ d i=0 . '1T (c), and t is as large as(cid:16)logβ d + 1(cid:17)2 logβ d = dO(log log d). This is because there are at most Thus, our algorithm becomes inefficient once d ≥ 2ω(cid:0) log n In order to avoid this problem, we will make the embedding more efficient by showing that we do not need all of R, but rather a fine net of R. In addition, our net will be of polynomial size in the dimension, which gives an efficient algorithm for all ω(log n) ≤ d ≤ no(1). We first show that it suffices to consider fine nets of R, and then build a fine net of R of size poly(d). Lemma 4.13. Fix an γ ∈ (0, 1/2). Let k · kX be an arbitrary symmetric norm and k · kX∗ be its dual norm. If N is a γ-net of R with respect to distance given by k · kX∗, then log log n (cid:1) . (1 − γ − τ d)kxkX ≤ max y∈N kxky ≤ (β2 + γ)kxkX 12 Proof. Since the embedding we build is linear, it suffices to show that every vector x ∈ Rd with kxkX = 1 has 1 − γ − τ d ≤ max y∈N kxky ≤ (β2 + γ). Consider a fixed vector x ∈ Rd with kxkX = 1. Additionally, we may assume the coordinates of x are non-negative and in non-increasing order. We simply follow the computation: hx∗, yi + γkxkX + τ d, kxkX = kx∗kX ≤ max where we used Lemma 4.12 and the fact that kvkX∗ ≤ γ in a γ-net of R with respect to the distance given by k · kX∗. On the other hand, (hx∗, yi + hx∗, vi) + τ d ≤ max y∈N y∈R hx∗, yi + τ d = max y∈N max y∈N kxky = max y∈R (hx∗, yi + hx∗, vi) ≤ max y∈R kxky + γkxkX ≤ (β2 + γ)kxkX , where again, we used Lemma 4.12 and the fact that kvkX∗ ≤ γ. Finally, we conclude the theorem by providing a γ-net for R of size dO(log(1/γ)γ−1). Lemma 4.14. Fix any symmetric space X with dual X∗. There exists an 8(β − 1)-net of size dO(log(1/(β−1))/ log β) for R with respect to distances given by k · kX∗. We defer the proof of Lemma 4.14 to the next section. The proof of Theorem 4.2 follows by combining Lemma 4.11, Lemma 4.13, and Lemma 4.14. In particular, given a β−1 8 -net of R, we get an embedding with distortion at most (β2 + 8(β − 1))(1 + (8(β − 1) + τ d)2) from Lemma 4.13. We let τ = β proceed to proving Lemma 4.14, which gives the desired upper bound on the size of the net. d2 and β =p1 + δ/100 to get the desired linear embedding with distortion 1 + δ. We now 4.1 Proof of Lemma 4.14: bounding the net size We now give an upper bound on the size of a fine net of R. We proceed by constructing a further simplification of R(x). Intuitively we show that one can ignore the higher levels if there are fewer coordinates in the higher levels than some lower level. Lemma 4.15. Let k · kX be a symmetric norm. Consider any nonnegative vector x ∈ Rd+ as well as two indices u, v ∈ [d]. Let y ∈ Rd+ be the vector with: 0  xk  zk yk = xu + xv k ∈ [d] \ {u, v} k = u k = v . z0 k = max{zu, zv} min{zu, zv} k ∈ [d] \ {u, v} k = u k = v Then kykX ≥ kxkX. Proof. Consider the vector z ∈ BX∗ where hx, zi = kxkX. Now, we let z0 ∈ Rd be given by Note that z0 is a permutation of z, so z0 ∈ BX∗. Now, hy, z0i = (xu + xv) max{zu, zv} + X xkzk ≥ X k∈[d]\{u,v} k∈[d] xkzk = hx, zi = kxkX . 13 Definition 4.16. Consider a vector x ∈ R. We define the simplified rounded vector S(x) as the vector returned by the following procedure. 1: Initialize z = x 2: for k = 0, 1, . . . , 2 logβ(d) − 1 do 3: 4: 5: 6: end for 7: Sort the coordinates of z in non-increasing order and return z. if bk(z) ≤ maxj<k+3 logβ(β−1) bj(z) then end if Set all coordinates of z of value β−k to 0 i.e. set bk(z) = 0. Next we show that the simplified rounded vector is close to the rounded counts vector. Lemma 4.17. Let k · kX be a symmetric norm and let x ∈ R. Then kS(x) − xkX ≤ 2(β − 1)kxkX. Proof. Consider some k ∈ [2 logβ d − 1] and let Ck(x) ⊂ [d] be set of coordinates where x is at level k and does not equal S(x) = z, i.e., Ck(x) = {i ∈ [d] xi = β−k and xi 6= zi}. Additionally, for each k ∈ [2 logβ d − 1], let Tk ⊂ [d] be the coordinates at level k in x which trigger line 3 of S(x), and thus become 0's in z (we do not need to consider the case k = 0 since line 3 never triggers, in fact, we do not need to consider k ∈ [−3 logβ(b − 1)] either). In other words, max bj(z)}. j<k+3 logβ(β−1) Tk(x) = {i ∈ [d] xi = β−k and at iteration k of S(x), bk(z) ≤ Note that T1(x), . . . , T2 logβ d−1(x) are all disjoint, and Ck(x) ≤P sort, causing xi 6= zi. Thus, we may consider an injection sk : Ck(x) →S j∈[k] Tj(x), since whenever we zero out coordinates in levels less than or equal to k, S(x) will shift the coordinates when we j∈[k] Tj(x), which charges coordinates in Ck(x) to coordinates which were zeroed out in line 3 of S(x). Additionally, for each j ∈ [2 logβ d − 1] where Tj(x) 6= ∅, we let qj be the integer between 0 and j + 3 logβ(β − 1) which triggered line 3 of S(x) at k = j. More specifically, 0 ≤ qj ≤ j + 3 logβ(β − 1) is the integer for which bj(x) ≤ bqj(x). Finally, for each j ∈ [2 logβ d − 1] where Tj(x) 6= ∅, we let gj : Tj(x) → Bqj(x) (recall that Bqj(x) ⊂ [d] are the indices of x at level qj) be an arbitrary injection. Such an injection exists k∈[2 logβ d−1] Ck(x) → [d] where because bj(x) ≤ bqj(x). We may consider the mapping F : S we "aggregate" coordinates of S F(i) = gj(sk(i)) where k and j are such that i ∈ Ck(x) and sk(i) ∈ Tj(x). See Figure 4.1 for an example of a coordinate being mapped by F. Let y be the vector where k∈[2 logβ(d)−1] Ck(x) of x according to the map F according to Lemma 4.15. In particular, we define y ∈ Rd where for i ∈ [d], we let yi = X Note that for each i ∈ [d], 0 ≤ (x − z)i ≤ xi, and S i0∈F −1(i) xi0. k∈[2 logβ(d)−1] Ck(x) ⊂ [d] are the non-zero coordinates of x − z. Thus, from Lemma 4.15, we conclude that kx − zkX ≤ kykX. We now turn to upper-bounding kykX. 14 x = i Bqj(x) gj −3 logβ(β − 1) sk ' Tj(x) i0 Ck(x) Figure 1: Example mapping of particular levels of x with F showing aggregation of coordinates. The coordinate i0 ∈ Ck(x) belongs to level k and will be non-zero in x − S(x). In particular, coordinate i0 ∈ Ck(x) is mapped via sk to coordinate ' ∈ Tj(x), which is β−j in x and 0 in S(x). Then coordinate ' is mapped to i ∈ Bqj(x), where qj is the level below j with bqj ≥ bj. Thus, the composed map F sends i0 to i. Fix some i ∈ [d] where xi = β−j. Then yi = X k>j−3 logβ(β−1) k (i)) as 0 when g−1 k0 (g−1 k (i)) = β−k0. Thus,  ≤ X β−k0 k0 (g−1 where we interpret xs−1 k0 (g−1 xs−1 k (i)) 6= 0, xs−1 yi ≤ X X k>j−3 logβ(β−1) k0≥k X k0≥k  , xs−1 k0 (g−1 k (i)) k (i) = ∅, or s−1 k0 (g−1 k (i)) = ∅. Note that whenever β − 1 ≤ β1−j+3 logβ(β−1) β1−k (β − 1)2 ≤ β(β − 1) · β−j. k>j−3 logβ(β−1) Recall that xi = β−j, so β(β − 1)x weakly majorizes y, and thus kx − zkX ≤ kykX ≤ β(β − 1) · kxkX . Hence, when β ≤ 2, we have kx − zkX ≤ 2(β − 1)kxkX. Proof of Lemma 4.14. We now prove the theorem by showing that the set N = {S(x) ∈ Rd x ∈ R} is a γ-net of R, and we give an upper bound on the size. By Lemma 4.17, kx − S(x)kX ≤ 2(β − 1)kxkX ≤ 8(β − 1). So it suffices to give an upper bound on the size of N. We bound from above the number of net points by an encoding argument. Let z = S(x) and let tk = bk(z) maxj<k+3 logβ(β−1) bj(z) . Let k∗ ∈ {0, . . . , 2 logβ d−1} be the smallest level k with non-zero bk(z). For all j > k∗−3 logβ(β−1), we either have tj(z) = 0 or tj(z) ≥ 1. Additionally, z has d coordinates, so 2 logβ d−1Y j=k∗−3 logβ(β−1) max(tj, 1) ≤ d−3 logβ(β−1), since terms of the product "cancel" except for at most −3 logβ(β − 1), which are each at most d. 15 (( We will encode z ∈ N in three steps. In the first step, we use 2 logβ d − 1 bits in order to encode whether bk(z) = 0 or bk(z) > 0. In the second step, we then encode the values bk∗+j(z) for j ∈ {0, . . . , 3 logβ(1/(β − 1))}. Finally, we go through j > k∗ + 3 logβ a prefix-free code, where writing ti uses at most O (log max(ti, 1)) many bits. Thus, in total, the number of bits we use is (cid:16) 1 β−1 O (cid:19) + logβ d + log d logβ (cid:18) 1 log d · log(cid:16) 1 (cid:17) β − 1 (cid:17) log d · log(cid:16) 1 log β = O = O β−1 β−1 log β  . + log 2 logβ d−1X  2 logβ d−1Y j=k∗−3 logβ(β−1) j=k∗−3 logβ(β−1) log max(tj, 1) max(tj, 1) (cid:17), and encode ti using   Thus, we obtain N is a 8(β − 1)-net, and the size of N is dO(log(1/(β−1))/ log β). 5 Proof of the main theorem: ANN for symmetric norms We now prove our main result, Theorem 1.1. The algorithm here achieves approximation log2 log n · log log d ! O We proceed by giving an algorithm for Lt Lemma 5.1. Fix some c1, . . . , cd ≥ 0. Let L [And09], and Theorem 2.9. where for every x = (x1, . . . , xd) ∈ Rd2, '∞ . Ld ε5 '1 T (c) using Theorem 2.8, Theorem 5.1.2 from '∞ T (c) be the space with k · k(c) T,∞ : Rd2 → R seminorm kxk(c) T,∞ = max k∈[d] ckkxkkT (k). ε3 (cid:16) log log n·log log d (cid:17) using space O(cid:0)d2 · n1+ε(cid:1) and query time O(cid:0)d2 · nε(cid:1). For every ε ∈ (0, 1/2), there exists a data structure for ANN over k · k(c) mation O Proof. Given the randomized embedding from Lemma 3.3, we can build a data structure for ckk·kT (k) achieving approximation O( log log d ) using space O(d2n1+ε/2) and query time O(d2nε/2). This data structure works in the same way as in the proof of Theorem 3.2. We handle the constant ck by rescaling the norm, and since the embeddings are linear, it does not affect the correctness of the data structure. Then we apply Theorem 2.8. T,∞ which achieves approxi- ε2 Lemma 5.2. Fix some c1, . . . , cd ≥ 0. Let L where x = (x1, . . . , xm) ∈ Rd2, '1 T (c) be the space with k · k(c) dX ckkxkkT (k). kxk(c) T,1 = k=1 T,1 : Rd2 → R seminorm (cid:16) log log n·log log d For every ε ∈ (0, 1/2), there exists a data structure for ANN over k·k(c) O (cid:17) using space O(d2 · n1+ε) and query time O(d2 · nε). ε4 T,1 which achieves approximation 16 Proof. The proof follows from Theorem 5.1.2 in [And09] and Lemma 5.1. Finally, we are combine the above results to get an improved algorithm for general symmetric norms. Theorem 5.3. For every d-dimensional symmetric norm k · kX and every ε ∈ (0, 1/2), there exists a data structure for ANN over k · kX which achieves approximation O( log2 log n log log d ) using space dO(1) · O(n1+ε) and query time dO(1) · O(nε). Proof. Given Theorem 4.2, we embed k · kX intoL '1 T (c) with approximation (1 ± 1 result from Lemma 5.2 allows we to apply Theorem 2.9 to obtain the desired data structure. 10). The L '∞ ε5 Theorem 5.3 implies our main result Theorem 1.1 stated in the introduction. 6 Lower bounds In this section, we show that our techniques do not extend to general norms. In particular, we show there does not exist a universal norm U for which any norm embeds (possibly randomized) with constant distortion, unless the blow-up in dimension is exponential. Hence the result from below applies to cases of U = '∞ as well as an (low-dimensional) product spaces. Theorem 6.1. For any ε > 0, let U be a d0-dimensional normed space such that for any d- dimensional normed space X, there exists a distribution D supported on linear embeddings f : Rd → Rd0 where for every x ∈ Rd, kxkX ≤ kf(x)kU ≤ DkxkU 3 over the draw of f ∼ D, for D = O(d1/2−ε). Then d0 = exp(cid:0)Ω(d2ε)(cid:1). holds with probability at least 2 We will prove the above theorem by showing that if there exists a universal normed space U satisfying the conditions of Theorem 6.1 above, then two parties, call them Alice and Bob, can use the embeddings to solve the communication problem Index with only a few bits. Let U be a proposed d0-dimensional normed space satisfying the conditions of Theorem 6.1. By the John's theorem [Bal97], we may apply a linear transform so that: d0B'2 Lemma 6.2. For any ε > 0, there exists a set of exp(cid:0)Ω(d2ε)(cid:1) many points on the unit sphere Sd−1 B'2 ⊂ BU ⊂ such that pairwise inner-products are at most whose coordinates are ± 1√ Proof. Consider picking two random points x, y ∈ Sd−1 where each entry is ± 1√ Bernstein's inequality, d1/2−ε . In fact, these points may consist of points (cid:21) We may pick exp(cid:0)Ω(d2ε)(cid:1) random points and union bound over the probability that some pair has ≤ 2 exp(cid:16)−Ω(d2ε)(cid:17) (cid:20) hx, yi ≥ 1 . Then by d1/2−ε Pr x,y √ . 1 d d large inner product. Fix ε > 0 and C = d1/2−ε, and let P be set a set of unit vectors with pairwise inner-product at C of size exp(Ω(d2ε)). For each a ∈ {0, 1}P consider the following norm: most 1 kxka = C · max y∈P :ay=1 hx, yi. Assume there exists a randomized linear embedding f : Rd → Rd0 with the following guarantees: 17 consider rounding each entry of M by to the nearest integer multiple of each x ∈ Sd−1, k(M − M0)xkU ≤ k(M − M0)xk2 ≤ 1 is an integer multiple of vectors in B2. • For every x ∈ Rd, kxka ≤ kf(x)kU ≤ Dkxka with probability at least 2 3. Note the embedding f can be described by M, a d0 × d matrix of real numbers. Additionally, we poly(d) to obtain M0. For poly(d). Thus, we may assume each entry of M poly(d)) factor in the distortion of the embedding for We now show that the existence of the randomized embedding implies a one-way randomized protocol for the communication problem Index. We first describe the problem. In an instance of Index: poly(d), and lose (1 ± 1 1 1 • Alice receives a string a ∈ {0, 1}n. • Bob receives an index i ∈ [n]. • Alice communicates with Bob so that he can output ai. Theorem 6.3 ([KNR99]). The randomized one-way communication complexity of Index is Ω(n). We give a protocol for Index: 1. Suppose Alice has input a ∈ {0, 1}P . She will generate the norm k · ka described above. Note that f ∼ D has that for each x ∈ Rd, the embedding preserves the norm of x up to D with 3. In particular, if Bob's input is i ∈ P, corresponding to point y, then an probability 2 embedding f ∈ D, which we represent as a d0 × d matrix M, satisfies: kyka ≤ kM ykU ≤ Dkyka with probability 2 3. In particular, with probability 2 3: • If ai = 0, then kyka ≤ 1, which implies kM ykU ≤ D. • If ai = 1, then kyka ≥ C, which implies kM ykU ≥ C. Alice computes the set Pc ⊂ P of vectors which satisfy the above property (i.e. the embedding M preserves increases the norm by at most a factor D). 2. Alice finds a subset B ⊂ Pc of linearly independent vectors such that every x ∈ Pc we have d0kM xkU ≤ C · D · √ x ∈ span(B). Note that B ≤ d and for all x ∈ B, kM xk2 ≤ √ d0. Therefore, each M x ∈ Rd0 can be written with O(d0) bits. So Alice sends the set B, as well as M x for each x ∈ B using O(dd0) bits. 3. In order for Bob to decode ai, he first checks whether y ∈ span(B), and if not, he guesses. If y ∈ span(B), which happens with probability 2 3, then Bob writes y = X bi∈B cibi 18 and M y =P bi∈B ciM bi. If kM ykU ≤ D, then ai = 0 and if kM ykU ≥ C then ai = 1. Thus, if D < C 2 , Bob can recover ai with probability 2 3. dd0 ≥ Ω (P), which in turn implies d0 ≥ exp(cid:0)Ω(d2ε)(cid:1). Alice communicates O(dd0) bits, and Bob is able to recover ai with probability 2 3. By Theorem 6.3, Acknowledgments We thank Piotr Indyk for suggesting the proof of Theorem 6.1. We also thank Assaf Naor for discussions related to these research questions. Thanks to Clément Canonne for pointing us to relevant literature about symmetric norms. This work is supported in part by Simons Foundation, Google, and NSF (CCF-1617955), as well as by the NSF Graduate Research Fellowship (Grant No. DGE-16-44869). References [ACP08] Alexandr Andoni, Dorian Croitoru, and Mihai Patrascu. Hardness of nearest neighbor under L-infinity. In Proceedings of the 49th Annual IEEE Symposium on Foundations of Computer Science (FOCS '2008), pages 424–433, 2008. Andreas Argyriou, Rina Foygel, and Nathan Srebro. Sparse prediction with the k-support norm. In Proceedings of Advances in Neural Information Processing Systems 25 (NIPS '2012), pages 944–952, 2012. Alexandr Andoni and Piotr Indyk. Near-optimal hashing algorithms for approximate nearest neighbor in high dimensions. In Proceedings of the 47th Annual IEEE Symposium on Foundations of Computer Science (FOCS '2006), pages 459–468, 2006. Alexandr Andoni, Piotr Indyk, and Robert Krauthgamer. Overcoming the '1 non-embeddability barrier: Algorithms for product metrics. In Proceedings of the 20th ACM-SIAM Symposium on Discrete Algorithms (SODA '2009), pages 865–874, 2009. [AFS12] [AI06] [AIK09] [AINR14] Alexandr Andoni, Piotr Indyk, Huy L. Nguyen, and Ilya Razenshteyn. Beyond locality-sensitive hashing. In Proceedings of the 25th ACM-SIAM Symposium on Discrete Algorithms (SODA '2014), pages 1018–1028, 2014. Available as arXiv:1306.1547. [AKR15] Alexandr Andoni, Robert Krauthgamer, and Ilya Razenshteyn. Sketching and embedding are equivalent for norms. In Proceedings of the 47th ACM Symposium on the Theory of Computing (STOC '2015), pages 479–488, 2015. Available as arXiv:1411.2577. [And09] [And16] [ALRW17] Alexandr Andoni, Thijs Laarhoven, Ilya Razenshteyn, and Erik Waingarten. Optimal hashing- based time–space trade-offs for approximate near neighbors. In Proceedings of the 28th ACM-SIAM Symposium on Discrete Algorithms (SODA '2017), 2017. Available as arXiv:1608.03580. Alexandr Andoni. Nearest Neighbor Search: the Old, the New, and the Impossible. PhD thesis, MIT, 2009. Alexandr Andoni. High-dimensional computational geometry. In Peter Bühlmann, Petros Drineas, Michael Kane, and Mark J. van der Laan, editors, Handbook of Big Data., pages 105–123. Chapman and Hall/CRC, 2016. Alexandr Andoni and Ilya Razenshteyn. Optimal data-dependent hashing for approximate near neighbors. In Proceedings of the 47th ACM Symposium on the Theory of Computing (STOC '2015), pages 793–801, 2015. Available as arXiv:1501.01062. Amirali Abdullah and Suresh Venkatasubramanian. A directed isoperimetric inequality with application to Bregman near neighbor lower bounds. In Proceedings of the 47th ACM Symposium on the Theory of Computing (STOC '2015), pages 509–518, 2015. Keith Ball. An Elementary Introduction to Modern Convex Geometry, volume 31 of MSRI Publications. Cambridge University Press, 1997. [AR15] [AV15] [Bal97] [BBC+15] Jarosław Błasiok, Vladimir Braverman, Stephen R. Chestnut, Robert Krauthgamer, and Lin F. Yang. Streaming symmetric norms via measure concentration. Available as arXiv:1511.01111, 2015. 19 [BG15] [BKL06] [BO10] [BS88] [Cla99] [CW15] [DMS93] [HIM12] [IM98] [Ind01] [Ind02] [Ind04] [Joh48] [KL04] [KNR99] [KP12] [KR02] [KW16] [Mat96] Yair Bartal and Lee-Ad Gottlieb. Approximate nearest neighbor search for 'p-spaces (2 < p < ∞) via embeddings. Available as arXiv:1512.01775, 2015. Alina Beygelzimer, Sham Kakade, and John Langford. Cover trees for nearest neighbor. In Proceedings of the 23rd International Conference on Machine Learning (ICML '2006), pages 97–104, 2006. Vladimir Braverman and Rafail Ostrovsky. Zero-one frequency laws. In Proceedings of the 42rd ACM Symposium on the Theory of Computing (STOC '2010), pages 281–290, 2010. Colin Bennett and Robert Sharpley. Interpolation of Operators, volume 129 of Pure and Applied Mathematics. Academic Press, 1988. Ken Clarkson. Nearest neighbor queries in metric spaces. Discrete Comput. Geom., 22(1):63–93, 1999. Previously in SoCG97. Kenneth L. Clarkson and David P. Woodruff. Sketching for m-estimators: A unified approach to robust regression. In Proceedings of the 26th ACM-SIAM Symposium on Discrete Algorithms (SODA '2015), pages 921–939, 2015. S. J. Dilworth and S. J. Montgomery-Smith. The distribution of vector-valued Rademacher series. Annals of Probability, 21(4):2046–2052, 1993. Sariel Har-Peled, Piotr Indyk, and Rajeev Motwani. Approximate nearest neighbor: Towards removing the curse of dimensionality. Theory of Computing, 8(1):321–350, 2012. Piotr Indyk and Rajeev Motwani. Approximate nearest neighbors: Towards removing the curse of dimensionality. In Proceedings of the 30th ACM Symposium on the Theory of Computing (STOC '1998), pages 604–613, 1998. Piotr Indyk. On approximate nearest neighbors under '∞ norm. Journal of Computer and System Sciences, 63(4):627–638, 2001. Piotr Indyk. Approximate nearest neighbor algorithms for fréchet distance via product metrics. In Proceedings of the 18th ACM Symposium on Computational Geometry (SoCG '2002), pages 102–106, 2002. Piotr Indyk. Approximate nearest neighbor under edit distance via product metrics. In Proceedings of the 15th ACM-SIAM Symposium on Discrete Algorithms (SODA '2004), pages 646–650, 2004. Fritz John. Extremum problems with inequalities as subsidiary conditions. In Studies and Essays Presented to R. Courant on his 60th Birthday, January 8, 1948, pages 187–204. Interscience Publishers, Inc., New York, N. Y., 1948. Robert Krauthgamer and James R. Lee. Navigating nets: simple algorithms for proximity search. In Proceedings of the 15th ACM-SIAM Symposium on Discrete Algorithms (SODA '2004), pages 798–807, 2004. Ilan Kremer, Noam Nisan, and Dana Ron. On randomized one-round communication complexity. Computational Complexity, pages 21–49, 1999. Michael Kapralov and Rina Panigrahy. NNS lower bounds via metric expansion for '∞ and EMD. In Proceedings of the 39th International Colloquium on Automata, Languages and Programming (ICALP '2012), pages 545–556, 2012. David R. Karger and Matthias Ruhl. Finding nearest neighbors in growth-restricted metrics. In Proceedings of the 34th ACM Symposium on the Theory of Computing (STOC '2002), pages 741–750, 2002. Felix Krahmer and Rachel Ward. A unified framework for linear dimensionality reduction in L1. RIM, 70(1):209–231, 2016. Jiří Matoušek. On the distortion required for embedding finite metric spaces into normed spaces. Israel Journal of Mathematics, 93:333–344, 1996. 20 [MOA11] Albert W. Marshall, Ingram Olkin, and Barry C. Arnold. Inequalities: theory of majorization [MPS14] [Nao17] [NR06] [NS07] and its applications. Academic press, 2011. Andrew M. McDonald, Massimiliano Pontil, and Dimitris Stamos. Spectral k-support norm regu- larization. In Proceedings of Advances in Neural Information Processing Systems 25 (NIPS '2014), pages 3644–3652, 2014. Assaf Naor. A spectral gap precules low-dimensional embeddings. In Proceedings of the 33rd International Symposium on Computational Geometry (SoCG '2017), 2017. Assaf Naor and Yuval Rabani. On approximate nearest neighbor search in 'p, p > 2. Manuscript, 2006. Assaf Naor and Gideon Schechtman. Planar earthmover is not in L1. SIAM Journal on Computing, 37(3):804–826, 2007. An extended abstract appeared in FOCS'06. [PTW10] Rina Panigrahy, Kunal Talwar, and Udi Wieder. Lower bounds on near neighbor search via metric expansion. In Proceedings of the 51st Annual IEEE Symposium on Foundations of Computer Science (FOCS '2010), pages 805–814, 2010. [WLKC15] Jun Wang, Wei Liu, Sanjiv Kumar, and Shih-Fu Chang. Learning to hash for indexing big data - [Woj91] [WSSJ14] a survey. Available as arXiv:1509.05472, 2015. Przemysław Wojtaszczyk. Banach Spaces for Analysts. Cambridge University Press, 1991. Jingdong Wang, Heng Tao Shen, Kingkuan Song, and Jianqiu Ji. Hashing for similarity search: a survey. Available as arXiv:1408.2927, 2014. A Bounding space in Theorem 2.9 Here we justify the space bound of the algorithm from Theorem 2.9 (from [Ind02]). We note that the improved bound was also claimed in [AIK09], albeit without a proof. First of all, as suggested at the end of Section 3 of [Ind02], one modifies the algorithm to obtain space of the form of n1+ε, at the expense of increasing the approximation to O(ε−1 log log n). This is done by replacing the conditions in Case 2 and 3 by respectively: #1+ε "B(s, R(s) + c + 1) ∩ Si #1+ε "Si − B(p, R0) Si S B(s, R(s)) ∩ Si Si , < Si − B(s, R0 + 2) S . < and With the remaining algorithm being precisely the same, our only task here is to argue the space bound. First of all we bound the sum of the number of points stored in all the leaves. For a tree with m nodes, let L(m) be an upper bound on this count. We would like to prove that L(m) ≤ m1+ε. As in [Ind02], we only need to focus on cases 2 and 3 of the construction, as case 1 does not replicate the points. We will consider the case 2 (case 3 is exactly similar). j = Si ∩ ∪s∈Sj B(s, c + 1), whereas S = m. By construction, we have Let mj = Sj and m0 By induction, assume L(m0 thatP mj = m and mj/m > (m0 L(m) ≤X j)1+ε for all children. Then, we have that: mj = m1+ε. j/m)1+ε for all j. j) ≤ (m0 L(m0 j) ≤X j)1+ε < mεX (m0 j j j 21 We now argue the total space is O(S(n) · k log n · n). Since the depth of the tree is O(k log n), we have that the total number of points stored in the ANN data structures is O(k log n · C(n)) = O(k log n · n1+). Since each ANN is on at most n points, we have that, for each occurrence of a point in the ANN data structure, we have an additional factor of S(n)/n.4 Hence the total space occupied by all the ANN data structures is O(S(n)/n · k log n · n1+). Using a smaller ε (to hide the log n factor), we obtain the stated space bound of O(S(n) · k · n). B fO(log d)-ANN for symmetric norms We provide a simple ANN algorithm for general symmetric norm achieving O(log d log log d) approx- imation using near-linear space and sub-linear query time. The algorithm will leverage the results in the previous section by relating general symmetric norms to Orlicz norms. Recall the definition of level vectors in Definition 4.3. Definition B.1. Let k · kX be any symmetric norm. Let Lk > 0 be the minimum number of coordinates needed at level k to have norm at least 1. In other words, Lk = min{j ∈ [d] kβ−iξ(j)kX > 1}. At a high level, we will relate the norm of a vector x ∈ Rd to the norm of its level vectors Vk(x). The definition above gives a way to measure the contribution of level k to the norm. For example, if x ∈ Rd has norm kxkX ≥ D, and there are only 2 logβ d non-zero levels with respect to x, then some level vector kVk(x)kX ≥ D logβ d), since we may divide Vk(x) into a sum of vectors with Lk coordinates at level k. On the other hand, if x ∈ Rd has kxkX ≤ 1, then bk < Lk for each k. Since we consider only 2 logβ d relevant levels, for kxkS ≤ 1, 2 logβ d. This implies bk = Ω( DLk 2 logβ d−1X k=0 ≤ 2 logβ d. bk Lk Additionally,P2 logβ d−1 (bk/Lk) can be decomposed as an additive contribution of coordinates. In particular, coordinate xi contributes 1/Lk if i ∈ Bk. Therefore, we can hope to approximate the symmetric norm by an Orlicz norms and apply the arguments from Lemma 3.1. k=0 The lemma below formalizes the ideas discussed above. Lemma B.2. Let k · kX be any symmetric norm. For any D, α > 1, there exists a non-decreasing function G: R+ → R+ with G(0) = 0 and G(t) → ∞ as t → ∞, where every vector x ∈ Rd satisfies the following: (cid:16)xi i=1 G(xi) ≤ 2 logβ d. • If kxkX ≤ 1, then Pd • If kxkX > αD · 7 logβ d, then Pd 2 logβ d−1X i=1 G D (cid:17) ≥ α · 2 logβ d. Proof. For i ≥ 0, let Ai = (β−i−1, β−i]. The function G: R+ → R+ is defined as G(t) = i=0 χAi(t) Li + α · 2 logβ d · t · χ(1,∞)(t) (2) 4Here we assume the natural condition that S(n) is increasing, which is, otherwise, easy to guarantee. 22 Recall the norm satisfies, kξ(1)kX = 1, so if kxkX ≤ 1, then xi ≤ 1 for all i ∈ [d]. This means Note that G(0) = 0 and G(t) → ∞ as t → ∞. χ(1,∞)(xi) = 0 so the second term of the RHS of (2) is zero. Therefore, 2 logβ d−1X 2 logβ d−1X χAk(xi) dX dX G(xi) = i=1 i=1 k=0 Lk k=0 = bk Lk where bk is defined with respect to x. Since, bk < Lk for all 0 ≤ k < 2 logβ d, If x ∈ Rd where kxkX > αD · 7 logβ d, then the vector k x that for any vector x ∈ Rd with kxkX > α · 7 logβ d, DkX > α · 7 logβ d. So it suffices to prove dX i=1 dX i=1 G(xi) ≤ 2 logβ d. G(xi) ≥ α · 2 logβ d Additionally, for any vector x ∈ Rd, we may consider the vector C(x) ∈ Rd for τ = β d2 from Definition 4.4. By Proposition 4.6, kC(x)kX ≥ kxkX − β d > α · 6 logβ d. Therefore, we may assume x ∈ Rd has kxkX > α · 6 logβ d, and that all non-zero coordinates have absolute values greater than d2 . Equivalently, bk = 0 for all k ≥ 2 logβ d. If for some i ∈ [d], xi ≥ 1, then the second term in the RHS of (2) is non-zero, and G(xi) ≥ α · 2 logβ d. So we may further assume all coordinates of x lie in levels k = 0, . . . , 2 logβ d − 1. Note that β 2 logβ d−1X dX G(xi) = G(Vk(x)i), dX and for each 0 ≤ k < 2 logβ d,Pd (cid:26) We partition the levels into two groups, (cid:27) i=1 k=0 i=1 i=1 G(Vk(x)i) = bk Lk A = k bk Lk < 1 For all k ∈ B, (cid:27) ≥ 1 . k bk Lk . (cid:25) (cid:26) B = ≤ 2bk Lk and (cid:24) bk Lk kVk(x)kX ≤ since by the triangle inequality, we can break Vk(x) into at most at level k each having norm at least 1. Suppose for the sake of contradiction thatP α · 4 logβ d ≥ X α · 6 logβ d < kxkX ≤ X Additionally, since kxkX > α · 6 logβ d, and k∈B bk Lk k∈B 2bk Lk ≥ X kVk(x)kX + X k∈B k∈B ≤ α · 2 logβ d. Then kVk(x)kX . kVk(x)kX , k∈A 23 (cid:24) bk (cid:25) Lk vectors with Lk coordinates it follows that X kVk(x)kX > α · 2 logβ d. k∈A However, this is a contradiction for since A ≤ 2 logβ d and kVk(x)kX ≤ 1. Lemma B.3. For any ε ∈ (0, 1/2), there exists a data structure for ANN over any symmetric norm k · kX which achieves approximation O Proof. We fix β = 3 The one difference is that we rescale the '∞ norm by (cid:17) using space O(dn1+ε) and query time O(dnε). 2. The proof of this lemma follows in the same way as the proof of Theorem 3.2. (cid:16) log d log log d 2 logβ d after applying the embedding. ε2 1 B.1 The logΩ(1) d-approximation is necessary Let us remark that we cannot push the technique much further. Namely, any G(·) (even non-convex) √ requires approximation Ω( log d) for the following norm. Define the norm of a vector to be This is the minimal norm for ak = √ that an approximation with any G(·) ends up having a distortion Ω( log d). The idea is to consider the following vectors: for every 1 ≤ k ≤ d, we consider a vector √ k (see Section 1.2 for the definition). It is not hard to check (cid:18) x∗ 1 + x∗ 2 + . . . x∗ √ k k (cid:19) . kxk = max 1≤k≤d (cid:16)1, 1, . . . , 1 {z } k , 0, 0, . . . , 0(cid:17) , and besides, we consider a vector(cid:16)1, 3 − √ The remaining calculation is a simple exercise. 2 − 1, √ √ √ d − √ 2, . . . , d − 1(cid:17) . C Lower bound for arbitrary metrics: expander graphs We give an example of a metric that is hard for current approaches to ANN search. The lower bound is based on the notion of robust expansion, which implies all known lower bounds for ANN [PTW10, ALRW17]. In what follows, we will refer to d = log N as the dimension of a finite metric space of size N. Our example of a hard metric will be the shortest path metric on any spectral expander graph. We note that a similar theorem to the one below is also known for a finite subset of the high-dimensional Earth-Mover Distance [KP12]. Fix M to be the metric induced by the shortest path distance on a 3-regular expander G on N nodes. In particular, assume that 1 − λ(G) > c, where c is an absolute constant, and λ(G) ∈ (0, 1) is the second-largest eigenvalue of the normalized adjacency matrix of G. Let d be the dimension d = log N. Theorem C.1. For any approximation α > 1, and data set size n ≥ 1 with dΩ(1) ≤ n ≤ N O(1), any α-ANN data structure on n points which makes t cell probes (with cells of size at most w ≤ (d log n)O(1)), and has success probability at least γ > n−1+o(1), must use space m = γΩ(1/t)N Ω(1/(αt)) = γΩ(1/t)2Ω(d/(αt)). 24 We proceed by introducing a few definitions from [PTW10], and then prove lower bounds on the robust expansion. Definition C.2 ([PTW10]). In the Graphical Neighbor Search problem (GNS), we are given a bipartite graph H = (U, V, E) where the dataset comes from U and the queries come from V . The dataset consists of pairs P = {(pi, xi) pi ∈ U, xi ∈ {0, 1}, i ∈ [n]}. On query q ∈ V , if there exists a unique pi with (pi, q) ∈ E, then we want to return xi. One can use the GNS problem to prove lower bounds on c-ANN as follows: build a GNS graph H by taking U = V = [N], and connecting two points u ∈ U, v ∈ V iff they are at a distance at most r (see details in [PTW10]). We will also need to make sure that in our instances q is not closer than cr to other points except the near neighbor. We now introduce the notion of robust expansion, used in [PTW10] to prove lower bounds. Definition C.3 (Robust Expansion [PTW10]). For a GNS graph H = (U, V, E), fix a distribution e on E ⊂ U × V , and let µ be the marginal on U and η be the marginal on V . For δ, γ ∈ (0, 1], the robust expansion Φr(δ, γ) is defined as follows: Φr(δ, γ) = min A⊂V :η(A)≤δ min e(A×V )≥γ B⊂U: e(A×B) µ(B) η(A) . We now prove a lower bound on the robust expansion Φr(δ, γ) for a GNS graph arising from the shortest path metric on the expander graph G. Fix r = d/α. The hard distribution e is defined as follows: pick p at random from M and obtain q by running a random walk of length r starting at p. Note that for n < N 1/4 and sufficiently high constant α, the distribution satisfies the weak-independence condition required for applying the results in [PTW10]. Fix any sets A, B ⊂ M, where a = A/N and b = B/N. By the expander mixing lemma applied to Gr, we obtain that:(cid:12)(cid:12)(cid:12)EGr(A, B) − A·B 3rN (cid:12)(cid:12)(cid:12) ≤ λ33rqA · B. Considering that Pr[q ∈ B p ∈ A] = EGr (A,B) aN·3r , we have that: Pr[q ∈ B p ∈ A] ≤ b + λrq γ ≤ Φr · a + λrpΦr. b/a. Restricting to sets A, B such that Pr[q ∈ B p ∈ A] ≥ γ, for which we must have that Φr = Φr(a, γ) ≥ b/a (by definition), we conclude: Hence, either Φr = Ω(γ/a) or Φr = Ω(γ2/λ2r). Proof of Theorem C.1. Applying Theorem 1.5 from [PTW10], we have that, for t ≥ 1 cell probes, either: • mtw/n ≥ Ω(γ · mt), an impossibility; • or mtw/n ≥ Ω(γ2/λ2r), or mt = Ω( n w γ2/λ2r), implying m = γ2/tN Ω(1/(αt)). 25 To show how bad the situation for expander metrics is, we state a lower bound on for α-ANN on the expander metric described above in the list-of-points model, which captures the hashing-based algorithms of [ALRW17] and in the decision tree model of [Ind01]. The proofs follow from a simple derivation using the robust expansion lower bounds in Section 7 of [ALRW17] and a reduction of decision trees to O(log m)-cell-probe data structures similar to Appendix A in [ACP08]. Theorem C.4. Any list-of-points data structure for (c, r)-ANN for random instances of n points in the expander metric of dimension d (described above) with query time t and space m has either t = Ω(n), or m = exp (Ω(d)). Theorem C.5. Let d = Ω(log1+ε n) for some ε > 0. Any decision tree of size m and depth t and word size w succeeding with probability γ satisfies: (cid:18) mO(log m)tw ≥ Φr In particular, for any ρ > 0, if w ≤ nρ, either t ≥ eΩ(n1−ρ) or m = exp(cid:16)Ω(dε/(1+ε))(cid:17) poly(n). mO(log m) , O(log m) n 1 γ (cid:19) . 26
1312.6677
3
1312
2015-03-05T19:51:27
Path Finding I :Solving Linear Programs with \~O(sqrt(rank)) Linear System Solves
[ "cs.DS", "math.NA", "math.OC" ]
In this paper we present a new algorithm for solving linear programs that requires only $\tilde{O}(\sqrt{rank(A)}L)$ iterations to solve a linear program with $m$ constraints, $n$ variables, and constraint matrix $A$, and bit complexity $L$. Each iteration of our method consists of solving $\tilde{O}(1)$ linear systems and additional nearly linear time computation. Our method improves upon the previous best iteration bound by factor of $\tilde{\Omega}((m/rank(A))^{1/4})$ for methods with polynomial time computable iterations and by $\tilde{\Omega}((m/rank(A))^{1/2})$ for methods which solve at most $\tilde{O}(1)$ linear systems in each iteration. Our method is parallelizable and amenable to linear algebraic techniques for accelerating the linear system solver. As such, up to polylogarithmic factors we either match or improve upon the best previous running times in both depth and work for different ratios of $m$ and $rank(A)$. Moreover, our method matches up to polylogarithmic factors a theoretical limit established by Nesterov and Nemirovski in 1994 regarding the use of a "universal barrier" for interior point methods, thereby resolving a long-standing open question regarding the running time of polynomial time interior point methods for linear programming.
cs.DS
cs
Solving Linear Programs with (cid:101)O( Path Finding I : √ rank) Linear System Solves Yin Tat Lee MIT [email protected] Aaron Sidford MIT [email protected] 5 1 0 2 r a M 5 ] S D . s c [ 3 v 7 7 6 6 . 2 1 3 1 : v i X r a Abstract In this paper we present a new algorithm for solving linear programs that requires only (cid:101)O((cid:112)rank(A)L) iterations to solve a linear program with m constraints, n variables, and con- straint matrix A, and bit complexity L. Each iteration of our method consists of solving (cid:101)O(1) ods which solve at most (cid:101)O(1) linear systems in each iteration. Our method is parallelizable and Our method improves upon the previous best iteration bound by factor of Ω((m/ rank(A))1/4) for methods with polynomial time computable iterations and by Ω((m/ rank(A))1/2) for meth- linear systems and additional nearly linear time computation. amenable to linear algebraic techniques for accelerating the linear system solver. As such, up to polylogarithmic factors we either match or improve upon the best previous running times for solving linear programs in both depth and work for different ratios of m and rank(A). Moreover, our method matches up to polylogarithmic factors a theoretical limit established by Nesterov and Nemirovski in 1994 regarding the use of a “universal barrier” for interior point methods, thereby resolving a long-standing open question regarding the running time of poly- nomial time interior point methods for linear programming. Introduction 1 Given a matrix, A ∈ Rm×n, and vectors, (cid:126)b ∈ Rm and (cid:126)c ∈ Rn, solving the linear program1 min (cid:126)x∈Rn : A(cid:126)x≥(cid:126)b (cid:126)cT (cid:126)x (1.1) is a core algorithmic task for both the theory and practice of computer science. Since Karmarkar’s breakthrough result in 1984, proving that interior point methods can solve lin- ear programs in polynomial time for a relatively small polynomial, interior point methods have been an incredibly active area of research with over 1200 papers written just as of 1994 [29]. Currently, the fastest asymptotic running times for solving (1.1) in many regimes are interior point methods. √ Previously, state of the art interior point methods for solving (1.1) require either O( mL) itera- 1This expression is the dual of a linear program written in standard form. It is well known that all linear programs can be written as (1.1). Note that this notation of m and n differs from that in some papers. Here m denotes the number of constraints and n denotes the number of variables. To avoid confusion we state many of our results in terms of(cid:112)rank(A) instead of √ n . 1 However, tions of solving linear systems [31] or O((m rank(A))1/4L) iterations of a more complicated but still polynomial time operation [36, 39, 41, 1].2 In this paper we present a new interior point method that solves general linear programs in solutions to (1.1) and despite this existential result, the O((m rank(A))1/4L) iteration bound for polynomial time linear programming methods has not been improved in over 20 years. in a breakthrough result of Nesterov and Nemirovski in 1994, they showed that there exists a universal barrier function that if computable would allow (1.1) to be solved in O((cid:112)rank(A)L) iterations [28]. Unfortunately, this barrier is more difficult to compute than the (cid:101)O((cid:112)rank(A)L) iterations thereby matching the theoretical limit proved by Nesterov and Nemirovski only solving (cid:101)O(1) linear systems and performing additional (cid:101)O(nnz(A)) work in each iteration.4 Our algorithm is parallelizable and we achieve the first (cid:101)O((cid:112)rank(A)L) depth polynomial work method linear programming algorithm has a running time of (cid:101)O((nnz(A) + (rank(A))ω)(cid:112)rank(A)L) where up to polylogarithmic factors.3 Furthermore, we show how to achieve this convergence rate while for solving linear programs. Furthermore, using one of the regression algorithms in [24, 17], our ω < 2.3729 is the matrix multiplication constant [42]. This is the first polynomial time algorithm for linear programming to achieve a nearly linear dependence on nnz(A) for fixed n. Furthermore, we show how to use acceleration techniques as in [37] to decrease the amortized per-iteration costs of solving the requisite linear system and thereby achieve a linear programming algorithm with running time faster than the previous fastest running time of O(m1.5nL) whenever m = Ω (n). This is the first provable improvement on both running time and the number of iterations for general interior point methods in over 20 years. We achieve our results through an extension of standard path following techniques for linear programming [31, 7] that we call weighted path finding. We study what we call the weighted central path, an idea of adding weights to the standard logarithmic barrier function [35, 5, 21] that was recently used implicitly by Mądry to make an important breakthrough improvement on the running time for solving unit-capacity instances of the maximum flow problem [19]. We provide a general analysis of properties of the weighted central path, discuss tools for manipulating points along the path, and ultimately produce an efficiently computable path that converges in (cid:101)O((cid:112)rank(A)L) steps. We hope that these results may be of independent interest and serve as tools for further improving the running time of interior point methods in general. While the analysis in this paper is quite technical, our linear programming method is straightforward and we hope that these techniques may prove useful in practice. 1.1 Previous Work Linear programming is an extremely well studied problem with a long history. There are numerous algorithmic frameworks for solving linear programming problems, e.g. simplex methods [4], ellipsoid methods [10], and interior point methods [8]. Each method has a rich history and an impressive body of work analyzing the practical and theoretical guarantees of the methods. We couldn’t possibly 2Here and in the rest of the paper L denotes the standard “bit complexity” of the linear program. The parameter L is at most the number of bits needed to represent (1.1). For integral A, (cid:126)b, and (cid:126)c the quantity L is often defined to be the potentially smaller quantity L = log(m) + log(1 + dmax) + log(1 + max{(cid:13)(cid:13)(cid:126)c(cid:13)(cid:13)∞,(cid:13)(cid:13)(cid:126)b(cid:13)(cid:13)∞}) where dmax is the 3Here and in the remainder of the paper we use (cid:101)O(·) to hide polylog(n, m) factors. largest absolute value of the determinant of a square sub-matrix of A [8]. 4We assume that A has no rows or columns that are all zero as these can be remedied by trivially removing constraints or variables respectively or immediately solving the linear program. Therefore nnz(A) ≥ min{m, n}. 2 cover the long line of beautiful work on this important problem in full, and we make no attempt. Instead, here we present the major improvements on the number of iterations required to solve (1.1) and discuss the asymptotic running times of these methods. For a more comprehensive history of polynomial time algorithms for linear programming and interior point we refer the reader to one of the many excellent references on the subject, e.g. [29, 43]. dominated by the time needed to solve a linear system of the form(cid:0)AT DA(cid:1) (cid:126)x = (cid:126)y for some positive In 1984 Karmarkar [8] provided the first proof of an interior point method running in polyno- mial time. This method required O(mL) iterations where the running time of each iteration was diagonal matrix D ∈ Rm×m and some (cid:126)y ∈ Rn. Using low rank matrix updates and preconditioning Karmarkar achieved a running time of O(m3.5L) for solving (1.1) inspiring a long line of research into interior point methods.5 Karmarkar’s result sparked interest in a particular type of interior point methods, known as path following methods. These methods solve (1.1) by minimizing a penalized objective function ft((cid:126)x), ft((cid:126)x) where min (cid:126)x∈Rn ft((cid:126)x) def= t · (cid:126)cT (cid:126)x + φ((cid:126)x) and t is a parameter. Usually, the standard log barrier φ((cid:126)x) def= −(cid:80) where φ : Rn → R is a barrier function such that φ((cid:126)x) → ∞ as (cid:126)x tends to boundary of the polytope i∈[m] log([A(cid:126)x − (cid:126)b]i) is used. Path following methods first approximately minimize ft for small t, then use this minimizer as an initial point to minimize f(1+c)t for some constant c, and then repeat until the minimizer is close to the optimal solution of (1.1). Using this approach Renegar provided the first polynomial time interior point method which √ solves (1.1) in O ( mL) iterations [31]. As with Karmarkar’s result the running time of each iteration of this method was dominated by the time needed to solve a linear system of the form (cid:0)AT DA(cid:1) (cid:126)x = (cid:126)y. Using a combination of techniques involving low rank updates, preconditioning and fast matrix multiplication, the amortized complexity of each iteration was improved [38, 7, 29]. The previously fastest running time achieved by such techniques was O(m1.5nL) [37]. In a seminal work of Nesterov and Nemirovski [29], they showed that path-following methods can in principle be applied to minimize any linear cost function over any convex set by using a suitable barrier function. Using this technique they showed how various problems such as semidefinite programming, finding extremal ellipsoids, and more can all be solved in polynomial time via path following. In this general setting, the number of iterations required depended on the square root of a quantity associated with the barrier called self-concordance. They showed that for any convex set in Rn, there exists a barrier function, called the universal barrier function, with self-concordance O(n). Therefore, in theory any such convex optimization problems with n variables can be solved in nL) iterations. However, this result is generally considered to be only of theoretical interest as O ( the universal barrier function is defined as the volume of certain polytopes, a problem which in full generality is NP-hard and its derivatives can only approximated by solving O(nc) linear programs for some large constant c [18]. √ Providing a barrier that enjoys a fast convergence rate and is easy minimize approximately is an important theoretical question with numerous implications. Renegar’s path-following method mL) linear systems. Exploiting the effectively reduces solving a linear program to solving O( √ 5Here and in the remainder of the paper when we provide asymptotic running times for linear programming algorithms, for simplicity we hide additional dependencies on L that may arise from the need to carry out arithmetic operations to precision L. 3 structure of these systems yields the fastest known algorithms for combinatorial problems such as minimum cost flow [3] and multicommodity flow [37]. Given recent breakthroughs in solving two broad class of linear systems, symmetric diagonally dominant linear systems [33, 14, 9, 15] and overdetermined system of linear equations [2, 24, 17] improving the convergence rate of barrier methods while maintaining easy to compute iterations could have far reaching implications6 In 1989, Vaidya [41] made an important breakthrough in this direction. He proposed two barrier functions related to the volume of certain ellipsoids which were shown to yield O((m rank(A))1/4 L) and O(rank(A)L) iteration linear programming algorithms [39, 41, 36]. Unfortunately each iteration of these methods required explicit computation of the projection matrix D1/2A(AT DA)−1AT D1/2 for a positive diagonal matrix D ∈ Rm×m. This was slightly improved by Anstreicher [1] who showed it sufficed to compute the diagonal of this projection matrix. Unfortunately both these methods do not yield faster running times than [37] unless m (cid:29) n and neither are immediately amenable to take full advantage of improvements in solving structured linear system solvers. Year Author 1984 Karmarkar [8] 1986 Renegar [31] 1989 Vaidya [40] 1994 Nesterov and Nemirovskii [29] 2013 This paper Number of Iterations √ O(mL) mL) O( O((cid:112)rank(A)L) O((cid:112)rank(A)L) Nature of iterations Linear system solve Linear system solve O((m rank(A))1/4 L) Expensive linear algebra (cid:101)O(1) Linear system solves These results seem to suggest that you can solve linear programs closer to the O((cid:112)rank(A)L) Volume computation bound achieved by the universal barrier only if you pay more in each iteration. In this paper we show that this is not the case. Up to polylogarithmic factors we achieve the convergence rate of the universal barrier function while only having iterations of cost comparable to that of Karmarkar’s and Renegar’s algorithms. 1.2 Our Approach In this paper our central goal is to produce an algorithm to solve (1.1) in (cid:101)O((cid:112)rank(A)L) iterations where each iteration solves (cid:101)O(1) linear systems of the form(cid:0)AT DA(cid:1) (cid:126)x = (cid:126)y. To achieve our goal ide- ally we would produce a barrier function φ such that standard path following yields a (cid:101)O((cid:112)rank(A)L) racy using (cid:101)O(1) linear system solves. Instead, we consider manipulating a barrier that we can easily compute the gradient of, the standard logarithmic barrier, φ((cid:126)x) = −(cid:80) iteration algorithm with low iterations costs. Unfortunately, we are unaware of a barrier function that both yields a fast convergence rate and has a gradient that can be computed with high accu- i∈[m] log[A(cid:126)x − (cid:126)b]i. Note that the behavior of the logarithmic barrier is highly dependent on the representation of (1.1). Just duplicating a constraint, i.e. a row of A and the corresponding entry in (cid:126)b, corresponds to doubling the contribution of some log barrier term − log[A(cid:126)x − (cid:126)b]i to φ. It is not hard to see that repeating a constraint many times can actually slow down the convergence of standard path In other words, there is no intrinsic reason to weight all the − log[A(cid:126)x − (cid:126)b]i following methods. the same and the running time of path following methods do depend on the weighting of the 6Indeed, in Part II [16]we show how ideas in this paper can be used to yield the first general improvement to the running time of solving the maximum flow problem on capacitated directed graphs since 1998 [6]. 4 − log[A(cid:126)x − (cid:126)b]i. Recently, Mut and Terklaky proved that by duplicating constraints on Klee-Minty √ cubes carefully, the standard logarithmic barrier really requires O( m log(1/)) iterations [23]. To alleviate this issue, we add weights to the log barrier that we change during the course of the algorithm. We show that by carefully manipulating these weights we can achieve a convergence rate that depends on the dimension of the polytope, rank(A), rather than the number of constrains m. In Section 4, we study this weighted log barrier function given by gi(A(cid:126)x − (cid:126)b) · log([A(cid:126)x − (cid:126)b]i) φ((cid:126)x) = − (cid:88) i∈[m] >0 → Rm >0 is a weight function of the current point and we investigate what properties where (cid:126)g : Rm of (cid:126)g((cid:126)x) yield a faster convergence rate. To illustrate the properties of the weighted logarithmic barrier, suppose for simplicity that we normalize A and (cid:126)b so that A(cid:126)x − (cid:126)b = (cid:126)1 and let (cid:126)g def= (cid:126)g((cid:126)1). Under these assumptions, we show that the rate of convergence of path following depends on(cid:13)(cid:13)(cid:126)g(cid:13)(cid:13)1 and i A(cid:0)AT diag ((cid:126)g) A(cid:1)−1 AT (cid:126)1i. (1.2) (cid:126)1T max i∈[m] To improve the convergence rate we would like to keep both these quantities small. For a general matrix A, the quantity (1.2) is related to the leverage scores of the rows of A, a commonly used measure for the importance of rows in a linear system [20]. i A(cid:0)AT diag ((cid:126)g) A(cid:1)−1 AT (cid:126)1i is the effective resistance of the graph while keeping(cid:13)(cid:13)(cid:126)g(cid:13)(cid:13)1 small. Thus, if it exists, an optimal (cid:126)g would simply make put a resistor of resistance 1/gi on the edge i. Then, (cid:126)1T resistance of the edge i [32]. Hence, we wish to to find g to minimize the maximum effective For illustration purposes, if we assume that A is the incidence matrix of a certain graph and all effective resistances the same. This electric network inverse problem is well studied [34] and motivates us to considering the following weight function (cid:126)g((cid:126)s) def= arg max (cid:126)w∈Rm −(cid:126)1T (cid:126)w + 1 α log det(cid:0)AT S−1WαS−1A(cid:1) + β (cid:88) i∈[m] log wi. (1.3) for carefully chosen constants α, β where S def= diag((cid:126)s((cid:126)x)) and W = diag( (cid:126)w). The optimality conditions of this optimization problem imply that the effective resistances are small, the total weight is small, no weight is too small, and every term in the logarithmic barrier is sufficiently penalized. This barrier is related to the volumetric barrier function used by Vaidya [40] and can be viewed as searching for the best function in a family of volumetric barrier function. This formulation nL) iteration path-following algorithm by with some careful analysis can be made to yield an O( solving the following minimax problem t(cid:126)cT (cid:126)x − (cid:126)1T (cid:126)w + log det(cid:0)AT S−1WαS−1A(cid:1) + β (cid:88) (1.4) √ log wi min (cid:126)x∈Rn max (cid:126)w∈Rm 1 α i∈[m] where (cid:126)s((cid:126)x) def= A(cid:126)x − (cid:126)b, S def= diag((cid:126)s((cid:126)x)) and W = diag( (cid:126)w). Unfortunately, computing the derivative of the minimax formula still requires computing the diagonal of the projection matrix as in Vaidya and Anstreicher’s work [37, 1] and is therefore too 5 inefficient for our purposes. In Section 6 we show how to compute (cid:126)w approximately up to certain multiplicative coordinate-wise error using dimension reduction techniques. However, this error is still too much for path following to handle the directly as multiplicatively changing weights can hurt our measures of centrality too much. Therefore, rather than using the weighted log barrier where the weights (cid:126)g((cid:126)x) depends on the (cid:126)x directly, we maintain separate weights (cid:126)w and current point (cid:126)x and use the barrier φ((cid:126)x) = − (cid:88) φ((cid:126)x, (cid:126)w) = − (cid:88) i∈[m] gi((cid:126)x) log(s((cid:126)x)i) wi log(s((cid:126)x)i). i∈[m] We then maintain two invariants, (1) (cid:126)x is centered, i.e. (cid:126)x close to the minimum point of t · (cid:126)cT (cid:126)x + φ((cid:126)x, (cid:126)w) and (2) (cid:126)w close to (cid:126)g((cid:126)x) multiplicatively. We separate the problem of maintaining these invariants into two steps. First, we design a step for changing (cid:126)x and (cid:126)w simultaneously that improves centrality without moving (cid:126)w too far away from (cid:126)g((cid:126)x). We do this by decomposing a standard Newton step into a change in (cid:126)x and a change in (cid:126)w with a ratio chosen using properties of the particular weight function. Second, we show that given a multiplicative approximation to (cid:126)g((cid:126)x) and bounds for how much (cid:126)g((cid:126)x) may have changed, we can maintain the invariant that (cid:126)g((cid:126)x) is close to (cid:126)w multiplicatively without moving (cid:126)w too much. We formulate this as a general two player game and prove that there is an efficient strategy to maintain our desired invariants. Combining these and standard techniques in path-following methods, we obtain an O((cid:112)rank(A)L) iterations path-following algorithm where each iterations consists of O(1) linear system solves. We remark that a key component of our result is a better understanding of the effects of weighting the logarithmic barrier and note that recently Mądry [19] has shown another way of using weighted barrier functions to achieve a O(m10/7) time path-following method for the maximum flow problem on unweighted graphs. We hope this provides further evidence of the utility of the weighted central path discussed in later sections. 1.3 Geometric Interpretation of the Barrier While to the best of our knowledge the specific weighted barrier, (1.3), presented in the previous section is new, the minimax problem, (1.4), induced by the weight function is closely related to fundamental problems in convex geometry. In particular, if we set α = 1, t = 0, and consider the limit as β → 0 in (1.4) then we obtain the following minimax problem −(cid:126)1T (cid:126)w + log det(cid:0)AT S−1WS−1A(cid:1) . min (cid:126)x∈Rn max (cid:126)w≥0 The maximization problem inside (1.5) is often referred to as D-optimal design and is directly related to computing the John Ellipsoid of the polytope {(cid:126)y ∈ Rn : [A ((cid:126)y − (cid:126)x)]i ≤ s((cid:126)x)i} [11]. In and particular, (1.5) is directly computing the John Ellipsoid of the polytope hence, one can view our linear programming algorithm as using approximate John Ellipsoids to improve the convergence rate of interior point methods. (cid:126)x ∈ Rn : A(cid:126)x ≥ (cid:126)b (cid:110) (1.5) (cid:111) 6 Our algorithm is not the first instance of using John Ellipsoids in convex optimization or linear programming. In a seminal work of Tarasov, Khachiyan and Erlikh in 1988 [12], they showed that a general convex problem can be solved in O(n) steps of computing John Ellipsoid and querying a separating hyperplane oracle. Furthermore, in 2008 Nesterov [26] also demonstrated how to use a √ John ellipsoid to compute approximate solutions for certain classes of linear programs in O( n/) iterations and O(n2m + n1.5m/) time. From this geometric perspective, there are two major contributions of this paper. First, we show that the logarithmic volume of an approximate John Ellipsoid is an almost optimal barrier function for linear programming and second, that computing approximate John Ellipsoids can be streamlined such that the cost of these operations is comparable to pert-iteration cost of using the standard logarithmic barrier function. 1.4 Overview The rest of the paper is structured as follows. In Section 2 we provide details regarding the mathe- matical notation we use throughout the paper. In Section 3 we provide some preliminary information on linear programming and interior point methods. In Section 4 we formally introduce the weighted path and analyze this path assuming access to weight function. In Section 5 we present our weight function. In Section 6 we showed approximate weights suffices and in Section 7 we put everything together to present a (cid:101)O((cid:112)rank(A)L) iteration algorithm for linear programming where in each iteration we solve (cid:101)O(1) linear systems. Finally, in the Appendix we provide some additional mathe- matical tools we use throughout the paper. Note that throughout this paper we make little attempt to reduce polylogarithmic factors in our running time. 2 Notation Here we introduce various notation that we will use throughout the paper. This section should be used primarily for reference as we reintroduce notation as needed later in the paper. (For a summary of linear programming specific notation we use, see Appendix A.) Variables: We use the vector symbol, e.g. (cid:126)x, to denote a vector and we omit the symbol when we denote the vectors entries, e.g. (cid:126)x = (x1, x2, . . .). We use bold, e.g. A, to denote a matrix. For integers z ∈ Z we use [z] ⊆ Z to denote the set of integers from 1 to z. We let (cid:126)1i denote the vector that has value 1 in coordinate i and is 0 elsewhere. Vector Operations: We frequently apply scalar operations to vectors with the interpretation that these operations should be applied coordinate-wise. For example, for vectors (cid:126)x, (cid:126)y ∈ Rn we let (cid:126)x/(cid:126)y ∈ Rn with [(cid:126)x/(cid:126)y]i def= (xi/yi) and log((cid:126)x) ∈ Rn with [log((cid:126)x)]i = log(xi) for all i ∈ [n] . Matrix Operations: We call a symmetric matrix A ∈ Rn×n positive semidefinite (PSD) if (cid:126)xT A(cid:126)x ≥ 0 for all (cid:126)x ∈ Rn and we call A positive definite (PD) if (cid:126)xT A(cid:126)x > 0 for all (cid:126)x ∈ Rn. For a positive definite matrix A ∈ Rn×n we denote let (cid:107) · (cid:107)A : Rn → R denote the norm such that for √ all (cid:126)x ∈ Rn we have (cid:107)(cid:126)x(cid:107)A (cid:126)xT A(cid:126)x. For symmetric matrices A, B ∈ Rn×n we write A (cid:22) B to indicate that B − A is PSD (i.e. (cid:126)xT A(cid:126)x ≤ (cid:126)xT B(cid:126)x for all (cid:126)x ∈ Rn) and we write A ≺ B to indicate that B − A is PD (i.e. that (cid:126)xT A(cid:126)x < (cid:126)xT B(cid:126)x for all (cid:126)x ∈ Rn). We define (cid:31) and (cid:23) analogously. For A, B ∈ Rn×m, we let A ◦ B denote the Schur product, i.e. [A ◦ B]ij def= Aij · Bij for all i ∈ [n] and j ∈ [m], and we let A(2) def= A ◦ A. We use nnz(A) to denote the number of nonzero entries in A. def= 7 Diagonal Matrices: For A ∈ Rn×n we let diag(A) ∈ Rn denote the vector such that diag(A)i = Aii for all i ∈ [n]. For (cid:126)x ∈ Rn we let diag((cid:126)x) ∈ Rn×n be the diagonal matrix such that diag(diag((cid:126)x)) = (cid:126)x. For A ∈ Rn×n we let diag(A) be the diagonal matrix such that diag(diag(A)) = diag(A). For a vector (cid:126)x ∈ Rn when the meaning is clear from context we use X ∈ Rn×n to denote X def= diag((cid:126)x). (cid:126)x and (cid:126)y are close multiplicatively. We often write (cid:13)(cid:13)X−1((cid:126)y − (cid:126)x)(cid:13)(cid:13)∞ ≤  to convey the equivalent more convenient to write (cid:13)(cid:13) log (cid:126)x − log (cid:126)y(cid:13)(cid:13)∞ ≤  which is approximately equivalent for small . In Multiplicative Approximations: Frequently in this paper we need to convey that two vectors facts that yi ∈ [(1 − )xi, (1 + )xi] for all i or (1 − )X (cid:22) Y (cid:22) (1 + )X. At times we find it Lemma 33, we bound the quality of this approximation. Matrices: We use Rm matrix A ∈ Rm×n and vector (cid:126)x ∈ Rm >0 to denote the vectors in Rm where each coordinate is positive and for a >0 we define the following matrices and vectors • Projection matrix PA((cid:126)x) ∈ Rm×m: PA((cid:126)x) def= X1/2A(AT XA)−1AT X1/2. • Leverage scores (cid:126)σA((cid:126)x) ∈ Rm: (cid:126)σA((cid:126)x) def= diag(PA((cid:126)x)). • Leverage matrix ΣA((cid:126)x) ∈ Rm×m: ΣA((cid:126)x) def= diag(PA((cid:126)x)). • Projection Laplacian ΛA((cid:126)x) ∈ Rm×m: ΛA((cid:126)x) def= ΣA((cid:126)x) − PA((cid:126)x)(2). The definitions of projection matrix and leverage scores are standard when the rows of A are reweighed by the values in vector (cid:126)x. Convex Sets: We call a set U ⊆ Rk convex if for all (cid:126)x, (cid:126)y ∈ Rk and all t ∈ [0, 1] it holds that t · (cid:126)x + (1 − t) · (cid:126)y ∈ U. We call U symmetric if (cid:126)x ∈ Rk ⇔ −(cid:126)x ∈ Rk. For any α > 0 and convex set U ⊆ Rk we let αU def= {(cid:126)x ∈ Rkα−1(cid:126)x ∈ U}. For any p ∈ [1,∞] and r ∈ R≥0 the (cid:96)p ball of radius r is given by {(cid:126)x ∈ Rk(cid:13)(cid:13)(cid:126)x(cid:13)(cid:13)p ≤ r}. ∂xi Calculus: For a function f : Rn → R differentiable at x ∈ Rn, we denote the gradient of f at (cid:126)x by ∇f ((cid:126)x) ∈ Rn where we have [∇f ((cid:126)x)]i = ∂ f ((cid:126)x) for all i ∈ [n]. If f ∈ Rn → R is twice differentiable at x ∈ Rn, we denote the Hessian of f at x by∇2f ((cid:126)x) where we have [∇f ((cid:126)x)]ij = ∂2 f ((cid:126)x) for all i, j ∈ [n]. Often we will consider functions of two vectors, g : Rn1×n2 → R, and wish to compute the gradient and Hessian of g restricted to one of the two vectors. For (cid:126)x ∈ Rn and (cid:126)y ∈ Rm then we let ∇(cid:126)x(cid:126)g((cid:126)a,(cid:126)b) ∈ Rn1 denote the gradient of (cid:126)g for fixed (cid:126)y at point {(cid:126)a,(cid:126)b} ∈ Rn1×n2. We define ∇(cid:126)y, ∇2 (cid:126)x(cid:126)x, (cid:126)y(cid:126)y similarly. Furthermore for h : Rn → Rm differentiable at (cid:126)x ∈ Rn we let J((cid:126)h((cid:126)x)) ∈ Rm×n and ∇2 denote the Jacobian of (cid:126)h at (cid:126)x where for all i ∈ [m] and j ∈ [n] we let [J((cid:126)h((cid:126)x))]ij h((cid:126)x)i. For functions of multiple vectors we use subscripts, e.g. J(cid:126)x, to denote the Jacobian of the function restricted to the (cid:126)x variable. def= ∂ ∂xj ∂xi∂xj 3 Preliminaries Here we provide a brief introduction to path following methods for linear programming. The purpose of this section is to formally introduce interior point terminology and methodology that we build upon to obtain (cid:101)O((cid:112)rank(A)L) iteration solver. The algorithm and the analysis discussed in this section can be viewed as a special case of the framework presented in Section 4. The reader well 8 versed in path following methods can likely skip this section and to the more curious reader we encourage them to consider some of the many wonderful expositions on this subject [28, 43, 7] for further reading. 3.1 The Setup Given a matrix, A ∈ Rm×n, and vectors, (cid:126)b ∈ Rm and (cid:126)c ∈ Rn, the central goal of this paper is to efficiently compute a solution to the following linear program min (cid:126)x∈Rn : A(cid:126)x≥(cid:126)b (cid:126)cT (cid:126)x (3.1) It is well known that this is the dual of the standard form of a linear program and hence all linear programs can be expressed by (3.1). We call a vector (cid:126)x ∈ Rm feasible if A(cid:126)x ≥ (cid:126)b, we call (cid:126)cT (cid:126)x the cost of such a vector. therefore our goal is to either compute a minimum cost feasible vector or determine that none exists. We assume that A is full rank, i.e. rank(A) = n, and that m ≥ n. Nevertheless, we still write many of our results using rank(A) rather than n for two reasons. First, this notation makes clear that rank(A) is referring to the smaller of the two quantities m and n. Second, if rank(A) < n, then we can reduce the number of variables to rank(A) by a change of basis.7 Hence, we only need to solve linear programs in the full rank version. 3.2 Path Following Interior Point Interior point methods solve (3.1) by maintaining a point (cid:126)x that is in the interior of the feasible region, i.e. (cid:126)x ∈ S0 where S0 def= {(cid:126)x ∈ Rn : A(cid:126)x > (cid:126)b}. These methods attempt to iteratively decrease the cost of (cid:126)x while maintaining strict feasibility. This is often done by considering some measurement of the distance to feasibility such as (cid:126)s((cid:126)x) def= A(cid:126)x−(cid:126)b, called the slacks, and creating some penalty for these distances approaching 0. Since (cid:126)s((cid:126)x) > 0 if and only if (cid:126)x ∈ S0 by carefully balancing penalties for small (cid:126)s((cid:126)x) and penalties for large (cid:126)cT (cid:126)x these methods eventually compute a point close enough to the optimum solution that it can be computed exactly. Path following methods fix ratios between the the penalty for large (cid:126)cT (cid:126)x and the penalty for small (cid:126)s((cid:126)x) and alternate between steps of optimizing with respect to this ratio and changing the >0 → R such ratio. These methods typically encode the penalties through a barrier function φ : Rm that φ((cid:126)s((cid:126)x)) → ∞ as s((cid:126)x)i → 0 for any i ∈ [m] and they encode the ratio through some parameter t > 0. Formally, they attempt to solve optimization problems of the following form for increasing values of t ft((cid:126)x) def= t · (cid:126)cT (cid:126)x + φ((cid:126)s((cid:126)x)) min (cid:126)x∈Rm ft((cid:126)x) where (3.2) Since φ((cid:126)s((cid:126)x)) → ∞ as s((cid:126)x)i → 0 the minimizer of ft((cid:126)x), denoted (cid:126)x∗(t), is in S0 for all t. As t increases the effect of the cost vector on (cid:126)x∗(t) increases and the distance from the boundary of the feasible region as measured by (cid:126)s((cid:126)x) decreases. One can think of the points {(cid:126)x∗(t) t > 0} as a path minished by using a subspace embedding [24] to replace (cid:126)x with Π(cid:126)y for subspace embedding Π and (cid:101)O(rank(A)) 7In general, computing this change of basis may be computationally expensive. However, this cost can be di- dimensional (cid:126)y. Then using the reduction in Appendix E we only need to work with an (cid:101)O(rank(A)) rank matrix. 9 in Rn, called the central path, where (cid:126)x∗(t) approaches a solution to (3.1) as t → ∞. A standard choice of barrier is the standard log barrier, φ((cid:126)s((cid:126)x)) def= −(cid:80){i} log(s((cid:126)x)i) and for this choice of barrier we refer to {(cid:126)x∗(t) t > 0} as the standard central path. Path following methods typically follow the following framework: (1) Compute Initial Point: Compute an approximation (cid:126)x∗(t) for some t. (2) Follow the central path: Repeatedly increase t and compute an approximation to (cid:126)x∗(t). (3) Round to optimal solution: Use the approximation to (cid:126)x∗(t) to compute the solution to (3.1). Steps (1) and (3) are typically carried out by standard interior point techniques. These techniques are fairly general and covered briefly in Section 7 and Appendix E. However, the manner in which (2) is performed varies greatly from method to method. In the following subsection we provide a simple technique for performing (2) that yields reasonable running times and serves as the foundation for the algorithms considered in the remainder of the paper. 3.3 Following the Path There are numerous techniques to follow the central path, i.e. approximately compute (cid:126)x∗(t) for increasing values of t. Even with the barrier fixed there are numerous schemes to balance maintaining a point close to a central path point, advancing to a further central path point, and performing the numerical linear algebra needed for these operations [37, 7, 22, 29]. In this section we present a simple and common method whereby we simply alternate between improving our distance to (cid:126)x∗(t) for some fixed t, and increasing t by some fixed multiplicative factor. This method reduces the analysis of path following to bounding the computational complexity of centering, i.e. improve the distance to (cid:126)x∗(t), and bounding how much increasing t hurts centrality, i.e. increases the distance to (cid:126)x∗(t). In the remainder of this section we show how to perform this analysis for the standard central path, φ((cid:126)x) def= −(cid:80) Typically path following methods center, i.e. minimize ft((cid:126)x), using Newton’s method or some variant thereof. While for an arbitrary current point (cid:126)x ∈ S0 and t > 0 the function ft((cid:126)x) can be ill- behaved, in a region near (cid:126)x∗(t) the Hessian of ft((cid:126)x) given by ∇2ft((cid:126)x) = AT S−2A for S def= diag((cid:126)s((cid:126)x)) changes fairly slowly. More precisely, if one considers the second order approximation of ft((cid:126)z) around some point (cid:126)x ∈ S0 “close enough” to (cid:126)x∗(t) , i∈[m] log(s((cid:126)x)i). ft((cid:126)z) ≈ ft((cid:126)x) + (cid:104)∇ft((cid:126)x), (cid:126)z − (cid:126)x(cid:105) + ((cid:126)z − (cid:126)x)T (∇2ft((cid:126)x)) ((cid:126)z − (cid:126)x) , 1 2 and applies one step of Newton’s method, i.e. minimizes this quadratic approximation to compute (cid:126)x(new) := (cid:126)x − (∇2ft((cid:126)x))−1∇ft((cid:126)x) = (cid:126)x − (AT S−2A)−1(t(cid:126)c − AT (cid:126)s) for (cid:126)s def= (cid:126)s((cid:126)x) then this procedure rapidly converges to (cid:126)x∗(t). To quantify this, we measure centrality, i.e. how close the current point (cid:126)x ∈ S0 is to (cid:126)x∗(t), by the size of this Newton step in the Hessian induced norm. For (cid:126)x ∈ S0 and Newton step (cid:126)ht((cid:126)x) def= (∇2ft((cid:126)x))−1∇ft((cid:126)x) we denote centrality by δt((cid:126)x) def=(cid:13)(cid:13)(cid:126)ht((cid:126)x)(cid:13)(cid:13)∇2ft((cid:126)x). Standard analysis of Newton’s 10 √ Combining these facts yields that in O( method shows that if δt((cid:126)x) is less than some constant then for (cid:126)x(new) := (cid:126)x−(cid:126)h((cid:126)x) we have δt((cid:126)x(new)) = O(δt((cid:126)x)2) (See Lemma 5). Furthermore, under these conditions it is not hard to show that for t(cid:48) = t(1 + (m)−1/2) we have δt(cid:48)((cid:126)x(new)) ≤ O (δt((cid:126)x)) (See Lemma 1). m) iterations we can double t while maintaining a nearly centered (cid:126)x, i.e. δt((cid:126)x) at most a constant. With some additional work discussed briefly in Section 7 it can be shown that by maintaining a nearly centered (cid:126)x and changing t by a constant factor at most (cid:101)O(L) times one can compute a solution to (3.1). Therefore, this method solves (3.1) mL) iterations where the cost of each iteration is O(nnz(A)) plus the time need to solve a √ in O( linear system in the matrix AT S−2A. 4 Weighted Path Finding In this section we introduce the optimization framework we use to solve the linear programs, the weighted central path. After formally defining the path (Section 4.1), we prove properties of the path (Section 4.2) and show how to center along the path (Section 4.3). We show that the performance of path following methods using a weighted central path depends crucially on how the weights are computed and in Section 4.4 we characterize the properties we require of such a weight function in order to ensure that our weighted path following scheme converges efficiently. In Section 4.2 we analyze the convergence rate of our weighted path following scheme assuming the ability to compute these weights exactly. In the following section we then show how it suffices to compute the weights approximately (Section 6), we show how to compute these weights efficiently (Section 5), and we show how this yields an efficient linear program solver (Section 7). Section 3.2. Rather than keeping the barrier function φ((cid:126)x) = −(cid:80) 4.1 The Weighted Path Our weighted path following method is a generalization of the path following scheme presented in i∈[m] log s((cid:126)x)i fixed we allow for greater flexibility in how we penalize slack variables and adaptively modify the barrier function in order to take larger steps. In addition to maintaining a feasible point (cid:126)x and a path parameter t we maintain a set of positive weights (cid:126)w ∈ Rm >0 and attempt to minimize the penalized objective function ft : S0 × Rm >0 → R given for all (cid:126)x ∈ S0 and (cid:126)w ∈ Rm wi log s((cid:126)x)i. (4.1) ft((cid:126)x, (cid:126)w) def= t · (cid:126)cT (cid:126)x − (cid:88) >0 by i∈[m] >0} and our goal is to compute a sequence of feasible Note that trivially any (cid:126)x ∈ S0 can be expressed as arg min(cid:126)y∈Rn ft((cid:126)y, (cid:126)w) for some (cid:126)w ∈ Rm We maintain a feasible point {(cid:126)x, (cid:126)w} ∈ {S0 × Rm points for increasing t and changing (cid:126)w such that ft((cid:126)x, (cid:126)w) is nearly minimized with respect to (cid:126)x. >0 and therefore, every (cid:126)x ∈ S0 is a weighted central path point for some choice of weights. However, in >0} to a solution for (1.1) we order to to convert a weighted central path point {(cid:126)x, (cid:126)w} ∈ {S0 × Rm will need to have t large and(cid:13)(cid:13) (cid:126)w(cid:13)(cid:13)1 small which precludes this trivial choice of t and (cid:126)w. the weighted central path while making large increases in t and maintaining(cid:13)(cid:13) (cid:126)w(cid:13)(cid:13)1 small. Ultimately, this will allow us to solve linear programs in (cid:101)O((cid:112)rank(A)L) iterations while only solving (cid:101)O(1) linear In the remainder of the paper, we show that by careful updating (cid:126)x, (cid:126)w, and t we can stay close to systems in each iteration. 11 4.2 Properties of the Weighted Path As in Section 3.3 for a feasible {(cid:126)x, (cid:126)w} ∈ {S0 × Rm >0} we measure the centrality of this point by the size of the Newton step on (cid:126)x in the Hessian norm, denoted by δt((cid:126)x, (cid:126)w) and we call {(cid:126)x, (cid:126)w} a central path point if δt((cid:126)x, (cid:126)w) = 0. For the penalized objective function ft, we see that the Newton step, (cid:126)ht((cid:126)x, (cid:126)w), is given by (cid:126)ht((cid:126)x, (cid:126)w) = (∇2 (cid:126)x(cid:126)xft((cid:126)x, (cid:126)w))−1∇(cid:126)xft((cid:126)x, (cid:126)w) = (AT S−1WS−1A)−1(t(cid:126)c − AT S−1 (cid:126)w) and the centrality, δt((cid:126)x, (cid:126)w), is given by for all {(cid:126)x, (cid:126)w} ∈ {S0 × Rm δt((cid:126)x, (cid:126)w) def=(cid:13)(cid:13)(cid:126)ht((cid:126)x, (cid:126)w)(cid:13)(cid:13)∇2 (cid:126)x(cid:126)xft((cid:126)x, (cid:126)w) =(cid:13)(cid:13)t(cid:126)c − AT S−1 (cid:126)w(cid:13)(cid:13)(AT S−1WS−1A) >0} by −1 (4.2) (4.3) √ (cid:13)(cid:13) (cid:126)w(cid:13)(cid:13)1 =(cid:80) i∈[m] wi. Whereas in the standard central path we saw that the centrality increased at a rate of m as t increased, here we show that in this more general case, the m is replaced by the total weight Lemma 1 (Weighted Path Step). For all {(cid:126)x, (cid:126)w} ∈ {S0 × Rm δ(1+α)t((cid:126)x, (cid:126)w) ≤ (1 + α)δt((cid:126)x, (cid:126)w) + α (cid:113)(cid:13)(cid:13) (cid:126)w(cid:13)(cid:13)1 >0} and t, α ≥ 0, we have δt((cid:126)x, (cid:126)w) yields Proof. Let (cid:126)s def= (cid:126)s((cid:126)x). By (4.3) we have Now,(cid:13)(cid:13) ·(cid:13)(cid:13)(AT S−1WS−1A)−1 is a norm and therefore by the triangle inequality and the definition of δ(1+α)t((cid:126)x, (cid:126)w) =(cid:13)(cid:13)(1 + α)t(cid:126)c − AT S−1 (cid:126)w(cid:13)(cid:13)(AT S−1WS−1A)−1. δ(1+α)t((cid:126)x, (cid:126)w) ≤ (1 + α)δt((cid:126)x, (cid:126)w) + α(cid:13)(cid:13)AT S−1 (cid:126)w(cid:13)(cid:13)(AT S−1WS−1A)−1. (cid:115)(cid:88) (cid:13)(cid:13)AT S−1 (cid:126)w(cid:13)(cid:13)(AT S−1WS−1A)−1 =(cid:13)(cid:13)W−1/2 (cid:126)w(cid:13)(cid:13)PS−1A( (cid:126)w) ≤(cid:13)(cid:13)W−1/2 (cid:126)w(cid:13)(cid:13)2 = (4.4) Recall that PS−1A ( (cid:126)w) = W1/2S−1A(AT S−1WS−1A)−1AT S−1W1/2 is a projection matrix. Con- sequently PS−1A ( (cid:126)w) (cid:22) I and we have wi. (4.5) i∈[m] Combining (4.4) and (4.5) yields the result. Now to see how well a Newton step on (cid:126)x can center, i.e. decrease δt((cid:126)x, (cid:126)w), we need to bound how fast the second order approximation of ft((cid:126)x, (cid:126)w) can change, i.e. how much the Hessian, ∇2 (cid:126)x(cid:126)xft((cid:126)x, (cid:126)w), changes as we change (cid:126)x. We do this by bounding how much the slacks can change as we change (cid:126)x. As ∇2 (cid:126)x(cid:126)xft((cid:126)x, (cid:126)w) = AT S−1WS−1A this immediately bounds how much the Hessian can change as we change (cid:126)x. The following lemma is motivated by similar results in [40, 1]. 12 Lemma 2 (Relative Change of Slacks). Let (cid:126)x(new) = (cid:126)x + (cid:126)∆ for some (cid:126)x ∈ S0 and (cid:126)∆ ∈ Rn. Let (cid:126)s(new) and (cid:126)s denote the slacks associated with (cid:126)x(new) and (cid:126)x respectively. If (cid:13)(cid:13)S−1A(cid:126)∆(cid:13)(cid:13)∞ < 1 then (4.6) Proof. Clearly (cid:126)s(new) = (cid:126)s + A(cid:126)∆ and therefore the multiplicative change in slacks is given by i∈[m] i∈[m] (cid:126)x(new) ∈ S0 and (cid:13)(cid:13)W−1/2(cid:126)1i In particular, choosing (cid:126)∆ = −(cid:126)ht((cid:126)x, (cid:126)w) yields (cid:13)(cid:13)PS−1A( (cid:126)w). (cid:13)(cid:13)W−1/2(cid:126)1i (cid:13)(cid:13)PS−1A( (cid:126)w). (cid:13)(cid:13)S−1A(cid:126)∆(cid:13)(cid:13)∞ ≤(cid:13)(cid:13)(cid:126)∆(cid:13)(cid:13)AT S−1WS−1A · max (cid:13)(cid:13)S−1A(cid:126)∆(cid:13)(cid:13)∞ ≤ δt((cid:126)s, (cid:126)w) · max (cid:13)(cid:13)S−1((cid:126)s(new) − (cid:126)s)(cid:13)(cid:13)∞ =(cid:13)(cid:13)S−1A(cid:126)∆(cid:13)(cid:13)∞. Consequently (cid:126)x(new) ∈ S0 if and only if(cid:13)(cid:13)S−1A(cid:126)∆(cid:13)(cid:13)∞ < 1. To prove (4.6) we note that by definition of(cid:13)(cid:13) ·(cid:13)(cid:13)∞ (cid:12)(cid:12)(cid:12)(cid:68) (cid:13)(cid:13)S−1A(cid:126)∆(cid:13)(cid:13)∞ = max (cid:12)(cid:12)(cid:12)(cid:68)(cid:0)AT S−1WS−1A(cid:1)1/2 (cid:126)∆,(cid:0)AT S−1WS−1A(cid:1)−1/2 (cid:13)(cid:13)(AT S−1WS−1A) (cid:13)(cid:13)S−1A(cid:126)∆(cid:13)(cid:13)∞ ≤(cid:13)(cid:13)(cid:126)∆(cid:13)(cid:13)AT S−1WS−1A · max Using that A is full rank and therefore AT S−1WS−1A (cid:31) 0 then yields (cid:13)(cid:13)S−1A(cid:126)∆(cid:13)(cid:13)∞ = max (cid:13)(cid:13)AT S−1(cid:126)1i Applying Cauchy Schwarz we have S−1A(cid:126)∆, (cid:126)1i i∈[m] (cid:69)(cid:12)(cid:12)(cid:12) . AT S−1(cid:126)1i (cid:69)(cid:12)(cid:12)(cid:12)i . i∈[m[ Recalling the definition PS−1A ( (cid:126)w) = W1/2S−1A(cid:0)AS−1WS−1A(cid:1)−1 AT S−1W1/2 yields the result. (cid:13)(cid:13)PS−1A( (cid:126)w) decreases, the region over which Newton steps do Lemma 2 implies that as(cid:13)(cid:13)W−1/2(cid:126)1i not change the Hessian too much increases. We call this quantity, (cid:13)(cid:13)W−1/2(cid:126)1i (cid:13)(cid:13)PS−1A( (cid:126)w), the slack i∈[m[ −1. sensitivity as it measures how much slack changes during a Newton step. Definition 3 (Slack Sensitivity). For (cid:126)s, (cid:126)w ∈ Rm >0 the slack sensitivity8, γ((cid:126)s, (cid:126)w) is given by (cid:13)(cid:13)W−1/2(cid:126)1i (cid:13)(cid:13)PS−1A( (cid:126)w). γ((cid:126)s, (cid:126)w) def= max i∈[m] Geometrically, slack sensitivity indicates how much a relative slack can change during a Newton step, equivalently, how small is the Newton step region compared to the original polytope. From Lemmas 1 and 2 our goal in using the weighted central path is clear. We wish to keep(cid:13)(cid:13) (cid:126)w(cid:13)(cid:13)1 small so that we can make large increases to t without increasing centrality and we wish to keep γ((cid:126)s((cid:126)x), (cid:126)w) small so that over a large region we can improve centrality quickly. Unfortunately, while it is not too difficult to produce weights that meet these criterion, changing the weights can also increase δt. Therefore, we also need to choose weights in such a way that they do not change too drastically as we take Newton steps. In the next subsection we introduce the step that we use to improve centrality and account for possible changes in the weights. 8In the previous version in ArXiv, we called it weighted condition number which is confusing. We are indebted to an anonymous reviewer for suggesting this name. 13 4.3 Centering Steps Here we define the centering step we use to decrease δt((cid:126)x, (cid:126)w). There are two ways to decrease δt, one is to perform a Newton step on (cid:126)x which corresponds to move (cid:126)x closer to the central path., one is to set (cid:126)w such that δt((cid:126)x, (cid:126)w) = 0 which corresponds to move the path itself to closer to (cid:126)x. By mixing two steps, we can slow down progress along a specific weighted path as much as we want but still obtaining the guarantee of Newton method. We call this r-step where r controls the ratio of how much we change (cid:126)w and (cid:126)x. Setting r = 0 corresponds to a standard Newton step on (cid:126)x where the weights are not updated. Setting r = ∞ coresponds to changing (cid:126)w to make (cid:126)x completely centered. There are two reasons we do thisinstead of a standard Newton step: 1. When we change (cid:126)x, we need to change the weights (cid:126)w accordingly to maintain the the properties we want. However, when we change the weights (cid:126)w, we need to update (cid:126)x again, and so on. For the weight function we consider in Section 5 the change of (cid:126)w required is large. Consequently, after updating the weights we need to move (cid:126)x even more and it is not clear how to maintain good weights and good centrality at the same time if we neglect the direction in which the weights change. However, the weights we use actual change in a direction which partial helps improve centrality. Considering a r-step helps us account for this progress directly. 2. We cannot compute the weights we want to use exactly. Instead we only know how to compute them approximately up to 1/polylog(m) multiplicative error using Johnson–Lindenstrauss. . Therefore, if we take a full Newton step on (cid:126)x and update the weights using the weight function, the error in our approximation is possibly so large that the step in full would not help centrality. To control this error and center when we cannot compute the weights exactly, we exploit that the r-step gives us part of the change in the weights that we can compute precisely. Definition 4 (r-step). Given a feasible point {(cid:126)x(old), (cid:126)w(old)} ∈ {S0 × Rm a r-step >0}, a path parameter t, and {(cid:126)x(new), (cid:126)w(new)} = stept((cid:126)x(old), (cid:126)w(old), r) is defined as follows where we recall that (cid:126)x(new) def= (cid:126)x(old) − 1 1 + r r (cid:126)w(new) def= (cid:126)w(old) + (cid:126)ht((cid:126)x(old), (cid:126)w(old)), W(old)S−1 1 + r (old)A(cid:126)ht((cid:126)x(old), (cid:126)w(old)) (cid:126)ht((cid:126)x(old), (cid:126)w(old)) def= (AT S−1 (old)W(old)S−1 (old)A)−1(t(cid:126)c − AT S−1 (old) (cid:126)w(old)) and we let (cid:126)s(old) and (cid:126)s(new) denote the slacks with (cid:126)x(old) and (cid:126)x(new) respectively. Note that for a r-step we have (cid:126)s(new) = (cid:126)s(old) − 1 1 + r A(cid:126)h((cid:126)x(old), (cid:126)w(old)) and therefore W−1 (old)( (cid:126)w(new) − (cid:126)w(old)) = −rS−1 (old)((cid:126)s(new) − (cid:126)s(old)). (4.7) (4.8) 14 In other words, a r-step performs a multiplicative update on the weights that is exactly r times larger than the update on the slacks. Using Lemma 2 we now show that so long as δt((cid:126)x(old), (cid:126)w(old)) is reasonably small with respect to the slack sensitivity, any r-step produces a feasible {(cid:126)x(new), (cid:126)w(new)} and does not change the Hessian too much. Lemma 5 (Stability of r-step). Let {(cid:126)x(new), (cid:126)w(new)} = stept((cid:126)s(old), (cid:126)w(old), r) where γ def= γ((cid:126)x(old), (cid:126)w(old)) and δt def= δt((cid:126)x(old), (cid:126)w(old)) ≤ 1 8γ . (old)((cid:126)s(new) − (cid:126)s(old))(cid:13)(cid:13)W(old) Under these conditions we have(cid:13)(cid:13)S−1 (old)((cid:126)s(new) − (cid:126)s(old))(cid:13)(cid:13)∞ ≤ 1 (cid:13)(cid:13)S−1 (old)( (cid:126)w(new) − (cid:126)w(old))(cid:13)(cid:13)∞ ≤ r (cid:13)(cid:13)W−1 ≤ 1 1 + r 1 + r 1 + r · δt, · δt · γ, · δt · γ. Consequently {(cid:126)x(new), (cid:126)w(new)} is feasible and (1 − 3δtγ)∇2 (cid:126)x(cid:126)xft((cid:126)x(old), (cid:126)w(old)) (cid:22) ∇2 (cid:126)x(cid:126)xft((cid:126)x(new), (cid:126)w(new)) (cid:22) (1 + 3δtγ)∇2 (cid:126)x(cid:126)xft((cid:126)x(old), (cid:126)w(old)) (4.9) (4.10) (4.11) (4.12) Proof. Equation (4.9) follows from the definition of δt and (4.7). Equations (4.10) and (4.11) follow from Lemma 2, the definition of γ, (4.7), and (4.8). Since δt ≤ 1 8γ this implies that slack or weight >0}. changes by more than a multiplicative factor of 1 8 and therefore clearly {(cid:126)s(new), (cid:126)w(new)} ∈ {S0×Rm To prove (4.12) note that (4.10) and (4.11) imply that (cid:16) (cid:16) 1 − r 1+r δtγ 1 − 1 1+r δtγ (cid:17) W(old) (cid:22) W(new) (cid:22)(cid:16) (cid:17) S(old) (cid:22) S(new) (cid:22)(cid:16) 1 + r 1+r δtγ (cid:17) (cid:17) 1 + 1 S(old). >0} we have that 1+r δtγ W(old), (cid:126)x(cid:126)xft((cid:126)x, (cid:126)w) = AT S−1WS−1A for (cid:126)x, (cid:126)w ∈ {S0 × Rm (cid:126)x(cid:126)xft((cid:126)x(new), (cid:126)w(new)) (cid:22) (cid:126)x(cid:126)xft((cid:126)x(old), (cid:126)w(old)). Since ∇2 1 − r (cid:16) (cid:16) 1+r δtγ 1 + 1 1+r δtγ (cid:17) (cid:17)2∇2 (cid:126)x(cid:126)xft((cid:126)x(old), (cid:126)w(old)) (cid:22) ∇2 (cid:16) (cid:16) (cid:17) (cid:17)2 ≤ 1 + 3δtγ 1+r δtγ 1 + r 1 − 1 1+r δtγ (cid:16) (cid:16) and 1 − r 1+r δtγ 1 + 1 1+r δtγ (cid:16) (cid:16) (cid:17) (cid:17)2∇2 1+r δtγ 1 + r 1 − 1 1+r δtγ (cid:17) (cid:17)2 ≥ 1 − 3δtγ. Using that 0 ≤ δtγ ≤ 1 8 and computing the Taylor series expansions9 yields that 9Throughout this paper, when we use taylor series expansions we may use more than just the second order approximation to the function. 15 Using Lemma 5 we now bound how much a r-step improves centrality. Lemma 6 (Centrality Improvement of r-step). Let {(cid:126)x(new), (cid:126)w(new)} = stept((cid:126)x(old), (cid:126)w(old), r) where γ def= γ((cid:126)x(old), (cid:126)w(old)) and δt def= δt((cid:126)x(old), (cid:126)w(old)) ≤ 1 8γ . We have the following bound on the change in centrality δt((cid:126)x(new), (cid:126)w(new)) ≤ 2 1 + r · γ · δ2 t . Proof. Let (cid:126)ht definition of stept, we see that def= (cid:126)ht((cid:126)x(old), (cid:126)w(old)) and let (cid:126)∆ def= S−1 (old)((cid:126)s(new) − (cid:126)s(old)) = −1 (old)A(cid:126)ht. Recalling the (cid:32) (cid:33) (cid:32) · 1+r S−1 (cid:33) 1 − r (cid:126)∆i 1 + (cid:126)∆i (cid:126)w(new) i (cid:126)s(new) i = = (cid:32) (cid:126)w(old) i (cid:126)s(old) i (cid:126)w(old) i (cid:126)s(old) i (cid:126)w(old) i (cid:126)s(old) i (cid:33) i i = − r (cid:126)w(old) (cid:126)∆i (cid:33)(cid:32) + (cid:126)s(old) (cid:126)∆i 1 − (1 + r)(cid:126)∆i 1 + (cid:126)∆i (cid:16) (old) (cid:126)w(old) = ∇xft((cid:126)x(old), (cid:126)w(old)) = t(cid:126)c − AT S−1 = −(1 + r)AT S−1 (old)W(old) Using the definition of (cid:126)ht we have (4.13) (4.14) (4.15) (cid:17) (cid:126)ht (old)A AT S−1 (cid:126)∆ (old)W(old)S−1 (cid:17) . and therefore t(cid:126)c = AT S−1 (old)W(old) Combining (4.13) and (4.14) and using the definition of (cid:126)∆ then yields ∇xft((cid:126)x(new), (cid:126)w(new)) = t(cid:126)c − AT S−1 (new) (cid:126)w(new) (cid:16)(cid:126)1 − (1 + r)(cid:126)∆ (cid:32) = AT S−1 (old)W(old) (cid:126)1 − (1 + r)(cid:126)∆ − (cid:126)1 + (cid:33) (1 + r)(cid:126)∆ (cid:126)1 + (cid:126)∆ = −(1 + r)AT S−1 = AT S−1 (old)W(old)S−1 (old)W(old) (cid:126)∆2 (cid:126)1 + (cid:126)∆ (old)diag((cid:126)∆)(I + diag((cid:126)∆))−1A(cid:126)ht Now by Lemma 5 we know that (new)W(new)S−1 Therefore by (4.15) and the fact that AT S−1 (cid:16) (cid:126)w(old)(cid:17) PS−1 (old)A (new)A (cid:23) (1 − 3δtγ)AT S−1 (old)A. (old)W(old)S−1 (cid:17)−1 AT S−1 = W1/2 (old)S−1 (old)A AT S−1 (old)WS−1 (old)A (old)W1/2 (old) (cid:22) I, (cid:16) 16 S−1 (old) A( (cid:126)w(old)) AT S−1 (new)W(new)S−1 (new)A we have δt((cid:126)x(new), (cid:126)w(new)) =(cid:13)(cid:13)∇xft((cid:126)x(new), (cid:126)w(new))(cid:13)(cid:13)(cid:16) (old)A(cid:126)h(cid:13)(cid:13)P (old)A(cid:126)h(cid:13)(cid:13)2 (cid:17)−1 ≤ (1 − 3δtγ)−1/2(cid:13)(cid:13)diag((cid:126)∆)(I + diag((cid:126)∆))−1W1/2 (old)S−1 ≤ (1 − 3δtγ)−1/2(cid:13)(cid:13)diag((cid:126)∆)(I + diag((cid:126)∆))−1W1/2 (old)S−1 (old)A(cid:126)h(cid:13)(cid:13)2 ≤ (1 − 3δtγ)−1/2 (cid:13)(cid:13)(cid:126)∆(cid:13)(cid:13)∞ (cid:13)(cid:13)W1/2 1 −(cid:13)(cid:13)(cid:126)∆(cid:13)(cid:13)∞ (old)S−1 (cid:32) (cid:13)(cid:13)(cid:126)∆(cid:13)(cid:13)∞ (cid:33) 1 −(cid:13)(cid:13)(cid:126)∆(cid:13)(cid:13)∞ where in the last step we use that by Lemma 5,(cid:13)(cid:13)(cid:126)∆(cid:13)(cid:13)∞ ≤ 1 quickly we need to maintain weights such that (cid:13)(cid:13) (cid:126)w(cid:13)(cid:13)1, γ((cid:126)s, (cid:126)w), and δt((cid:126)x, (cid:126)w) are small. Rather 4.4 Weight Functions In Sections 4.1, 4.2, and 4.3 we saw that to make our weighted path following schemes to converge 1+r δtγ and that δ ≤ 1 than showing how to do this directly, here we assume we have access to some fixed differentiable function for computing the weights and we characterize when such a weight function yields an efficient weighted path following scheme. This allows us to decouple the problems of using weights effectively and computing these weights efficiently. 8γ by assumption. = (1 − 3δtγ) ≤ 2 1 + r −1/2 · δt γδ2 t >0 → Rm For the remainder of this paper we assume that we have a fixed differentiable weight function >0 from slacks to positive weights (see Section 5 for a description of the function we (cid:126)g : Rm use). For slacks (cid:126)s ∈ Rm >0 we let G((cid:126)s) def= diag((cid:126)g((cid:126)s)) denote the diagonal matrix associated with the slacks and we let G(cid:48)((cid:126)s) def= J(cid:126)s((cid:126)g((cid:126)s)) denote the Jacobian of the weight function with respect to the slacks. bounded, and good slack sensitivity, i.e. γ((cid:126)x, (cid:126)g((cid:126)s((cid:126)x))) small, we need to ensure that the weights do not change too much as we change (cid:126)x. For this, we use the operator norm of I + r−1G((cid:126)s)−1G(cid:48)((cid:126)s)S to measure for how much the weight function can diverge from the change in weights induced by a r-step, i.e. how consistent (cid:126)g is to the central path. Lastly, to simplify the analysis we make a For the weight function to be useful, in addition to yielding weights of small size, i.e. (cid:13)(cid:13)(cid:126)g((cid:126)s)(cid:13)(cid:13)1 uniformity assumption that none of the weights are two big, i.e. (cid:13)(cid:13)(cid:126)g((cid:126)s)(cid:13)(cid:13)∞ is bounded. Formally we • Size : The size c1((cid:126)g) satisfies c1((cid:126)g) ≥(cid:13)(cid:13)(cid:126)g((cid:126)s)(cid:13)(cid:13)1 (cid:13)(cid:13)I + r−1G((cid:126)s)−1G(cid:48)((cid:126)s)S(cid:13)(cid:13)G((cid:126)s) ≤ 1 and (cid:13)(cid:13)(cid:0)I + r−1G((cid:126)s)−1G(cid:48)((cid:126)s)S(cid:1) (cid:126)y(cid:13)(cid:13)∞ ≤(cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)∞ + cr • Slack Sensitivity: The slack sensitivity cγ((cid:126)g) satisfies cγ((cid:126)g) ≥ 1 and γ((cid:126)s, (cid:126)g((cid:126)s)) ≤ cγ((cid:126)g). • Step Consistency : The step consistency cr((cid:126)g) satisfies cr((cid:126)g) ≥ 1 and ∀r ≥ cr((cid:126)g) and ∀(cid:126)y ∈ Rm Definition 7 (Weight Function). A weight function is a differentiable function from (cid:126)g : Rm such that for constants c1((cid:126)g), cγ((cid:126)g), and cr((cid:126)g), we have the following for all (cid:126)s ∈ Rm >0: define a weight function as follows. (cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)G((cid:126)s). >0 → Rm >0 17 • Uniformity : The weight function satisfies(cid:13)(cid:13)(cid:126)g((cid:126)s)(cid:13)(cid:13)∞ ≤ 2 When the weight function (cid:126)g is clear from context we often write c1, cγ, and cr. To get a sense of the magnitude of these parameters, in Theorem 12 we prove that there is a rank A), slack sensitivity O(1) and step consistency O(cid:0)log(cid:0) m weight function with size O( hence lemmas with polynomial dependence of slack sensitivity and step consistency suffice for our purposes. However, for the remainder of this section and Section 6 we let the weight function be fixed but arbitrary. (cid:1)(cid:1); rank A √ Ideally, in our weighted path following schemes we would just set (cid:126)w = (cid:126)g((cid:126)s) for any slacks (cid:126)s we compute. However, actually computing (cid:126)g((cid:126)s) may be expensive to compute exactly and therefore we analyze schemes that maintain separate weights, (cid:126)w ∈ Rm >0 with the invariant that (cid:126)w is close to (cid:126)g((cid:126)s) multiplicatively. Formally, we define (cid:126)Ψ((cid:126)s, (cid:126)w) for all (cid:126)s, (cid:126)w ∈ Rm and attempt to keep(cid:13)(cid:13)(cid:126)Ψ((cid:126)s, (cid:126)w)(cid:13)(cid:13)∞ small despite changes that occur due to r-steps. >0 by (cid:126)Ψ((cid:126)s, (cid:126)w) def= log((cid:126)g((cid:126)s)) − log( (cid:126)w) Now we wish to show that a r-step does not increase (cid:126)Ψ((cid:126)s, (cid:126)w) by too much. To do this, we first (4.16) prove the following helper lemma. Lemma 8. For a weight function (cid:126)g and (cid:126)s0, (cid:126)s1 ∈ S0 such that 0 ((cid:126)s1 − (cid:126)s0)(cid:13)(cid:13)∞ ≤ 1 ∞ def=(cid:13)(cid:13)S−1 (cid:19)(cid:13)(cid:13)(cid:13)(cid:13)∞ (cid:18)(cid:126)g((cid:126)s1) (cid:126)g((cid:126)s0) log 32cr def=(cid:13)(cid:13)S−1 (cid:19) 0 ((cid:126)s1 − (cid:126)s0)(cid:13)(cid:13)G((cid:126)s0) ≤ ∞ (cid:19)(cid:13)(cid:13)(cid:13)(cid:13)G((cid:126)s0) (cid:18)(cid:126)g((cid:126)s1) (cid:126)g((cid:126)s0) log cr + . and g (cid:18)(cid:126)s1 (cid:13)(cid:13)(cid:13)(cid:13)log + 1 cr 1 cr Proof. Let (cid:126)p : Rm → Rm be defined for all i ∈ [m] and s ∈ Rm ≤ 3∞ and (cid:126)s0 (cid:126)s0 >0 by we have (cid:18)(cid:126)s1 (cid:19) (cid:13)(cid:13)(cid:13)(cid:13)log ≤ (1 + 6cr∞) g. (cid:126)p((cid:126)s)i def= log((cid:126)si) + 1 cr log((cid:126)g((cid:126)si)). Clearly J(cid:126)s[(cid:126)p((cid:126)s)] = S−1 + c−1 we see that for all i ∈ [0, 1] , r G−1((cid:126)s)G(cid:48)((cid:126)s). Therefore, letting (cid:126)st def= (cid:126)s0 + t((cid:126)s1 − (cid:126)s0) for all t ∈ [0, 1] (cid:126)p((cid:126)si) = (cid:126)p((cid:126)s0) + S−1 t + 1 cr G−1((cid:126)st)G(cid:48)((cid:126)st) ((cid:126)s1 − (cid:126)s0)dt. Applying Jensen’s inequality and the definition of (cid:126)p then yields that for all i ∈ [0, 1] and any norm (cid:20) i 0 (cid:21) (cid:21) (cid:13)(cid:13) ·(cid:13)(cid:13) , (cid:13)(cid:13)(cid:13)(cid:13)log (cid:18) (cid:126)si (cid:19) (cid:126)s0 (cid:18) (cid:126)g((cid:126)si) (cid:126)g((cid:126)s0) (cid:19)(cid:13)(cid:13)(cid:13)(cid:13) ≤ 0 + 1 cr log Now for all t ∈ [0, 1] define (cid:126)at ∈ Rm >0 by (cid:126)at def= log i (cid:13)(cid:13)(cid:13)(cid:13)(cid:20) (cid:18) (cid:126)st (cid:126)s0 I + G−1((cid:126)st)G(cid:48)((cid:126)st)St 1 cr S−1 t ((cid:126)s1 − (cid:126)s0) (4.17) (cid:13)(cid:13)(cid:13)(cid:13) dt. (cid:18) (cid:126)g((cid:126)st) (cid:19) (cid:126)g((cid:126)s0) (cid:19) − 1 cr log 18 t ∈ [0, i]. By Lemma 33 and the fact that ∞ ≤ 1 (4.17) and applying Definition 7 yields that ∀i ∈ [0, M ] , and let M be the supremum over all i ∈ [0, 1] such that(cid:13)(cid:13) log (cid:126)g((cid:126)st) − log (cid:126)g((cid:126)s0)(cid:13)(cid:13)∞ ≤ 3.5cr∞ for all this implies that(cid:13)(cid:13)G((cid:126)si)−1((cid:126)g((cid:126)si) − (cid:126)g((cid:126)s0))(cid:13)(cid:13)∞ ≤ 4cr∞ and(cid:13)(cid:13)G((cid:126)s0)−1((cid:126)g((cid:126)s0) − (cid:126)g((cid:126)si))(cid:13)(cid:13)∞ ≤ 4cr∞ for all i ∈ [0, M ]. Therefore, choosing(cid:13)(cid:13) ·(cid:13)(cid:13)G((cid:126)s0) in t ((cid:126)s1 − (cid:126)s0)(cid:13)(cid:13)G((cid:126)st)dt ≤ (1 + 4cr∞) (cid:13)(cid:13)S−1 Similarly, by choosing(cid:13)(cid:13) ·(cid:13)(cid:13)∞ in (4.17), we have ∀i ∈ [0, M ] that (cid:16)(cid:13)(cid:13)S−1 t ((cid:126)s1 − (cid:126)s0)(cid:13)(cid:13)G((cid:126)st) (cid:13)(cid:13)S−1 t ((cid:126)s1 − (cid:126)s0)(cid:13)(cid:13)∞ + cr (cid:13)(cid:13)G((cid:126)s0) < (1 + 4cr∞)1/2 (cid:13)(cid:13)∞ < g ≤ (1 + 6cr∞) g. (cid:13)(cid:13)(cid:126)ai (cid:13)(cid:13)(cid:126)ai 1 − ∞ (cid:17) 32cr dt 0 i i √ 0 ∞ 1 − ∞ < + 1 + 4cr∞ 1 − ∞ crg ≤ 2.2∞ 8, we have (cid:114) 8 7 ≤ 1 2 19 By the definition of (cid:126)ai, the triangle inequality, and Lemma 33 we then have that (cid:13)(cid:13) log((cid:126)g((cid:126)si)) − log((cid:126)g((cid:126)s0))(cid:13)(cid:13)∞ < cr (cid:0)2.2∞ +(cid:13)(cid:13) log((cid:126)si) − log((cid:126)s0)(cid:13)(cid:13)∞ (cid:1) < 3.5cr∞. Since (cid:126)g is continuous we have that M = 1 and the result follows. Using this lemma we bound on how much a r-step increases (cid:126)Ψ as follows Lemma 9. Let {(cid:126)x(new), (cid:126)w(new)} = stept((cid:126)x(old), (cid:126)w(old), cr) where δt def= δt((cid:126)x(old), (cid:126)w(old)) ≤ 1 8cγ Letting − log we have (cid:126)∆ def= log (cid:126)g((cid:126)s(new)) (cid:126)g((cid:126)s(old)) (cid:32) (cid:33) (cid:13)(cid:13)(cid:126)∆(cid:13)(cid:13)∞ ≤ 4cγδt (cid:13)(cid:13)W−1/2(cid:126)1i Since(cid:13)(cid:13) log((cid:126)g((cid:126)s(old))) − log( (cid:126)w(old))(cid:13)(cid:13)∞ ≤ 1 γ((cid:126)s, (cid:126)w) = max i∈[m] . 8 and (cid:32) (cid:126)w(new) (cid:126)w(old)  def=(cid:13)(cid:13) log((cid:126)g((cid:126)s(old))) − log( (cid:126)w(old))(cid:13)(cid:13)∞ ≤ 1 (cid:33) (cid:13)(cid:13)(cid:126)∆(cid:13)(cid:13)W(new) (cid:13)(cid:13)(cid:126)1i (cid:13)(cid:13)PS−1A( (cid:126)w) = max (cid:13)(cid:13)S−1A(AT S−1WS−1A) = (cid:126)Ψ((cid:126)s(new), (cid:126)w(new)) − (cid:126)Ψ((cid:126)s(old), (cid:126)w(old)), ≤ ecr 1 + cr δt + 13cγδ2 t . −1AT S−1. and i∈[m] Proof. Recall the following definition of slack sensitivity γ((cid:126)s(old), (cid:126)w(old)) ≤ γ((cid:126)s(old), (cid:126)g((cid:126)s(old))) ≤ 1.1cγ. Therefore, since δt ≤ 1 (cid:13)(cid:13)W−1 (old)( (cid:126)w(new) − (cid:126)w(old))(cid:13)(cid:13)∞ ≤ 1.1crcγδt 64cγ cr 1 + cr and (cid:13)(cid:13)S−1 (old)((cid:126)s(new) − (cid:126)s(old))(cid:13)(cid:13)∞ ≤ 1.1cγδt 1 + cr , by Lemma 5 and (4.18) we have (4.18) . ≤ 1 2 (4.19) (old)((cid:126)s(new)−(cid:126)s(old)) and using that cr ≥ 1 and − 2 ≤ i i 1 + s(old) (cid:32) (4.20) + cr log s(new) i − s(old) (cid:33)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (old)((cid:126)s(new) − (cid:126)s(old))(cid:13)(cid:13)∞ ≤ 1.1cγ δt (cid:33)(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) (cid:33) (cid:13)(cid:13)S−1 (old)((cid:126)s(new) − (cid:126)s(old))(cid:13)(cid:13). (4.21) (cid:126)s(new) (cid:126)s(old) + cr log (cid:32) ≤ 1+cr (cid:126)w(new) (cid:126)w(old) i i i r i i s(old) (cid:33) (cid:32) (cid:33) + cr log s(new) i ≤ 2c2 − s(old) − (cid:126)s(old) s(new) i s(old) i w(new) i w(old) (cid:33)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) = Recalling that W−1 log(1 + ) ≤  for  < 1 (cid:32) 2 we have that for all i ∈ [m] 1 − cr (old)( (cid:126)w(new)− (cid:126)w(old)) = −crS−1 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)log (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)log (cid:32) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:126)s(new) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)2 Letting(cid:13)(cid:13) ·(cid:13)(cid:13) denote either(cid:13)(cid:13) ·(cid:13)(cid:13)∞ or(cid:13)(cid:13) ·(cid:13)(cid:13)W(old) , recalling that(cid:13)(cid:13)S−1 (cid:33)(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) + (cid:13)(cid:13)(cid:13)(cid:13)(cid:13)log (cid:13)(cid:13)(cid:13)(cid:13)(cid:13)cr log (cid:32) (cid:32) (cid:13)(cid:13)(cid:13)(cid:13)(cid:13)log (cid:33)(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) + 2.2crcγδt . Therefore, letting(cid:13)(cid:13) ·(cid:13)(cid:13) be(cid:13)(cid:13) ·(cid:13)(cid:13)∞ in (4.21), we have (cid:13)(cid:13)(cid:126)∆(cid:13)(cid:13) ≤ , and applying (4.20) yields (cid:126)g((cid:126)s(new)) (cid:126)g((cid:126)s(old)) (cid:126)g((cid:126)s(new)) (cid:126)g((cid:126)s(old)) (cid:126)s(new) (cid:126)s(old) (cid:126)s(new) (cid:126)s(old) (cid:32) (cid:32) (cid:33) (cid:33) ≤ cr (cid:126)s(old) i (cid:32) + log 1 cr 1.1cγ δt + log cr 1+cr (cid:13)(cid:13)(cid:126)∆(cid:13)(cid:13)∞ ≤ 3cr∞ + 2.2crcγδt Similarly, letting(cid:13)(cid:13) ·(cid:13)(cid:13) be(cid:13)(cid:13) ·(cid:13)(cid:13)W(old) (cid:13)(cid:13)(cid:126)∆(cid:13)(cid:13)W(old) (old)( (cid:126)w(new) − (cid:126)w(old))(cid:13)(cid:13)∞ ≤ 1.1cγδt yields the result. ≤ e/2crg(1 + 6cr∞) + 2.2crcγδt ≤ e Finally, noting that(cid:13)(cid:13)W−1 1.1cγδt 1 + cr δt + 10cγδ2 t . ≤ 4cγδt. 1 + cr 1 + cr cr δt By Lemma 5 and (4.19), (cid:126)s(old) and (cid:126)s(new) meet the conditions of Lemma 8 with ∞ ≤ 1.1cγ δt g ≤ e/2δt 1+cr and in (4.19) and noting that by definition of  yields 4.5 Centering Using Exact Weights Here we bound the rate of convergence rate of path following assuming that we can compute the weight function (cid:126)g exactly. We start by providing a basic lemma regarding how the Newton step size changes as we change (cid:126)w. Lemma 10 (Effect of Weight Change). Let (cid:126)x ∈ S0 and let (cid:126)w(old), (cid:126)w(new) ∈ Rm >0 with ∞ def=(cid:13)(cid:13) log( (cid:126)w(new)) − log( (cid:126)w(old))(cid:13)(cid:13)∞ ≤ 1 2 it follows that δt((cid:126)x, (cid:126)w(new)) ≤ (1 + ∞) (cid:104) δt((cid:126)x, (cid:126)w(old)) +(cid:13)(cid:13) log( (cid:126)w(new)) − log( (cid:126)w(old))(cid:13)(cid:13)W(old) (cid:105) , (4.22) 20 def= AT S−1W(new)S−1A. By the definition (4.23) (4.24) (4.25) Proof. Let H(old) of δt and the triangle inequality we have def= AT S−1W(old)S−1A and let H(new) (new) δt((cid:126)x, (cid:126)w(new)) =(cid:13)(cid:13)t(cid:126)c − AT S−1 (cid:126)w(new)(cid:13)(cid:13)H−1 ≤(cid:13)(cid:13)t(cid:126)c − AT S−1 (cid:126)w(old)(cid:13)(cid:13)H−1 (cid:13)(cid:13)t(cid:126)c − AS−1 (cid:126)w(old)(cid:13)(cid:13)H−1 (cid:13)(cid:13)AT S−1 (cid:126)w(new) − AT S−1 (cid:126)w(old)(cid:13)(cid:13)H−1 (new) Furthermore, since PAS−1( (cid:126)w(new)) (cid:22) I we have By definition of ∞ and Lemma 33 H−1 (new) (cid:22) (1 + ∞)2H−1 Using that (ex−1)2 ex ≤ (1 + x)2x2 for x ≤ 1 (cid:13)(cid:13)(cid:13)(cid:13)(cid:13) (cid:126)w(new) − (cid:126)w(old) √ (cid:126)w(new) (cid:126)w(old) (cid:13)(cid:13)(cid:13)(cid:13)(cid:13)W(old) +(cid:13)(cid:13)AT S−1 (cid:126)w(new) − AT S−1 (cid:126)w(old)(cid:13)(cid:13)H−1 (new) (old) and therefore ≤ (1 + ∞)δt((cid:126)x, (cid:126)w(old)). (new) (new) ≤ −1/2 (cid:13)(cid:13)(cid:13)(cid:13)(cid:13)W(old) =(cid:13)(cid:13)W (new)( (cid:126)w(new) − (cid:126)w(old))(cid:13)(cid:13)PAS−1 ( (cid:126)w(new)) (cid:13)(cid:13)(cid:13)(cid:13)(cid:13) (cid:126)w(new) − (cid:126)w(old) 2 and letting x =(cid:2)log( (cid:126)w(new)) − log( (cid:126)w(old))(cid:3) ≤ (1 + ∞)(cid:13)(cid:13) log( (cid:126)w(new)) − log( (cid:126)w(old))(cid:13)(cid:13)W(old) √ (cid:126)w(new) (cid:126)w(old) i we have (4.26) Combining (4.23), (4.24), (4.25), and (4.26) completes the proof. (cid:126)x(new) = centeringExact((cid:126)x(old)) 1. (cid:126)x(new) = (cid:126)x(old) − 1 (cid:126)h((cid:126)x(old), (cid:126)g((cid:126)s(old))). 1+cr With this lemma we can now show how much centering progress we make by just updating (cid:126)x and using the weight function. Note that in this proof we are just using the r-step in the proof, not the algorithm itself. We will need to use the r-step itself only later when we drop the assumption that we can compute (cid:126)g exactly. Theorem 11 (Centering with Exact Weights). Fix a weight function (cid:126)g, let (cid:126)x(old) ∈ S0, and let (cid:126)x(new) = centeringExact((cid:126)x(old)) If then def= δt((cid:126)x(old), (cid:126)g((cid:126)s(old))) ≤ 1 δt 80cγcr (cid:18) (cid:19) δt((cid:126)x(new), (cid:126)g((cid:126)s(new))) ≤ 1 − 1 4cr δt((cid:126)x(old), (cid:126)g((cid:126)s(old))). 21 Proof. Let {(cid:126)x(new), (cid:126)w(new)} ∈ {S0×Rm Note that this (cid:126)s(new) is the same as the (cid:126)s(new) in the theorem statement. >0} be the result of a cr step from {(cid:126)x(old), (cid:126)w(old)} ∈ {S0×Rm >0}. Now by Lemma 6 we have that Furthermore, defining (cid:126)∆ as in Lemma 9 and noting that (cid:126)w(old) = (cid:126)g((cid:126)s(old)) we have δt((cid:126)s(new), (cid:126)w(new)) ≤ cγδ2 t . (cid:33) (cid:32) (cid:33) (cid:32) (cid:32) (cid:126)∆ def= log (cid:126)g((cid:126)s(new)) (cid:126)g((cid:126)s(old)) − log (cid:126)w(new) (cid:126)w(old) = log (cid:126)g((cid:126)s(new)) (cid:126)w(new) (cid:13)(cid:13) log((cid:126)g((cid:126)s(new))/ (cid:126)w(new))(cid:13)(cid:13)∞ ≤ 4cγδt ≤ 1/2 (cid:13)(cid:13) log((cid:126)g((cid:126)s(new))/ (cid:126)w(new))(cid:13)(cid:13) (cid:126)w(new) ≤ ecr δt + 13cγδ2 t 1 + cr we see by Lemma 9 that and (4.27) (4.28) (4.29) (cid:33) . (cid:21) with  = 0 because we are using exact weight computation. Applying Lemma 10 to (4.27), (4.28), and (4.29) we have (cid:20) δt((cid:126)x(new), (cid:126)g((cid:126)s(new))) ≤ (1 + 4cγδt) cγδ2 t + cr 1 + cr δt + 13cγδ2 t (cid:18) ≤ cr 1 + cr 1 − 1 2cr ≤ δt + 20cγcrδ2 t (cid:19) (cid:18) + 1 4cr δt ≤ 1 − 1 4cr (cid:19) δt r ) iterations of CenteringExact r ) then in Θ(c−1 )) and maintain δt((cid:126)x, (cid:126)g((cid:126)s)) = O(c−1 γ c−1 r ) using O(c−1 −1/2 γ c−2 r c 1 γ c−1 From this lemma we have that if δt((cid:126)x, (cid:126)g((cid:126)s)) is O(c−1 −1/2 γ c−1 r c 1 we can decrease δt((cid:126)x, (cid:126)g((cid:126)s)) by a multiplicative constant. Furthermore by Lemma 1 we see that we can increase t by a multiplicative (1 + O(c−1 γ c−1 r ). Thus we can double t and maintain δt((cid:126)x, (cid:126)g((cid:126)s)) = O(c−1 ) iterations of CenteringExact. In Section 7 we make this argument rigorously in the more general setting. In the following sections, we show how to relax this requirement that (cid:126)g is computed exactly. 5 A Weight Function for (cid:101)O((cid:112)rank(A)L) Convergence Section 4 yields an (cid:101)O((cid:112)rank(A)L) iteration interior point method. In Section 5.1 we motivate and >0 that when used in the framework proposed in Here, we present the weight function (cid:126)g : Rm >0 → Rm describe the weight function (cid:126)g, in Section 5.2 we prove that (cid:126)g satisfies Definition 7 with nearly opti- mal c1((cid:126)g), cγ((cid:126)g), and cr((cid:126)g), and in Section 5.3 we show how to compute and correct approximations to (cid:126)g efficiently. 22 barrier, φ((cid:126)s) = −(cid:80) 5.1 The Weight Function Our weight function was inspired by the volumetric barrier methods of [40, 1].10 These papers considered using the volumetric barrier, φ((cid:126)s) = − log det(AT S−2A) , in addition to the standard log i∈[m] log si. In some sense the standard log barrier has a good slack sensitivity, 1, but a large size, m, and the volumetric barrier has a worse slack sensitivity, m, but better total weight, n. By carefully applying a weighted combination of these two barriers [40] and [1] achieved an O((m rank(A))1/4L) iteration interior point method at the cost more expensive linear algebra in each iteration. √ Instead of using a fixed barrier, our weight function (cid:126)g : Rm >0 is computed by solving a convex optimization problem whose optimality conditions imply both good size and good slack sensitivity. We define (cid:126)g for all (cid:126)s ∈ Rm >0 → Rm (cid:126)g((cid:126)s) def= arg min (cid:126)w∈Rm >0 f ((cid:126)s, (cid:126)w) where >0 by f ((cid:126)s, (cid:126)w) def= (cid:126)1T (cid:126)w − 1 α log det(AT s WαAs) − β log wi (5.1) (cid:88) i∈[m] where here and in the remainder of this section we let As chosen later such that the following hold def= S−1A and the parameters α, β ∈ R are α ∈ (0, 1) , β ∈ (0, 1) , and β1−α ≥ 1 2 . (5.2) To get a sense for why (cid:126)g has the desired properties, , suppose for illustration purposes that >0. Using Lemma 34 and setting the gradient of (5.1) to (cid:126)0 we see α = 1 and β = 0 and fix (cid:126)s ∈ Rm that if (cid:126)g exists then (cid:126)g((cid:126)s) = (cid:126)σAs((cid:126)g((cid:126)s)) def= diag (G((cid:126)s))1/2As(AT s G((cid:126)s)As)−1AT s (G((cid:126)s))1/2(cid:17) where we use the definition of (cid:126)σAs from Section 2. Consequently, and γ((cid:126)s, (cid:126)g((cid:126)s)) = 1 . s (G((cid:126)s))1/2 is a projection matrix,(cid:13)(cid:13)(cid:126)σAs((cid:126)g((cid:126)s))(cid:13)(cid:13)1 = Furthermore, since (G((cid:126)s))1/2As(AT rank(A). Therefore, this would yield a weight function with good cγ and c1. s G((cid:126)s)As)−1AT Unfortunately picking α = 1 and β = 0 makes the optimization problem for computing (cid:126)g degenerate. In particular for this choice of α and β, (cid:126)g((cid:126)s) could be undefined. In the follow sections we will see that by picking better values for α and β we can trade off how well (cid:126)g performs as a weight function and how difficult it is to compute approximations to (cid:126)g. (cid:16) (cid:13)(cid:13)PAs ((cid:126)g) = 1 (cid:13)(cid:13)G−1/2(cid:126)1i max i 5.2 Weight Function Properties Here, we show that (cid:126)g : R≥0 → R≥0 as given by (5.1) is a weight function with respect to Definition 7 and we bound the values of c1((cid:126)g), cγ((cid:126)g), and cr((cid:126)g). The goal of this section is to prove the following. Theorem 12 (Properties of Weight Function). Let us define α and β by α = 1 − log2 (cid:16) 2m 1 rank(A) (cid:17) and β = rank(A) 2m For this choice of parameters (cid:126)g is a weight function meeting the criterion of Definition 7 with 10 See Section 1.2 for further intuition. 23 Next, using Lemma 36 and chain rule, we compute the following for all i, j ∈ [m], ∇ (cid:126)w f ((cid:126)s, (cid:126)w) = (cid:126)1 − 1 α ΣW−α(cid:0)αWα−1(cid:1) − βW−1(cid:126)1 = (cid:0)I − ΣW−1 − βW−1(cid:1) (cid:126)1 (cid:17) − ΣijIij + βIij (cid:16) ∂(∇ (cid:126)w f ((cid:126)s, (cid:126)w))i ∂wj j = − wiΛij (cid:126)w−α − α = Σij wiwj Λij wiwj j α (cid:126)wα−1 (cid:126)w2 i βIi=j wiwj + • Size : c1((cid:126)g) = 2 rank(A). • Slack Sensitivity: cγ((cid:126)g) = 2. • Step Consistency : cr((cid:126)g) = 2 log2 (cid:16) 2m rank(A) (cid:17) . We break the proof into several parts. In Lemma 13, we prove basic properties of f. In Lemma 14 we prove that (cid:126)g is a weight function and bound its size. In Lemma 15 we bound the slack sensitivity of (cid:126)g and in Lemma 16 we show that (cid:126)g is consistent. We start by computing the gradient and Hessian of f ((cid:126)s, (cid:126)w) with respect to (cid:126)w. Lemma 13. For all (cid:126)s ∈ Rm f ((cid:126)s, (cid:126)w) =(cid:0)I − ΣW−1 − βW−1(cid:1) (cid:126)1 >0 and (cid:126)w ∈ Rm ∇ (cid:126)w >0, we have and ∇2 (cid:126)w (cid:126)w f ((cid:126)s, (cid:126)w) = W−1 (Σ + βI − αΛ) W−1 where Σ def= ΣAs(Wα(cid:126)1) and Λ def= ΛAs(Wα(cid:126)1). Proof. Using Lemma 34 and the chain rule we compute the gradient of ∇w f ((cid:126)s, (cid:126)w) as follows . (Using that Σis diagonal) Consequently ∇2 (cid:126)w (cid:126)w f ((cid:126)s, (cid:126)w) = W−1 (Σ + βI − αΛ) W−1 as desired. Using this lemma, we prove that (cid:126)g is a weight function with good size. Lemma 14. The function (cid:126)g is a weight function meeting the criterion of Definition 7. For all (cid:126)s ∈ Rm >0 and i ∈ [m] we have β ≤ gi((cid:126)s) ≤ 1 + β and (cid:13)(cid:13)(cid:126)g((cid:126)s)(cid:13)(cid:13)1 = rank(A) + β · m. Furthermore, for all (cid:126)s ∈ Rm >0, the weight function obeys the following equations G((cid:126)s) = (Σg + βI) (cid:126)1 and G(cid:48)((cid:126)s) = −2G((cid:126)s) (G((cid:126)s) − αΛg) −1 ΛgS−1 where Σg def= ΣAs(G((cid:126)s)α(cid:126)1), Λg def= ΛAs(G((cid:126)s)α(cid:126)1), and G(cid:48)((cid:126)s) is the Jacobian matrix of (cid:126)g at (cid:126)s. 24 Proof. By Lemma 32 and (5.2) we have that for all (cid:126)w, (cid:126)s ∈ Rm >0 , ΣAs( (cid:126)w) (cid:23) ΛAs( (cid:126)w) (cid:23) αΛAs( (cid:126)w). f ((cid:126)s, (cid:126)w) (cid:23) βW−2 and f ((cid:126)s, (cid:126)w) is convex for (cid:126)w, (cid:126)s ∈ Rm >0. Using Therefore, by Lemma 13, ∇2 Lemma 13, we see that that for all i ∈ [m] it is the case that (cid:126)w (cid:126)w (cid:104)∇ (cid:126)w (cid:105) f ((cid:126)s, (cid:126)w) = i 1 wi (wi − σi − β) i (cid:105) f ((cid:126)s, (cid:126)w) (cid:104)∇ (cid:126)w is strictly negative and if (cid:126)wi ∈ (1 + β,∞) then Since 0 ≤ σi ≤ 1 for all i by Lemma 32 and β ∈ (0, 1) by (5.2), we see that if (cid:126)wi ∈ (0, β) then is strictly positive. >0 , the (cid:126)w that minimizes this convex function f ((cid:126)s, (cid:126)w) lies in the box (cid:104)∇ (cid:126)w that(cid:13)(cid:13)(cid:126)σ(cid:13)(cid:13)1 = tr (PAs(G((cid:126)s)α)). Since PAs(G((cid:126)s)α(cid:126)1) is a projection onto the image of G((cid:126)s)α/2As and Therefore, for any (cid:126)s ∈ Rm between β and 1 + β. Since f is strongly convex in this region, the minimizer is unique. The formula for G((cid:126)s) follows by setting ∇ (cid:126)w f ((cid:126)s, (cid:126)w) = (cid:126)0 and the size of (cid:126)g follows from the fact since (cid:126)g((cid:126)s) > 0 and (cid:126)s > 0, the dimension of the image of G((cid:126)s)α/2As is the rank of A. Hence, we have that (cid:13)(cid:13)(cid:126)g((cid:126)s)(cid:13)(cid:13)1 ≤(cid:13)(cid:13)(cid:126)σ(cid:13)(cid:13)1 +(cid:13)(cid:13)β(cid:126)1(cid:13)(cid:13)1 = rank(A) + β · m. f ((cid:126)s, (cid:126)w) (cid:105) i To compute G(cid:48)((cid:126)s), we note that for (cid:126)w ∈ Rm rule, we get the following for all i, j ∈ [m], >0 and Λw def= ΛWαA(S−2(cid:126)1), by Lemma 36 and chain ∂(∇ (cid:126)w f ((cid:126)s, (cid:126)w))i ∂sj = −w−1 i Λijs2 j (cid:16)−2s−3 j (cid:17) = 2w−1 i Λijs−1 j . f ((cid:126)s, (cid:126)w) with respect to (cid:126)s. Since we have already shown that J (cid:126)w(∇ (cid:126)w Consequently, J(cid:126)s(∇ (cid:126)w f ((cid:126)s, (cid:126)w)) = 2W−1ΛwS−1 where J(cid:126)s denotes the Jacobian matrix of the function ∇ (cid:126)w (cid:126)w (cid:126)wft((cid:126)s, (cid:126)w) = W−1 (Σw + βI − αΛw) W−1 is positive definite (and hence invertible), by applying the implicit function theorem to the specification of (cid:126)g((cid:126)s) as the solution to ∇ (cid:126)w f ((cid:126)s, (cid:126)w) = (cid:126)0, we have f ((cid:126)s, (cid:126)w)) = ∇2 G(cid:48)((cid:126)s) = −(cid:16) (cid:17)−1(cid:16) (cid:17) J (cid:126)w(∇ (cid:126)w f ((cid:126)s, (cid:126)w)) J(cid:126)s(∇ (cid:126)w f ((cid:126)s, (cid:126)w)) = −2G((cid:126)s) (G((cid:126)s) − αΛg) −1 ΛgS−1 Using Lemma 14 we now show that (cid:126)g has a good slack sensitivity. Lemma 15 (Weight Function Slack Sensitivity). For all (cid:126)s ∈ Rm Proof. Fix an arbitrary (cid:126)s ∈ Rm know that (cid:126)g = (Σ + βI) (cid:126)1 and β ≤ gi ≤ 1 + β ≤ 2 for all i ∈ [m]. Furthermore, since β1−α ≥ 1 α ∈ (0, 1) by (5.1) and clearly G = G1−αGα we have >0 and let (cid:126)g def= (cid:126)g((cid:126)s), and Σ def= ΣAs((cid:126)gα). Recall that by Lemma 14 we 2 and >0, we have γ((cid:126)s, (cid:126)g((cid:126)s)) ≤ 2. Gα (cid:22) β1−αGα (cid:22) G (cid:22) (2)1−αGα (cid:22) 2Gα 1 2 Applying this and using the definition of PAs((cid:126)g) yields s GαAs)−1AT s GAs)−1AT s (cid:22) 2As(AT As(AT s = 2G−α/2PAs((cid:126)gα)G−α/2 (5.3) . (5.4) 25 Hence, by definition of the weight slack sensitivity we have γ((cid:126)s, (cid:126)g) = max i i = max ≤ max i = max i (cid:13)(cid:13)G−1/2(cid:126)1i (cid:113) (cid:113) (cid:114) 2(cid:126)1T (cid:13)(cid:13)PAs ((cid:126)g) (cid:114) σi s (cid:126)1i s GAs)−1AT (cid:126)1T i As(AT i G−α/2PAs((cid:126)gα)G−α/2(cid:126)1i σi gα i ≤ 2 max ≤ 2 2 i gi 2 and gi ≥ σi. where the last line due to the fact g1−α i ≥ β1−α ≥ 1 Finally, we bound the step consistency of (cid:126)g. Lemma 16 (Weight Function Step Consistency). For all (cid:126)s ∈ Rm >0, (cid:126)y ∈ Rm, r ≥ 2 1−α, and we have (cid:107)B(cid:126)y(cid:107)G((cid:126)s) ≤(cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)G((cid:126)s) B def= I + 1 r G((cid:126)s)−1G(cid:48)((cid:126)s)S, (cid:107)B(cid:126)y(cid:107)∞ ≤(cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)∞ + (cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)G((cid:126)s). 2 1 − α and Proof. Fix an arbitrary (cid:126)s ∈ Rm Λ def= ΛAs((cid:126)gα). Also, fix an arbitrary (cid:126)y ∈ Rm and let (cid:126)z def= B(cid:126)y. −1 ΛS−1 and therefore By Lemma 14, G(cid:48) = −2G (G − αΛ) >0 and let (cid:126)g def= (cid:126)g((cid:126)s), (cid:126)σ def= (cid:126)σAs((cid:126)gα), Σ def= ΣAs((cid:126)gα), P def= PAs((cid:126)gα), B = I + r−1G−1(cid:16)−2G (G − αΛ) −1(cid:0)G − (α + 2r−1)Λ(cid:1) = (G − αΛ) = (G − αΛ) S −1 (G − αΛ) − 2r−1 (G − αΛ) −1 Λ −1 ΛS−1(cid:17) . By Lemma 14, we have G (cid:23) Σ. By the definition of Λ = Σ − P(2), we have Σ (cid:23) Λ and Lemma 32 shows that Λ (cid:23) 0. Hence, we have 0 (cid:22) Λ (cid:22) Σ ≺ G. Using this and 0 < 2r−1 ≤ 1 − α, we have that 0 ≺ G − (α + 2r−1)Λ (cid:22) G − αΛ . Thus, G − αΛ is positive definite and therefore (cid:126)z is the unique vector such that (G − αΛ) (cid:126)z =(cid:0)G − (α + 2r−1)Λ(cid:1) (cid:126)y To bound(cid:13)(cid:13)(cid:126)z(cid:13)(cid:13)G, we note that since G (cid:31) 0 we have (cid:16) I − αG−1/2ΛG−1/2(cid:17) G1/2(cid:126)z = (cid:16) I − (α + 2r−1)G−1/2ΛG−1/2(cid:17) (5.5) G1/2(cid:126)y Furthermore, since 0 (cid:22) G−1/2ΛG−1/2 (cid:22) I, we have that 0 (cid:22) I − (α + 2r−1)G−1/2ΛG−1/2 (cid:22) I − αG−1/2ΛG−1/2 26 (5.6) for arbitrary i ∈ [m] and using that (cid:126)σi ≥ 0 then yields that −2 −2 (1 − α) Σ(cid:126)z + β(cid:126)z + αP(2)(cid:126)z = G(cid:126)z − αΛ(cid:126)z G1/2(cid:126)z(cid:13)(cid:13)(I−αG−1/2ΛG−1/2) G1/2(cid:126)z(cid:13)(cid:13)(I−(α+2k−1)G−1/2ΛG−1/2) I − αG−1/2ΛG−1/2(cid:17) and consequently(cid:13)(cid:13)(cid:126)z(cid:13)(cid:13)G =(cid:13)(cid:13)(cid:16) I − αG−1/2ΛG−1/2(cid:17) ≤(cid:13)(cid:13)(cid:16) =(cid:13)(cid:13)G1/2(cid:126)y(cid:13)(cid:13) =(cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)G . Therefore,(cid:13)(cid:13)B(cid:126)y(cid:13)(cid:13)G ≤(cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)G as desired. Next, to bound(cid:13)(cid:13)(cid:126)z(cid:13)(cid:13)∞, we use that Λ = Σ − P(2) and (cid:126)g = (cid:126)σ + β(cid:126)1 and (5.5) to derive = (cid:0)G − (α + 2r−1)Λ(cid:1) (cid:126)y = (cid:0)1 − α − 2r−1(cid:1) Σ(cid:126)y + β(cid:126)y +(cid:0)α + 2r−1(cid:1) P(2)(cid:126)y ((1 − α)(cid:126)σi + β)(cid:126)zi ≤(cid:12)(cid:12)(cid:12)α(cid:126)1T (cid:12)(cid:12)(cid:12) + (cid:12)(cid:12)(cid:12)(cid:0)(1 − α − 2r−1)(cid:126)σi + β(cid:1) (cid:126)yi +(cid:0)α + 2r−1(cid:1) (cid:126)1T (cid:12)(cid:12)(cid:12)[P(2)(cid:126)z]i (cid:12)(cid:12)(cid:12) + ((1 − α)(cid:126)σi + β)(cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)∞ + (cid:12)(cid:12)(cid:12)[P(2)(cid:126)y]i (cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)Σ (cid:13)(cid:13)(cid:126)z(cid:13)(cid:13)Σ + ((1 − α)(cid:126)σi + β)(cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)∞ + (cid:126)σi ≤ ((1 − α)(cid:126)σi + β)(cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)∞ + (1 + α)(cid:126)σi (cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)G5.6 (cid:126)zi ≤ (cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)∞ + (cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)G ≤ (cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)∞ + and therefore(cid:13)(cid:13)B(cid:126)y(cid:13)(cid:13)∞ =(cid:13)(cid:13)(cid:126)z(cid:13)(cid:13)∞ ≤(cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)∞ + 2 (cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)G. toLeft multiplying this equation by (cid:126)1T i (1 + α) (cid:126)σi (cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)G ((1 − α)(cid:126)σi + β) 1 − α ≤ α ≤ α(cid:126)σi Consequently, i P(2)(cid:126)y i P(2)(cid:126)z . (cid:12)(cid:12)(cid:12) 1−α (cid:12)(cid:12)(cid:12) 2 (0 < 2r−1 ≤ (1 − α) < 1) (Lemma 32) (Σ (cid:22) Gand) From Lemmas 14, 15 and 16, the proof of Theorem 12 is immediate. Since m ≥ rank(A) we have log2 (2m/ rank(A)) ≥ 1 and α ∈ (0, 1). Furthermore β ∈ (0, 1) and (cid:18) rank(A) (cid:19)(cid:16) 2m β1−α = 1 log2(2m/ rank(A)) (cid:17) >0 we have (cid:13)(cid:13)(cid:126)g((cid:126)s)(cid:13)(cid:13)1 ≤ 2 · rank(A) by 1 2 = and therefore (5.2) is satisfied. Furthermore, for all (cid:126)s ∈ Rm Lemma 14. The bounds on cγ((cid:126)g) and cr((cid:126)g) then follow from Lemma 15 and Lemma 16 respectively. 5.3 Computing and Correcting The Weights Here, we describe how to efficiently compute approximations to the weight function (cid:126)g : Rm≥0 → Rm≥0 as given by (5.1). The two main technical tools we use towards this end are the gradient descent method, Theorem 17, a standard result in convex optimization, and fast numerical methods for 27 estimating leverage scores using the Johnson-Lindenstrauss Lemma, Theorem 20, a powerful tool in randomized numerical linear algebra. compute (cid:126)g((cid:126)s) to high accuracy in (cid:101)O(1) iterations. Unfortunately, this result makes two assumptions Since the weight function, (cid:126)g, is defined as the minimizer of a convex optimization problem (5.1), we could use the gradient descent method directly to minimize f and hence compute (cid:126)g. Indeed, in Lemma 19 we show how applying the gradient descent method in a carefully scaled space allows us to to compute (cid:126)g((cid:126)s): (1) we are given a weight (cid:126)w ∈ R≥0 that is not too far from (cid:126)g((cid:126)s) and (2) we compute the gradient of f exactly. Assumption (1) is not an issue as we always ensure that (cid:126)g does not change too much between calls to compute (cid:126)g and therefore can always use our previous weights as the approximation to (cid:126)g((cid:126)s). However, naively computing the gradient of f is computationally expensive and hence assumption (2) is problematic. To deal with this issue we use the fact that by careful application of Johnson- Lindenstrauss one can compute a multiplicative approximation to the gradient efficiently and in Theorem 21 we show that this suffices to compute an approximation to (cid:126)g that suffices to use in our weighted path following scheme. First we prove the theorem regarding gradient descent method we use in our analysis. This the- orem shows that if we take repeated projected gradient steps then we can achieve linear convergence up to bounds on how much the hessian of the function changes over the domain of interest. 11 Theorem 17 (Simple Constrained Minimization for Twice Differentiable Function [25]). Let H be a positive definite matrix and Q ⊆ Rm be a convex set. Let f ((cid:126)x) : Q → R be a twice differentiable function such that there are constants L ≥ µ ≥ 0 such that for all (cid:126)x ∈ Q we have µH (cid:22) ∇2f ((cid:126)x) (cid:22) LH. If for some (cid:126)x(0) ∈ Q and all k ≥ 0 we apply the update rule (cid:126)x(k+1) = arg min (cid:126)x∈Q (cid:68)∇f ((cid:126)x(k)), (cid:126)x − (cid:126)x(k)(cid:69) H ≤(cid:16) (cid:13)(cid:13)(cid:126)x(k) − (cid:126)x∗(cid:13)(cid:13)2 + L 2 (cid:13)(cid:13)(cid:126)x − (cid:126)x(k)(cid:13)(cid:13)2 H then for all k ≥ 0 we have (cid:17)k(cid:13)(cid:13)(cid:126)x(0) − (cid:126)x∗(cid:13)(cid:13)2 Lemma 18 (Hessian Approximation). For(cid:13)(cid:13)W−1((cid:126)g((cid:126)s) − (cid:126)w)(cid:13)(cid:13)∞ ≤ 1 1 − µ L the optimal point (cid:126)g((cid:126)s) such that the Hessian of f does not change too much. 12 we have H. To apply this Theorem 17 to compute (cid:126)g((cid:126)s) we first need to show that there is a region around 2(1 − α) 3 W−1 (cid:22) ∇2 (cid:126)w (cid:126)w f ((cid:126)s, (cid:126)w) (cid:22) 3 2 W−1. Proof. From Lemma 13, we know that f ((cid:126)s, (cid:126)w) = W−1 (Σ + βI − αΛ) W−1 where Σ = ΣAs( (cid:126)wα) and Λ = ΛAs( (cid:126)wα). Using 0 (cid:22) Λ (cid:22) Σ, we have ∇2 (cid:126)w (cid:126)w (1 − α)W−1 (Σ + βI) W−1 (cid:22) ∇2 ww f ((cid:126)s, (cid:126)w) (cid:22) W−1 (Σ + βI) W−1 11Note that this theorem is usually stated with H = I, i.e. the standard Euclidean norm rather than the one induced by H. However, Theorem 17 can be proved by these standard results just by a change of variables. 28 Using that(cid:13)(cid:13)W−1((cid:126)g((cid:126)s) − (cid:126)w)(cid:13)(cid:13)∞ ≤ 1 12 and applying Lemma 14 we have (cid:18) (cid:18) (cid:19)−2 (cid:19)2 Σ + βI (cid:22) 1 − 1 12 Σ + βI (cid:23) 1 − 1 12 ΣAs((cid:126)gα) + βI (cid:22) ΣAs((cid:126)gα) + βI (cid:23) (cid:18) (cid:18) (cid:19)−2 (cid:19)2 1 − 1 12 G (cid:22) 3 2 W 1 − 1 12 G (cid:23) 2 3 W. and Combining Theorem 17 and Lemma 18, we get the following algorithm to compute the weight function using the exact computation of the gradient of f. Note that this algorithm applies Theorem 17 multiple times as in each iteration we are taking a gradient step with respect to a different norm. Lemma 19 (Exact Weight Computation). Given (cid:126)w(0) ∈ Rm ≤ 1−α 24 . Let (cid:13)(cid:13)(cid:13)W−1 (0)((cid:126)g((cid:126)s) − (cid:126)w(0)) (cid:13)(cid:13)(cid:13)∞ . (cid:27) (cid:17)(cid:13)(cid:13)(cid:13)(cid:13)2 >0 such that (cid:13)(cid:13)(cid:13)∞ ≤ 1 − α (0)( (cid:126)w − (cid:126)w(0)) (cid:126)w(k)(cid:17)α(cid:17) (cid:16)(cid:16) + β 24 Q = (cid:126)w∈Q (cid:126)w(k+1) = arg min For all k ≥ 0 let (cid:26) (cid:126)w ∈ Rm (cid:13)(cid:13)(cid:13)W−1 (cid:13)(cid:13)(cid:13)(cid:13) (cid:126)w − 1 (cid:16) This implies that for all k ,(cid:13)(cid:13)(cid:13)G((cid:126)s)−1((cid:126)g((cid:126)s) − (cid:126)w(k)) (cid:13)(cid:13)(cid:13)2 (cid:126)w(k)(cid:17)α(cid:17) (cid:16)(cid:16) (cid:126)w(k)(cid:17)α(cid:17) (cid:16)(cid:16) Proof. Note that iterations of Theorem 17 can be rewritten as (k) − βW−1 I − ΣAs (cid:16) (cid:126)w(k+1) = arg min (cid:126)w(k) + (cid:126)σAs (cid:68)(cid:16) (cid:13)(cid:13)(cid:13)(cid:13) (cid:126)w − 1 (cid:126)w(k) + (cid:126)σAs = arg min ≤ 4m2 W−1 (cid:126)w∈Q + β 12 (cid:18) (cid:19)k 1 − 1 − α (cid:17) (cid:126)1, (cid:126)w − (cid:126)w(k)(cid:69) (cid:17)(cid:13)(cid:13)(cid:13)(cid:13)2 W−1 (cid:126)w∈Q ∞ (k) 2 2 . (k) W−1 (k) (cid:13)(cid:13)(cid:13) (cid:126)w − (cid:126)w(k)(cid:13)(cid:13)(cid:13)2 W−1 (k) + where the last line simply comes for expanding the quadratic function and ignoring the constant term. Hence, we see that the iteration on (cid:126)w(k+1) is in fact a gradient descent step. To apply Theorem 17 we note that for any (cid:126)w ∈ Q the definition of Q and the fact that α ∈ (0, 1) implies that (1 − 1 24 )W(0) (cid:22) W (cid:22) (1 + 1 24 )W(0). Therefore Lemma 18 shows that for all (cid:126)w(k) ∈ Q, (k) (cid:22) 2(1 − α) W−1 (cid:13)(cid:13)(cid:13) (cid:126)w(k+1) − (cid:126)g((cid:126)s) (cid:13)(cid:13)(cid:13)2 (0) (cid:22) ∇2 (cid:18) 1 − 1 − α (cid:19)(cid:13)(cid:13)(cid:13) (cid:126)w(k) − (cid:126)g((cid:126)s) where the left most and right most inequality comes from the fact they lies in a small region Q. Hence, Theorem 17 and inequality (5.7) shows that f ((cid:126)s, (cid:126)w) (cid:22) 3 2 (0) (cid:22) 2W−1 (k). (cid:13)(cid:13)(cid:13)2 1 − α W−1 W−1 (5.7) ≤ (cid:126)w (cid:126)w 2 3 . W−1 (k) W−1 (k) 4 29 Since we have (0)((cid:126)g((cid:126)s) − (cid:126)w(0)) (cid:13)(cid:13)(cid:13)∞ (cid:13)(cid:13)(cid:13)W−1 (cid:13)(cid:13) (cid:126)w(k) − (cid:126)g((cid:126)s)(cid:13)(cid:13)2 ≤ 1−α G−1((cid:126)s) ≤ ≤ (cid:1)2 W(k). Hence, G−1((cid:126)s) 24 24 1 − 1 − α 24 and (cid:126)w(k) ∈ Q, we know that G((cid:126)s) (cid:23)(cid:0)1 − 1−α (cid:19)(cid:13)(cid:13) (cid:126)w(k−1) − (cid:126)g((cid:126)s)(cid:13)(cid:13)2 (cid:18) 1 − 1 − α (cid:18) 1 − 1 − α (cid:18) 1 − 1 − α (cid:13)(cid:13)G−1((cid:126)s)((cid:126)g((cid:126)s) − (cid:126)w(0))(cid:13)(cid:13)2 (cid:19)−2(cid:18) (cid:19)(cid:13)(cid:13) (cid:126)w(k−1) − (cid:126)g((cid:126)s)(cid:13)(cid:13)2 (cid:19)k(cid:13)(cid:13) (cid:126)w(0) − (cid:126)g((cid:126)s)(cid:13)(cid:13)2 (cid:1)2 (cid:0)1 − 1−α ∞ ≤ m(1 + β) G−1((cid:126)s) G−1((cid:126)s) 12 12 4 ≤ ∞ ≤ β−1(cid:13)(cid:13) (cid:126)w(k) − (cid:126)g((cid:126)s)(cid:13)(cid:13)2 24 The result follows from the facts that G−1((cid:126)s) ≤ m(cid:13)(cid:13)G((cid:126)s)(cid:13)(cid:13)∞ (cid:13)(cid:13) (cid:126)w(0) − (cid:126)g((cid:126)s)(cid:13)(cid:13)2 and lemma 14 that(cid:13)(cid:13)G−1((cid:126)s)( (cid:126)w(k) − (cid:126)g((cid:126)s))(cid:13)(cid:13)2 (0)((cid:126)g((cid:126)s) − (cid:126)w(0))(cid:13)(cid:13)2 (cid:13)(cid:13)W−1 ∞ G−1((cid:126)s) where β = rank(A) 2m . Unfortunately, we cannot use the previous lemma directly as computing (cid:126)σAs exactly is too expensive for our purposes. However, in [32] they showed that we can compute leverage scores, (cid:126)σAs, approximately by solving only polylogarithmically many regression problems (See [20] for more details). These results use the fact that the leverage scores of the the ith constraint, i.e. [(cid:126)σAs]i is the (cid:96)2 length of vector PA((cid:126)x)(cid:126)1i and that by the Johnson-Lindenstrauss lemma these lengths are persevered up to multiplicative error if we project these vectors onto certain random low dimensional subspace. Consequently, to approximate the (cid:126)σAs we first compute the projected vectors and then use it to approximate (cid:126)σAs and hence only need to solve (cid:101)O(1) regression problems. For completeness, we provide the algorithm and theorem here: (cid:126)σ(apx) = computeLeverageScores(A, (cid:126)x, ) 1. Let k =(cid:6)24 log(m)/2(cid:7). (cid:16) =(cid:80)k 2. Let (cid:126)q(j) be k random ±1/ 3. Compute (cid:126)p(j) = X1/2A(AT XA)−1AT X1/2(cid:126)q(j). 4. Return (cid:126)σ(apx) (cid:17)2 k vectors of length m. √ . (cid:126)p(j) i j=1 i Theorem 20 ([32]). For 0 <  < 1 with probability at least 1− 1 returns (cid:126)σ(apx) such that for all i ∈ [m] , m the algorithm computeLeverageScores (1 − ) (cid:126)σA((cid:126)x)i ≤ (cid:126)σ(apx) i ≤ (1 + ) (cid:126)σA((cid:126)x)i. by solving only O(−2 · log m) linear systems. Now, we show that we can modify Lemma 19 to use computeLeverageScores and we prove that this still provides adequate error guarantees. Our weight computation and the analysis is as follows. 30 rank(A) 2. Q = (cid:126)w = computeWeight((cid:126)s, (cid:126)w(0), K) 1. Let cr = 2 log2 (cid:16) 2m (cid:126)w ∈ Rm (cid:13)(cid:13)(cid:13)W−1 (cid:110) (cid:13)(cid:13)(cid:13) (cid:126)w − 1 (cid:16) 2m (cid:17), β = rank(A) (cid:13)(cid:13)(cid:13)∞ (cid:111) 3. For j = 1 to k where k = (cid:100)12cr log(cid:0) 4m (cid:1)(cid:101) ≤ 1 (cid:16) S−1A,(cid:0) (cid:126)w(j)(cid:1)α (cid:17)(cid:13)(cid:13)(cid:13)2 (cid:17) , α = 1 − (0)( (cid:126)w − (cid:126)w(0)) (cid:16) 3a. (cid:126)σ(j) = computeLeverageScores (cid:126)w(j−1) + (cid:126)σ(j) + β(cid:126)1 (cid:17) rank(A) log2 12cr ,  K 2 1 W−1 (j−1) 3b. (cid:126)w(j) = arg min (cid:126)w∈Q 4. Output (cid:126)w(j). 2m ,  = K 48cr log( 2m K ) . Note that the convex set Q is aligned with standard basis and hence the step 3b can be computed by explicit formula (5.9). Theorem 21 (Approximate Weight Computation). Let (cid:126)s ∈ Rm and K ∈ (0, 1). The algorithm computeWeight((cid:126)s, (cid:126)w(0), K) returns (cid:126)w such that >0,(cid:13)(cid:13)W−1 (0)((cid:126)g((cid:126)s) − (cid:126)w(0))(cid:13)(cid:13)∞ ≤ 1 12cr 12, (cid:13)(cid:13)G((cid:126)s)−1((cid:126)g((cid:126)s) − (cid:126)w)(cid:13)(cid:13)∞ ≤ K with probability(cid:0)1 − 1 (cid:1)(cid:100)12cr log( 4m K )(cid:101). m systems. The running time is dominated by the time needed to solve O(c3 r log3(m/K) log(m)/K2) linear Proof. Consider an execution of computeWeight((cid:126)s, (cid:126)w(0), K) where each computeLeverageScores computes (cid:126)σAs during this idealized execution of computeWeight. (cid:0)( (cid:126)w(j))α(cid:1), and let (cid:126)v(j)denote the (cid:126)w(j) computed (cid:0)( (cid:126)w(j))α(cid:1) exactly, i.e. (cid:126)σ(j) = (cid:126)σAs Now suppose that for all i ∈ [m] we have (1 − )M(cid:126)v(j) (cid:126)w(j+1) = median (5.8) for some M ≥ 0 and j ∈ [k − 1]. Since the objective function and the constraints for step 3b. are axis-aligned we can compute (cid:126)w(j) coordinate-wise and we see that i i ≤ (cid:126)w(j) i ≤ (1 + )M(cid:126)v(j) (cid:16) (cid:18) (cid:17) (cid:126)w(j)(cid:17)α(cid:17) (cid:16)(cid:16) (cid:16)(cid:0) (cid:126)w(j+1)(cid:1)α(cid:17) + β , (cid:126)w(0), (cid:126)w(j) + (cid:126)σAs 1 2 (cid:18)(cid:18) 1 − 1 12cr (cid:19) (cid:16)(cid:0) (cid:126)w(j+1)(cid:1)α(cid:17) (cid:19) (cid:19) 1 + 1 12cr (cid:126)w(0) (5.9) where [median ((cid:126)x, (cid:126)y, (cid:126)z)]i is equal to the median of xi, yi and zi for all i ∈ [m]. By (5.8), (5.9), and the fact that (1 − ) σAs for all i ∈ [m], we have that ≤ (1 + ) σAs ≤ (cid:126)σ(j+1) i i i (1 − )M +1(cid:126)v(j+1) ≤ (cid:126)w(j+1) ≤ (1 + )M +1(cid:126)v(j+1) . i i i Since (cid:126)v(0) = (cid:126)w(0) and since j ∈ [k − 1] was arbitrary we can apply induction and we have that for all j ∈ [k] 12Recall that cr = 2 1−α = 2 log rank(A) (1 − )j(cid:126)v(j) i ≤ (cid:126)w(j) i ≤ (1 + )j(cid:126)v(j) i . (cid:16) 2m (cid:17) ≥ 2. 31 1 − 1 Note that k ≤ 1 8 and therefore by Taylor series expansion we have(cid:13)(cid:13)V−1 (cid:13)(cid:13)G((cid:126)s)−1((cid:126)g((cid:126)s) − (cid:126)w(k))(cid:13)(cid:13)∞ ≤(cid:13)(cid:13)G((cid:126)s)−1((cid:126)g((cid:126)s) − (cid:126)v(k))(cid:13)(cid:13)∞ +(cid:13)(cid:13)G((cid:126)s)−1(cid:16) (cid:19)−2(cid:13)(cid:13)V−1 Furthermore since (cid:126)v(k) ∈ Q we know that G((cid:126)s) (cid:23)(cid:16) (cid:17)2 Lemma 19, and recalling that k = (cid:100)12cr log(cid:0) 4m (cid:1)(cid:101) we have (cid:18) (cid:19) k (cid:19) (cid:18) 4m 1 − 1 6cr − k 12cr + 1.5(cid:100)12cr log 1 − 1 12cr ≤ 2m · exp (cid:101) ≤ K ≤ 2m + 1.5k (cid:18) (cid:18) (cid:19) 12cr + K 2 ≤ K 2 K 8 k. V(k). Putting these together, applying (k) (cid:0) (cid:126)w(k) − (cid:126)v(k)(cid:1)(cid:13)(cid:13)∞ ≤ 9 (cid:126)v(k) − (cid:126)w(k)(cid:17)(cid:13)(cid:13)∞ (k)((cid:126)v(k) − (cid:126)w(k))(cid:13)(cid:13)∞ (cid:16)√ (cid:17) Finally, we show how to compute an initial weight without having an approximate weight to help the computation. The algorithm computeInitialWeight((cid:126)s, K) computes an initial weight in iterations of computeWeight by computing (cid:126)g for a large enough value of β and then O decreasing β gradually. rank A (cid:16) 2m (cid:17) , α = 1 − (cid:126)w = computeInitialWeight((cid:126)s, K) 1. Let cr = 2 log2 rank(A) 2. Loop until β = rank(A) 2a. (cid:126)w = computeWeight((cid:126)s, (cid:126)w, √ 2b. β = max rank(A) 3. Output computeWeight((cid:126)s, (cid:126)w, K). (cid:26)(cid:18) (1−α)3/2 1 − 1000c2 r (cid:19) 50cr ). 2m 1 (cid:16) 2m 1 log2 rank(A) (cid:17), β = 12cr and (cid:126)w = β(cid:126)1. (cid:27) β, rank(A) 2m . Theorem 22 (Computating Initial Weights). For (cid:126)s ∈ Rm the algorithm computeInitialWeight((cid:126)s, K) returns (cid:126)w ∈ Rm >0 and K > 0, with constant probability >0 such that (cid:13)(cid:13)G((cid:126)s)−1((cid:126)g((cid:126)s) − (cid:126)w)(cid:13)(cid:13)∞ ≤ K. O((cid:112)rank (A) log(1/K)/K2) linear systems. The total running time of computeInitialWeight((cid:126)s, K) is dominated by the time needed to solve Proof. Fix (cid:126)s ∈ Rm >0 and let As def= S−1A. For all β > 0 let (cid:126)g : R>0 → Rm be defined by13 (cid:126)g(β) def= arg min (cid:126)w∈Rm >0 (cid:126)1T (cid:126)w − 1 α log det(AT s WαAs) − β log wi (cid:88) i∈[m] The algorithm computeInitialWeight((cid:126)s, K) maintains the invariant that before step 2a (cid:13)(cid:13)W−1((cid:126)g(β) − (cid:126)w)(cid:13)(cid:13)∞ ≤ 1 12cr . (5.10) 13Note that early we assumed that β < 1 and here we use much larger values of β. However, this bound on β was primarily to assist in bounding c1 and does not affect this proof. 32 Since (cid:126)g(β) = (cid:126)σ(β) + β where (cid:126)σ(β) def= (cid:126)σAs((cid:126)gα(β)), we have that for all i ∈ [m] β ≤ g(β)i ≤ 1 + β. Therefore, in the step 1, the initial weight, (cid:126)w = β(cid:126)1 ∈ Rm 2a, by Theorem 21 we have >0 satisfies the invariant (5.10). After step . (5.11) Therefore, it suffices to prove that (cid:126)g(β) is close to (cid:126)g(β − θ) for small θ. To bound how much (cid:126)g(β) changes for small changes in β we proceed similarly to Lemma 14. First by the implicit function theorem and direct calculation we know that J (cid:126)w(∇ (cid:126)w f ((cid:126)s, (cid:126)w)) = G(β) (G(β) − αΛg) −1 (cid:126)1 (5.12) = −(cid:16) d(cid:126)g dβ (cid:13)(cid:13)G(β)−1((cid:126)g(β) − (cid:126)w)(cid:13)(cid:13)∞ ≤ 1 (cid:17) (cid:17)−1(cid:16) Jβ(∇ (cid:126)w f ((cid:126)s, (cid:126)w)) 50cr where Λg (5.12) in a similar manner to Lemma 16. Note that def= ΛAs(G(β)α(cid:126)1). Next to estimate how fast (cid:126)g can change as a function of β we estimate where Σ(β) def= ΣAs((cid:126)gα(β)). Consequently, Using this estimate of how much (cid:126)g changes in the Σ(β) norm, we now estimate how much (cid:126)g changes in the (cid:96)∞ norm. Let (cid:126)z def= (G(β) − αΛg) −1 (cid:126)1. Then, we have . (5.13) G(β) − αΛg (cid:23) (1 − α)G(β) (cid:23) (1 − α)Σ(β) 1 = Σ(β) Σ(β) −1 (cid:126)1 dβ Σ(β) (cid:13)(cid:13)(cid:13)2 rank (A) 1 − α ≤ 1 − α (cid:13)(cid:13)(cid:13)(cid:13)2 (cid:13)(cid:13)(cid:13)(cid:13)G(β)−1 d(cid:126)g ≤ (cid:13)(cid:13)(cid:13)(G(β) − αΛg) (cid:13)(cid:13)(cid:13)(cid:126)1 (cid:13)(cid:13)(cid:13)2 ((1 − α) (cid:126)σi(β) + β)(cid:126)zi ≤ (cid:12)(cid:12)(cid:12)α(cid:126)1T (cid:33) =(cid:13)(cid:13)(cid:126)z(cid:13)(cid:13)∞ ≤ max (cid:13)(cid:13)G(β − θ)−1((cid:126)g(β − θ) − (cid:126)w)(cid:13)(cid:13)∞ ≤ 1 (cid:32) α(cid:13)(cid:13)(cid:126)z(cid:13)(cid:13)Σ(β) ≤ max 1 − α i P(2)(cid:126)z (cid:12)(cid:12)(cid:12) + 1 ≤ α(cid:126)σi(β)(cid:13)(cid:13)(cid:126)z(cid:13)(cid:13)Σ(β) + 1. (cid:32)(cid:112)rank (A) (1 − α)3/2 , 1 β 12cr (cid:33) . , 1 β Using (5.13) and α < 1, we have (cid:13)(cid:13)(cid:13)(cid:13) d ln (cid:126)g dβ (cid:13)(cid:13)(cid:13)(cid:13)∞ Using (5.11), integrating, and applying Lemma 33 we have that √ (1−α)3/2β rank(A) 1000c2 r for θ ≤ . Hence, this proves that step 2a preserves the invariant (5.10) at step 2a. Hence, the algorithm satisfies the assumptions needed for Theorem 21 throughout and computeWeight portion and ins step 2a works as desired. Since each iteration β decreased by O iterations. Using the initial β is O(1) we see that the algorithm requires only O Theorem 21 to bound the total number of linear systems solved then yields the result. (cid:16) (cid:17) 1/(cid:112)rank (A) (cid:17) (cid:16)(cid:112)rank (A) 33 6 Approximate Weights Suffice In the previous sections, we analyzed a weighted path following strategy assuming oracle access to a weight function we could compute exactly and showed how to compute a weight function approximately. In this section we show why it suffices to compute multiplicative approximations to the weight function. Ultimately, having access to this “noisy oracle” will only cause us to lose polylogarithmic factors in the running time as compared to the “exact oracle” case. This is a non-trivial statement as the weight function serves several roles in our weighted path following scheme. First, it ensures a good ratio between total weight c1 and slack sensitivity cγ. This allows us to take make large increases to the path parameter t after which we can improve centrality. Second, the weight function is consistent and does not differ too much from the cr-update step direction. This allows us to change the weights between cr-update steps without moving too far away from the central path. Given a multiplicative approximation to the weight function, this first property is preserved up to an approximation constant however this second property is not. To effectively use multiplicative approximations to the weight function we cannot simply use the weight function directly. Rather we need to smooth out changes to the weights by using some slowly changing approximation to the weight function. In this section we show how this can be achieved in general. First, in Section 6.1, we present the smoothing problem in a general form that we call the chasing 0 game and we provide an effective strategy for playing this game. Then in Section 6.2 we show how to use this strategy to produce a weighted path following scheme that uses multiplicative approximations to the weight function. 6.1 The Chasing 0 Game The chasing 0 game is as follows. There is a player, an adversary, and a point (cid:126)x ∈ Rm. The goal of the player is to keep the point close to (cid:126)0 in (cid:96)∞ norm and the goal of the adversary tries to move (cid:126)x away from (cid:126)0 ∈ Rm. The game proceeds for an infinite number of iterations where in each iteration the adversary moves the current point (cid:126)x(k) ∈ Rm to some new point (cid:126)y(k) ∈ Rm and the player needs to respond. The player does not know (cid:126)x(k), (cid:126)y(k), or the move of the adversary. All the player knows is that the adversary moved the point within some convex set U (k) and the player knows some (cid:126)z(k) ∈ Rn that is close to (cid:126)y(k) in (cid:96)∞ norm.14 With this information the player is allowed to move the point a little more than the adversary. Formally, the player is allowed to set the next point to (cid:126)x(k+1) ∈ Rm such that (cid:126)∆(k) def= (cid:126)x(k+1) − (cid:126)y(k) ∈ (1 + )U for some fixed  > 0. In particular, we would like an efficient strategy for computing (cid:126)∆(k) such that(cid:13)(cid:13)(cid:126)x(k)(cid:13)(cid:13)∞ is bounded The question we would like to address is, how close the player can keep (cid:126)x(k+1) to (cid:126)0 in (cid:96)∞ norm? for all k ≥ 0. 14To apply this result to weighted central path following we let the current points (cid:126)x(k) denote the difference between log( (cid:126)w) and log((cid:126)g ((cid:126)x)). The sets U (k) are then related to the cr-update steps and the steps of the player are related to the weights the path following strategy picks. 34 Chasing 0 Game: 1. Given R > 0,  > 0, (cid:126)x(0) ∈ Rm. 2. For k = 1, 2,··· 2a. The adversary announces symmetric convex set U (k) ⊆ Rn and (cid:126)u(k) ∈ U (k). 2b. The adversary sets (cid:126)y(k) := (cid:126)x(k) + (cid:126)u(k). 2c. The adversary announces (cid:126)z(k) such that(cid:13)(cid:13)(cid:126)z(k) − (cid:126)y(k)(cid:13)(cid:13)∞ ≤ R. 2d. The player chooses (cid:126)∆(k) ∈ (1 + ) U (k). 2e. The player sets (cid:126)x(k+1) = (cid:126)y(k) + (cid:126)∆(k). player can follow to ensure that that (cid:13)(cid:13)(cid:126)x(k)(cid:13)(cid:13)∞ is never too large. Our strategy simply consists of We show that assuming that the U (k) are sufficiently bounded then there is strategy that the taking “gradient steps” using the following potential function. Definition 23. For any µ ≥ 0 let pµ : R → R and Φµ : Rm → R be given by ∀x ∈ R : pµ(x) def= eµx + e−µx and Φµ((cid:126)x) def= pµ(xi). (cid:88) i∈[m] In other words, for all k we simply set (cid:126)∆(k) to be the vector in (1 + )U (k) that best minimizes the potential function of the observed position, i.e. Φµ((cid:126)z(k)) for an appropriate choice of µ. In the following theorem we show that this suffices to keep Φµ((cid:126)x(k)) small and that small Φµ((cid:126)x(k)) implies Theorem 24. Suppose that each U (k) is a symmetric convex set that contains an (cid:96)∞ ball of radius rk and is contained in a (cid:96)∞ ball of radius Rk ≤ R.15 Let 0 <  < 1 where 5 and consider the strategy (cid:69) µ =  . small(cid:13)(cid:13)(cid:126)x(k)(cid:13)(cid:13)∞ and hence has the desired properties. (cid:68)∇Φµ((cid:126)z(k)), (cid:126)∆ (cid:19) (cid:18) log(cid:0) 12mτ In particular, we have(cid:13)(cid:13)(cid:126)x(k)(cid:13)(cid:13)∞ ≤ 12R and suppose Φµ((cid:126)x(0)) ≤ 12mτ ∀k ≥ 0 (cid:126)∆(k) = (1 + ) arg min (cid:126)∆∈U (k) : Φµ((cid:126)x(k+1)) ≤ 1 − 2rk 24R Let τ def= maxk Rk rk    12R (or more specifically(cid:13)(cid:13)(cid:126)x(0)(cid:13)(cid:13)∞ ≤ 12R (cid:1). Φµ((cid:126)x(k)) + m ≤ 12mτ Rk 2R  .  log(cid:0) 6τ  (cid:1) ) then µΦµ((cid:126)x) − 2µm ≤(cid:13)(cid:13)∇Φµ((cid:126)x)(cid:13)(cid:13)1 To prove Theorem 24 we first provide the following lemma regarding properties of the potential function Φµ. Lemma 25 (Properties of the Potential Function). For all (cid:126)x ∈ Rm, we have and eµ(cid:107)(cid:126)x(cid:107)∞ ≤ Φµ((cid:126)x) ≤ 2meµ(cid:107)(cid:126)x(cid:107)∞ (6.1) Furthermore, for any symmetric convex set U ⊆ Rm and any (cid:126)x ∈ Rm, let (cid:126)x(cid:91) def= arg max(cid:126)y∈U (cid:104)(cid:126)x, (cid:126)y(cid:105)16 def= max(cid:126)y∈U (cid:104)(cid:126)x, (cid:126)y(cid:105). Then for all (cid:126)x, (cid:126)y ∈ Rm with(cid:13)(cid:13)(cid:126)x − (cid:126)y(cid:13)(cid:13)∞ ≤ δ ≤ 1 and(cid:13)(cid:13)(cid:126)x(cid:13)(cid:13)U e−µδ(cid:13)(cid:13)∇Φµ((cid:126)y)(cid:13)(cid:13)U − µ(cid:13)(cid:13)∇Φµ((cid:126)y)(cid:91)(cid:13)(cid:13)1 ≤(cid:68)∇Φµ((cid:126)x),∇Φµ((cid:126)y)(cid:91)(cid:69) ≤ eµδ(cid:13)(cid:13)∇Φµ((cid:126)y)(cid:13)(cid:13)U + µeµδ(cid:13)(cid:13)∇Φµ((cid:126)y)(cid:91)(cid:13)(cid:13)1. 15Formally we assume that if (cid:126)x ∈ U (k) then(cid:13)(cid:13)(cid:126)x(cid:13)(cid:13)∞ ≤ R and we assume that if(cid:13)(cid:13)(cid:126)x(cid:13)(cid:13)∞ ≤ r then (cid:126)x ∈ U (k). 5µ we have (6.2) 16This is a scaled version of # operator in [27] and hence we name it differently. 35 eµx ≤ pµ(x) ≤ 2eµx If additionally U is contained in a (cid:96)∞ ball of radius R then Proof. First we note that for all x ∈ R we have e−µδ(cid:13)(cid:13)∇Φµ((cid:126)y)(cid:13)(cid:13)U − µmR ≤(cid:13)(cid:13)∇Φµ((cid:126)x)(cid:13)(cid:13)U ≤ eµδ(cid:13)(cid:13)∇Φµ((cid:126)y)(cid:13)(cid:13)U + µeµδmR. eµx − e−µx(cid:17) µ(x) = µ(cid:0)eµx − e−µx(cid:1) and eµδ−µy − e−µy−µδ(cid:17) and therefore we have (6.1). since x − y ≤ δ we have that x = y + z for some z ∈ (−δ, δ). Using that p(cid:48)(x) is monotonic in x we then have p(cid:48) µ(x) = p(cid:48) = µ Next let x, y ∈ R such that x − y ≤ δ. Note that (cid:12)(cid:12)p(cid:48) (cid:16) µ(x)(cid:12)(cid:12) = p(cid:48) (cid:16) eµy+µδ − e−µy−µδ(cid:17) µ(y + δ) = eµδp(cid:48)(y) + µ µ(y + z) ≤ p(cid:48) µ(x) = µ sign(x) and p(cid:48) (6.3) (cid:16) µ(x) = p(cid:48) ≤ eµδ(cid:12)(cid:12)p(cid:48)(y)(cid:12)(cid:12) + µeµδ. (6.4) By symmetry (i.e. replacing x and y) this implies that (6.5) Since U is symmetric this implies that for all i ∈ [m] we have sign(∇Φµ((cid:126)y)(cid:91))i = ∇Φµ((cid:126)y)i = sign(yi) . Therefore, if for all i ∈ [n] we have sign(xi) = sign(yi), by (6.4), we see that (cid:68)∇Φµ((cid:126)x),∇Φµ((cid:126)y)(cid:91)(cid:69) i = µ(x) ≥ e−µδp(cid:48)(y) − µ p(cid:48) (cid:88) µ(yi) + µeµδ(cid:17)∇Φµ((cid:126)y)(cid:91) ≤ (cid:88) ≤ eµδ(cid:68)∇Φµ((cid:126)y),∇Φµ((cid:126)y)(cid:91)(cid:69) = eµδ(cid:13)(cid:13)∇Φµ((cid:126)y)(cid:13)(cid:13)U + µeµδ(cid:13)(cid:13)∇Φµ((cid:126)y)(cid:91)(cid:13)(cid:13)1. µ(xi)∇Φµ((cid:126)y)(cid:91) p(cid:48) (cid:16) eµδp(cid:48) i i i + µeµδ(cid:13)(cid:13)∇Φµ((cid:126)y)(cid:91)(cid:13)(cid:13)1 2 since δ ≤ 1 e−µδ(cid:12)(cid:12)p(cid:48) 5µ. Thus, we have ≤ sign (yi) p(cid:48) µ(yi)(cid:12)(cid:12) − µ ≤ − µ Similarly, using (6.5), we have e−µδ(cid:13)(cid:13)∇Φµ((cid:126)y)(cid:13)(cid:13)U − µ(cid:13)(cid:13)∇Φµ((cid:126)y)(cid:91)(cid:13)(cid:13)1 ≤ (cid:10)∇Φµ((cid:126)x),∇Φµ((cid:126)y)(cid:91)(cid:11) and hence Taking inner product on both sides with ∇Φµ((cid:126)y)(cid:91) Thus, (6.2) holds in general. (6.2) holds. On the other hand if sign(xi) (cid:54)= sign(yi) then we know that xi ≤ δ and consequently p(cid:48) µ(xi) ≤ µ(eµδ − e−µδ) ≤ µ µ(xi) ≤ 0 ≤ eµδ(cid:12)(cid:12)p(cid:48) i and using definition of(cid:13)(cid:13)·(cid:13)(cid:13)U and ·(cid:91), we get (6.2). Finally we note that since U is contained in a (cid:96)∞ ball of radius R, we have(cid:13)(cid:13)(cid:126)y(cid:91)(cid:13)(cid:13)1 ≤ mR for all (cid:126)y. Using this fact, (6.2), and the definition of(cid:13)(cid:13) ·(cid:13)(cid:13)U, we obtain where the last line comes from the fact ∇Φµ((cid:126)y)(cid:91) ∈ U and the definition of (cid:13)(cid:13) ·(cid:13)(cid:13)U. By symmetry e−µδ(cid:13)(cid:13)∇Φµ((cid:126)y)(cid:13)(cid:13)U − µmR ≤(cid:68)∇Φµ((cid:126)x),∇Φµ((cid:126)y)(cid:91)(cid:69) ≤(cid:13)(cid:13)∇Φµ((cid:126)x)(cid:13)(cid:13)U µ(yi)(cid:12)(cid:12) + µeµδ. 2 (6.3) follows. 36 Using Lemma 25 we prove Theorem 24. Proof. [Theorem 24] For the remainder of the proof, let (cid:13)(cid:13)(cid:126)x(cid:13)(cid:13)U (k) = max(cid:126)y∈U (k) (cid:104)(cid:126)x, (cid:126)y(cid:105) and (cid:126)x(cid:91)(k) = arg max(cid:126)y∈U (k) (cid:104)(cid:126)x, (cid:126)y(cid:105). Since U (k) is symmetric, we know that (cid:126)∆(k) = − (1 + )(cid:0)∇Φµ((cid:126)z(k))(cid:1)(cid:91)(k) and therefore by applying the mean value theorem twice we have that Φµ((cid:126)x(k+1)) = Φµ((cid:126)y(k)) + = Φµ((cid:126)x(k)) + (cid:68)∇Φµ((cid:126)z), (cid:126)x(k+1) − (cid:126)y(k)(cid:69) (cid:68)∇Φµ((cid:126)y), (cid:126)y(k) − (cid:126)x(k)(cid:69) (cid:28) + (cid:68)∇Φµ((cid:126)z), (cid:126)x(k+1) − (cid:126)y(k)(cid:69) (cid:17)(cid:91)(k)(cid:29) (cid:16)∇Φµ((cid:126)z(k)) ∇Φµ((cid:126)z), for some (cid:126)y between (cid:126)y(k) and (cid:126)x(k) and some (cid:126)z between (cid:126)x(k+1) and (cid:126)y(k). Now, using that (cid:126)y(k) − (cid:126)x(k) ∈ U (k) and that (cid:126)x(k+1) − (cid:126)y(k) = (cid:126)∆(k) we have Φµ((cid:126)x(k+1)) ≤ Φµ((cid:126)x(k)) +(cid:13)(cid:13)∇Φµ((cid:126)y)(cid:13)(cid:13)U (k) − (1 + ) . (6.6) Furthermore, since  < 1 Since U k is contained within the (cid:96)∞ ball of radius Rk Lemma 25 shows that (cid:13)(cid:13)∇Φµ((cid:126)y)(cid:13)(cid:13)U (k) ≤ eµRk(cid:13)(cid:13)∇Φµ((cid:126)x(k))(cid:13)(cid:13)U (k) + mµRkeµRk . 5 and Rk ≤ R, by triangle inequality we have(cid:13)(cid:13)(cid:126)z−(cid:126)z(k)(cid:13)(cid:13)∞ ≤ (1 + )Rk + R ≤ 3R and(cid:13)(cid:13)(cid:126)z(k) − (cid:126)x(k)(cid:13)(cid:13)∞ ≤ 2R. Therefore, applying Lemma 25 twice yields that (cid:69) ≥ e−3µR(cid:13)(cid:13)∇Φµ((cid:126)z(k))(cid:13)(cid:13)U (k) − µmRk (cid:68)∇Φµ((cid:126)z),∇Φµ((cid:126)z(k))(cid:91)(k) ≥ e−5µR(cid:13)(cid:13)∇Φµ((cid:126)x(k))(cid:13)(cid:13)U (k) − 2µmRk. (6.8) (6.7) Combining (6.6), (6.7), and (6.8) then yields that Φµ((cid:126)x(k+1)) ≤ Φµ((cid:126)x(k)) −(cid:0)(1 + )e−5µR − eµR(cid:1)(cid:13)(cid:13)∇Φµ((cid:126)x(k))(cid:13)(cid:13)U (k) + mµRkeµR + 2(1 + )mµRk. Since we chose µ =  12R, we have 1 +  ≤  2 Hence, we have (1 + )e−5µR − eµR ≤  2. Also, since 0 <  < 1 + (1 + 6µR) ≤  2 e5µR + e6µR. 5 we have mµRkeµR + 2(1 + )mµRk ≤(cid:0)eµR + 2(1 + )(cid:1) mµRk ≤ m (cid:13)(cid:13)∇Φµ((cid:126)x(k))(cid:13)(cid:13)U (k) + m Φµ((cid:126)x(k+1)) ≤ Φµ((cid:126)x(k)) −  2 7Rk 24R . 7Rk 24R . Using Lemma 25 and the fact that Uk contains a (cid:96)∞ ball of radius rk, we have Φµ((cid:126)x(k)) − 2m (cid:13)(cid:13)∇Φµ((cid:126)x(k))(cid:13)(cid:13)U (k) ≥ rk (cid:13)(cid:13)∇Φµ((cid:126)x(k))(cid:13)(cid:13)1 ≥ rk (cid:16) (cid:17) . 12R Thus, we have 37 Therefore, we have that Φµ((cid:126)x(k+1)) ≤ ≤ (cid:19) (cid:19) (cid:18) (cid:18) 1 − 2rk 24R 1 − 2rk 24R Φµ((cid:126)x(k)) + rk 12R m + m 7Rk 24R Φµ((cid:126)x(k)) + m Rk 2R . Hence, if Φµ((cid:126)x(k)) ≤ 12mτ have by induction that Φµ((cid:126)x(k)) ≤ 12mτ immediately from Lemma 25.   , we have Φµ((cid:126)x(k+1)) ≤ 12mτ for all k. The necessary bound on (cid:13)(cid:13)(cid:126)x(k)(cid:13)(cid:13)∞ then follows . SinceΦµ((cid:126)x(0)) ≤ 12mτ by assumption we   6.2 Centering Step With Noisy Weight Here we show how to use the results of the previous section to perform weighted path following given access only to a multiplicative approximation of the weight function. In particular, we show how to use Theorem 24 to improve the centrality of (cid:126)x while maintaining the invariant that (cid:126)w is close to (cid:126)g((cid:126)x) multiplicatively. >0}, we measure the distance between the >0, in log scale (cid:126)Ψ((cid:126)s, (cid:126)w) def= log((cid:126)g((cid:126)s)) − log( (cid:126)w). Our goal is to keep(cid:13)(cid:13)(cid:126)Ψ((cid:126)s, (cid:126)w)(cid:13)(cid:13)∞ ≤ K for some error threshold K. We choose K to be just As in Section 4 given a feasible point, {(cid:126)x, (cid:126)w} ∈ {S0×Rm >0, and the weight function, (cid:126)g((cid:126)s) ∈ Rm current weights, (cid:126)w ∈ Rm small enough that we can still decrease δt((cid:126)x, (cid:126)w) linearly and still approximate (cid:126)g((cid:126)s), as in general it may be difficult to compute (cid:126)g((cid:126)s) when (cid:126)w is far from (cid:126)g((cid:126)s). Furthermore, we ensure that (cid:126)Ψ doesn’t change too much in either (cid:107) · (cid:107)∞ or (cid:107) · (cid:107)W(new) and thereby ensure that the centrality does not increase too much as we move (cid:126)w towards (cid:126)g((cid:126)s). We meet these goals by playing the chasing 0 game where the vector we wish to keep near (cid:126)0 is (cid:126)Ψ((cid:126)s, (cid:126)w), the adversaries moves are cr-steps, and our moves change log( (cid:126)w). The cr-step decreases δt and since we are playing the chasing 0 game we keep (cid:126)Ψ((cid:126)s, (cid:126)w) small. Finally, since by the rules of the chasing 0 game we do not move (cid:126)w much more than (cid:126)g((cid:126)s) has moved, we have by similar reasoning to the exact weight computation case, Theorem 11 that changing (cid:126)w does not increase δt too much. This inexact centering operation and the analysis are formally defined and analyzed below. Most of the parameter balancing involved in this paper lies in the theorem below. Due to the step consistency, we know know that after a cr-steps, the weight does not move too far away that we can move it back without hurting centrality too much if we can compute the weight exactly. The Chasing 0 game shows that we can mimic this if we compute the weight accurate enough. Therefore, the balancing is simply about how accurate we need to do. K 60cr log(960crcγ m3/2) , δt = δt((cid:126)x(old), (cid:126)w(old)),  = 1 5cr ((cid:126)x(new), (cid:126)w(apx)) = centeringInexact((cid:126)x(old), (cid:126)w(old), K, approxWeight) 1. R = and µ =  12R . 2. {(cid:126)x(new), (cid:126)w(new)} = stept((cid:126)x(old), (cid:126)w(old), cr) as in Definition 4. 3. Let U = {(cid:126)y ∈ Rm (cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)W(new) 5. (cid:126)w(apx) := exp(cid:0)log( (cid:126)w(new)) + (1 + ) arg min(cid:126)u∈U cr+1 δt and(cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)∞ ≤ 4cγδt} 4. Compute (cid:126)z = approxWeight((cid:126)s, (cid:126)w(new), R). (cid:10)∇Φµ ≤ cr+0.14 (cid:0)log((cid:126)z) − log(cid:0) (cid:126)w(new)(cid:1)(cid:1) , (cid:126)u(cid:11)(cid:1) Note that in step 5 in centeringInexact, we need to project a certain vector onto the intersection , and box,(cid:13)(cid:13) ·(cid:13)(cid:13)∞. In Section C we show that this can be computed in parallel in of ball,(cid:13)(cid:13) ·(cid:13)(cid:13)W(new) 38 12R. Let ((cid:126)x(new), (cid:126)w(apx)) = centeringInexact((cid:126)x(old), (cid:126)w(old), K), then and Φµ def= Φµ((cid:126)Ψ((cid:126)x(old), (cid:126)w(old))) ≤ 960crcγm3/2 (cid:19) 1 − 0.5 1 + cr δt Φµ((cid:126)x(k)) + 2mcγδt 5R ≤ 960crcγm3/2. depth O(1) and work O(m) and therefore this step is not a bottleneck in the computational cost of our weighted path following schemes. Theorem 26 (Centering with Inexact Weights). Given current point {(cid:126)x(old), (cid:126)w(old)} ∈ {S0 × Rm error parameter K ≤ 1 >0}, , and approximate weight computation oracle, approxWeight, such that (cid:13)(cid:13) log(approxWeight((cid:126)s, (cid:126)w, R))−log ((cid:126)g((cid:126)s))(cid:13)(cid:13)∞ ≤ R for (cid:126)s, (cid:126)w ∈ Rm >0 with(cid:13)(cid:13) log( (cid:126)w)−log ((cid:126)g((cid:126)s))(cid:13)(cid:13)∞ ≤ 2K, 8cr assume that def= δt((cid:126)x(old), (cid:126)w(old)) ≤ δt 240crcγ log(cid:0)960crcγm3/2(cid:1) K and (cid:18) where µ =  δt((cid:126)x(new), (cid:126)w(apx)) ≤ (cid:18) (cid:19) Also, we have(cid:13)(cid:13) log((cid:126)g((cid:126)s(new))) − log( (cid:126)w(apx))(cid:13)(cid:13)∞ ≤ K. U def= {(cid:126)y ∈ Rm (cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)W(new) Φµ((cid:126)Ψ((cid:126)x(new), (cid:126)w(apx))) ≤ δt 600c2 rR ≤ Cw 1 − √ m Proof. By Lemma 9, we know that for a cr-update step, we have (cid:126)Ψ((cid:126)x(new), (cid:126)w(new))−(cid:126)Ψ((cid:126)x(old), (cid:126)w(old)) ∈ U where U is the symmetric convex set given by (cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)∞ ≤ C∞} and where Note that since δt ≤ K(cid:0)240crcγ log(cid:0)960crcγm3/2(cid:1)(cid:1)−1 we have and Cw = cr + 1/8 cr + 1 C∞ = 4cγδt δt + 13cγδ2 t . (cid:32) 240crcγ log(cid:0)960crcγm3/2(cid:1)(cid:33) K C∞ ≤ 4cγ 60cr log(cid:0)960crcγm3/2(cid:1) = R K ≤ Therefore U is contained in a (cid:96)∞ ball of radius R. Again using the bound on δt we have Cw = cr + 1 8 cr + 1 δt + 13cγδ2 t ≤ cr + 1 8 cr + 1 δt + 0.008 cr δt ≤ cr + 0.14 cr + 1 δt. (6.9) Consequently, U ⊆ U where we recall that U is the symmetric convex set defined by U = {(cid:126)y ∈ Rm (cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)W(new) ≤ cr + 0.14 cr + 1 δt and (cid:13)(cid:13)(cid:126)y(cid:13)(cid:13)∞ ≤ 4cγδt}. that(cid:13)(cid:13)(cid:126)Ψ((cid:126)s(old), (cid:126)w(old))(cid:13)(cid:13)∞ ≤ K ≤ 1 8cr Therefore, we can play the chasing 0 game on (cid:126)Ψ((cid:126)s(old), (cid:126)w(old)) attempting to maintain the invariant without taking steps that are more than 1 +  times the size of U. We pick  = 1 5cr so to not interfere with our ability to decrease δt linearly. 39  log 12R (cid:19) ≤ K satisfies the following (cid:18) 12mτ To use the chasing 0 game to maintain (cid:13)(cid:13)(cid:126)Ψ((cid:126)s(old), (cid:126)w(old))(cid:13)(cid:13)∞ ≤ K we need to ensure that R (cid:96)∞ ball that U contains. Since(cid:13)(cid:13)(cid:126)g((cid:126)s(old))(cid:13)(cid:13)∞ ≤ 2 by Definition 7 and since(cid:13)(cid:13)(cid:126)Ψ((cid:126)x(old), (cid:126)w(old))(cid:13)(cid:13)∞ ≤ 1 by assumption we have that(cid:13)(cid:13) (cid:126)w(old)(cid:13)(cid:13)∞ ≤ 3. By Lemma 5 we know that(cid:13)(cid:13) (cid:126)w(new)(cid:13)(cid:13)∞ ≤ 4 if δtcγ ≤ 1 Consequently, if(cid:13)(cid:13)(cid:126)u(cid:13)(cid:13)∞ ≤ δt where here τ is as defined in Theorem 24. To bound τ we need to lower bound the radius of the ∀u ∈ Rm : m, then (cid:126)u ∈ U. Thus, U contains a a box of radius (cid:18) 12mτ m and consequently contained in a box of radius 4cγδt, we have that τ ≤ 16cγ m and since U is and consequently (cid:13)(cid:13)(cid:126)u(cid:13)(cid:13)2 √ 4 4m √ δt 8 8  4 12R  log  ≤ 60crR log This proves that we meet the conditions of Theorem 24. Therefore, we have . √ W(new) (cid:13)(cid:13)(cid:126)u(cid:13)(cid:13)2 960crcγm3/2(cid:17) ≤ K. (cid:19)(cid:19) (cid:19) Φµ((cid:126)x(k)) + m Φµ((cid:126)x(k)) + ∞ ≥ 1 (cid:16) (cid:18) δt √ m 4 √ m 1 2R 2mcγδt 5R Φµ((cid:126)Ψ((cid:126)x(new), (cid:126)w(apx))) ≤ 1 − 2 24R (4cγδt) where we do not need to re-derive the last line because it follows from Theorem 24. Consequently, (cid:13)(cid:13)(cid:126)Ψ((cid:126)x(old), (cid:126)w(old))(cid:13)(cid:13)∞ ≤ K and Φµ((cid:126)Ψ((cid:126)x(new), (cid:126)w(apx))) ≤ 960crcγm3/2. Since K ≤ 8, we have (cid:13)(cid:13)G((cid:126)s(old))−1( (cid:126)w(old) − (cid:126)g((cid:126)s(old)))(cid:13)(cid:13)∞ ≤ 1.2 and γ((cid:126)s(old), (cid:126)w(old)) ≤ 2cγ. Consequently, by 1 Lemma 6 we have δt((cid:126)x(new), (cid:126)w(new)) ≤ γ((cid:126)x(old), (cid:126)w(old)) · δ2 t ≤ 2 · cγ · δ2 t 1 − δt = 600c2 rR ≤ 960crcγm3/2. (cid:19) (cid:18) (cid:18) (cid:104) Let ∞ def=(cid:13)(cid:13) log( (cid:126)w(apx)) − log( (cid:126)w(new))(cid:13)(cid:13)∞ and w By our bounds on U, we have ∞ ≤ (1 + )R ≤ 1 100cr Using Lemma 10, we have that and w = (1 + ) def=(cid:13)(cid:13) log( (cid:126)w(apx)) − log( (cid:126)w(new))(cid:13)(cid:13)W(new) (cid:20) cr + 0.14 . ≤ cr + 0.37 cr + 1 δt. cr + 1 δt (cid:21) (cid:105) ≤ 3cγδ2 δt((cid:126)x(new), (cid:126)w(apx)) ≤ (1 + ∞) 1 ≤ 1 + (cid:18) δt((cid:126)x(new), (cid:126)w(new)) + w (cid:19)(cid:18) cr + 0.34 (cid:19) δt + 3cγδ2 t ≤ t + (1 + ∞)w (cid:18) cr + 0.5 (cid:19) δt cr + 1 100cr cr + 1 40 7 The Algorithm In this section we show how to put together the results of the previous sections to solve a linear program. First, in Section 7.1 we provide a path following routine that allows us to move quickly from one approximate central path point to another. Using this subroutine, in Section 7.2 we show how to obtain an algorithm for solving a linear program in (cid:101)O((cid:112)rank(A)L) iterations that consist of solving linear systems in the original constraint matrix. In the Appendix we provide additional proof details such as how these algorithm only require approximate linear system solvers (Appendix D) and how to initialize our interior point technique and round approximate solutions to optimal ones (Appendix E). 7.1 Path Following We start by analyzing the running time of pathFollowing a subroutine for following the weighted central path. (cid:17) (cid:16) 2m (cid:18) ((cid:126)x(new), (cid:126)w(new)) = pathFollowing((cid:126)x(old), (cid:126)w(old), tstart, tend) 1. cr = 2 log2 2. While t < tend 2a. ((cid:126)x(new), (cid:126)w(apx)) = centeringInexact((cid:126)x(old), (cid:126)w(old), K, computeWeight) 2b. , t = tstart, K = 1 24cr t(new) := t (cid:19) rank(A) 1 + . . √ r log(crm) 1 1010c3 rank(A) 1 r log(cid:0)1920crm3/2(cid:1) r log(cid:0)1920crm3/2(cid:1) 2c. (cid:126)x(old) := (cid:126)x(new), (cid:126)w(old) := (cid:126)w(apx), t := t(new) 2d. For every 100cr log(crm) steps, check if the current (cid:126)x, (cid:126)w satisfies the δ and Φ invariants. m If it does not satisfies, roll back to the last time the invariants were met. 3. Output ((cid:126)x(old), (cid:126)w(old)). Theorem 27 (Main Result). Given {(cid:126)x(old), (cid:126)w(old)} ∈ {S0 × Rm >0} and tstart ≤ tend. Suppose that and Φµ((cid:126)Ψ((cid:126)x(old), (cid:126)w(old))) ≤ 1920crm3/2 δtstart((cid:126)x(old), (cid:126)w(old)) ≤ 11520c2 (cid:16)(cid:112)rank(A) log (cid:16) tend (cid:17)(cid:17) where µ = 2 log (52crm) /K. Let ((cid:126)x(new), (cid:126)w(apx)) = pathFollowing((cid:126)x(old), (cid:126)w(old), tstart, tend), then and Φµ((cid:126)Ψ((cid:126)x(new), (cid:126)w(new))) ≤ 1920crm3/2. δtend((cid:126)x(new), (cid:126)w(new)) ≤ 1 11520c2 Furthermore, computing ((cid:126)x(new), (cid:126)w(new)) takes O where the cost of each iteration is dominated by the time need to solve O(1) linear system solves. iterations in expectation tstart Proof. This algorithm maintains the invariant that δt((cid:126)x(old), (cid:126)w(old)) ≤ r log(cid:0)1920crm3/2(cid:1) and Φµ((cid:126)Ψ((cid:126)x(old), (cid:126)w(old))) ≤ 1920crm3/2 1 11520c2 in each iteration in the beginning of the step (2a). Note that our oracle computeWeight satisfies the assumption of Theorem 26 since 2K ≤ 1 . Hence, centeringInexact can use computeWeight 12cr 41 (cid:18) (cid:19) to find the approximations of (cid:126)g((cid:126)s(new)). Hence, Theorem 26 shows that we have δt((cid:126)x(new), (cid:126)w(apx)) ≤ 1 − 0.5 1 + cr and Φµ((cid:126)Ψ((cid:126)x(new), (cid:126)w(apx))) ≤ 1920crm3/2. δt Using the fact c1((cid:126)g) ≤ 2 rank(A) and that (cid:126)w(new) is within a multiplicative factor of two of (cid:126)g((cid:126)s(new)) by Lemma 1 we have δt(new)((cid:126)x(new), (cid:126)w(apx)) (cid:32) 1 + ≤ ≤ 1010c3 1 r log (crm)(cid:112)rank(A) r log(cid:0)1920crm3/2(cid:1) 1 (cid:33)(cid:18) 1 − 0.5 1 + cr (cid:19) δt + (cid:113)(cid:13)(cid:13) (cid:126)w(new)(cid:13)(cid:13)1 r log (crm)(cid:112)rank(A) 1010c3 (cid:1)(cid:100)12cr log( 4m 11520c2 Theorem 21 shows that with probability(cid:0)1 − 1 K )(cid:101), computeWeight outputs a correct answer. Therefore, for each 100cr log(crm) iterations there is constant probability that the whole procedure runs correctly. Hence, we only need to know how long it takes to check the current state satisfies δt and Φµ invariants. We can check the δt easily using only 1 linear system solve. To check Φµ, we need to compute the weight function exactly. To do this, we use lemma 19 and note that computing the leverage scores exactly takes m linear system solve. Therefore, the averaged cost of step 2d is just O(1) linear system solves and this justified the total running time. m m 7.2 Solving a Linear Program Here we show how to use the properties of pathFollowing proved in Theorem 27 to obtain a linear program solver. Given the previous theorem all that remains is to show how to get the initial central point and round the optimal point to a vertex. We defer much of the proof of how to obtain an initial point, deal with unbounded solutions, and round to an optimal vertex to Lemma 40 proved in Appendix E. Theorem 28. Consider a linear programming problem of the form min (cid:126)x∈Rn : A(cid:126)x≥(cid:126)b (cid:126)cT (cid:126)x (7.1) where A ∈ Rm×n, (cid:126)b ∈ Rm, and (cid:126)c ∈ Rn have integer coefficients. Let L denote the bit complexity of (7.1) and suppose that for any positive definite diagonal matrix D ∈ Rm×m with condition number 2 O(L) there is an algorithm solve(A,(cid:126)b, D, ) such that (cid:13)(cid:13)solve(A,(cid:126)b, D, ) − (DA)+(cid:126)b(cid:13)(cid:13)AT D2A ≤ (cid:13)(cid:13) (DA)+ (cid:126)b(cid:13)(cid:13)AT D2A (cid:16)(cid:112)rank(A) (T + nnz(A)) L (cid:17) in time O (T log(1/)) for any  > 0 with success probability greater than 1 − 1 an algorithm to solve (7.1) in expected time O constraints of an optimal solution or prove that the program is unfeasible or unbounded. m. Then, there is , i.e, find the active (7.2) 42 Using [24] as the Solve algorithm, we obtain an algorithm that solves (7.1) in time O (cid:16)(cid:112)rank(A) (nnz(A) + (rank(A))ω) L (cid:17) (cid:68) (cid:69) . (7.3) where ω < 2.3729 [42] is the matrix multiplication constant. Proof. Applying the Lemma 40 we obtain a modified linear program given A(new)(cid:126)x ≥ (cid:126)b(new) (cid:126)c(new), (cid:126)x min which is bounded and feasible with O(n) variables, O(m) constraints, O(rank(A)) rank and O(L) bit complexity. Also, we are given an explicit interior point (cid:126)x0. To obtain an initial weighted central path point, we can use Theorem 22. However, (cid:126)x may not be close to central path, i.e. δt could be large. To fix this, we can temporarily change the cost function such that δt = 0. In particular, we can set (cid:126)cmodified = AT S−1 x (cid:126)w and get δt = 0 for this modified cost function. One can think of Theorem 27 as showing that we can get the central path point from a certain cost function tstart(cid:126)c to another cost function tend(cid:126)c in time that depends only logarithmically on the multiplicative difference between these two vectors. Clearly, instead of increasing t we can decrease t similarly. Hence, we can decrease t such that we get the central path point (cid:126)xcenter for the cost function 2− Θ(L)(cid:126)cmodified. Since 2− Θ(L) is close enough to zero, it can be shown that δt is small also for the cost function 2− Θ(L)(cid:126)c. Then, we could use Theorem 27 to increase t and obtain the central path point for t = 2 Θ(L). standard duality gap theorem,17 we know that the duality gap of (cid:126)xt is less than (cid:13)(cid:13) (cid:126)w(cid:13)(cid:13)1/t and in this case it is less than 2− Θ(L) because(cid:13)(cid:13) (cid:126)w(cid:13)(cid:13)1 ≤ 2 rank (A). Now, we can use the conclusion of the Then, we can use centeringInexact to make δt becomes and hence (cid:126)cT (cid:126)xt close to (cid:126)cT (cid:126)x. By a Lemma 40 to find the active constraints of an optimal solution of the original linear program or prove that it is infeasible or unbounded. During the algorithm, we only called the function centeringInexact O(L) times and hence the algorithm only executes O(L) linear system solves. In Section D, we show that these linear systems do not need to be solved exactly and that inexact linear algebra suffices. Using this observation and letting using [24] as the solve routine yields the total running time of (cid:16)(cid:112)rank(A) (nnz(A) + (rank(A))ω) L (cid:17) . O In Section C, we show that the projection problem in centeringInexact can be computed in (cid:101)O(1) depth and O(m) work and other operations are standard parallelizable linear algebra opera- tions. Therefore, we achieve the first (cid:101)O((cid:112)rank (A)L) depth polynomial work method for solving Theorem 29. There is an (cid:101)O((cid:112)rank (A)L) depth polynomial work algorithm to solve linear program linear programs. of the form where L denote the bit complexity of the linear program. 17See [16] or [25] for a more detailed treatment of this fact in a more general regime. min (cid:126)x∈Rn : A(cid:126)x≥(cid:126)b (cid:126)cT (cid:126)x 43 7.3 Accelerating the Solver In this section, we show that how we can apply acceleration methods for decreasing the iterations of interior point techniques can be applied to our algorithm to yield a faster method. In particular we show how to adapt techniques of Vaidya [37] for using fast matrix multiplication to obtain a faster running time. Our goal here is to provide a simple exposition of how the iteration costs of our method can be decrease. We make no attempt to explore the running time of our algorithm in all regimes and we note that since our algorithm only needs to solve linear systems in scalings of the original constraint matrix there may be techniques to improve our algorithm further in specific regimes by exploiting structure in A. To accelerate our path following method, we note that we solve systems of two forms: we solve systems in AT S−1WS−1A to update (cid:126)x and we solve systems in AT S−1WαS−1A to update (cid:126)w. Since we have proven in Lemma 15 that two system are spectrally similar, we only need to know how to solve system of the form AT S−1WS−1A and then we can use preconditioning to solve either system. Furthermore, we note similarly to Vaidya [37] that the S and W matrices do not change too much from iteration to iteration and therefore a sequence of the necessary linear system can be solved faster than considering them individually. Below we state and Appendix F we prove a slight improvement of a result in [37] formally analyzing one way of solving these systems faster. Theorem 30. Let (cid:126)d(i) ∈ Rm that d(i) j given the (cid:126)d(i) in a sequence, in each iteration i we can compute (cid:0)AT DiA(cid:1)−1 (cid:126)xi for Di = diag((cid:126)di) >0 be a sequence of r positive vectors. Suppose that the number of times for any i ∈ [r] and j ∈ [m] is bounded by Cr2 for some C ≥ 1. Then if we are (cid:54)= d(i+1) j and arbitrary (cid:126)xi ∈ Rn with average cost per iteration (cid:18) mnω−1 r (cid:101)O (cid:19) + n2 + Cωr2ω + Cω−1nrω where ω < 2.3729 [42] is the matrix multiplication constant. Using Theorem 30 we simply need to estimate how much the diagonal entries S−1WS−1 to obtain a faster linear program solver. We prove the following. Theorem 31. For any n (cid:18)(cid:112)mβ O (cid:18) m ≤ β ≤ 1 and r > 1, there is an mnω−1 nnz(A) + n2 + r + β−ωr2ω + β−(ω−1)nrω (cid:19) (cid:19) L (7.4) time algorithm for solving linear programming problems of the form min (cid:126)cT (cid:126)x given A(cid:126)x ≥ (cid:126)b where A ∈ Rm×n. Proof. Instead of using β = n m , 1] be arbitrary as in the theorem statement. Looking at the analysis in Section 5 we see that this yields a weight function with c1 = O (βm), cγ = O(1) and cr = O(1). Consequently, it takes O(cid:0)√ βmL(cid:1) iterations to solve m in the weight function we let β ∈ [ n the linear program. 44 theorem to compute(cid:0)AT DjA(cid:1)−1 (cid:126)x for each group of operations, we need to estimate the change of We separate the sequence of the linear systems involved into groups of size r. To use the previous the diagonal entries S−1WS−1. For the change of S, Lemma 5 shows that = O(1). Since we have added β in the weight function, we have (cid:126)wi ≥ β and (cid:13)(cid:13) log ((cid:126)sj) − log ((cid:126)sj+1)(cid:13)(cid:13)Wj (cid:13)(cid:13) log ((cid:126)sj) − log ((cid:126)sj+1)(cid:13)(cid:13)2 = O(β−1/2). Therefore, in a period of r operations, at most O(cid:0)β−1r2(cid:1) coordinates can change multiplicatively only changing (cid:126)d a total of O(cid:0)β−1r2(cid:1) over a sequence of r operations. Using Theorem 30 and using Therefore, we can maintain a vector (cid:126)d such that D is spectrally similar to S−1WS−1 while by a constant factor. Similarly, we can use inequality (6.9) to analyze the change of W. ADA as pre-conditioner for the necessary linear system solves, we can solve the linear system with average cost (cid:18) Using that the total number of iterations is O(cid:0)√ nnz(A) + n2 + O r + β−ωr2ω + β−(ω−1)nrω βmL(cid:1) then yields (7.4). mnω−1 (cid:19) . 8 Acknowledgments We thank Yan Kit Chim, Andreea Gane, Jonathan A. Kelner, Lap Chi Lau, Aleksander Mądry, Cameron Musco, Christopher Musco, Lorenzo Orecchia, Ka Yu Tam and Nisheeth Vishnoi for many helpful conversations. This work was partially supported by NSF awards 0843915 and 1111109, NSF Graduate Research Fellowship (grant no. 1122374) and Hong Kong RGC grant 2150701. Finally, we thank the referees for extraordinary efforts and many helpful suggestions. References [1] Kurt M. Anstreicher. Volumetric path following algorithms for linear programming. Math. Program., 76:245–263, 1996. [2] 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, pages 81–90. ACM, 2013. [3] Samuel I Daitch and Daniel A Spielman. Faster approximate lossy generalized flow via interior point algorithms. In Proceedings of the 40th annual ACM symposium on Theory of computing, pages 451–460. ACM, 2008. [4] George B Dantzig. Maximization of a linear function of variables subject to linear inequalities. New York, 1951. [5] RobertM. Freund. Projective transformations for interior-point algorithms, and a superlinearly convergent algorithm for the w-center problem. Mathematical Programming, 58(1-3):385–414, 1993. 45 [6] Andrew V. Goldberg and Satish Rao. Beyond the flow decomposition barrier. J. ACM, 45(5):783–797, 1998. [7] Clovis C Gonzaga. Path-following methods for linear programming. SIAM review, 34(2):167– 224, 1992. [8] Narendra Karmarkar. A new polynomial-time algorithm for linear programming. In Proceedings of the sixteenth annual ACM symposium on Theory of computing, pages 302–311. ACM, 1984. [9] Jonathan A. Kelner, Lorenzo Orecchia, Aaron Sidford, and Zeyuan Allen Zhu. A Simple, Combinatorial Algorithm for Solving SDD Systems in Nearly-Linear Time. January 2013. [10] Leonid G Khachiyan. Polynomial algorithms in linear programming. USSR Computational Mathematics and Mathematical Physics, 20(1):53–72, 1980. [11] Leonid G Khachiyan. Rounding of polytopes in the real number model of computation. Math- ematics of Operations Research, 21(2):307–320, 1996. [12] LG Khachiyan, SP Tarasov, and II Erlikh. The method of inscribed ellipsoids. In Soviet Math. Dokl, volume 37, pages 226–230, 1988. [13] Adam R Klivans and Daniel Spielman. Randomness efficient identity testing of multivariate polynomials. In Proceedings of the thirty-third annual ACM symposium on Theory of computing, pages 216–223. ACM, 2001. [14] Ioannis Koutis, Gary L. Miller, and Richard Peng. A nearly-m log n time solver for sdd linear systems. In Foundations of Computer Science (FOCS), 2011 IEEE 52nd Annual Symposium on, pages 590 –598, oct. 2011. [15] Yin Tat Lee and Aaron Sidford. Efficient accelerated coordinate descent methods and faster In The 54th Annual Symposium on Foundations of algorithms for solving linear systems. Computer Science (FOCS), 2013. [16] Yin Tat Lee and Aaron Sidford. Path finding ii: An\ o (m sqrt (n)) algorithm for the minimum cost flow problem. arXiv preprint arXiv:1312.6713, 2013. [17] Mu Li, Gary L Miller, and Richard Peng. Iterative row sampling. 2012. [18] László Lovász and Santosh Vempala. Simulated annealing in convex bodies and an o*(n4) volume algorithm. J. Comput. Syst. Sci., 72(2):392–417, 2006. [19] Aleksander Madry. Navigating central path with electrical flows: from flows to matchings, and back. In Proceedings of the 54th Annual Symposium on Foundations of Computer Science, 2013. [20] Michael W. Mahoney. Randomized algorithms for matrices and data. Foundations and Trends in Machine Learning, 3(2):123–224, 2011. [21] Nimrod Megiddo. Pathways to the optimal set in linear programming. In Nimrod Megiddo, editor, Progress in Mathematical Programming, pages 131–158. Springer New York, 1989. 46 [22] Shinji Mizuno, Michael J Todd, and Yinyu Ye. On adaptive-step primal-dual interior-point algorithms for linear programming. Mathematics of Operations research, 18(4):964–981, 1993. [23] Murat Mut and Tamás Terlaky. A tight iteration-complexity upper bound for the mty predictor- corrector algorithm via redundant klee-minty cubes. 2013. [24] Jelani Nelson and Huy L Nguyên. Osnap: Faster numerical linear algebra algorithms via sparser subspace embeddings. arXiv preprint arXiv:1211.1002, 2012. [25] Yu Nesterov. Introductory Lectures on Convex Optimization: A Basic Course, volume I. 2003. [26] Yu. Nesterov. Rounding of convex sets and efficient gradient methods for linear programming problems. Optimization Methods Software, 23(1):109–128, February 2008. [27] Yu Nesterov. Efficiency of coordinate descent methods on huge-scale optimization problems. SIAM Journal on Optimization, 22(2):341–362, 2012. [28] Yu E Nesterov and Michael J Todd. Self-scaled barriers and interior-point methods for convex programming. Mathematics of Operations research, 22(1):1–42, 1997. [29] Yurii Nesterov and Arkadii Semenovich Nemirovskii. Interior-point polynomial algorithms in convex programming, volume 13. Society for Industrial and Applied Mathematics, 1994. [30] Christos H Papadimitriou and Kenneth Steiglitz. Combinatorial optimization: algorithms and complexity. Courier Dover Publications, 1998. [31] James Renegar. A polynomial-time algorithm, based on newton’s method, for linear program- ming. Mathematical Programming, 40(1-3):59–93, 1988. [32] Daniel A Spielman and Nikhil Srivastava. Graph sparsification by effective resistances. SIAM Journal on Computing, 40(6):1913–1926, 2011. [33] Daniel A Spielman and Shang-Hua Teng. Nearly-linear time algorithms for graph partitioning, graph sparsification, and solving linear systems. In Proceedings of the thirty-sixth annual ACM symposium on Theory of computing, pages 81–90. ACM, 2004. [34] Gilbert Strang. Inverse problems and derivatives of determinants. Archive for Rational Me- chanics and Analysis, 114(3):255–265, 1991. [35] Michael J Todd. Scaling, shifting and weighting in interior-point methods. Computational Optimization and Applications, 3(4):305–315, 1994. [36] Pravin M. Vaidya. A new algorithm for minimizing convex functions over convex sets (extended abstract). In FOCS, pages 338–343, 1989. [37] Pravin M Vaidya. Speeding-up linear programming using fast matrix multiplication. In Foun- dations of Computer Science, 1989., 30th Annual Symposium on, pages 332–337. IEEE, 1989. [38] Pravin M Vaidya. An algorithm for linear programming which requires o (((m+ n) n 2+(m+ n) 1.5 n) l) arithmetic operations. Mathematical Programming, 47(1-3):175–201, 1990. 47 [39] Pravin M. Vaidya. Reducing the parallel complexity of certain linear programming problems (extended abstract). In FOCS, pages 583–589, 1990. [40] Pravin M Vaidya. A new algorithm for minimizing convex functions over convex sets. Mathe- matical Programming, 73(3):291–341, 1996. [41] Pravin M Vaidya and David S Atkinson. A technique for bounding the number of iterations in path following algorithms. Complexity in Numerical Optimization, pages 462–489, 1993. [42] Virginia Vassilevska Williams. Multiplying matrices faster than coppersmith-winograd. In Proceedings of the forty-fourth annual ACM symposium on Theory of computing, pages 887– 898. ACM, 2012. [43] Yinyu Ye. Interior point algorithms: theory and analysis, volume 44. John Wiley & Sons, 2011. A Glossary Here we summarize problem specific notation we use throughout the paper. For many quantities we included the typical order of magnitude as they appear during our algorithms. • Linear program related: constraint matrix A ∈ Rm×n , cost vector (cid:126)c ∈ Rn, constraint vector (cid:126)b ∈ Rm, solution (cid:126)x ∈ Rn, weights of constraints (cid:126)w ∈ Rm where m is the number of constraints and n is the number of variables. • Bit complexity: L = log(m) + log(1 + dmax) + log(1 + max{(cid:13)(cid:13)(cid:126)c(cid:13)(cid:13)∞,(cid:13)(cid:13)(cid:126)b(cid:13)(cid:13)∞}) where dmax is the largest absolute value of the determinant of a square sub-matrix of A. G corresponds to (cid:126)g. i∈[m] wi log s((cid:126)x)i. • Slacks: (cid:126)s((cid:126)x) = A(cid:126)x − (cid:126)b. • Matrix version of variables: S is the diagonal matrix corresponds to (cid:126)s, W corresponds to (cid:126)w, • Newton step (4.2): (cid:126)ht((cid:126)x, (cid:126)w) = (∇2 (cid:126)x(cid:126)xft((cid:126)x, (cid:126)w))−1∇(cid:126)xft((cid:126)x, (cid:126)w) =(cid:0)AT S−1WS−1A(cid:1)−1(cid:0)t(cid:126)c − AT S−1 (cid:126)w(cid:1) . • Penalized objective function (4.1): ft((cid:126)x, (cid:126)w) = t · (cid:126)cT (cid:126)x −(cid:80) • Centrality (4.3): δt((cid:126)x, (cid:126)w) =(cid:13)(cid:13)(cid:126)ht((cid:126)x, (cid:126)w)(cid:13)(cid:13)∇2 (cid:13)(cid:13)PS−1A( (cid:126)w) ≈ 1. • Properties of weight function (Def 7): size c1((cid:126)g) = (cid:13)(cid:13)(cid:126)g((cid:126)s)(cid:13)(cid:13)1 ≈ rank (A), slack sensitivity (cid:1). cγ((cid:126)g) = sup(cid:126)s γ((cid:126)s, (cid:126)g((cid:126)s)) ≈ 1, step consistency cr((cid:126)g) ≈ log(cid:0) m • Slack Sensitivity(4.3): γ((cid:126)s, (cid:126)w) = maxi∈[m] 1 polylog(m) . (cid:126)x(cid:126)xft((cid:126)x, (cid:126)w) ≈ (cid:13)(cid:13)W−1/2(cid:126)1i rank A • Difference between (cid:126)g and (cid:126)w (4.16): (cid:126)Ψ((cid:126)s, (cid:126)w) = log((cid:126)g((cid:126)s)) − log( (cid:126)w). • Potential function for tracing 0 (Def 23): Φµ((cid:126)x) = eµx + e−µx ≈ poly(m). 48 • The weight function proposed (5.1): (cid:126)g((cid:126)s) = arg min >0 (cid:126)w∈Rm f ((cid:126)s, (cid:126)w) where where As = S−1A, α ≈ 1 − 1/ log2 B Technical Tools log det(AT s WαAs) − β (cid:88) i log wi f ((cid:126)s, (cid:126)w) = (cid:126)1T (cid:126)w − 1 α (cid:16) m rank(A) (cid:17) , β ≈ rank(A)/m. In this section, we provide and prove various mathematical facts that we use throughout the paper. B.1 Matrix Properties First, we prove various properties regarding projection matrices that we use throughout the paper. Lemma 32 (Projection Matrices). Let P ∈ Rn×n be an arbitrary projection matrix and let Σ = diag(P). For all i, j ∈ [n] and (cid:126)x ∈ Rn we have the following (1) Σii =(cid:80) j∈[n] P(2) ij , (2) 0 (cid:22) P(2) (cid:22) Σ (cid:22) I, ij ≤ ΣiiΣjj, i P(2)(cid:126)x ≤ Σii (3) P(2) (4) (cid:126)1T Proof. To prove (1), we simply note that by definition of a projection matrix P = PP and therefore (cid:13)(cid:13)(cid:126)x(cid:13)(cid:13)Σ. Σii = Pii = (cid:126)1T i P(cid:126)1i = (cid:126)1T i PP(cid:126)1i = P2 ij = P(2) ij (cid:88) j∈[n] (cid:88) j∈[n] To prove (2), we observe that since P is a projection matrix, all its eigenvectors are either 0 or 1. Therefore, Σ (cid:22) I and by (1) Σ − P(2) is diagonally dominant. Consequently, Σ − P(2) (cid:23) 0. Rearranging terms and using the well known fact that the shur product of two positive semi-definite matrices is positive semi-definite yields (2). To prove (3), we use P = PP, Cauchy-Schwarz, and (1) to derive (cid:88) k∈[n] Pij = PikPkj ≤ (cid:12)(cid:12)(cid:12)(cid:126)1T (cid:12)(cid:12)(cid:12) = (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:88) j∈[n] (cid:118)(cid:117)(cid:117)(cid:117)(cid:116) P2 ik k∈[n] (cid:88) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ ij (cid:126)xj k∈[n] (cid:88) (cid:118)(cid:117)(cid:117)(cid:117)(cid:116) (cid:88) j∈[n] 49  =(cid:112)ΣiiΣjj . P2 kj  · (cid:88) j∈[n] Squaring then yields (3). To prove (4), we note that by the definition of P(2) and Cauchy-Schwarz, we have i P(2)(cid:126)x P(2) Σjj(cid:126)x2 j P(4) ij Σjj (B.1) Now, by (1) and (3), we know that(cid:88) Since(cid:13)(cid:13)(cid:126)x(cid:13)(cid:13)Σ (cid:113)(cid:80) j∈[n] Σjj(cid:126)x2 P4 ij Σjj j∈[n] def= ≤ (cid:88) j∈[n] P2 ijΣiiΣjj Σjj = Σii (cid:88) j∈[n] j, combining (B.1) and (B.2) yields i P(2)(cid:126)x P2 ij = Σ2 ii (cid:12)(cid:12)(cid:12)(cid:126)1T (cid:12)(cid:12)(cid:12) ≤ Σii (B.2) (cid:13)(cid:13)(cid:126)x(cid:13)(cid:13)Σ as desired. B.2 Taylor Expansions and Multiplicative Approximations Throughout this paper we use log((cid:126)a) − log((cid:126)b) as a convenient way of working with B−1((cid:126)a − (cid:126)b) or A−1((cid:126)b − (cid:126)a). In this section we make this connection rigorous by providing several helper lemmas used throughout the paper. Lemma 33 (Log Notation). Suppose(cid:13)(cid:13) log((cid:126)a) − log((cid:126)b)(cid:13)(cid:13)∞ =  ≤ 1/2 then (cid:13)(cid:13)B−1((cid:126)a − (cid:126)b)(cid:13)(cid:13)∞ ≤  + 2. If(cid:13)(cid:13)B−1((cid:126)a − (cid:126)b)(cid:13)(cid:13)∞ =  ≤ 1/2, then(cid:13)(cid:13) log((cid:126)a) − log((cid:126)b)(cid:13)(cid:13)∞ ≤  + 2. Proof. Using the Taylor expansion of ex and log(1 + x), we get the following two inequalities which prove the claim 1 + x ≤ ex ≤ 1 + x + x2 for x ≤ 1 2 x − x2 ≤ log(1 + x) ≤ x for x ≤ 1 2 . , B.3 Matrix Calculus Here, we derive various matrix calculus formulas used in Section 5. These are now somewhat standard and also discussed in [40, 1] but we derive them here for completeness. In this section, we define RA( (cid:126)w)ij def= (cid:126)aT i (AT WA)−1(cid:126)aj. We start by computing the derivative of the volumetric barrier function, f ( (cid:126)w) def= log det(AT WA). Lemma 34 (Derivative of Volumetric Barrier). For A ∈ Rn×m, let f : Rm >0 → R be given by f ( (cid:126)w) def= log det(AT WA). Then the following holds ∀ (cid:126)w ∈ Rm >0 : ∇f ( (cid:126)w) = diag(RA( (cid:126)w)) def= ΣA( (cid:126)w)W−1(cid:126)1. 50 (cid:104) Proof. For all i ∈ [m] and (cid:126)w ∈ Rm, we know that 1 α ∂ ∂ (cid:126)wi Applying the matrix determinant lemma then yields that f ( (cid:126)w + α(cid:126)1i) − f ( (cid:126)w) f ( (cid:126)w) = lim α→0 = lim α→0 1 α (cid:105) (cid:2)log(cid:0)det(AT WA) · (1 + α(cid:126)aT i ) − log det(AT WA)(cid:3) . (cid:2)log det(AT WA + α(cid:126)ai(cid:126)aT i (AT WA)−1(cid:126)ai)(cid:1) − log(cid:0)det(AT WA)(cid:1)(cid:3) . f ( (cid:126)w) = lim α→0 1 α ∂ ∂ (cid:126)wi Therefore, ∂ ∂ (cid:126)wi f ( (cid:126)w) = lim α→0 log(1 + αR( (cid:126)w)ii) α = R( (cid:126)w)ii. Next we bound the rate of change of entries of the resistance matrix. Lemma 35 (Derivative of Effective Resistance). For all A ∈ Rm×n, (cid:126)w ∈ Rm have >0, and i, j, k ∈ [m] we ∂ ∂ (cid:126)wk [RA( (cid:126)w)]ij = −RA( (cid:126)w)ikRA( (cid:126)w)kj where diag(RA( (cid:126)w)) def= ΣA( (cid:126)w)W−1(cid:126)1. Proof. By definition, we have that ∂ ∂ (cid:126)wk RA( (cid:126)w)ij = lim α→0 (cid:105) R( (cid:126)w + α(cid:126)1k)ij − R( (cid:126)w)ij (cid:104) 1 α and R( (cid:126)w + α(cid:126)1k)ij = (cid:126)1T i A(AT WA + αAT (cid:126)1k(cid:126)1T k A)−1AT (cid:126)1j . Furthermore, by applying the Sherman-Morrison formula, we know that (AT WA + αAT (cid:126)1k(cid:126)1T k A)−1 = (AT WA)+ − α(AT WA)−1AT (cid:126)1k(cid:126)1T k A(AT WA)−1 1 + α(cid:126)1T k A(AT WA)−1AT (cid:126)1k (B.3) (B.4) . (B.5) Combining (B.3), (B.4), and (B.5) yields the result. Finally, we use this to derive the Jacobian of leverage scores. Lemma 36 (Derivative of Leverage Scores). For all A ∈ Rm×n, (cid:126)w ∈ Rm >0 we have the following J (cid:126)w((cid:126)σA( (cid:126)w)) = ΛA( (cid:126)w)W−1. Proof. Since by definition (cid:126)σA( (cid:126)w)i = (cid:126)wiRA( (cid:126)w)ii by the previous lemma, we have that ∂ ∂ (cid:126)wj (cid:126)σA( (cid:126)w)i = (cid:126)1i=jR( (cid:126)w)ii − (cid:126)wiR( (cid:126)w)(2) ij . Writing this in matrix form and recalling the definition of the Jacobian then yields J (cid:126)w((cid:126)σA( (cid:126)w)) = diag(RA( (cid:126)w)) − WRA( (cid:126)w)(2). Right multiplying by I = WW−1 and recalling the definition of ΛA then yields the result. 51 C Projecting Onto Ball Intersect Box In the algorithm centeringInexact, we need to compute (cid:104)(cid:126)a, (cid:126)u(cid:105) arg min (cid:126)u∈U we show how this can be computed in nearly linear time and in particular it can be computed in where U = {(cid:126)x ∈ Rm (cid:13)(cid:13)(cid:126)x(cid:13)(cid:13)W ≤ b and(cid:13)(cid:13)(cid:126)x(cid:13)(cid:13)∞ ≤ c} for some (cid:126)w ≥ (cid:126)0, i.e. we need to project (cid:126)a onto the intersection of the ball, (cid:8)(cid:126)x ∈ Rm (cid:13)(cid:13)(cid:126)x(cid:13)(cid:13)W ≤ b(cid:9), and the box (cid:8)(cid:126)x ∈ Rm (cid:13)(cid:13)(cid:126)x(cid:13)(cid:13)∞ ≤ c(cid:9). In this section parallel in depth (cid:101)O(1) and work (cid:101)O(m). (cid:13)(cid:13)2 (cid:13)(cid:13)(cid:126)x Note that by rescaling we can rewrite (C.1) as arg max ≤1,−li≤xi≤li (cid:104)(cid:126)a, (cid:126)x(cid:105) (C.2) (C.1) for some li. Let us consider a simple algorithm which first ignore the box constraint and find the best vector (cid:126)a. If (cid:126)a does not violate any box constraint, then it is the solution. Otherwise, we pick a most violated constraint i, i.e. the coordinate with highest ai /li. Then, we threshold this coordinates and repeat the procedure on the remaining coordinate. (cid:126)x = projectOntoBallBox((cid:126)a) 1. Set (cid:126)a = (cid:126)a/(cid:13)(cid:13)(cid:126)a(cid:13)(cid:13)2. 2. Sort the coordinate such that ai /li is in descending order. sign ((cid:126)aj) lj 3. For i = 0,··· , m (cid:114) 1−(cid:80)i 1−(cid:80)i if j ∈ {1, 2,··· , i} otherwise 3b. If (cid:126)x is a feasible solution, output (cid:126)x. 3a. Set (cid:126)x = k=0 l2 k k=0 a2 k (cid:126)aj . Lemma 37. The algorithm projectOntoBallBox outputs a solution of the problem (C.2). Proof. We claim that for all k ≤ i where i is the last step in the algorithm, we have where Ω = {x : (cid:13)(cid:13)(cid:126)x(cid:13)(cid:13)2 ≤ 1,−li ≤ xi ≤ li} and Ωk = Ω ∩ {x : (cid:104)(cid:126)a, (cid:126)x(cid:105) = max (cid:126)x∈Ωk (cid:104)(cid:126)a, (cid:126)x(cid:105) max (cid:126)x∈Ω (cid:126)x is feasible at the last step, we have xi = li for i ∈ {1, 2,··· , k}}. Since (cid:126)xlast = arg max (cid:126)x∈Ωk = arg max (cid:126)x∈Ω (cid:104)(cid:126)a, (cid:126)x(cid:105) (cid:104)(cid:126)a, (cid:126)x(cid:105) . Therefore, the correctness of the algorithm follows from the claim. Now, we prove the claim by induction. The base case is trivial because Ω = Ω0. Now proceed by contradiction and suppose that (cid:104)(cid:126)a, (cid:126)x(cid:105) > max (cid:126)x∈Ωk+1 max (cid:126)x∈Ωk (cid:104)(cid:126)a, (cid:126)x(cid:105) . 52 (C.3) (cid:104)(cid:126)a, (cid:126)x(cid:105). If for all j > k, we have yj < lj. Then, the (cid:126)x found in the (k + 1)th Let (cid:126)y = arg max(cid:126)x∈Ωk iteration is exactly (cid:126)y and it is feasible and hence the algorithm outputs (cid:126)y. Otherwise, there is j such that yj = lj. Since (cid:126)y /∈ Ωk+1, we have yk+1 < lk+1 and hence j > k + 1. Consider (cid:126)z(t) = (cid:126)y + sign (yk+1) t yk+1 +  where  is a very small positive number. Note that d dt (cid:13)(cid:13)(cid:126)z(t)(cid:13)(cid:13)2 ≤ 1 for t > 0 but close to 0. Also, we have (cid:126)1j (cid:126)1k+1 − sign (yj) t lj (cid:13)(cid:13)(cid:126)z(t)(cid:13)(cid:13)2(cid:12)(cid:12)(cid:12)t=0 = 2 yk+1 yk+1+ − 2 < 0 and hence d dt Take  = lk+1 − yk+1, then we have d dt (cid:104)(cid:126)a, (cid:126)z(cid:105) = ak+1 yk+1 +  − aj lj . (cid:104)(cid:126)a, (cid:126)z(cid:105) = ak+1 lk+1 − aj lj > 0 because j > k + 1 and ai /li is in descending order. Therefore, (cid:126)z(t) is a feasible and better solution for small positive t. Hence, it proves (cid:126)y is not the optimal solution of max(cid:126)x∈Ωk (cid:104)(cid:126)a, (cid:126)x(cid:105) that contradicts to the definition of (cid:126)y. Hence, max(cid:126)x∈Ω (cid:104)(cid:126)a, (cid:126)x(cid:105) = max(cid:126)x∈Ωk (cid:104)(cid:126)a, (cid:126)x(cid:105) and the algorithm outputs an optimal solution. (cid:126)x = projectOntoBallBoxParallel((cid:126)a) 1. Set (cid:126)a = (cid:126)a/(cid:13)(cid:13)(cid:126)a(cid:13)(cid:13)2. k and(cid:80)i 3. Precompute(cid:80)i 2. Sort the coordinate such that ai /li is in descending order. 4. Find the first i such that 1−(cid:80)i 1−(cid:80)i sign ((cid:126)aj) lj (cid:114) 1−(cid:80)i 1−(cid:80)i k=0 a2 k=0 l2 k k=0 a2 if j ∈ {1, 2,··· , i} k otherwise k for all i. . 5. Output (cid:126)x = k=0 l2 (cid:126)aj ≤ l2 i+1 a2 i+1 . k=0 l2 k k=0 a2 k The algorithm projectOntoBallBoxParallel is a parallel and more efficient version projectOntoBallBox. All other operations in our algorithm are standard linear algebra and hence the following theorem shows that our linear programming solver is indeed parallelizable. Lemma 38. The algorithm projectOntoBallBoxParallel outputs an solution of the optimization problem (C.2) in depth O(1) and work O(m). Proof. Note that in the algorithm projectOntoBallBox, the value is increasing through the algorithm. To see this, note that in step 3b, if (cid:126)x is not feasible, that means there is j such that k=0 l2 k k=0 a2 k 1 −(cid:80)i 1 −(cid:80)i 1 −(cid:80)i 1 −(cid:80)i 53 k=0 l2 k k=0 a2 k > l2 j a2 j . Since ai/li is in descending order, j = i + 1. Therefore, we have k=0 l2 k k=0 a2 k 1 −(cid:80)i 1 −(cid:80)i 1 −(cid:80)i+1 1 −(cid:80)i+1 k=0 l2 k k=0 a2 k l2 i+1 a2 i+1 . > 1 −(cid:80)i 1 −(cid:80)i k=0 l2 k k=0 a2 k . > Hence, we have Using this fact, it is easy to see the algorithm projectOntoBallBoxParallel and the algorithm projectOntoBallBox outputs the same vector. Obviously, all steps can be computed in depth O(1) and work O(m). D Inexact Linear Algebra Throughout much of our analysis of weighted path following we assumed that linear systems in A could be solved exactly. In this section we relax this assumption and discuss the effect of using inexact linear algebra in our linear programming algorithms. We show that rather than computing(cid:0)AT DA(cid:1)−1 (cid:126)x precisely for positive diagonal matrix D it suffices to solve these systems approximately. Throughout this section we assume that for any matrix A ∈ Rn×m and vector (cid:126)b ∈ Rm there is an algorithm solve(A,(cid:126)b) which outputs an vector (cid:126)x such that (D.1) Since A is full rank, we can write (cid:126)c = AT (cid:126)d for some (cid:126)d. From equation (4.2), the Newton step is (cid:13)(cid:13)(cid:126)x − A+(cid:126)b(cid:13)(cid:13)AT A ≤ (cid:13)(cid:13)A+(cid:126)b(cid:13)(cid:13)AT A. (cid:32) √ (cid:33) √ (cid:126)w − (cid:126)s(cid:126)d√ (cid:126)w t (cid:126)ht((cid:126)x, (cid:126)w) = (AT S−1WS−1A)−1AT S−1 √ (cid:126)w WS−1A (cid:16)√ (cid:32) = t (cid:17)+ (cid:33) . W − (cid:126)s(cid:126)d√ (cid:126)w (cid:33) (cid:13)(cid:13)(cid:13)(cid:13)(cid:13)AT S−1WS−1A (cid:32)√ (cid:13)(cid:13)(cid:13)(cid:13)(cid:13)solve WS−1A, t √ (cid:126)w − (cid:126)s(cid:126)d√ (cid:126)w − (cid:126)ht Suppose that we compute (cid:126)ht by the algorithm solve above, then we have ≤ (cid:13)(cid:13)(cid:126)ht (cid:13)(cid:13)AT S−1WS−1A = δt ((cid:126)x, (cid:126)w) . Hence, the outcome of solve differs from the Newton step (cid:126)ht by a relative small amount in (cid:107)·(cid:107)AT S−1WS−1A. Hence, it suffices to prove that δt is stable under this small amount in (cid:107)·(cid:107)AT S−1WS−1A and hence is the algorithm solve will only increase δ by a little compared with using exact linear algebra. (cid:13)(cid:13)(cid:13)(cid:126)∆ (cid:13)(cid:13)(cid:13)AT S−1WS−1A ≤ 1 8γ . Then, we have Lemma 39. Let γ def= γ((cid:126)x, (cid:126)w) and (cid:126)x(new) = (cid:126)x + (cid:126)∆. Let η = (cid:16) (cid:17) ≤ (1 − γη) δt (cid:126)x(new), (cid:126)w −1 (δt ((cid:126)x, (cid:126)w) + η) . 54 Proof. By the same proof in Lemma 5, we have that (cid:16) Therefore, we have δt (cid:126)x(new), (cid:126)w = (cid:17) (new)A (new) (cid:126)w AT S−1 (new)WS−1 (new) (cid:126)w ≤ (1 + γη) (cid:13)(cid:13)S−1((cid:126)s(new) − (cid:126)s)(cid:13)(cid:13)∞ ≤ γη. (cid:13)(cid:13)(cid:13)t(cid:126)c − AT S−1 (cid:13)(cid:13)(cid:13)(cid:16) (cid:17)−1 (cid:13)(cid:13)(cid:13)t(cid:126)c − AT S−1 (cid:13)(cid:13)(cid:13)(cid:16) (cid:13)(cid:13)(cid:13)(cid:13)AT ≤ (1 + γη)(cid:13)(cid:13)t(cid:126)c − AT S−1 (cid:126)w(cid:13)(cid:13)(AT S−1WS−1A) (cid:13)(cid:13)(cid:13)(cid:13)(cid:13)W (cid:13)(cid:13)(cid:13)(cid:13)(cid:13)(cid:126)s(new) − (cid:126)s (cid:13)(cid:13)(cid:13)(cid:13)(cid:13)(cid:126)s(new) − (cid:126)s (cid:13)(cid:13)(cid:13)(cid:13)(cid:13)W (cid:13)(cid:13)S−1((cid:126)s(new) − (cid:126)s)(cid:13)(cid:13)W ≤ η. ≤ (1 + γη) δt ((cid:126)x, (cid:126)w) + (1 − γη)−1 = (1 + γη) δt ((cid:126)x, (cid:126)w) + (new)WS−1 (cid:17)−1 AT S−1 (cid:126)s(new) (cid:126)s (new)A −1 + . By the same proof in Lemma 5, we have that Thus, we have the result. (cid:18) (cid:126)w (cid:126)s (cid:19)(cid:13)(cid:13)(cid:13)(cid:13)(AT S−1WS−1A) −1 − (cid:126)w (cid:126)s(new) Therefore, as long as we choose  small enough, the algorithm solve gives an accurate enough (cid:126)x(new) for the centering step. Similarly, it is easy to see that it also gives accurate enough (cid:126)w(new) because the error of (cid:126)w(new) due to solve is small in(cid:13)(cid:13) ·(cid:13)(cid:13)W norm and the tracing 0 game can afford for this error. At last, we need to check solve gives us a way to compute weight function. Since the weight function computation relies on the function computeLeverageScores, we only need to know if we can compute (cid:126)l in the computeLeverageScores with high enough accuracy. Now, we use the notation is the computeLeverageScores. Without loss of generality, we can assume X = I. Let (cid:126)l(apx) and (cid:126)p(apx) be the approximate (cid:126)l and (cid:126)p computed by the algorithm Solve. Then, we have (cid:13)(cid:13)(cid:13)(cid:13)(cid:16)(cid:126)l(j)(cid:17)(apx) − (AT A)+AT (cid:126)q(j) (cid:13)(cid:13)(cid:13)(cid:13)AT A Hence, for any i, j, we have(cid:13)(cid:13)(cid:13)(cid:13)(cid:126)p(j) i −(cid:16) (cid:126)p(apx) i (cid:17)(j)(cid:13)(cid:13)(cid:13)(cid:13)∞ ≤ = (cid:13)(cid:13)(cid:13)(cid:13)AT A = −1 (cid:13)(cid:13)(cid:13)(cid:13)(cid:16)(cid:126)l(j)(cid:17)(apx) − A+(cid:126)q(j) ≤ (cid:13)(cid:13)A+(cid:126)q(j)(cid:13)(cid:13)AT A = (cid:13)(cid:13)AT (cid:126)q(j)(cid:13)(cid:13)(AT A) (cid:114) n ≤ (cid:13)(cid:13)(cid:126)q(j)(cid:13)(cid:13)2 ≤  (cid:126)p(apx)(cid:17)(j)(cid:13)(cid:13)(cid:13)(cid:13)2 (cid:13)(cid:13)(cid:13)(cid:13)(cid:126)p(j) −(cid:16) (cid:13)(cid:13)(cid:13)(cid:13)A (cid:18)(cid:16)(cid:126)l(j)(cid:17)(apx) − (cid:126)l(j) (cid:114) n (cid:19)(cid:13)(cid:13)(cid:13)(cid:13)2 k . ≤  . k 55 Therefore, we have(cid:118)(cid:117)(cid:117)(cid:116) k(cid:88) Therefore, if  ≤(cid:113) j=1 (cid:16) (cid:126)p(j) i (cid:17)2 − (cid:118)(cid:117)(cid:117)(cid:116) k(cid:88) j=1 (cid:18)(cid:16) (cid:126)p(apx) i (cid:17)(j)(cid:19)2 ≤ (cid:118)(cid:117)(cid:117)(cid:116) k(cid:88) √ ≤  j=1 nk. (cid:18) i −(cid:16) (cid:126)p(j) (cid:126)p(apx) i (cid:17)(j)(cid:19)2 1 mpolylog(m), the error is small enough for computeLeverageScores. E Bit Complexity and Linear Program Reductions In this section, we show how to reduce solving an arbitrary linear program to finding a low cost solution in a bounded linear program for which we have an explicit interior point. Throughout this section letA ∈ Rm×n, (cid:126)b ∈ Rm, (cid:126)c ∈ Rn, and consider the following general linear program min (cid:126)x∈Rn : A(cid:126)x≥(cid:126)b (cid:126)cT (cid:126)x (E.1) We assume that the entries of A, (cid:126)b, and (cid:126)c are integers and we let OP T denote the optimal value of (E.1) and we let L denote the bit complexity of (E.1) where L def= log(m) + log(1 + dmax(A)) + log(1 + max{(cid:13)(cid:13)(cid:126)c(cid:13)(cid:13)∞,(cid:13)(cid:13)(cid:126)b(cid:13)(cid:13)∞}) and dmax(A) denotes the largest absolute value of the determinant of a square sub-matrix of A. Our goal is to efficiently transform (E.1) to a linear program of the same form (cid:126)x∈Rn(cid:48) min : A(cid:48)(cid:126)x≥(cid:126)b(cid:48) (cid:126)c(cid:48)T (cid:126)x (E.2) where A(cid:48) ∈ Rm(cid:48)×n(cid:48) , (cid:126)b(cid:48) ∈ Rm(cid:48), and (cid:126)c(cid:48) ∈ Rn(cid:48) are integer, and nnz(A(cid:48)), n(cid:48), m(cid:48), and the bit complexity of (E.2) denoted, L(cid:48), are comparable to nnz(A), n, m, and L. Furthermore, we require that (E.2) is bounded, has an explicit efficiently computable interior point, and that we can convert any low cost feasible solution to a solution of (E.1) in linear time. While there are standard tools to perform reductions to ensure that (E.1) is bounded and has an explicit initial feasible point or to ensure that the optimal integral solution can be easily computed explicitly, we need to particularly careful when using these reductions to ensure that nnz(A), n, and m are not increased significantly. As the running times of our path following techniques in Section (7) depend crucially on these parameters in this section we prove the following Lemma claiming that such an efficient reduction is possible. , (cid:126)b(cid:48) ∈ Rm(cid:48), (cid:126)c(cid:48) ∈ Rn(cid:48), Lemma 40. In O(nnz(A) + n + m) time we can compute integer A(cid:48) ∈ Rm(cid:48)×n(cid:48) (cid:126)x(cid:48) ∈ Rm(cid:48). Such that nnz(A(cid:48)) = O(nnz(A) + n + m), n(cid:48) = O(n), m(cid:48) = O(m), A(cid:48)(cid:126)x(cid:48) ≥ (cid:126)b(cid:48), and (E.2) is bounded and has bit complexity at most 12L1 + 7 log(20n). Furthermore, if we can find a feasible point in (E.2) such that the cost of that point is at most the OP T + 2−12(L+log(20n)) where OP T is the value of (E.2) then we can either 1. Find the active constraints of a basic feasible optimal solution (E.1) using only one matrix vector multiplication by A; or 56 2. Prove that (E.1) is infeasible or unbounded. We break this proof into two parts. First in Lemma 41 we show how to transform (E.1) so that the linear program is bounded and has an explicit feasible point. Then in Lemma 43 we follow the approach of [3] and show that we can perturb the cost of a linear program to make the optimal solution unique and thereby make it easy to compute an exact integral solution. Lemma 41. Consider the following modified linear program min (cid:126)cT (cid:126)x + n23L+4z such that A(cid:126)x + z(cid:126)1 ≥ (cid:126)b, 2L+1 ≥ z ≥ 0, 2L+1(cid:126)1 ≥ (cid:126)x ≥ −2L+1(cid:126)1 (E.3) where A, (cid:126)b, and (cid:126)c are as in (E.1) and L is the bit complexity of (E.1). (E.3) is bounded with an explicit interior point (cid:126)x = 0, z = 2L + 1. Furthermore, (E.1) is bounded and feasible with an optimal solution (cid:126)x if and only if ((cid:126)x, 0) is an optimal solution of (E.3) with 2L ≥ xi ≥ −2L, (E.1) is unbounded if and only if there is a basic feasible solution, ((cid:126)x, z), of (E.3) with xi > 2L for some i, and (E.1) is infeasible if and only if there is basic feasible solution, ((cid:126)x, z), of (E.3) with (cid:126)z (cid:54)= 0. Furthermore, (E.3) can be written in the form (E.2) such that all these properties hold with nnz(A(cid:48)) = O(nnz(A) + n + m), n(cid:48) = O(n), m(cid:48) = O(m), and L(cid:48) ≤ 4L + 2 log(16n). Proof. Case 1: Suppose (E.1) is bounded and feasible. It is known that any basic feasible solution of (E.1) is a vector of rational numbers with both absolute value of numerator and denominator are bounded by 2L [30]. Therefore, −n22L ≤ OP T ≤ n22L. Given any feasible solution (cid:126)x of (E.1), the point ((cid:126)x, z = 0) is a feasible solution of (E.3) with same cost value. Hence, the linear program (E.3) is feasible and the optimal value of (E.3) is at most n22L. On the other hand, clearly (E.3) is feasible because (cid:126)x = (cid:126)0, z = 2L + 1 is an interior point. Furthermore, (E.3) is bounded and therefore has some optimal value. Consider any optimal basic feasible solution ((cid:126)x, z) of (E.3), we have (cid:126)cT (cid:126)x is between −n22L+1 and n22L+1. Also, z is a rational number with the absolute value of denominator are bounded by 2L using Cramer’s rule. Therefore, we have z ≥ 2−L1 or z = 0. If z ≥ 2−L, then the total cost is at least n23L+42−L − n22L+1 > n22L. However, as we argued above, the optimal value of (E.3) is at most n22L. Therefore, optimal solution has z = 0 and 2L ≥ xi ≥ −2L for all i. Case 2: Suppose (E.1) is not feasible. In this case, any feasible point ((cid:126)x, z) in (E.3) has z (cid:54)= 0 and by the reasoning in the previous section any basic feasible solution has cost greater than n22L. Case 3: Suppose (E.1) is not bounded. Let OPTk = min (cid:126)cT (cid:126)x such that A(cid:126)x ≥ (cid:126)b, k + 2L ≥ xi ≥ −2L−k. Thus, we have OPT1 < OPT0 and any optimal point of the case k = 1 has some coordinate larger than 2L or smaller −2L. By similar argument as above, we have that the optimal point of (E.3) is of the form ((cid:126)x, 0) and some coordinate of (cid:126)x is larger than 2L or smaller −2L. To compute the bit complexity of (E.3) note that we can write (E.3) in the form of (E.2) by where I ∈ Rm×m and(cid:126)0 ∈ Rm (E.4) choosing A(cid:48) =  A (cid:126)1 (cid:126)0 I −I (cid:126)0 (cid:126)0T 1 (cid:126)0T −1  , (cid:126)b(cid:48) =  (cid:126)b −2L1+1 2L1+1 0 2L1+1 (cid:126)c (cid:19) (cid:18)  , (cid:126)c(cid:48) = (cid:0)(cid:2) A (cid:126)1 (cid:3)(cid:1) ≤ n · dmax (A) . n23L+4 Thus n(cid:48) = n + 1, m(cid:48) = 3m + 2, and it is easy to see that dmax(A(cid:48)) = dmax 57 Therefore, the bit complexity of (E.3) is at most log(1 + ndmax(A)) + log(1 + n23L+4) ≤ 4L + 2 log(16n) as desired. Following the approach in [3] to use the following isolation lemma, we show that it is possible to transform the linear program into one with unique optimal solution by randomly perturbing the cost function. Lemma 42 ([13]). Given any collection of linear functions on n variables c1, c2,··· , cn with coeffi- cients in the range {−K,−K − 1,··· , K − 1, K}. If c1,··· , cn are independently chosen uniformly at random in {−2Kn,··· , 2Kn}. Then, with probability greater than 1 2, there is a unique linear function of minimum value at c1, c2,··· , cn. Note that for we can think every vertex (cid:126)x is a linear function (cid:126)cT (cid:126)x on the cost variables (cid:126)c. Although there are exponentially many vertices, the above lemma shows that the minimizer is attained at a unique vertex (linear function). Lemma 43. Suppose that (E.1) is feasible and bounded and consider the following modified linear program min(cid:0)22L+3n(cid:126)c + (cid:126)r(cid:1)T (cid:126)x given A(cid:126)x ≥ (cid:126)b. (E.5) where each coordinate in (cid:126)r ∈ Rm is chosen uniformly at random from the integers {−2L+1n,··· , 2L+1n}. Let OP T ’ denote the optimal value of the linear program (E.5). Given any feasible solution for the linear program (E.5) with cost less than OP T + n−12−3L−2, we can find the active constraints of a basic feasible optimal solution of (E.1) by using only one matrix vector multiplication with A. Furthermore, the bit complexity of (E.5) is at most 3L + log(8n). Proof. Since the set of basic solutions to (E.5) and (E.1) are the same, we know that any basic feasible solution of (E.5) is a vector of rational numbers with absolute value of numerator and denominator both bounded by 2L. Consequently our perturbation of the cost function maintains that an optimum solution to (E.5) is an optimal solution to (E.1). Hence, the Isolation Lemma shows that with probability greater than 1 Now consider the polytope Pt = {(cid:126)x such that A(cid:126)x ≥ (cid:126)b and (cid:0)22L+3n(cid:126)c + (cid:126)r(cid:1)T (cid:126)x ≤ OP T +t2−2L−1} (cid:126)x is in the polytope of {A(cid:126)x ≥ (cid:126)b} and hence (cid:13)(cid:13)(cid:126)x(cid:13)(cid:13)∞ ≤ 2L. Therefore, for any (cid:126)x ∈ Pt, we have (cid:13)(cid:13)(cid:126)x − (cid:126)x∗(cid:13)(cid:13)∞ ≤ t · 2L+1 for any t ≤ 1. Therefore, for any (cid:126)x ∈ Pt, (cid:13)(cid:13)A(cid:126)x − A(cid:126)x∗(cid:13)(cid:13)∞ ≤ nt22L+1. Since for t > 0. Since (E.5) has a unique solution, by a similar argument as before, P1 contains only one basic feasible solution of (E.5) and hence Pt − (cid:126)x∗ = t (P1 − (cid:126)x∗) for any t ≤ 1. Also, for any (cid:126)x ∈ P1, 2, the linear program (E.5) has a unique solution (cid:126)x∗. A(cid:126)x∗ is a vector of rational numbers with the absolute value of denominator are bounded by 2L, we can distinguish if a constraint is satisfied or not when nt22L+1 < 2−L−1. Combining Lemma 41 and Lemma 43 proves Lemma 40. F Numerical Linear Algebra for Acceleration Here we prove Theorem 30 needed for the accelerated linear program solver. Below we restate the theorem for convenience. 58 Theorem 44. Let (cid:126)d(i) ∈ Rm that d(i) j given the (cid:126)d(i) in a sequence, in each iteration i we can compute (cid:0)AT DiA(cid:1)−1 (cid:126)xi for Di = diag((cid:126)di) >0 be a sequence of r positive vectors. Suppose that the number of times for any i ∈ [r] and j ∈ [m] is bounded by Cr2 for some C ≥ 1. Then if we are (cid:54)= d(i+1) j and arbitrary (cid:126)xi ∈ Rn with the average cost per iteration (cid:18) mnω−1 r (cid:101)O (cid:19) + n2 + Cωr2ω + Cω−1nrω where ω < 2.3729 [42] is the matrix multiplication constant. Proof. For all i ∈ [r] let Bi = AT DiA. Since D1 ∈ Rm×m is diagonal and A ∈ Rn×m we can compute D1A trivially in O(mn) time. Furthermore from this we can compute B1 = AT D1A in O(mnω−1) time using fast matrix multiplication by splitting A into m n blocks of size n and using that m > n. Furthermore, using fast matrix multiplication we can then compute B−1 in O(nω) time and similarly we can compute B−1 1 AT in O(mnω−1) time. Now, we show how to use this computation of B−1 1 AT in O(mnω−1) time to decrease the running time of future iterations. 1 and B−1 For all k > 1, let Dk = D1 + ∆k for some diagonal ∆k ∈ Rm×m and let rk def= nnz(∆k). Let Pk ∈ Rrk×n be the 1 − 0 matrix that selects the rows of A for which the diagonal entry in ∆k is nonzero, let Sk ∈ Rrk×rk be the diagonal matrix whose diagonal entries are the non-zero diagonal entries of ∆k and Ak 1 def= PkA. k SkPk and hence by the Woodbury matrix identity, we have B−1 Note that ∆k = PT = B−1 Assume we have computed AkB−1 compute(cid:0)S−1 1 AT k (F.1) k ∈ Rrk×rk explicitly, we can use fast matrix multiplication to i (cid:126)xi in just k ). Then, we can use (F.1) to compute B−1 1 AkB−1 1 AT k k + AkB−1 1 − B−1 k AT k SkPkA(cid:1)−1 i =(cid:0)AT D1A + AT PT (cid:0)S−1 (cid:1)−1 in time O(rω (cid:16)(cid:0)S−1 (cid:1) + nnz(Ak) + nnz k + AkB−1 (cid:18) mnω−1 (cid:19) i (cid:126)xi is k AT k 1 (cid:18) mnω−1 + n2 + nrk + rω k = (cid:101)O r (cid:101)O (cid:1)−1 (cid:1)−1(cid:17)(cid:17) O 1 AT k time. Consequently, not counting the time to compute AkB−1 average cost of computing B−1 = O(nrk + n2) k AT k ∈ Rrk×rk, we have that the (cid:16) k + AkB−1 nnz(cid:0)B−1 (cid:19) + n2 + Cωr2ω r (F.2) because rk ≤ Cr2 and nrk ≤ 2n2 + 2r2 k. All that remains is to estimate the cost of computing AkB−1 order the rows of A such that AT this, to compute AkB−1 k AT k we see that it suffices to compute k = [AT k−1 RT (cid:18) AkB−1 UkB−1 k AkB−1 1 AT 1 Ak UkB−1 1 UT k 1 UT k (cid:19) k . For notational simplicity, we k ] where Rk ∈ Ruk×n where uk = rk − rk−1. From k AT Now, since we precomputed B−1 compute B−1 k by extracting columns from B−1 1 AT and U is just a subset of the rows of A, we see that we can 1 AT . Thus, we see that the time to compute 1 UT 59 k Ak is dominated by the time to multiply a matrix of size at most rk × n and n × uk. We matrices of size uk × uk which can be done in O(rknuω−2 · n ) k k B−1 AT can do this by multiplying O time. Thus the average cost of computing AT (cid:17) (cid:16) rk (cid:19) ·(cid:0)rknuω−2 where we used the fact that since (cid:80)  (cid:88) (cid:18) 1 1≤k<r O uk uk r achieve when each uk = Cr. k B−1 k Ak is (cid:1) ≤ O(Crn · r · (Cr)ω−2) = O(Cω−1nrω) k uk = rk, rk ≤ Cr2 and the minimum value of (cid:80) k k uω−2 k is 60
1703.07964
1
1703
2017-03-23T08:37:54
Minimum Cuts and Shortest Cycles in Directed Planar Graphs via Noncrossing Shortest Paths
[ "cs.DS" ]
Let $G$ be an $n$-node simple directed planar graph with nonnegative edge weights. We study the fundamental problems of computing (1) a global cut of $G$ with minimum weight and (2) a~cycle of $G$ with minimum weight. The best previously known algorithm for the former problem, running in $O(n\log^3 n)$ time, can be obtained from the algorithm of \Lacki, Nussbaum, Sankowski, and Wulff-Nilsen for single-source all-sinks maximum flows. The best previously known result for the latter problem is the $O(n\log^3 n)$-time algorithm of Wulff-Nilsen. By exploiting duality between the two problems in planar graphs, we solve both problems in $O(n\log n\log\log n)$ time via a divide-and-conquer algorithm that finds a shortest non-degenerate cycle. The kernel of our result is an $O(n\log\log n)$-time algorithm for computing noncrossing shortest paths among nodes well ordered on a common face of a directed plane graph, which is extended from the algorithm of Italiano, Nussbaum, Sankowski, and Wulff-Nilsen for an undirected plane graph.
cs.DS
cs
Minimum Cuts and Shortest Cycles in Directed Planar Graphs via Noncrossing Shortest Paths∗ Hung-Chun Liang† Hsueh-I Lu‡ April 27, 2018 Abstract Let G be an n-node simple directed planar graph with nonnegative edge weights. We study the fundamental problems of computing (1) a global cut of G with minimum weight and (2) a cycle of G with minimum weight. The best previously known algorithm for the former problem, running in O(n log3 n) time, can be obtained from the algorithm of Ł acki, Nussbaum, Sankowski, and Wulff-Nilsen for single-source all-sinks maximum flows. The best previously known result for the latter problem is the O(n log3 n)-time algorithm of Wulff-Nilsen. By exploiting duality between the two problems in planar graphs, we solve both problems in O(n log n log log n) time via a divide-and-conquer algorithm that finds a shortest non-degenerate cycle. The kernel of our result is an O(n log log n)-time algorithm for computing noncrossing shortest paths among nodes well ordered on a common face of a directed plane graph, which is extended from the algorithm of Italiano, Nussbaum, Sankowski, and Wulff-Nilsen for an undirected plane graph. 1 Introduction Let G be an n-node m-edge simple graph with nonnegative edge weights. G is unweighted if the weights of all edges of G are identical. Let C be a subgraph of G. The weight w(C) of C is the sum of edge weights of C. Let G \ C denote the graph obtained from G by deleting the edges of C. Paths are allowed to repeat nodes throughout the paper. For nodes s and t, an st-path of G is a path of G from s to t and an st-cut of G is a subgraph C of G such that there are no st-paths in G \ C. A (global) cut of G is an st-cut of G for some nodes s and t of G. A cycle of G is an ss-path of G for some node s of G. • The minimum-cut problem on G seeks a cut of G with minimum weight. For instance, the v1v3-cut consisting of edge v2v3 is the minimum cut of the graph in Figure 1(a). The best known algorithm on directed G, due to Hao and Orlin [30], runs in O(mn log n2 m ) time. On undirected G, Nagamochi and Ibaraki [54] and Stoer and Wagner [61] solved the problem in O(mn + n2 log n) time and Karger [37] solved the problem in expected ∗A preliminary version of this paper appeared as the master's thesis of the first author [45]. The journal version appeared in SIAM Journal on Discrete Mathematics [46]. †Graduate Institute of Computer Science and Information Engineering, National Taiwan University. Email: [email protected]. ‡Corresponding author. Department of Computer Science and Information Engineering, National Taiwan Uni- versity. This author also holds joint appointments in the Graduate Institute of Networking and Multimedia and the Graduate Institute of Biomedical Electronics and Bioinformatics, National Taiwan University. Address: 1 Roosevelt Road, Section 4, Taipei 106, Taiwan, ROC. Research of this author is supported in part by MOST grant 104–2221– E–002–044–MY3. Email: [email protected]. Web: www.csie.ntu.edu.tw/~hil. 1 v4 6 v2 9 2 7 8 5 v1 v3 1 v4 6 ⋆ ⋆ ⋆ 9 f2 ⋆ v1 f1 2 ⋆ v2 7 f3 8 v3 (a) G (b) G△ f2 7 ⋆ 6 5 1 f4 ⋆ ⋆ f3 ⋆ f1 8 2 (c) G∗ △ 5 1 9 ⋆ f4 Figure 1: (a) A simple planar graph G. (b) A simple bidirected plane graph G△ obtained from G by adding edges with weights ⋆ = 0 (respectively, ⋆ = ∞) if we are seeking a minimum cut (respectively, shortest cycle) of G. (c) The dual of G△. O(m log3 n) time. Kawarabayashi and Thorup [38] recently announced the first known o(mn)-time algorithm on undirected unweighted G, improving upon the algorithm of Gabow [24] designed twenty years ago. • The shortest-cycle problem on G seeks a cycle of G with minimum weight. For instance, cycle v2v3v2 with weight 6 is the shortest cycle of the graph in Figure 1(a). Since a short- est directed cycle containing edge ts is obtainable from a shortest st-path, the problem on directed graphs can be reduced to computing all-pairs shortest paths in, e.g., O(mn + n2 log n) time [10]. Vassilevska Williams and Williams [65] argued that finding a truly subcubic algorithm for the problem might be hard. For directed (respectively, undi- rected) unweighted G, Itai and Rodeh [32] solved the problem in O(µ(n) log n) (respec- tively, O(min(mn, µ(n)))) time, where µ(n) = O(n2.373) [64] is the time for multiplying two n × n matrices. If G is undirected and planar, Chalermsook, Fakcharoenphol, and Nanongkai [8] showed that the time complexity of both aforementioned problems on G is O(log n) times that of finding an st-cut of G with minimum weight for any given nodes s and t. Plugging in the O(n log n)-time algorithms, e.g., of Frederickson [23], Borradaile and Klein [1], and Erickson [14], the reduction of Chalermsook et al. solved both problems in O(n log2 n) time. Plugging in the O(n log log n)- time algorithm of Italiano, Nussbaum, Sankowski, and Wulff-Nilsen [33], the reduction of Chalermsook et al. solved both problems in O(n log n log log n) time. The best known result for both problems on G is the O(n log log n)-time algorithm of Ł acki and Sankowski [44], relying upon the st-cut oracle of Italiano et al. [33]. This paper addresses both problems for the case that G is directed and planar. While the minimum-cut problem has been thoroughly studied for undirected planar graphs, surprisingly no prior work is specifically for directed planar graphs. Djidjev [12] claimed that his technique for unweighted undirected planar graphs solves the shortest-cycle problem on unweighted directed planar G in O(n3/2) time and left open the problem of finding a shortest cycle in un- weighted directed planar G in o(n3/2) time. Weimann and Yuster [67] gave an O(n3/2)-time al- gorithm for the shortest-cycle problem, which should be adjustable to solve the minimum-cut problem also in O(n3/2) time (via similar techniques to our proof for Lemma 4.2 in §4 to handle degeneracy in shortest cycles). Wulff-Nilsen [68] reduced the time for the shortest-cycle prob- lem on G to O(n log3 n), but it is unclear how to adjust his algorithm to solve the minimum-cut problem without increasing the required time by too much. The algorithm of Ł acki, Nuss- 2 baum, Sankowski, and Wulff-Nilsen [43] for single-source all-sinks maximum flows solves the minimum-cut problem on directed planar G in O(n log3 n) time. Below is our result: Theorem 1.1. It takes O(n log n log log n) time to solve the minimum-cut and shortest-cycle problems on an n-node simple directed planar graph with nonnegative edge weights. As pointed out by anonymous reviewers, Mozes, Nikolaev, Nussbaum, and Weimann [51] recently announced an O(n log log n)-time algorithms for the minimum-cut problem. How- ever, unlike our Theorem 1.1, their algorithm requires the condition that there is a unique shortest path between any two nodes. For general directed planar graphs with nonnegative edge weights, they apply an isolation lemma [50, 53] to perturb the edge weights to meet the condition with high probability. Thus, their results are Monte Carlo randomized algorithms. Related work The only known nontrivial linear-time algorithm for the shortest-cycle problem, due to Chang and Lu [9], works on undirected unweighted planar graphs. For undirected G, if G is embed- ded on an orientable surface of genus g, Erickson, Fox, and Nayyeri [15] solved the problem in gO(g)n log log n time, based on the algorithm of Ł acki and Sankowski [44] for undirected planar graphs. If G is undirected and unweighted and is 2-cell embedded on an orientable surface of genus g = O(nα) with 0 < α < 1, Djidjev [12] solved the problem in O(g3/4n5/4 log n) time. On undirected unweighted O(1)-genus G, Weimann and Yuster [67] solved the problem in O(n log n) time. For directed planar G, even if G is unweighted, our Theorem 1.1 remains the best known algorithm. If G is unweighted and embedded on a genus-g surface, the tech- nique of Djidjev [12] solved the problem in O(g1/2n3/2) time. The shortest-cycle problem on G with negative edge weights can be reduced to one with nonnegative edge weights using the standard reweighting technique via a shortest-path tree in G (e.g., [20, 25, 27, 42, 52]). Cygan, Gabow, and Sankowski [11] studied the problem on graphs whose edge weights are bounded integers. Yuster [69] studied the version on undirected G asking for each node a shortest cycle containing the node. See e.g., [5, 6, 7, 16, 19, 21, 22] for algorithms that compute shortest cy- cles with prescribed topological properties. See, e.g., [32, 47, 49, 59, 60, 70] for approximation algorithms of the shortest-cycle problem. The closely related problem that seeks a minimum st-cut for given nodes s and t and its dual problem that seeks a maximum st-flow have been extensively studied even for only pla- nar graphs (see, e.g., [1, 14, 39, 66]). A minimum st-cut of G can be obtained in O(m + n) time from a maximum st-flow f of G by identifying the edges from the nodes of G reachable from s to the nodes of G not reachable from s in the residual graph of G with respect to f. No efficient reductions for the other direction are known. Orlin [55] gave the only known O(mn)-time algorithms for the maximum st-flow problem on general graphs with integral edge weights. For undirected planar G, Reif [58] gave an O(n log2 n)-time algorithm for the minimum st-cut problem. Frederickson [23] improved the time complexity of Reif's algorithm to O(n log n). The best known algorithms for both problems, due to Italiano et al. [33], run in O(n log log n) time. The attempt of Janiga and Koubek [34] to generalize Reif's algorithm to directed planar G turned out to be flawed [17, 36, 51]. Borradaile and Klein [1] and Erickson [14] gave O(n log n)- time algorithms for both problems on directed planar graphs. On directed planar unweighted G, Brandes and Wagner [4] and Eisenstat and Klein [13] solved both problems in O(n) time. The algorithm of Kaplan and Nussbaum [36] is capable of exploiting the condition that nodes s and t are close. For directed planar G, the O(n log3 n)-time algorithm of Ł acki et al. [43] obtains the minimum weights of st-cuts for any given s and all nodes t of G. For any given node sub- sets S and T of directed planar G, the O(n log3 n)-time algorithm of Borradaile, Klein, Mozes, 3 Nussbaum, and Wulff-Nilsen [2] computes a subgraph C of G with minimum weight such that there is no st-path in G \ C for any s ∈ S and t ∈ T . On undirected planar G, Borradaile, Sankowski, and Wulff-Nilsen [3] gave an O(n log4 n)-time algorithm to compute a Gomory- Hu cut-equivalent tree [28], a compact representation of st-cuts with minimum weights for all nodes s and t. The kernel of our result is an O(n log log n)-time algorithm for computing noncrossing shortest paths among nodes well ordered on a common face of a directed plane graph, which is extended from the algorithm of Italiano et al. [33] for an undirected plane graph. A closely related NP-hard shortest-noncrossing-paths problem seeks noncrossing paths between k given terminal pairs on h faces with minimum total weight in a plane graph. Takahashi, Suzuki, and Nishizeki [63] solved the problem for undirected plane graphs with h ≤ 2 in O(n log k) time. Papadopoulou [56] addressed the geometric version of the problem, where the terminal pairs are on the boundaries of h polygonal obstacles in the plane with complexity n and gave an O(n)-time algorithm for the case h ≤ 2. Erickson and Nayyeri [18] generalized the result of Takahashi et al., solving the problem for undirected planar graphs in 2O(h2)n log k time. They also generalized the result of Papadopoulou to solve the geometric version in 2O(h2)n time. Each of these algorithms computes an implicit representation of the answers, which may have total size Ω(kn). Polishchuk and Mitchell [57] addressed the problem of finding noncrossing thick paths with minimum total weight. Takahashi, Suzuki, and Nishizeki [62] also considered the rectilinear version of the problem. Technical overview and outline Our proof for Theorem 1.1 consists of a series of reductions. Based upon the duality between simple cycles and minimal cuts in plane graphs, Section 2 gives an O(n)-time reduction from the minimum-cut and shortest-cycle problems in an n-node planar graph to the problem of finding a shortest non-degenerate cycle in an n-node O(1)-degree plane graph G (Lemma 2.1). Let C be a balanced separator of G that corresponds to a fundamental cycle with respect to a shortest-path tree of G. A shortest non-degenerate cycle that does not cross C can be re- cursively computed from the subgraphs of G separated by C. Although we cannot afford to compute a shortest non-degenerate cycle that crosses C, Section 3 reduces the problem of find- ing a shortest non-degenerate cycle to finding a C-short cycle, i.e., a non-degenerate cycle that crosses C with the property that if it is not shortest, then a shortest non-degenerate cycle that does not cross C has to be a shortest non-degenerate cycle of G (Lemma 3.1). This reduction is a divide-and-conquer recursive algorithm using the balanced separator C and thus intro- duces an O(log n)-factor overhead in the running time. A cycle of G that crosses a shortest path P of G can be shortcutted into a non-degenerate cycle that crosses P at most once. Sec- tion 4 reduces the problem of finding a C-short cycle to that of finding a (C, P )-short cycle, i.e., a non-degenerate cycle whose weight is no more than that of any non-degenerate cycle that crosses a shortest path P of G in C exactly once (Lemma 4.2). By the technique of Reif [58] that incises G along P , Section 4 further reduces the problem of finding a (C, P )-short cycle to that of finding shortest noncrossing paths among nodes well ordered on the boundary of external face (Lemma 4.1). As a matter of fact, this shortest-noncrossing-paths problem can be solved by the O(n log n)-time algorithm of Klein [40], already yielding improved O(n log2 n)-time al- gorithms for the minimum-cut and shortest-cycle problems. (Mozes et al. [51] also mentioned that O(n log2 n)-time algorithms can be obtained by plugging in the O(n log n)-time minimum st-cut algorithm of Borradaile and Klein [1] into a directed version of the reduction algorithm of Chalermsook et al. [8].) To achieve the time complexity of Theorem 1.1, Section 5 solves the problem in O(n log log n) time by extending the algorithm of Italiano et al. [33] for an undi- 4 rected plane graph. Section 6 concludes the paper. 2 Reduction to finding shortest non-degenerate cycles Directed graph G is bidirected if, for any two nodes s and t of G, st is an edge of G if and only if ts is an edge of G. The graph in Figure 1(a) is not bidirected. The degree of node v in bidirected G is the number of neighbors of v in G. The degree of bidirected G is the maximum degree of the nodes in G. A bidirected plane graph is a bidirected planar graph equipped with a plane embedding in which edges between two adjacent nodes are bundled together. Figures 1(b) and 1(c) show two bidirected plane graphs G△ and G∗ △. A cycle passing each node at most once is simple. A cycle is degenerate if it is a node or passes both edges st and ts for two nodes s and t. A cycle not simple (respectively, degenerate) is non-simple (respectively, non-degenerate). Cycle C1 in Figure 2(a) is non-degenerate and non-simple. In the graph G of Figure 1(a), cycle v2v3v2 is degenerate and simple, cycle v2v3v4v2 is non-degenerate and simple, and cycle v1v2v4v2v3v1 is degenerate and non-simple. The shortest degenerate cycle of G is v2v3v2 with weight 6. The shortest non-degenerate cycle of G is v2v3v4v2 with weight 16. Theorem 1.1 can be proved by the following lemma: Lemma 2.1. It takes O(n log n log log n) time to compute a shortest non-degenerate cycle in an n-node O(1)-degree simple bidirected plane graph with nonnegative edge weights. Proof of Theorem 1.1. Adding edges with weights 0 (respectively, ∞) to the input graph does not affect the weight of minimum cuts (respectively, shortest cycles). Hence, we may assume without loss of generality that the input graph G△ has at least four nodes and is a simple bidirected plane graph such that each face of G△ is a triangle. See Figures 1(a) and 1(b) for examples. Let the dual G∗ △ of G△ be the simple bidirected plane graph on the 2n − 4 faces of G△ sharing the same set of 6n − 12 edges with G△ that is obtainable in O(n) time from G△ as follows: For any two adjacent nodes s and t of G△, there are directed edges f g = st and gf = ts △, where f and g are the two faces of G△ incident with the bundled edges between s and in G∗ t such that face g immediately succeeds face f in clockwise order around node s of G△. See Figure 1(c) for an example. Observe that C is a minimal cut of G△ if and only if C is a simple △. By nonnegativity of edge weights, a shortest non-degenerate cycle non-degenerate cycle of G∗ △ is a minimum cut of G△. For instance, the shortest non-degenerate cycle of the graph G∗ of G∗ in Figure 1(c) is f1f4f3f1 with weight 5. It corresponds to the v1v3-cut {v1v3, v2v3, v4v3} of G△, which in turn corresponds to the minimum cut {v2v3} of G. Although the degenerate cycle f1f4f1 is a shortest cycle of G∗ △, it does not correspond to a cut of G in the above manner. Since each node of G∗ △ has exactly three neighbors, the statement of the theorem for the minimum-cut problem follows from applying Lemma 2.1 on G∗ △. △ By nonnegativity of edge weights, it takes O(n) time to obtain a shortest degenerate cycle of G△ by examining the O(n) degenerate cycles of G△ on exactly two nodes. By Lemma 2.1, the statement of the theorem for the shortest-cycle problem is immediate from the following claim: It takes O(n) time to obtain from G△ an O(n)-node O(1)-degree simple bidirected plane graph G such that a shortest non-degenerate cycle of G△ can be computed from a shortest non-degenerate cycle of G in O(n) time. Let G1 and G2 be simple bidirected plane graphs with nonnegative edge weights such that G2 is obtained from G1 by the following O(d)-time operation on a degree-d node v of G1 with d ≥ 4: If u1, . . . , ud are the neighbors of v in G1 in clockwise order around v, then SPLIT(v) 5 u1 u2 u1 0 0 5 0 u4 2 4 0 0 1 3 v 7 6 0 8 5 u3 u4 0 0 0 1 3 v1 v4 u2 0 2 v2 0 0 0 8 v3 4 0 u3 0 0 0 0 7 6 (a) G1, C1, and C ∗ 1 (b) G2, C ∗ 2, and C2 Figure 2: Bidirected plane graphs G1 and G2 and their edge weights are in black solid lines. 2 = u1v1v2u2u3v3v4u4u1 are in blue Shortest non-degenerate cycles C1 = u1vu2u3vu4u1 and C ∗ 1 = u1vu4u1 and C2 = u1v1v2v3v4u4u1 are in dashed lines. Shortest non-degenerate cycles C ∗ red dotted lines. • adds zero-weight path v1v2 ··· vd−1vdvd−1 ··· v2v1 with new nodes v1, . . . , vd, • replaces edge uiv by edge uivi with the same weight for each i = 1, . . . , d, • replaces edge vui by edge viui with the same weight for each i = 1, . . . , d, and • deletes v. See Figure 2 for an example of G1 and G2. An O(n)-node O(1)-degree simple bidirected plane graph G can be obtained in O(n) time from G△ by iteratively applying SPLIT on each node v of G△ with degree d ≥ 4. To prove the claim, it suffices to ensure the following statement: A shortest non-degenerate cycle C1 of G1 is obtainable in O(d) time from a shortest non- degenerate cycle C ∗ 2 of G2. 2 and C1. 2 ). Since C ∗ 2 with 1 ≤ i 6= j ≤ d such that P has at least two edges and all For each uiuj-path P of C ∗ internal nodes of P are in {v1, . . . , vd}, we replace P by path uivuj. By w(P ) = w(uivuj), we 2 is non-degenerate, so is the resulting O(d)-time obtainable have w(C1) = w(C ∗ cycle C1 of G1. Since C1 may pass v more than once, C1 could be non-simple. See Figure 2 1 ) for any shortest simple for an example of C ∗ 1 of G1. By nonnegativity of edge weights, we have w(C1) ≥ w(C ∗ non-degenerate cycle C ∗ 1 ) even if C1 is non-simple. Let C2 be the cycle of G2 that is obtained from C ∗ 1 as follows: If 1, then replace it by path uivi ··· vjuj. By there is a path uivuj with 1 ≤ i 6= j ≤ d in C ∗ 1 ). Otherwise, let C2 = C ∗ w(uivuj) = w(uivi ··· vjuj), we have w(C2) = w(C ∗ 1 is 1 is non-degenerate, so is C2. See Figure 2 1. Since C ∗ simple, there is at most one path uivuj in C ∗ 1 ), C1 is a shortest non- for an example of C ∗ degenerate cycle of G1. It remains to show w(C1) = w(C ∗ 1 and C2. By w(C1) = w(C ∗ 2 ) ≤ w(C2) = w(C ∗ 1. Since C ∗ The rest of the paper proves Lemma 2.1. 3 Divide-and-conquer via balanced separating cycles Let C be a simple non-degenerate cycle of a bidirected plane graph G with nonnegative edge weights. Let intG(C) (respectively, extG(C)) denote the subgraph of G consisting of the nodes and edges on the boundary of the faces of G inside (respectively, outside) of C. A non- degenerate cycle C3 of G is C-short if one of C1, C2, and C3 is a shortest non-degenerate cycle 6 1 2 1 v4 4 1 2 v3 v1 1 2 2 4 2 0 v2 1 1 3 9 9 v6 v5 v2 3 1 1 1 2 9 9 v7 v6 3 9 9 v1 1 2 2 4 v8 4 1 2 v3 1 0 1 2 1 v4 1 0 v5 3 1 2 9 9 v7 (a) G, C, and C ∗ (b) H Figure 3: (a) The bidirected plane graph G and its edge weights are in black. The blue dashed cycle C = v1v2v3v4v5v1 is a segmented cycle of G whose segments are shortest paths P1 = v1v2v3 and P2 = v1v5v4 of G. The shortest non-degenerate cycle of intG(C) is v1v2v5v1 with weight 5. The shortest non-degenerate cycle of extG(C) is v2v6v7v5v4v3v2 with weight 7. The red dotted cycle C ∗ = v2v6v7v5v2 with weight 4 is the unique C-short non-degenerate cycle of G and the unique shortest non-degenerate cycle of G. (b) A bidirected plane graph H. of G, where C1 (respectively, C2) is a shortest non-degenerate cycle of intG(C) (respectively, extG(C)). We say that C is segmented if it consists of the following three paths in order: (1) a shortest path P1, (2) an edge, and (3) the reverse of a shortest path P2, where one of P1 and P2 is allowed to be a node. Let shortest paths P1 and P2 be the segments of C. See Figure 3(a) for an example. This section proves Lemma 2.1 using Lemmas 3.1, 3.2, and 3.3. Section 4 proves Lemma 3.1. Lemma 3.1. Let G be an n-node O(1)-degree simple bidirected plane graph with nonnegative edge weights. Given a segmented simple non-degenerate cycle C of G together with its segments, it takes O(n log log n) time to compute a C-short non-degenerate cycle of G. Lemma 3.2 (Henzinger, Klein, Rao, and Subramanian [31]). It takes O(n) time to compute a shortest-path tree rooted at any given node of an n-node connected simple directed planar graph with nonnegative edge weights. Lemma 3.3 (Lipton and Tarjan [48], Goodrich [29], Klein, Mozes, and Sommer [41, Lemma 1]). Let G△ be an n-node simple undirected plane triangulation with nonnegative face weights summing to 1 such that the weight of each face of G△ is at most 1 4 . Given any spanning tree T of G△, it takes O(n) time to obtain an edge e of G△ \ T such that the total weight of the faces of G△ inside (respectively, outside) of the simple cycle in T ∪ {e} is no more than 3 4 . Proof of Lemma 2.1. We give a divide-and-conquer recursive algorithm on the input graph H, which can be assumed to be connected without loss of generality. For each degree-2 node y whose neighbors x and z are non-adjacent, we replace y and its incident edges by edges xz and zx with weights w(xy) + w(yz) and w(zy) + w(yx), respectively. The resulting graph G obtainable in O(n) time from H remains an O(1)-degree simple connected bidirected plane graph. See Figure 3 for an example of H and G. Let ℓ be the number of faces in G. Since each maximal simple path on the degree-2 nodes of G has O(1) edges, G has O(ℓ) nodes. A shortest non-degenerate cycle of H can be obtained in O(n) time from a shortest non-degenerate cycle of G, which can be found in O(1) time for the case with ℓ ≤ 4. 7 4 1 2 v3 v1 1 2 2 4 2 0 v2 1 1 3 9 9 v6 1 2 1 v4 v5 3 1 2 9 9 v1 1 6 0 1 6 v5 0 1 6 v4 1 6 v2 0 1 6 1 6 v3 0 v7 v6 v7 (a) G and T (a) G△ and T0 Figure 4: (a) The bidirected plane graph G having 6 faces and its edge weights are in black. A shortest-path tree T rooted at v1 is in blue dashed lines. (b) The plane triangulation G△ consists of all edges. The numbers are weights of the faces of G△. The undirected version G0 of G consists of the black solid edges and the blue dashed edges. The undirected version T0 of T is in blue dashed lines. The edges in G△ \ G0 are in red dotted lines. To obtain a shortest non-degenerate cycle of G for the case with ℓ ≥ 5, let T be an O(n)-time obtainable shortest-path tree of G rooted at an arbitrary node as ensured by Lemma 3.2. For each face f of the simple undirected unweighted version G0 of G having size k ≥ 3, (1) let f be triangulated into k − 2 faces via adding k − 3 edges without introducing multiple edges, (2) let an arbitrary one of the k − 2 faces be assigned weight 1 ℓ , and (3) let the remaining k − 3 faces be assigned weights 0. Let G△ be the resulting simple plane triangulation. The undirected version T0 of T is a spanning tree of G0 and G△. See Figure 4 for an example. Lemma 3.3 ensures an edge xy of G△ \ T0 obtainable in O(n) time such that the face weights of G△ inside (respectively, outside) of the simple cycle of T0 ∪ {xy} sum to at most 3 4. For instance, such an edge xy in the example in Figure 4 is v3v4. If x and y are adjacent in G, then let E = ∅; otherwise, let E consist of edges xy and yx with weights ∞. We union G and E to obtain a simple bidirected plane graph G∗. Let s be the least common ancestor of x and y in T . Let C be the segmented simple non-degenerate cycle of G∗ consisting of (1) the sx-path of T , (2) edge xy, and (3) the reverse of the sy-path of T . By Lemma 3.1, it takes O(n log log n) time to compute a C-short cycle C3 of G∗. Let H1 = intG∗(C) \ E and H2 = extG∗(C) \ E. No matter E = ∅ or not, H1 and H2 are subgraphs of G . We recursively compute a shortest non-degenerate cycle C1 (respectively, C2) in H1 (respectively, H2), which is also a shortest non-degenerate cycle of intG∗(C) (respectively, extG∗(C)). By definition of C3, a cycle C ∗ in {C1, C2, C3} with minimum weight is a shortest non-degenerate cycle of G∗. If C ∗ passes an edge in E 6= ∅, then the weight of each non-degenerate cycle of G∗ and G is ∞. Otherwise, we return C ∗ as a shortest non-degenerate cycle of G. The algorithm runs in O(n log log n) time without accounting for the time for its subsequent recursive calls. By ℓ ≥ 5, the number ℓ1 (respectively, ℓ2) of faces in H1 (respectively, H2) is at most 3 20 ℓ, implying that there are O(log n) levels of recursion. By ℓ1 + ℓ2 ≤ ℓ + 2, the overall number of faces in each recursion level is O(n), implying that the overall number of nodes in each recursion level is O(n). The algorithm runs in O(n log n log log n) time. 4 ℓ + 1 ≤ 19 8 3 3 5 5 1 0 u 6 6 0 0 s 1 1 u1 1 1 u2 1 1 t (a) G 1 1 0 1 8 8 v 9 9 u1 1 1 u2 1 5 0 1 1 5 1 1 u 3 6 ∞ 1 8 ∞ ∞ v1 0 8 ∞∞ v2 ∞ v 1 9 s 3 1 0 0 6 9 t (b) H Figure 5: (a) With P = su1u2t and C = su1u2tvs, the red dotted cycle u1u2uvu1 and the blue dashed cycle u1vuu2u1 are (C, P )-cycles of G with minimum weight 2. (b) H is obtained from incising G along P . 4 Non-degenerate cycles that cross the separating cycle This section proves Lemma 3.1 by Lemma 4.2, which is proved by Lemmas 3.2 and 4.1. Sec- tion 5 proves Lemma 4.1. If graph G has uv-paths, then let dG(u, v) denote the weight of a shortest uv-path of G. If G has no uv-paths, then let dG(u, v) = ∞. Lemma 4.1. Let G be an n-node simple connected bidirected plane graph with nonnegative edge weights. Let u1, . . . , uℓ, vℓ, . . . , v1 be O(n) nodes on the boundary of the external face of G in order. It takes overall O(n log log n) time to compute dG(ui, vi) for each i = 1, . . . , ℓ. Let G be a simple bidirected plane graph. A simple path Q of G aligns with subgraph H of G if Q or the reverse of Q is a path of H. A simple path Q of G passing at least one edge deviates from subgraph H of G if the edges and the internal nodes of Q are not in H. For any simple path P of G, a non-degenerate cycle of G is a P -cycle if it consists of a path aligning with P and a path deviating from P . For any simple non-degenerate cycle of G and any path P of G aligning with C, a P -cycle is a (C, P )-cycle if the first edge of its path deviating from P is in intG(C) if and only if the last edge of its path deviating from P is in extG(C). For instance, the C ∗ in Figure 3(a) is a P1-cycle of G whose path aligning with P1 is node v2. The first edge v2v6 (respectively, last edge v5v2) of its path deviating from P1 is in extG(C) (respectively, intG(C)), so C ∗ is a (C, P1)-cycle of G. C ∗ is also a (C, P2)-cycle. A non-degenerate cycle of G is (C, P )-short if its weight is no more than that of any (C, P )-cycle of G. Lemma 4.2. Let G be an n-node O(1)-degree simple bidirected plane graph with nonnegative edge weights. Let C be a simple non-degenerate cycle of G. Given a path P of G aligning with C, it takes O(n log log n) time to compute a (C, P )-short cycle of G. Proof. Let C ∗ be a (C, P )-cycle of G with minimum weight. For instance, the red and blue cycles in Figure 5(a) are two (C, P )-cycles with minimum weight 2. Let C0 be a shortest non- degenerate cycle of G passing at least one endpoint of P , which can be obtained in O(n) time via examining shortest uv-paths in G\{uv, vu} by Lemma 3.2 for all O(1) edges uv of G incident to at least one endpoint of P . If C ∗ passes some endpoint of P , then w(C0) ≤ w(C ∗), implying 9 R2 Pi u1 P1 P2 P1 P2 R1 Q1 Q2 (a) (b) v2 v1 u2 (c) Figure 6: (a) The red dotted P1-cycle not intersecting P2 is in intG(C). The blue dashed P2- cycle not intersecting P1 is in extG(C). (b) The red dotted cycle consists of Q1, R1, Q2, and R2 in order is a (C, P1)-cycle. (c) The degenerate cycle C ′ is obtained from the non-degenerate red dotted cycle C ∗ by replacing the u1v1-path of C ∗ with the blue dashed u1v1-path of Pi. The green dash-dotted cycle C ′′ is a non-degenerate cycle contained by C ′. that C0 is a cycle ensured by the lemma. The rest of the proof assumes that C ∗ does not pass any endpoint of P . Thus, P has internal nodes. Let H be an O(n)-node O(1)-degree simple bidirected plane graph obtainable in O(n) time as follows: Suppose that u0, . . . , uℓ+1 with ℓ ≥ 1 are the nodes of P in order. Let s = v0 = u0 and t = vℓ+1 = uℓ+1. We incise G along P by be replaced by vvi (respectively, viv) with the same weight, • adding new nodes v1, . . . , vℓ, a new path P ′ = sv1 ··· vℓt and the reverse of P ′, • for each i = 1, . . . , ℓ, letting each edge vui (respectively, uiv) incident to ui in intG(C) \ P • letting the weight of each edge in P ′ and the reverse of P ′ be ∞, and • embedding the resulting graph H such that P and P ′ are on the external face. See Figure 5 for an example. By Lemma 4.1, it takes overall O(n log log n) time to compute dH (ui, vi) and dH(vi, ui) for each i ∈ {1, . . . , ℓ}. Let i1 (respectively, i2) be an i ∈ {1, . . . , ℓ} that minimizes dH(ui, vi) (respectively, dH (vi, ui)). By Lemma 3.2, it takes O(n) time to obtain a simple shortest ui1vi1-path P1 of H and a simple shortest vi2ui2-path P2 of H. The weight of P1 (respectively, P2) is minimum over all uivi-paths (respectively, viui-paths) of H with 1 ≤ i ≤ ℓ. Let C1 (respectively, C2) be the non-degenerate cycle of G corresponding to P1 (respectively, P2). Let Q be the path of C ∗ that deviates from P . Let ui and uj with 1 ≤ i, j ≤ ℓ be the first and last nodes of Q, respectively. If the first edge of Q is in intG(C), then C ∗ corresponds to a viui-path of H, implying w(C2) ≤ w(C ∗). If the last edge of Q is in intG(C), then C ∗ corresponds to a ujvj-path of H, implying w(C1) ≤ w(C ∗). For instance, the red (respectively, blue) cycle of G in Figure 5(a) corresponds to the red u1v1-path (respectively, blue v1u1-path) of H in Figure 5(b). Thus, one of C0, C1, and C2 with minimum weight is a cycle ensured by the lemma. Proof of Lemma 3.1. Let G1 = intG(C) and G2 = extG(C). Let P1 and P2 be the given segments of C. Let C ∗ be a shortest non-degenerate cycle of G whose number of edges not in P1 ∪ P2 is minimized over all shortest non-degenerate cycles of G. If C ∗ is a cycle of G1 or G2, then 10 any cycle of G is C-short, including the one ensured by Lemma 4.2. The rest of the proof assumes that neither G1 nor G2 contains C ∗. By Lemma 4.2, it suffices to ensure that C ∗ is a (C, P1)-cycle. We need the following claim: For each i ∈ {1, 2}, if C ∗ ∩ Pi 6= ∅, then C ∗ is a Pi-cycle of G. By the claim, C ∗ intersects both P1 and P2 or else C ∗ would be a cycle of G1 or G2, as illustrated by Figure 6(a), contradicting the assumption. Since C ∗ is a P1-cycle and a P2-cycle, C ∗ consists of four paths Q1, R1, Q2, and R2 in order such that Qi aligns with Pi and Ri deviates from P1 ∪ P2 for each i ∈ {1, 2}. By the assumption, if R1 ⊆ Gi and R2 ⊆ Gj, then {i, j} = {1, 2}. Thus, C ∗ is a (C, P1)-cycle. See Figure 6(b) for an illustration. It remains to prove the claim. Assume for contradiction that C ∗ intersects Pi but is not a Pi-cycle for an index i ∈ {1, 2}. There are nodes u1, v1, u2, v2 of Pi with u1 6= v1 and u2 6= v2 such that • u1 precedes v1 in Pi, • u2 succeeds v2 in Pi, • the u1v1-path and the u2v2-path of C ∗ deviate from Pi, and • the u1v1-path of C ∗ deviates from the u2v2-path of C ∗. Let C ′ be the cycle of G obtained from C ∗ by replacing the u1v1-path of C ∗ with the u1v1- path of Pi. Since Pi is a shortest path of G, w(C ′) ≤ w(C ∗). Since C ∗ is non-degenerate, the reverse of each of the u2v2-path of C ′ is not in C ′. Thus, even if C ′ is degenerate, there is a non- degenerate cycle C ′′ in C ′. See Figure 6(c) for an illustration. By nonnegativity of edge weights, w(C ′′) ≤ w(C ′). By w(C ′′) ≤ w(C ∗), C ′′ is a shortest non-degenerate cycle of G whose number of edges not in P1 ∪ P2 is fewer than the number of edges of C ∗ not in P1 ∪ P2, contradicting the definition of C ∗. 5 Noncrossing shortest paths among nodes on external face This section proves Lemma 4.1 via extending techniques of Reif [58] and Italiano et al. [33] for undirected planar graphs. Algorithms for r-divisions (Lemma 5.1) and dense-distance graphs (Lemma 5.2) are reviewed in §5.1. Data structures for fast-Dijkstra algorithm (Lemma 5.5) are given in §5.2. Data structures that enables efficient partition of boundary nodes via non- crossing paths (Lemma 5.6) are given in §5.3. Tools involving noncrossing shortest paths (Lemma 5.8) are given in §5.4. Lemma 4.1 is proved by Lemmas 3.2, 5.1, 5.2, 5.5, 5.6, and 5.8 in §5.5. 5.1 Dense-distance graph Let G be a simple bidirected plane graph. A division D of G is an edge-disjoint partition of G into bidirected plane subgraphs, each of which is a piece of D. The multiplicity of node v of G in D is the number of pieces of D containing v. A node of G with multiplicity two or more in D is a boundary node of D. A face of a piece of D is a hole of the piece if it is not a face of G. For any r > 0, an r-division (see, e.g., [23, 31, 33, 41, 44]) of G is a division of G with O(n/r) pieces, each having O(r) nodes, O(√r) boundary nodes, and O(1) holes. Lemma 5.1 (Klein, Mozes, and Sommer [41]). For any r > 0, it takes O(n) time to compute an r-division for an n-node simple bidirected plane graph each of whose faces contains at most three nodes. 11 y1 1 9 1 1 1 1 x1 9 9 x2 1 1 1 1 1 1 1 1 9 x3 1 y2 1 9 9 3 4 2 x1 5 2 x2 3 4 2 3 5 3 2 2 4 4 2 x3 2 2 y1 y2 4 4 (a) H (b) K(H) Figure 7: (a) A piece H in which x1, x2, and x3 are the boundary nodes in one hole and y1 and y2 the boundary nodes in the other hole. (b) K(H). Let D be an r-division of G. For any connected component H of any piece of D, let K(H) denote the complete directed graph on the boundary nodes of D in H in which w(uv) = dH (u, v). See Figure 7 for an example. The dense distance graph (see, e.g., [33]) K(D) of D is the O(n)-edge simple directed graph on the O(n/√r) boundary nodes of D simplified from the union of K(H) over all connected components H of all pieces of D by keeping exactly one copy of parallel edges with minimum weight. For any edge uv of K(D), an underlying uv-path is a uv-path in some connected component H of some piece of D with weight equal to w(uv) in K(D). For any path Π of K(D), an underlying path of Π consists of an underlying uv-path for each edge uv of Π. Lemma 5.2 (Klein [40]). For any given r-division D of an n-node simple bidirected plane graph with nonnegative edge weights, it takes O(n log r) time to compute K(D) and a data structure from which, for any path Π of K(D), the first c edges of an underlying path of Π can be obtained in O(c log log r) time. 5.2 Fast-Dijkstra algorithm Consider the following equation w(u1v1) + w(u2v2) ≤ w(u1v2) + w(u2v1) (1) for distinct nodes u1, u2, v1, v2 of a simple directed graph H with edge weights. A type-1 Monge unit is a complete H equipped with a cyclic ordering for the nodes of H such that Equation (1) holds for any distinct nodes u1, u2, v2, v1 of H in order. A type-2 Monge unit is a complete bipartite H equipped with an ordering for each of the two maximal independent sets of H such that Equation (1) holds for any distinct nodes u1 and u2 of one independent set in order and any distinct nodes v1 and v2 of the other independent set in order. A Monge decomposition of a simple directed graph K with edge weights is a set M of Monge units on node subsets of K such that K is the graph simplified from the union of the Monge units in M. The multiplicity of a node v of K in M is the number of Monge units in M that contain v. The size of M is the sum of the multiplicities of all nodes of K in M. An equivalent 12 x2 x2 x1 2 5 2 y1 2 3 5 6 2 2 7 y2 x3 x1 2 5 2 2 2 6 5 3 2 2 2 y1 x3 2 2 2 y2 (a) (b) Figure 8: Each of the two graphs can be simplified from the union of two type-2 Monge units. form of the following lemma is proved by Mozes and Wulff-Nilsen [52, §4.4] using the algo- rithm of Klein [40] and used by Kaplan, Mozes, Nussbaum, and Sharir [35, §5.2]. Specifically, for any hole C of a piece H of D, the complete graph on the nodes of C with w(uv) = dH(u, v) for any nodes u and v in C equipped with the cyclic ordering of C is a type-1 Monge unit. For instance, the subgraphs of K(H) in Figure 7(b) induced by {x1, x2, x3} and {y1, y2} equipped with their cyclic orders on the holes are two type-1 Monge units. For any two holes C1 and C2 of a piece H of D, Mozes et al. showed that the complete bipartite graph on the nodes of C1 and C2 with w(uv) = dH (u, v) for nodes u and v such that each of C1 and C2 contains exactly one of u and v can be simplified from the union of O(1) type-2 Monge units. For instance, the subgraph of K(H) in Figure 7 consisting of edges between {x1, x2, x3} and {y1, y2} can be simplified from the union of the graphs in Figures 8(a) and 8(b). The edges of the graph in Figure 8(a) from hx1, x2, x3i (respectively, hy2, y1i) to hy1, y2i (respectively, hx3, x1, x2i) form a type-2 Monge unit. The edges of the graph in Figure 8(b) from hx3, x1, x2i (respectively, hy1, y2i) to hy1, y2i (respectively, hx3, x1, x2i) form a type-2 Monge unit. Lemma 5.3. For any given r-division D of an n-node simple bidirected plane graph with nonnegative edge weights, it takes O(n log r) time to obtain a Monge decomposition M (D) of K(D) such that the multiplicity of a node of K(D) in M (D) is O(1) times its multiplicity in D. As summarized in the following lemma, given a size-m Monge decomposition of graph K, there are O(m log2 m)-time obtainable data structures for range minimum queries (see, e.g., Kaplan et al. [35] and Gawrychowski, Mozes, and Weimann [26]) with which the fast-Dijkstra algorithm of Fakcharoenphol and Rao [20] outputs a shortest-path tree of K in O(m log2 m) time. Lemma 5.4. Given a size-m Monge decomposition of a simple strongly connected directed graph K with nonnegative edge weights, it takes O(m log2 m) time to compute a shortest-path tree of K rooted at any given node. Lemma 5.5. Let D be a given r-division of an n-node simple plane graph with nonnegative edge It takes O(n log r) time to compute a data structure from which, for any subset X of the weights. boundary nodes of D such that the subgraph K of K(D) induced by X is strongly connected, it takes O(m log2 m) time to compute a shortest-path tree of K rooted at any given node, where m is the sum of the multiplicities of the nodes of X in D. Proof. Let M (D) be a Monge decomposition of K(D) as ensured by Lemma 5.3. Let M consist of the subgraph H[X] of H induced by X for each Monge unit H in M (D). Each H[X] remains 13 u1 1 2 1 1 x 1 1 u2 2 1 4 6 z 3 5 1 0 v1 u1 1 1 1 2 y 1 1 1 1 x 2 0 1 1 v2 u2 2 1 z 1 0 v1 1 1 y 1 1 2 0 v2 (a) G, P1, and P2 (b) G[P1, P2] Figure 9: (a) P1 = u1xyzv1 and P2 = u2xyzv2 are noncrossing shortest paths of G. (b) G[P1, P2]. a Monge unit with the induced cyclic ordering (respectively, orderings) of the nodes in H[X] for the first (respectively, second) type. Thus, M is a Monge decomposition of K preserving the property that the multiplicity of a node of K in M is O(1) times its multiplicity in D, implying that the size of M is O(m). It takes overall O(m) time to obtain the induced cyclic ordering or the two induced orderings of the nodes of H[X] from H for each Monge unit H in M (D). Since the weight of each edge of H[X] can be obtained in O(1) time from its weight in H, we have an implicit representation of M in O(m) time. The lemma follows from Lemma 5.4. 5.3 Noncrossing paths Let G be a simple connected bidirected plane graph. Let u1, u2, v2, v1 be distinct nodes on the boundary of the external face of connected plane graph G in order. A simple u1v1-path P1 and a simple u2v2-path P2 of G are noncrossing if P1 ∩ P2 is empty or is a path. For instance, in Figure 9, P1 in red and P2 in blue are noncrossing. For noncrossing P1 and P2, let G[P1, P2] denote the connected bidirected plane subgraph of G enclosed by P1, P2, and the u1u2-path and v2v1-path on the boundary of the external face of G following the order of u1, u2, v2, v1. See Figure 9 for an example. Let D be an r-division of G. Our proof of Lemma 4.1 needs a data structure B(D) with the following property: For distinct nodes u1, u2, u3, v3, v2, v1 on the external face of G in order, any disjoint simple u1v1-path P1 and u3v3-path P3 of G, and any simple u2v2-path P2 of G[P1, P3] such that P1 and P2 are noncrossing, given X(1, 3) and P2 \ P1, it takes O((m1 + m2) log r) time to obtain X(1, 2) and X(2, 3), where X(i, j) with 1 ≤ i < j ≤ 3 consists of the boundary nodes of D in G[Pi, Pj], m1 is the sum of multiplicities of the nodes of X(1, 3) in D, and m2 is the number of edges in P2 \ P1. See Figure 10 for an illustration. Lemma 5.6. It takes O(n) time to compute a data structure B(D) for any given r-division D of any n-node simple connected bidirected plane graph. Proof. Given X(1, 3) and the edge set E of P2 \ P1, it takes O(m1 + m2) time to obtain the nodes of X(1, 3) in E, which belongs to X(1, 2) ∩ X(2, 3). Let X consist of the nodes of X(1, 3) not in E. If X = ∅, then X(1, 2) = X(2, 3) = X(1, 3). The rest of the proof assumes X 6= ∅. Let 0 (respectively, 1) consist of the pieces H of D such that H contains nodes of X and no (respectively, some) edges of E. We have 1 6= ∅, since G[P1, P3] is connected and E 6= ∅. Let A be the O(m1 + m2)-time obtainable undirected bipartite graph on the nodes x in X and the pieces H of D in 0 such that H and x are adjacent in A if and only if H contains x in G. The nodes of X in the same connected component of A either all belong to X(1, 2) or all belong to X(2, 3). Since G[P1, P3] is connected, each connected component of A contains a node of X 14 P1 u1 u2 P2 u3 P3 (a) G[P1, P3] v1 v2 v3 P1 u1 u2 P2 (b) G[P1, P2] u2 P2 u3 P3 (c) G[P2, P3] v1 v2 v2 v3 Figure 10: An illustration for the definition of B(D), where P1 is the blue solid u1v1-path, P3 is the green dash-dotted u3v3-path, and P2 is the red dotted u2v2-path. P1 and P3 are disjoint. P1 and P2 are noncrossing. (a) G[P1, P3], in which the boundary nodes of D form X(1, 3). (b) G[P1, P2], in which the boundary nodes of D form X(1, 2). (c) G[P2, P3], in which the boundary nodes of D form X(2, 3). that belongs to a piece of H ∈ 1 in G. It takes overall O(m1 + m2) time to obtain H ∩ E, C ∩ E, and C ∩ X for each hole C of each piece H of D in 1. Since each piece of D has O(1) holes, it remains to show that with the B(D) defined below, for each hole C of each piece H of D in 1, it takes O(m log r) time to determine the nodes of C ∩ X in X(1, 2), where m is the number of nodes in H ∩ X plus the number of edges in H ∩ E. Assume without loss of generality that the external face of each piece H of D is a hole of H. The O(n)-time obtainable data structure B(D) consists of (1) the cyclic ordering of the incident edges around each node of G and (2) the following items for each hole C of each piece H of D: • An arbitrary simple path Q of H from a node of C to a node q on the external face of H. • The ordering indices of the nodes on Q. • The cyclic ordering indices of the nodes on C. It takes overall O(m1 + m2) time to obtain Q ∩ E for each hole C of each piece H of D in 1. With the first part of B(D), if uv is an edge of G[P1, P3] with u ∈ P2 and v /∈ P2, then it takes O(1) time to determine whether v ∈ G[P1, P2]. With the second part of B(D), for any k-node subset U of any piece H of D and any hole C of H, it takes O(k) time to determine the ordering indices of the nodes of U ∩ Q in Q and the cyclic ordering indices of the nodes of U ∩ C in C. Case 1: C ∩ E 6= ∅. As illustrated by Figure 11(a), it takes overall O(m log r) time via sorting their ordering indices to compute, for each node x of C∩X, the first node u ∈ E in the traversal of C starting from x following the order of u1, u3, v3, v1 and the node v of C preceding u in the traversal. We have x ∈ X(1, 2) if and only if v ∈ G[P1, P2], which can be determined in O(1) time. Case 2: C∩E = ∅. As illustrated by Figure 11(b), if Q∩E 6= ∅, then let v be the node preceding the first node u of Q in E. Let C ′ be the boundary of the external face of H. As illustrated by Figure 11(c), if Q ∩ E = ∅, then let v be the node of C ′ preceding the first node u of C ′ in E on the traversal of C ′ starting from q following the order of u1, u3, v3, v1. Either way, it takes O(m) 15 v u E x E C (a) E C Q E v u q Q (b) q v u C Q E C ′ (c) Figure 11: Illustrations for the proof of Lemma 5.6. P ′ 2 P1 u1 u u2 v P2 v1 v2 Figure 12: An illustration for the proof of Lemma 5.7. time to obtain v and determine whether v ∈ G[P1, P2]. If v ∈ G[P1, P2], then C ∩ X ⊆ X(1, 2). Otherwise, C ∩ X ⊆ X(2, 3). 5.4 Noncrossing shortest paths Lemma 5.7. Let G be a simple connected bidirected plane graph with nonnegative edge weights. If nodes u1, u2, v2, v1 are on the boundary of the external face of G in order, then for any shortest u1v1- path P1 of G, there is a shortest u2v2-path P2 of G such that P1 and P2 are noncrossing. 2 6= ∅. Proof. As illustrated by Figure 12, suppose that P ′ 2 in P1. Let P2 be obtained from Let u (respectively, v) be the first (respectively, last) node of P ′ 2 by replacing its uv-path with the uv-path of P1. By the order of u1, u2, v2, v1 on the boundary P ′ of the external face of G, P2 is well defined and is a shortest u2v2-path of G such that P1 and P2 are noncrossing. 2 is a shortest u2v2-path of G with P1∩P ′ Lemma 5.8. Let G be an n-node simple connected bidirected plane graph with nonnegative edge weights. Let u1, . . . , uk, vk, . . . , v1 be 2k distinct nodes on the boundary of the external face of G in 16 order. For each i ∈ {1, k}, let Pi be a simple shortest uivi-path of G such that P1 and Pk are noncross- ing. Let h be the number of nodes of G[P1, Pk] not in P1 ∩ Pk. Given P1 \ Pk and Pk \ P1, consider the problem of computing dG(ui, vi) for all i = 1, . . . , k. 1. If P1 ∩ Pk = ∅, then the problem can be solved in O(h log k) time. 2. If P1 ∩ Pk = ∅ and we are given a set Z of O(1) nodes such that for each i = 1, . . . , k at least one shortest uivi-path passes at least one node of Z, then the problem can be solved in O(h) time. 3. If P1 ∩ Pk 6= ∅ and we are given w(P1 ∩ Pk), then the problem can be solved in O(h) time. Proof. Since P1 \ Pk and Pk \ P1 are given, it takes O(h) time to obtain G[P1, Pk] excluding the edges and internal nodes of P1∩Pk. Statements 2 and 3 follow from Lemmas 3.2 and 5.7. As for Statement 1, under the assumption that a simple shortest uava-path Pa and a simple shortest ubvb-path Pb of G are given and disjoint, below is the recursive algorithm MEASURE(a, b) with 1 ≤ a < b ≤ k for solving the (a, b)-subproblem of computing dG(ui, vi) for all indices i with a < i < b: Let i = ⌊(a + b)/2⌋. By Lemma 3.2, it takes time linear in the number of nodes in G[Pa, Pb] to obtain dG(ui, vi) and a simple shortest uivi-path Pi of G[Pa, Pb] that is noncrossing with both Pa and Pb. For the (a, i)-subproblem, if Pa ∩ Pi = ∅, then call MEASURE(a, i); otherwise, apply Statement 2 with Z consisting of an arbitrary node in Pa ∩ Pi. For the (i, b)-subproblem, if Pi ∩ Pb = ∅, then call MEASURE(i, b); otherwise, apply Statement 2 with Z consisting of an arbitrary node in Pi ∩ Pb. The algorithm for the statement obtains dG(u1, v1) and dG(uk, vk) from P1 and Pk and calls MEASURE(1, k). Since each dG(ui, vi) with 1 < i < k is computed by Lemma 3.2 or Statement 2, the correctness holds trivially. By the choice of i, MEASURE(1, k) runs in O(log k) levels of recursion. Since Pa ∩ Pb = ∅ holds for each call to MEASURE(a, b), each node of G[P1, Pk] appears in at most two subgraphs G[Pa, Pb] in the same level of recursion. Thus, the overall running time for each level of recursion is O(h). The algorithm runs in O(h log k) time. 5.5 Proving Lemma 4.1 Proof of Lemma 4.1. For each i = 1, . . . , ℓ, let di = dG(ui, vi). With the modification below, each di with 1 ≤ i ≤ ℓ equals the weight of a shortest u′ i-path in the resulting G, which remains an iv′ O(n)-node simple connected bidirected plane graph: (1) for each i = 1, . . . , ℓ, add new nodes u′ i and v′ i and i in the external face, zero-weighted edges u′ ivi, (2) contract each zero-weighted strongly connected subgraph into a single node, (3) delete v′ all self-loops, and (4) delete all except one copy of each set of multiple edges with minimum weight. Thus, the rest of the proof assumes that u1, . . . , uℓ, vℓ, . . . , v1 are distinct and G does not have any zero-weighted cycles, implying that all shortest paths of G are simple. i, and ∞-weighted edges uiu′ iui and viv′ Let G△ be an O(n)-node bidirected plane graph obtainable in O(n) time from G by identi- fying nodes ui and vi into a new node zi for each i = 1, . . . , ℓ and then triangulating each face of size larger than 3. Let (2) r = max(1,⌈log6 2 n⌉). By Lemma 5.1, an r-division D0 for G△ can be computed in O(n) time. Let D1 be the division of G induced by D0: Each piece of D1 is obtained from a piece of D0 by deleting the edges added to triangulate faces of size larger than 3. Each piece of D0 has O(r) nodes, O(√r) boundary nodes, and O(1) holes, so does each piece of D1. Let I consist of indices 1 and ℓ and the indices i such that at least one of ui and vi is a boundary node of D1. Since each zi with i ∈ I \ {1, ℓ} is a boundary node in D0, the cardinality of I is O(n/√r). To turn both of ui and vi with i ∈ I 17 Subroutine SOLVE(a, b) If I(a, b) = ∅, then solve the (a, b)-subproblem by Lemma 5.8(1) and return. If I(a, b) 6= ∅, then let i be a median of I(a, b) and let P (respectively, P ′) be a shortest uivi-path whose first (respectively, last) c edges can be obtained in O(c log log r) time. Case 1: P ∩ (Pa ∪ Pb) = ∅. Let Pi = P . Call LABEL(Pi), SOLVE(a, i), and SOLVE(i, b). Return. Case 2: P ∩ (Pa ∪ Pb) 6= ∅. • Call LABEL(P [ui, x]), where x is the first node of P in Pa ∪ Pb. • Call LABEL(P ′[y, vi]), where y is the last node of P ′ in P [ui, x] ∪ Pa ∪ Pb. Case 2(1): y ∈ Pa ∪ Pb. Let j be the index in {a, b} with x ∈ Pj. • If y /∈ Pj, then solve the (a, b)-subproblem by Lemma 5.8(2) with Z = {x, y}. Return. • If y ∈ Pj, then let Pi = P [ui, x]Pj [x, y]P ′[y, vi], implying w(Pi ∩ Pj) = φ(y) − φ(x). – If x ∈ Pa, then solve the (a, i)-subproblem by Lemma 5.8(3) and call SOLVE(i, b). Return. – If x ∈ Pb, then solve the (i, b)-subproblem by Lemma 5.8(3) and call SOLVE(a, i). Return. Case 2(2): y /∈ Pa ∪ Pb, implying y ∈ P [ui, x] and y 6= x. Let Pi = P [ui, y]P ′[y, vi]. Let Z = {x}. • If x ∈ Pa, then solve the (a, i)-subproblem by Lemma 5.8(2) and call SOLVE(i, b). Return. • If x ∈ Pb, then solve the (i, b)-subproblem by Lemma 5.8(2) and call SOLVE(a, i). Return. Figure 13: Subroutine SOLVE(a, b). into boundary nodes, we introduce O(n/r) new O(√r)-node pieces, which form a partition of the nodes ui and vi with i ∈ I. Let D be the resulting division of G. Each new piece of D has O(√r) nodes and no edges, so it has O(√r) boundary nodes and O(1) holes. Thus, D is an r-division of G such that each ui with 1 ≤ i ≤ ℓ is a boundary node in D if and only if so is vi. Let G′ be the simple bidirected plane graph with edge weights obtained from G by reversing the direction of each edge. Let D′ be the r-division of G′ corresponding to D. By Equation (2), it takes O(n log log n) time to compute K(D) and K(D′) and the data structures ensured by Lemmas 5.2 and 5.5. For any nodes x and y in a shortest path P of G, let P [x, y] denote the xy-path of P . We need a subroutine LABEL(P ) to compute label φ(z) for each node z of a shortest path P of G under the assumption that φ(z) for at most one node of P is pre-computed: Let z∗ be the node with pre-computed φ(z∗). If there is no such a node, then let z∗ be an arbitrary node of P and let φ(z∗) = 0. For each node z that precedes z∗ in P , let φ(z) = φ(z∗) − w(P [z, z∗]). For each node z that succeeds z∗ in P , let φ(z) = φ(z∗) + w(P [z, z∗]). Subroutine LABEL(P ) runs in O(1) time per node of P and does not overwrite φ(z) for any z with pre-computed φ(z). After running LABEL(P ), for any nodes x and y of P , w(P [x, y]) can be obtained from φ(y) − φ(x) in O(1) time. For any indices a and b, let set I(a, b) consist of the indices i ∈ I with a < i < b. For each i ∈ {1, ℓ}, let Pi be a shortest uivi-path of G obtainable in O(n) time by Lemma 3.2. If P1 ∩ Pℓ 6= ∅, then the lemma follows from Lemma 5.8(2) with Z = {x} for an arbitrary node x ∈ P1 ∩ Pℓ. The rest of the proof assumes P1 ∩ Pℓ = ∅. The algorithm proving the lemma calls LABEL(P1), LABEL(Pk), and SOLVE(1, ℓ), where the main subroutine SOLVE(a, b), as defined in Figure 13 and elaborated below, solves the (a, b)-subproblem of computing di for all indices i with a ≤ i ≤ b under the condition that 18 ua ui ub va vi vb x y (a) ua x y ui ub va vi vb ua ui ub x y va vi vb (b) (c) Figure 14: Illustrations for the proof of Lemma 4.1. All Pa and Pb are in black. Each P [ui, x] is in red dots. Each P ′[y, vi] is in blue dashes. • shortest uava-path Pa of G and shortest ubvb-path Pb of G are disjoint, • φ(z) is pre-computed for each node z ∈ Pa ∪ Pb, and • the set X(a, b) of boundary nodes of D in G[Pa, Pb] is given. By Equation (2), it remains to prove that SOLVE(1, ℓ) correctly solves the (1, ℓ)-subproblem in O(n log r) time. If I(a, b) = ∅, then all ui with a < i < b are not boundary nodes in D. Since these ui induce a connected subgraph of G, they belong to a common piece of D, implying b − a = O(r). The (a, b)-subproblem can be solved by Lemma 5.8(1) in O(h(a, b) log r) time, where h(a, b) is the number of nodes in G[Pa, Pb] that are not in Pa ∩ Pb. For the case with I(a, b) 6= ∅, we cannot afford to directly compute a shortest uivi-path Pi of G for a median i of I(a, b) by Lemma 3.2. Instead, in the subgraph of K(D) induced by the given set X(a, b) of boundary nodes of D in G[Pa, Pb], we compute a shortest uivi-path Π (respectively, Π′) of K(D) (respectively, K(D′)), the first (respectively, last) c edges of whose underlying path P (respectively, P ′) can be obtained in O(c log log r) time by Lemma 5.2. By Lemma 5.7, G[Pa, Pb] contains at least one shortest uivi-path of G, implying that the subgraph of K(D) induced by X(a, b) contains at least one shortest uivi-path of K(D). Therefore, P and P ′ are shortest uivi-paths of G in G[Pa, Pb]. If P does not intersect Pa ∪ Pb, then it takes O(log log r) time per node to obtain P . As in Case 1 of Figure 13, the subroutine lets Pi = P and calls LABEL(Pi), SOLVE(a, i), and SOLVE(i, b). If P intersects Pa ∪ Pb, it takes O(log log r) time per node to obtain P [ui, x] and P ′[y, vi], where x is the first node of P in Pa ∪ Pb and y is the last node of P ′ in P [ui, x] ∪ Pa ∪ Pb, as stated by the first two bullets in Case 2 of Figure 13. The subroutine calls LABEL(P [ui, x]) and LABEL(P ′[y, vi]). • As illustrated by Figure 14(a), if each of Pa and Pb contains exactly one of x and y, then the (a, b)-subproblem is solved in O(h(a, b)) time by Lemma 5.8(2) with Z = {x, y}, as stated by the first bullet in Case 2(1) of Figure 13. • As illustrated by Figure 14(b), if x, y ∈ Pa, then let Pi = P [ui, x]Pa[x, y]P ′[y, vi]. The (i, b)-subproblem is solved by calling SOLVE(i, b). The (a, i)-subproblem is solved by Lemma 5.8(3) with w(Pa ∩ Pi) = φ(y) − φ(x) in O(h(a, b)) time. The case with x, y ∈ Pb is similar. The second bullet of Case 2(1) in Figure 13 states these two cases. • As illustrated by Figure 14(c), if x ∈ Pa and y /∈ Pa ∪ Pb, then the shortest uivi-path Pi = P [ui, y]P ′[y, vi] is disjoint with Pa ∪ Pb. The (i, b)-subproblem is solved by call- ing SOLVE(i, b). Since at least one shortest uivi-path of G[Pa, Pi] passes x, the (a, i)- subproblem can be solved in O(h(a, b)) time by Lemma 5.8(2) with Z = {x}. The case with x ∈ Pb and y /∈ Pa ∪ Pb is similar. Case 2(2) in Figure 13 states these two cases. 19 The correctness holds trivially, since each di with 1 ≤ i ≤ ℓ is computed somewhere during the execution of SOLVE(1, ℓ) by Lemma 5.8. Since i is chosen to be a median of I(a, b) in each subroutine call to SOLVE(a, b), there are O(log n) levels of recursion in executing SOLVE(1, ℓ). Let m(a, b) be the sum of the multiplicities of the nodes of X(a, b) in D. By Lemma 5.5, the time for computing Π and Π′ is O(m(a, b) log2 m(a, b)). In order to maintain the condition that X(a, b) is given whenever SOLVE(a, b) is called, we apply Lemma 5.6 to obtain X(a, i) and X(i, b) in O((m(a, b) + mi) log r) time before calling SOLVE(a, i) or SOLVE(i, b), where mi is the number of edges in Pi \ (Pa ∪ Pb). Since Pa and Pb are disjoint, each boundary node of D is contained by one or two subgraphs G[Pa, Pb] of the same recursion level. Since there are O(n/r) pieces of D and each piece of D has O(√r) boundary nodes, the sum of m(a, b) over all subgraphs G[Pa, Pb] at the same recursion level is O(n/√r). Since each edge of G appears in at most one Pi \ (Pa ∪ Pb) for all subroutine calls to SOLVE(a, b), the sum of all mi throughout the execution of SOLVE(1, ℓ) is O(n). By Equation (2), the overall time for computing Π and Π′ is O(cid:18)log n · n √r log2 n(cid:19) = O(n). The overall time of finding all paths P , P [ui, x], and P ′[y, vi] is O(n log log r), since their edges are disjoint and all of them are obtainable in O(log log r) time per node. Therefore, the running time of SOLVE(1, ℓ) is dominated by the sum of the O(h(a, b) log r) time for solving the (a, b)- subproblems by Lemmas 5.8(1), 5.8(2), and 5.8(3) at the bottom of recursion. Since the sum of h(a, b) over all these (a, b)-subproblems is O(n), the running time of SOLVE(1, ℓ) is O(n log r). The lemma is proved. 6 Concluding remarks We give the first known O(n log n log log n)-time algorithms for finding a minimum cut and a shortest cycle in an n-node simple directed planar graph G with nonnegative edge weights. For the case that G is restricted to be unweighted, our shortest-cycle algorithm remains the best known result for the shortest-cycle problem. The best algorithm for the minimum-cut problem, running in O(n log n) time, is obtained by plugging in the O(n)-time minimum st- cut algorithm of, e.g., Brandes and Wagner [4] and Eisenstat and Klein [13] to a directed version of the reduction algorithm of Chalermsook et al. [8]. Thus, an interesting future direction is to further reduce the running time of our algorithms on both problems for this special case. Extending our results to bounded-genus graphs is also of interest. Acknowledgment We thank the anonymous reviewers for helpful comments. References [1] G. Borradaile and P. N. Klein. An O(n log n) algorithm for maximum st-flow in a directed planar graph. Journal of the ACM, 56(2):9.1–9.30, 2009. [2] G. Borradaile, P. N. Klein, S. Mozes, Y. Nussbaum, and C. Wulff-Nilsen. Multiple-source multiple-sink maximum flow in directed planar graphs in near-linear time. In Proceedings of the 52nd Annual IEEE Symposium on Foundations of Computer Science, pages 170–179, 2011. 20 [3] G. Borradaile, P. Sankowski, and C. Wulff-Nilsen. Min st-cut oracle for planar graphs with near-linear preprocessing time. ACM Transactions on Algorithms, 11(3):16.1–16.29, 2015. [4] U. Brandes and D. Wagner. A linear time algorithm for the arc disjoint Menger problem in planar directed graphs. Algorithmica, 28(1):16–36, 2000. [5] S. Cabello. Finding shortest contractible and shortest separating cycles in embedded graphs. ACM Transactions on Algorithms, 6(2):24.1–24.18, 2010. [6] S. Cabello, E. W. Chambers, and J. Erickson. Multiple-source shortest paths in embedded graphs. SIAM Journal Computing, 42(4):1542–1571, 2013. [7] S. Cabello, É. Colin de Verdière, and F. Lazarus. Finding shortest non-trivial cycles in directed graphs on surfaces. In Proceedings of the 26th ACM Symposium on Computational Geometry, pages 156–165, 2010. [8] P. Chalermsook, J. Fakcharoenphol, and D. Nanongkai. A deterministic near-linear time algorithm for finding minimum cuts in planar graphs. In Proceedings of the 15th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 828–829, 2004. [9] H.-C. Chang and H.-I. Lu. Computing the girth of a planar graph in linear time. SIAM Journal on Computing, 42(3):1077–1094, 2013. [10] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms. MIT Press, 3rd edition, 2009. [11] M. Cygan, H. N. Gabow, and P. Sankowski. Algorithmic applications of Baur-Strassen's theorem: Shortest cycles, diameter and matchings. In Proceedings of the 53rd Annual IEEE Symposium on Foundations of Computer Science, pages 531–540, 2012. [12] H. Djidjev. A faster algorithm for computing the girth of planar and bounded genus graphs. ACM Transactions on Algorithms, 7(1):3.1–3.16, 2010. [13] D. Eisenstat and P. N. Klein. Linear-time algorithms for max flow and multiple-source shortest paths in unit-weight planar graphs. In Proceedings of the 45th ACM Symposium on Theory of Computing, pages 735–744, 2013. [14] J. Erickson. Maximum flows and parametric shortest paths in planar graphs. In Proceed- ings of the 21st Annual ACM-SIAM Symposium on Discrete Algorithms, pages 794–804, 2010. [15] J. Erickson, K. Fox, and A. Nayyeri. Global minimum cuts in surface embedded graphs. In Proceedings of the 23rd Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1309– 1318, 2012. [16] J. Erickson and S. Har-Peled. Optimally cutting a surface into a disk. Discrete & Computa- tional Geometry, 31(1):37–59, 2004. [17] J. Erickson and A. Nayyeri. Minimum cuts and shortest non-separating cycles via homol- ogy covers. In Proceedings of the 22nd Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1166–1176, 2011. [18] J. Erickson and A. Nayyeri. Shortest non-crossing walks in the plane. In Proceedings of the 22nd Annual ACM-SIAM Symposium on Discrete Algorithms, pages 297–208, 2011. 21 [19] J. Erickson and P. Worah. Computing the shortest essential cycle. Discrete & Computational Geometry, 44(4):912–930, 2010. [20] J. Fakcharoenphol and S. Rao. Planar graphs, negative weight edges, shortest paths, and near linear time. Journal of Computer and System Sciences, 72(5):868–889, 2006. [21] K. Fox. Shortest non-trivial cycles in directed and undirected surface graphs. In Pro- ceedings of the 24th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 352–364, 2013. [22] K. Fox. Fast algorithms for surface embedded graphs via homology. PhD thesis, University of Illinois at Urbana-Champaign, 2014. [23] G. N. Frederickson. Fast algorithms for shortest paths in planar graphs, with applications. SIAM Journal on Computing, 16(6):1004–1022, 1987. [24] H. N. Gabow. A matroid approach to finding edge connectivity and packing arbores- cences. Journal of Computer and System Sciences, 50(2):259–273, 1995. [25] H. N. Gabow and R. E. Tarjan. Faster scaling algorithms for network problems. SIAM Journal on Computing, 18(5):1013–1036, 1989. [26] P. Gawrychowski, S. Mozes, and O. Weimann. Submatrix maximum queries in Monge matrices are equivalent to predecessor search. In B. Speckmann, editor, Proceedings of the 42nd International Colloquium on Automata, Languages, and Programming, pages 580-592, 2015. [27] A. V. Goldberg. Scaling algorithms for the shortest paths problem. SIAM Journal on Com- puting, 24(3):494–504, 1995. [28] R. E. Gomory and T. C. Hu. Multi-terminal network flows. Journal of the SIAM, 9(4):551– 570, 1961. [29] M. T. Goodrich. Planar separators and parallel polygon triangulation. Journal of Computer and System Sciences, 51(3):374–389, 1995. [30] J. Hao and J. B. Orlin. A faster algorithm for finding the minimum cut in a directed graph. Journal of Algorithms, 17(3):424–446, 1994. [31] M. R. Henzinger, P. N. Klein, S. Rao, and S. Subramanian. Faster shortest-path algorithms for planar graphs. Journal of Computer and System Sciences, 55(1):3–23, 1997. [32] A. Itai and M. Rodeh. Finding a minimum circuit in a graph. SIAM Journal on Computing, 7(4):413–423, 1978. [33] G. F. Italiano, Y. Nussbaum, P. Sankowski, and C. Wulff-Nilsen. Improved algorithms for min cut and max flow in undirected planar graphs. In Proceedings of the 43rd ACM Symposium on Theory of Computing, pages 313–322, 2011. [34] L. Janiga and V. Koubek. Minimum cut in directed planar networks. Kybernetika, 28(1):37– 49, 1992. [35] H. Kaplan, S. Mozes, Y. Nussbaum, and M. Sharir. Submatrix maximum queries in Monge In Proceedings of the 23rd matrices and Monge partial matrices, and their applications. Annual ACM-SIAM Symposium on Discrete Algorithms, pages 338–355, 2012. 22 [36] H. Kaplan and Y. Nussbaum. Minimum s-t cut in undirected planar graphs when the source and the sink are close. In T. Schwentick and C. Dürr, editors, Proceedings of the 28th International Symposium on Theoretical Aspects of Computer Science, pages 117–128, 2011. [37] D. R. Karger. Minimum cuts in near-linear time. Journal of the ACM, 47(1):46–76, 2000. [38] K.-i. Kawarabayashi and M. Thorup. Deterministic global minimum cut of a simple graph In Proceedings of the 47th ACM Symposium on Theory of Computing, in near-linear time. pages 665–674, 2015. [39] S. Khuller and J. Naor. Flow in planar graphs: A survey of recent results. In Planar Graphs, DIMACS Series in Discrete Math and Theoretical Computer Science 9, pages 59–84. AMS, 1993. [40] P. N. Klein. Multiple-source shortest paths in planar graphs. In Proceedings of the 16th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 146–155, 2005. [41] P. N. Klein, S. Mozes, and C. Sommer. Structured recursive separator decompositions for planar graphs in linear time. In Proceedings of the 45th ACM Symposium on Theory of Computing, pages 505–514, 2013. [42] P. N. Klein, S. Mozes, and O. Weimann. Shortest paths in directed planar graphs with neg- ative lengths: A linear-space O(n log2 n)-time algorithm. ACM Transactions on Algorithms, 6(2):30.1–30.18, 2010. [43] J. Ł acki, Y. Nussbaum, P. Sankowski, and C. Wulff-Nilsen. Single source - all sinks max flows in planar digraphs. In Proceedings of the 53rd Annual IEEE Symposium on Foundations of Computer Science, pages 599–608, 2012. [44] J. Ł acki and P. Sankowski. Min-cuts and shortest cycles in planar graphs in O(n log log n) time. In Proceedings of the 19th Annual European Symposium on Algorithms, pages 155–166, 2011. [45] H.-C. Liang. Minimum cuts and shortest cycles in directed planar graphs via shortest non-crossing paths. Master's thesis, National Taiwan University, July 2015. [46] H.-C. Liang and H.-I. Lu. Minimum cuts and shortest cycles in directed planar graphs via noncrossing shortest paths. SIAM Journal on Discrete Mathematics, 31(1):454–476, 2017. [47] A. Lingas and E.-M. Lundell. Efficient approximation algorithms for shortest cycles in undirected graphs. Information Processing Letters, 109(10):493–498, 2009. [48] R. J. Lipton and R. E. Tarjan. A separator theorem for planar graphs. SIAM Journal on Applied Mathematics, 36:177–189, 1979. [49] B. Monien. The complexity of determining a shortest cycle of even length. Computing, 31(4):355–369, 1983. [50] R. Motwani and P. Raghavan. Randomized Algorithms. Cambridge University Press, 1995. [51] S. Mozes, C. Nikolaev, Y. Nussbaum, and O. Weimann. Minimum cut of directed planar graphs in O(n log log n) time. Computing Research Repository, December 2015. http://arxiv.org/abs/1512.02068. 23 [52] S. Mozes and C. Wulff-Nilsen. Shortest paths in planar graphs with real lengths in O(n log2 n/ log log n) time. In M. de Berg and U. Meyer, editors, Proceedings of the 18th An- nual European Symposium on Algorithms, Lecture Notes in Computer Science 6347, pages 206–217. Springer, 2010. [53] K. Mulmuley, U. V. Vazirani, and V. V. Vazirani. Matching is as easy as matrix inversion. Combinatorica, 7(1):105–113, 1987. [54] H. Nagamochi and T. Ibaraki. Computing edge-connectivity in multigraphs and capaci- tated graphs. SIAM Journal on Discrete Mathematics, 5(1):54–66, 1992. [55] J. B. Orlin. Max flows in O(nm) time, or better. In Proceedings of the 45th ACM Symposium on Theory of Computing, pages 765–774, 2013. [56] E. Papadopoulou. k-pairs non-crossing shortest paths in a simple polygon. International Journal of Computational Geometry and Applications, 9(6):533–552, 1999. [57] V. Polishchuk and J. S. B. Mitchell. Thick non-crossing paths and minimum-cost flows in polygonal domains. In Proceedings of the 23rd ACM Symposium on Computational Geometry, pages 56–65, 2007. [58] J. H. Reif. Minimum s-t cut of a planar undirected network in O(n log2 n) time. SIAM Journal on Computing, 12(1):71–81, 1983. [59] L. Roditty and R. Tov. Approximating the girth. ACM Transactions on Algorithms, 9(2):15.1– 15.13, 2013. [60] L. Roditty and V. Vassilevska Williams. Subquadratic time approximation algorithms for the girth. In Proceedings of the 23rd Annual ACM-SIAM Symposium on Discrete Algorithms, pages 833–845, 2012. [61] M. Stoer and F. Wagner. A simple min-cut algorithm. Journal of the ACM, 44(4):585–591, 1997. [62] J. Takahashi, H. Suzuki, and T. Nishizeki. Finding shortest non-crossing rectilinear paths in plane regions. In Proceedings of the 4th International Symposium on Algorithms and Com- putation, pages 98–107, 1993. [63] J.-y. Takahashi, H. Suzuki, and T. Nishizeki. Shortest noncrossing paths in plane graphs. Algorithmica, 16(3):339–357, 1996. [64] V. Vassilevska Williams. Multiplying matrices faster than Coppersmith-Winograd. In Proceedings of the 44th ACM Symposium on Theory of Computing, pages 887–898, 2012. [65] V. Vassilevska Williams and R. Williams. Subcubic equivalences between path, matrix and triangle problems. In Proceedings of the 51st Annual IEEE Symposium on Foundations of Computer Science, pages 645–654, 2010. [66] K. Weihe. Edge-disjoint (s, t)-paths in undirected planar graphs in linear time. Journal of Algorithms, 23(1):121–138, 1997. [67] O. Weimann and R. Yuster. Computing the girth of a planar graph in O(n log n) time. SIAM Journal on Discrete Mathematics, 24(2):609–616, 2010. 24 [68] C. Wulff-Nilsen. Algorithms for planar graphs and graphs in metric spaces. PhD thesis, Uni- versity of Copenhagen, 2010. [69] R. Yuster. A shortest cycle for each vertex of a graph. Information Processing Letters, 111(21- 22):1057–1061, 2011. [70] R. Yuster and U. Zwick. Finding even cycles even faster. SIAM Journal on Discrete Mathe- matics, 10(2):209–222, 1997. 25
1903.02999
2
1903
2019-04-23T17:26:24
Tiers for peers: a practical algorithm for discovering hierarchy in weighted networks
[ "cs.DS" ]
Interactions in many real-world phenomena can be explained by a strong hierarchical structure. Typically, this structure or ranking is not known; instead we only have observed outcomes of the interactions, and the goal is to infer the hierarchy from these observations. Discovering a hierarchy in the context of directed networks can be formulated as follows: given a graph, partition vertices into levels such that, ideally, there are only edges from upper levels to lower levels. The ideal case can only happen if the graph is acyclic. Consequently, in practice we have to introduce a penalty function that penalizes edges violating the hierarchy. A practical variant for such penalty is agony, where each violating edge is penalized based on the severity of the violation. Hierarchy minimizing agony can be discovered in $O(m^2)$ time, and much faster in practice. In this paper we introduce several extensions to agony. We extend the definition for weighted graphs and allow a cardinality constraint that limits the number of levels. While, these are conceptually trivial extensions, current algorithms cannot handle them, nor they can be easily extended. We solve the problem by showing the connection to the capacitated circulation problem, and we demonstrate that we can compute the exact solution fast in practice for large datasets. We also introduce a provably fast heuristic algorithm that produces rankings with competitive scores. In addition, we show that we can compute agony in polynomial time for any convex penalty, and, to complete the picture, we show that minimizing hierarchy with any concave penalty is an NP-hard problem.
cs.DS
cs
Noname manuscript No. (will be inserted by the editor) Tiers for peers a practical algorithm for discovering hierarchy in weighted networks Nikolaj Tatti 9 1 0 2 r p A 3 2 ] S D . s c [ 2 v 9 9 9 2 0 . 3 0 9 1 : v i X r a the date of receipt and acceptance should be inserted later Abstract Interactions in many real-world phenomena can be explained by a strong hierarchical structure. Typically, this structure or ranking is not known; instead we only have observed outcomes of the interactions, and the goal is to infer the hierarchy from these observations. Discovering a hierarchy in the context of directed networks can be formulated as follows: given a graph, par- tition vertices into levels such that, ideally, there are only edges from upper levels to lower levels. The ideal case can only happen if the graph is acyclic. Consequently, in practice we have to introduce a penalty function that penal- izes edges violating the hierarchy. A practical variant for such penalty is agony, where each violating edge is penalized based on the severity of the violation. Hierarchy minimizing agony can be discovered in O(cid:0)m2(cid:1) time, and much faster in practice. In this paper we introduce several extensions to agony. We extend the definition for weighted graphs and allow a cardinality constraint that limits the number of levels. While, these are conceptually trivial extensions, current algorithms cannot handle them, nor they can be easily extended. We solve the problem by showing the connection to the capacitated circulation problem, and we demonstrate that we can compute the exact solution fast in practice for large datasets. We also introduce a provably fast heuristic algorithm that produces rankings with competitive scores. In addition, we show that we can compute agony in polynomial time for any convex penalty, and, to complete the picture, we show that minimizing hierarchy with any concave penalty is an NP-hard problem. Keywords Hierarchy discovery; agony; capacitated circulation; weighed graphs The research described in this paper builds upon and extends the work appearing in ICDM15 as [20]. Nikolaj Tatti Helsinki Institute for Information Technology (HIIT) and Department of Information and Computer Science, Aalto University, Finland E-mail: [email protected] 2 1 Introduction Nikolaj Tatti Interactions in many real-world phenomena can be explained by a strong hi- erarchical structure. As an example, it is more likely that a line manager in a large, conservative company will write emails to her employees than the other way around. Typically, this structure or ranking is not known; instead we only have observed outcomes of the interactions, and the goal is to infer the hierarchy from these observations. Discovering hierarchies or ranking has applications in various domains: (i) ranking individual players or teams based on how well they play against each other [4], (ii) discovering dominant animals within a single herd, or ranking species based on who-eats-who networks [9], (iii) inferring hierarchy in work-places, such as, U.S. administration [12], (iv ) summarizing browsing behaviour [11], (v ) discovering hierarchy in social net- works [7], for example, if we were to rank twitter users, the top-tier users would be the content-providers, middle-tiers would spread the content, while the bottom-tier are the consumers. We consider the following problem of discovering hierarchy in the context of directed networks: given a directed graph, partition vertices into ranked groups such that there are only edges from upper groups to lower groups. Unfortunately, such a partitioning is only possible when the input graph has no cycles. Consequently, a more useful problem definition is to define a penalty function p on the edges. This function should penalize edges that are violating a hierarchy. Given a penalty function, we are then asked to find the hierarchy that minimizes the total penalty. The feasibility of the optimization problem depends drastically on the choice of the penalty function. If we attach a constant penalty to any edge that violates the hierarchy, that is, the target vertex is ranked higher or equal than the source vertex, then this problem corresponds to a feedback arc set problem, a well-known NP-hard problem [2], even without a known constant- time approximation algorithm [5]. A more practical variant is to penalize the violating edges by the severity of their violation. That is, given an edge (u, v) we compare the ranks of the vertices r(u) and r(v) and assign a penalty of max(r(u) − r(v) + 1, 0). Here, the edges that respect the hierarchy receive a penalty of 0, edges that are in the same group receive a penalty of 1, and penalty increases linearly as the violation becomes more severe, see Figure 1. This particular score is referred as agony. Minimizing agony was introduced by Gupte et al. [7] where the authors is the number of edges. A faster discovery algorithm with the computational provide an exact O(cid:0)nm2(cid:1) algorithm, where n is the number of vertices and m complexity of O(cid:0)m2(cid:1) was introduced by Tatti [19]. In practice, the bound O(cid:0)m2(cid:1) is very pessimistic and we can compute agony for large graphs in reasonable time. In this paper we specifically focus on agony, and provide the following main extensions for discovering hierarchies in graphs. weighted graphs: We extend the notion of the agony to graphs with weighted edges. Despite being a conceptually trivial extension, current algo- Tiers for peers 3 rithms [7, 19] for computing agony are specifically design to work with unit weights, and cannot be used directly or extended trivially. Consequently, we need a new approach to minimize the agony, and in order to do so, we demon- strate that we can transform the problem into a capacitated circulation, a classic graph task known to have a polynomial-time algorithm. cardinality constraint: The original definition of agony does not restrict the number of groups in the resulting partition. Here, we introduce a cardinal- ity constraint k and we are asking to find the optimal hierarchy with at most k groups. This constraint works both with weighted and non-weighted graphs. Current algorithms for solving agony cannot handle cardinality constraints. Luckily, we can enforce the constraint when we transform the problem into a capacitated circulation problem. fast heuristic: We introduce a fast divide-and-conquer heuristic. This heuristic is provably fast, see Table 1, and -- in our experiments -- produces competitive scores when compared to the optimal agony. convex edge penalties: Minimizing agony uses linear penalty for edges. We show that if we replace the linear penalty with a convex penalty, see Fig- ure 1, we can still solve the problem in polynomial time by the capacitated circulation solver. However, this extension increases the computational com- plexity. concave edge penalties: To complete the picture, we also study concave edge penalties, see Figure 1. We show that in this case discovering the optimal hierarchy is an NP-hard problem. This provides a stark difference between concave and convex edge penalties. canonical solution: A hierarchy minimizing agony may not be unique. For example, given a DAG any topological sorting of vertices will give you an optimal agony of 0. To address this issue we propose to compute a canonical solution, where, roughly speaking, the vertices are ranked as high as possible without compromising the optimality of the solution. We demonstrate that this solution is unique, it creates a hierarchy with the least amount of groups, and that we can compute it in O(n log n + m) time, if we are provided with the optimal solution and the flow resulted from solving the capacitated circulation. y t l a n e p e g d e 6 4 2 0 −3 −2 −1 3 rank difference, r(u) − r(v) 0 1 2 convex (polynomial) linear = agony (polynomial) concave (NP-hard) constant = FAS (NP-hard) 4 5 Fig. 1 A toy example of edge penalties as a function of the rank difference between the vertices. 4 Nikolaj Tatti Table 1 Summary of running times of different algorithms for computing agony: n is the number of vertices, m is the number of edges, k is the number of allowed ranks. Algorithm variant input type running time Exact Exact Exact Canonical Heuristic Heuristic Heuristic Heuristic plain speed-up speed-up -- plain plain SCC SCC unweighted weighted optimal rank and the flow no cardinality constraint cardinality constraint no cardinality constraint cardinality constraint O(m log n(m + n log n)) O(m(min(kn, m) + n log n)) O(m log n(m + n log n)) O(m + n log n) O(m log n) O(cid:0)m log n + k2n(cid:1) O(m log n) O(cid:0)m log n + k2n + km log n(cid:1) This paper is an extension of a conference paper [20]. In this extension we significantly speed-up the exact algorithm, propose a provably fast heuristic, and provide a technique for selecting unique canonical solutions among the optimal rankings. The rest of the paper is organized as follows. We introduce the notation and formally state the optimization problem in Section 2. In Section 3 we transform the optimization problem into a capacitated circulation problem, allowing us a polynomial-time algorithm, and provide a speed-up in Section 4. In Section 5 we discuss alternative edge penalties. We demonstrate how to extract a canonical optimal solution in Section 6. We discuss the related work in Section 8 and present experimental evaluation in Section 9. Finally, we conclude the paper with remarks in Section 10. 2 Preliminaries and problem definition We begin with establishing preliminary notation and then defining the main problem. The main input to our problem is a weighted directed graph which we will denote by G = (V, E, w), where w is a function mapping an edge to a real positive number. If w is not provided, we assume that each edge has a weight of 1. We will often denote n = V and m = E. As mentioned in the introduction, our goal is to partition vertices V . We express this partition with a rank assignment r, a function mapping a vertex to an integer. To obtain the groups from the rank assignment we simply group the vertices having the same rank. Given a graph G = (V, E) and a rank assignment r, we will say that an edge (u, v) is forward if r(u) < r(v), otherwise edge is backward, even if r(u) = r(v). Ideally, rank assignment r should not have backward edges, that is, for any (u, v) ∈ E we should have r(u) < r(v). However, this is only possible when G is a DAG. For a more general case, we assume that we are given a penalty function p, mapping an integer to a real number. The penalty for a single edge (u, v) is then equal to p(d), where d = r(u)−r(v). If p(d) = 0, whenever d < 0, then the forward edges will receive 0 penalty. Tiers for peers 5 We highlight two penalty functions. The first one assigns a constant penalty to each backward edge, pc(d) =(1 0 if d ≥ 0 otherwise . The second penalty function assigns a linear penalty to each backward edge, pl (d) = max(0, d + 1) . For example, an edge (u, v) with r(u) = r(v) is penalized by pl (r(u) − r(v)) = 1, the penalty is equal to 2 if r(u) = r(v) + 1, and so on. Given a penalty function and a rank assignment we can now define the the score for the ranking to be the sum of the weighted penalties. Definition 1 Assume a weighted directed graph G = (V, E, w) and a rank assignment r. Assume also a cost function p mapping an integer to a real number. We define a score for a rank assignment to be q(G, r, p) = Xe=(u,v)∈E w(e)p(r(u) − r(v)) . We will refer the score q(G, r, pl ) as agony. Example 1 Consider the left ranking r1 of a graph G given in Figure 2. This ranking has 5 backward edges, consequently, the penalty is q(G, r1, pc) = 5. On the other hand, there are 2 edges, (i, a) and (e, g), having the agony of 1. Moreover, 2 edges has agony of 2 and (d, b) has agony of 3. Hence, agony is equal to q(G, r1, pl ) = 2 × 1 + 2 × 2 + 1 × 3 = 10 . The agony for the right ranking r2 is q(G, r2, pl ) = 7. Consequently, r2 yields a better ranking in terms of agony. a c e f h g i b d i b d f g a c e h Fig. 2 Toy graphs. Backward edges are represented by dotted lines, while the forward edges are represented by solid lines. Ranks are represented by dashed grey horizontal lines. We can now state our main optimization problem. Problem 1 Given a graph G = (V, E, w), a cost function p, and an integer k, find a rank assignment r minimizing q(r, G) such that 0 ≤ r(v) ≤ k − 1 for every v ∈ V . We will denote the optimal score by q(G, k, p). 6 Nikolaj Tatti We should point out that we have an additional constraint by demanding that the rank assignment may have only k distinct values, that is, we want to find at most k groups. Note that if we assume that the penalty function is non- decreasing and does not penalize the forward edges, then setting k = V is equivalent of ignoring the constraint. This is the case since there are at most V groups and we can safely assume that these groups obtain consecutive ranks. However, an optimal solution may have less than k groups, for example, if G has no edges and we use pl (or pc), then a rank assigning each vertex to 0 yields the optimal score of 0. We should also point out that if using pc, there is always an optimal solution where each vertex has its own rank. This is not the case for agony. It is easy to see that minimizing q(G, pc) is equivalent to finding a directed acyclic subgraph with as many edges as possible. This is known as Feedback Arc Set (FAS) problem, which is NP-complete [2]. On the other hand, if we assume that G has unit weights, and set k = V , then minimizing agony has a polynomial-time O(cid:0)m2(cid:1) algorithm [7, 19]. 3 Computing agony In this section we present a technique for minimizing agony, that is, solving Problem 1 using pl as a penalty. In order to do this we show that this problem is in fact a dual problem of the known graph problem, closely related to the minimum cost max-flow problem. 3.1 Agony with shifts We begin with an extension to our optimization problem. Problem 2 (Agony-with-shifts) Given a graph G = (V, E, w, s), where w maps an edge to a, possibly infinite, non-negative value, and s maps an edge to a possibly negative integer, find a rank assignment r minimizing Xe=(u,v)∈E w(e) × max(r(u) − r(v) + s(e), 0) . We denote the optimal sum with q(G). In order to transform the problem of minimizing agony to Agony-with- shifts, assume a graph G = (V, E, w) and an integer k. We define a graph H = (W, F, w, s) as follows. The vertex set W consists of 2 groups: (i) V vertices, each vertex corresponding to a vertex in G (ii) 2 additional vertices α and ω. For each edge e = (u, v) ∈ E, we add an edge f = (u, v) to F . We set w(f ) = w(e) and s(f ) = 1. We add edges (v, ω) and (α, v) for every v ∈ V with s(v, ω) = s(α, v) = 0 and w(v, ω) = w(α, v) = ∞. Finally we add (ω, α) with s(ω, α) = 1 − k and w(ω, α) = ∞. We will denote this graph by H (G, k) = H. Tiers for peers 7 a 1 b 2 1 1 G c d α 1(1) a b 1 ( 2 ) 1(1) d 1 ( 2 ) c H (G, 4) ω −3(∞) Fig. 3 Toy graph G and the related circulation graph H (G, 4). Edge costs and shifts for (α, v) and (v, ω) are omitted to avoid clutter. Example 2 Consider G = (V, E), a graph with 4 vertices and 4 edges, given in Figure 3. Set cardinality constraint k = 4. In order to construct H (G, k) we add two additional vertices α and ω to enforce the cardinality constraint k. We set edge costs to −1 and edges capacities to be the weights of the input graph. We connect α and ω with a, b, c, and d, and finally we connect ω to α. The resulting graph is given in Figure 3. 3.2 Agony is a dual problem of Circulation Minimizing agony is closely related to a circulation problem, where the goal is to find a circulation with a minimal cost satisfying certain balance equations. Problem 3 (Capacitated circulation) Given a graph G = (V, E, c, s), where c maps an edge to a, possibly infinite, non-negative value, and s maps an edge to a possibly negative integer, find a flow f such that 0 ≤ f (e) ≤ c(e) for every e ∈ E and Xe=(v,u)∈E f (e) = Xe=(u,v)∈E f (e), for every v ∈ V maximizing We denote the above sum as circ(G). s(e)f (e) . Xe∈E This problem is known as capacitated circulation problem, and can be solved in O(m log n(m + n log n)) time with an algorithm presented by Orlin [14]. We should stress that we allow s to be negative. We also allow capacities for certain edges to be infinite, which simply means that f (e) ≤ c(e) is not enforced, if c(e) = ∞. The following proposition shows the connection between the agony and the capacitated circulation problem. 8 Nikolaj Tatti Proposition 1 Assume a weighted directed graph with shifts, G = (V, E, w, s). Then q(G) = circ(G). Proof Let G = (V, E, w, s). To prove this result we will show that computing circ(G) is a linear program, whose dual corresponds to optimizing Agony- with-shifts. In order to do this, we first express a general Capacitated circulation problem as a linear program, s(u, v)f (u, v) f (u, v), maximize X(u,v)∈E f (v, u) = X(u,v)∈V w(u, v) ≥ f (u, v) ≥ 0, X(v,u)∈V such that for every v ∈ V , for every (u, v) ∈ E . This program has the following dual program, η(u, v)w(u, v) minimize X(u,v)∈E such that for every (u, v) ∈ E π(v) − π(u) + η(u, v) ≥ s(u, v), π(v) − π(u) ≥ s(u, v), η(u, v) ≥ 0, if w(u, v) < ∞, if w(u, v) = ∞, (1) which is optimized over the variables π and η. If π are integers, then they correspond to the ranking r. Moreover, η(u, v) = max(π(u)−π(v)+s(u, v), 0). So that, w(u, v)η(u, v) corresponds to the penalty term in the sum of Agony-with-shifts, and the objective function of the dual program corresponds exactly to the objective of Agony-with-shifts. To complete the proof we need to show that there is an optimal integer- valued dual solution π and η. This result follows from the fact that the con- straints of the dual form an arc-vertex incidence matrix, which is known to be totally unimodular [15, Corollary of Theorem 13.3], Since s(u, v) are in- tegers, Theorem 13.2 in [15] implies that there is an optimal solution with integer-valued π, completing the proof. ⊓⊔ 3.3 Algorithm for minimizing agony Proposition 1 states that we can compute agony but it does not provide direct means to discover an optimal rank assignment. However, a closer look at the proof reveals that minimizing agony is a dual problem of Capacitated cir- culation. That is, if we were to solve the dual optimization problem given in Equation 1, then we can extract the optimal ranking from the dual parameters π by setting r(v) = π(v)− π(α) for v ∈ V , where α is the special vertex added during the construction of H. Tiers for peers 9 Luckily, the algorithms for solving Capacitated circulation by Ed- monds and Karp [3] or by Orlin [14] in fact solve Equation 1 and are guar- anteed to have integer-valued solution as long as the capacities s(u, v) are integers, which is the case for us. If we are not enforcing the cardinality constraint, that is, we are solving q(G, k) with k = V , we can obtain a significant speed-up by decomposing G to strongly connected components, and solve ranking for individual components. Proposition 2 Assume a graph G, and set k = V . Let {Ci} be the strongly connected components of G, ordered in a topological order. Let ri be the rank- ing minimizing q(G(Ci),Ci). Let bi = Pi−1 j=1 Cj. Then the ranking r(v) = ri(v) + bi, where Ci is the component containing v, yields the optimal score q(G, k). Proof Note that max r(v) ≤ k, hence r is a valid ranking. Let r′ be the ranking minimizing q(G, k). Let r′ i be the projection of the ranking to Ci. Then q(G, r′) ≥Xi=1 q(G(Ci), r′ i) ≥Xi=1 q(G(Ci), ri) = q(G, r) , where the last equality holds because any cross-edge between the components is a forward edge. ⊓⊔ 4 Speeding up the circulation solver In this section we propose a modification to the circulation solver. This modi- fication provides us with a modest improvement in computational complexity, and -- according to our experimental evaluation -- significant improvement in running time in practice. Before explaining the modification, we first need to revisit the original Orlin's algorithm. We refer the reader to [14] for a complete expose. The solver actually solves a slightly different problem, namely, an unca- pacitated circulation. Problem 4 (Circulation) Given a directed graph F = (W, A, t, b) with weights on edges and biases on vertices, find a flow f such that 0 ≤ f (e) for every e ∈ A and X(v,u)∈A f (v, u) − X(u,v)∈A (2) f (u, v) = b(v), for every v ∈ W minimizing t(u, v)f (u, v) . X(u,v)∈A 10 Nikolaj Tatti To map our problem to Circulation, we us the trick described by Orlin [14]: we replace each capacitated edge e = (v, w) with a vertex u and two edges (v, u) and (w, u). We set b(u) = −c(e), and add c(v, w) to b(w). The costs are set to t(v, u) = max(−s(e), 0) and t(w, u) = max(s(e), 0). For each uncapacitated edge (v, w), we connect v to w with t(v, w) = −s(v, w).1 From now on, we will write H = H (G, k), and F = (W, A, s, b) to be the graph modified as above. We split W to W1 and W2: W1 are the original vertices in H, while W2 are the vertices rising from the capacitated edges. We also write n and m to be the number of vertices and edges in H, respectively, and n′ and m′ to be the number of vertices and edges in F , respectively. Note that n′, m′ ∈ O(m). Consider the dual of uncapacitated circulation. Problem 5 (dual to Circulation) Given a directed graph F = (W, A, s, b) with weights on edges and biases on vertices, find dual variables π on vertices maximizing such that b(v)π(v) X(u,v)∈A t(e) + π(w) − π(v) ≥ 0, for every e = (v, w) ∈ A . (3) The standard linear programming theory states that f and π satisfying Eq. 2 -- 3 are optimal solutions to their respective problems if and only if the slackness conditions hold, (t(e) + π(w) − π(v))f (e) = 0, for every e = (v, w) ∈ A . (4) The main idea behind Orlin's algorithm is to maintain a flow f and a dual π satisfying Eqs. 3 -- 4, and then iteratively enforce Eq. 2. More specifically, we first define an excess of a vertex to be e(v) = b(v) + X(w,v)∈A f (w, v) − X(v,w)∈A f (v, w) . Our goal is to force e(v) = 0 for every v. This is done in gradually in multiple iterations. Assume that we are given ∆, a granularity which we will use to modify the flow. The following steps are taken: (i) We first construct a residual graph R which consists of all the original edges, and reversed edges for all edges with positive flow. (ii) We then select a source s with e(s) ≥ α∆2, and construct a shortest path tree T in R, weighted by t(e) + π(w) − π(v), for e = (v, w). (iii) The dual variables are updated to π(v) − d(v), where d is the shortest distance from s to v. (iv) We select a sink r with e(r) ≤ −α∆, and augment the flow along the path in T from r to s. This is repeated until there are no longer viable options for s or r. After that we half ∆, and repeat. 1 The reason for the minus sign is that we expressed Circulation as a minimization problem and Capacitated circulation as a maximization problem. 2 Here α is a fixed parameter 1/2 < α < 1, we use α = 3/4. Tiers for peers 11 To guarantee polynomial convergence, we also must contract edges for which f (e) ≥ 3n′∆, where n′ is the number of vertices in the (original) input graph. Assume that we contract (v, w) into a new vertex u. We set π(u) = π(v), b(u) = b(v)+b(w). We delete the edge (v, w), and edges adjacent to v and w are migrated to u; the cost of an edge t(w, x) must be changed to t(w, x) + t(v, w), and similarly the cost of an edge t(x, w) must be changed to t(x, w) − t(v, w). A high-level pseudo-code is given in Algorithm 1. Algorithm 1: Orlin's algorithm for solving Circulation. 1 ∆ ← min(max e(v), max −e(v)); 2 while there is excess do 3 4 5 6 7 8 9 10 11 contract any edges with f (e) ≥ 3n∆; while max e(v) ≥ α∆ and min e(v) ≤ −α∆ do s ← a vertex with e(s) ≥ α∆; r ← a vertex with e(r) ≤ −α∆; T ← shortest path tree from s in residual graph, weighted by t(e) + π(w) − π(v); update π using T ; P ← path in T from r to s; augment flow by ∆ along P ; ∆ ← ∆/2; The bottleneck of this algorithm is computing the shortest path tree. This is the step that we will modify. In order to do this we first point out that Orlin's algorithm relies on two things that inner loop should do: (i) Eqs. 3 -- 4 must be maintained, and (ii) path augmentations are of granularity ∆, after the augmentations there should not be a viable vertex for a source or a viable vertex for a sink. As long as these two conditions are met, the correctness proof given by Orlin [14] holds. Our first modification is instead of selecting one source s, we select all possible sources, S ← {v ∈ V e(v) ≥ α∆}, and compute the shortest path tree using S as roots. Once this tree is computed, we subtract the shortest distance from π, select a sink t, and augment flow along the path from t to some root s ∈ S. π are modified. The following lemma guarantees that Eqs. 3 -- 4 are maintained when f and Lemma 1 Let f and π be flow and dual variables satisfying the slackness conditions given in Eq. 4. Let S be a set of vertices. Define d(v) be the shortest distance from S to v in the residual graph with weighted edges t(e)+π(w)−π(v). Let π′ = π − d. Then π′ satisfy Eq. 3, and f and π′ respect the slackness conditions in Eq. 4. Moreover, t(e) + π′(w) − π′(v) = 0 for every edge in the shortest path tree. Note that since we modify f only along the edges of the shortest path tree, this lemma guarantees that Eq. 4 is also maintained when we augment f . The 12 Nikolaj Tatti proof of this lemma is essentially the same as the single-source version given by Orlin [14]. Proof Let e = (v, w) ∈ E. Then e is also in residual graph, and d(w) ≤ d(v) + t(e) + π(w) − π(v). This implies t(e) + π′(w) − π′(v) = t(e) + π(w) − d(w) − π(v) + d(v) ≥ 0, proving the first claim. If e is in the shortest path tree, then d(w) = d(v) + t(e) + π(w) − π(v), which implies the third claim, t(e) + π(w) − π(v) = 0. (w, v) = e′ is also in residual graph, we must have d(v) = d(w). Thus, To prove the second claim, if f (e) > 0, then t(e) + π(w) − π(v) = 0. Since t(e) + π′(w) − π′(v) = t(e) + π(w) − d(w) − π(v) + d(v) = 0 . This completes the proof. ⊓⊔ Once we augment f , we need to update the shortest path tree. There are three possible updates: (i) adding a flow may result in a new backward edge in the residual graph, (ii) reducing a flow may result in a removing a backward edge in the residual graph, and (iii) deleting a source from S requires that the tree is updated. In order to update the tree we will use an algorithm by Ramalingam and Reps [16] to which we will refer as rr. The pseudo-code for the modified solver is given in Algorithm 2. Algorithm 2: A modified algorithm for Circulation. 1 ∆ ← min(max e(v), max −e(v)); 2 while there is excess do 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 contract any edges with f (e) ≥ 3n′∆; S ← {v ∈ V e(v) ≥ α∆}; Q ← {v ∈ V e(v) ≤ −α∆}; T ← shortest path tree from S in residual graph, weighted by t(e) + π(w) − π(v); update π using T , see Lemma 1; while S 6= ∅ and Q 6= ∅ do select r ∈ Q; P ← path in T from r to some s ∈ S; augment flow by ∆ along P ; update residual graph; if e(s) < α∆ then delete s from S; if e(r) > −α∆ then delete r from Q; update T using [16]; update π using T , see Lemma 1; ∆ ← ∆/2; Before going further, we need to address one technical issue. rr requires that edge weights are positive, whereas we can have weights equal to 0. We solve this issue by adding ǫ = 1/n′ to each edge. Since the original weights Tiers for peers 13 are integers and a single path may have n′ − 1 edges, at most, the obtained shortest path tree is a valid shortest path tree for the original weights. We use ǫ only for computing and updating the tree; we will not use it when we update the dual variables. In order to update the tree, first note that the deleting the source s from S is essentially the same as deleting an edge: computing the tree using S as roots is equivalent to having one auxiliary root, say σ, with only edges connecting σ to S. Removing s from S is then equivalent to deleting an edge (σ, s). The update is done by first adding the new edges, and then deleting the necessary edges. We first note that the edge additions do not require any updates by rr. This is because the internal structure of rr is a subgraph of all edges that can be used to form the shortest path. Any edge that is added will be from a child to a parent, implying that it cannot participate in a shortest path.3 Proposition 3 Algorithm 2 runs in O(m(min(kn, m) + n log n)) time, as- suming G is not weighted. To prove the result we need the following lemma. Lemma 2 At any point of the algorithm, the dual variables π satisfy π(v) − π(u) ≤ k for any u, v. Proof Let us first prove that this result holds if we have done no edge contrac- tions. Let α and ω be the vertices in H, enforcing the cardinality constraint. Assume that v and w are both in W1. Then Eq. 3 guarantees that π(u) ≥ π(α) and π(ω) ≥ π(v) implying π(v) − π(u) ≤ π(ω) − π(α) ≤ t(ω, α) = k − 1 . Now assume that v (and/or u) is in W2. Then the shortest path tree connects it to a vertex x ∈ W1, and either π(u) = π(x) or π(u) = π(x) − 1. This leads to that the difference π(v) − π(u) can be at most k. To see why the lemma holds despite edge contractions, note that we can always unroll the contractions to the original graph, and obtain π′ that sat- isfies Eq. 3. Moreover, if x is a new vertex resulted from a contraction, after unrolling, there is a vertex u ∈ W such that π(x) = π′(u). This is because when we create x, we initialize π(x) to be dual of one contracted vertices. Consequently, the general case reduces to the first case. ⊓⊔ Proof (of Proposition 3) Since b(v) = −1, for v ∈ W2 and b(v) ≥ 0 for v ∈ W1, we have ∆ = 1, and after a single iteration e(v) = 0, for v ∈ W . So, we need only one outer iteration. Consequently, we only need to show that the inner loop needs O(m(min(kn, m) + n log n)) time. Let us write O to be the vertices who are either in W1, or, due to a contrac- tion, contain a vertex in W1. Let Pi be the path selected during the ith itera- i to be the number of vertices whose distance is changed4 tion. Let us write n′ 3 The edge can participate later when we delete edges. 4 taking into account the ǫ trick 14 Nikolaj Tatti during the ith iteration of the inner loop; let mi be the number of edges adja- cent to these vertices. Finally, let us write ni to be the number of vertices in O whose distance is changed. i log n′ i log n′ i) time. Ramalingam and Reps [16] showed that updating a tree during the ith iteration requires O(mi + n′ i) time. More specifically, the update algo- rithm first detects the affected vertices in O(mi) time, and then computes the new distances using a standard Dijkstra algorithm with a binomial heap in O(mi + n′ We can optimize this to O(mi + n′ i + ni log ni) by performing a trick sug- gested by Orlin: Let X be the vertices counted towards ni and let Y be the remaining vertices counted towards n′ i. A vertex in Y is either in a path be- tween two vertices in X, or is a leaf. In the latter case it may be only connected to only two (known) vertices. We can first compute the distances for X by frog- leaping the vertices in Y in O(mi + ni log ni) time. This gives us the updated distances for X and for vertices in Y that are part of some path. Then we can proceed to update the leaf vertices in Y in O(mi + ni) time. The total running time of an inner loop is then Pi + mi + n′ i + ni log ni! ⊆ O Xi i + ni log n! . O Xi First note that we can have at most O(m) terms in the sum. This is because we either have P max(e(i), 0) ≤ 2∆αn′ or P max(−e(i), 0) ≤ 2∆αn′ due to to the previous outer loop iteration, and since the contractions can only reduce these terms. Pi + mi + n′ A path from a leaf to a root in T cannot contain two consecutive vertices that are outside O. Hence, the length of a path is at most O(n). Let us now bound the number of times a single vertex, say v, needs to be updated. Assume that we have changed the distance but the dual π(v) has not changed. In other words, we have increased the ǫ part of the distance. This effectively means that π(v) remained constant but we have increased the number of edges from the vertex to the root. Since we can have at most O(n) long path, we can have at most O(n) updates without before updating π(v). Note that at least one root, say s ∈ S, will not have its dual updated until the very last iteration. Lemma 2 now implies that we can update, that is, decrease, π(v) only O(k) times. Consequently, we can only update v O(nk) times. i ∈ O(mnk), Pi ni ∈ O(cid:0)n2k(cid:1), and This immediately implies that Pi n′ Pi mi ∈ O(mnk). Since path lengths are O(n), we also havePi Pi ∈ O(mn). This gives us a total running time of O(cid:0)mn + mnk + n2k log n(cid:1) = O(nk(m + n log n)) . We obtain the final bound by alternatively bounding rr with O(m + n log n), and observing that you need only O(m) updates. ⊓⊔ The theoretical improvement is modest: we essentially replaced m with min(nk, m). However, in practice this is a very pessimistic bound, and we Tiers for peers 15 will see that this approach provides a significant speed-up. Moreover, this result suggests -- backed up by our experiments -- that the problem is easier for smaller values of k. This is opposite to the behavior of the original solver presented in [20]. Note also, that we assumed that G has no weights. If we have integral weights of at most ℓ, then the running time increases by O(log ℓ) time. 5 Alternative penalty functions We have shown that we can find ranking minimizing edge penalties pl in poly- nomial time. In this section we consider alternative penalties. More specifically, we consider convex penalties which are solvable in polynomial time, and show that concave penalties are NP-hard. 5.1 Convex penalty function We say that the penalty function is convex if p(x) ≤ (p(x − 1) + p(x + 1))/2 for every x ∈ Z. Let us consider a penalty function that can be written as ℓ ps (x) = max(0, αi(x − βi)), Xi=1 where αi > 0 and βi ∈ Z for 1 ≤ i ≤ ℓ. This penalty function is convex. On the other hand, if we are given a convex penalty function p such that p(x) = 0 for x < 0, then we can safely assume that an optimal rank assignment will have values between 0 and V − 1. We can define a penalty function ps with ℓ ≤ V terms such that ps (x) = p(x) for x < V . Consequently, finding an optimal rank assignment using ps will also yield an optimal rank assignment with respect to p. Note that pl is a special case of ps . This hints that we can solve q(G, k, ps ) with a technique similar to the one given in Section 3. In fact, we can map this problem to Agony-with-shifts. In order to do this, assume a graph G = (V, E, w) and an integer k. Set n = V and m = E. We define a graph H = (W, F, w, s) as follows. The vertex set W consists of 2 groups: (i) n vertices, each vertex corresponding to a vertex in G (ii) 2 additional vertices α and ω. For each edge e = (v, w) ∈ E, we add ℓ edges fi = (u, v) to F . We set s(fi) = −βi and w(fi) = αiw(e). We add edges to α and ω to enforce the cardinality constraint, as we did in Section 3.1. We denote this graph by H (G, k, ps ) = H. Example 3 Consider a graph G given in Figure 4 and a penalty function ps (d) = max(0, d + 1) + 2 max(0, d − 3). The graph H = H (G, 3, ps ) has 5 vertices, the original vertices and the two additional vertices. Each edge in G results in two edges in H. This gives us 6 edges plus the 7 edges adjacent to α or ω. The graph H without α and ω is given in Figure 4. 16 Nikolaj Tatti a 1 b 2 1 6 a 1(1) −3(2) b 3 - 3 ( 4 ) 1 ( 2 ) 3(2) − 1(1) G c H (G, 3, ps ) c 3 Fig. 4 Toy graph G and the related circulation graph H (G, 3, ps ). To avoid clutter the vertices α and ω and the adjacent edges are omitted. Finally, let us address the computational complexity of the problem. The circulation graph H (G, k, ps ) will have n + 2 vertices and ℓm + n edges. If the penalty function p is convex, then we need at most ℓ = n functions to represent p between the range of [0, n − 1]. Moreover, if we enforce the cardinality con- straint k, we need only ℓ = k components. Consequently, we will have at most dm + n, edges where d = min(k, ℓ, n) for ps , and d = min(k, n) for a convex penalty p. This gives us computational time of O(dm log n(dm + n log n)). 5.2 Concave penalty function We have shown that we can solve Problem 1 for any convex penalty. Let us consider concave penalties, that is penalties for which p(x) ≥ (p(x − 1) + p(x + 1))/2. There is a stark difference compared to the convex penalties as the minimization problem becomes computationally intractable. Proposition 4 Assume a monotonic penalty function p : Z → R such that p(x) = 0 for x < 0, p(2) > p(1), and there is an integer t such that p(t) > p(t − 1) + p(t + 1) 2 (5) and p(s) s + 1 ≥ p(y) y + 1 , for every 0 ≤ s ≤ y and y ∈ [t − 1, t, t + 1]. Then, determining whether q(G, k, p) ≤ σ for a given graph G, integer k, and threshold σ is an NP-hard problem. We provide the proof in Appendix. While the conditions in Proposition 4 seem overly complicated, they are quite easy to satisfy. Assume that we are given a penalty function that is concave in [−1,∞], and p(−1) = 0. Then due to concavity we have p(x) x + 1 ≥ p(x + 1) x + 2 , for x ≥ 0 . This leads to the following corollary. Tiers for peers 17 Corollary 1 Assume a monotonic penalty function p : Z → R such that p(x) = 0 for x < 0, p(2) > p(1), and p is concave and non-linear in [−1, ℓ] for some ℓ ≥ 1. Then, determining whether q(G, k, p) ≤ σ for a given graph G, integer k, and threshold σ is NP-hard problem. Note that we require p to be non-linear. This is needed so that the proper inequality in Equation 5 is satisfied. This condition is needed since pl satisfies every other requirement. Corollary 1 covers many penalty functions such as p(x) = √x + 1 or p(x) = log(x + 2), for x ≥ 0. Note that the function needs to be convex only in [−1, ℓ] for some ℓ ≥ 1. At extreme, ℓ = 1 in which case t = 0 satisfies the conditions in Proposition 4. 6 Selecting canonical solution A rank assignment minimizing agony may not be unique. In fact, consider a graph G with no edges, then any ranking will have the optimal score of 0. Moreover, if the input graph G is a DAG, then any topological sorting of vertices will yield the optimal score of 0. In this section we introduce a technique to select a unique optimal solution. The idea here is to make the ranks as small as possible without compromising the optimality of the solution. More specifically, let us define the following relationship between to rankings. Definition 2 Given two rank assignments r and r′, we write r (cid:22) r′ if r(x) ≤ r′(x) for every x. The following proposition states that there exists exactly one ranking with the optimal score that is minimal with respect to the (cid:22) relation. We will refer to this ranking as canonical ranking. Proposition 5 Given a graph G and an integer k, there exists a unique op- timal rank assignment r such that r (cid:22) r′ for every optimal rank assignment r′. The proof of this proposition is given in Appendix. Canonical ranking has many nice properties. The canonical solution for a graph without edges assigns rank 0 to all vertices. More generally, if G = (V, E) is a DAG, then the source vertices S of G will receive a rank of 0, the source vertices of G(V \ S) will receive a rank of 1, and so on. For general graphs we have the following proposition. Proposition 6 Let r be the canonical ranking. Then r has the least distinct rank values among all optimal solutions. In other words, the partition of V corresponding to the canonical ranking has the smallest number of groups. Our next step is to provide an algorithm for discovering canonical ranking. In order to do so we assume that we use Orlin's algorithm and obtain the flow 18 Nikolaj Tatti f and the dual π, described in Problem 4 and 5. We construct the residual graph R, as described in Section 4, edges weighted by t(e) + π(w) − π(v). We then compute, d(v) which is the shortest path in R from α to v. Finally, we set r∗(v) = r(v) − d(v). Once, we have computed the residual graph, we simply compute the short- est path distance from q and subtract the distance from the optimal ranking, see Algorithm 3. Algorithm 3: canon(G), computes canonical optimal solution 1 f, π ← optimal flow and dual of Circulation; 2 R ← residual graph; 3 d(v) ← shortest weighted distance from α to v in R; 4 foreach v ∈ V do r∗(v) ← r(v) − d(v); 5 return r∗; Proposition 7 Algorithm canon returns canonical solution with optimal score. We give the proof of this proposition in Appendix. Proposition states that to compute the canonical ranking it is enough to form the residual graph, compute the shortest edge distances d(v) from the vertex q, and subtract them from the input ranking. The computational com- plexity of these steps is O(m + n log n). Moveover, this proposition holds for a more general convex penalty function, described in Section 5.1. 7 A fast divide-and-conquer heuristic In this section we propose a simple and fast divide-and-conquer approach. The main idea is as follows: We begin with the full set of vertices and we split them into two halves: the left half will have smaller ranks than the right half. We then continue splitting the smaller sets recursively, and obtain a tree. We show that this can be done in O(m log n) time. If we are given a cardinality constraint k, then we prune the tree using dynamic program that runs in O(cid:0)k2n(cid:1) time. We also propose a variant, where we perform SCC decomposition, and perform then divide-and-conquer on individual components. To enforce the cardinality constraint in this case, we need additional O(cid:0)km log n + k2n(cid:1) time. 7.1 Constructing a tree by splitting vertices As mentioned above, our goal is to construct a tree T . This tree is binary and ordered, that is, each non-leaf vertex has a left child and a right child. Each leaf α5 in this tree T is associated with a set of vertices that we denote by Vα. Every vertex of the input graph should belong to some leaf, and 5 we will systematically denote the vertices in T with Greek letters Tiers for peers 19 no two leaves share a vertex. If α is a non-leaf, then we define Vα to be the union of vertices related to each descendant leaf of α. We also define Eα to be the edges in E that have both endpoints in Vα. Since the tree is ordered, we can sort the leaves, left first. Using this order, we define a rank r(v) to be the rank of the leaf in which v is included. We define q(T ) = q(r). Our goal is to construct T with good q(T ). We do this by splitting Vα of a leaf α to two leaves such that the agony is minimized. Luckily, we can find the optimal split efficiently. Let us first express the gain in agony due to a split. In order to do so, assume a tree T , and let α be a leaf. Let X be the vertices in leaves that are left to α, and let Z be the vertices in leaves that are right to α. We define b(α) to be the total weight of the edges from Z to X, b(α) = X(z,x)∈E x∈X,z∈Z w(z, x) . Let y be a vertex in Vα. We define ib(y; α) = X(z,y)∈E z∈Z w(z, y) and ob(y; α) = X(y,x)∈E x∈X w(y, x) to be the total weight of the backward edges adjacent to y and Z or X. We also define the total weights Let ib(α) = Xy∈Vα ib(y; α) flux (y; α) = X(x,y)∈Eα and ob(α) = Xy∈Vα w(x, y) − X(y,x)∈Eα ob(y; α) . w(y, x) to be the total weight of incoming edges minus the total weight of the outgoing edges. Finally, let us define d (y; α) = flux (y; α) + ib(y; α) − ob(y; α) . We can now use these quantities to express how a split changes the score. Proposition 8 Let α be a leaf of a tree T . Assume a new tree T ′, where we have split α to two leaves. Let Y1 be the vertex set of the new left leaf, and Y2 the vertex set of the new right leaf. Then the score difference is q(T ′) − q(T ) = b(α) + ib(α) − Xy∈Y2 d (y; α) that can be rewritten as q(T ′) − q(T ) = b(α) + ob(α) + Xy∈Y1 d (y; α) . 20 Nikolaj Tatti Proof We will show that q(T ′) − q(T ) = b(α) + Xy∈Y1 ib(y; α) + Xy∈Y2 ob(y; α) + Xy∈Y1 flux (y; α) . (6) Equation 6 can be then rewritten to the forms given in the proposition. Let Y0 be the set of all vertices to the left of α. Let Y3 be the set of all vertices to the right of α. Note that Y0 ∪ Y1 ∪ Y2 ∪ Y3 = V . Write t(i, j) to be the total weight of edges from Yi to Yj. Also, write c(i, j) to be the total change in the penalty of edges from Yi to Yj due to a split. Note that c(0, 1) = c(0, 2) = c(0, 3) = c(1, 3) = c(2, 3) = 0 since these are forward edges that remain forward. Also, c(0, 0) = c(1, 1) = c(2, 2) = c(3, 3) = 0 since the rank difference of these edges has not changed. For the same reason, c(3, 2) = c(1, 0) = 0. Case (i): Since a split shifts Y3 by one rank, c(3, 0) = t(3, 0) and c(3, 1) = t(3, 1). Case (ii): Since a split shifts Y2 by one rank, c(2, 0) = t(2, 0). Case (iii): The penalty of an edge from Y2 to Y1 increases by w(e). Summing over these edges leads to c(2, 1) = t(2, 1). Case (iv ): The penalty of an edge from Y1 to Y2 decreases by w(e). Summing over these edges leads to c(1, 2) = −t(1, 2). q(T ′) − q(T ) =Xi,j c(i, j) = t(3, 0) + t(3, 1) + t(2, 0) + t(2, 1) − t(1, 2) This leads to . First, note that t(3, 0) = b(α) , t(3, 1) = Xy∈Y1 ib(y; α) , t(2, 0) = Xy∈Y2 ob(y; α) . To express t(2, 1) − t(1, 2), we can write Xy∈Y1 w(x, y) − X(y,x)∈Eα flux (y; α) = X(x,y)∈Eα y∈Y1 y∈Y1 w(y, x) = t(1, 1) + t(2, 1) − t(1, 1) − t(1, 2) = t(2, 1) − t(1, 2) . This proves Eq. 6, and the proposition. ⊓⊔ Proposition 8 gives us a very simple algorithm for finding an optimal split: A vertex y for which d (y) ≥ 0 should be in the right child, while the rest ver- tices should be in the left child. If the gain is negative, then we have improved the score by splitting. However, it is possible to have positive gain, in which case we should not do a split at all. Note that the gain does not change if we do a split in a different leaf. This allows to treat each leaf independently, and not care about the order in which leaves are tested. The difficulty with this approach is that if we simply recompute the quan- tities every time from the scratch, we cannot guarantee a fast computation time. This is because if there are many uneven splits, we will enumerate over some edges too many times. In order to make the algorithm provably fast, we Tiers for peers 21 argue that we can detect which of the new leaves has fewer adjacent edges, and we only enumerate over these edges. Let us describe the algorithm in more details. We start with the full graph, but as we split the vertices among leaves, we only keep the edges that are intra- leaf; we delete any cross-edges between different leaves. As we delete edges, we also maintain 4 counters for each vertex, flux (y; α), ib(y; α), ob(y; α), and the unweighted degree, deg(y), where α is the leaf containing y. For each leaf α, we maintain four sets of vertices, Nα = {y ∈ Vα deg(y; α) > 0, d (y; α) < 0} , Pα = {y ∈ Vα deg(y; α) > 0, d (y; α) ≥ 0} , N ∗ α = {y ∈ Vα deg(y; α) = 0, d (y; α) < 0} , P ∗ α = {y ∈ Vα deg(y; α) = 0, d (y; α) ≥ 0} . The reason why we treat vertices with zero degree differently is so that we can bound Nα or Pα by the number of adjacent edges. Note that we maintain these sets only for leaves. To save computational time, when a leaf is split, its sets are reused by the new leaves, and in the process are modified. In addition, we maintain the following counters 1. the total weights b(α), ib(α), ob(α), and 2. in order to avoid enumerating over N ∗ α and P ∗ α when computing the gain, we also maintain the counters dbN (α) = Xy∈Nα ib(y) − ob(y) , dbP (α) = Xy∈Pα ib(y) − ob(y) . We also maintain gain(α) for non-leaves, which is the agony gain of splitting α. We will use this quantity when we prune the tree to enforce the cardinality constraint. If we decide to split, then we can do this trivially: according to Proposition 8 Nα and N ∗ α should be in the right child. Our task is to compute the gain, and see whether we should split the leaf, and compute the structures for the new leaves. α should be in the left child while Pα and P ∗ Given a leaf α, our first step is to determine whether Nα or Pα has fewer edges. More formally, we define adj (X) to be the edges that have at least one end point in X. We then need to compute whether adj (Nα) ≤ adj (Pα). This is done by cleverly enumerating over elements of Nα and Pα simultaneously. The pseudo-code is given in Algorithm 4. Proposition 9 Let m1 = adj (Nα) and m2 = adj (Pα). Then LeftS- maller returns true if and only if m1 ≤ m2 in O(min(m1, m2)) time. Proof Assume that the algorithm returns true, so Y1 = ∅ and c1 ≤ c2. Since Y1 = ∅, then c1 = m1, which leads to m1 = c1 ≤ c2 ≤ m2. Assume that the algorithm returns false. Then the while loop condition guarantees that Y2 = ∅ and c1 ≥ c2. Since Y2 = ∅, then c2 = m2. Either Y1 6= ∅ or c1 > c2. If latter, 22 Nikolaj Tatti Algorithm 4: LeftSmaller(α), tests whether adj (Nα) ≤ adj (Pα). 1 Y1 ← Nα, Y2 ← Pα; 2 c1 ← 0; c2 ← 0; 3 until (Y1 = ∅ and c1 ≤ c2) or (Y2 = ∅ and c1 ≥ c2) do 4 5 6 7 8 9 if c1 ≤ c2 then y ← vertex in Y1; delete y from Y1; c1 ← c1 + deg(y); else y ← vertex in Y2; delete y from Y2; c2 ← c2 + deg(y); 10 return Y1 = ∅ and c1 ≤ c2; then m2 = c2 < c1 ≤ m1. If former, then m2 = c2 ≤ c1 < m1. This proves the correctness. To prove the running time, first note, since there are no singletons, each iterations will increase either c1 or c2. Assume that m1 ≤ m2. If we have not terminated after 2m1 iterations, then we must have m1 < c2. Since c1 ≤ m1 < c2, we will then only increase c1. This requires at most m1 iterations (actually, we can show that we only need 1 more iteration). In conclusion, the algorithm runs in O(m1) time. The case for m1 ≥ m2 is similar. ⊓⊔ We can now describe our main algorithm, given in Algorithms 5, 6, and 7. Split is given a leaf α. As a first step, Split determines which side has fewer edges using LeftSmaller. After that it computes the gain, and checks whether a split is profitable. If it is, then it calls either ConstructLeft or ConstructRight, depending which one is faster. These two algorithms perform the actual split and updating the structures, and then recurse on the new leaves. Algorithm 5: Split(α), checks if we can improve by splitting α, and decides which side is more economical to split. Calls either Con- structLeft or ConstructRight to update the structures. 1 if LeftSmaller(α) then 2 3 g ← b(α) + ob(α) + dbN (α) + Py∈Nα if g < 0 then ConstructLeft(α); gain(α) ← g ; d(y; α); 4 else 5 6 g ← b(α) + ib(α) − dbP (α) − Py∈Pα if g < 0 then ConstructRight(α); gain(α) ← g ; d(y; α); Let us next establish the correctness of the algorithm. We only need to show that during the split the necessary structures are maintained properly. We only show it for ConstructLeft, as the argument is exactly the same for ConstructRight. Proposition 10 ConstructLeft maintains the counters and the vertex sets. Tiers for peers 23 Algorithm 6: ConstructLeft(α), performs a single split using Nα. Recurses to Split for further splits. 1 create a new leaf β with sets Nβ = Nα, Pβ = ∅, N ∗ 2 b(β) ← b(α) + ob(α); 3 create a new leaf γ with sets Nγ = ∅, Pγ = Pγ , N ∗ 4 b(γ) ← b(α); 5 foreach x ∈ Nα do γ = ∅, and P ∗ α, and P ∗ γ = P ∗ γ ; α = P ∗ α = ∅; 6 7 8 b(γ) ← b(γ) + ib(x); b(β) ← b(β) − ob(x); delete edges (x, z) or (z, x) for any z ∈ Pα, and update flux , deg , ib, ob ; β , dbN (β) and dbP (β); γ , dbN (γ) and dbP (γ); 9 check the affected vertices and update Pβ, Nβ, P ∗ 10 check the affected vertices and update Pγ, Nγ , P ∗ 11 Split(β); Split(γ); β , N ∗ γ , N ∗ Algorithm 7: ConstructRight(α), performs a single split using Pα. Recurses to Split for further splits. 1 create a new leaf β with sets Nβ = Nα, Pβ = ∅, N ∗ 2 b(β) ← b(α); 3 create a new leaf γ with sets Nγ = ∅, Pγ = Pγ , N ∗ 4 b(γ) ← b(α) + ib(α); 5 foreach x ∈ Pα do γ = ∅, and P ∗ α, and P ∗ γ = P ∗ γ ; α = P ∗ α = ∅; 6 7 8 b(γ) ← b(γ) − ib(x); b(β) ← b(β) + ob(x); delete edges (x, z) or (z, x) for any z ∈ Pα, and update flux , deg , ib, ob ; 9 check the affected vertices and update Pβ, Nβ, P ∗ 10 check the affected vertices and update Pγ, Nγ , P ∗ 11 Split(β); Split(γ); β , N ∗ γ , N ∗ β , dbN (β) and dbP (β); γ , dbN (γ) and dbP (γ); Proof During a split, our main task is to remove the cross edges between Nα and Pα and make sure that all the counters and the vertex sets in the new leaves are correct. Let y ∈ Vβ. If there is no cross edge attached to a vertex y in Eα, then d(y; β) = d(y; α) and deg(y; β) = deg(y; α). This means that we only need to check vertices that are adjacent to a cross edge, and possibly move them to a different set, depending on deg(y; β) and d(y; β). This is exactly what the algorithm does. The case for y ∈ Vγ is similar. of b(α) as well as additional edges to Nα, namely b(γ) = b(α) +Py∈Nα which is exactly what algorithm computes. Also, b(β) = b(α)+Py∈Pα b(α) + ob(α) −Py∈Nα as we delete edges or move vertices from one set to another. ⊓⊔ The only non-trivial counters are b(γ) and b(β). Note that b(γ) consists ib(y), ob(y) = ob(y). The remaining counters are trivial to maintain We conclude this section with the computational complexity analysis. Proposition 11 Constructing the tree can be done in O(m log n) time, where m is the number of edges and n is the number of vertices in the input graph. To prove the proposition, we need the following lemmas. 24 Nikolaj Tatti β = N ∗ γ = P ∗ Lemma 3 Let m = adj (Nα). Updating the new leaves in ConstructLeft can be done in O(m) time. Proof The assignments Nβ = Nα, N ∗ α are done by reference, so they can be done in constant time. Since there are no singletons in Nα, there are most 2m vertices in Nα. Deleting an edge is done in con- stant time, so the for-loop requires O(m) time. There are at most 2m affected vertices, thus updating the sets also can be done in O(m) time. ⊓⊔ Lemma 4 Let m = adj (Pα). Updating the new leaves in ConstructRight can be done in O(m) time. α, Pγ = Pα, P ∗ The proof for the lemma is the same as the proof for Lemma 3. Proof Let us write mα = min(adj (Nα),adj (Pα)) to be the smaller of the two adjacent edges. Lemmas 3 -- 4 implies that the running time is O(Pα mα), where α runs over every vertex in the final tree. We can express the sum differently: given an edge e, write 1 e ∈ adj (Nα) , 1 e ∈ adj (Pα) , . 0 otherwise and adj (Nα) ≤ adj (Pα), and adj (Nα) > adj (Pα), ieα =  That is, mα =Pe ieα. Write ie =Pα ieα. To prove the proposition, we show that ie ∈ O(log n). Fix e, and let α and β be two vertices in a tree for which ieα = ieβ = 1. Either α is a descendant of β, or β is a descendant of α. Assume the latter, without the loss of generality. We will show that 2Eβ ≤ Eα, and this immediately proves that ie ∈ O(log n). To prove this, let us define cα to be the number of cross edges between Nα and Pα, when splitting α. Assume, for simplicity, that β is the left descendant of α. Then Eβ ≤ adj (Nα) − cα. Also, e ∈ adj (Nα), and by definition of ieα, mα = adj (Nα). This gives us, 2Eβ ≤ 2mα− 2cα ≤ (adj (Nα)− cα) + (adj (Pα)− cα) = Eα− cα ≤ Eα The case when β is the right descendant is similar, proving the result. ⊓⊔ . 7.2 Enforcing the cardinality constraint by pruning the tree If we did not specify the cardinality constraint, then once we have obtained the tree, we can now assign individual ranks to the leaves, and consequently to the vertices. If k is specified, then we may violate the cardinality constraint by having too many leaves. In such case, we need to reduce the number of leaves, which we do by pruning some branches. Luckily, we can do this optimally by using dynamic Tiers for peers 25 programming. To see this, let T ′ be a subtree of T obtained by merging some of the branches, making them into leaves. Then Proposition 8 implies that q(T ′) is equal to q(T ′) = W + Xα is a non-leaf in T ′ gain(α) , where W is the total weight of edges. This allows us to define the following dynamic program. Let opt (α; h) be the optimal gain achieved in branch starting from α using only h ranks. If α is the root of T , then opt (α; k) is the optimal agony that can be obtained by pruning T to have only k leaves. To compute opt (α; h), we first set opt (α; 1) = 0 for any α, and opt (α; h) = 0 if α is a leaf in T . If α is a non-leaf and k > 1, then we need to distribute the budget among the two children, that is, we compute opt (α; h) = gain(α) + min 1≤ℓ≤h−1 opt (β; ℓ) + opt (γ; h − ℓ) . We also record the optimal index ℓ, that allows us to recover the optimal tree. Computing a single opt (α; h) requires O(k) time, and we need to compute at most O(nk) entries, leading to O(cid:0)nk2(cid:1) running time. 7.3 Strongly connected component decomposition If the input graph has no cycles and there is no cardinality constraint, then the optimal agony is 0. However, the heuristic is not guaranteed to produce such a ranking. To guarantee this, we add an additional -- and optional -- step. First, we perform the SCC decomposition. Secondly, we pack strongly connected components in the minimal number of layers: source components are in the first layer, second layer consists of components having edges edge only from the first layer, and so on. We then run the heuristic on each individual layer. If k is not set, we can now create a global ranking, where the ranks of the ith layer are larger than the ranks of the (i− 1)th layer. In other words, edges between the SCCs are all forward. If k is set, then we need to decide how many individual ranks each com- ponent should receive. Moreover, we may have more than k layers, so some of the layers must be merged. In such a case, we will demand that the merged layers must use exactly 1 rank, together. The reason for this restriction is that it allows us to compute the optimal distribution quickly using dynamic programming. The gain in agony comes from two different sources. The first source is the improvement of edges within a single layer. Let us adopt the notation from the previous section, and write opt (i; h) to be the optimal gain for ith layer using h ranks. We can compute this using the dynamic program in the previous section. The second source of gain is making the inter-layer edges forward. Instead of computing the total weight of such edges, we compute how many 26 Nikolaj Tatti edges are not made forward. These are exactly the edges that are between the layers that have been merged together. In order to express this we write w(j, i) to be the total weight of inter-layer edges having both end points in layers j, . . . , i. To express, the agony of the tree, let ki be the budget of individual layers. We also, write [aj, bj] to mean that layers aj, . . . , bj have been merged, and must share a single rank. We can show that the score of the tree T ′ that uses this budget distribution of is then equal to q(T ′) = W +Xi opt (i, ki) +Xj w(aj , bj), where W is the total weight of the intra-layer edges. Note that W is a constant and so we can ignore it. To find the optimal ki and [aj, bj], we use the following dynamic program. Let us write o(i; h) to be the gain of 1, . . . , i layers using h ranks. We can express o(i; h) as o(i; h) = min(min j w(j, i) + o(j − 1; h − 1) , min ℓ opt (i, ℓ) + o(i − 1, h − ℓ)) . The first part represents merging j, . . . , i layers, while the second part repre- sents spending ℓ ranks on the ith layer. By recording the optimal j and ℓ we can recover the optimal budget distribution for each i and h. running time, which is too expensive. Computing the second part can be done in O(k) time, and computing the first part can be done in O(n) time, naively. This leads to O(cid:0)n2k + nk2(cid:1) Luckily we can speed-up the computation of the first term. To simplify notation, fix h, and let us write f (j, i) = w(j, i) + o(j − 1; h − 1). We wish to find j(i) such that f (j(i), i) is minimal for each i. Luckily, f satisfies the condition, f (j1, i1) − f (j2, i1) ≤ f (j1, i2) − f (j2, i2), where j1 ≤ j2 ≤ i1 ≤ i2. Aggarwal et al. [1] now guarantees that j(i1) ≤ j(i2), for i1 ≤ i2. Moreover, Aggarwal et al. [1] provides an algorithm that computes j(i) in O(n) time. Unfortunately, we cannot use it since it assumes that f (j, i) can be computed in constant time, which is not the case due to w(j, i). Fortunately, we can still use the monotonicity of j(·) to speed-up the al- gorithm. We do this by computing j(i) in an interleaved manner. In order to do so, let ℓ be the number of layers, and let t be the largest integer such that s = 2t ≤ ℓ. We first compute j(s). We then proceed to compute j(s/2) and j(3s/2), and so on. We use the previously computed values of j(·) as sentinels: when computing j(s/2) we do not test j > j(s) or when computing j(3s/2) we do not test j < j(s). The pseudo-code is given in Algorithm 8. To analyze the complexity, note that for a fixed s, the variables i, a and b are only moving to the right. This allows us to compute w(j, i) incrementally: whenever we increase i, we add the weights of new edges to the total weight, whenever we increase j, we delete the weights of expiring edges from the Tiers for peers 27 Algorithm 8: Fast algorithm for computing j(i) minimizing f (j(i), i) 1 ℓ ← largest possible i; 2 s ← max (cid:8)2t ≤ ℓ, t ∈ N(cid:9); 3 while s ≥ 1 do 4 5 6 7 8 9 foreach i = s, 3s, 5s, . . ., i ≤ ℓ do a ← 1; b ← i; if i − s ≥ 1 then a ← j(i − s); if i + s ≤ ℓ then b ← min(b, j(i + s)); j(i) ← mina≤j≤b f (j, i); s ← s/2; total weight. Each edge is visited twice, and this gives us O(m) time for a fixed s. Since s is halved during each outer iteration, there can be at most O(log n) iterations. We need to do this for each h, so the total running time is O(cid:0)km log n + nk2(cid:1). As our final remark, we should point out that using this decomposition may not necessarily result in a better ranking. If k is not specified, then the optimal solution will have inter-layer edges as forward, so we expect this decomposition to improve the quality. However, if k is small, we may have a better solution if we allow to inter-layer edges go backward. At extreme, k = 2, we are guar- anteed that the heuristic without the SCC decomposition will give an optimal solution, so the SCC decomposition can only harm the solution. We will see this behaviour in the experimental section. Luckily, since both algorithms are fast, we can simply run both approaches and select the better one. 8 Related work The problem of discovering the rank of an object based on its dominating relationships to other objects is a classic problem. Perhaps the most known ranking method is Elo rating devised by Elo [4], used to rank chess players. In similar fashion, Jameson et al. [9] introduced a statistical model, where the likelihood of the the vertex dominating other is based on the difference of their ranks, to animal dominance data. Maiya and Berger-Wolf [12] suggested an approach for discovering hierar- chies, directed trees from weighted graphs such that parent vertices tend to dominate the children. To score such a hierarchy the authors propose a statis- tical model where the probability of an edge is high between a parent and a child. To find a good hierarchy the authors employ a greedy heuristic. The technical relationship between our approach and the previous studies on agony by Gupte et al. [7] and Tatti [19] is a very natural one. The authors of both papers demonstrate that minimizing agony in a unweighted graph is a dual problem to finding a maximal eulerian subgraph, a subgraph in which, for each vertex, the same number of outdoing edges and the number of incoming edges is the same. Discovering the maximum eulerian subgraph is a special 28 Nikolaj Tatti case of the capacitated circulation problem, where the capacities are set to 1. However, the algorithms in [7, 19] are specifically designed to work with unweighted edges. Consequently, if our input graph edges or we wish to enforce the cardinality constraint, we need to solve the problem using the capacitated circulation solver. The stark difference of computational complexities for different edge penal- ties is intriguing: while we can compute agony and any other convex score in polynomial-time, minimizing the concave penalties is NP-hard. Minimizing the score q(G, k, pc) is equivalent to feedback arc set (FAS), which is known to be APX-hard with a coefficient of c = 1.3606 [2]. Moreover, there is no known constant-ratio approximation algorithm for FAS, and the best known approximation algorithm has ratio O(log n log log n) [5]. In this paper we have shown that minimizing concave penalty is NP-hard. An interesting theoretical question is whether this optimization problem is also APX-hard, and is it possible to develop an approximation algorithm. Role mining, where vertices are assigned different roles based on their ad- jacent edges, and other features, has received some attention. Henderson et al. [8] studied assigning roles to vertices based on its features while McCallum et al. [13] assigned topic distributions to individual vertices. A potential direc- tion for a future work is to study whether the rank obtained from minimizing agony can be applied as a feature in role discovery. 9 Experiments In this section we present our experimental evaluation. Our main focus of the experiments is practical computability of the weighted agony. 9.1 Datasets and setup For our experiments we took 10 large networks from SNAP repository [10]. In addition, for illustrative purposes, we used two small datasets: Nfl, consisting of National Football League teams. We created an edge (x, y) if team x has scored more points against team y during 2014 regular season, we assign the weight to be the difference between the points. Since not every team plays against every team, the graph is not a tournament. Reef, a food web of guilds of species [17], available at [18]. The dataset consisted of 3 food webs of coral reef systems: The Cayman Islands, Jamaica, and Cuba. An edge (x, y) appears if a guild x is known to prey on a guild y. Since the guilds are common among all 3 graphs, we combined the food webs into one graph, and weighted the edges accordingly, that is, each edge received a weight between 1 and 3. The sizes of the graphs, along with the sizes of the largest strongly con- nected component, are given in the first 4 columns of Table 2. The 3 Higgs and Nfl graphs had weighted edges, and for the remaining graphs we assigned a weight of 1 for each edge. We removed any self-loops as they have no effect on the ranking, as well as any singleton vertices. Tiers for peers 29 For each dataset we computed the agony using Algorithm 2. We compared the algorithm to the baseline given by Tatti [20]. For the unweighted graphs we also computed the agony using Relief, an algorithm suggested by Tatti [19]. Note that this algorithm, nor the algorithm by Gupte et al. [7], does not work for weighted graphs nor when the cardinality constraint k given in Problem 1 is enforced. We implemented algorithms in C++ and performed experiments using a Linux-desktop equipped with a Opteron 2220 SE processor.6 Table 2 Basic characteristics of the datasets and the experiments. The 6th is the number of groups in the optimal ranking. Name Amazon Gnutella EmailEU Epinions Slashdot WebGoogle WikiVote largest SCC time baseline V E V ′ E′ k SCC plain [20] [19] 62 586 265 214 75 879 82 168 403 394 3 387 388 395 234 3 301 092 17 50 916 24 151 132 9 443 506 10 9 841 201 25m6s 6h24m 4h27m 20s 45s 29s 2m 44s 20m 61s 1h38m 1h5m 875 713 5 105 039 434 818 3 419 124 31 10m31s 25m22s 8h50m 2h32m 7s 24m7s 4s 10s 33s 38s 147 892 418 956 508 837 870 161 7 115 103 689 1 300 39 456 12 14 149 34 203 32 223 71 307 8s 10m 49m 2s 6s 43s 32 Nfl 258 Reef HiggsReply 37 145 HiggsRetweet 425 008 HiggsMention 302 523 205 4232 30 517 733 610 445 147 32 1 263 13 086 4 786 205 6 0 19 569 11 63 505 22 19 848 21 4ms 8ms 0.3s 12s 6s 5ms 100ms 5s 2m10s 1m34s 22ms 10ms 0.2s 10m 2m -- -- -- -- -- 9.2 Results Let us begin by studying running times given in Table 2. We report the run- ning times of our approach with and without the strongly connected compo- nent decomposition as suggested by Proposition 2, and compare it against the baselines, whenever possible. Note that we can use the decomposition only if we do not enforce the cardinality constraint. Our first observation is that the decomposition always helps to speed up the algorithm. In fact, this speed-up may be dramatic, if the size of the strongly connected component is significantly smaller than the size of the input graph, for example, with HiggsRetweet. The running times are practical despite the unappealing theoretical bound. This is due to several factors. First, note that the theoretical bound of O(min(nk, m)m log n) given in Section 4 only holds for unweighted graphs, and it is needed to bound the number of outer-loop iterations. In practice, however, the number of these iterations is small, even for weighted graphs. The other, and the main, reason is the pessimistic n in the min(nk, m) factor; we spend nk inner-loop iterations only if the dual π(v) 6 The source code is available at http://users.ics.aalto.fi/ntatti/agony.zip 30 Nikolaj Tatti of each vertex v increases by O(k), and between the increases the shortest path from sources to v changes O(n) times. The latter change seems highly unlikely in practice, leading to a faster computational time. We see that our algorithm beats consistently both baselines. What is more important: the running times remain practical, even if we do not use strongly connected components. This allows us to limit the number of groups for large graphs. This is a significant improvement over [20], where solving HiggsRetweet without the SCC decomposition required 31 hours. Our next step is to study the effect of the constraint k, the maximum number of different rank values. We see in the 6th column in Table 2 that despite having large number of vertices, that the optimal rank assignment has low number of groups, typically around 10 -- 20 groups, even if the cardinality constraint is not enforced. Let us now consider agony as a function of k, which we have plotted in Figure 5 for Gnutella and WikiVote graphs. We see that for these datasets that agony remains relatively constant as we decrease k, and starts to increase more prominently once we consider assignments with k ≤ 5. ×104 Gnutella ×104 WikiVote 4 ) k , G ( q 2 0 2 5 ) k , G ( q 3 2 1 0 10 constraint k 15 20 24 2 4 6 8 10 12 constraint k Fig. 5 Agony as a function of the constraint k for Gnutella and WikiVote datasets. Enforcing the constraint k has an impact on running time. As implied by Proposition 3, low values of k should speed-up the computation. In Figure 6 we plotted the running time as a function of k, compared to the plain version without the speed-up. As we can see lower values of k are computationally easier to solve. This is an opposite behavior of [20], where lowering k increased the computational time. To explain this behaviour, note that when we decrease k we increase the agony score, which is equivalent to the capacitated circulation. Both solvers increase incrementally the flow until we have reached the solution. As we lower k, we increase the amount of optimal circulation, and we need more iterations to reach the optimal solution. The difference between the algorithm is that for lower k updating the residual graph becomes significantly faster than computing the tree from scratch. This largely overpowers the effect of Tiers for peers 31 Gnutella WikiVote ) s d n o c e s n i ( e m i t 103 102 101 baseline [20] speed-up ) s d n o c e s n i ( e m i t 103 102 101 100 2 5 10 constraint k 15 20 24 2 4 6 8 10 12 constraint k Fig. 6 Execution time as a function of the constraint k for Gnutella and WikiVote datasets. Note that the y-axis is logarithmic. Table 3 Scores, compared to the optimal, and running times of the heuristic. Here, SCC is the heuristic with SCC decomposition, while plain is the plain version, opt is the optimal agony. Time (sec.) Name Amazon Gnutella EmailEU Epinions Slashdot WebGoogle WikiVote Nfl Reef HiggsReply HiggsRetweet HiggsMention q(SCC) q(opt) q(plain) q(opt) q(SCC) q(plain) q(opt) SCC plain 1.036 1.256 1.008 1.024 1.001 1.051 1.043 1.047 -- 1.007 1.259 1.078 1.037 1.350 1.012 1.030 1.003 1.079 1.091 1.047 -- 1.103 1.606 1.322 2 044 609 23 820 121 820 271 419 749 448 1 935 476 18 430 1172 0 5 499 19 264 24 165 2 046 344 25 603 122 362 273 016 750 760 1 985 831 19 276 1172 452 6 022 24 579 29 632 1 973 965 18 964 120 874 264 995 748 582 1 841 215 17 676 1119 0 5459 15 302 22 418 9.24 0.35 0.47 0.40 0.68 6.80 0.05 0.002 0.008 2.29 0.12 1.82 8.49 0.34 0.45 0.37 0.64 6.64 0.05 0.002 0.006 1.03 0.05 1.65 needing many more iterations to converge. However, there are exceptions: for example, computing agony for WikiVote with k = 8 is slower than k = 9. Let us now consider the performance of the heuristic algorithm. We report the obtained scores and the running times in Table 3. We tested both vari- ants: with and without SCC decomposition, and we do not enforce k. We first observe that both variants are expectedly fast: processing the largest graphs, Amazon and WebGoogle, required less than 10 seconds, while the exact version needed 10 -- 25 minutes. The plain version is cosmetically faster. Heuristic also produces competitive scores but the performance depends on the dataset: for Gnutella and HiggsRetweet the SCC variant produced 25% increase to agony, while for the remaining datasets the increase was lower than 8%. Note that, Reef has agony of 0, that is, the network is a DAG but the plain variant was not able to detect this. This highlights the benefit of doing the SCC decom- position. In general, the SCC variant outperforms the plain variant when we do not enforce the cardinality constraint. 32 Nikolaj Tatti As we lower the cardinality constraint k, the plain variant starts to out- perform the SCC variant, as shown in Figure 7. The reason for this is that the SCC variant requires that a edge (u, v) between two SCCs is either forward or r(u) = r(v). This restriction becomes too severe as we lower k and it becomes more profitable to allow r(u) < r(v). At extreme k = 2, the plain version is guaranteed to find the optimal solution, so the SCC variant can only harm the solution. Gnutella WikiVote ) l a m i t p o ( q / ) c i t s i r u e h ( q 1.6 1.4 1.2 1 plain SCC ) l a m i t p o ( q / ) c i t s i r u e h ( q 1.6 1.4 1.2 1 2 5 10 constraint k 15 20 24 2 4 6 8 10 12 constraint k Fig. 7 Ratio of the agony given by the heuristic and the optimal agony as a function of the constraint k for Gnutella and WikiVote datasets. Table 4 Rank assignment discovered for Nfl dataset with k = 3 groups Rank Teams 1. 2. 3. den bal ne dal sea phi kc gb pit stl nyg mia car no sd min cin buf det ind hou sf ari wsh oak tb jax ten cle atl nyj chi Let us look at the ranking that we obtained from Nfl dataset using k = 3 groups, given in Table 4. We see from the results that the obtained ranking is very sensible. 7 of 8 teams in the top group consists of playoff teams of 2014 season, while the bottom group consists of teams that have a significant losing record. Finally, let us look at the rankings obtained Reef dataset. The graph is in fact a DAG with 19 groups. To reduce the number of groups we rank the guilds into k = 4 groups. The condensed results are given in Table 5. We see that the top group consists of large fishes and sharks, the second group contains mostly smaller fishes, a large portion of the third group are crustacea, while the last group contains the bottom of the food chain, planktons and algae. We should point out that this ranking is done purely on food web, and not on type of species. For example, cleaner crustacea is obviously very different than plankton. Yet cleaner crustacea only eats planktonic bacteria and micro- Tiers for peers 33 Table 5 Ranked guilds of Reef dataset, with k = 4. For simplicity, we removed the duplicate guilds in the same group, and grouped similar guilds (marked as italic, the number in parentheses indicating the number of guilds). Sharks (6), Amberjack, Barracuda, Bigeye, Coney grouper, Flounder, Frogfish, Grouper, Grunt, Hind, Lizardfish, Mackerel, Margate, Palometa, Red hind, Red snapper, Remora, Scorpionfish, Sheepshead, Snapper, Spotted eagle ray Angelfish, Atlantic spadefish, Ballyhoo, Barracuda, Bass Batfish, Blenny Butterflyfish, Caribbean Reef Octopus, Caribbean Reef Squid, Carnivorous fish II-V, Cornetfish, Cow- fish, Damselfish, Filefish, Flamefish, Flounder, Goatfish, Grunt, Halfbeak, Hamlet, Hawk- fish, Hawksbill turtle, Herring, Hogfish, Jack, Jacknife fish, Jawfish, Loggerhead sea turtle, Margate, Moray, Needlefish Porcupinefish I-II, Porkfish, Pufferfish, Scorpionfish, Seabream, Sergeant major, Sharptail eel, Slender Inshore Squid, Slippery dick, Snap- per, Soldierfish, Spotted drum, Squirrelfish, Stomatopods II, Triggerfish, Trumpetfish, Trunkfish, Wrasse, Yellowfin mojarra Crustacea (31), Ahermatypic benthic corals, Ahermatypic gorgonians, Anchovy, An- gelfish, Benthic carnivores II, Blenny, Carnivorous fish I, Common Octopus, Corallivorous gastropods IV, Deep infaunal soft substrate suspension feeders, Diadema, Echinometra, Goby, Green sea turtle, Herbivorous fish I-IV, Herbivorous gastropods I, Hermatypic benthic carnivores I, Hermatypic corals, Hermatypic gorgonians, Herring, Infaunal hard substrate suspension feeders, Lytechinus, Macroplanktonic carnivores II-IV, Macroplank- tonic herbivores I, Molluscivores I, Omnivorous gastropod, Parrotfish, Pilotfish, Silver- side, Stomatopods I, Tripneustes, Zooplanktivorous fish I-II, Planktons (7), Algae (6), Sponges (2), Feeders (11), Benthic carnivores I, Carnivorous ophiuroids, Cleaner crustacea I, Corallivorous polychaetes, Detritivorous gastropods I, Echinoid carnivores I, Endolithic polychaetes, Epiphyte grazer I, Epiphytic autotrophs, Eucidaris, Gorgonian carnivores I, Herbivorous gastropod carnivores I, Herbivorous gas- tropods II-IV, Holothurian detritivores, Macroplanktonic carnivores I, Micro-detritivores, Molluscivores II-III, Planktonic bacteria, Polychaete predators (gastropods), Seagrasses, Sponge-anemone carnivores I, Spongivorous nudibranchs detritivores while being eaten by many other guilds. Consequently, it is ranked in the bottom group. 10 Concluding remarks In this paper we studied the problem of discovering a hierarchy in a directed graph that minimizes agony. We introduced several natural extensions: (i) we demonstrated how to compute the agony for weighted edges, and (ii) how to limit the number of groups in a hierarchy. Both extensions cannot be handled with current algorithms, hence we provide a new technique by demonstrat- ing that minimizing agony can be solved by solving a capacitated circulation problem, a well-known graph problem with a polynomial solution. We also introduced a fast divide-and-conquer heuristic that produces the rankings with competitive scores. We should point out that we can further generalize the setup by allowing each edge to have its own individual penalty function. As long as the penalty functions are convex, the construction done in Section 5.1 can still be used to solve the optimization problem. Moreover, we can further generalize cardi- 34 Nikolaj Tatti nality constraint by requiring that only a subset of vertices must have ranks within some range. We can have multiple such constraints. There are several interesting directions for future work. As pointed out in Section 5.1 minimizing convex penalty increases the number of edges when solving the corresponding circulation problem. However, these edges have very specific structure, and we conjecture that it is possible to solve the convex case without the additional computational burden. References 1. A. Aggarwal, M. Klawe, S. Moran, P. Shor, and R. Wilber. Geometric applications of a matrix-searching algorithm. Algorithmica, 2(1 -- 4):195 -- 208, 1987. 2. I. Dinur and S. Safra. On the hardness of approximating vertex cover. Annals of Mathematics, 162(1):439 -- 485, 2005. 3. J. Edmonds and R. M. Karp. Theoretical improvements in algorithmic efficiency for network flow problems. Journal of ACM, 19(2):248 -- 264, 1972. 4. A. E. Elo. The rating of chessplayers, past and present. Arco Pub., 1978. 5. G. Even, J. (Seffi) Naor, B. Schieber, and M. Sudan. Approximating minimum feedback sets and multicuts in directed graphs. Algorithmica, 20(2):151 -- 174, 1998. 6. M. Garey and D. Johnson. Computers and intractability: a guide to the theory of NP-completeness. WH Freeman & Co., 1979. 7. M. Gupte, P. Shankar, J. Li, S. Muthukrishnan, and L. Iftode. Finding hierarchy in directed online social networks. In Proceedings of the 20th International Conference on World Wide Web, pages 557 -- 566, 2011. 8. K. Henderson, B. Gallagher, T. Eliassi-Rad, H. Tong, S. Basu, L. Akoglu, D. Koutra, C. Faloutsos, and L. Li. Rolx: Structural role extraction & mining in large graphs. In Proceedings of the 18th ACM SIGKDD In- ternational Conference on Knowledge Discovery and Data Mining, pages 1231 -- 1239, 2012. 9. K. A. Jameson, M. C. Appleby, and L. C. Freeman. Finding an appropriate order for a hierarchy based on probabilistic dominance. Animal Behaviour, 57:991 -- 998, 1999. 10. J. Leskovec and A. Krevl. SNAP Datasets: Stanford large network dataset collection. http://snap.stanford.edu/data, Jan. 2015. 11. L. Macchia, F. Bonchi, F. Gullo, and L. Chiarandini. Mining summaries of propagations. In IEEE 13th International Conference on Data Mining, pages 498 -- 507, 2013. 12. A. S. Maiya and T. Y. Berger-Wolf. Inferring the maximum likelihood hierarchy in social networks. In Proceedings IEEE CSE'09, 12th IEEE In- ternational Conference on Computational Science and Engineering, pages 245 -- 250, 2009. Tiers for peers 35 13. A. McCallum, X. Wang, and A. Corrada-Emmanuel. Topic and role dis- covery in social networks with experiments on enron and academic email. J. Artif. Int. Res., 30(1):249 -- 272, 2007. 14. J. B. Orlin. A faster strongly polynomial minimum cost flow algorithm. Operations Research, 41(2), 1993. 15. C. H. Papadimitriou and K. Steiglitz. Combinatorial Optimization: Algo- rithms and Complexity. Prentice-Hall, Inc., 1982. 16. G. Ramalingam and T. Reps. On the computational complexity of dy- namic graph problems. Theoretical Computer Science, 158:233 -- 277, 1996. 17. P. D. Roopnarine and R. Hertog. Detailed food web networks of three Greater Antillean Coral Reef systems: The Cayman Islands, Cuba, and Jamaica. Dataset Papers in Ecology, 2013, 2013. 18. H. R. Roopnarine PD. Data from: Detailed food web net- works of systems: The Cay- man Islands, Cuba, and Jamaica, 2012. Dryad Digital Repository, http://dx.doi.org/10.5061/dryad.c213h. three Greater Antillean Coral Reef 19. N. Tatti. Faster way to agony -- discovering hierarchies in directed graphs. In Prooceding of European Conference of Machine Learning and Knowl- edge Discovery in Databases, ECML PKDD 2014, pages 163 -- 178, 2014. 20. N. Tatti. Hierarchies in directed networks. In Proceedings of the 15th IEEE International Conference on Data Mining (ICDM 2015), 2015. A Proof of Proposition 4 Proof To prove the completeness we will provide reduction from Maximum Cut [6]. An instance of Maximum Cut consists of an undirected graph, and we are asked to partition vertices into two sets such that the number of cross edges is larger or equal than the given threshold σ. Note that the conditions of the proposition guarantee that p(0) > 0. Assume that we are given an instance of Maximum Cut, that is, an undirected graph G = (V, E) and a threshold σ. Let m = E. Define a weighted directed graph H = (W, F, w) as follows. Add V to W . For each edge (u, v) ∈ E, add a path with t intermediate vertices from u to v, the length of the path is t + 2. Add also a path in reversed direction, from v to u. Set edge weights to be 1. Add 4 special vertices α1, . . . , α4. Add edges (αi+1, αi), for i = 1, . . . , 3 with a weight of C = 2B p(0) p(2) − p(1) , where B = 2(t + 1)m . Add edges (αi, αi+1), for i = 1, . . . , 3 with a weight of D = 4Cp(1) /p(0) + B . Add edges (α0, v) and (v, α4), for each v ∈ V , with a weight of D. Let r be the optimal ranking for H. We can safely assume that r(α1) = 0. We claim that r(αi) = i − 1, and r(v) = 1, 2 for each v ∈ V . To see this, consider a ranking r′ such that r′(αi) = i − 1 and the rank for the remaining vertices is 2. The score of this rank is q(cid:0)H, r′(cid:1) = 3Cp(1) + 2(t + 1)mp(0) = 3Cp(1) + Bp(0) . Let (u, v) ∈ F with the weight of D. If r(u) ≥ r(v), then the score of r is at least Dp(0) = 4Cp(1) + Bp(0) which is more than q(H, r′). Hence, r(u) < r(v). Let (u, v) ∈ F with the 36 Nikolaj Tatti weight of C. Note that r(u) ≥ r(v) + 1. Assume that r(u) ≥ r(v) + 2. Then the score is at least 3Cp(1) + C(p(2) − p(1)) = 3Cp(1) + 2Bp(0) , which is a contradiction. This guarantees that r(αi) = i − 1, and r(v) = 1, 2 for each v ∈ V . Consider (u, v) ∈ E and let u = x0, . . . , xt+1 = v be the corresponding path in H. Let di = r(xi) − r(xi+1) and set ℓ = t + r(u) − r(v). Let P = P p(di) be the penalty contributed by this path. Note that P ≤ p(ℓ), a penalty that we achieve by setting r(xi) = r(xi−1) + 1 for i = 1, . . . , t. This implies that di ≤ ℓ. The condition of the proposition now implies P = ≥ ≥ = = t X i=0 t X i=0 t X i=0 p(di) = t X p(di) i=0,di ≥0 max(di + 1, 0) ℓ + 1 p(ℓ) di + 1 ℓ + 1 p(ℓ) t X i=0 1 + r(xi) − r(xi+1) (t + 1 + r(u) − r(v)) = p(ℓ) . p(ℓ) ℓ + 1 p(ℓ) ℓ + 1 This guarantees that P = p(ℓ). Partition edges E into two groups, and X = {(u, v) ∈ E ∈ r(u) = r(v)} Y = {(u, v) ∈ E ∈ r(u) 6= r(v)} . Let ∆ = p(t − 1) + p(t + 1) − 2p(t). Note that concavity implies that ∆ < 0. Then q(H, r) = 3C + X2p(t) + Y (p(t − 1) + p(t + 1)) = 3C + m2p(t) + Y (p(t − 1) + p(t + 1) − 2p(t)) = 3C + m2p(t) + Y ∆ . The first two terms are constant. Consequently, q(H, r) is optimal if and only if Y , the number of cross-edges is maximal. Given a threshold σ, define σ′ = 3C + m2p(t) + ∆σ. Then q(H, r) ≤ σ′ if and only if there is a cut of G with at least σ cross-edges, which completes the reduction. ⊓⊔ B Proof of Proposition 5 and 7 We will prove both Propositions 5 and 7 with the same proof. Proof Let r∗ be the ranking returned by canon, and let π∗ = π − d be the corresponding dual. Lemma 1 states that π∗ satisfies the slackness conditions, so it remains a solution to Problem 5. This implies also that r∗ is an optimal ranking. To complete the proof we need to show that for any r′, we have r∗ (cid:22) r′. Note that this also proves that r∗ is a unique ranking having such property. Let r′ be any optimal ranking, and let π′ be the corresponding dual. We can assume that π′(α) = π∗(α) = 0. To prove the result we need to show that π′(v) ≥ π∗(v). We will prove this by induction over the shortest path tree T from α. This certainly holds for α. Tiers for peers 37 Let u be a vertex and let v be its parent in T , and let e ∈ E(T ) be the connecting edge. Note that, by definition, −t(e) = π∗(u)−π∗(v). By the induction assumption, π∗(v) ≤ π′(v). If e is forward, then due to Eq. 3 π′(u) − π′(v) ≥ −t(e) = π∗(u) − π∗(v) ≥ π∗(u) − π′(v) If e is backward, then f (v, u) > 0. and Eq. 4 implies π′(u) − π′(v) = −t(e) = π∗(u) − π∗(v) ≥ π∗(u) − π′(v) This completes the induction step, and the proves the proposition. ⊓⊔ . .
1612.03343
1
1612
2016-12-10T21:04:55
Oblivious Sorting and Queues
[ "cs.DS" ]
We present a deterministic oblivious LIFO (Stack), FIFO, double-ended and double-ended priority queue as well as an oblivious mergesort and quicksort algorithm. Our techniques and ideas include concatenating queues end-to-end, size balancing of multiple arrays, several multi-level partitionings of an array. Our queues are the first to enable executions of pop and push operations without any change of the data structure (controlled by a parameter). This enables interesting applications in computing on encrypted data such as hiding confidential expressions. Mergesort becomes practical using our LIFO queue, ie. it improves prior work (STOC '14) by a factor of (more than) 1000 in terms of comparisons for all practically relevant queue sizes. We are the first to present double-ended (priority) and LIFO queues as well as oblivious quicksort which is asymptotically optimal. Aside from theortical analysis, we also provide an empirical evaluation of all queues.
cs.DS
cs
Oblivious Sorting and Queues Johannes Schneider University of Liechtenstein, Vaduz, Liechtenstein 6 1 0 2 c e D 0 1 ] S D . s c [ 1 v 3 4 3 3 0 . 2 1 6 1 : v i X r a Abstract We present a deterministic oblivious LIFO (Stack), FIFO, double-ended and double-ended priority queue as well as an oblivious mergesort and quicksort algorithm. Our techniques and ideas include concatenating queues end-to-end, size balancing of multiple arrays, several multi-level partitionings of an array. Our queues are the first to enable executions of pop and push operations without any change of the data structure (controlled by a parameter). This enables interesting applications in computing on encrypted data such as hiding confidential expressions. Mergesort becomes practical using our LIFO queue, ie. it improves prior work (STOC '14) by a factor of (more than) 1000 in terms of comparisons for all practically relevant queue sizes. We are the first to present double-ended (priority) and LIFO queues as well as oblivious quicksort which is asymptotically optimal. Aside from theortical analysis, we also provide an empirical evaluation of all queues. Keywords: sorting, queues, complexity, oblivious algorithms, privacy preserving, computation on encrypted data, secure computing, fully homomorphic encryption, secure multi-party computation 1. Introduction Advances in computing on encrypted data such as Fully Homomorphic Encryption (FHE) and secure multi-party computation (SMC) might make outsourcing computation securely practically feasible. Memory access must also be secured. For example, accessing the i-th element of an array of length n needs O(1) operations on RAM machines. But for a program running on encrypted data, the same access mechanism reveals access patterns. The knowledge of seemingly simple access patterns can help to disclose sensitive information such as stock trading patterns [17] or encryption keys [10]. A simple solution requires to access all array elements requiring O(n) instead of O(1) time. Oblivious RAM (ORAM) secures memory access more efficiently using multiple parties. Often relying on more than one party is not desirable. Current solutions for oblivious data structures also do not hide (high level) operations, which makes them unsuitable for omnipresent 'if-then-else' statements with private conditions and queue access in branches. Evaluating a confidential expression, keeping data as well as the expression itself secret, becomes straight forward using our LIFO queue and known techniques for computing on encrypted data. Such a scenario is important for cloud computing, ie. a cloud provider might host data for customers, which run their own analytics functionality. The customers wish to keep their data and algorithms private – in case of industrial automation an algorithm often means a mathematical expression on time-series sensor data.1 To summarize, the main contributions are: 1. We present oblivious LIFO, FIFO and double-ended (priority) queues. The amortized overhead of an operation on the LIFO queue is O(log n) in the maximal length n of the queue. Prior LIFO queues (based on priority queues [21]) required O(log2 n). For a wide range of applications such as the producer-consumer problem in a streaming context our FIFO queue has only O(log n) overhead which improves prior work [21] by a factor log n. We are the first to introduce double-ended queues. Our double-ended queue needs O(log2 n). 2. We are the first to derive oblivious data structures to support push and pop operations that might not alter the 5 10 15 20 stored elements (depending on a parameter). Email address: [email protected] (Johannes Schneider) 1In fact, a request from industry motivated this feature. Preprint submitted to Journal of Theoretical Computer Science June 25, 2018 25 30 35 40 45 50 55 60 65 3. Our deterministic mergesort algorithm improves on [9] for all relevant list sizes, eg. by two orders of magnitude for sorting of 10 billion elements. 4. We state the first oblivious quicksort algorithm. It is asymptotically optimal. The Monte Carlo algorithm succeeds with high probability, ie. 1 − 1/nc for an arbitrary constant c. 1.1. Overview of Technique We structure the array representing the queue in subarrays (SA) of increasing size. A SA might be itself a queue. SAs are organized into parts that are merged and split if they are shifted between different SAs. Moving of elements between SAs can cause some of the push and pop operations to require linear run-time in the maximal queue length. But the time is amortized across many operations so that the average overhead is only (poly)logarithmic. Moving of parts between SAs happens based on the number of pops and pushes. It is not dependent on the data held in the queue. We develop a deterministic calling pattern that does not require knowing the number of stored elements in a queue. This allows to hide the number of operations together with another idea: We permit the pop and push of a special (empty) element that does not alter the number of stored elements in the data structure. Put differently, this disguises whether an operation on the data structure changed the stored elements or not. Furthermore, to ensure efficient access to both ends of a queue, eg. as needed for FIFO and double ended queues, we concatenate two ends of a (LIFO) queue. 1.2. Outline We first discuss our model and some notation (Section 2). The main data structures are given in Section 3 (Stack) with a detailed explanation of core ideas and analysis, Section 4 (FIFO) and Section 5 (double-ended queue). Detailed case studies are given in Section 9 after explaining the technique thoroughly. This includes an explanation how obliviousness (and operation hiding) helps in securing code. Performance evaluation can be found in Section 11. 2. Preliminaries and Limitations We assume knowledge of an upper bound on the maximal number of elements n that can be kept in the data structure, ie. a queue is represented by an array of fixed size n. This assumption is common for oblivious data structures. Adjusting the size of the data structure exactly to the actual number of elements is impossible since our goal is to conceal the number of elements contained in the queue. Our queues support two operations: Push (allowing empty elements) and Pop (allowing conditional popping). For obliviousness we proved an analogous definition as [6]. Essentially, obliviousness implies that memory access patterns are the same for any input. Definition 1. A data structure is oblivious if the sequence of memory access only depends on the number of push and pop operations. A sorting algorithm is oblivious if the sequence of memory accesses is the same regardless of the input. We use a special (empty) element "∅" also denoted by a dash '−' indicating that an element in the queue is unused. Its bit representation must be different from any data item stored in the queue. We use variants of compare and exchange operations. The simplest form takes as input a binary bit b and two variables A and B. It assigns A := B if the bit b is 1, otherwise A is not changed, ie. it computes A := b · B + (1 − b) · A. The compare-exchange-and- erase CmpExEr(b, A, B) performs a compare and exchange as described and, additionally, it might erase B, ie. it sets variable B to ∅ if b is 1 and leaves it unchanged otherwise (see PseudoCode CmpExEr in Algorithm 1). For the analysis we distinguish between input sensitive operations involving parameters of the push and pop elements as well as data of the queue and operations that do not directly depend on any input data (but potentially on the number of operations). The motivation is that for secure computation these distinctions are meaningful, since the former correspond to (slower) operations on encrypted data. For our algorithms input sensitive operations always dominate the time complexity – even when using non-encrypted data. They are split into elementary operations (+,-,·), called E-Ops, and comparisons C-Ops, which are composed of elementary operation. The distinction is motivated since comparisons are used to measure performance of sorting algorithms. For encrypted operations, comparisons might have different time complexities, eg. for SMC such as [19] it is not clear how to perform a comparison in less than Ω(nb · E − Ops) time, where nb is the number of bits of a compared number. 2 3. LIFO (Stack) 70 75 For a Last-In-First-Out (LIFO) queue (also called Stack) a pop operation returns the most recently pushed ele- ment onto the data structure. To ensure obliviousness we access the same array elements independent upon the data contained in the queue. Our queue always accesses the first element. A newly pushed element is stored in the first position of the array. This implies that upon every insertion, we must shift elements to the right to avoid overwriting of a previously inserted element. It is easy to shift the entire queue to the right but this requires linear run-time. To improve efficiency, we logically split the array representing the queue into subarrays (SAs) of exponentially growing size. We only shift parts of size at most 2k of a SA after every 2k push or pop operations. LIFO Queue A with 3 subarrays S(i): A = [S(0) S(1) S(2)] Subarray S(i) with 4 parts P(i,j): S(i) = P(i,0) P(i,1) P(i,2) P(i,3) Part P(i,j) with 2i elements: P(i,j) = E(i,j,0) E(i,j,1) E(i,j,2)...E(i,j,2i-1) Legend: "" separates subarrays, "" parts and " " elements Elements 1-12 pushed to (=>) LIFO Queue: 1 => [ 1 - - - - - - - - - - - - - - - - - - - - - - - - - - -] 2 => [ 2 1 - - - - - - - - - - - - - - - - - - - - - - - - - -] 3 => [ 3 2 1 - - - - - - - - - - - - - - - - - - - - - - - - -] 4 => [ 4 3 - - 2 1 - - - - - - - - - - - - - - - - - - - - - -] 5 => [ 5 4 3 - 2 1 - - - - - - - - - - - - - - - - - - - - - -] 6 => [ 6 5 - - 4 3 2 1 - - - - - - - - - - - - - - - - - - - -] 7 => [ 7 6 5 - 4 3 2 1 - - - - - - - - - - - - - - - - - - - -] 8 => [ 8 7 - - 6 5 4 3 2 1 - - - - - - - - - - - - - - - - - -] 9 => [ 9 8 7 - 6 5 4 3 2 1 - - - - - - - - - - - - - - - - - -] 10 => [10 9 - - 8 7 6 5 4 3 2 1 - - - - - - - - - - - - - - - -] 11 => [1110 9 - 8 7 6 5 4 3 2 1 - - - - - - - - - - - - - - - -] 12 => [1211 - -10 9 8 7 6 5 - - 4 3 2 1 - - - - - - - - - - - -] Elements popped from (<=) LIFO Queue: 12 <= [ -11 - -10 9 8 7 6 5 - - 4 3 2 1 - - - - - - - - - - - -] 11 <= [10 9 - - - - 8 7 6 5 - - 4 3 2 1 - - - - - - - - - - - -] 10 <= [ - 9 - - 8 7 6 5 - - - - 4 3 2 1 - - - - - - - - - - - -] 9 <= [ 8 7 - - - - 6 5 - - - - 4 3 2 1 - - - - - - - - - - - -] 8 <= [ - 7 - - 6 5 - - - - - - 4 3 2 1 - - - - - - - - - - - -] 7 <= [ 6 5 - - - - - - - - - - 4 3 2 1 - - - - - - - - - - - -] 6 <= [ - 5 - - - - - - - - - - 4 3 2 1 - - - - - - - - - - - -] 5 <= [ 4 3 - - - - 2 1 - - - - - - - - - - - - - - - - - - - -] 4 <= [ - 3 - - 2 1 - - - - - - - - - - - - - - - - - - - - - -] 3 <= [ 2 1 - - - - - - - - - - - - - - - - - - - - - - - - - -] 2 <= [ - 1 - - - - - - - - - - - - - - - - - - - - - - - - - -] 1 <= [ - - - - - - - - - - - - - - - - - - - - - - - - - - - -] Figure 1: Pushes and pops onto a LIFO queue More formally, a queue is implemented as an array A that is split into s subarrays (SA) S i growing exponen- tially in size with i. The total length n of the array is n := Ps−1 i=0 S i. Each SA S i itself is partitioned into q parts Pi,0, Pi,1, ..., Pi,q−1 of equal size Pi, j = S i/q. The size of a part varies for different SAs. We denote the k-th element in Pi, j by Ei, j,k. Figure 1 shows the structure of a queue. 80 3.1. Push, Pop and Shifting We explain the shifting procedure shown in Figure 1 for a sequence of push operations. We always push an element onto the first position in the array A (or pop an element from there). After every modification of the queue, 3 Steps for a Push of 6 onto LIFO Queue: Original queue: [ 5 4 3 - - - 2 1 - - - - - - - - - - - - - - - - - - - -] after ShiftPartsRight(Sublist 0): [ - 5 4 3 - - 2 1 - - - - - - - - - - - - - - - - - - - -] after E(0,0,0)=6 [ 6 5 4 3 - - 2 1 - - - - - - - - - - - - - - - - - - - -] final queue after executing emptyTwoParts(Sublist 0): [ 6 5 - - 4 3 - - 2 1 - - - - - - - - - - - - - - - - - -] Executing emptyTwoParts(Sublist 0): Original queue: [ 6 5 4 3 - - 2 1 - - - - - - - - - - - - - - - - - - - -] after ShiftPartsRight(Sublist 1): [ 6 5 4 3 - - - - 2 1 - - - - - - - - - - - - - - - - - -] after shifting P(0,2) to P(1,0): [ 6 5 - 3 4 - - - 2 1 - - - - - - - - - - - - - - - - - -] final queue after shifting of parts P(0,3) to P(2,0): [ 6 5 - - 4 3 - - 2 1 - - - - - - - - - - - - - - - - - -] Figure 2: Steps for pushing an element onto a LIFO queue Algorithm 1 LIFO Initialization(Number of SAs s with s ≥ 1) q := 4 {number of parts per SA} Ei, j,k := ∅, ∀i ∈ [0, s − 1], j ∈ [0, q − 1], k ∈ [0, 2i − 1] npu := npo := 0 {counter for pushes and pops} CmpExEr(b,A,B) A := b · B + (1 − b) · A {Exchange A, B based on b} B := (1 − b) · B + b · ∅ {Delete B based on b} ShiftPartsRight(SA i,doOp) empty&DoOp := doOp if Ei,0,0 , ∅ else 0 for SA j := q − 1 to 1 do doS hi f t := empty&DoOp if Ei, j,0 = ∅ else 0 for Element k = 0 to S i/q − 1 do CmpExEr(doShift, Ei, j,k ,Ei, j−1,k) EmptyTwoParts(SA i) q−1 j=0 (Ei, j,0 = ∅) else 0 isFull := 1 if ∧ ShiftPartsRight(SA i+1,isFull) for SA j := q − 2 to q − 1 do o := ( j − q + 2) · S i/q {offset for last 2 parts} for Element k := 0 to S i/q − 1 do CmpExEr(isFull, Ei+1,0,k+o,Ei, j,k) MoveBetweenSAs(nOps,Operation Op) mi := 0 {Find maximal SA to empty/refill} while (nOps + 1) mod 2mi+1 = 0 do mi := mi + 1 for SA i := min(mi, s − 2) to 0 do Apply Operation Op on SA i return (nOps + 1) mod 2max(0,s−2) ShiftPartsLeft(SA i) f ull&DoOp := 1 if Ei,0,q−1 , ∅ else 0 for SA j := to q − 2 do doS hi f t := f ull&DoOp if Ei, j,0 , ∅ else 0 for Element k := 0 to S i/q − 1 do CmpExEr(doShift, Ei, j,k ,Ei, j+1,k) RefillTwoParts(SA i) q−1 isEmpty := 1 if ∧ j=0 (Ei, j,0 , ∅) else 0 ShiftPartsLeft(SA i+1) for SA j := q − 2 to q − 1 do o := ( j − q + 2) · S i/q {offset for last 2 parts} for Element k := 0 to S i/q − 1 do CmpExEr(doShift, Ei, j,k,Ei+1,0,k+o) Push(Element x) npu := MoveBetweenSAs(npu,EmptyTwoParts) b := 1 if x , ∅ ∧ Ei,0,0 , ∅ else 0 E0,0,0 := x if x , ∅ else E0,0,0 Pop(doPop) result := E0,0,0 if doPop else ∅ E0,0,0 := ∅ if doPop else E0,0,0 npo := MoveBetweenSAs(npo,refillTwoParts) return result 4 85 90 95 100 105 110 115 120 125 130 we modify (some) SAs to ensure that there is space for further pushes in the first SA. We shift elements to the right. Shifting is only done on a part level, ie. either we shift all elements of a part or none. We perform frequent shifts to overwrite empty small parts near the beginning of the array and less frequent shifts are conducted for larger parts situated towards the end of the array. We shift parts within a SA but also move parts between SAs, ie. either we merge two parts into one or we split a part into two parts. The subroutines for a push shown in Algorithm 1 are discussed next. ShiftPartsRight and EmptyTwoParts: ShiftPartsRight shifts elements from one part to the next part (on the right) within a SA. It avoids overwriting of filled parts by checking if the part to be overwritten is indeed empty. To this end, we only check if the first position of a part is empty. No parts are moved, if the first part of the SA is empty. A parameter indicates whether shifting should take place or not. This is necessary to enable executions of push operations that do not modify the queue. If the parameter is false, ie. zero, then no elements are moved. The order of shifting is from back to front, ie. elements of the second to last part are shifted to the last part (given it is empty), then the third to last part is shifted to the second to last (if empty) and so on. EmptyTwoParts empties the last two parts of a SA i by merging them to form the first part of SA i + 1. It first empties the first part in SA i + 1 by doing a ShiftPartsRight. Emptying only takes place if all parts of SA i are full and SA i + 1 is not completely full. Without this condition for q > 2 a full part would be (continuously) shifted towards the right for repeated insertions of the empty element ∅. This would lead to empty SAs followed by (partially) full SAs. As a consequence for pop operations we would have to undo the shifting (or search the entire array). Push: A push operation first ensures that the first position of the array is empty. Then, it inserts the pushed element at the first position. A push and its suboperations are illustrated in Figure 2. MoveBetweenSAs: Restructuring is done after every operation starting from some initial SA (down) to the very first SA in the beginning of the queue. The (index of the) initial SA depends on the number of operations and not the number of actual elements in the queue, which we wish to disguise. Parts of a SA are moved to the next SA, once a SA is full. It might seem reasonable to move all parts of a full SA to the next. However, for alternating pushes and pops this might trigger large performance penalties since parts are continuously moved back and forth between SAs. To disguise the number of elements in the queue (and thus parts), we access all parts in the same deterministic manner for any sequence of pushes of fixed length. Since we allow pushes of a special (empty) element that has no impact on the number of stored elements, the number of operations (as an indicator for the actual number of elements contains) is not exact. We assume that the array grows at a maximal rate, ie. every push is done using a non-empty element. Since we always empty two parts of a SA, we must create space in a SA by moving elements, whenever a sequence of operations could have resulted in the filling of two parts of that SA. For example, every push potentially fills one part in the first SA, since they are of size one. Thus, we would empty the first SA after every second push operation. For SA i with parts of size 2i, we would move two parts to the next SA after every 2i+1 operations. But this approach fails for an arbitrary interleaving of operations pops and pushes of empty and non-empty elements. For example, for the following sequence of pushed elements 1, 2, 3, ∅, 4, 5, the algorithm would attempt to empty the first SA after having pushed 1, 2 and again after 1, 2, 3, ∅. The first SA contains 1,2,3 and misses one element to be full. Thus, the SA would not be emptied and two more elements could be (attempted) to be pushed onto the SA before trying to empty it again, but the SA becomes full after pushing one more element. Therefore, we perform restructuring operations more frequently, ie. for SA i we execute EmptyTwoParts after every 2i operations (rather than after 2i+1). The last SA that can be emptied is the second to last, ie. the one with index s − 2. The restructuring is done in Algorithm MoveBetweenSAs which executes for a push operation EmptyTwoParts on all parts as described. It takes as input the counter of the current operations and returns the next value for the counter, which is (usually) the counter incremented by 1. However, once the maximal possible SA has been shifted the operation counter is reset to zero, eg. for s = 5 the counter is reset after 2s−2 = 8 operations. The sequence of maximal SA indexes where parts might be moved to the next SA is a repetition of the sequence 0,1,0,2,0,1,0,3. Pop: The pop operation (and its subroutines) behave analogously to push but reverse. ShiftPartsLeft shifts parts of a SA within the SA towards the beginning. In contrast to ShiftPartsRight, we do not need a parameter to indicate whether we actually perform the operation or not. ShiftPartsLeft only shifts a part, if the first part is empty. RefillTwoParts moves the first part of SA i + 1 to the beginning of SA i. One full part in SA i + 1 corresponds to two full parts in SA i. As for emptying of parts and right shifts, no non-empty parts are overwritten. 5 3.2. Analysis Theorem 1. The LIFO queue is oblivious. 135 140 145 150 155 160 Proof. According to Definition 1 we require that memory accesses are independent of the input. (They are allowed to be dependent on the number of operations.) None of the procedures in Algorithm 1 accesses memory cell dependent on an input value, ie. all loop-conditions do not depend on the input and any conditional access to memory cells of the form 'cell0:=a if cell1=x else b' can be expressed as multiplications (Section 2). We analyze push and pop operations with respect to time complexity (Theorem 2) and correctness (Theorem 3). In the worst case a single operation might take Ω(n), where n is the maximal length of the queue. We prove that on average, the time is only logarithmic in n. log n i=0 2i+1/2i = O(log n). Theorem 2. For the LIFO queue a pop and push operation requires amortized O(log n) time, ie. 14q log(n/q) E-Ops and 8q + 2 C-Ops. The proof uses that two parts of SA i of length 2 · 2i are refilled (emptied) after every 2i push (pop) operations. Since there are O(log n) SAs we get timeP Proof. SA i is refilled (emptied) after every 2i pop (push) operations. After refilling (emptying) all SAs from index s−2 to 0, ie. after 2s−2 pop (push) operations, we start over by considering SA 0 only. The average run-time increases up to the point, where SA s − 2 is considered. Thus, it suffices to compute the average number of operations for a sequence of 2s−2 pop (push) operations. We analyze pop operations by counting of E-Ops followed by C-Ops. CmpExEr needs 7 E-OPs (2 additions, 1 subtraction, 4 multiplications). ShiftsPartsLeft for SA i needs 2i · 7(q − 1). RefillTwoParts on SA i performs one shift in list i + 1 and moves one part of it, yielding 2i · 7(q − 1) + 2i · 7q = 7 · 2i · q. Since RefillTwoParts on SA i is called after every 2i−1 pops, on average refilling of SA i contributes by 7 · 2i · q/2i−1 = 14q E-Ops. By definition we have n =Ps−1 i=0 q · 2i = q · (2s − 1) yielding s = (log(n/q)) + 1. Summing over all SAs gives i=0 S i =Ps−1 Xi=0 s−2 14q = 14q(s − 1) = 14q log(n/q) The analysis of C-Ops is analogous. CmpExEr contains zero comparisons. In ShiftPartsLeft we perform one com- parison (line 1) and one in each of the 2i · (q − 1) iterations. A refill of SA i takes 2q comparisons (q to compute isEmpty in RefillTwoParts (line 1) and q within ShiftPartsLeft. Therefore, the number of comparisons becomes Ps−2 i=0 2q/2i−1 ≤ 8q. Adding two C-Ops due to lines 1-2 in Algorithm Pop completes the proof for pop. The push operation is analyzed in the same manner. Lemma 1. Each part Pi, j can only be in one of two states: empty (all elements being ∅) or full (no elements being ∅). This follows since we modify either all or none of the elements of a part. Proof. Initially, all parts are empty. Parts of the first SA can only be full or empty, since they contain at most one element. Parts of SA i > 0 are only modified due to mergers, splits and shifting. Right or left shifting of a part within a SA is done for entire parts. The part overwritten is an exact copy of the part being shifted. The part being shifted becomes empty, ie. all elements are set to the empty element. When all parts of SA i are full, the last two parts of a SA, ie. Pq−2,i and Pq−1,i, each of size 2i are shifted to the next SA, ie. to become the first P0,i+1 of size 2i+1. This part is filled completely. A filled part in SA i (see procedure RefillTwoParts) split into two parts of the same size, yields two full parts in SA i − 1. Theorem 3. The LIFO queue works correctly. We show that no elements are overwritten and no empty elements are returned if the array is non-empty since we refill and empty parts of SAs sufficiently often. 6 165 170 175 180 185 190 195 200 205 210 Proof. In Algorithm 1 no parts are overwritten if the first element of a part is non-empty – see definition and usage of variables f ull&doOp, empty&doOp in ShiftPartsLeft/Right; isFull, isEmpty in Empty/RefillTwoParts; line 2 of push with Ei,0,0 , ∅. Since all elements of a part are either the empty element or differ from it (Lemma 1), checking the first element suffices to avoid overwriting of non-empty parts. We first show that there is no interleaving of empty and non-empty SAs. Let the t-th SA be the largest SA such that at least one part is full. All SAs i < t contain at least one non-empty part. An arbitrary sequence of pushes cannot reduce the number of full parts in a SA below two. This follows since we only empty two parts of a SA if all four parts are full. An arbitrary sequence of pops cannot completely empty a SA except the last, since SA i being of size q · 2i is refilled with elements from SA i + 1 after every 2i pops (see MoveBetweenSAs in Algorithm 1). Next we show that there is no interleaving of SAs with some non-empty parts and SAs with only full parts. EmptyT- woParts executes on SA i before it executes on SA j < i. Upon execution there are two possibilities: Either no or two parts are moved to SA i + 1. In the first case at most 3 parts are full in SA i and thus, we could insert one more part, in the second case the SA is full and two parts are emptied. Either way, it suffices to empty SA i after two parts in SA i − 1 (might) have been filled. Since this corresponds to 2i−1 elements, our choice of calling EmptyTwoParts i after every two 2i−1 operations suffices (see MoveBetweenSAs in Algorithm 1). Therefore, not all parts of a SA can be full, if there is space in a larger SA. For refilling parts an analogous argument applies. 4. FIFO A First-In-First-Out (FIFO) queue needs fast access to the first and the last element. We use an array of LIFO queue variants of increasing lengths, ie. each SA of the FIFO queue is itself a LIFO queue. Each LIFO queue stores elements in 'reverse' order, meaning the first element to be popped in the LIFO queue is the oldest element the LIFO queue contains. In this way we can efficiently access the oldest element of each LIFO queue. The array structure is visualized in Figure 3. Each LIFO queue matches on SA. For a pop operation the LIFO queue with largest index that is non-empty is identified. Then an element is popped from that queue. To make the algorithm oblivious we execute a pop operation on every LIFO queue within the FIFO queue. We start from the back and pop an element from each LIFO queue, ie. SA, until the first non-empty LIFO queue has been identified. For the remaining queues we execute pops using a parameter to indicate that, in fact, no element should be popped. The key point is that indepedent of the value of the parameter the same memory cells are accessed. PopperQueue: A LIFO queue offers more functionality than is needed, since we do not push elements in the front but only pop them except for the first queue, which is just a single element. Opposed to a LIFO queue, we can therefore refill a SA completely. We reduce the number of parts from four to two. Using more parts per SA is slower since we must shift the same elements multiple times rather than moving them less often in bigger chunks, ie. larger SAs. We can reuse most LIFO procedures (Algorithm 1) without modification, ie. ShiftsPartLeft, RefillTwoParts and Pop. We call this LIFO variant "PopperQueue". It is a special case of the LIFO queue from Section 3. It has the same (asymptotic) properties, but it is roughly a factor of two faster, since it uses less parts and therefore requires less shifts within a SA, ie. compare Theorem 2 for q = 4 (LIFO) and q = 2 (PopperQueue). Due to the more involved array organization of a FIFO queue, the emptying of parts and refilling of parts needs careful attention. It is not possible to concatenate two parts to get a larger part without extra processing, ie. two arrays (of PopperQueues) placed after each other generally do not yield an array representing a larger PopperQueue with a valid structure. The concatenation could give partially filled parts. For example, assume that there are two queues with one SA and two parts, eg. [1−] and [−4], naive concatenation yields [1 − − 4 − −] having the partially filled part − 4. Furthermore, we have to ensure a correct ordering of the elements within LIFO queues when moving elements between them. If one last part of the PopperQueue stored in SA i is full, we move 2i elements from queue i to the very last part of queue i + 1. We pop one element after the other from queue i and put it directly into the last part of queue i + 1, ie. the element of the j-th pop is put at the j-th position of the last part. At this point the whole queue i + 1 (except the last part that was just inserted) might be empty which would cause subsequent calls of pop on queue i + 1 to fail. Therefore, we attempt to shift elements from the last part of the last SA of LIFO queue i + 1 consisting of newly inserted elements up to the first SA of queue i + 1. 7 FIFO Queue F with 3 LIFO queues A(m) = L u  Subarray S(i) with 2 parts P(i t  (  S(i) = P(i,0) P(i,1) ! "#. $% & (m) wi subarrays S (m) = [S(0) (m-1)] : > ) 2  with 2i elements: P( i456 7 89;<= ,0) E( ?@ABCD EFGHIJKMNOPQRSTUVW i-1) Part P -/013 Elements pus ,'*+ ueue hXY Z[ \]^_ `abc d e fg jk l mno pq r ‚ ƒ„ …† ‡ˆ ‰Š‹ Œ Ž › œ žŸ ¡ ¢£¤ ¥¦ § ´ µ¶ ·¸ ¹º »¼½ ¾¿ À Í ÎÏ ÐÑ ÒÓ ÔÕÖ ×Ø Ù ae çè éê ëì íîï ðñ ò ÿ          ! " 0 12 34 56 789 :; < MN OP QR STUVWX YZ [ - - - - - - - - 2 - - - 2 - - - 2 3 4 - 2 3 4 - 2 3 4 5 6 - - - svw ‘ ©ª ÁÂà ÚÛÜ óôõ #$% 6 6 = >? @ ABC \ ]^ _ `ab Elements pop plm noqr stuv wxyz {}~€  ‚ƒ „… †‡ˆ‰Š‹ Œ Ž Ÿ ¡ ¢£ ¤¥¦§© ª« ¬ ½ ¾¿ ÀÁ ÂÃÄÅAEÇ ÈÉ Ê Û ÜÝ Þss àáâãäå aeç è ù úû üý þÿ   6 6 6 6 6      !" #$% 3 45 68 9:;<=> ?@ AB CDE  ‘ ’ “”• - ®¯ ° ±²³ Ë ÌÍ Î ÏÐÑ é êë ì íîï 7    - - - - - - R ST UV WXYZ[\ ]^ _ l mn opqrs tuv wx y ‡ˆ ‰Š ‹Œ Ž ‘ ’“ ” - - - - - - - - - - - - &'( FGH `ab z{} •–— xy z{ ’“ ”• «¬ -® ÄÅ AEÇ ÝÞ ßà ö÷ øù   &' () DE FG cd ef –— ˜™ ´µ ¶· ÒÓ ÔÕ ðñ òó  )* +, IJ KL cd ef ~ € ˜™ š› - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - - 3 4 - - - - - 2 - - 3 4 - - - - - 2 3 4 - - - - - - - } ~ € – — ˜™š ¯ ° ±²³ È É ÊËÌ á â ãäå ú û üýþ -   * + ,./ H I JKL g h ijk 2 3 4 - - - - - - - 4 - - - - - - - - - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - š › œž ¸ ¹ º»¼ Ö × ØÙÚ ô õ ö÷ø -   . / 012 M N OPQ g h ijk ‚ ƒ „…† œ  žŸ Figure 3: Sequence of pushes and pops onto a FIFO queue 8 The push operation for the FIFO queue appends elements to the end of the very first LIFO queue. Since it is of length two, we shift the second element of it to the left and then set the second position to the newly inserted element. 215 Corollary 1. For the FIFO queue a pop operation requires O(log2 n) and a push O(log n) time on average. i=0 O(i) = O(s2) = O(log2 n). For a push we move blocks of size 2i from SA i, ie. PopperQueue i, to SA i + 1 after every 2i operations, which needs Proof. For a pop of the FIFO queue we do a pop for each of the PopperQueues givingPs time linear in the queue length. Summation givesPs i=0 O(2i/2i) = O(s) = O(log n). 4.1. Fast FIFO (and Double-Ended Queues) FIFO queues are often used as buffers to distribute peak loads across a longer timespan. Commonly, a producer pushes elements onto the queue continuously (as a stream), while a consumer repeatedly takes an element and processes it. Buffering always introduces some delay in processing. Thus, usually an additional delay is tolerable. A pop on the fast FIFO queue only returns an element given the queue has been filled partially, ie. it is at least half full. Our FIFO queue that has only amortized O(log n) overhead rather than O(log2 n). The idea is to use two queues "back to back": one for popping and one for pushing. The two queues share the last part, ie. both treat this part as belonging to them. Thus, elements are pushed onto one of the queues and are continuously shifted to the right with newly inserted elements until they reach the queue for popping. A pop only returns an element after its last part of the last SA (shared with the pushing queue) has been filled. The same ideas also apply to double-ended queues. For the Fast FIFO Queue (B2B Queue) the time complexity of a push and pop matches the corresponding operations for the LIFO queue. Corollary 2. For the B2B-FIFO Queue a pop and push operation require O(log n). 5. Double-Ended Queue A double-ended queue supports popping elements at the head and tail as well as prepending elements at the beginning and appending them at the end. We combine ideas for LIFO and FIFO queues. We use an array of queues (as for FIFO queues) to address the need to push elements to the head of the array and pop them from the tail. Since elements can also be pushed at the back, we use LIFO queues, ie. SA i of the double-ended queue is given by a LIFO queue with i + 1 SAs (rather than PopperQueues). Pushing to the back requires identifying the last non-empty SA, ie. queue, as for popping from the back in the FIFO queue. However, we can only push the element onto the queue, if it is non-full, otherwise we push it onto the next queue. Popping elements from the front might trigger refilling of SAs. In turn, we have to move the newest elements of one SA to another. Identifying the newest elements of a LIFO queue (with elements sorted by age, ie. ascending insertion order) is cumbersome, since there is only efficient access to the oldest element. To reverse order, we remove all elements from the array (using a sequence of pops) and insert them into a temporary LIFO queue. This yields a queue sorted by newest to oldest elements. Then we move elements by popping them from the temporary queue to the queue to refill, ie. for queue i we move 2i+1 elements. The remaining elements are pushed back onto the emptied queue (used to create the temporary LIFO queue). Theorem 4. Any operation on the double-ended queue has amortized time O(log2 n). 220 225 230 235 240 245 Operations are similar to the LIFO queue, except for refilling and emptying that needs an additional logarithmic factor due to the popping and pushing of elements rather than direct access in O(1). 250 Proof. Pushing and popping to the front works the same as for LIFO queues except for the refilling and emptying of full SA. We require an additional logarithmic factor, since we cannot just copy elements of one SA, ie. queue, to another but we first pop them from the LIFO queue onto a temporary queue. More precisely, each element access using a pop requires amortized O(log n) as shown in Theorem 2 rather than O(1). Pushing and popping to the back requires executing a constant number of push and pop operations for all parts constituting LIFO queues. Since we have O(log n) queues and each operation on a LIFO queue requires O(log n) (see Theorem 2), a single push and pop operation requires O(log2 n). 255 9 260 265 270 275 280 285 290 295 300 6. Double-Ended Priority Queue In this scenario, each data item has a priority. A double-ended priority queue can return either the data element with the smallest or largest priority. The queue structure is the same as for double-ended queue. We ensure that each SA, ie. LIFO queue, contains elements sorted in descending priority. When moving elements from one queue to another, ie. to empty a full queue or refill a queue, we first create one single sorted array containing all elements from both queues and then refill the smaller queue up to half of its capacity with the elements of smallest priority and put the other elements in the larger queue. The sorting can be done by merging both arrays. Popping the element of minimum priority requires finding the smallest element in SA 0. Popping the element of maximum priority requires checking all parts, since we do not know which parts contain elements and which do not as well as which part contains the element with largest priority. More precisely, we first (peek) all parts and find the element and part with the maximum element. After that we perform a pop on the (first) queue containing the maximum element. This is done by executing a pop for all parts. The parameter of the pop operation, determining whether the operation indeed removes an element from the queue, must be set accordingly, ie. it is ∅ for all but the queue containing the maximum element. The restructuring is somewhat more involved. Upon a push that requires restructuring, eg. either refilling or emptying queue i we first create one sorted array in increasing order by merging both queues as done for ordinary mergesort (see also Section 7). We then refill SA i until it is half full with the smallest elements (in reversed order) and insert the remaining to the next SA (in reversed order). Theorem 5. Any operation on the double-ended priority queue has amortized time O(log2 n). Proof. We discuss time followed by correctness. Pushing an element to the front (or popping the element of minimum priority) works the same as for LIFO queues except for the emptying and refilling of full SA. We require an additional logarithmic factor to move elements from queue i to queue i + 1 (or the other way around), we create a temporary queue by repeatedly popping the element of maximum priority and adding it to the temporary queue. Each element access using a pop requires amortized O(log n) as shown in Theorem 2 rather than O(1). Moving the elements from the temporary queue onto the (new) queues i and i + 1 has the same asymptotic time complexity. Therefore, push to the front need O(log2 n) time. Popping the maximum priority element requires executing a pop operation for all LIFO queues (plus restructuring). Since we have O(log n) queues and each operation on a LIFO queue requires O(log n) (see Theorem 2), a single push and pop operation requires O(log2 n). Popping the maximum priority element requires executing a pop operation for all LIFO queues (plus restructuring). This requires O(log2 n). Correctness of a pop of maximum priority follows, since we maintain all queues in descending order of priority. Thus, the element of maximum priority is the first element in one of the queues. Since we consider the first elements of all queues and return the one of maximum priority, correctness follows. For the minimum we only investigate the first queue. Since upon every restructuring operation on queue i we keep the smallest half of both queues i and i + 1 in queue i, it holds that after a restructuring all elements in SA i are smaller than any element in SA i + 1 > i. Using induction, we have that the smallest element is in SA 0. 7. Oblivious Mergesort Our oblivious mergesort algorithm (O-Mergesort) divides an unsorted array (or list) into SAs of one element. It repeatedly merges two arrays of equal length to obtain a new sorted array of double the length until there is only one array remaining. This array is sorted. To make the sorting procedure oblivious requires a queue that supports a conditional pop, ie. we pop the element of the array if it is smaller than another element. For short arrays (of length 1), we use a naive sort. Otherwise, two PopperQueues are merged by repeatedly comparing the first element of each queue A and B and appending the smaller one to the result array C. Note, that since A and B are sorted the element put into C is the smallest element in both arrays. We pop an element from the array which element we just appended to C – see Algorithm O-Merge 2. Theorem 6. Sorting of an array of n elements requires at most 85n log n C-Ops and a total of n · (3 + 560(logn − 1) + 28 log2 n) E-Ops. 10 Algorithm 2 O-Merge Input: Sorted PopperQueue A and B of length l Output: Merged LIFO Queue C b := 1 if A[0] ≤ B[0] else 0 C[0] := A[0] · b + B[0] · (1 − b) C[1] := B[0] · b + A[0] · (1 − b) eleA := A.pop(1) {Returns smallest element in A} eleB := B.pop(1) for k = 0 to 2 · l − 2 do 1: if l = 1 then 2: 3: 4: 5: else 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: end if {Set C[k] to the smallest element in A union B and remove the element} b := 1 if eleA ≤ eleB else 0 C[k] := eleA · b + (1 − b) · eleB eleA := A.pop(b) · b + (1 − b) · eleA eleB := A.pop(1 − b) · (1 − b) + b · eleB end for C[2 · l − 1] := eleA · b + (1 − b) · eleB 305 310 315 320 Proof. The merger of two arrays of size l each requires 4l pop operations, each requiring 18 comparisons using Theorem 2 with q = 2. Additionally, we need one more comparison per iteration. This gives a total of 85l S-Ops for merging two arrays. In total we get the following boundP The naive sort of two arrays of size one comparing the two elements requires 5 E-Ops. In total there are n/2 queues of length 1 yielding a total of 5n/2. The merger of two arrays of size l > 1 requires each 4l pop operations, each requiring 28(log(l/2) + 1) = 28 log l E-Ops.2, giving a total of 112l log l. Additionally, we need 5 E-Ops for each of the 2l operations, giving a total of 10l E-Ops. Overall we get l(10 + 112 log l). Overall, we get 2log n− j · 85 · 2 j ≤ 85n log n S-Ops. log n−1 j=0 5n/2 + 2log n− j−1 · 112 · 2 j · (log(2 j) + 10) log n−1 Xj=1 Xj=1 log n−1 = 5n/2 + n · 56 · (log(2 j) + 10) ≤ 3n + 56n(log2 n/2 + 10(log n − 1)) = n · (3 + 560(log n − 1) + 28 log2 n) The analysis uses that we merge n 2i arrays of length 2i and Theorem 2 to bound the time two merge two arrays. We improve on [9] by a factor of more than 1000 in terms of the number of comparisons, ie. C-Ops. Comparisons are often used to analyze sorting algorithms, since typically the total operations involved is proportional to the number of comparisons. In our case, this does not necessarily hold, since we only require one comparison for shifting a large number of elements. Therefore, the costs for shifting might dominate the costs for comparisons. To ensure a fair and objective comparison among algorithms we also analyzed the number of other operations, ie. E-Ops, since they are the dominant factor in our algorithm. With respect to the total number of operations O-Mergesort is asymptotically worse by a factor log n. However, due to the extremely large constants used in the state-of-the-art [9] we use less operations for all practically relevant scenarios, ie. for arrays of length up to roughly 25300. For illustration, when sorting 10 billion elements we need more than 100x less E-Ops. Furthermore, E-Ops (or XORs, ANDs) are generally less complex than comparisons, therefore in practice the speed-up might be even larger. 2We have log(l/2) + 1 rather than log(l/2) using Theorem 2 with q = 2 since we merge arrays of length l = 2x but we only support mergers of arrays of length 2y − 1, thus we need y = x + 1 = log(l/2) + 1 11 325 330 335 340 345 350 355 8. Quicksort Our oblivious quicksort algorithm (O-Quicksort) is a comparison-based divide and conquer algorithm. Small arrays of size at most 4 log2 n are sorted using O-Mergesort. Larger arrays are recursively split into two smaller (sub)arrays. An array is split using a pivot element. All elements less or equal to the pivot are put in one array and all larger elements in the other array. Ideally, both arrays are of the same size. However, naive splitting likely leads to badly balanced arrays leading to O(n2) run-time since an oblivious algorithm must treat both parts as potentially large. However, when choosing the median as pivot, it is possible to ensure that both arrays are of equal size. We compute an approximate median for all elements (Section 8.1). Unfortunately, choosing an approximate median still leaves some uncertainty with respect to the exact array lengths after the splitting. Therefore, in the partition process (Section 8.1), rather than swapping elements within one array, we create two arrays of fixed length, one for elements larger than the pivot and one for all other elements. Since the length of each of the two arrays must be fixed using conservative upper bounds, their sum of lengths exceeds the length of the array to be split. To get a single sorted array requires a special reunification of both arrays (Section 8.2). For simplicity, we assume that all elements to be sorted are distinct. This assumption is removed in Section 8.3. 8.1. Random Pivot Choice and Partition Algorithm RandomPivot chooses several elements uniformly at random, sorts them and picks the median. By choosing the median of a sufficiently large sample of elements we ensure that the chances of a split resulting in very unbalanced arrays is small. We pick a fixed number of samples np, sort them, eg. using the O-MergeSort algorithm, and then pick the middle element l/2 of the sorted array of length l as pivot. Algorithm 3 RandomPivot Input: Array A of length l, number of samples np Output: Pivot p 1: P := Set of np elements of A chosen uniformly at random 2: S P := Sorted samples P {eg. using O-MergeSort} 3: p := S P[l/2] {Choose middle element (= Median) as pivot} For the partitioning the entire array is split into two arrays, one with all elements being smaller than the pivot and one with all elements being larger. The two arrays are given by two LIFO queues. We push elements that are smaller than the approximated median on one of the queues and the larger elements on the other queue. We discuss the case of duplicates in Section 8.3. 1 1 + p13c(log n)/np ≥ 1/4 Theorem 7. Algorithm RandomPivot returns a pivot p such that at least a fraction c f = 1 2 · of elements of an array of length n are larger than p and the same fraction is smaller than p with probability 1 − 1/nc for np ≥ 13 · c · log n. We obtain tail estimates using carefully applied Chernoff bounds. Theorem 8 (Chernoff Bound). The probability that the number X of occurred independent events Xi ∈ {0, 1}, i.e. X := Pi Xi, is not in [(1 − c0)E[X], (1 + c1)E[X]] with c0 ∈]0, 1] and c1 ∈]0, 1[ can be bounded by p(X ≤ (1 − c0)E[X] ∨ X ≥ (1 + c1)E[X]) < 2e−E[X]·min(c0 ,c1)2/3. Proof of Theorem 7: Proof. The value of c f is minimized, when np is smallest. Thus, the bound c f ≥ 1/4 follows from substitution of the lower bound, ie. np = 13 · c · log n, into c f = 1 = 1/4. The theorem holds if the 2 · pivot does not stem from the c f · n smallest or largest elements. If we pick less than c f · np < np/2 elements S ⊆ A from the c f ·n smallest and less than c f ·np < np/2 elements L ⊆ A from the c f ·n largest elements this will be the case. The reason being that the pivot p is the element at position np/2 in the sorted sequence and, thus, it will not be from 1 + p13c(log n)/np 1 = 1/2 · 1 1+ √1 12 360 the set of c f · n smallest or largest elements. We expect to pick c f · np elements S out of the c f · n smallest elements (and analogously for the largest), ie. E[S] = c f · np. We seek the smallest factor f > 1 such that when exceeding the expectation by factor f the pivot is not chosen correctly. We have f · c f · np = np/2, if f = 1/(2 · c f ). The probability that the expectation is exceeded by a factor f > 1 or more is given using a Chernoff bound (see Theorem 8) by prob(S > f · E[S ]) < 1/2( f−1)2 /3·c f ·np ≤ 1/21/12·( f−1)2·np (Using c f ≥ 1/4) = 1/21/12·(1/(2·c f )−1)2·np (Using f = 1/(2 · c f )) = 1/21/12·((1+√13c log n/np)−1)2·np = 1/213/12·c log n = 1/n13/12·c In the same manner we can compute prob(L > f · E[L]). Therefore the probability of both events becomes for n sufficiently large: prob((cid:0)L ≤ f · E[L](cid:1) ∧(cid:0)S ≤ f · E[S ](cid:1)) ≥ 1 −(cid:0)prob(L > f · E[L]) + prob(S > f · E[S ](cid:1) ≥ 1 − 1/nc 365 Expected Length Min. Length B 11 17 29 32 33 39 42 44 46 - - Max. Length C 91 87 84 71 61 51 48 - - - - Copying of elements up to min. Length A 11 17 29 32 33 - - - - - - 61 71 84 87 91 Copying of remaining elements (step by step) A 11 17 29 32 33 39 - - - - 51 61 71 84 87 91 11 17 29 32 33 39 42 - - 48 51 61 71 84 87 91 11 17 29 32 33 39 42 44 - 48 51 61 71 84 87 91 11 17 29 32 33 39 42 44 46 48 51 61 71 84 87 91 Figure 4: Merger of two subarrays within O-Quicksort 8.2. Sorting and End-to-End Array Merger 370 So far we have obtained well-balanced, but unsorted SAs. Since we do not have access to their exact lengths we use a conservative bound on their lengths given by the analysis of the partition process. O-Quicksort recurses on two separate arrays stemming from the partitioning. We sort the array of smaller elements B than the pivot in ascending order and the array of larger elements C in descending order. At the end, both arrays must be merged to get a single final array of sorted elements. This requires some care since we do not know their exact lengths. Due to the partitioning process we can bound the minimum length of B and C to be l/2 · (1 + ǫ) with ǫ := p13 · c · (log n)/l. We copy the elements (up to the guaranteed minimum length bound) to the final array, so that these elements appear sorted. This means we fill the final array with B from the left end towards the right and with C from the right end. The 13 Algorithm 4 O-Quicksort Input: Array A of length l, Sort ascending: asc Output: Sorted array A B, C := Partition(A) O-Quicksort(B, l/2 · (1 + ǫ), T rue)) O-Quicksort(C, l/2 · (1 + ǫ), False)) for k = 0 to l/2 · (1 − 2ǫ) do B[k] := B[k] {Copy elements from B to A} B[l − k] := C[k] {Copy elements from B to A} end for for k = l/2 · (1 − 2ǫ) to l/2 · (1 + ǫ) do 1: ǫ := p13 · c · (log n)/l 2: if l ≥ 4 log2 n then 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: else 15: 16: end if end for if B[k] , v∅ then B[k] := B[k] {Copy elements from B to A} if C[k] , v∅ then B[l − k] := C[k] {Copy elements from C to A} B:= Sort using O-MergeSort or other alg. either ascending or desc. depending on asc 375 entire process is illustrated in Figure 4. The remaining elements are handled in the same fashion, but before setting an array element in A to be an element from B or C, we check whether the element in A is still empty. Theorem 9. O-Quicksort needs O(n log n) C-Ops and E-Ops. It produces a correct sorting with probability 1 − 1/nc for an arbitrary constant c. The recurrences are somewhat involved, since the lengths of both arrays used for recursion exceeds the original length of the array being split. We conduct a staged analysis to obtain (asymptotically tight) bounds. 380 Proof. The complexity T (n) of O-Quicksort in terms of comparisons can be stated using a recurrence. For one call (ignoring recursion) to an array of length l > 4 log2 n we have that the complexity is given by partitioning the array being O(l) plus the reunification of both sorted arrays, ie. the copying of elements being also O(l). Thus, we get a total of O(l) = c0 · l for some constant c0. We obtain the following recurrence for an array of length l using ǫ = √a/l with a := 13 · c · (log n): 385 First call: T (l) = 2T (l/2 · (1 + pa/l)) + c0 · l Second call: T (l/2 · (1 + pa/l)) ≤ 2T (l/4 · (1 + pa/l) · (1 + pa/(l/2))) + c0 · l/2 · (1 + pa/l) ≤ 2T (l/4 ·(cid:0)1 + pa/(l/2)(cid:1)2) + c0 · l/2 · (1 + pa/l) Third call: T (l/4 · (1 + pa/(l/2))2) ≤ 2T (l/8 · (1 + pa/(l/4))3) + c0 · n/8 · (1 + pa/(l/4))3 i-th call: T (l/2i ·(cid:0)1 + pa/(l/2i−1)(cid:1)i) ≤ 2T (l/2i+1 ·(cid:0)1 + pa/(l/2i)(cid:1)i+1) + c0 · l/2i ·(cid:0)1 + pa/(l/2i)(cid:1)i+1 (1) Assume we start splitting the entire array A with l = n. The total number of operations (C-Ops and E-Ops) at recursion depth i is given by the additive term in Equation (1) multiplied by the number of calls to O-Quicksort being 2i, ie. 390 = c0 · n ·(cid:0)1 + pa/(n/2i)(cid:1)i+1 The total operations for the first r := log n − 8 log log n recursions is given by: Xi=0 (cid:0)1 + pa/(log n)8(cid:1)log n 2ic0 · n/2i ·(cid:0)1 + pa/(n/2i)(cid:1)i+1 ≤ c0 · n · c0 · n ·(cid:0)1 + pa/(n/2i)(cid:1)i+1 r−1 r−1 Xi=0 ≤ c0 · n · log n 14 After r recursions the size of the input sequence for the recursive calls is at most n/2r · (1 + pa/(n/2r−1))r ≤ 2· log8 n (for n sufficiently large). For another 6 log log n recursions on an array of length 2 log8 n the number of operations is bounded by: 395 400 405 410 c0 · 2 log8 n · 6 log log n−1 Xi=0 (1 + s 4 log n (log n)2 )6 log log n = c0 · 2 log8 n · 6 log log n−1 (1 + Xi=0 )6 log log n ≤ 4c0 log8 n 2 plog n The size of the remaining arrays is 4 log2 n using the same derivation as above using r recursions. To sort such an array using O-MergeSort requires O(log2 n log log n) C-Ops and O(log2 n(log log n)2) E-Ops (see Theorem 6). There are 2log n−2 log log n = n/ log2 n such arrays, giving a total of O(n log log n) C-Ops and O(n(log log n)2) E-Ops. To obtain a correctly sorted queue all executions of RandomPivot must be successful. We perform at most log n − 2 log log n recursions. Thus, in total there are at most n calls to RandomPivot, each succeeding with probability at least 1 − 1/nc′ for an arbitrary constant c′. The probability that all succeed is at least (1 − 1/nc′)n ≥ 1 − 1/nc′−2. Choosing c′ = c + 2 concludes the proof. 8.3. Equal or Duplicate Elements So far we focused on arrays of distinct elements. For non-distinct elements our algorithm can fail to compute balanced arrays in case the chosen median is not unique. In the most extreme case all elements are the same and the split would result in one empty array and one array being the same as the array to be split. Elements can always be made distinct by appending a unique number at the end, eg. by appending a counter to a array of elements (0, 0, 0), we get (00, 01, 02). We assign elements that are equal to the pivot p to both arrays such that their lengths maintain balanced. In a first phase we create two arrays B, C and maintain a counter lp for the elements equal to p by distinguishing three cases for an element x that is compared to the pivot p, ie. x < p, x > p and x = p. In the first case, we assign x to array B and increment the length counter of lB. In the second case we assign x to C and increment the length counter lC of C. In the third case, we increment just the counter lp. In the second phase we distribute lp copies of p to the arrays B and C such that their difference in length is as small as possible. We perform l iterations, where l is the number of elements in the array to be partitioned, ie. A. In each iteration we subtract one from lp. If lp is zero the arrays remain the same. Otherwise, if the lengths of lB is less than lC, we append a copy of the pivot to B and increment the length counter lB otherwise we do the same for C. The (asymptotic) complexity remains the same. 415 9. Applications 9.1. Confidential Expressions Confidential expressions, hiding data as well as operations on the data are a rather straight forward application of our LIFO queue with conditional operations as well as basic operations, e.g. addition and multiplication, from secure computing schemes such as fully homomorphic encryption (FHE) or secure multi-party computation (MPC). We first discuss the evaluation of non-confidential expressions. For brevity we only discuss the evaluation of expressions involving numbers, additions and multiplications. We focus on evaluating postfix expressions. When using encrypted values, the expression remains confidential. That is to say, despite computing the expression we do not learn anything about the expression except its length. The key to achieve this is the conditional push, ie. we execute a push operation but it only has an impact given that the element to be pushed is different from the special element ∅ that is not appended to the stack. Our algorithm 5 requires linear run-time in terms of the number of elements in the expression (or, more precisely, in the bound we get for the length of the expression). To evaluate confidential expressions, all array elements of the input A must be encrypted as well as variables that depend on the array elements. Variables that indicate array lengths or the number of operations do not have to be encrypted.3 To this end, one can use any of the known scheme for computing on encrypted data such as FHE or MPC, eg. [5] or [19]. These schemes provide basic operations such as addition and multiplication that allow to construct other operations such as comparisons, subtractions and more. However, certain operations like accessing an array 420 425 430 3In Algorithm 5 the values of n and s do not have to be encrypted. In the LIFO queue and its sub-procedures, npu, npo,q,o,mi and s remain unencrypted. All other variables are encrypted. 15 Algorithm 5 Case Study: PostFix expressions Input: LIFO Queue A of postfix symbols of length at most n Output: Result of evaluation 1: st := LIFO(s) {Choose number of SAs s such that array can hold at least n elements} 2: for i := 0 to n − 1 do symb := A.pop(1) 3: toPush := symb if symb is a number else ∅ 4: st.push(toPush) 5: isAdd := 1 if symb = " + " else 0 6: resAdd := st.pop(isAdd) + st.pop(isAdd) 7: isMul := 1 if symb = " ∗ " else 0 8: resMul := st.pop(isMul) · st.pop(isMul) 9: toPush := isMul · resMul + (1 − isMul) · ∅ 10: toPush := isAdd · resAdd + (1 − isAdd) · toPush 11: st.push(toPush) 12: 13: end for 14: return st.pop(1) element using an encrypted index might occur linear overhead in the length of the array. In our case, we manage to keep the asymptotic running time, since we only have to directly substitute additions, subtractions, multiplication and comparisons operations. 435 9.2. Stock Span Analysis 440 445 450 455 The Stock Span Problem is motivated by financial analysis of stocks. The span of a stock's price on day d is the maximum number of consecutive days until day d, where the price of the stock has been at most its price on d. The well-known text book solution is given in Algorithm 6 taking linear time in the number of prices n.4 A straight forward solution gives a quadratic run-time algorithm due to the nested loops, ie. due to the worst case behavior of the inner loop. This renders the solution impractical for larger datasets. The total number of iterations (when being summed across all outer loop iterations) of the inner loop is only n. A single iteration of the inner loop could perform all n iterations for some inputs. To ensure obliviousness we would have to execute (asymptotically) n iterations of the inner loop for every execution of the outer loop. Furthermore, the code contains direct array access, eg. price[i]. In the obvious manner, this would also incur linear run-time overhead. However, it is possible to transform the nested loop by essentially changing the inner loop to an 'if'-conditional first without changing the number of iterations of the outer loop. Then we make the loop oblivious using a conditional expression if-then-else. Essentially, in Algorithm 6 we replace the while and do keyword in line 5 by an if and then. Lines 6 to 8 form the else part. We only show the final pseudocode after the translation of the 'if' into oblivious code in Algorithm 7. Since we must execute both branches of the i f to keep the condition confidential, the algorithm requires that we can execute the 'pop' operation without impacting the data structure, ie. without actually performing a pop. This is supported by our data structure by using a special element in case the condition evaluates to true. The algorithm uses a peek operation, which returns the first element without removing it. It can be implemented using a combination of pop and push operation, eg. x := pop(1), push(x). 10. Related Work In 2009 Gentry [5] introduced a fully homomorphic encryption(FHE) scheme based on lattices. Since then the field of computing on encrypted data (and circuits) has evolved rapidly, as summarized in [15]. All approaches for FHE are based on either addition and multiplication or XOR and AND. Secure computations can also be carried out using multiple parties, such that no party learns a secret (if it does not collude with other parties). Secure multi- party computation was introduced three decades ago [24, 7] and is still subject to extensive research, eg. [19]. Both 4We adjusted it from http://www.geeksforgeeks.org/the-stock-span-problem/ 16 Algorithm 6 Case Study: Stock Span Input: LIFO Queue price of prices of length at most n Output: LIFO S with spans (in reverse order) 1: st := LIFO(s) {Choose number of SAs s such that array can hold at least n elements} 2: st.push(0) 3: S .push(1) {Span first element is 1} 4: for i = 0 to n − 1 do 5: 6: 7: 8: 9: end for while st.peek() , ∅ ∧ price[st[0]] ≤ price[i] do st.pop() span := i + 1 if st.peek() , ∅ else i − st[0] S.push(span) st.append(i) Algorithm 7 Case Study: Oblivious Stock Span Input: LIFO Queue price of prices of length at most n Output: LIFO S with spans (in reverse order) 1: st := LIFO(s) {Choose number of SAs s such that array can hold at least n elements} 2: pi := price.pop(1) 3: st.push((0, pi)) 4: S .push(1) {Span first element is 1} 5: i := 0 6: for k := 0 to n − 1 do (sti,stp) := st.pop(1) 7: popNext := 1 if sti = ∅ or sti ≤ pi else 0 8: pi := price.pop(popNext) · popNext + (1 − popNext) · pi 9: i := i + (1 − popNext) 10: span := i + 1 if st.peek() , ∅ else i − sti 11: span := ∅ if popNext else span 12: S .push(span) 13: pushi := (i, pi) if (1-popNext) else (∅, ∅) 14: st.push(pushi) 15: 16: end for 17 460 465 470 475 480 485 490 495 500 505 510 SMC and FHE can compute expressions beyond addition and multiplication such as comparisons. These operations could be used as black boxes to make our algoritms work on encrypted data. [5, 22] mentioned that circuit privacy is achievable by adding a (large) noise vector of the encrypted 0. The original work on SMC [24] already allowed to hide circuits using garbled circuits. Our approach also allows to achieve circuit privacy in a novel manner by hiding whether a certain operation really impacted the computation. Our work is not limited to circuits. "Oblivious RAM" (ORAM) [6] disguises access patterns by a client from a server using randomization. The original solution [6] is based on a hierarchy of buffers such that each level of the hierarchy consists of several blocks. One block per level is read and always written on the first level. For each level, some blocks are real and some are dummy containing random data. The original algorithm has been improved, eg. in a recent tree-based scheme [20] each data block is stored somewhere in the tree, ie. following a specific path from the root. After an access minor reordering involving the accessed elements takes place, potentially, resulting in some data being sent to the client. Some schemes, eg. [20, 23], trade-off performance (or memory consumption) and the risk for memory access errors. Oblivious data structures for ORAM covering arrays and queues are discussed in [23]. They make use of data access locality encountered for arrays and queues. A single access to a parent node in the position map returns pointers to multiple children. They hide whether the operation is a read or write to a memory cell. However, assuming one knows that a write must occur in a function, one knows that some memory cell is modified. We do not use traditional ORAM techniques. Furthermore, in our scenario, knowing that a certain operation is performed, ie. a pop or push, still gives no hint whether the data structure was modified or not. Other work designed oblivious data structures particularly for SMC, eg. [12, 21]. The work [12] uses ORAM structures and secret sharing among parties to achieve obliviousness. In contrast, [21] presents a deterministic scheme for priority queues using the bucket heap concept for priority queues [3] coming with O(log2 n) overhead. Bucket heaps partition memory into buffers of size 22i+1 and signal blocks of size 22i [3]. Buckets store actual elements, whereas buffers store overflowing elements. Once a buffer is full it is merged into a bucket. [21] adjusted this setting to use blocks of equal size. Our queue shares the common idea of organizing data in blocks of increasing size that is also found in other work, eg. [14]. We differ from prior work [14, 21, 3] in several aspects, eg. we perform a more fine-grained partitioning using multiple blocks, eg. in the view of [21] we introduce one more level of partitioning for buffer and data blocks. We have also come up with a deterministic oblivious sequence of restructuring operations to handle empty and full blocks rather than counting the number of elements in the queue, eg. [21]. In contrast to our work, prior work also does not hide the impact of an operation (ie. they do not hide the number of elements in a bucket), which is essential for securing control structures. Our fast B2B-FIFO queue introduces novel ideas such as block sharing not found in prior work. The paper [1] shows how to compute the k-th ranked element for SMC. The paper [13] discusses median computa- tion. Such operations might prove valuable also for sorting, eg. selecting the median element for quicksort. However, both protocols [1, 13] disclose the outcome of secure comparisons, which might require non-desirable client interac- tion and is not considered secure. The SMC protocol for sorting in [25] runs in constant rounds but needs to know the product of the range of numbers R and it has communication and computational complexity that is proportional to product of the range of numbers times the number of elements, ie. O(n · R) (an improved version has O(n2)). To achieve constant rounds it relies on the evaluation of unbounded fan-in gates. Sorting networks are naturally oblivious, since they use a fixed sequence of comparisons among elements in an array that is not related to the data stored in the array. They have been used for secure sorting in [11, 9]. The work [9] is based on a network with 19600 · n log n comparators. A comparator can be implemented by a comparison yielding a bit b followed by an exchange of two elements A, B, ie. A := b · B + (1 − b) · A and B := b · A + (1 − b) · B. Therefore a comparator needs 7 E-Ops in addition to the comparison, yielding 156800 · n log n operations. Though this is asymptotically optimal, it is of little practical relevance due to the number of comparators needed. Additionally, the depth (of the sorting network) is of order n log n, which makes it non-parallelizable. Our algorithms improve on it for all relevant scenarios (see Section 7 for a detailed comparison). The oblivious randomized Shellshort algorithm [8] is asymptotically optimal in terms of the number of comparisons using several techniques such as permutation of the array as well as shaker and brick passes of the array. Oblivious algorithms for geometric problems are presented in [4]. Algorithms for graphs incurring overhead up to linear factor (in the number of nodes) are given in [2]. Other work [18] based on ORAM designed data structures for maps. They allow for history independence, ie. different sequences of operations lead to indistinguishable (memory layouts of the physical) data structures. 18 11. Evaluation 515 520 525 We shed light on two aspects that are not immediate from the asymptotic analysis. First, on the one hand our oblivious data structures are more involved than using a naive oblivious implementation traversing the entire array for each operation, on the other hand we have shown that asymptotically it outperforms a naive implementation. The key question is, whether our oblivious queues outperform already for queues of small capacity or only for those with large capacity. Therefore, we compared our implementation against a simple 'linear' oblivious queue that accesses all elements (that could be stored) for each operation. Thus, the run-time is linear in the capacity. Second, how much slower is our array compared to a non-oblivious queue. We have shown that the asymptotic factors are of order O(log n) and O(log2 n) depending on the queue type. Here, we give more precise insights. We implemented the benchmarks in Python. The evaluation was run on a machine equipped with an Intel 2.5 GHz quad-core CPU with 8 GB RAM on Windows 7. For the non-oblivious queue we ran 1 Mio. operations. For the oblivous linear queue, ie. the naive oblivious queue traversing the entire array for each operation, we attempted to run 1 Mio operations, but stopped after 1 hour if the computation was still ongoing and estimated the time it would take to compute 1 Mio. operations. For the oblivious data structures we executed max(100000, 2 · capacity) operations, since the maximal run-time is achieved if we execute a multiple of the capacity. Each operation was chosen randomly among a push and pop operation. Due to the obliviousness it does not matter what parameters we use for the push and pop operation. ObliviousFIFO ObliviousFastFIFO ObliviousLinearQueue NonObliviousQueue 105 104 103 102 101 ] s [ e m T i ObliviousLIFO ObliviousLinearQueue NonObliviousQueue 104 103 ] s [ e m T i 102 101 100 27 55 111 223 447 895 1791 3583 7167~2^13~2^14~2^15 100 12 28 60 124 252 508 1020 2044 4092 8188 Queue Capacity (a) FIFO Queues ObliviousDoubleEndedQueue ObliviousLinearQueue NonObliviousQueue 10 6 10 5 10 4 ] s [ e m T i 10 3 10 2 10 1 Queue Capacity (b) LIFO Queues ObliviousDoubleEndedPriorityQueue ObliviousLinearQueue NonObliviousQueue 106 105 104 ] s [ e m T i 103 102 101 10 0 3068 6140 12284 24572 49148 98300 196604 393212 7864281572860 100 3070 6142 ~2^13 ~2^14 ~2^15 ~2^16 ~2^17 ~2^18 ~2^19 ~2^20 Queue Capacit y Queue Capacity (c) Double-Ended Queues (d) Double-Ended Priority Queues Figure 5: Running Times results for 1 Mio. operations for our oblivious queues compared to linear oblivious and non-oblivious queues 19 530 535 540 545 550 The plots in Figures 5a, 5b,5c and 5d show the run-times comparing all queue variants for increasing maximum queue sizes for FIFO and LIFO queues. Qualitatively all queues behave similarly as predicted by the asymptotic analysis. For small queue sizes (LIFO and FastFIFO up to about 60, FIFO up to about 500) a simple linear oblivious queue has an edge over our more complex queues. For double-ended queues performance is somewhat worse, but simple linear queues are also outperformed for moderate queue sizes. With growing queue sizes the exponential gap becomes clearly visible between the linear oblivious queue and our implementations. The LIFO and fast FastFIFO queue are more than 100x faster for queues of capacity about 10000. For FIFO queues we reach the boundary of 100x performance improvement for queues of capacity about 100000. Note, that it is not uncommon that a simple algorithm with bad asymptotic behavior outperforms more complex algorithms. For example, a naive bubble sort might also be faster than mergesort for small data sizes although the later is asymptotically much faster. When it comes to overhead of our oblivious queue compared to the built-in Python queue (surrounded by a wrapper), which uses memory proportional to the actual array size, the asymptotic behavior is well-visible. Our LIFO and FastFIFO queue both have an asymptotic overhead of log n compared to non-oblivious queues that directly accesses queue elements. This results in close to parallel lines in Figures 5b and 5b. The overhead is roughly a factor 40 for queues of size 10000. For FIFO queues the asymptotic overhead is larger, ie. log2 n. The overhead is a factor of 200 for arrays of the same size. In the light of overhead that typically comes with secure computation, eg. FHE or SMC that can reach more than 5-6 orders of magnitude [16], our overhead is very modest. We also want to emphasize that to the best of our knowledge no prior work has compared against a non-oblivious implementation. We believe this is a very important benchmark. 12. Conclusions We have presented oblivious queues accompanied by theoretical and practical investigation having only (poly)logarithmic overhead. Since queues are an essential part of everyday programming, we believe that they will play a major role for enabling computation using encrypted data, in particular with focus on expression hiding. Still, many more common data structures and operations have to be realized efficiently before any of the existing technolo- gies such as FHE and MPC become practical for a large range of applications 555 References [1] G. Aggarwal, N. Mishra, and B. Pinkas. Secure computation of the median (and other elements of specified ranks). Journal of cryptology, 23(3):373–401, 2010. [2] M. Blanton, A. Steele, and M. Alisagari. Data-oblivious graph algorithms for secure computation and outsourcing. In Proceedings of the 8th ACM SIGSAC symposium on Information, computer and communications security, pages 207–218. ACM, 2013. 560 [3] G. S. Brodal, R. Fagerberg, U. Meyer, and N. Zeh. Cache-oblivious data structures and algorithms for undirected breadth-first search and shortest paths. In Algorithm Theory-SWAT 2004, pages 480–492. 2004. [4] D. Eppstein, M. T. Goodrich, and R. Tamassia. Privacy-preserving data-oblivious geometric algorithms for geographic data. In Proceedings of the 18th SIGSPATIAL International Conference on Advances in Geographic Information Systems, pages 13–22. ACM, 2010. [5] C. Gentry. Fully Homomorphic Encryption Using Ideal Lattices. In Proc. 41st ACM Symposium on Theory of Computing, pages 169–178, 565 2009. [6] O. Goldreich. Towards a theory of software protection and simulation by oblivious rams. In Proc. of 19th Symposium on Theory of comput- ing(STOC), pages 182–194, 1987. [7] O. Goldreich, S. Micali, and A. Wigderson. How to play any mental game. In Proc. of 19th Symp. on Theory of computing, pages 218–229, 1987. 570 [8] M. T. Goodrich. Randomized shellsort: A simple oblivious sorting algorithm. In Proceedings of the 21st Symposium on Discrete Algo- rithms(SODA), pages 1262–1277, 2010. [9] M. T. Goodrich. Zig-zag sort: A simple deterministic data-oblivious sorting algorithm running in o (n log n) time. In Proc. of 46th Symp. on Theory of Computing, pages 684–693, 2014. [10] M. S. Islam, M. Kuzu, and M. Kantarcioglu. Access pattern disclosure on searchable encryption: Ramification, attack and mitigation. In 575 NDSS, volume 20, page 12, 2012. [11] K. V. Jonsson, G. Kreitz, and M. Uddin. Secure multi-party sorting and applications. IACR Cryptology ePrint Archive, 2011:122, 2011. [12] M. Keller and P. Scholl. Efficient, oblivious data structures for MPC. pages 506–525, 2014. [13] Y. Lindell and B. Pinkas. Secure multiparty computation for privacy-preserving data mining. Journal of Privacy and Confidentiality, 1(1):5, 2009. 580 [14] J. C. Mitchell and J. Zimmerman. Data-oblivious data structures. In LIPIcs-Leibniz International Proceedings in Informatics, volume 25. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2014. 20 [15] C. Moore, M. O'Neill, E. O'Sullivan, Y. Doroz, and B. Sunar. Practical homomorphic encryption: A survey. In Int. Symp.on Circuits and Systems (ISCAS), pages 2792–2795, 2014. [16] M. Naehrig, K. Lauter, and V. Vaikuntanathan. Can homomorphic encryption be practical? In Proceedings of the 3rd ACM workshop on 585 Cloud computing security workshop, pages 113–124. ACM, 2011. [17] B. Pinkas and T. Reinman. Oblivious RAM revisited. In Advances in Cryptology (CRYPTO), pages 502–519. 2010. [18] D. S. Roche, A. J. Aviv, and S. G. Choi. A practical oblivious map data structure with secure deletion and history independence. arXiv preprint arXiv:1505.07391, 2015. [19] J. Schneider. Lean and fast secure multi-party computation: Minimizing communication and local computation using a helper. SECRYPT, 590 2016, extended version: arXiv:1508.07690, https://arxiv.org/abs/1508.07690. [20] E. Stefanov, M. Van Dijk, E. Shi, C. Fletcher, L. Ren, X. Yu, and S. Devadas. Path oram: An extremely simple oblivious RAM protocol. In Proc. of the SIGSAC conference on Computer & communications security, pages 299–310, 2013. [21] T. Toft. Secure data structures based on multi-party computation. In Proceedings of the 30th annual symposium on Principles of distributed computing, pages 291–292, 2011. 595 [22] M. Van Dijk, C. Gentry, S. Halevi, and V. Vaikuntanathan. Fully homomorphic encryption over the integers. In Advances in cryptology– EUROCRYPT 2010, pages 24–43. 2010. [23] X. S. Wang, K. Nayak, C. Liu, T. Chan, E. Shi, E. Stefanov, and Y. Huang. Oblivious data structures. In Proc. of the Conference on Computer and Communications Security, pages 215–226, 2014. [24] A. C.-C. Yao. How to generate and exchange secrets. In Foundations of Computer Science(FOCS), 1986. [25] B. Zhang. Generic constant-round oblivious sorting algorithm for MPC. In Provable Security, pages 240–256. 2011. 600 21
1904.08150
1
1904
2019-04-17T09:22:20
A Brief Note on Single Source Fault Tolerant Reachability
[ "cs.DS" ]
Let $G$ be a directed graph with $n$ vertices and $m$ edges, and let $s \in V(G)$ be a designated source vertex. We consider the problem of single source reachability (SSR) from $s$ in presence of failures of edges (or vertices). Formally, a spanning subgraph $H$ of $G$ is a {\em $k$-Fault Tolerant Reachability Subgraph ($k$-FTRS)} if it has the following property. For any set $F$ of at most $k$ edges (or vertices) in $G$, and for any vertex $v\in V(G)$, the vertex $v$ is reachable from $s$ in $G-F$ if and only if it is reachable from $s$ in $H - F$. Baswana et.al. [STOC 2016, SICOMP 2018] showed that in the setting above, for any positive integer $k$, we can compute a $k$-FTRS with $2^k n$ edges. In this paper, we give a much simpler algorithm for computing a $k$-FTRS, and observe that it extends to higher connectivity as well. Our results follow from a simple application of \emph{important separators}, a well known technique in Parameterized Complexity.
cs.DS
cs
A Brief Note on Single Source Fault Tolerant Reachability Daniel Lokshtanov∗ Pranabendu Misra† Saket Saurabh‡ Meirav Zehavi§ Abstract Let G be a directed graph with n vertices and m edges, and let s ∈ V (G) be a designated source vertex. We consider the problem of single source reachability (SSR) from s in presence of failures of edges (or vertices). Formally, a spanning subgraph H of G is a k-Fault Tolerant Reachability Subgraph (k-FTRS) if it has the following property. For any set F of at most k edges (or vertices) in G, and for any vertex v ∈ V (G), the vertex v is reachable from s in G − F if and only if it is reachable from s in H − F . Baswana et.al. [STOC 2016, SICOMP 2018] showed that in the setting above, for any positive integer k, we can compute a k-FTRS with 2kn edges. In this paper, we give a much simpler algorithm for computing a k-FTRS, and observe that it extends to higher connectivity as well. Our results follow from a simple application of important separators, a well known technique in Parameterized Complexity. 1 Introduction Fault tolerant data structures aim to capture properties of real world networks, which are often prone to a small number of failures. Such data structures allow us to test various properties of the network after failures have occurred, and the repairs are awaited. The problem is modeled as a directed graph (digraph) G where a small number of edges (or vertices) have failed, and a parameter k is used as a bound on the maximum number of failures that may occur at a time. In this paper, we consider the problem of deciding the reachability of all vertices v ∈ V (G) from a designated source vertex s ∈ V (G) upon the failure of any k edges (or vertices) in the input graph G. Specifically, our objective is to construct a sparse spanning subgraph H of G that preserves all reachability relationships from the source vertex s upon the failure of any k edges (or vertices) in G. More formally, we seek a spanning subgraph H of G with the following property: For any set F of at most k edges (or vertices) in G, and for any vertex v ∈ V (G), there is a path from s to v in G − F if and only if there is a path from s to v in H − F . Such a graph H is called a k-Fault Tolerant Reachability Subgraph (k-FTRS). Observe that, beyond the question of deciding the reachability of a vertex v, the graph H may also be used to find an alternate route from s to v, if one exists, upon the failure of the edges in F . Now, the problem is formally defined as follows. Given as input a digraph G, a designated source vertex s ∈ V (G) and an integer k, we must output a spanning subgraph H of G that is a k-FTRS. Recently, Baswana et al. [3] presented an algorithm for computing a k-FTRS. Specifically, their algorithm runs in time O(2kmn) for a digraph G of n vertices and m edges, and produces a k-FTRS where the in-degree of any vertex is upper bounded by 2k. Their algorithm is based on the notion of farthest min-cut that was introduced by Ford and Fulkerson [14]. They suggest that their methods may be of independent interest in other problems. This is indeed so, for the notion of important separators, which generalizes the notion of furthest cuts, is a well-known technique in Parameterized Complexity [9]. ∗University of California Santa Barbara, USA. [email protected] †Max-Planck Institute for Informatics, Saarbrucken, Germany. [email protected] ‡Institute of Mathematical Sciences, Chennai, India. [email protected] §Ben-Gurion University, Beersheba, Israel. [email protected] 1 The notion of important separators was introduced by Marx [20] to give an FPT algorithm for Multiway Cut. Subsequently, important separators and techniques based on them have been used to resolve the complexity of several important problems such as Directed Feedback Vertex Set [6], Multicut [21], Directed Multiway Cut [7], Almost 2-SAT [24], Parity Multiway Cut [18] and a linear-time FPT algorithm for Directed Feedback Vertex Set [19]. Informally speaking, important separators capture the entire collection of furthest cuts in a graph that have a bounded cardinality. We refer the reader to the textbook of Cygan et al. [9] for an introduction to important separators, and more generally to the various tools and techniques in Parameterized Complexity. Using the notion of important separators, we give a very simple and conceptually appealing algorithm for computing a k-FTRS. Indeed, we generalize the problem slightly. Given a digraph G, a designated source vertex s ∈ V (G), an integer λ and an integer k, we output a spanning subgraph H of G such that for any set F of at most k edges (or vertices) and for any vertex v ∈ V (G), there are λ edge-disjoint paths from s to v in G − F if and only if there are λ such paths in H − F . The graph H is called a (λ, k)-Fault Tolerant Reachability Subgraph ((λ, k)- FTRS). As before, H may be used for both testing the λ-connectivity of a vertex v from s, as well as for obtaining an alternate collection of λ edge-disjoint paths from s to v, if they exist, after the failure of up to k edges (or vertices). In particular, we obtain the following theorem. Theorem 1. There is a (λ, k)-FTRS where each vertex has in-degree at most (k + λ)4k+λ. Further, this graph can be constructed in time O(4k+λ(k + λ)2(m + n)m). Our bound and running time, obtained by a direct application of known results on important separators, are slightly worse than those given by Baswana et al. [3]. Our intent here is to provide a conceptual exposition of the results of Baswana et al [3] and further, introduce important separators as an algorithmic tool for problems on fault tolerant networks, and more generally for distributed network problems. Due to space constraints the discussion of other related works has been postponed to the appendix. Related Work. While a number of results are known about graph reachability for undirected graphs starting from the work of Nagamochi and Ibaraki [22], and more generally in the dy- namic model1 [12], relatively little is known in the case of digraphs. Patrascu and Thorup [23] considered the problem of edge failures in undirected graphs. They constructed a data structure that processes a bath of k edge failures in O(k log2 n log log n) time, and then answers connec- tivity queries for any pair of vertices in O(log log n) time. Subsequent results have led to a randomized data structure that uses almost-linear space (in the number of vertices) and cor- rectly answers the queries with high probability [16]. For vertex failures in undirected graphs, Duan and Pettie [11] gave a data structure that can process a batch of k vertex failures in O(k2c+4 log2 n log log n) time and thereafter answer connectivity queries in O(k) time. Here c is a parameter of the algorithm offering a tradeoff between the running time and the space used. Recently, they improved this algorithm to process the k failures in O(k3 log3 n) time and with the same query time as before, while using O(km log n) space [12, 13]. We refer to [12] for further details. In digraphs, other than [3], an optimal oracle for dual fault tolerant reachability was proposed by Choudhary [8]. Furthermore, fault tolerance in digraphs for shortest paths [10, 4, 17, 5, 1] and strongly connected components [15, 2] were also studied. The various problems in the fault tolerant model for digraphs are subject to extensive ongoing research. We refer to [3, 8, 12, 2, 1] for a detailed discussion and further details. 1Here we have a sequence of edge insertions and deletions, as well as reachability queries, and we must efficiently update the data structure and answer the queries. 2 2 Preliminaries Let G be a digraph on n vertices and m edges. For a subset of edges X ⊆ E(G), we let G − X denote the subgraph of G with vertex set V (G) and edge set E(G) \ X. We omit the braces when the set contains only a single edge, i.e. G− {e} is denoted by G− e. For an edge e = (u, v), u is called the tail of e and v is called the head of v. We denote these vertices by tail(e) and head(e), respectively. For R ⊆ V (G), δ−(R) denotes the set of in-coming edges to R, i.e. the set of edges of G such that tail(e) ∈ V (G) \ R and head(e) ∈ R. Similarly, δ+(R) denotes the set of out-going edges from R. Let G be a digraph and S and T be two disjoint subsets of V (G). A (directed) (S, T )-cut is a subset X of edges of G such that there is no path from a vertex in S to a vertex in T in G − X. Any minimal (S, T )-cut X can be expressed as δ+(R) = X where S ⊆ R ⊆ V (G) \ T is the set of vertices that are reachable from some vertex of S in G − X. Hence, for any (S, T )-cut X, let RX denote the set of vertices that are reachable from S in G − X. The set RX is called the reachability set of X, and if X is minimal, then X = δ+(RX ). An (S, T )-cut X is an important (S, T )-separator if there is no other (S, T )-cut X ′ such that X ′ ≤ X and RX ⊆ RX ′. (Observe that if X is an important (S, T )-separator, then it is a minimal (S, T )-cut.) Let Xk(S, T ) denote the collection of all important (S, T )-separators in G of size at most k. The following observation follows immediately from the definition of important separators. Observation 1. Let Y be any (S, T )-cut of size at most k in G. Then, there is an important (S, T )-separator X ∈ Xk(S, T ) such that X ≤ Y and RY ⊆ RX. We have the following result on the collection Xk(S, T ). Lemma 2 (Theorem 8.36 [9]). The cardinality of Xk(S, T ) is upper bounded by 4k. Furthermore, Xk(S, T ) can be computed in time O(Xk(S, T )k2(m + n)). In this paper, we describe the construction of a (λ, k)-FTRS with respect to edge failures only, because any vertex failure can be modeled by an edge failure: Split every vertex v into an edge (vin, vout), where the incoming and outgoing edges of v are respectively directed into vin and directed out of vout [3]. 3 A simple algorithm for (λ, k)-FTRS Let us first consider the case where λ = 1, i.e. the construction of a k-FTRS. Let v ∈ V (G) \ {s} be an arbitrary vertex, and let X(v) denote the collection of all important (s, v)-separators in G of size at most k + 1. By Lemma 2, there are at most (k + 1)4k+1 edges in the union of all such important separators. We have the following claim. Lemma 3. Let e ∈ δ−(v) \ (SX∈X(v) X). Then, G − e is a k-FTRS of G. Proof. Suppose not, and consider a set F of at most k edges and a vertex w ∈ V (G) such that w is unreachable from s in (G − e) − F , but there is a path from s to w in G − F . Since e ∈ δ−(v), it follows that v is unreachable from s in (G − e) − F , but there is a path from s to v in G − F . Thus, Y = F ∪ {e} is an (s, v)-cut in G. Since G and G − e only differ on e, this implies that e lies on every path from s to v in G − F . We may conclude the following: (a) Y is an (s, v)-cut in G of size at most k + 1; (b) the vertex u := tail(e) belongs to the reachability set of Y , i.e. u ∈ RY . Now, consider the (s, v)-cut Y in the graph G and the collection X(v). Since e /∈ SX∈X(v) X, i.e. e /∈ X for any X ∈ X(v), and e = (u, v), it follows that u /∈ RX for any X ∈ X(v). However, u ∈ RY and Y is (s, v)-cut of cardinality k + 1 in G. This is a contradiction to Observation 1. Hence, G − e is a k-FTRS of G. 3 The above lemma can be turned into an iterative algorithm that gradually bounds the in- degree of each vertex in the graph. Let α = (k + 1)4k+1 denote the upper-bound on δ−(v) ∩ (SX∈X(v) X) for any vertex v ∈ V (G) \ {s}. Algorithm 1 An algorithm to compute a k-FTRS of a digraph G with a source vertex s. 1: procedure FTRS(G, s, k) 2: Delete all incoming edges of the source vertex s in G. while there exists v ∈ V (G) \ {s} such that δ−(v) > α do 3: 4: 5: Compute X(v) via Lemma 2. Pick an edge e ∈ δ−(v) \ (SX∈X(v) X) and delete it. end while 6: 7: end procedure The correctness of the above algorithm follows from Lemma 3. Furthermore, it is clear that this algorithm terminates once the in-degree of every vertex is upper bounded by α. Hence, it runs in time O(4kk2m(m + n)). This gives us the following corollary. Corollary 4. There is a k-FTRS where each vertex has in-degree at most (k + 1)4k+1. Further, this graph can be constructed in time O(4kk2(m + n)m). The following simple lemma extends the above construction (and also the construction of Baswana et al. [3]) to any value of λ. Lemma 5. Let H be a (k + λ − 1)-FTRS of G. Then, H is also a (k, λ)-FTRS of G. Proof. Suppose not. Consider a vertex v ∈ V (G) \ {s} and a set of F of at most k edges such that the following holds: there are λ edge-disjoint paths from s to v in G − F , but there is no such collection of paths in H − F . Consider a minimum (s, v)-cut X in H − F , and observe that X ≤ λ − 1. It follows that Y = F ∪ X is an (s, v)-cut in H of size at most k + λ − 1. However, Y is not an (s, v)-cut in G. This is a contradiction to the fact that H is a (k + λ − 1)-FTRS of G. Therefore, H must be a (λ, k)-FTRS of G. The proof of Theorem 1 follows from Corollary 4 and Lemma 5. References [1] Surender Baswana, Keerti Choudhary, Moazzam Hussain, and Liam Roditty. Approximate single source fault tolerant shortest path. In Proceedings of the Twenty-Ninth Annual ACM- SIAM Symposium on Discrete Algorithms, SODA 2018, New Orleans, LA, USA, January 7-10, 2018, pages 1901 -- 1915, 2018. [2] Surender Baswana, Keerti Choudhary, and Liam Roditty. An efficient strongly connected components algorithm in the fault tolerant model. In 44th International Colloquium on Automata, Languages, and Programming, ICALP 2017, July 10-14, 2017, Warsaw, Poland, pages 72:1 -- 72:15, 2017. [3] Surender Baswana, Keerti Choudhary, and Liam Roditty. Fault-tolerant subgraph for single-source reachability: General and optimal. SIAM J. Comput., 47(1):80 -- 95, 2018. [4] Davide Bil`o, Luciano Gual`a, Stefano Leucci, and Guido Proietti. Multiple-edge-fault- In 33rd Symposium on Theoretical Aspects of tolerant approximate shortest-path trees. Computer Science, STACS 2016, February 17-20, 2016, Orl´eans, France, pages 18:1 -- 18:14, 2016. 4 [5] Greg Bodwin, Fabrizio Grandoni, Merav Parter, and Virginia Vassilevska Williams. Pre- serving distances in very faulty graphs. In 44th International Colloquium on Automata, Languages, and Programming, ICALP 2017, July 10-14, 2017, Warsaw, Poland, pages 73:1 -- 73:14, 2017. [6] Jianer Chen, Yang Liu, Songjian Lu, Barry O'Sullivan, and Igor Razgon. A fixed-parameter algorithm for the directed feedback vertex set problem. J. ACM, 55(5):21:1 -- 21:19, 2008. [7] Rajesh Hemant Chitnis, MohammadTaghi Hajiaghayi, and D´aniel Marx. Fixed-parameter tractability of directed multiway cut parameterized by the size of the cutset. In Proceedings of the Twenty-Third Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2012, Kyoto, Japan, January 17-19, 2012, pages 1713 -- 1725, 2012. [8] Keerti Choudhary. An optimal dual fault tolerant reachability oracle. In 43rd International Colloquium on Automata, Languages, and Programming, ICALP 2016, July 11-15, 2016, Rome, Italy, pages 130:1 -- 130:13, 2016. [9] Marek Cygan, Fedor V. Fomin, Lukasz Kowalik, Daniel Lokshtanov, D´aniel Marx, Marcin Pilipczuk, Michal Pilipczuk, and Saket Saurabh. Parameterized Algorithms. Springer, 2015. [10] Ran Duan and Seth Pettie. Dual-failure distance and connectivity oracles. In Proceedings of the Twentieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2009, New York, NY, USA, January 4-6, 2009, pages 506 -- 515, 2009. [11] Ran Duan and Seth Pettie. Connectivity oracles for failure prone graphs. In Proceedings of the 42nd ACM Symposium on Theory of Computing, STOC 2010, Cambridge, Mas- sachusetts, USA, 5-8 June 2010, pages 465 -- 474, 2010. [12] Ran Duan and Seth Pettie. Connectivity oracles for graphs subject to vertex failures. CoRR, abs/1607.06865, 2016. [13] Ran Duan and Seth Pettie. Connectivity oracles for graphs subject to vertex failures. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2017, Barcelona, Spain, Hotel Porta Fira, January 16-19, pages 490 -- 509, 2017. [14] Lester Randolph Ford Jr and Delbert Ray Fulkerson. Flows in networks. Princeton uni- versity press, 1962. [15] Loukas Georgiadis, Giuseppe F. Italiano, and Nikos Parotsidis. Strong connectivity in In Proceedings of the Twenty-Eighth directed graphs under failures, with applications. Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2017, Barcelona, Spain, Hotel Porta Fira, January 16-19, pages 1880 -- 1899, 2017. [16] David Gibb, Bruce M. Kapron, Valerie King, and Nolan Thorn. Dynamic graph connec- tivity with improved worst case update time and sublinear space. CoRR, abs/1509.06464, 2015. [17] Manoj Gupta and Shahbaz Khan. Multiple source dual fault tolerant BFS trees. In 44th International Colloquium on Automata, Languages, and Programming, ICALP 2017, July 10-14, 2017, Warsaw, Poland, pages 127:1 -- 127:15, 2017. [18] Daniel Lokshtanov and M. S. Ramanujan. Parameterized tractability of multiway cut with parity constraints. In Automata, Languages, and Programming - 39th International Colloquium, ICALP 2012, Warwick, UK, July 9-13, 2012, Proceedings, Part I, pages 750 -- 761, 2012. 5 [19] Daniel Lokshtanov, M. S. Ramanujan, and Saket Saurabh. When recursion is better than iteration: A linear-time algorithm for acyclicity with few error vertices. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2018, New Orleans, LA, USA, January 7-10, 2018, pages 1916 -- 1933, 2018. [20] D´aniel Marx. Parameterized graph separation problems. In Parameterized and Exact Computation, First International Workshop, IWPEC 2004, Bergen, Norway, September 14-17, 2004, Proceedings, pages 71 -- 82, 2004. [21] D´aniel Marx and Igor Razgon. Fixed-parameter tractability of multicut parameterized by the size of the cutset. In Proceedings of the 43rd ACM Symposium on Theory of Computing, STOC 2011, San Jose, CA, USA, 6-8 June 2011, pages 469 -- 478, 2011. [22] Hiroshi Nagamochi and Toshihide Ibaraki. A linear-time algorithm for finding a sparsek- connected spanning subgraph of ak-connected graph. Algorithmica, 7(1):583 -- 596, Jun 1992. [23] Mihai Patrascu and Mikkel Thorup. Planning for fast connectivity updates. In 48th Annual IEEE Symposium on Foundations of Computer Science (FOCS 2007), October 20-23, 2007, Providence, RI, USA, Proceedings, pages 263 -- 271, 2007. [24] Igor Razgon and Barry O'Sullivan. Almost 2-sat is fixed-parameter tractable. J. Comput. Syst. Sci., 75(8):435 -- 450, 2009. 6
1603.03490
2
1603
2016-06-14T06:16:28
A Unifying Formalism for Shortest Path Problems with Expensive Edge Evaluations via Lazy Best-First Search over Paths with Edge Selectors
[ "cs.DS", "cs.RO" ]
While the shortest path problem has myriad applications, the computational efficiency of suitable algorithms depends intimately on the underlying problem domain. In this paper, we focus on domains where evaluating the edge weight function dominates algorithm running time. Inspired by approaches in robotic motion planning, we define and investigate the Lazy Shortest Path class of algorithms which is differentiated by the choice of an edge selector function. We show that several algorithms in the literature are equivalent to this lazy algorithm for appropriate choice of this selector. Further, we propose various novel selectors inspired by sampling and statistical mechanics, and find that these selectors outperform existing algorithms on a set of example problems.
cs.DS
cs
A Unifying Formalism for Shortest Path Problems with Expensive Edge Evaluations via Lazy Best-First Search over Paths with Edge Selectors Christopher M. Dellin and Siddhartha S. Srinivasa The Robotics Institute, Carnegie Mellon University {cdellin, siddh}@cs.cmu.edu 6 1 0 2 n u J 4 1 ] S D . s c [ 2 v 0 9 4 3 0 . 3 0 6 1 : v i X r a Abstract While the shortest path problem has myriad applications, the computational efficiency of suitable algorithms depends inti- mately on the underlying problem domain. In this paper, we focus on domains where evaluating the edge weight function dominates algorithm running time. Inspired by approaches in robotic motion planning, we define and investigate the Lazy Shortest Path class of algorithms which is differentiated by the choice of an edge selector function. We show that sev- eral algorithms in the literature are equivalent to this lazy al- gorithm for appropriate choice of this selector. Further, we propose various novel selectors inspired by sampling and sta- tistical mechanics, and find that these selectors outperform existing algorithms on a set of example problems. 1 Introduction Graphs provide a powerful abstraction capable of represent- ing problems in a wide variety of domains from computer networking to puzzle solving to robotic motion planning. In particular, many important problems can be captured as shortest path problems (Figure 1), wherein a path p∗ of min- imal length is desired between two query vertices through a graph G with respect to an edge weight function w. Despite the expansive applicability of this single abstrac- tion, there exist a wide variety of algorithms in the literature for solving the shortest path problem efficiently. This is be- cause the measure of computational efficiency, and therefore the correct choice of algorithm, is inextricably tied to the un- derlying problem domain. The computational costs incurred by an algorithm can be broadly categorized into three sources corresponding to the blocks in Figure 1. One such source consists of queries on the structure of the graph G itself. The most commonly dis- cussed such operation, expanding a vertex (determining its successors), is especially fundamental when the graph is rep- resented implicitly, e.g. for domains with large graphs such as the 15-puzzle or Rubik's cube. It is with respect to ver- tex expansions that A* (Hart, Nilsson, and Raphael 1968) is optimally efficient. A second source of computational cost consists of main- taining ordered data structures inside the algorithm it- self, which is especially important for problems with large Presented at ICAPS 2016, London. This extended version includes proofs and timing results in the appendix. Graph G = (V, E) Weight Function w : E → [0, +∞] Query u Shortest Path Algorithm Path p∗ Figure 1: While solving a shortest path query, a shortest path algorithm incurs computation cost from three sources: ex- amining the structure of the graph G, evaluating the edge weight function w, and maintaining internal data structures. branching factors. For such domains, approaches such as partial expansion (Yoshizumi, Miura, and Ishida 2000) or it- erative deepening (Korf 1985) significantly reduce the num- ber of vertices generated and stored by either selectively fil- tering surplus vertices from the frontier, or by not storing the frontier at all. The third source of computational cost arises not from reasoning over the structure of G, but instead from evaluat- ing the edge weight function w (i.e. we treat discovering an out-edge and determining its weight separately). Consider for example the problem of articulated robotic motion plan- ning using roadmap methods (Kavraki et al. 1996). While these graphs are often quite small (fewer than 105 vertices), determining the weight of each edge requires performing many collision and distance computations for the complex geometry of the robot and environment, resulting in plan- ning times of multiple seconds to find a path. In this paper, we consider problem domains in which eval- uating the edge weight function w dominates algorithm run- ning time and investigate the following research question: How can we minimize the number of edges we need to evaluate to answer shortest-path queries? We make three primary contributions. First, inspired by lazy collision checking techniques from robotic motion planning (Bohlin and Kavraki 2000), we formulate a class of shortest-path algorithms that is well-suited to problem do- mains with expensive edge evaluations. Second, we show that several existing algorithms in the literature can be ex- pressed as special cases of this algorithm. Third, we show that the extensibility afforded by the algorithm allows for Eeval ← ∅ wlazy(e) ← west(e) ∀e ∈ E loop Algorithm 1 Lazy Shortest Path (LazySP) 1: function LAZYSHORTESTPATH(G, u, w, west) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: pcandidate ← SHORTESTPATH(G, u, wlazy) if pcandidate ⊆ Eeval then Eselected ← SELECTOR(G, pcandidate) for e ∈ Eselected \ Eeval do wlazy(e) ← w(e) Eeval ← Eeval ∪ e return pcandidate (cid:46) Evaluate (expensive) novel edge evaluation strategies, which can outperform ex- isting algorithms over a set of example problems. 2 Lazy Shortest Path Algorithm We describe a lazy approach to finding short paths which is well-suited to domains with expensive edge evaluations. Problem Definition A path p in a graph G = (V, E) is composed of a sequence of adjacent edges connecting two endpoint vertices. Given an edge weight function w : E → [0, +∞], the length of the path with respect to w is then: (cid:88) e∈p len(p, w) = w(e). (1) Given a single-pair planning query u : (vstart, vgoal) inducing a set of satisfying paths Pu, the shortest-path problem is: p∗ = arg min p ∈ Pu len(p, w). (2) A shortest-path algorithm computes p∗ given (G, u, w). Many such algorithms have been proposed to efficiently ac- commodate a wide array of underlying problem domains. The well-known principle of best-first search (BFS) is com- monly employed to select vertices for expansion so as to minimize such expansions while guaranteeing optimality. Since we seek to minimize edge evaluations, we apply BFS to the question of selecting candidate paths in G for evalua- tion. The resulting algorithm, Lazy Shortest Path (LazySP), is presented in Algorithm 1, and can be applied to graphs defined implicitly or explicitly. The Algorithm We track evaluated edges with the set Eeval. We are given an estimator function west of the true edge weight w. This estimator is inexpensive to compute (e.g. edge length or even 0). We then define a lazy weight function wlazy which returns the true weight of an evaluated edge and otherwise uses the inexpensive estimator west. At each iteration of the search, the algorithm uses wlazy to compute a candidate path pcandidate by calling an existing solver SHORTESTPATH (note that this invocation requires no evaluations of w). Once a candidate path has been found, it is Algorithm 2 Various Simple LazySP Edge Selectors 1: function SELECTEXPAND(G, pcandidate) efirst ← first unevaluated e ∈ pcandidate 2: vfrontier ← G.source(efirst) 3: Eselected ← G.out edges(vfrontier) 4: return Eselected 5: 6: function SELECTFORWARD(G, pcandidate) return {first unevaluated e ∈ pcandidate} 7: 8: function SELECTREVERSE(G, pcandidate) return {last unevaluated e ∈ pcandidate} 9: 10: function SELECTALTERNATE(G, pcandidate) if LazySP iteration number is odd then 11: 12: 13: 14: 15: function SELECTBISECTION(G, pcandidate) 16: return {first unevaluated e ∈ pcandidate} return {last unevaluated e ∈ pcandidate} (cid:26) unevaluated e ∈ pcandidate return else furthest from nearest evaluated edge (cid:27) returned if it is fully evaluated. Otherwise, an edge selector is employed which selects graph edge(s) for evaluation. The true weights of these edges are then evaluated (incurring the requisite computational cost), and the algorithm repeats. LazySP is complete and optimal: Theorem 1 (Completeness of LazySP) If the graph G is finite, SHORTESTPATH is complete, and the set Eselected re- turned by SELECTOR returns at least one unevaluated edge on pcandidate, then LAZYSHORTESTPATH is complete. Theorem 2 (Optimality of LazySP) If west is chosen such that west(e) ≤  w(e) for some parameter  ≥ 1 and LAZYSHORTESTPATH terminates with some path pret, then len(pret, w) ≤  (cid:96)∗ with (cid:96)∗ the length of an optimal path. The optimality of LazySP depends on the admissibility of west in the same way that the optimality of A* depends on the admissibility of its goal heuristic h. Theorem 2 estab- lishes the general bounded suboptimality of LazySP w.r.t. the inflation parameter . While our theoretical results (e.g. equivalences) hold for any choice of , for clarity our ex- amples and experimental results focus on cases with  = 1. Proofs are available in the appendix. The Edge Selector: Key to Efficiency The LazySP algorithm exhibits a rough similarity to optimal replanning algorithms such as D* (Stentz 1994) which plan a sequence of shortest paths for a mobile robot as new edge weights are discovered during its traverse. D* treats edge changes passively as an aspect of the problem setting (e.g. a sensor with limited range). The key difference is that our problem setting treats edge evaluations as an active choice that can be exploited. While any choice of edge selector that meets the conditions above will lead to an algorithm that is complete and optimal, its efficiency is dictated by the choice of this selector. This mo- tivates the theoretical and empirical investigation of different edge selectors in this paper. (a) Expand[77] (b) Forward[34] (c) Reverse[24] (d) Alternate[23] (e) Bisection[25] (f) WeightSamp[22] (g) Partition[22] Figure 2: Snapshots of the LazySP algorithm using each edge selector discussed in this paper on the same obstacle roadmap graph problem, with start ( ) and goal ( ). At top, the algorithms after evaluating five edges (evaluated edges labeled as valid invalid). At middle, the final set of evaluated edges. At bottom, for each unique path considered from left to right, the or number of edges on the path that are unevaluated. The total number of edges evaluated is noted in brackets. Note that the scale on the Expand plot has been adjusted because the selector evaluates many edges not on the candidate path at each iteration. evaluated and invalid, and already evaluated, evaluated and valid, Simple selectors. We codify five common strategies in Al- gorithm 2. The Expand selector captures the edge weights that are evaluated during a conventional vertex expansion. The selector identifies the first unevaluated edge efirst on the candidate path, and considers the source vertex of this edge a frontier vertex. It then selects all out-edges of this frontier vertex for evaluation. The Forward and Reverse selectors se- lect the first and last unevaluated edge on the candidate path, respectively (note that Forward returns a subset of Expand). The Alternate selector simply alternates between Forward and Reverse on each iteration. This can be motivated by both bidirectional search algorithms as well as motion plan- ning algorithms such as RRT-Connect (Kuffner and LaValle 2000) which tend to perform well w.r.t. state evaluations. The Bisection selector chooses among those unevaluated edges the one furthest from an evaluated edge on the candi- date path. This selector is roughly analogous to the collision checking strategy employed by the Lazy PRM (Bohlin and Kavraki 2000) as applied to our problem on abstract graphs. In the following section, we demonstrate that instances of LazySP using simple selectors yield equivalent results to ex- isting vertex algorithms. We then discuss two more sophis- ticated selectors motivated by weight function sampling and statistical mechanics. 3 Edge Equivalence to A* Variants In the previous section, we introduced LazySP as the path- selection analogue to BFS vertex-selection algorithms. In this section, we make this analogy more precise. In partic- ular, we show that LazySP-Expand is edge-equivalent to a LazySP Selector Expand Existing Algorithm (Weighted) A* Forward Lazy Weighted A* Alternate Bidirectional Heuristic Front-to-Front Algorithm Result Edge-equivalent (Theorems 3, 4) Edge-equivalent (Theorems 5, 6) Conjectured Table 1: LazySP equivalence results. The A*, LWA*, and BHFFA algorithms use reopening and the dynamic hlazy heuristic (4). variant of A* (and Weighted A*), and that LazySP-Forward is edge-equivalent to a variant of Lazy Weighted A* (see Table 1). It is important to be specific about the conditions under which these equivalences arise, which we detail here. Proofs are available in the appendix. Edge equivalence. We say that two algorithms are edge- equivalent if they evaluate the same edges in the same order. We consider an algorithm to have evaluated an edge the first time the edge's true weight is requested. Arbitrary tiebreaking. For some graphs, an algorithm may have multiple allowable choices at each iteration (e.g. LazySP with multiple candidate shortest paths, or A* with multiple vertices in OPEN with lowest f-value). We will say that algorithm A is equivalent to algorithm B if for any 302010101010101010 Pcandidate (LazySP) Vfrontier Scandidate (A*) Figure 3: Illustration of the equivalence between A* and LazySP-Expand. After evaluating the same set of edges, the next edges to be evaluated by each algorithm can both be expressed as a surjective mapping onto a common set of un- expanded frontier vertices. choice available to A, there exists an allowable choice avail- able to B such that the same edge(s) are evaluated by each. A* with reopening. We show equivalence to variants of A* and Lazy Weighted A* that do not use a CLOSED list to prevent vertices from being visited more than once. A* with a dynamic heuristic. In order to apply A* and Lazy Weighted A* to our problem, we need a goal heuristic over vertices. The most simple may be hest(v) = min p:v→vg len(p, west). (3) Note that the value of this heuristic could be computed as a pre-processing step using Dijkstra's algorithm (Dijkstra 1959) before iterations begin. However, in order for the equivalences to hold, we require the use of the lazy heuristic hlazy(v) = min p:v→vg len(p, wlazy). (4) This heuristic is dynamic in that it depends on wlazy which changes as edges are evaluated. Therefore, heuristic values must be recomputed for all affected vertices on OPEN after each iteration. Equivalence to A* We show that the LazySP-Expand algorithm is edge- equivalent to a variant of the A* shortest-path algorithm. We make use of two invariants that are maintained during the progression of A*. Invariant 1 If v is discovered by A* and v(cid:48) is undiscovered, with v(cid:48) a successor of v, then v is on OPEN. Invariant 2 If v and v(cid:48) are discovered by A*, with v(cid:48) a suc- cessor of v, and g[v] + w(v, v(cid:48)) < g[v(cid:48)], then v is on OPEN. When we say a vertex is discovered, we mean that it is either on OPEN or CLOSED. Note that Invariant 2 holds because we allow vertices to be reopened; without reopening (and with an inconsistent heuristic), later finding a cheaper path to v (and not reopening v(cid:48)) would invalidate the invariant. We will use the goal heuristic hlazy from (4). Note that if an admissible edge weight estimator w exists (that is, w ≤ w), then our A* can approximate the Weighted A* algorithm (Pohl 1970) with parameter  by using west =  w, and the suboptimality bound from Theorem 2 holds. Equivalence. In order to show edge-equivalence, we con- sider the case where both algorithms are beginning a new iteration having so far evaluated the same set of edges. LazySP-Expand has some set Pcandidate of allowable can- didate paths minimizing len(p, wlazy); the Expand selector will then identify a vertex on the chosen path for expansion. A* will iteratively select a set of vertices from OPEN to expand. Because it is possible that a vertex is expanded mul- tiple times (and only the first expansion results in edge eval- uations), we group iterations of A* into sequences, where each sequence s consists of (a) zero or more vertices from OPEN that have already been expanded, followed by (b) one vertex from OPEN that is to be expanded for the first time. We show that both the set of allowable candidate paths Pcandidate available to LazySP-Expand and the set of allow- able candidate vertex sequences Scandidate available to A* map surjectively to the same set of unexpanded frontier ver- tices Vfrontier as illustrated in Figure 3. This is established by way of Theorems 3 and 4 below. Theorem 3 If LazySP-Expand and A* have evaluated the same set of edges, then for any candidate path pcandidate cho- sen by LazySP yielding frontier vertex vfrontier, there exists an allowable A* sequence scandidate which also yields vfrontier. Theorem 4 If LazySP-Expand and A* have evaluated the same set of edges, then for any candidate sequence scandidate chosen by A* yielding frontier vertex vfrontier, there exists an allowable LazySP path pcandidate which also yields vfrontier. Equivalence to Lazy Weighted A* In a conventional vertex expansion algorithm, determining a successor's cost is a function of both the cost of the edge and the value of the heuristic. If either of these components is expensive to evaluate, an algorithm can defer its compu- tation by maintaining the successor on the frontier with an approximate cost until it is expanded. The Fast Downward algorithm (Helmert 2006) is motivated by expensive heuris- tic evaluations in planning, whereas the Lazy Weighted A* (LWA*) algorithm (Cohen, Phillips, and Likhachev 2014) is motivated by expensive edge evaluations in robotics. We show that the LazySP-Forward algorithm is edge- equivalent to a variant of the Lazy Weighted A* shortest- path algorithm. For a given candidate path, the Forward se- lector returns the first unevaluated edge. Variant of Lazy Weighted A*. We reproduce a variant of LWA* without a CLOSED list in Algorithm 3. For the purposes of our analysis, the reproduction differs from the original presentation, and we detail those differences here. With the exception of the lack of CLOSED, the differences do not affect the behavior of the algorithm. The most obvious difference is that we present the orig- inal OPEN list as separate vertex (Qv) and edge (Qe) pri- ority queues, with sorting keys shown on lines 3 and 4. A vertex v in the original OPEN with trueCost(v) = true corresponds to a vertex v in Qv, whereas a vertex v(cid:48) in the original OPEN with trueCost(v(cid:48)) = f alse (and parent v) corresponds to an edge (v, v(cid:48)) in Qe. Use of the edge queue if Qv.TopKey ≤ Qe.TopKey then v ← Qv.Pop() for v(cid:48) ∈ G.GetSuccessors(v) do (cid:46) For uninitialized, g[v] = ∞ g[vstart] ← 0 Qv ← {vstart} (cid:46) Key: g[v] + h(v) Qe ← ∅ (cid:46) Key: g[v] + w(v, v(cid:48)) + h(v(cid:48)) while min(Qv.TopKey, Qe.TopKey) < g[vgoal] do Algorithm 3 Lazy Weighted A* (without CLOSED list) 1: function LAZYWEIGHTEDA*(G, w, w, h) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: Qe.Insert((v, v(cid:48))) (v, v(cid:48)) ← Qe.Pop() if g[v(cid:48)] ≤ g[v] + w(v, v(cid:48)) then gnew ← g[v] + w(v, v(cid:48)) if gnew < g[v(cid:48)] then (cid:46) evaluate else continue g[v(cid:48)] = gnew Qv.Insert(v(cid:48)) obviates the need for duplicate vertices on OPEN with dif- ferent parents and the conf (v) test for identifying such du- plicates. This presentation also highlights the similarity be- tween LWA* and the inner loop of the Batch Informed Trees (BIT*) algorithm (Gammell, Srinivasa, and Barfoot 2015). The second difference is that the edge usefulness test (line 12 of the original algorithm) has been moved from before inserting into OPEN to after being popped from OPEN, but before being evaluated (line 12 of Algorithm 3). This change is partially in compensation for removing the CLOSED list. This adjustment does not affect the edges evaluated. We make use of an invariant that is maintained during the progression of Lazy Weighted A*. Invariant 3 For all vertex pairs v and v(cid:48), with v(cid:48) a succes- sor of v, if g[v] + max(w(v, v(cid:48)), w(v, v(cid:48))) < g[v(cid:48)], then ei- ther vertex v is on Qv or edge (v, v(cid:48)) is on Qe. We will use h(v) = hlazy(v) from (4) and w = wlazy. Note that the use of these dynamic heuristics requires that the Qv and Qe be resorted after every edge is evaluated. Equivalence. The equivalence follows similarly to that for A* above. Given the same set of edges evaluated, the set of allowable next evaluations is identical for each algorithm. Theorem 5 If LazySP-Forward and LWA* have evaluated the same set of edges, then for any allowable candidate path pcandidate chosen by LazySP yielding first unevaluated edge eab, there exists an allowable LWA* sequence scandidate which also yields eab. Theorem 6 If LazySP-Forward and LWA* have evaluated the same set of edges, then for any allowable sequence of vertices and edges scandidate considered by LWA* yielding evaluated edge eab, there exists an allowable LazySP can- didate path pcandidate which also yields eab. Relation to Bidirectional Heuristic Search LazySP-Alternate chooses unevaluated edges from either the beginning or the end of the candidate path at each it- known edges path distribution edge indicator distributions ? . . . Figure 4: Illustration of maximum edge probability selec- tors. A distribution over paths (usually conditioned on the known edge evaluations) induces on each edge e a Bernoulli distribution with parameter p(e) giving the probability that it belongs to the path. The selector chooses the edge with the largest such probability. Algorithm 4 Maximum Edge Probability Selector (for WeightSamp and Partition path distributions) 1: function SELECTMAXEDGEPROB(G, pcandidate,Dp) p(e) ← Pr( e ∈ P ) for P ∼ Dp 2: emax ← unevaluated e ∈ pcandidate maximizing p(e) 3: return {emax} 4: eration. We conjecture that an alternating version of the Ex- pand selector is edge-equivalent to the Bidirectional Heuris- tic Front-to-Front Algorithm (Sint and de Champeaux 1977) for appropriate lazy vertex pair heuristic, and that LazySP- Alternate is edge-equivalent to a bidirectional LWA*. 4 Novel Edge Selectors Because we are conducting a search over paths, we are free to implement selectors which are not constrained to evalu- ate edges in any particular order (i.e. to maintain evaluated trees rooted at the start and goal vertices). In this section, we describe a novel class of edge selectors which is designed to reduce the total number of edges evaluated during the course of the LazySP algorithm. These selectors operate by maintaining a distribution over the set of potential paths P at each iteration of the algorithm (see Figure 4). Such a path distribution induces a Bernoulli distribution for each edge e which indicates its probability p(e) to lie on the potential path; at each iteration, the selectors then choose the unevalu- ated edge that maximizes this edge indicator probability (Al- gorithm 4). The two selectors described in this section differ with respect to how they maintain this distribution over po- tential paths. Weight Function Sampling Selector The first selector, WeightSamp, is motivated by the intuition that it is preferable to evaluate edges that are most likely to lie on the true shortest path. Therefore, it computes its path distribution Dp by performing shortest path queries on sampled edge weight functions drawn from a distribution Dw. This edge weight distribution is conditioned on the the known weights of all previously evaluated edges Eeval: Dp : SP(w) for w ∼ Dw(Eeval). (5) obstacle distribution weight fn distribution path distribution known edges . . . . . . . . . Figure 5: The WeightSamp selector uses the path distribu- tion induced by solving the shortest path problem on a dis- tribution over possible edge weight functions Dw. In this ex- ample, samples from Dw are computed by drawing samples from DO, the distribution of obstacles that are consistent with the known edge evaluations. For example, the distribution Dw might consist of the edge weights induced by a model of the distribution of en- vironment obstacles (Figure 5). Since this obstacle distribu- tion is conditioned on the results of known edge evaluations, we consider the subset of worlds which are consistent with the edges we have evaluated so far. However, depending on the fidelity of this model, solving the corresponding short- est path problem for a given sampled obstacle arrangement might require as much computation as solving the origi- nal problem, since it requires computing the resulting edge weights. In practice, we can approximate Dw by assuming that each edge is independently distributed. Partition Function Selector While the WeightSamp selector captures the intuition that it is preferable to focus edge evaluations in areas that are use- ful for many potential paths, the computational cost required to calculate it at each iteration may render it intractable. One candidate path distribution that is more efficient to compute has a density function which follows an exponential form: Dp : fP (p) ∝ exp(−β len(p, wlazy)). (6) In other words, we consider all potential paths P between the start and goal vertices, with shorter paths assigned more probability than longer ones (with positive parameter β). We call this the Partition selector because this distribution is closely related to calculating partition functions from sta- tistical mechanics. The corresponding partition function is: (7) exp(−β len(p, wlazy)). (cid:88) p∈P Z(P ) = Note that the edge indicator probability required in Algo- rithm 4 can then be written: (a) Initial p(e) scores on a constant-weight grid with β: 50, 33, 28 (b) Initial p(e) scores with ∞-weight obstacles with β: 50, 33, 28 (c) Initial p(e) scores (d) Scores after five evaluations Figure 6: Examples of the Partition selector's p(e) edge score function. (a) With no known obstacles, a high β as- signs near-unity score to only edges on the shortest path; as β decreases and more paths are considered, edges immedi- ately adjacent to the roots score highest. (b) Since all paths must pass through the narrow passage, edges within score highly. (c) For a problem with two a-priori known obstacles (dark gray), the score first prioritizes evaluations between the two. (d) Upon finding these edges are blocked, the next edges that are prioritized lie along the top of the world. Here, P \ e denotes paths in P that do not contain edge e. It may appear advantageous to restrict P to only sim- ple paths, since all optimal paths are simple. Unfortunately, an algorithm for computing (7) efficiently is not currently known in this case. However, in the case that P consists of all paths, there exists an efficient incremental calculation of (7) via a recursive formulation which we detail here. We use the notation Zxy = Z(Pxy), with Pxy the set of paths from x to y. Suppose the values Zxy are known be- tween all pairs of vertices x, y for a graph G. (For a graph with no edges, Zxy is 1 if x = y and 0 otherwise.) Consider a modified graph G(cid:48) with one additional edge eab with weight wab. All additional paths use the new edge eab a non-zero number of times; the value Z(cid:48) xy can be shown to be p(e) = 1 − Z(P \ e) Z(P ) . (8) Z(cid:48) xy = Zxy + ZxaZby exp(βwab) − Zba if exp(βwab) > Zba. (9) Figure 7: Visualization of the first of three articulated motion planning problems in which the HERB robot must move its right arm from the start configuration (pictured) to any of seven grasp configurations for a mug. Shown is the progression of the Alternate selector on one of the randomly generated roadmaps; approximately 2% of the 7D roadmap is shown in gray by projecting onto the space of end-effector positions. This form is derived from simplifying the induced geomet- ric series; note that if exp(βwab) ≤ Zba, the value Z(cid:48) xy is infinite. One can also derive the inverse: given values Z(cid:48), calculate the values Z if an edge were removed. This incremental formulation of (7) allows for the corre- sponding score p(e) for edges to be updated efficiently dur- ing each iteration of LazySP as the wlazy value for edges chosen for evaluation are updated. In fact, if the values Z are stored in a square matrix, the update for all pairs after an edge weight change consists of a single vector outer product. 5 Experiments We compared the seven edge selectors on three classes of shortest path problems. The average number of edges evalu- ated by each, as well as timing results from our implementa- tions, are shown in Figure 8. In each case, the estimate was chosen so that west ≤ w, so that all runs produced optimal paths. The experimental results serve primarily to illustrate that the A* and LWA* algorithms (i.e. Expand and Forward) are not optimally edge-efficient, but they also expose dif- ferences in behavior and prompt future research directions. All experiments were conducted using an open-source im- plementation.1 Motion planning results were implemented using OMPL (S¸ucan, Moll, and Kavraki 2012). Random partially-connected graphs. We tested on a set of 1000 randomly-generated undirected graphs with V = 100, with each pair of vertices sharing an edge with prob- ability 0.05. Edges have an independent 0.5 probability of having infinite weight, else the weight is uniformly dis- tributed on [1, 2]; the estimated weight was unity for all edges. For the WeightSamp selector, we drew 1000 w sam- ples at each iteration from the above edge weight distribu- tion. For the Partition selector, we used β = 2. Roadmap graphs on the unit square. We considered roadmap graphs formed via the first 100 points of the (2, 3)- Halton sequence on the unit square with a connection radius of 0.15, with 30 pairs of start and goal vertices chosen ran- domly. The edge weight function was derived from 30 sam- pled obstacle fields consisting of 10 randomly placed axis- 1https://github.com/personalrobotics/lemur aligned boxes with dimensions uniform on [0.1, 0.3], with each edge having infinite weight on collision, and weight equal to its Euclidean length otherwise. One of the resulting 900 example problems is shown in Figure 2. For the Weight- Samp selector, we drew 1000 w samples with a naıve edge weight distribution with each having an independent 0.1 col- lision probability. For the Partition selector, we used β = 21. Roadmap graphs for robot arm motion planning. We considered roadmap graphs in the configuration space corre- sponding to the 7-DOF right arm of the HERB home robot (Srinivasa et al. 2012) across three motion planning prob- lems inspired by a table clearing scenario (see Figure 7). The problems consisted of first moving from the robot's home configuration to one of 7 feasible grasp configurations for a mug (pictured), second transferring the mug to one of 72 feasible configurations with the mug above the blue bin, and third returning to the home configuration. Each problem was solved independently. This common scenario spans various numbers of starts/goals and allows a comparison w.r.t. diffi- culty at different problem stages as discussed later. For each problem, 50 random graphs were constructed by applying a random offset to the 7D Halton sequence with N = 1000, with additional vertices for each problem start and goal configuration. We used an edge connection radius of 3 radians, resulting E ranging from 23404 to 28109. Each edge took infinite weight on collision, and weight equal to its Euclidean length otherwise. For the WeightSamp selector, we drew 1000 w samples with a naıve edge weight distribution in which each edge had an independent 0.1 prob- ability of collision. For the Partition selector, we used β = 3. 6 Discussion The first observation that is evident from the experimen- tal results is that lazy evaluation -- whether using Forward (LWA*) or one of the other selectors -- grossly outperforms Expand (A*). The relative penalty that Expand incurs by evaluating all edges from each expanded vertex is a func- tion of the graph's branching factor. Since the Forward and Reverse selectors are simply mir- rors of each other, they exhibit similar performance averaged across the PartConn and UnitSquare problem classes, which F R B A PartConn online†(ms) sel (ms) UnitSquare online†(ms) sel (ms) P‡ W E 20.66 20.39 87.10 35.86 34.84 22.23 44.81 1.22 1.96 1.86 1.20 2.41 4807.19 3.32 0.02 0.01 0.01 0.01 0.03 4805.64 2.07 15.58 14.08 69.21 27.29 27.69 17.82 32.62 0.91 1.47 1.49 0.94 1.71 3864.95 1.72 0.01 0.01 0.01 0.01 0.02 3863.49 0.87 56.93 48.07 269.82 5.90 8.22 5.96 7.34 3402.21 5.80 0.00 0.00 0.00 0.00 0.00 3392.76 1.54 269.78 5.87 8.20 5.94 7.31 9.39 4.21 344.74 49.72 95.58 59.44 58.90 73.72 50.66 109.09 4.81 14.81 7.03 7.91 3375.35 7.25 0.00 0.00 0.00 0.00 0.00 3358.82 1.61 16.47 5.59 109.07 4.78 14.77 7.01 7.88 657.02 62.24 98.54 69.96 75.88 66.24 62.16 166.19 3.27 7.36 5.95 5.63 4758.04 5.99 0.00 0.00 0.00 0.00 0.00 4750.16 2.03 7.82 3.91 166.17 3.26 7.34 5.93 5.61 1845.38 78.90 30.70 37.04 69.26 30.82 31.38 534.16 9.61 2.50 4.91 8.47 2073.23 4.17 0.00 0.00 0.00 0.00 0.00 2069.29 0.98 3.90 3.15 ArmPlan(avg) 949.05 63.62 74.94 55.48 68.01 online (s) sel (s) eval (s) ArmPlan1 online (s) sel (s) eval (s) ArmPlan2 online (s) sel (s) eval (s) ArmPlan3 online (s) sel (s) eval (s) 534.10 9.58 2.48 4.89 8.44 (a) Average number of edges evaluated for each problem class and selector. The minimum selector, along with any selector within one unit of its standard error, is shown in bold. The ArmPlan class is split into its three constituent problems. Online timing results are also shown, including the components from the invoking the selec- tor and evaluating edges. †PartConn and UnitSquare involve trivial edge evaluation time. ‡Timing for the Partition selector does not include pre-computation time. 80 60 40 ↑ 80 60 40 100 80 60 E F R A B W P E F R A B W P E F R A B W P (b) PartConn (c) UnitSquare (d) ArmPlan Figure 8: Experimental results for the three problem classes across each of the seven selectors, E:Expand, F:Forward, R:Reverse, A:Alternate, B:Bisection, W:WeightSamp, and P:Partition. In addition to the summary table (a), the plots (b-d) show summary statistics for each problem class. The means and standard errors in (b-c) are across the 1000 and 900 problem instances, respectively. The means and stan- dard errors in (d) are for the average across the three con- stituent problems for each of the 50 sampled roadmaps. are symmetric. However, this need not the case for a particu- lar instance. For example, the start of ArmPlan1 and the goal of ArmPlan3 consist of the arm's single home configuration in a relatively confined space. As shown in the table in Fig- ure 8a, it appears that the better selector on these problems attempts to solve the more constrained side of the problem first. While it may be difficult to determine a priori which part of the problem will be the most constrained, the simple Alternate selector's respectable performance suggests that it may be a reasonable compromise. The per-path plots at the bottom of Figure 2 allow us to characterize the selectors' behavior. For example, Alternate often evaluates several edges on each path before finding an obstacle. Its early evaluations also tend to be useful later, and it terminates after considering 10 paths on the illustrated problem. In contrast, Bisection exhibits a fail-fast strategy, quickly invalidating most paths after a single evaluation, but needing 16 such paths (with very little reuse) before it termi- nates. In general, the Bisection selector did not outperform any of the lazy selectors in terms of number of edges evalu- ated. However, it may be well suited to problem domains in which evaluations that fail tend be less costly. The novel selectors based on path distributions tend to minimize edge evaluations on the problems we considered. While the WeightSamp selector performs similarly to Par- tition on the simpler problems, it performs less well in the ArmPlan domain. This may be because many more samples are needed to approximate the requisite path distribution. The path distribution selectors are motivated by focusing evaluation effort in areas that are useful for many distinct candidate paths, as illustrated in Figure 6. Note that in the absence of a priori knowledge, the edges nearest to the start and goal tend to have the highest p(e) score, since they are members of many potential paths. Because it tends to focus evaluations in a similar way, the Alternate selector may serve as a simple proxy for the more complex selectors. We note that an optimal edge selector could be theoret- ically achieved by posing the edge selection problem as a POMDP, given a probabilistic model of the true costs. While likely intractable in complex domains, exploring this solu- tion may yield useful approximations or insights. Timing results. Figure 8a shows that the five simple se- lectors incur a negligible proportion of the algorithm's run- time. The WeightSamp and Partition selectors both require additional time (especially the former) in order to reduce the time spent evaluating edges. This tradeoff depends in- timately on the problem domain considered. In the ArmPlan problem class, the Partition selector was able to reduce aver- age total online runtime slightly despite an additional 1.54s of selector time. Note that Partition requires an expensive computation of the graph's initial Z-values, which are in- dependent of the true weights and start/goal vertices (and can therefore be pre-computed, e.g. across all ArmPlan in- stances). Full timing results are available in the appendix (Figure 9). Optimizations. While we have focused on edge evalua- tions as the dominant source of computational cost, other considerations may also be important. There are a number of optimizations that allow for efficient implementation of LazySP. The first relates to the repeated invocations of the inner shortest path algorithm (line 5 of Algorithm 1). Because only a small number of edges change weights between in- vocations, an incremental search algorithm such as SSSP (Ramalingam and Reps 1996) or LPA* (Koenig, Likhachev, and Furcy 2004) can be used to greatly improve the speed of the inner searches. Since the edge selector determines where on the graph edges are evaluated, the choices of the selector and the inner search algorithm are related. For example, us- ing the Forward selector with an incremental inner search rooted at the goal results in behavior similar to D* (Stentz 1994) (albeit without the need to handle a moving start lo- cation) since a large portion of the inner tree can be reused. An optimization commonly applied to vertex searches called immediate expansion is also applicable to LazySP. If an edge is evaluated with weight w ≤ west, the inner search need not be run again before the next edge is evaluated. A third optimization is applicable to domains with infi- nite edge costs (e.g. to represent infeasible transitions). If the length of the path returned by the inner shortest path al- gorithm is infinite, LazySP can return this path immediately even if some of its edges remain unevaluated without af- fecting its (sub)optimality. This reduces the number of edge evaluations needed in the case that no feasible path exists. Other methods for expensive edge evaluations. An al- ternative to lazy evaluations is based on the observation that when solved by vertex expansion algorithms, such problems are characterized by slow vertex expansions. To mitigate this, approaches such as Parallel A* (Irani and Shih 1986) and Parallel A* for Slow Expansions (Phillips, Koenig, and Likhachev 2014) aim to parallelize such expansions. We be- lieve that a similar approach can be applied to LazySP. Another approach to finding short paths quickly is to re- lax the optimization objective (2) itself. While LazySP al- ready supports a bounded-suboptimal objective via an in- flated edge weight estimate (Theorem 2), it may also be pos- sible to adapt the algorithm to address bounded-cost prob- lems (Stern, Puzis, and Felner 2011). Acknowledgements We would like to thank Aaron Johnson and Michael Ko- val for their comments on drafts of this work. This work was (partially) funded by the National Science Foundation IIS (#1409003), Toyota Motor Engineering & Manufactur- ing (TEMA), and the Office of Naval Research. References Bohlin, R., and Kavraki, E. 2000. Path planning using Lazy PRM. In IEEE International Conference on Robotics and Automation, volume 1, 521 -- 528. Cohen, B.; Phillips, M.; and Likhachev, M. 2014. Planning In Robotics: single-arm manipulations with n-arm robots. Science and Systems. Dijkstra, E. W. 1959. A note on two problems in connexion with graphs. Numerishe Mathematik 1(1):269 -- 271. Gammell, J.; Srinivasa, S.; and Barfoot, T. 2015. Batch In- formed Trees (BIT*): Sampling-based optimal planning via the heuristically guided search of implicit random geometric graphs. In IEEE International Conference on Robotics and Automation, 3067 -- 3074. Hart, P.; Nilsson, N.; and Raphael, B. 1968. A formal basis for the heuristic determination of minimum cost paths. IEEE Transactions on Systems Science and Cybernetics 4(2):100 -- 107. Helmert, M. 2006. The fast downward planning system. Artificial Intelligence Research 26:191 -- 246. Irani, K. B., and Shih, Y. 1986. Parallel A* and AO* al- gorithms: An optimality criterion and performance evalua- In International Conference on Parallel Processing, tion. 274 -- 277. Kavraki, L.; Svestka, P.; Latombe, J.-C.; and Overmars, M. 1996. Probabilistic roadmaps for path planning in high- IEEE Transactions on dimensional configuration spaces. Robotics and Automation 12(4):566 -- 580. Koenig, S.; Likhachev, M.; and Furcy, D. 2004. Lifelong planning A*. Artificial Intelligence 155(1 -- 2):93 -- 146. Korf, R. E. 1985. Depth-first iterative-deepening: An op- timal admissible tree search. Artificial Intelligence 27:97 -- 109. Kuffner, J., and LaValle, S. 2000. RRT-Connect: An effi- cient approach to single-query path planning. In IEEE Inter- national Conference on Robotics and Automation, volume 2, 995 -- 1001. Phillips, M.; Koenig, S.; and Likhachev, M. 2014. Paral- lel A* for planning with time-consuming state expansions. In International Conference on Automated Planning and Scheduling. Pohl, I. 1970. Heuristic search viewed as path finding in a graph. Artificial Intelligence 1(34):193 -- 204. Ramalingam, G., and Reps, T. 1996. An incremental al- gorithm for a generalization of the shortest-path problem. Journal of Algorithms 21(2):267 -- 305. Sint, L., and de Champeaux, D. 1977. An improved bidirec- tional heuristic search algorithm. J. ACM 24(2):177 -- 191. Srinivasa, S.; Berenson, D.; Cakmak, M.; Collet, A.; Dogar, M.; Dragan, A.; Knepper, R.; Niemueller, T.; Strabala, K.; Vande Weghe, M.; and Ziegler, J. 2012. HERB 2.0: Lessons learned from developing a mobile manipulator for the home. Proceedings of the IEEE 100(8):2410 -- 2428. Stentz, A. 1994. Optimal and efficient path planning for partially-known environments. In IEEE International Con- ference on Robotics and Automation, volume 4, 3310 -- 3317. Stern, R.; Puzis, R.; and Felner, A. 2011. Potential search: A bounded-cost search algorithm. In International Conference on Automated Planning and Scheduling. S¸ucan, I. A.; Moll, M.; and Kavraki, L. E. 2012. The Open IEEE Robotics & Automation Motion Planning Library. Magazine 19(4):72 -- 82. http://ompl.kavrakilab.org. Yoshizumi, T.; Miura, T.; and Ishida, T. 2000. A* with partial expansion for large branching factor problems. In AAAI Conference on Artificial Intelligence, 923 -- 929. A Appendix: Proofs LazySP Proof of Theorem 2 Let p∗ be an optimal path w.r.t. w, with (cid:96)∗ = len(p∗, w). Since west(e) ≤  w(e) and  ≥ 1, it follows that regardless of which edges are stored in Weval, wlazy(e) ≤  w(e), and therefore len(p∗, wlazy) ≤  (cid:96)∗. Now, since the inner SHORTESTPATH algorithm terminated with pret, we know that len(pret, wlazy) ≤ len(p∗, wlazy). Further, since the algorithm terminated with pret, each edge on pret has been evaluated; therefore, len(pret, w) = len(pret, wlazy). Therefore, len(pret, w) ≤  (cid:96)∗. (cid:3) Proof of Theorem 1 In this case, the algorithm will evalu- ate at least unevaluated edge at each iteration. Since there are a finite number of edges, eventually the algorithm will (cid:3) terminate. A* Equivalence Proof of Invariant 1 If v is discovered, then it must either be on OPEN or CLOSED. v can be on CLOSED only after it has been expanded, in which case v(cid:48) would be discovered (cid:3) (which it is not). Therefore, v must be on OPEN. Proof of Invariant 2 Clearly the invariant holds at the be- ginning of the algorithm, with only vstart on OPEN. If the invariant were to no longer hold after some iteration, then there must exist some pair of discovered vertices v and v(cid:48) with v on CLOSED and g[v]+w(v, v(cid:48)) < g[v(cid:48)]. Since v is on CLOSED, it must have been expanded at some previous iter- ation, immediately after which the inequality could not have held because g[v(cid:48)] is updated upon expansion of v. There- fore, the inequality must have newly held after some inter- vening iteration, with v remaining on CLOSED. Since the values g are monotonically non-increasing and w is fixed, this implies that g[v] must have been updated (lower). How- ever, if this had happened, then v would have been removed from CLOSED and placed on OPEN. This contradiction im- (cid:3) plies that the invariant holds at every iteration. Proof of Theorem 3 Consider path p∗ lazy with length (cid:96)∗ lazy yielding frontier vertex vfrontier via SELECTEXPAND. Con- struct a vertex sequence s as follows. Initialize s with the vertices on p∗ lazy from vstart to vfrontier, inclusive. Let N be the number of consecutive vertices at the start of s for which f (v) = (cid:96)∗ lazy, vstart, must lazy, so N ≥ 1.) Remove from the start of s have f (vstart) = (cid:96)∗ the first N − 1 vertices. Note that at most the first vertex on s has f (v) = (cid:96)∗ lazy, and the last vertex on s must be vfrontier. Now we show that each vertex in this sequence s, consid- ered by A* in turn, exists on OPEN with minimal f-value. Iteratively consider the following procedure for sequence s. Throughout, we know that there must not be any vertex with f (v) < (cid:96)∗ lazy; that would imply that a different path through vb shorter than (cid:96)∗ lazy could not have been chosen. If the sequence has length > 1, then consider the first two vertices on s, va and vb. By construction, f (va) = (cid:96)∗ lazy and f (vb) (cid:54)= (cid:96)∗ lazy. In fact, from above we know that f (vb) > (cid:96)∗ lazy. Therefore, we have that f (va) < f (vb), therefore and lazy (Note that the first vertex on p∗ lazy exists, in which case p∗ g[va] + w(va, vb) < g[vb]. By Invariant 2, va must be on OPEN, and with f (va) = (cid:96)∗ lazy, it can therefore be consid- ered by A*. After it is expanded, f (vb) = (cid:96)∗ lazy, and we can repeat the above procedure with the sequence formed by re- moving the va from s. If instead the sequence has length 1, then it must be ex- actly (vfrontier), with f (vfrontier) = (cid:96)∗ lazy. Since the edge after f (vfrontier) is not evaluated, then by Invariant 1, vfrontier must (cid:3) be on OPEN, and will therefore be expanded next. Proof of Theorem 4 Given that all vertices in scandidate be- sides the last are re-expansions, they can be expanded with no edge evaluations. Once the last vertex, vfrontier, is to be expanded by A*, suppose it has f-value (cid:96). First, we will show that there exists a path with length (cid:96) w.r.t. wlazy wherein all edges before vfrontier have been eval- uated, and the first edge after vfrontier has not. Let pa be a shortest path from vstart to vfrontier consisting of only evalu- ated edges. The length of this pa must be equal to g[vfrontier]; if it were not, there would be some previous vertex on pa with lower f-value than vfrontier, which would necessarily have been expanded first. Let pb be the a shortest path from vfrontier to vgoal. The length of pb must be hlazy(vfrontier) by definition. Therefore, the path (pa, pb) must have length (cid:96), and since vfrontier is a new expansion, the first edge on pb must be unevaluated. Second, we will show that there does not exist any path shorter than (cid:96) w.r.t. wlazy. Suppose p(cid:48) were such a path, with length (cid:96)(cid:48) < (cid:96). Clearly, vstart would have f-value (cid:96)(cid:48) (although it may not be on OPEN). Consider each pair of vertices (va, vb) along p(cid:48) in turn. In each case, if vb were either undis- covered, or if g[va]+w(va, vb) < g[vb], then va would be on OPEN (via Invariants 1 and 2, respectively) with f (va) = (cid:96)(cid:48), and would therefore have been expanded before vfrontier. Oth- erwise, we know that f (vb) = (cid:96)(cid:48), and we can continue to the (cid:3) next pair on p(cid:48). LWA* Equivalence Proof of Invariant 3 Clearly the invariant holds at the be- ginning of the algorithm with only g[vstart] = 0, since the inequality holds only for the out-edges of vstart, with vstart on Qv. Consider each subsequent iteration. If a vertex v is popped from Qv, then this may invalidate the invariant for all successors of v; however, since all out-edges are immedi- ately added to Qe, the invariant must hold. Consider instead if an edge (v, v(cid:48)) which satisfies the inequality is popped from Qe. Due to the inequality, we know that g[v(cid:48)] will be recalculated as g[v(cid:48)] = g[v] + w(v, v(cid:48)), so that the inequality is no longer satisfied for edge (v, v(cid:48)). However, reducing the value g[v(cid:48)] may introduce satisfied inequalities across sub- sequent out-edges of v(cid:48), but since v(cid:48) is added to Qv, the in- (cid:3) variant continues to hold. Proof of Theorem 5 In the first component of the equiva- lence, we will show that for any path p minimizing wlazy allowable to LazySP-Forward, with (va, vb) the first uneval- uated edge on p, there exists a sequence of vertices and edges on Qv and Qe allowable to LWA* such that edge (va, vb) is the first to be newly evaluated. Let the length of p w.r.t. wlazy be (cid:96).' We will first show that no vertex on Qv or edge on Qe can have f (·) < (cid:96). Suppose such a vertex v, or edge e with source vertex v, exists. Then g[v] + h(v) < (cid:96), and there must be some path p(cid:48) consisting of an evaluated segment from vstart to v of length g[v], followed a segment from v to vgoal of length h(v). But then this path should have been chosen by LazySP. Next, we will show a procedure for generating an allow- able sequence for LWA*. We will iteratively consider a se- quence of path segments, starting with the segment from vstart to va, and becoming progressively shorter at each it- eration by removing the first vertex and edge on the path. We will show that the first vertex on each segment vf has g[vf ] = (cid:96)− h(vf ). By definition, this is true of the first such segment, since g[vstart] = 0. For each but the last such seg- ment, consider the first edge, (vf , vs). If vs has the correct g[·], we can continue to the next segment immediately. Oth- erwise, either vf is on Qv or (vf , vs) is on Qe by Invariant 3. If the former is true, then vf can be popped from Qv with f = (cid:96), thereby adding (vf , vs) to Qe. Then, (vf , vs) can be popped from Qe with f = (cid:96), resulting in g[vs] = (cid:96) − h(vs). We can then move on to the next segment. At the end of this process, we have the trivial segment (va), with g[va] = (cid:96) − h(va). If va is on Qv, then pop it (with f (va) = (cid:96)), placing eab on Qe; otherwise, since eab is unevaluated, it must already be on Qe. Since f (eab) = (cid:96), we (cid:3) can pop and evaluate it. Proof of Theorem 6 Given that all vertices in scandidate en- tail no edge evaluations, and all edges therein are re- expansions, they can be considered with no edge evalua- tions. Once the last edge exy is to be expanded by LWA*, suppose it has f-value (cid:96). First, we will show that there exists a path with length (cid:96) w.r.t. wlazy which traverses unevaluated edge exy wherein all edges before vx have been evaluated. Let px be a shortest path segment from vstart to vx consisting of only evaluated edges. The length of px must be equal to g[vx]; if it were not, there would be some previous vertex on px with lower f- value than vx, which would necessarily have been expanded first. Let py be the a shortest path from vy to vgoal. The length of py must be hlazy(vy) by definition. Therefore, the path (px, exy, py) must have length (cid:96). Second, we will show that there does not exist any path shorter than (cid:96) w.r.t. wlazy. Suppose p(cid:48) were such a path, with length (cid:96)(cid:48) < (cid:96), and with first unevaluated edge e(cid:48) xy. Clearly, vstart has g[vstart] = (cid:96)(cid:48) − h(vstart). Consider each evaluated b] (cid:54)= (cid:96)(cid:48) − h(v(cid:48) edge e(cid:48) b), ab would be on Qv or Qe with f (·) = (cid:96)(cid:48), then either v(cid:48) and would therefore be expanded before exy. Therefore, e(cid:48) would then be popped from Qe with f (e(cid:48) xy) = (cid:96)(cid:48), and it would have been evaluated before exy with f (exy) = (cid:96). (cid:3) ab along p(cid:48) in turn. In each case, if g[v(cid:48) a or e(cid:48) xy B Appendix: Timing Results We include an accounting of the cumulative computation time taken by each component of LazySP for each of the seven selectors for each problem class (Figure 9). PartConn total (ms) sel-init (ms) online (ms) search (ms) sel (ms) eval (ms) eval (edges) UnitSquare total (ms) sel-init (ms) online (ms) search (ms) sel (ms) eval (ms) eval (edges) ArmPlan (avg) total (s) sel-init (s) online (s) search (s) sel (s) eval (s) eval (edges) ArmPlan1 total (s) sel-init (s) online (s) search (s) sel (s) eval (s) eval (edges) ArmPlan2 total (s) sel-init (s) online (s) search (s) sel (s) eval (s) eval (edges) ArmPlan3 total (s) sel-init (s) online (s) search (s) sel (s) eval (s) eval (edges) Expand Forward Reverse Alternate Bisect WeightSamp Partition 1.22 ± 0.04 -- 1.22 ± 0.04 0.48 ± 0.01 0.02 ± 0.00 -- 87.10 ± 2.39 35.86 ± 1.04 34.84 ± 1.04 22.23 ±0.60 44.81 ±1.11 2.41 ±0.06 4807.19 ±135.22 -- -- 2.41 ±0.06 4807.19 ±135.22 1.38 ±0.04 0.70 ± 0.02 0.03 ±0.00 4805.64 ±135.18 -- 20.66 ± 0.57 1.86 ± 0.06 -- 1.86 ± 0.06 1.05 ± 0.03 0.01 ± 0.00 -- 1.96 ± 0.06 -- 1.96 ± 0.06 1.12 ± 0.03 0.01 ± 0.00 -- 1.20 ±0.03 -- 1.20 ±0.03 0.68 ±0.02 0.01 ±0.00 -- -- 0.91 ± 0.03 -- 0.91 ± 0.03 0.35 ± 0.01 0.01 ± 0.00 -- 69.21 ± 2.55 27.29 ± 1.03 27.69 ± 1.02 17.82 ±0.60 32.62 ±0.72 1.71 ±0.04 3864.95 ±117.66 -- -- 1.71 ±0.04 3864.95 ±117.66 0.92 ±0.02 0.75 ± 0.02 0.02 ±0.00 3863.49 ±117.62 -- 15.58 ± 0.47 1.49 ± 0.06 -- 1.49 ± 0.06 0.82 ± 0.03 0.01 ± 0.00 -- 1.47 ± 0.06 -- 1.47 ± 0.06 0.79 ± 0.03 0.01 ± 0.00 -- 0.94 ±0.03 -- 0.94 ±0.03 0.51 ±0.02 0.01 ±0.00 -- -- 7.03 ±0.63 -- 7.03 ±0.63 0.02 ±0.00 0.00 ±0.00 7.01 ±0.63 5.96 ±0.31 -- 5.96 ±0.31 0.02 ±0.00 0.00 ±0.00 5.94 ±0.31 5.90 ± 0.46 -- 5.90 ± 0.46 0.02 ± 0.00 0.00 ± 0.00 5.87 ± 0.45 8.22 ± 0.53 -- 8.22 ± 0.53 0.02 ± 0.00 0.00 ± 0.00 8.20 ± 0.52 4.81 ± 0.49 14.81 ± 1.45 -- -- 4.81 ± 0.49 14.81 ± 1.45 0.02 ± 0.00 0.03 ± 0.00 0.00 ± 0.00 0.00 ± 0.00 4.78 ± 0.49 14.77 ± 1.44 269.82 ± 17.95 7.34 ±0.43 3402.21 ±172.20 -- -- -- 269.82 ± 17.95 7.34 ±0.43 3402.21 ±172.20 0.02 ± 0.00 0.02 ±0.00 0.02 ± 0.00 0.00 ± 0.00 0.00 ±0.00 3392.76 ±171.74 269.78 ± 17.95 7.31 ±0.43 9.39 ± 0.57 949.05 ± 63.46 63.62 ± 4.15 74.94 ± 5.07 55.48 ±2.95 68.01 ±3.86 56.93 ± 3.37 7.91 ±0.70 3375.35 ±319.81 109.09 ± 14.15 -- -- -- 109.09 ± 14.15 7.91 ±0.70 3375.35 ±319.81 0.02 ± 0.00 0.02 ±0.00 0.02 ± 0.00 0.00 ±0.00 3358.82 ±318.17 0.00 ± 0.00 109.07 ± 14.15 7.88 ±0.70 16.47 ± 1.68 73.72 ± 7.63 344.74 ± 39.63 49.72 ± 4.25 95.58 ± 9.67 59.44 ±5.06 58.90 ±4.74 5.63 ±0.45 4758.04 ±407.56 166.19 ± 9.29 7.36 ± 0.69 5.95 ±0.52 -- -- - - -- -- 5.63 ±0.45 4758.04 ±407.56 166.19 ± 9.29 7.36 ± 0.69 5.95 ±0.52 0.01 ± 0.00 0.01 ±0.00 0.02 ± 0.00 0.02 ± 0.00 0.01 ±0.00 0.00 ± 0.00 0.00 ±0.00 4750.16 ±406.98 0.00 ± 0.00 0.00 ±0.00 7.82 ± 0.61 5.93 ±0.52 166.17 ± 9.28 5.61 ±0.45 7.34 ± 0.69 69.96 ±6.98 75.88 ±7.47 657.02 ± 29.24 62.24 ± 6.12 98.54 ±10.89 66.24 ± 6.36 8.47 ±0.99 2073.23 ±198.75 534.16 ± 55.64 2.50 ± 0.23 4.91 ±0.56 9.61 ± 1.33 -- -- -- -- -- -- 8.47 ±0.99 2073.23 ±198.75 4.91 ±0.56 2.50 ± 0.23 534.16 ± 55.64 9.61 ± 1.33 0.03 ± 0.01 0.02 ±0.00 0.02 ±0.00 0.02 ± 0.00 0.02 ± 0.00 0.02 ± 0.01 0.00 ± 0.00 0.00 ± 0.00 0.00 ±0.00 0.00 ±0.00 2069.29 ±198.53 0.00 ± 0.00 534.10 ± 55.63 2.48 ± 0.23 4.89 ±0.56 8.44 ±0.99 3.90 ± 0.31 9.58 ± 1.33 30.82 ± 3.60 30.70 ± 3.62 37.04 ±4.59 69.26 ±7.97 1845.38 ±195.57 78.90 ±10.36 3.27 ± 0.25 -- 3.27 ± 0.25 0.01 ± 0.00 0.00 ± 0.00 3.26 ± 0.25 15.81 ± 0.16 12.49 ± 0.11 3.32 ± 0.10 0.68 ± 0.02 2.07 ± 0.06 -- 20.39 ± 0.56 15.13 ± 0.14 13.41 ± 0.12 1.72 ± 0.06 0.45 ± 0.01 0.87 ± 0.03 -- 14.08 ± 0.46 496.57 ± 5.53 490.77 ± 5.51 5.80 ± 0.28 0.04 ± 0.00 1.54 ± 0.09 4.21 ± 0.22 48.07 ± 2.44 496.74 ± 8.22 489.49 ± 8.18 7.25 ± 0.66 0.04 ± 0.00 1.61 ± 0.16 5.59 ± 0.51 50.66 ± 4.43 495.21 ±12.65 489.22 ±12.64 5.99 ± 0.48 0.03 ± 0.00 2.03 ± 0.22 3.91 ± 0.27 62.16 ± 6.10 497.76 ±10.27 493.59 ±10.21 4.17 ± 0.43 0.04 ± 0.00 0.98 ± 0.13 3.15 ± 0.32 31.38 ± 3.80 Figure 9: Detailed timing results for each selector. The actual edge weights for the illustrative PartConn and UnitSquare prob- lems were pre-computed, and therefore their timings are not included. The Partition selector requires initialization of the Z- values (7) for the graph using only the estimated edge weights. Since this is not particular to either the actual edge weights (e.g. from the obstacle distribution) or the start/goal vertices from a particular instance, this initialization (sel-init) is considered separately. The online running time (online) is broken into LazySP's three primary steps: the inner search (search), invoking the edge selector (sel), and evaluating edges (eval). We also show the number of edges evaluated.
1110.3850
1
1110
2011-10-17T23:35:11
On the Power of Adaptivity in Sparse Recovery
[ "cs.DS" ]
The goal of (stable) sparse recovery is to recover a $k$-sparse approximation $x*$ of a vector $x$ from linear measurements of $x$. Specifically, the goal is to recover $x*$ such that ||x-x*||_p <= C min_{k-sparse x'} ||x-x'||_q for some constant $C$ and norm parameters $p$ and $q$. It is known that, for $p=q=1$ or $p=q=2$, this task can be accomplished using $m=O(k \log (n/k))$ non-adaptive measurements [CRT06] and that this bound is tight [DIPW10,FPRU10,PW11]. In this paper we show that if one is allowed to perform measurements that are adaptive, then the number of measurements can be considerably reduced. Specifically, for $C=1+eps$ and $p=q=2$ we show - A scheme with $m=O((1/eps)k log log (n eps/k))$ measurements that uses $O(log* k \log \log (n eps/k))$ rounds. This is a significant improvement over the best possible non-adaptive bound. - A scheme with $m=O((1/eps) k log (k/eps) + k \log (n/k))$ measurements that uses /two/ rounds. This improves over the best possible non-adaptive bound. To the best of our knowledge, these are the first results of this type. As an independent application, we show how to solve the problem of finding a duplicate in a data stream of $n$ items drawn from ${1, 2, ..., n-1}$ using $O(log n)$ bits of space and $O(log log n)$ passes, improving over the best possible space complexity achievable using a single pass.
cs.DS
cs
On the Power of Adaptivity in Sparse Recovery Piotr Indyk Eric Price David P. Woodruff October 11, 2018 Abstract The goal of (stable) sparse recovery is to recover a k-sparse approximation x∗ of a vector x from linear measurements of x. Specifically, the goal is to recover x∗ such that kx − x∗kp ≤ C min k-sparse x′ kx − x′kq for some constant C and norm parameters p and q. It is known that, for p = q = 1 or p = q = 2, this task can be accomplished using m = O(k log(n/k)) non-adaptive measurements [CRT06] and that this bound is tight [DIPW10, FPRU10, PW11]. In this paper we show that if one is allowed to perform measurements that are adaptive , then the number of measurements can be considerably reduced. Specifically, for C = 1 + ǫ and p = q = 2 we show • A scheme with m = O( 1 ǫ k log log(nǫ/k)) measurements that uses O(log∗ k · log log(nǫ/k)) rounds. This is a significant improvement over the best possible non-adaptive bound. • A scheme with m = O( 1 improves over the best possible non-adaptive bound. ǫ k log(k/ǫ) + k log(n/k)) measurements that uses two rounds. This To the best of our knowledge, these are the first results of this type. As an independent application, we show how to solve the problem of finding a duplicate in a data stream of n items drawn from {1, 2, . . . , n − 1} using O(log n) bits of space and O(log log n) passes, improving over the best possible space complexity achievable using a single pass. 1 1 0 2 t c O 7 1 ] S D . s c [ 1 v 0 5 8 3 . 0 1 1 1 : v i X r a 1 Introduction In recent years, a new "linear" approach for obtaining a succinct approximate representation of n-dimensional vectors (or signals) has been discovered. For any signal x, the representation is equal to Ax, where A is an m × n matrix, or possibly a random variable chosen from some distribution over such matrices. The vector Ax is often referred to as the measurement vector or linear sketch of x. Although m is typically much smaller than n, the sketch Ax often contains plenty of useful information about the signal x. A particularly useful and well-studied problem is that of stable sparse recovery. We say that a vector x′ is k-sparse if it has at most k non-zero coordinates. The sparse recovery problem is typically defined as follows: for some norm parameters p and q and an approximation factor C > 0, given Ax, recover an "approximation" vector x∗ such that kx − x∗kp ≤ C min (this inequality is often referred to as ℓp/ℓq guarantee). If the matrix A is random, then Equation (1) should hold for each x with some probability (say, 2/3). Sparse recovery has a tremendous number of applications in areas such as compressive sensing of signals [CRT06, Don06], genetic data acquisition and analysis [SAZ10, BGK+10] and data stream algorithms1 [Mut05, Ind07]; the latter includes applications to network monitoring and data analysis. k-sparse x′(cid:13)(cid:13)x − x′(cid:13)(cid:13)q (1) It is known [CRT06] that there exist matrices A and associated recovery algorithms that produce ap- proximations x∗ satisfying Equation (1) with p = q = 1, constant approximation factor C, and sketch length m = O(k log(n/k)) (2) A similar bound, albeit using random matrices A, was later obtained for p = q = 2 [GLPS10] (building on [CCF02, CM04, CM06]). Specifically, for C = 1 + ǫ, they provide a distribution over matrices A with m = O( 1 ǫ k log(n/k)) (3) rows, together with an associated recovery algorithm. It is also known that the bound in Equation (2) is asymptotically optimal for some constant C and p = q = 1, see [DIPW10] and [FPRU10] (building on [GG84, Glu84, Kas77]). The bound of [DIPW10] also extends to the randomized case and p = q = 2. For C = 1 + ǫ, a lower bound of m = Ω( 1 ǫ k log(n/k)) was recently shown [PW11] for the randomized case and p = q = 2, improving upon the earlier work of [DIPW10] and showing the dependence on ǫ is optimal. The necessity of the "extra" logarithmic factor multiplying k is quite unfortunate: the sketch length determines the "compression rate", and for large n any logarithmic factor can worsen that rate tenfold. In this paper we show that this extra factor can be greatly reduced if we allow the measurement process to be adaptive. In the adaptive case, the measurements are chosen in rounds, and the choice of the mea- surements in each round depends on the outcome of the measurements in the previous rounds. The adaptive measurement model has received a fair amount of attention in the recent years [JXC08, CHNR08, HCN09, HBCN09, MSW08, AWZ08], see also [Def10]. In particular [HBCN09] showed that adaptivity helps re- ducing the approximation error in the presence of random noise. However, no asymptotic improvement to the number of measurements needed for sparse recovery (as in Equation (1)) was previously known. 1In streaming applications, a data stream is modeled as a sequence of linear operations on an (implicit) vector x. Example operations include increments or decrements of x's coordinates. Since such operations can be directly performed on the linear sketch Ax, one can maintain the sketch using only O(m) words. 1 Results In this paper we show that adaptivity can lead to very significant improvements in the number of measurements over the bounds in Equations (2) and (3). We consider randomized sparse recovery with ℓ2/ℓ2 guarantee, and show two results: 1. A scheme with m = O( 1 ǫ k log log(nǫ/k)) measurements and an approximation factor C = 1 + ǫ. For low values of k this provides an exponential improvement over the best possible non-adaptive bound. The scheme uses O(log∗ k · log log(nǫ/k)) rounds. 2. A scheme with m = O( 1 ǫ k log(k/ǫ) + k log(n/k)) and an approximation factor C = 1 + ǫ. For low values of k and ǫ this offers a significant improvement over the best possible non-adaptive bound, since the dependence on n and ǫ is "split" between two terms. The scheme uses only two rounds. Implications Our new bounds lead to potentially significant improvements to efficiency of sparse recovery schemes in a number of application domains. Naturally, not all applications support adaptive measurements. For example, network monitoring requires the measurements to be performed simultaneously, since we cannot ask the network to "re-run" the packets all over again. However, a surprising number of applications are capable of supporting adaptivity. For example: • Streaming algorithms for data analysis: since each measurement round can be implemented by one pass over the data, adaptive schemes simply correspond to multiple-pass streaming algorithms (see [McG09] for some examples of such algorithms). • Compressed sensing of signals: several architectures for compressive sensing, e.g., the single-pixel camera of [DDT+08], already perform the measurements in a sequential manner. In such cases the measurements can be made adaptive2. Other architectures supporting adaptivity are under develop- ment [Def10]. • Genetic data analysis and acqusition: as above. Therefore, it seems likely that the results in this paper will be applicable in a wide variety of scenarios. As an example application, we show how to solve the problem of finding a duplicate in a data stream of n arbitrarily chosen items from the set {1, 2, . . . , n − 1} presented in an arbitrary order. Our algorithm uses O(log n) bits of space and O(log log n) passes. It is known that for a single pass, Θ(log2 n) bits of space is necessary and sufficient [JST11], and so our algorithm improves upon the best possible space complexity using a single pass. Techniques On a high-level, both of our schemes follow the same two-step process. First, we reduce the problem of finding the best k-sparse approximation to the problem of finding the best 1-sparse approximation (using relatively standard techniques). This is followed by solving the latter (simpler) problem. The first scheme starts by "isolating" most of of the large coefficients by randomly sampling ≈ ǫ/k fraction of the coordinates; this mostly follows the approach of [GLPS10] (cf. [GGI+02]). The crux of the algorithm is in the identification of the isolated coefficients. Note that in order to accomplish this using O(log log n) measurements (as opposed to O(log n) achieved by the "standard" binary search algorithm) we need to "extract" significantly more than one bit of information per measurements. To achieve this, we proceed as follows. First, observe that if the given vector (say, z) is exactly 1-sparse, then one can extract the position of the non-zero entry (say zj) from two measurements a(z) = Pi zi, and b(z) = Pi izi, 2We note that, in any realistic sensing system, minimizing the number of measurements is only one of several considerations. Other factors include: minimizing the computation time, minimizing the amount of communication needed to transfer the mea- surement matrices to the sensor, satisfying constraints on the measurement matrix imposed by the hardware etc. A detailed cost analysis covering all of these factors is architecture-specific, and beyond the scope of this paper. 2 since b(z)/a(z) = j. A similar algorithm works even if z contains some "very small" non-zero entries: we just round b(z)/a(z) to the nearest integer. This algorithm is a special case of a general algorithm that achieves O(log n/ log SN R) measurements to identify a single coordinate xj among n coordinates, where SN R = x2 j /kx[n]\jk2 (SNR stands for signal-to-noise ratio). This is optimal as a function of n and the SNR [DIPW10]. A natural approach would then be to partition [n] into two sets {1, . . . , n/2} and {n/2 + 1, . . . n}, find the heavier of the two sets, and recurse. This would take O(log n) rounds. The key observation is that not only do we recurse on a smaller-sized set of coordinates, but the SNR has also increased since x2 j has remained the same but the squared norm of the tail has dropped by a constant factor. Therefore in the next round we can afford to partition our set into more than two sets, since as long as we keep the ratio of log(# of sets ) and log SN R constant, we only need O(1) measurements per round. This ultimately leads to a scheme that finishes after O(log log n) rounds. In the second scheme, we start by hashing the coordinates into a universe of size polynomial in k and 1/ǫ, in a way that approximately preserves the top coefficients without introducing spurious ones, and in such a way that the mass of the tail of the vector does not increase significantly by hashing. This idea is inspired by techniques in the data stream literature for estimating moments [KNPW10, TZ04] (cf. [CCF02, CM06, GI10]). Here, though, we need stronger error bounds. This enables us to identify the positions of those coefficients (in the hashed space) using only O( 1 ǫ k log(k/ǫ)) measurements. Once this is done, for each large coefficient i in the hash space, we identify the actual large coefficient in the preimage of i. This can be achieved using the number of measurements that does not depend on ǫ. 2 Preliminaries We start from a few definitions. Let x be an n-dimensional vector. Definition 2.1. Define Hk(x) = arg max S∈[n] S=k kxSk2 to be the largest k coefficients in x. Definition 2.2. For any vector x, we define the "heavy hitters" to be those elements that are both (i) in the top k and (ii) large relative to the mass outside the top k. We define Definition 2.3. Define the error Hk,ǫ(x) = {j ∈ Hk(x) x2 2 2} xHk(x)(cid:13)(cid:13)(cid:13) j ≥ ǫ(cid:13)(cid:13)(cid:13) xHk(x)(cid:13)(cid:13)(cid:13) 2 2 Err2(x, k) =(cid:13)(cid:13)(cid:13) For the sake of clarity, the analysis of the algorithm in section 4 assumes that the entries of x are sorted by the absolute value (i.e., we have x1 ≥ x2 ≥ . . . ≥ xn). In this case, the set Hk(x) is equal to [k]; this allows us to simplify the notation and avoid double subscripts. The algorithms themselves are invariant under the permutation of the coordinates of x. Running times of the recovery algorithms In the non-adaptive model, the running time of the recovery algorithm is well-defined: it is the number of operations performed by a procedure that takes Ax as its input and produces an approximation x∗ to x. The time needed to generate the measurement vectors A, or to encode the vector x using A, is not included. In the adaptive case, the distinction between the matrix 3 generation, encoding and recovery procedures does not exist, since new measurements are generated based on the values of the prior ones. Moreover, the running time of the measurement generation procedure heavily depends on the representation of the matrix. If we suppose that we may output the matrix in sparse form and receive encodings in time bounded by the number of non-zero entries in the matrix, our algorithms run in n logO(1) n time. 3 Full adaptivity This section shows how to perform k-sparse recovery with O(k log log(n/k)) measurements. The core of our algorithm is a method for performing 1-sparse recovery with O(log log n) measurements. We then extend this to k-sparse recovery via repeated subsampling. 3.1 1-sparse recovery This section discusses recovery of 1-sparse vectors with O(log log n) adaptive measurements. First, in Lemma 3.1 we show that if the heavy hitter xj is Ω(n) times larger than the ℓ2 error (xj is "Ω(n)-heavy"), we can find it with two non-adaptive measurements. This corresponds to non-adaptive 1-sparse recovery with approximation factor C = Θ(n); achieving this with O(1) measurements is unsurprising, because the lower bound [DIPW10] is Ω(log1+C n). Lemma 3.1 is not directly very useful, since xj is unlikely to be that large. However, if xj is D times larger than everything else, we can partition the coordinates of x into D random blocks of size N/D and perform dimensionality reduction on each block. The result will in expectation be a vector of size D where the block containing j is D times larger than anything else. The first lemma applies, so we can recover the block containing j, which has a 1/√D fraction of the ℓ2 noise. Lemma 3.2 gives this result. We then have that with two non-adaptive measurements of a D-heavy hitter we can restrict to a subset where it is an Ω(D3/2)-heavy hitter. Iterating log log n times gives the result, as shown in Lemma 3.3. Lemma 3.1. Suppose there exists a j with xj ≥ C n√δ (cid:13)(cid:13)x[n]\{j}(cid:13)(cid:13)2 adaptive measurements suffice to recover j with probability 1 − δ. Proof. Let s : [n] → {±1} be chosen from a 2-wise independent hash family. Perform the measurements a(x) =P s(i)xi and b(x) =P(n + i)s(i)xi. For recovery, output the closest integer to b/a − n. Let z = x[n]\{j}. Then E[a(z)2] = kzk2 2. Hence with probability at least 1 − 2δ, we have both for some constant C. Then two non- Thus 2 and E[b(z)2] ≤ 4n2 kzk2 a(z) ≤p1/δ kzk2 b(z) ≤ 2np1/δ kzk2 b(x) a(x) = s(j)(n + j)xj + b(z) s(j)xj + a(z) (cid:12)(cid:12)(cid:12)(cid:12) b(x) a(x) − (n + j)(cid:12)(cid:12)(cid:12)(cid:12) s(j)xj + a(z) (cid:12)(cid:12)(cid:12)(cid:12) =(cid:12)(cid:12)(cid:12)(cid:12) b(z) − (n + j)a(z) ≤b(z) + (n + j)a(z) 4np1/δ kzk2 xj − a(z) xj − a(z) ≤ 4 Suppose xj > (8n + 1)p1/δ kzk2. Then (cid:12)(cid:12)(cid:12)(cid:12) b(x) a(x) − (n + j)(cid:12)(cid:12)(cid:12)(cid:12) < 4np1/δ kzk2 8np1/δ kzk2 =1/2 so ı = j. Lemma 3.2. Suppose there exists a j with xj ≥ C B2 δ2 (cid:13)(cid:13)x[n]\{j}(cid:13)(cid:13)2 for some constant C and parameters B and δ. Then with two non-adaptive measurements, with probability 1 − δ we can find a set S ⊂ [n] such that j ∈ S and(cid:13)(cid:13)xS\{j}(cid:13)(cid:13)2 ≤(cid:13)(cid:13)x[n]\{j}(cid:13)(cid:13)2 /B and S ≤ 1 + n/B2. Proof. Let D = B2/δ, and let h : [n] → [D] and s : [n] → {±1} be chosen from pairwise independent hash families. Then define Sp = {i ∈ [n] h(i) = p}. Define the matrix A ∈ RD×n by Ah(i),i = s(i) and Ap,i = 0 elsewhere. Then Let p∗ = h(j) and y = x[n]\{j} (Az)p = Xi∈Sp . We have that s(i)zi. E[Sp∗] =1 + (n − 1)/D E[(Ay)2 2 p∗] = E[(cid:13)(cid:13)(cid:13) ySp∗(cid:13)(cid:13)(cid:13) E[kAyk2 2 ] =kyk2 2] =kyk2 2 2 /D Hence by Chebyshev's inequality, with probability at least 1 − 4δ all of the following hold: Sp∗ ≤1 + (n − 1)/(Dδ) ≤ 1 + n/B2 ySp∗(cid:13)(cid:13)(cid:13)2 ≤kyk2 /√Dδ (cid:13)(cid:13)(cid:13) (Ay)p∗ ≤kyk2 /√Dδ kAyk2 ≤kyk2 /√δ. (4) (5) (6) (7) The combination of (6) and (7) imply (Ax)p∗ ≥xj − (Ay)p∗ ≥ (CD/δ − 1/√Dδ)kyk2 ≥ (CD/δ − 1/√Dδ)√δ kAyk2 ≥ CD 2√δ kAyk2 and hence (Ax)p∗ ≥ CD 2√δ (cid:13)(cid:13)(Ax)[D]\p∗(cid:13)(cid:13)2 . As long as C/2 is larger than the constant in Lemma 3.1, this means two non-adaptive measurements suffice to recover p∗ with probability 1 − δ. We then output the set Sp∗, which by (5) has xSp∗\{j}(cid:13)(cid:13)(cid:13)2 (cid:13)(cid:13)(cid:13) ySp∗(cid:13)(cid:13)(cid:13)2 ≤ kyk2 /√Dδ =(cid:13)(cid:13)x[n]\{j}(cid:13)(cid:13)2 /√Dδ =(cid:13)(cid:13)x[n]\{j}(cid:13)(cid:13)2 /B =(cid:13)(cid:13)(cid:13) as desired. The overall failure probability is 1 − 5δ; rescaling δ and C gives the result. Lemma 3.3. Suppose there exists a j with xj ≥ C(cid:13)(cid:13)x[n]\{j}(cid:13)(cid:13)2 adaptive measurements suffice to recover j with probability 1/2. for some constant C. Then O(log log n) 5 procedure NONADAPTIVESHRINK(x, D) For i ∈ [n], s1(i) ← {±1}, h(i) ← [D] For i ∈ [D], s2(i) ← {±1} a ←P s1(i)s2(h(i))xi b ←P s1(i)s2(h(i))xi(D + h(i)) p∗ ← ROUND(b/a − D). return {j∗ h(j∗) = p∗}. end procedure procedure ADAPTIVEONESPARSEREC(x) ⊲ Find smaller set S containing heavy coordinate xj ⊲ Observation ⊲ Observation ⊲ Recover heavy coordinate xj S ← [n] B ← 2, δ ← 1/4 while S > 1 do end while return S[0] end procedure S ← NONADAPTIVESHRINK(xS, 4B2/δ) B ← B3/2, δ ← δ/2. Algorithm 3.1: Adaptive 1-sparse recovery Proof. Let C′ be the constant from Lemma 3.2. Define B0 = 2 and Bi = B3/2 i−1 for i ≥ 1. Define δi = 2−i/4 for i ≥ 0. Suppose C ≥ 16C′B2 Define r = O(log log n) so Br ≥ n. Starting with S0 = [n], our algorithm iteratively applies Lemma 3.2 with parameters B = 4Bi and δ = δi to xSi to identify a set Si+1 ⊂ Si with j ∈ Si+1, ending when i = r. We prove by induction that Lemma 3.2 applies at the ith iteration. We chose C to match the base case. 0/δ2 0. For the inductive step, suppose(cid:13)(cid:13)xSi\{j}(cid:13)(cid:13)2 ≤ xj /(C′16 B2 so the lemma applies in the next iteration as well, as desired. (cid:13)(cid:13)xSi+1\{j}(cid:13)(cid:13)2 ≤ xj /(C′64 After r iterations, we have Sr ≤ 1 + n/B2 that any iteration fails is at mostP δi < 2δ0 = 1/2. B3 i δ2 i 3.2 k-sparse recovery ). Then by Lemma 3.2, i δ2 i ) = xj /(C′16 i+1 B2 δ2 i+1 ) r < 2, so we have uniquely identified j ∈ Sr. The probability Given a 1-sparse recovery algorithm using m measurements, one can use subsampling to build a k-sparse recovery algorithm using O(km) measurements and achieving constant success probability. Our method for doing so is quite similar to one used in [GLPS10]. The main difference is that, in order to identify one large coefficient among a subset of coordinates, we use the adaptive algorithm from the previous section as opposed to error-correcting codes. For intuition, straightforward subsampling at rate 1/k will, with constant probability, recover (say) 90% of the heavy hitters using O(km) measurements. This reduces the problem to k/10-sparse recovery: we can subsample at rate 10/k and recover 90% of the remainder with O(km/10) measurements, and repeat log k times. The number of measurements decreases geometrically, for O(km) total measurements. Naively doing this would multiply the failure probability and the approximation error by log k; however, we can make the number of measurements decay less quickly than the sparsity. This allows the failure probability and approximation ratios to also decay exponentially so their total remains constant. 6 To determine the number of rounds, note that the initial set of O(km) measurements can be done in parallel for each subsampling, so only O(m) rounds are necessary to get the first 90% of heavy hitters. Repeating log k times would require O(m log k) rounds. However, we can actually make the sparsity in subsequent iterations decay super-exponentially, in fact as a power tower. This give O(m log∗ k) rounds. Theorem 3.4. There exists an adaptive (1+ǫ)-approximate k-sparse recovery scheme with O( 1 measurements and success probability 1 − δ. It uses O(log∗ k log log(nǫ)) rounds. ǫ k log 1 δ log log(nǫ/k)) To prove this, we start from the following lemma: Lemma 3.5. We can perform O(log log(n/k)) adaptive measurements and recover an ı such that, for any j ∈ Hk,1/k(x) we have Pr[ı = j] = Ω(1/k). Proof. Let S = Hk(x). Let T ⊂ [n] contain each element independently with probability p = 1/(4C 2k), where C is the constant in Lemma 3.3. Let j ∈ Hk,1/k(x). Then we have so 2 2 2 E[(cid:13)(cid:13)xT\S(cid:13)(cid:13) (cid:13)(cid:13)xT\S(cid:13)(cid:13)2 ≤p4p(cid:13)(cid:13)xS(cid:13)(cid:13)2 = 2] = p(cid:13)(cid:13)xS(cid:13)(cid:13) C√k (cid:13)(cid:13)xS(cid:13)(cid:13)2 ≤ xj /C 1 with probability at least 3/4. Furthermore we have E[T \ S] < pn so T \ S < n/k with probability at least 1 − 1/(4C 2) > 3/4. By the union bound, both these events occur with probability at least 1/2. Independently of this, we have Pr[T ∩ S = {j}] = p(1 − p)k−1 > p/e so all these events hold with probability at least p/(2e). Assuming this, and T ≤ 1 + n/k. But then Lemma 3.3 applies, and O(log log T) = O(log log(n/k)) measurements can recover j from a sketch of xT with probability 1/2. This is independent of the previous probability, for a total success chance of p/(4e) = Ω(1/k). (cid:13)(cid:13)xT\{j}(cid:13)(cid:13)2 ≤ xj /C Lemma 3.6. With O( 1 ǫ k log 1 f δ log log(nǫ/k)) adaptive measurements, we can recover T with T ≤ k and Err2(xT , f k) ≤ (1 + ǫ) Err2(x, k) with probability at least 1 − δ. The number of rounds required is O(log log(nǫ/k)). Proof. Repeat Lemma 3.5 m = O( 1 f δ ) times in parallel with parameters n and k/ǫ to get coordinates T ′ = {t1, t2, . . . , tm}. For each j ∈ Hk,ǫ/k(x) ⊆ Hk/ǫ,ǫ/k(x) and i ∈ [m], the lemma implies Pr[j = ti] ≥ ǫ/(Ck) for some constant C. Then Pr[j /∈ T ′] ≤ (1 − ǫ/(Ck))m ≤ e−ǫm/(Ck) ≤ f δ for appropriate m. Thus ǫ k log 1 E[(cid:12)(cid:12)Hk,ǫ/k(x) \ T ′(cid:12)(cid:12)] ≤ f δ(cid:12)(cid:12)Hk,ǫ/k(x)(cid:12)(cid:12) ≤f δk Pr(cid:2)(cid:12)(cid:12)Hk,ǫ/k(x) \ T ′(cid:12)(cid:12) ≥ f k(cid:3) ≤δ. Now, observe xT ′ directly and set T ⊆ T ′ to be the locations of the largest k values. Then, since Hk,ǫ/k(x) ⊆ Hk(x),(cid:12)(cid:12)Hk,ǫ/k(x) \ T(cid:12)(cid:12) =(cid:12)(cid:12)Hk,ǫ/k(x) \ T ′(cid:12)(cid:12) ≤ f k with probability at least 1 − δ. 7 Suppose this occurs, and let y = xT . Then Err2(y, f k) = min 2 2 2 2 2 2 S≤f k(cid:13)(cid:13)yS(cid:13)(cid:13) yHk,ǫ/k(x)\T(cid:13)(cid:13)(cid:13) ≤(cid:13)(cid:13)(cid:13) xHk,ǫ/k(x)(cid:13)(cid:13)(cid:13) =(cid:13)(cid:13)(cid:13) =(cid:13)(cid:13)(cid:13) xHk(x)\Hk,ǫ/k(x)(cid:13)(cid:13)(cid:13) +(cid:13)(cid:13)(cid:13) xHk(x)(cid:13)(cid:13)(cid:13) xHk(x)\Hk,ǫ/k(x)(cid:13)(cid:13)(cid:13) + k(cid:13)(cid:13)(cid:13) xHk(x)(cid:13)(cid:13)(cid:13) ≤(cid:13)(cid:13)(cid:13) ≤(1 + ǫ)(cid:13)(cid:13)(cid:13) xHk(x)(cid:13)(cid:13)(cid:13) 2 =(1 + ǫ) Err2(x, k) 2 2 2 2 2 2 2 2 ∞ as desired. procedure ADAPTIVEKSPARSEREC(x, k, ǫ, δ) ⊲ Recover approximation x of x R0 ← [n] δ0 ← δ/2, ǫ0 ← ǫ/e, f0 ← 1/32, k0 ← k. J ← {} for i ← 0, . . . , O(log∗ k) do for t ← 0, . . . , Θ( 1 ǫi ki log 1 δi ) do St ← SUBSAMPLE(Ri, Θ(ǫi/ki)) J.add(ADAPTIVEONESPARSEREC(xSt)) end for Ri+1 ← [n] \ J δi+1 ← δi/8 ǫi+1 ← ǫi/2 fi+1 ← 1/21/(4i+1fi) ki+1 ← kifi end for x ← xJ return x ⊲ While ki ≥ 1 ⊲ Direct observation end procedure Algorithm 3.2: Adaptive k-sparse recovery Theorem 3.7. We can perform O( 1 size at most 2k with ǫ k log 1 δ log log(nǫ/k)) adaptive measurements and recover a set T of (cid:13)(cid:13)xT(cid:13)(cid:13)2 ≤ (1 + ǫ)(cid:13)(cid:13)(cid:13) with probability 1 − δ. The number of rounds required is O(log∗ k log log(nǫ)). e·2i . Let f0 = 1/32 and fi = 2−1/(4ifi−1) for i > 0, and define Proof. Define δi = δ ki = kQj<i fj. Let R0 = [n]. Let r = O(log∗ k) such that fr−1 < 1/k. This is possible since αi = 1/(4i+1fi) satisfies the recurrence α0 = 8 and αi = 2αi−1−2i−2 > 2αi−1/2. Thus αr−1 > k for r = O(log∗ k) and then fr−1 < 1/αr−1 < 1/k. xHk(x)(cid:13)(cid:13)(cid:13)2 2·2i and ǫi = ǫ . 8 For each round i = 0, . . . , r − 1, the algorithm runs Lemma 3.6 on xRi with parameters ǫi, ki, fi, and The total number of measurements is δi to get Ti. It sets Ri+1 = Ri \ Ti and repeats. At the end, it outputs T = ∪Ti. O(X 1 log log(nǫi/ki)) ≤O(X 2i(ki/k) log(1/fi) ) log(log(k/ki) + log(nǫ/k))) log log(nǫ/k)X 2i(ki/k) log(1/fi)(i + 1) log log(k/ki)) using the very crude bounds i + log(1/δ) ≤ (i + 1) log(1/δ) and log(a + b) ≤ 2 log a log b for a, b ≥ e. But then ≤O( k(i + log 1 fiδi ki log k log 1 δ 1 ǫ ǫi ǫ 1 δ X 2i(ki/k) log(1/fi)(i + 1) log log(k/ki) ≤X 2i(i + 1)fi log(1/fi) log log(1/fi) ≤X 2i(i + 1)O(pfi) =O(1) since fi < O(1/16i), giving O( 1 ǫ k log 1 δ log log(nǫ/k) total measurements. The probability that any of the iterations fail is at most P δi < δ. The result has size T ≤ P ki ≤ 2k. All that remains is the approximation ratio(cid:13)(cid:13)xT(cid:13)(cid:13)2 = kxRrk2. For each i, we have Err2(xRi+1, ki+1) = Err2(xRi\Ti, fiki) ≤ (1 + ǫi) Err2(xRi, ki). Furthermore, kr < kfr−1 < 1. Hence kxRrk2 2 = Err2(xRr , kr) ≤ r−1 Yi=0 (1 + ǫi)! Err2(xR0, k0) = r−1 Yi=0 (1 + ǫi)! Err2(x, k) i=0 (1 + ǫi) < eP ǫi < e, so ButQr−1 and hence as desired. r−1 (1 + ǫi) < 1 +X eǫi ≤ 1 + 2ǫ Yi=0 xHk(x)(cid:13)(cid:13)(cid:13)2 (cid:13)(cid:13)xT(cid:13)(cid:13)2 = kxRrk2 ≤ (1 + ǫ)(cid:13)(cid:13)(cid:13) Once we find the support T , we can observe xT directly with O(k) measurements to get a (1 + ǫ)- approximate k-sparse recovery scheme, proving Theorem 3.4 4 Two-round adaptivity The algorithms in this section are invariant under permutation. Therefore, for simplicity of notation, the analysis assumes our vectors x is sorted: x1 ≥ . . . ≥ xn = 0. We are given a 1-round k-sparse recovery algorithm for n-dimensional vectors x using m(k, ǫ, n, δ) measurements with the guarantee that its output x satisfies kx − xkp ≤ (1 + ǫ) · kx[k]kp for a p ∈ {1, 2} with probability at least 1 − δ. Moreover, suppose its output x has support on a set of size s(k, ǫ, n, δ). We show the following black box two-round transformation. 9 Theorem 4.1. Assume s(k, ǫ, n, δ) = O(k). Then there is a 2-round sparse recovery algorithm for n- dimensional vectors x, which, in the first round uses m(k, ǫ/5, poly(k/ǫ), 1/100) measurements and in the second uses O(k · m(1, 1, n, Θ(1/k))) measurements. It succeeds with constant probability. Corollary 4.2. For p = 2, there is a 2-round sparse recovery algorithm for n-dimensional vectors x such that the total number of measurements is O( 1 ǫ k log(k/ǫ) + k log(n/k)). Proof of Corollary 4.2. In the first round it suffices to use CountSketch with s(k, ǫ, n, 1/100) = 2k, which holds for any ǫ > 0 [PW11]. We also have that m(k, ǫ/5, poly(k/ǫ), 1/100) = O( 1 ǫ k log(k/ǫ)). Us- ing [CCF02, CM06, GI10], in the second round we can set m(1, 1, n, Θ(1/k)) = O(log n). The bound follows by observing that 1 ǫ k log(k/ǫ) + k log(n) = O( 1 ǫ k log(k/ǫ) + k log(n/k)). Proof of Theorem 4.1. In the first round we perform a dimensionality reduction of the n-dimensional input vector x to a poly(k/ǫ)-dimensional input vector y. We then apply the black box sparse recovery algorithm on the reduced vector y, obtaining a list of s(k, ǫ/5, poly(k/ǫ), 1/100) coordinates, and show for each coordinate in the list, if we choose the largest preimage for it in x, then this list of coordinates can be used to provide a 1 + ǫ approximation for x. In the second round we then identify which heavy coordinates in x map to those found in the first round, for which it suffices to invoke the black box algorithm with only a constant approximation. We place the estimated values of the heavy coordinates obtained in the first pass in the locations of the heavy coordinates obtained in the second pass. Let N = poly(k/ǫ) be determined below. Let h : [n] → [N ] and σ : [n] → {−1, 1} be Θ(log N )-wise independent random functions. Define the vector y by yi = Pj h(j)=i σ(j)xj. Let Y (i) be the vector x restricted to coordinates j ∈ [n] for which h(j) = i. Because the algorithm is invariant under permutation of coordinates of y, we may assume for simplicity of notation that y is sorted: y1 ≥ . . . ≥ yN = 0. We note that such a dimensionality reduction is often used in the streaming literature. For example, the sketch of [TZ04] for ℓ2-norm estimation utilizes such a mapping. A "multishot" version (that uses several functions h) has been used before in the context of sparse recovery [CCF02, CM06] (see [GI10] for an overview). Here, however, we need to analyze a "single-shot" version. Let p ∈ {1, 2}, and consider sparse recovery with the ℓp/ℓp guarantee. We can assume that kxkp = 1. We need two facts concerning concentration of measure. Fact 4.3. (see, e.g., Lemma 2 of [KNPW10]) Let X1, . . . , Xn be such that Xi has expectation µi and variance v2 i , and Xi ≤ K almost surely. Then if the Xi are ℓ-wise independent for an even integer ℓ ≥ 2, Pr"(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xi=1 where µ =Pi µi and v2 =Pi v2 Fact 4.4. (Khintchine inequality) ([Haa82]) For t ≥ 2, a vector z and a t-wise independent random sign vector σ of the same number of dimensions, E[hz, σit] ≤ kzkt ≥ λ# ≤ 2O(ℓ)(cid:18)(cid:16)v√ℓ/λ(cid:17)ℓ Xi − µ(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) + (Kℓ/λ)ℓ(cid:19) n i . 2(√t)t. We start with a probabilistic lemma. Let Z(j) denote the vector Y (j) with the coordinate m(j) of largest magnitude removed. N 1/6(cid:17) and N be sufficiently large. Then with probability ≥ 99/100, Lemma 4.5. Let r = O(cid:16)kx[k]kp · log N 1. ∀j ∈ [N ], kZ(j)kp ≤ r. 2. ∀i ∈ [N 1/3], σ(i) · yh(i) − xi ≤ r, 3. ky[k]kp ≤ (1 + O(1/√N )) · kx[k]kp + O(kr), 10 4. ∀j ∈ [N ], if h−1(j) ∩ [N 1/3] = ∅, then yj ≤ r, 5. ∀j ∈ [N ], kY (j)k0 = O(n/N + log N ). Proof. We start by defining events E, F and G that will be helpful in the analysis, and showing that all of them are satisfied simultaneously with constant probability. Event E: Let E be the event that h(1), h(2), . . . , h(N 1/3) are distinct. Then Prh[E] ≥ 1 − 1/N 1/3. Event F: Fix i ∈ [N ]. Let Z′ denote the vector Y (h(i)) with the coordinate i removed. Applying Fact 4.4 with t = Θ(log N ), Pr σ [σ(i)yh(i) − xi ≥ 2√t · kZ(h(i))k2] ≤ Pr ≤ Pr ≤ Pr σ = Pr σ σ σ [σ(i)yh(i) − xi ≥ 2√t ·(cid:13)(cid:13)Z′(cid:13)(cid:13)2] [σ(i)yh(i) − xit ≥ 2t(√t)t · kZ′kt 2] t]] [σ(i)yh(i) − xit ≥ 2t E[(cid:12)(cid:12)hσ, Z′i(cid:12)(cid:12) [σ(i)yh(i) − xit ≥ 2t E[σ(i)yh(i) − xit] ≤ 1/N 4/3. Let F be the event that for all i ∈ [N ], σ(i)yh(i) − xi ≤ 2√t · kZ(h(i))k2, so Prσ[F] ≥ 1 − 1/N. Event G: Fix j ∈ [N ] and for each i ∈ {N 1/3 + 1, . . . , n}, let Xi = xip1h(i)=j (i.e., Xi = xip if h(i) = j). We apply Lemma 4.3 to the Xi. In the notation of that lemma, µi = xip/N and v2 i ≤ xi2p/N, 2p/N. Also, K = xN 1/3+1p. Function h is Θ(log N )-wise and so µ = kx independent, so by Fact 4.3, p/N and v2 ≤ kx [N 1/3]k2p [N 1/3]kp kx p [N 1/3]kp N Xi − Xi ≥ λ# ≤2O(ℓ)(cid:18)(cid:16)kx [N 1/3]kp 2p √ℓ/(λ√N )(cid:17)ℓ +(cid:0)xN 1/3+1pℓ/λ(cid:1)ℓ(cid:19) for any λ > 0 and an ℓ = Θ(log N ). For ℓ large enough, there is a Pr"(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) [N 1/3]kp λ = Θ(kx 2pp(log N )/N + xN 1/3+1p · log N ) for which this probability is ≤ N−2. Let G be the event that for all j ∈ [N ], kZ(j)kp for some universal constant C > 0. Then Pr[G E] ≥ 1 − 1/N. By a union bound, Pr[E ∧ F ∧ G] ≥ 999/1000 for N sufficiently large. the event E ∧ F ∧ G holds (i.e., we condition on that event). First Condition: This condition follows from the occurrence of G, and using that kx [N 1/3]kp, p. One just needs to make these and kx substitutions into the variable λ defining G and show the value r serves as an upper bound (in fact, there is a lot of room to spare, e.g., r/ log N is also an upper bound). [N 1/3]kp ≤ kx[k]kp, as well as (N 1/3 − k + 1)xN 1/3+1p ≤ kx[k]kp We know proceed to proving the five conditions in the lemma statement. In the analysis we assume that p ≤ C(cid:18)kx [N 1/3]k2p ≤ kx + λ(cid:19) [N1/3]kp p N Second Condition: This condition follows from the joint occurrence of E, F, and G. 11 p + O(kr). p ≤ ky′kp p/(N 1/3 − k + 1) since m(j) /∈ [N 1/3]. 2 ≤ (1 + O(1/√N ))kx[k]k2 2. p + O(kr) ≤ (1 + O(1/√N ))kx[k]kp 2 ≤ (1 + O(1/√N ))kx′k2 p to ky[k]kp We relate ky′kp Third Condition: For the third condition, let y′ denote the restriction of y to coordinates in the set [N ] \ {h(1), h(2), ..., h(k)}. For p = 1 and for any choice of h and σ, ky′k1 ≤ kx[k]k1. For p = 2, the vector y is the sketch of [TZ04] for ℓ2-estimation. By their analysis, with probability ≥ 999/1000, ky′k2 2, where x′ is the vector whose support is [n] \ ∪k i=1h−1(i) ⊆ [n] \ [k]. We assume this occurs and add 1/1000 to our error probability. Hence, ky′k2 p. Consider any j = h(i) for an i ∈ [k] for which j is not among the top k coordinates of y. Call such a j lost. By the first condition of the lemma, σ(i)yj − xi ≤ r. Since j is not among the top k coordinates of y, there is a coordinate j′ among the top k coordinates of y for which j′ /∈ h([k]) and yj ′ ≥ yj ≥ xi − r. We call such a j′ a substitute. We can bijectively map substitutes to lost coordinates. It follows that ky[k]kp Fourth Condition: This follows from the joint occurrence of E,F, and G, and using that xm(j)p ≤ kx[k]kp Fifth Condition: For the fifth condition, fix j ∈ [N ]. We apply Fact 4.3 where the Xi are indicator variables for the event h(i) = j. Then E[Xi] = 1/N and Var[Xi] < 1/N. In the notation of Fact 4.3, µ = n/N, v2 < n/N, and K = 1. Setting ℓ = Θ(log N ) and λ = Θ(log N +p(n log N )/N ), we have by a union bound that for all j ∈ [N ], kY (j)k0 ≤ n N + Θ(log N +p(n log N )/N ) = O(n/N + log N ), with probability at least 1 − 1/N. By a union bound, all events jointly occur with probability at least 99/100, which completes the proof. Event H: Let H be the event that the algorithm returns a vector y with ky − ykp ≤ (1 + ǫ/5)ky[k]kp. Then Pr[H] ≥ 99/100. Let S be the support of y, so S = s(k, ǫ/5, N, 1/100). We condition on H. In the second round we run the algorithm on Y (j) for each j ∈ S, each using m(1, 1,kY (j)k0, Θ(1/k)))- measurements. Using the fifth condition of Lemma 4.5, we have that kY (j)k0 = O(ǫn/k + log(k)/ǫ) for N = poly(k/ǫ) sufficiently large. For each invocation on a vector Y (j) corresponding to a j ∈ S, the algorithm takes the largest (in magnitude) coordinate HH(j) in the output vector, breaking ties arbitrarily. We output the vector x with support equal to T = {HH(j) j ∈ S}. We assign the value σ(xj)yj to HH(j). We have p + kx[n]\Tkp p. p + k(x − x)[n]\Tkp p = k(x − x)Tkp kx − xkp p =k(x − x)Tkp (8) The rest of the analysis is devoted to bounding the RHS of equation 8. Lemma 4.6. For N = poly(k/ǫ) sufficiently large, conditioned on the events of Lemma 4.5 and H, kx[n]\Tkp p ≤ (1 + ǫ/3)kx[k]kp p. Proof. If [k] \ T = ∅, the lemma follows by definition. Otherwise, if i ∈ ([k] \ T ), then i ∈ [k], and so by the second condition of Lemma 4.5, xi ≤ yh(i) + r. We also use the third condition of Lemma 4.5 to obtain ky[k]kp ≤ (1 + O(1/√N )) · kx[k]kp + O(kr). By the triangle inequality, ≤ k1/pr + 1/p 1/p 1/p   Xi∈[k]\T xip  yh(i)p ≤ k1/pr +  ≤k1/pr + (1 + ǫ/5) · ky[k]kp.  Xi ∈ [k]\T  Xi ∈ [N ]\S yip  The lemma follows using that r = O(kx[k]k2 · (log N )/N 1/6) and N = poly(k/ǫ) is sufficiently large. 12 1/p 1/p 1/p 1/p ≤ Xj∈S We bound k(x − x)Tkp p using Lemma 4.5, S ≤ poly(k/ǫ), and that N = poly(k/ǫ) is sufficiently large. (yj − yj + σ(HH(j)) · xHH(j) − yj)p xHH(j) − σ(HH(j)) · yjp k(x − x)Tkp ≤ Xj∈S   σ(HH(j)) · xHH(j) − yjp yj − yjp ≤ Xj∈S   ≤(1 + ǫ/5)ky[k]kp + Xj∈S ≤(1 + ǫ/5)(1 + O(1/√N ))kx[k]kp + O(kr) + Xj∈S σ(HH(j)) · xHH(j) − yjp ≤(1 + ǫ/4)kx[k]kp + Xj∈S  + Xj∈S σ(HH(j)) · xHH(j) − yjp  σ(HH((j)) · xHH(j) − yjp  1/p 1/p 1/p p < 1 p ≤ 2 · kw[1]kp p, we have w1p > 3 p ≥ w1 − w1p, so if w1p < 3 Event I: We condition on the event I that all second round invocations succeed. Note that Pr[I] ≥ 99/100. We need the following lemma concerning 1-sparse recovery algorithms. Lemma 4.7. Let w be a vector of real numbers. Suppose w1p > 9 which kw − wkp Proof. kw − wkp On the other hand, kw[1]kp part, for j > 1 we have wjp < 1 10(cid:1)kwkp then kw − wkp p > (cid:0) 3 5 − 1 kw − wkp p ≤ 2 · kw[1]kp p. It remains to boundPj∈S σ(HH(j))·xHH(j)− yjp. We show for every j ∈ S, σ(HH(j))·xHH(j)− yjp is small. p. Moreover, for all j > 1, wjp < 3 5(cid:1)kwkp p, then kw − wkp p > (cid:0) 9 p. This contradicts that kw − wkp p ≤ 2 · kw[1]kp 10 · kwkp 2 · kwkp p < 1 10 · kwkp p. p. For the second 5 · kwkp p, p, this contradicts that p ≥ wj − wjp, so if wjp ≥ 3 10 · kwkp 10 · kwkp p = 1 Recall that m(j) is the coordinate of Y (j) with the largest magnitude. There are two cases. p. But since kw[1]kp 5 · kwkp 5 · kwkp p. Now, kw − wkp 10 · kwkp p. Then for any vector w for 5 · kwkp p. p = 3 10 − 3 Case 1: m(j) /∈ [N 1/3]. In this case observe that HH(j) /∈ [N 1/3] either, and h−1(j) ∩ [N 1/3] = ∅. It follows by the fourth condition of Lemma 4.5 that yj ≤ r. Notice that xHH(j)p ≤ xm(j)p ≤ kx[k]kp N 1/3−k . Bounding σ(HH(j)) · xHH(j) − yj by xHH(j) + yj, it follows for N = poly(k/ǫ) large enough that σ(HH(j)) · xHH(j) − yjp ≤ ǫ/4 · kx[k]kp/S). Case 2: m(j) ∈ [N 1/3]. If HH(j) = m(j), then σ(HH(j)) · xHH(j) − yj ≤ r by the second con- dition of Lemma 4.5, and therefore p for N = poly(k/ǫ) large enough. σ(HH(j)) · xHH(j) − yjp ≤ rp ≤ ǫ/4 · kx[k]kp/S 13 Otherwise, HH(j) 6= m(j). From condition 2 of Lemma 4.5 and m(j) ∈ [N 1/3], it follows that σ(HH(j)))xHH(j) − yj ≤σ(HH(j))xHH(j) − σ(m(j))xm(j) + σ(m(j))xm(j) − yj ≤ xHH(j) + xm(j) + r Notice that xHH(j) + xm(j) ≤ 2xm(j) since m(j) is the coordinate of largest magnitude. Now, condi- tioned on I, Lemma 4.7 implies that xm(j)p ≤ 9 p, or equivalently, xm(j) ≤ 101/p · kZ(j)kp. Finally, by the first condition of Lemma 4.5, we have kZ(j)kp = O(r), and so σ(HH(j))xHH(j) − yjp = O(rp), which as argued above, is small enough for N = poly(k/ǫ) sufficiently large. 10 · kY (j)kp The proof of our theorem follows by a union bound over the events that we defined. 5 Adaptively Finding a Duplicate in a Data Stream We consider the following FindDuplicate problem. We are given an adversarially ordered stream S of n elements in {1, 2, . . . , n− 1} and the goal is to output an element that occurs at least twice, with probability at least 1 − δ. We seek to minimize the space complexity of such an algorithm. We improve the space complexity of [JST11] for FindDuplicate from O(log2 n) bits to O(log n) bits, though we use O(log log n) passes instead of a single pass. Notice that [JST11] also proves a lower bound of Ω(log2 n) bits for a single pass. We use Lemma 3.3 of our multi-pass sparse recovery algorithm: Fact 5.1. Suppose there exists an i with xi ≥ Ckx[n]\{i}k2 for some constant C. Then O(log log n) adaptive measurements suffice to recover a set T of constant size so that i ∈ T with probability at least 1/2. Further, all adaptive measurements are linear combinations with integer coefficients of magnitude bounded by poly(n). Our algorithm DuplicateFinder for this problem considers the equivalent formulation of FindDuplicate in which we think of an underlying frequency vector x ∈ {−1, 0, 1, . . . , n − 1}n. We start by initializing xi = −1 for all i. Each time item i occurs in the stream, we increment its frequency by 1. The task is therefore to output an i for which xi > 0. Theorem 5.2. There is an O(log log n)-pass, O(log n log 1/δ) bits of space per pass algorithm for solving the FindDuplicate problem with probability at least 1 − δ. Proof. We describe an algorithm DuplicateFinder which succeeds with probability at least 1/8. Since it knows whether or not it succeeds, the probability can be amplified to 1 − δ by O(log 1/δ) independent par- allel repetitions. It is easy to see that the pass and space complexity are as claimed, so we prove correctness. 14 DuplicateFinder(S) 1. Repeat the following procedure C = O(1) times independently. (a) Select O(1)-wise independent uniform ti ∈ [0, 1] for i ∈ [n]. (b) Let ǫ > 0 be a sufficiently small constant. Let m = O(log 1/ǫ). (c) Let z1, . . . , z4m be a pairwise-independent partition of the coordinates of z, where z = xi/ti for all i. (d) Run algorithm A independently on vectors z1, . . . , z4m. (e) Let T1, . . . , T4m be the outputs of algorithm A on z1, . . . , z4m, respectively, as per Fact 5.1. (f) Compute each xi for i ∈ ∪4m j=1Tj in an extra pass. If there is an i for which xi > 0, then output i. 2. If no coordinate i has been output, then output FAIL. We use the following fact shown in the proof of Lemma 3 of [JST11]. Lemma 5.3. (see first paragraph of Lemma 3 of [JST11]) For a single index i ∈ [n] and t arbitrary, we have 1 20 √mkxk1 ti = t] = O(ǫ), Pr[kzHm(z)k2 > where Hm(z) denotes the set of m largest (in magnitude) coordinates of z. Suppose zi > kxk1 for . Conditioned on this some value of i. This happens if ti < xi kxk1 event, by Lemma 5.3 we have that with probability 1 − O(ǫ), and occurs with probability equal to xi kxk1 kzHm(z)k2 ≤ 1 20 √mkxk1. Suppose i occurs in zj for some value of j ∈ [4m]. Since the partition is pairwise-independent, the expected number of ℓ ∈ Hm(z) \ {i} which occur in zj is at most m 4m , and so with probability at least 3/4 − O(ǫ), the norm of zj with coordinate corresponding to coordinate i in z removed is at most kzHm(z)k2 ≤ 1 20 √mkxk1 ≤ 1 20 √mzi. Consider one of the C = O(1) independent repetitions of step 1. Since m is a constant, by Fact 5.1, with probability at least 1/2, A outputs a set T which contains coordinate i. Hence, with probability at least 3/8 − O(ǫ), if there is an i for which zi > kxk1, it is found by DuplicateFinder. Let pi = xi . Then zi > kxk1 with probability pi. Since Pi xi > 0, we have Pi xi>0 pi > 1 2. kxk1 For coordinates i for which xi > 0, let Wi = 1 if zi > kxk1, and let W =Pi Wi. Then E[W ] > 1/2 and by pairwise-independence, Var[W ] ≤ E[W ]. 2 and Var[W ′] ≤ E[W ] E[W ] > 1 have that with probability at least 1 coordinate i for which xi > 0 and zi > kxk1. This completes the proof. Let W ′ be the average of the random variable W over C independent repetitions. Then E[W ′] = C , and so by Chebyshev's inequality for C = O(1) sufficiently large we 2, W ′ > 0, which means that in one of the C repetitions there is a Hence, the overall probability of success is at least 1/2 · (3/8 − O(ǫ)) > 1/8, for ǫ sufficiently small. 15 Acknowledgements This material is based upon work supported by the Space and Naval Warfare Systems Center Pacific under Contract No. N66001-11-C-4092, David and Lucille Packard Fellowship, MADALGO (Center for Massive Data Algorithmics, funded by the Danish National Research Association) and NSF grant CCF-1012042. E. Price is supported in part by an NSF Graduate Research Fellowship. References [AWZ08] A. Aldroubi, H. Wang, and K. Zarringhalam. Sequential adaptive compressed sampling via huffman codes. Preprint, 2008. [BGK+10] A. Bruex, A. Gilbert, R. Kainkaryam, John Schiefelbein, and Peter Woolf. Poolmc: Smart pooling of mRNA samples in microarray experiments. BMC Bioinformatics, 2010. [CCF02] M. Charikar, K. Chen, and M. Farach-Colton. Finding frequent items in data streams. ICALP, 2002. [CHNR08] R. Castro, J. Haupt, R. Nowak, and G. Raz. Finding needles in noisy haystacks. Proc. IEEE Conf. Acoustics, Speech, and Signal Proc., page 51335136, 2008. [CM04] [CM06] G. Cormode and S. Muthukrishnan. Improved data stream summaries: The count-min sketch and its applications. LATIN, 2004. G. Cormode and S. Muthukrishnan. Combinatorial algorithms for Compressed Sensing. Proc. 40th Ann. Conf. Information Sciences and Systems, Princeton, Mar. 2006. In [CRT06] E. J. Cand`es, J. Romberg, and T. Tao. Stable signal recovery from incomplete and inaccurate measurements. Comm. Pure Appl. Math., 59(8):1208 -- 1223, 2006. [DDT+08] M. Duarte, M. Davenport, D. Takhar, J. Laska, T. Sun, K. Kelly, and R. Baraniuk. Single-pixel imaging via compressive sampling. IEEE Signal Processing Magazine, 2008. [Def10] Defense Sciences Office. Knowledge enhanced compressive measurement. Broad Agency Announcement, DARPA-BAA-10-38, 2010. [DIPW10] K. Do Ba, P. Indyk, E. Price, and D. Woodruff. Lower bounds for sparse recovery. SODA, 2010. [Don06] D. L. Donoho. Compressed Sensing. IEEE Trans. Info. Theory, 52(4):1289 -- 1306, Apr. 2006. [FPRU10] S. Foucart, A. Pajor, H. Rauhut, and T. Ullrich. The gelfand widths of lp-balls for 0 < p ≤ 1. J. Complexity, 2010. [GG84] A. Y. Garnaev and E. D. Gluskin. On widths of the euclidean ball. Sov. Math., Dokl., page 200204, 1984. [GGI+02] A. C. Gilbert, S. Guha, P. Indyk, Y. Kotidis, S. Muthukrishnan, and M. J. Strauss. Fast, small- space algorithms for approximate histogram maintenance. In ACM Symposium on Theoretical Computer Science, 2002. [GI10] A. Gilbert and P. Indyk. Sparse recovery using sparse matrices. Proceedings of IEEE, 2010. 16 [GLPS10] Anna C. Gilbert, Yi Li, Ely Porat, and Martin J. Strauss. Approximate sparse recovery: opti- mizing time and measurements. In STOC, pages 475 -- 484, 2010. [Glu84] [Haa82] E. D. Gluskin. Norms of random matrices and widths of finite-dimensional sets. Math. USSR- Sb., 48:173182, 1984. Uffe Haagerup. The best constants in the Khintchine inequality. Studia Math., 70(3):231 -- 283, 1982. [HBCN09] J. Haupt, R. Baraniuk, R. Castro, and R. Nowak. Compressive distilled sensing. Asilomar, 2009. [HCN09] J. Haupt, R. Castro, and R. Nowak. Adaptive sensing for sparse signal recovery. Proc. IEEE 13th Digital Sig. Proc./5th Sig. Proc. Education Workshop, page 702707, 2009. [Ind07] [JST11] [JXC08] [Kas77] P. Indyk. Sketching, streaming and sublinear-space algorithms. Graduate course notes, avail- able at http://stellar.mit.edu/S/course/6/fa07/6.895/, 2007. Hossein Jowhari, Mert Saglam, and G´abor Tardos. Tight bounds for lp samplers, finding dupli- cates in streams, and related problems. In PODS, pages 49 -- 58, 2011. S. Ji, Y. Xue, and L. Carin. Bayesian compressive sensing. IEEE Trans. Signal Processing, 56(6):23462356, 2008. B. S. Kashin. Diameters of some finite-dimensional sets and classes of smooth functions. Math. USSR, Izv.,, 11:317333, 1977. [KNPW10] Daniel M. Kane, Jelani Nelson, Ely Porat, and David P. Woodruff. Fast moment estimation in data streams in optimal space. CoRR, abs/1007.4191, 2010. [McG09] A. McGregor. Graph mining on streams. Encyclopedia of Database Systems, page 12711275, 2009. [MSW08] D. M. Malioutov, S. Sanghavi, and A. S. Willsky. Compressed sensing with sequential obser- vations. ICASSP, 2008. [Mut05] S. Muthukrishnan. Data streams: Algorithms and applications). Foundations and Trends in Theoretical Computer Science, 2005. [PW11] E. Price and D. Woodruff. (1+eps)-approximate sparse recovery. FOCS, 2011. [SAZ10] N. Shental, A. Amir, and Or Zuk. Identification of rare alleles and their carriers using com- pressed se(que)nsing. Nucleic Acids Research, 38(19):1 -- 22, 2010. [TZ04] Mikkel Thorup and Yin Zhang. Tabulation based 4-universal hashing with applications to second moment estimation. In Proceedings of the 15th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 615 -- 624, 2004. 17
1707.03478
2
1707
2018-02-01T18:13:10
Round Compression for Parallel Matching Algorithms
[ "cs.DS", "cs.DC" ]
For over a decade now we have been witnessing the success of {\em massive parallel computation} (MPC) frameworks, such as MapReduce, Hadoop, Dryad, or Spark. One of the reasons for their success is the fact that these frameworks are able to accurately capture the nature of large-scale computation. In particular, compared to the classic distributed algorithms or PRAM models, these frameworks allow for much more local computation. The fundamental question that arises in this context is though: can we leverage this additional power to obtain even faster parallel algorithms? A prominent example here is the {\em maximum matching} problem---one of the most classic graph problems. It is well known that in the PRAM model one can compute a 2-approximate maximum matching in $O(\log{n})$ rounds. However, the exact complexity of this problem in the MPC framework is still far from understood. Lattanzi et al. showed that if each machine has $n^{1+\Omega(1)}$ memory, this problem can also be solved $2$-approximately in a constant number of rounds. These techniques, as well as the approaches developed in the follow up work, seem though to get stuck in a fundamental way at roughly $O(\log{n})$ rounds once we enter the near-linear memory regime. It is thus entirely possible that in this regime, which captures in particular the case of sparse graph computations, the best MPC round complexity matches what one can already get in the PRAM model, without the need to take advantage of the extra local computation power. In this paper, we finally refute that perplexing possibility. That is, we break the above $O(\log n)$ round complexity bound even in the case of {\em slightly sublinear} memory per machine. In fact, our improvement here is {\em almost exponential}: we are able to deliver a $(2+\epsilon)$-approximation to maximum matching, for any fixed constant $\epsilon>0$, in $O((\log \log n)^2)$ rounds.
cs.DS
cs
Round Compression for Parallel Matching Algorithms Artur Czumaj Jakub Ł acki Aleksander M adry University of Warwick Google Research, New York MIT [email protected] [email protected] [email protected] Slobodan Mitrovi´c EPFL Krzysztof Onak IBM Research [email protected] [email protected] Piotr Sankowski University of Warsaw [email protected] Abstract For over a decade now we have been witnessing the success of massive parallel computation (MPC) frameworks, such as MapReduce, Hadoop, Dryad, or Spark. One of the reasons for their success is the fact that these frameworks are able to accurately capture the nature of large-scale computation. In particular, compared to the classic distributed algorithms or PRAM models, these frameworks allow for much more local computation. The fundamental question that arises in this context is though: can we leverage this additional power to obtain even faster parallel algorithms? A prominent example here is the maximum matching problem-one of the most classic graph prob- lems. It is well known that in the PRAM model one can compute a 2-approximate maximum matching in O(log n) rounds. However, the exact complexity of this problem in the MPC framework is still far from understood. Lattanzi et al. (SPAA 2011) showed that if each machine has n1+Ω(1) memory, this problem can also be solved 2-approximately in a constant number of rounds. These techniques, as well as the approaches developed in the follow up work, seem though to get stuck in a fundamental way at roughly O(log n) rounds once we enter the (at most) near-linear memory regime. It is thus entirely possible that in this regime, which captures in particular the case of sparse graph computations, the best MPC round complexity matches what one can already get in the PRAM model, without the need to take advantage of the extra local computation power. In this paper, we finally refute that perplexing possibility. That is, we break the above O(log n) round complexity bound even in the case of slightly sublinear memory per machine. In fact, our improvement here is almost exponential: we are able to deliver a (2 + ǫ)-approximation to maximum matching, for any fixed constant ǫ > 0, in O(cid:0)(log log n)2(cid:1) rounds. To establish our result we need to deviate from the previous work in two important ways that are cru- cial for exploiting the power of the MPC model, as compared to the PRAM model. Firstly, we use vertex– based graph partitioning, instead of the edge–based approaches that were utilized so far. Secondly, we develop a technique of round compression. This technique enables one to take a (distributed) algorithm that computes an O(1)-approximation of maximum matching in O(log n) independent PRAM phases and implement a super-constant number of these phases in only a constant number of MPC rounds. 1 Introduction Over the last decade, massive parallelism became a major paradigm in computing, and we have witnessed the deployment of a number of very successful massively parallel computation frameworks, such as MapRe- duce [DG04, DG08], Hadoop [Whi12], Dryad [IBY+07], or Spark [ZCF+10]. This paradigm and the corresponding models of computation are rather different from classical parallel algorithms models con- sidered widely in literature, such as the PRAM model. In particular, in this paper, we study the Mas- sive Parallel Computation (MPC) model (also known as Massively Parallel Communication model) that was abstracted out of capabilities of existing systems, starting with the work of Karloff, Suri, and Vas- silvitskii [KSV10, GSZ11, BKS13, ANOY14, BKS14]. The main difference between this model and the PRAM model is that the MPC model allows for much more (in principle, unbounded) local computation. This enables it to capture a more "coarse–grained," and thus, potentially, more meaningful aspect of par- allelism. It is often possible to simulate one clock step of PRAM in a constant number of rounds on MPC [KSV10, GSZ11]. This implies that algorithms for the PRAM model usually give rise to MPC al- gorithms without incurring any asymptotic blow up in the number of parallel rounds. As a result, a vast body of work on PRAM algorithms naturally translates to the new model. It is thus natural to wonder: 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 lower bounds established for the PRAM model suggest? It is not hard to come up with an example of a problem for which indeed the MPC parallel round number is much smaller than its PRAM round complexity. For instance, computing the parity of n Boolean values takes only O(1) parallel rounds in the MPC model when space per machine is nΩ(1), while on PRAM it provably requires Ω(log n/ log log n) time [BH87] (as long as the total number of processors is polynomial). However, the answer is typically less obvious for other problems. This is particularly the case for graph problems, whose study in a variant of the MPC model was initiated already by Karloff et al. [KSV10]. In this paper, we focus on one such problem, which is also one of the most central graph problems both in sequential and parallel computations: maximum matching. Maximum matchings have been the cornerstone of algorithmic research since 1950s and their study inspired many important ideas, including the complexity class P [Edm65]. In the PRAM model we can compute (1 + ǫ)-approximate matching in O(log n) rounds [LPP15] using randomization. Deterministically, a (2 + ǫ)-approximation can be computed processors are located at graph nodes and can communicate only with neighbors. in O(cid:0)log2 n(cid:1) rounds [FG17]. We note that these results hold in a distributed message passing setting, where setting, Ω(cid:16)plog n/ log log n(cid:17) time lower bound is known for computing any constant approximation to maximum matching [KMW06]. In such a distributed So far, in the MPC setting, the prior results are due to Lattanzi, Moseley, Suri, and Vassilvitskii [LMSV11], Ahn and Guha [AG15] and Assadi and Khanna [AK17]. Lattanzi et al. [LMSV11] put forth algorithms for several graph problems, such as connected components, minimum spanning tree, and maximum match- ing problem, that were based on a so-called filtering technique. In particular, using this technique, they have obtained an algorithm that can compute a 2-approximation to maximum matching in O(1/δ) MPC rounds, provided S, the space per machine, is significantly larger than the total number of vertices n, that is S = Ω(cid:0)n1+δ(cid:1), for any constant δ ∈ (0, 1). Later on, Ahn and Guha [AG15] provided an improved algo- rithm that computes a (1+ ǫ)-approximation in O(1/(δǫ)) rounds, provided S = Ω(cid:0)n1+δ(cid:1), for any constant δ > 0. Both these results, however, crucially require that space per machine is significantly superlinear in n, the number of vertices. In fact, if the space S is linear in n, which is a very natural setting for massively 1 parallel graph algorithms, the performance of both these algorithms degrades to O(log n) parallel rounds, which matches what was known for the PRAM model. Recently, Assadi and Khanna [AK17] showed how to construct randomized composable coresets of size O(n) that give an O(1)-approximation for maximum matching. Their techniques apply to the MPC model only if the space per machine is O(n√n). We also note that the known PRAM maximal independent set and maximal matching algorithms [Lub86, ABI86, II86] can be used to find a maximal matching (i.e., 2-approximation to maximum matching) in O(log n) MPC rounds as long as space per machine is at least nΩ(1) (i.e., S ≥ nc for some constant c > 0). We omit further details here, except mentioning that a more or less direct simulation of those algorithms is possible via an O(1)-round sorting subroutine [GSZ11]. The above results give rise to the following fundamental question: Can the maximum matching be (approximately) solved in o(log n) parallel rounds in O(n) space per machine? The main result of this paper is an affirmative answer to that question. We show that, for any S = Ω(n), one can obtain an O(1)- approximation to maximum matching using O(cid:0)(log log n)2(cid:1) parallel MPC rounds. So, not only do we break the existing Ω(log n) barrier, but also provide an exponential improvement over the previous work. Our algorithm can also provide a (2 + ǫ), instead of O(1)-approximation, at the expense of the number of parallel rounds increasing by a factor of O(log(1/ǫ)). Finally, our approach can also provide algorithms that have o(log n) parallel round complexity also in the regime of S being (mildly) sublinear. For instance, we obtain O(cid:0)(log log n)2(cid:1) MPC rounds even if space per machine is S = n/(log n)O(log log n). The exact comparison of our bounds with previous results is given in Table 1. 1.1 The model In this work, we adopt a version of the model introduced by Karloff, Suri, and Vassilvitskii [KSV10] and refined in later works [GSZ11, BKS13, ANOY14]. We call it massive parallel computation (MPC), which is a mutation of the name proposed by Beame et al. [BKS13]. In the MPC model, we have m machines at our disposal and each of them has S words of space. Initially, each machine receives its share of the input. In our case, the input is a collection E of edges and each machine receives approximately E/m of them. The computation proceeds in rounds. During the round, each of the machines processes its local data without communicating with other machines. At the end of each round, machines exchange messages. Each message is sent only to a single machine specified by the machine that is sending the message. All messages sent and received by each machine in each round have to fit into the machine's local memory. Hence, their total length is bounded by S.1 This in particular implies that the total communication of the MPC model is bounded by m · S in each round. The messages are processed by recipients in the next round. machine has to fit in its local memory. Hence again, each machine can output at most S words. At the end of the computation, machines collectively output the solution. The data output by each If the input is of size N , one usually wants S sublinear in the N , and The range of values for S and m. the total space across all the machines to be at least N -so the input fits onto the machines-and ideally not In this paper, the focus is on graph algorithms. If n is the number of vertices in the graph, the input size much larger. Formally, one usually considers S ∈ Θ(cid:0)N 1−ǫ(cid:1), for some ǫ > 0. can be as large as Θ(cid:0)n2(cid:1). Our parallel algorithm requires Θ(n) space per machine (or even slightly less), which is polynomially less than the size of the input for dense graphs. 1This for instance allows a machine to send a single word to S/100 machines or S/100 words to one machine, but not S/100 words to S/100 machines if S = ω(1), even if the messages are identical. 2 Sparse graphs. Many practical large graphs are believed to have only O(n) edges. One natural example is social networks, in which most participants are likely to have a bounded number of friends. The additional advantage of our approach is that it allows for a small number of processing rounds even if a sparse input graph does not fit onto a single machine. If a small number-say, f (n)-of machines is needed even to store the graph, our algorithm still requires only O(cid:0)(log log n)2 + log f (n)(cid:1) rounds for O(n/f (n)) space per machine. Communication vs. computation complexity. The main focus of this work is the number of (communica- tion) rounds required to finish computation. Also, even though we do not make an effort to explicitly bound it, it is apparent from the design of our algorithms that every machines performs O(S polylog S) computa- tion steps locally. This in particular implies that the overall work across all the machines is O(rN polylog S), where r is the number of rounds and N is the input size (i.e., the number of edges). and it is known that computing a (1 + ǫ)-approximate matching in the message passing model with Θ(n) The total communication during the computation is O(rN ) words. This is at most O(cid:0)rn2(cid:1) words edges per player may require Ω(cid:0)n2/(1 + ǫ)2(cid:1) bits of communication [HRVZ15]. Since our value of r is O(cid:0)(log log n)2(cid:1) when Θ(n) edges are assigned to each player, we lose a factor of Θ(log n) compared to this lower bound if words (and vertex identifiers) have Θ(log n) bits. 1.2 Our results In our work, we focus on computing an O(1)-approximate maximum matching in the MPC model. We collect our results and compare to the previous work in Table 1. The table presents two interesting regimes Source Approx. [LMSV11] 2 [AG15] 1 + ǫ 2 O(1) 2 + ǫ O(1) 2 + ǫ here Space n1+Ω(1) O(n) O(cid:0)n1+1/p(cid:1) nΩ(1) O(n) O(n)/f (n) Remarks Maximal matching p > 1 Maximal matching Simulate [Lub86, ABI86, II86] ǫ ∈ (0, 1/2) 2 ≤ f (n) = O(cid:0)n1/2(cid:1) Rounds O(1) O(log n) O(p/ǫ) O(log n) O(cid:0)(log log n)2(cid:1) O(cid:0)(log log n)2 · log(1/ǫ)(cid:1) O(cid:0)(log log n)2 + log f (n)(cid:1) O(cid:0)(log log n)2 + log f (n)(cid:1) · log(1/ǫ) Table 1: Comparison of our results for computing approximate maximum size matchings to the previous results for the MPC model. for our algorithms. On the one hand, when the space per machine is S = O(n), we obtain an algorithm that requires O((log log n)2) rounds. This is the first known algorithm that, with linear space per machine, breaks the O(log n) round barrier. On the other hand, in the mildly sublinear regime of space per machine, i.e., when S = O(n/f (n)), for some function f (n) that is no(1), we obtain an algorithm that still requires o(log n) rounds. This, again is the first such result in this regime. In particular, we prove the following result. 3 Theorem 1.1. There exists an MPC algorithm that constructs an O(1)-approximation to maximum matching with constant probability in O(cid:0)(log log n)2 + max(cid:0)log n space on each machine. S , 0(cid:1)(cid:1) rounds, where S = nΩ(1) is the amount of As a corollary, we obtain the following result that provides nearly 2-approximate maximum matching. 2 ), there exists an MPC algorithm that constructs a (2+ǫ)-approximation to Assadi et al. [ABB+17] observe that one can use a technique of McGregor [McG05] to extend the Corollary 1.2. For any ǫ ∈ (0, 1 maximum matching with 99/100 probability in O(cid:0)(log log n)2 + max(cid:0)log n S = nΩ(1) is the amount of space on each machine. algorithm to compute a (1 + ǫ)-approximation in O((log log n)2) · (1/ǫ)O(1/ǫ) rounds. It should also be noted that (as pointed out to us by Seth Pettie) any O(1)-approximation algorithm for unweighted matchings can be used to obtain a (2 + ǫ)-approximation algorithm for weighted matchings (see Section 4 of his paper with Lotker and Patt-Shamir [LPP15] for details). In our setting this implies that Theorem 1.1 yields an algorithm that computes a (2 + ǫ)-approximation to maximum weight matching in O((log log n)2 · (1/ǫ)) rounds and O(n log n) space per machine. S , 0(cid:1)(cid:1) · log(1/ǫ) rounds, where 1.3 Related work We note that there were efforts at modeling MapReduce computation [FMS+10] before the work of Karloff et al. Also a recent work [RVW16] investigates the complexity of the MPC model. In the filtering technique, introduced by Lattanzi et al. [LMSV11], the input graph is iteratively sparsified until it can be stored on a single machine. For the matching problem, the sparsification is achieved by first obtaining a small sample of edges, then finding a maximal matching in the sample, and finally removing all the matched vertices. Once a sufficiently small graph is obtained, a maximal matching is computed on a single machine. In the S = Θ(n) regime, the authors show that their approach reduces the number of edges by a constant factor in each iteration. Despite this guarantee, until the very last step, each iteration may make little progress towards obtaining even an approximate maximal matching, resulting in a O(log n) round complexity of the algorithm. Similarly, the results of Ahn and Guha [AG15] require n1+Ω(1) space per machine to compute a O(1)-approximate maximum weight matching in a constant number of rounds and do not imply a similar bound for the case of linear space. We note that the algorithm of Lattanzi et al. [LMSV11] cannot be turned easily into a fast approximation algorithm when space per machine is sublinear. Even with Θ(n) space, their method is able to remove only a constant fraction of edges from the graph in each iteration, so Ω(log n) rounds are needed until only a matching is left. When S = Θ(n), their algorithm works as follows: sample uniformly at random Θ(n) edges of the graph, find maximal matching on the sampled set, remove the matched vertices, and repeat. We do not provide a formal proof here, but on the following graph this algorithm requires Ω(log n) rounds, even to discover a constant factor approximation. Consider a graph consisting of t separate regular graphs of degree 2i, for 0 ≤ i ≤ t− 1, each on 2t vertices. This graph has t2t nodes and the algorithm requires Ω(t) rounds even to find a constant approximate matching. The algorithm chooses edges uniformly at random, and few edges are selected each round from all but the densest remaining subgraphs. Thus, it takes multiple rounds until a matching of significant size is constructed for sparser subgraphs. This example emphasizes the weakness of direct edge sampling and motivates our vertex sampling scheme that we introduce in this paper. Similarly, Ahn and Gupta [AG15] build on the filtering approach of Lattanzi et al. and design a primal- dual method for computing a (1 + ǫ)-approximate weighted maximum matching. They show that each 4 iteration of their distributed algorithm either makes large progress in the dual, or they can construct a large approximate matching. Regardless of their new insights, their approach is inherently edge-sampling based and does not break the O(log n) round complexity barrier when S = O(n). Despite the fact that MPC model is rather new, computing matching is an important problem in this model, as the above mentioned two papers demonstrate. This is further witnessed by the fact that the distributed and parallel complexity of maximal matching has been studied for many years already. The best deterministic PRAM maximal matching algorithm, due to Israeli and Shiloach [IS86], runs in O(cid:0)log3 n(cid:1) rounds. Israeli and Itai [II86] gave a randomized algorithm for this problem that runs in O(log n) rounds. Their algorithm works as well in CONGEST, a distributed message-passing model with a processor assigned to each vertex and a limit on the amount of information sent along each edge per round. A more recent paper by Lotker, Patt-Shamir, and Pettie [LPP15] gives a (1+ǫ)-approximation to maximum matching in O(log n) rounds also in the CONGEST model, for any constant ǫ > 0. On the deterministic front, in the LOCAL model, which is a relaxation of CONGEST that allows for an arbitrary amount of data sent along each edge, round algorithm by Fischer and Ghaffari [FG17]. On the negative side, Kuhn, Moscibroda, and Wattenhofer [KMW06] showed that any distributed algo- a line of research initiated by Ha´n´ckowiak, Karo´nski, and Panconesi [HKP01, HKP99] led to an O(cid:0)log3 n(cid:1)- rithm, randomized or deterministic, when communication is only between neighbors requires Ω(cid:16)plog n/ log log n(cid:17) rounds to compute a constant approximation to maximum matching. This lower bound applies to all dis- tributed algorithms that have been mentioned above. Our algorithm circumvents this lower bound by loosen- ing the only possible assumption there is to be loosened: single-hop communication. In a sense, we assign subgraphs to multiple machines and allow multi-hop communication between nodes in each subgraph. Finally, the ideas behind the peeling algorithm that is a starting point for this paper can be traced back to the papers of Israeli, Itai, and Shiloach [II86, IS86], which can be interpreted as matching high-degree vertices first in order to reduce the maximum degree. A sample distributed algorithm given in a work of Parnas and Ron [PR07] uses this idea to compute an O(log n) approximation for vertex cover. Their algorithm was extended by Onak and Rubinfeld [OR10] in order to provide an O(1)-approximation for vertex cover and maximum matching in a dynamic version of the problems. This was achieved by randomly matching high-degree vertices to their neighbors in consecutive phases while reducing the maximum degree in the remaining graph. This approach was further developed in the dynamic graph setting by a number of papers [BHI15, BHN16, BHN17, BCH17]. Ideas similar to those in the paper of Parnas and Ron [PR07] were also used to compute polylogarithmic approximation in the streaming model by Kapralov, Khanna, and Sudan [KKS14]. Our version of the peeling algorithm was directly inspired by the work of Onak and Rubinfeld [OR10] and features important modifications in order to make our analysis go through. 1.4 Future challenges We show a parallel matching algorithm in the MPC model by taking an algorithm that can be seen as a distributed algorithm in the so-called LOCAL model. This algorithm requires Θ(log n) rounds and can be simulated in Θ(log n) MPC rounds relatively easily with nΩ(1) space per machine. We develop an ap- proximate version of the algorithm that uses much fewer rounds by repeatedly compressing a superconstant number of rounds of the original algorithm to O(1) rounds. It is a great question if this kind of speedup can be obtained for other-either distributed or PRAM-algorithms. As for the specific problem considered in this paper, an obvious question is whether our round complex- ity is optimal. We conjecture that there is a better algorithm that requires O(log log n) rounds, the square root of our complexity. Unfortunately, a factor of log n in one of our functions (see the logarithmic factor in 5 α, a parameter defined later in the paper) propagates to the round complexity, where it imposes a penalty of log log n. Note also that as opposed to the paper of Onak and Rubinfeld [OR10], we do not obtain an O(1)- approximation to vertex cover. This stems from the fact that we discard so-called reference sets, which can be much bigger than the minimum vertex cover. This is unfortunately necessary in our analysis. Is there a way to fix this shortcoming of our approach? Finally, we suspect that there is a simpler algorithm for the problem that avoids the intricacies of our approach and proceeds by simply greedily matching high-degree vertices on induced subgraphs without sophisticated sampling in every phase. Unfortunately, we do not know how to analyze this kind of approach. 1.5 Recent developments Since an earlier version of this work was shared on arXiv, it has inspired two followup works. First, As- sadi [Ass17] applied the round compression idea to the distributed O(log n)-approximation algorithm for vertex cover of Parnas and Ron [PR07]. Using techniques from his recent work with Khanna [AK17], he gave a simple MPC algorithm that in O(log log n) rounds and n/ polylog(n) space per machine computes an O(log n)-approximation to minimum vertex cover. Second, a new paper by Assadi et al. [ABB+17] addresses, among other things, several open questions from this paper. They give an MPC algorithm that computes O(1)-approximation to both vertex cover and maximum matching in O(log log n) rounds and O(n) space per machine (though the space is strictly superlinear). Their result builds on techniques developed originally for dynamic matching algorithms [BS15, BS16] and composable coresets [AK17]. It is worth to note that their construction critically relies on the vertex sampling approach (i.e., random assignment of vertices to machines) introduced in our work. 1.6 Notation For a graph G = (V, E) and V ′ ⊆ V , we write G[V ′] to denote the subgraph of G induced by V ′. Formally, G[V ′] def= (V ′, E ∩ (V ′ × V ′)). We also write N (v) to denote the set of neighbors of a vertex v in G. 2 Overview In this section we present the main ideas and techniques behind our result. Our paper contains two main technical contributions. First, our algorithm randomly partitions vertices across the machines, and on each machine considers only the corresponding induced graph. We prove that it suffices to consider these induced subgraphs to obtain an approximate maximum matching. Note that this approach greatly deviates from previous works, that used edge based partitioning. Second, we introduce a round compression technique. Namely, we start with an algorithm that executes O(log n) phases and can be naturally implemented in O(log n) MPC rounds and then demonstrate how to emulate this algorithm using only o(log n) MPC rounds. The underlying idea is quite simple: each machine independently runs multiple phases of the initial algorithm. This approach, however, has obvious challenges since the machines cannot communicate in a single round of the MPC algorithm. The rest of the section is devoted to describing our approach and illustrating how to overcome these challenges. 6 2.1 Vertex based sampling The algorithms for computing maximal matching in PRAM and their simulations in the MPC model [Lub86, ABI86, IS86, II86] are designed to, roughly speaking, either halve the number of the edges or halve the maximum degree in each round. Therefore, in the worst case those algorithms inherently require Ω(log n) rounds to compute a maximal matching. On the other hand, all the algorithm for the maximal matching problem in the MPC model prior to ours ([LMSV11, AG15, AK17]) process the input graph by discarding edges, and eventually aggregate the remaining edges on a single machine to decide which of them are part of the final matching. It is not known how to design approaches similar to [LMSV11, AG15, AK17] while avoiding a step in which the maximal matching computation is performed on a single machine. This seems to be a barrier for improving upon O(log n) rounds, if the space available on each machine is O(n). The starting point of our new approach is alleviating this issue by resorting to a more careful vertex based sampling. Specifically, at each round, we randomly partition the vertex set into vertex sets V1, . . . , Vm and consider induced graphs on those subsets independently. Such sampling scheme has the following handy property: the union of matchings obtained across the machines is still a matching. Furthermore, we show that for the appropriate setting of parameters this sampling scheme allows us to handle vertices of a wide range of degrees in a single round, unlike handling only high-degree vertices (that is, vertices with degree within a constant factor of the maximum degree) as guaranteed by [II86, IS86]. 2.2 Global algorithm To design an algorithm executed on machines locally, we start from a sequential peeling algorithm GlobalAlg (see Algorithm 1), which is a modified version of an algorithm used by Onak and Rubinfeld [OR10]. The algorithm had to be significantly adjusted in order to make our later analysis of a parallel version possible. The execution of GlobalAlg is divided into Θ(log n) phases. In each phase, the algorithm first com- putes a set H of high-degree vertices. Then it selects a set F of vertices, which we call friends. Next the algorithm selects a matching fM between H and F , using a simple randomized strategy. F is carefully con- structed so that both F andfM are likely to be of order Θ(H). Finally, the algorithm removes all vertices in H∪F , hence reducing the maximum vertex degree in the graph by a constant factor, and proceeds to the next phase. The central property of GlobalAlg is that it returns an O(1) approximation to maximum matching with constant probability (Corollary 3.4). A detailed discussion of GlobalAlg is given in Section 3. Global matching algorithm Algorithm 1: GlobalAlg(G,e∆) Input: Graph G = (V, E) of maximum degree at most e∆ 1 ∆ ← e∆, M ← ∅, V ′ ← V 2 while ∆ ≥ 1 do Output: A matching in G 3 4 5 6 /* Invariant: the maximum degree in G[V ′] is at most ∆ */ Let H ⊂ V ′ be a set of vertices of degree at least ∆/2 in G[V ′]. We call vertices in H heavy. Create a set F of friends by selecting each vertex v ∈ V ′ independently with probability N (v) ∩ H/4∆. Compute a matchingfM in G[H ∪ F ] using MatchHeavy(H, F ) and add it to M . V ′ ← V ′ \ (H ∪ F ), ∆ ← ∆/2 7 return M 7 Algorithm 2: MatchHeavy(H, F ) Computing a matching in G[H ∪ F ] Input: set H of heavy vertices and set F of friends Output: a matching in G[H ∪ F ] 1 For every vertex v ∈ F pick uniformly at random a heavy neighbor v⋆ in N (v) ∩ H. 2 Independently at random color each vertex in H ∪ F either red or blue. 3 Select the following subset of edges: E⋆ ← {(v, v⋆) : v ∈ F ∧ v is red ∧ v⋆ ∈ H ∧ v⋆ is blue}. 4 For every blue vertex w incident to an edge in E⋆, select one such edge and add it to fM . 5 returnfM 2.3 Parallel emulation of the global algorithm (Section 4) space. The following two ways could be used to execute GlobalAlg in the MPC model: (1) place the whole graph on one machine, and trivially execute all the phases of GlobalAlg in a single round; or (2) simulate one phase of GlobalAlg in one MPC round while using O(n) space per machine, by distributing vertices randomly onto machines (see Section 6.1 for details). However, each of these approaches has severe draw- backs. The first approach requires Θ(E) space per machine, which is likely to be prohibitive for large graphs. On the other hand, while the second approach uses O(n) space, it requires Θ(log n) rounds of MPC computation. We achieve the best of both worlds by showing how to emulate the behavior of multiple phases of GlobalAlg in a single MPC round with each machine using O(n) space, thus obtaining an MPC algo- rithm requiring o(log n) rounds. More specifically, we show that it is possible to emulate the behavior of GlobalAlg in O(cid:0)(log log n)2(cid:1) rounds with each machine using O(n) (or even only n/(log n)O(log log n)) Before we provide more details about our parallel multi-phase emulation of GlobalAlg, let us mention the main obstacle such an emulation encounters. At the beginning of every phase, GlobalAlg has access to the full graph. Therefore, it can easily compute the set of heavy vertices H. On the other hand, machines in our MPC algorithm use O(n) space and thus have access only to a small subgraph of the input graph (when E ≫ n). In the first phase this is not a big issue, as, thanks to randomness, each machine can estimate the degrees of high-degree vertices. However, the degrees of vertices can significantly change from phase to phase. Therefore, after each phase it is not clear how to select high-degree vertices in the next phase without inspecting the entire graph again. Hence, one of the main challenges in designing a multi- phase emulation of GlobalAlg is to ensure that machines at the beginning of every phase can estimate global degrees of vertices well enough to identify the set of heavy vertices, while each machine still having access only to its local subgraph. This property is achieved using a few modifications to the algorithm. 2.3.1 Preserving randomness Our algorithm partitions the vertex set into m disjoint subsets Vi by assigning each vertex independently and uniformly at random. Then the graph induced by each subset Vi is processed on a separate machine. Each machine finds a set of heavy vertices, Hi, by estimating the global degree of each vertex of Vi. It is not hard to argue (using a standard concentration bound) that there is enough randomness in the initial partition so that local degrees in each induced subgraph roughly correspond to the global degrees. Hence, after the described partitioning, sets H andSi∈[m] Hi have very similar properties. This observation crucially relies on the fact that initially the vertices are distributed independently and uniformly at random. However, if one attempts to execute the second phase of GlobalAlg without randomly reassigning 8 vertices to sets after the first phase, the remaining vertices are no longer distributed independently and uniformly at random. In other words, after inspecting the neighborhood of every vertex locally and making a decision based on it, the randomness of the initial random partition may significantly decrease. Let us now make the following thought experiment. Imagine for a moment that there is an algorithm that emulates multiples phases of GlobalAlg in parallel and in every phase inspects only the vertices that end-up being matched. Then, from the point of view of the algorithm, the vertices that are not matched so far are still distributed independently and uniformly at random across the machines. Or, saying in a different way, if randomness of some vertices is not inspected while emulating a phase, then at the beginning of the next phase those vertices still have the same distribution as in the beginning of that MPC round. But, how does an algorithm learn about vertices that should be matched by inspecting no other vertex? How does the algorithm learn even only about high-degree vertices without looking at their neighborhood? In the sequel we show how to design an algorithm that looks only "slightly" at the vertices that do not end-up being matched. As we prove, that is sufficient to design a multi-phase emulation of GlobalAlg. We now discuss in more detail how to preserve two crucial properties of our vertex assignments through- out the execution of multiple phases: independent and nearly-uniform distribution. 2.3.2 Independence (Lemma 4.3) As noted above, it is not clear how to compute vertex degrees without inspecting their local neighborhood. A key, and at first sight counter-intuitive, step in our approach is to estimate even local degrees of vertices (in contrast to computing them exactly). To obtain the estimates, it suffices to examine only small neighbor- hoods of vertices and in turn preserve the independent distribution of the intact ones. More precisely, we sample a small set of vertices on each machine, called reference sets, and use the set to estimate the local degrees of all vertices assigned to this machine. Furthermore, we show that with a proper adjustments of GlobalAlg these estimates are sufficient for capturing high-degree vertices. Very crucially, all the vertices that are used in computing a matching in one emulated phase (including the reference sets) are discarded at the end of the phase, even if they do not participate in the obtained matching. In this way we disregard the vertices which position is fixed and, intuitively, secure an indepen- dent distribution of the vertices across the machines in the next phase. We also note, without going into details, that obtaining full independence required modifying how the set of friends is selected, compared to the original approach of Onak and Rubinfeld [OR10]. In their ap- proach, each heavy vertex selected one friend at random. However, as before, in order to select exactly one friend would require examining neighborhood of heavy vertices. This, however, introduces dependencies between vertices that have not been selected. So instead, in our GlobalAlg, every vertex selects itself as a friend independently and proportionally to the number of high-degree vertices (found using the reference set), which again secures an independent distribution of the remaining vertices. The final properties of the obtained sets in either approach are very similar. 2.3.3 Uniformity (Lemma 4.4) A very convenient property in the task of emulating multiple phases of GlobalAlg is a uniform distribution of vertices across all the machines at every phase – for such a distribution, we know the expected number of neighbors of each desired type assigned to the same machine. Obtaining perfect uniformity seems difficult- if not impossible in our setting-and we therefore settle for near uniformity of vertex assignments. The probability of the assignment of each vertex to each machine is allowed to differ slightly from that in the uniform distribution. Initially, the distribution of each vertex is uniform and with every phase it can deviate 9 more and more from the uniform distribution. We bound the rate of the decay with high probability and execute multiple rounds as long as the deviation from the uniform distribution is negligible. More precisely, in the execution of the entire parallel algorithm, the sufficiently uniform distribution is on average kept over (log log n)2(cid:17) phases of the emulation of GlobalAlg. Ω(cid:16) log n µH(r) 1 1 2 1 2 1 r Figure 1: An idealized version of µH : R → [0, 1], in which n was fixed to a small constant and the multiplicative constant inside the exponentiation operator was lowered. In order to achieve the near uniformity, we modify the procedure for selecting H, the set of high-degree vertices. Instead of a hard threshold on the degrees of vertices that are included in H as in the sequential algorithm, we randomize the selection by using a carefully crafted threshold function µH . This function specifies the probability with which a vertex is included in H. It takes as input the ratio of the vertex's degree to the current maximum degree (or, more precisely, the current upper bound on the maximum degree) and it smoothly transitions from 0 to 1 in the neighborhood of the original hard threshold (see Figure 1). The main intuition behind the introduction of this function is that we want to ensure that a vertex is not selected for H with almost the same probability, independently of the machine on which it resides. Using a hard threshold instead of µH could result in the following deficiency. Consider a vertex v that has slightly too few neighbors to qualify as a heavy vertex. Still, it could happen, with a non-negligible probability, that the reference set of some machine contains so many neighbors of v that v would be considered heavy on this machine. However, if v is not included in the set of heavy vertices on that machine, it becomes clear after even a single phase that the vertex is not on the given machine, i.e. the vertex is on the given machine with probability zero. At this point the distribution is clearly no longer uniform. Function µH has further useful properties that we extensively exploit in our analysis. We just note that in order to ensure near uniformity with high probability, we also have to ensure that each vertex is selected for F , the set of friends, with roughly the same probability on each machine. 2.4 Organization of the appendix The appendix presents the details of our techniques. We start by analyzing GlobalAlg in Section 3. Then, Section 4 describes how to emulate of a single phase of GlobalAlg in the MPC model. Section 5 gives and analyzes our parallel algorithm by putting together components developed in the previous sections. The resulting parallel algorithm can be implemented in the MPC model in a fairly straightforward way by using the result of [GSZ11]. The details of the implementation are given in Section 6. 10 3 Global Algorithm 3.1 Overview The starting point of our result is a peeling algorithm GlobalAlg that takes as input a graph G, and removes from it vertices of lower and lower degree until no edge is left. See page 7 for its pseudocode. We use the term phase to refer to an iteration of the main loop in Lines 2–6. Each phase is associated with a threshold ∆. Initially, ∆ equals e∆, the upper bound on the maximum vertex degree. In every phase, ∆ is divided by two until it becomes less than one and the algorithm stops. Since during the execution of the algorithm we maintain the invariant that the maximum degree in the graph is at most ∆, the graph has no edge left when the algorithm terminates. In each phase the algorithm matches, in expectation, a constant fraction of the vertices it removes. We use this fact to prove that, across all the phases, the algorithm computes a constant-factor approximate matching. We now describe in more detail the execution of each phase. First, the algorithm creates H, the set of vertices that have degree at least ∆/2 (Line 3). We call these vertices heavy. Then, the algorithm uses randomness to create F , a set of friends (Line 4). Each vertex v is independently included in F with probability equal to the number of its heavy neighbors divided by 4∆. We show that E [F] = O(H) and G[H ∪ F ] contains a matching of expected size Ω(H). This kind of matching is likely found by MatchHeavy in Line 5. Note that GlobalAlg could as well compute a maximal matching in G[H ∪ F ] instead of calling MatchHeavy. However, for the purpose of the analysis, using MatchHeavy is simpler, as we can directly relate the size of the obtained matching to the size of H. In addition, we later give a parallel version of GlobalAlg, and MatchHeavy is easy to parallelize. At the end of the phase, vertices in both H and F are removed from the graph, while the matching found in G[H ∪ F ] is added to the global matching being constructed. It is easy to see, that by removing H, the algorithm ensures that no vertex of degree larger than ∆/2 remains in the graph, and therefore the bound on the maximum degree decreases by a factor of two. 3.2 Analysis We start our analysis of the algorithm by showing that the execution of MatchHeavy in each phase of GlobalAlg finds a relatively large matching in expectation. Lemma 3.1. Consider one phase of GlobalAlg. Let H be the set of heavy vertices. MatchHeavy finds 40H. Proof. Observe that the set E⋆ is a collection of vertex-disjoint stars: each edge connects a red vertex with a blue vertex and the red vertices have degree 1. Thus, a subset of E⋆ forms a valid matching as long as no a matching fM such that Eh(cid:12)(cid:12)(cid:12)fM(cid:12)(cid:12)(cid:12)i ≥ 1 blue vertex is incident to two matched edges. Note that this is guaranteed by how edges are added to fM in The size of the computed matching is the number of blue vertices in H that have at least one incident edge in E⋆. Let us now lower bound the number of such vertices. Consider an arbitrary u ∈ H. It has the desired properties exactly when the following three independent events happen: some v ∈ F selects u in Line 1, u is colored blue, and v is colored red. The joint probability of the two latter events is exactly 1 4 . The Line 4. 11 probability that u is not selected by some v ∈ F is 1 ≤(cid:18)1 − 1 4∆(cid:19)∆/2 This implies that u is selected by a neighbor v ∈ F with probability at least 1 at least 1 4∆(cid:19)N (u)∩V ′ 2(cid:19) ≤ exp(cid:18)− (cid:18)1 − 40 , u is blue and incident to an edge in E⋆. Hence, Eh(cid:12)(cid:12)(cid:12)fM(cid:12)(cid:12)(cid:12)i ≥ 1 Next we show an upper bound on the expected size of F , the set of friends. ≤ exp(cid:18)− 10 · 1 4 = 1 ∆ 1 4∆ · 40 H. 1 8(cid:19) ≤ 9 10 . 10 . Therefore, with probability Lemma 3.2. Let H be the set of heavy vertices selected in a phase of GlobalAlg. The following bound holds on the expected size of F , the set of friends, created in the same phase: E [F] ≤ 1 Proof. At the beginning of a phase, every vertex u ∈ V ′-including those in H-has its degree, N (u)∩V ′, bounded by ∆. Reversing the order of the summation and applying this fact, we get: 4H. E [F] = Xv∈V ′ N (v) ∩ H 4∆ = Xu∈H N (u) ∩ V ′ 4∆ ≤ H · ∆ 4∆ = H 4 . We combine the last two bounds to lower bound the expected size of the matching computed by GlobalAlg. Lemma 3.3. Consider an input graph G with an upper bounde∆ on the maximum vertex degree. GlobalAlg(G,e∆) executes T def= ⌊loge∆⌋ + 1 phases. Let Hi, Fi, and fMi be the sets H, F , and fM constructed in phase i for i ∈ [T ]. The following relationship holds on the expected sizes of these sets: TXi=1 Eh(cid:12)(cid:12)(cid:12)fMi(cid:12)(cid:12)(cid:12)i ≥ 1 50 TXi=1 E [Hi + Fi] Proof. For each phase i ∈ [T ], by applying the expectation over all possible settings of the set Hi, we learn from Lemmas 3.1 and 3.2 that Eh(cid:12)(cid:12)(cid:12)fMi(cid:12)(cid:12)(cid:12)i ≥ It follows that 1 40 E [Hi] and E [Fi] ≤ 1 4 E [Hi] . 1 50 E [Hi + Fi] ≤ 1 50 E [Hi] + 1 200 E [Hi] = 1 40 and the statement of the lemma follows by summing over all phases. E [Hi] ≤ Eh(cid:12)(cid:12)(cid:12)fMi(cid:12)(cid:12)(cid:12)i , We do not use this fact directly in our paper, but note that the last lemma can be used to show that GlobalAlg can be used to find a large matching. Corollary 3.4. GlobalAlg computes a constant factor approximation to the maximum matching with Ω(1) probability. Proof. First, note that GlobalAlg finds a correct matching, i.e., no two different edges in M share an endpoint. This is implied by the fact that M is extended in every phase by a matching on a disjoint set of vertices. 12 Let T and sets Hi, Fi, and fMi for i ∈ [T ] be defined as in the statement of Lemma 3.3. Let MOPT be a maximum matching in the graph. Observe that at the end of the algorithm execution, the remaining graph is empty. This implies that the size of the maximum matching can be bounded by the total number of removed vertices, because each removed vertex decreases the maximum matching size by at most one: Hi + Fi ≥ MOPT . TXi=1 Eh(cid:12)(cid:12)(cid:12)fMi(cid:12)(cid:12)(cid:12)i ≥ Hence, using Lemma 3.3, E [M] = TXi=1 Since M ≤ MOPT, M ≥ 1 100 · MOPT + 1 · 1 strictly less than 1 1 50 TXi=1 100 MOPT = 1 E [Hi + Fi] ≥ 1 50 MOPT . 100 MOPT with probability at least 100 . Otherwise, E [M] would be 1 50 MOPT, which is not possible. 4 Emulation of a Phase in a Randomly Partitioned Graph In this section, we introduce a modified version of a single phase (one iteration of the main loop) of GlobalAlg. Our modifications later allow for implementing the algorithm in the MPC model. The pseu- docode of the new procedure, EmulatePhase, is presented as Algorithm 3. We partition the vertices of the current graph into m sets Vi, 1 ≤ i ≤ m. Each vertex is assigned independently and almost uniformly at random to one of the sets. For each set Vi, we run a subroutine LocalPhase (presented as Algorithm 4). This subroutine runs a carefully crafted approximate version of one phase of GlobalAlg with an appropri- ately rescaled threshold ∆. More precisely, the threshold passed to the subroutine is scaled down by a factor of m, which corresponds to how approximately vertex degrees decrease in subgraphs induced by each of the sets. The main intuition behind this modification is that we hope to break the problem up into smaller subproblems on disjoint induced subgraph, and obtain similar global properties by solving the problem ap- proximately on each smaller part. Later, in Section 5, we design an algorithm that assigns the subproblems to different machines and solves them in parallel. Algorithm 3: EmulatePhase(∆, G⋆, m,D) Emulation of a single phase in a randomly partitioned graph Input: • threshold ∆ • induced subgraph G⋆ = (V⋆, E⋆) of maximum degree 3 • number m of subgraphs • ǫ-near uniform and independent distribution D on assignments of V⋆ to [m] 2 ∆ Output: Remaining vertices and a matching 1 Pick a random assignment Φ : V⋆ → [m] from D 2 for i ∈ [m] do Vi ← {v ∈ V⋆ : Φ(v) = i} (V ′ i , Mi) ← LocalPhase(i, G⋆[Vi], ∆/m) 3 4 5 return (Sm i ,Sm i=1 V ′ i=1 Mi) /* LocalPhase = Algorithm 4 */ 13 A multiplicative constant used in the exponent of µH : α def= 96 ln n. The probability of the selection for a reference set: µR def=(cid:0)106 · log n(cid:1)−1 . The probability of the selection for a heavy set (used with r equal to the ratio of the estimated degree to the current threshold): µH (r) def=( 1 2 exp(cid:0) α 2 (r − 1/2)(cid:1) 2 exp(cid:0)− α 1 − 1 2 (r − 1/2)(cid:1) if r ≤ 1/2, if r > 1/2. The probability of the selection for the set of friends (used with r equal to the ratio of the number of heavy neighbors to the current threshold): µF (r) def=(max{r/4, 0} if r ≤ 4, if r > 4. 1 Table 2: Global parameters α ∈ (1,∞) and µR ∈ (0, 1) and functions µH : R → [0, 1] and µF : R → [0, 1] used in the parallel algorithm. α, µR, and µH depend on n, the total number of vertices in the graph. We now discuss LocalPhase (i.e., Algorithm 4) in more detail. Table 2 introduces two parameters, α and µR, and two functions, µH and µF , which are used in LocalPhase. Note first that α is a parameter used in the definition of µH but it is not used in the pseudocode of LocalPhase (or EmulatePhase) for anything else. It is, however, a convenient abbreviation in the analysis and the later parallel algorithm. The other three mathematical objects specify probabilities with which vertices are included in sets that are created in an execution of LocalPhase. Apart from creating its own versions of H, the set of heavy vertices, and F , the set of friends, LocalPhase constructs also a set Ri, which we refer to as a reference set. In Line 1, the algorithm puts each vertex in Ri independently and with the same probability µR. The reference set is used to estimate the degrees of other vertices in the same induced subgraph in Line 2. For each vertex vi, its estimate bdv is defined as the number of v's neighbors in Ri multiplied by µ−1 R to compensate for sampling. Next, in Line 3, the algorithm uses the estimates to create Hi, the set of heavy vertices. Recall that GlobalAlg uses a sharp threshold for selecting heavy vertices: all vertices of degree at least ∆/2 are placed in Hi. LocalPhase works differently. It divides the degree estimate by the current threshold ∆⋆ and uses function µH to decide with what probability the corresponding vertex is included in Hi. A sketch of the function can be seen in Figure 1. The function transitions from almost 0 to almost 1 in the neighborhood of 1 2 at a limited pace. As a result vertices of degrees smaller than, say, 1 4 ∆ are very unlikely to be included in Hi and vertices of degree greater than 3 4 ∆ are very likely to be included in Hi. GlobalAlg can be seen as an algorithm that instead of µH , uses a step function that equals 0 for arguments less than 1 2 and abruptly jumps to 1 for larger arguments. Observe that without µH , the vertices whose degrees barely qualify them as heavy could behave very differently depending on which set they were assigned to. We use µH to guarantee a smooth behavior in such cases. That is one of the key ingredients that we need for making sure that a set of vertices that 14 Algorithm 4: LocalPhase(i, Gi, ∆⋆) Emulation of a single phase on an induced subgraph Input: • induced subgraph number i (useful only for the analysis) • induced subgraph Gi = (Vi, Ei) • threshold ∆⋆ ∈ R+ Output: Remaining vertices and a matching on Vi 1 Create a reference set Ri by independently selecting each vertex in Vi with probability µR. 2 For each v ∈ Vi, bdv ← N (v) ∩ Ri/µR. 3 Create a set Hi of heavy vertices by independently selecting each v ∈ Vi with probability µH(cid:16)bdv/∆⋆(cid:17). 4 Create a set Fi of friends by independently selecting each vertex in v ∈ Vi with probability 5 Compute a maximal matching Mi in G[Hi ∪ Fi]. 6 return (Vi \ (Ri ∪ Hi ∪ Fi), Mi) µF (N (v) ∩ Hi/∆⋆). remains on one machine after a phase has almost the same statistical properties as a set of vertices obtained by new random partitioning. Finally, in Line 4, LocalPhase creates a set of friends. This step is almost identical to what happens in the global algorithm. The only difference is that this time we have no upper bound on the number of heavy neighbors of a vertex. As a result that number divided by 4∆⋆ can be greater than 1, in which case we have to replace it with 1 in order to obtain a proper probability. This is taken care of by function µF . Once Hi and Fi have been created, the algorithm finds a maximal matching Mi in the subgraph induced by the union of these two sets. The algorithm discards from the further consideration not only Hi and Fi, but also Ri. This eliminates dependencies in the possible distribution of assignments of vertices that have not been removed yet if we condition this distribution on the configuration of sets that have been removed. Intuitively, the probability of a vertex's inclusion in any of these sets depends only on Ri and Hi but not on any other vertices. Hence, once we fix the sets of removed vertices, the assignment of the remaining vertices to subgraphs is fully independent.2 The output of LocalPhase is a subset of Vi to be considered in later phases and a matching Mi, which is used to expand the matching that we construct for the entire input graph. We now introduce additional concepts and notation. They are useful for describing and analyzing properties of the algorithm. A configuration describes sets Ri, Hi, and Fi, for 1 ≤ i ≤ m, constructed in an execution of EmulatePhase. We use it for conditioning a distribution of vertex assignments as described in the previous paragraph. We also formally define two important properties of distributions of vertex assignments: independence and near uniformity. Configurations. Let m and V⋆ be the parameters to EmulatePhase: the number of subgraphs and the set of vertices in the graph to be partitioned, respectively. We say that C =(cid:0){Ri}i∈[m],{Hi}i∈[m],{Fi}i∈[m](cid:1) is an m-configuration if it represents a configuration of sets Ri, Hi, and Fi created by EmulatePhase in the simulation of a phase. Recall that for any i ∈ [m], Ri, Hi, and Fi are the sets created (and removed) by 2By way of comparison, consider observing an experiment in which we toss the same coin twice. The bias of the coin is not fixed but comes from a random distribution. If we do not know the bias, the outcomes of the coin tosses are not independent. However, if we do know the bias, the outcomes are independent, even though they have the same bias. 15 the execution of LocalPhase for Vi, the i-th subset of vertices. We say that a vertex v is fixed by C if it belongs to one of the sets in the configuration, i.e., v ∈ [i∈[m] (Ri ∪ Hi ∪ Fi) . Conditional distribution. Let D be a distribution on assignments ϕ : V⋆ → [m]. Suppose that we execute EmulatePhase for D and let C be a non-zero probability m-configuration-composed of sets Ri, Hi, and Fi for i ∈ [m]-that can be created in this setting. Let V ′ ⋆ be the set of vertices in V⋆ that are not fixed by C. We write D[C] to denote the conditional distribution of possible assignments of vertices in V ′ ⋆ to [m], given that for all i ∈ [m], Ri, Hi, and Fi in C were the sets constructed by LocalPhase for the i-th induced subgraph. Near uniformity and independence. Let D be a distribution on assignments ϕ : eV → [m] for some set eV and m. For each vertex v ∈ eV , let pv : [m] → [0, 1] be the probability mass function of the marginal distribution of v's assignment. For any ǫ ≥ 0, we say that D is ǫ-near uniform if for every vertex v and every i ∈ [m], pv(i) ∈J(1 ± ǫ)/mK. We say that D is an independent distribution if the probability of every assignment ϕ in D equals exactlyQv∈V ′ pv(ϕ(v)). Concentration inequality. We use the following version of the Chernoff bound that depends on an upper bound on the expectation of the underlying independent random variables. It can be shown by combining two applications of the more standard version. Lemma 4.1 (Chernoff bound). Let X1, . . . , Xk be independently distributed random variables taking values in [0, 1]. Let X def= X1 +··· + Xk and let U ≥ 0 be an upper bound on the expectation of X, i.e., E[X] ≤ U . For any δ ∈ [0, 1], Pr(X − E[X] > δU ) ≤ 2 exp(−δ2U/3). Concise range notation. Multiple times throughout a paper, we want to denote a range around some value. Instead of writing, say, [x − δ, x + δ], we introduce a more concise notation. In this specific case, we would simply write Jx ± δK. More formally, let E be a numerical expression that apart from standard operations also contains a single application of the binary or unary operator ±. We create two standard numerical expressions from E: E− and E+ that replace ± with − and +, respectively. Now we define JEK def= [min{E−, E+}, max{E−, E+}]. As another example, consider E = √101 ± 20. We have E− = √101 − 20 = 9 and E+ = √101 + 20 = 11. Henceq√101 ± 20y = [min{9, 11}, max{9, 11}] = [9, 11]. We now show the properties of EmulatePhase that we use to obtain our final parallel algorithm. 4.1 Outline of the section We start by showing that EmulatePhase computes a large matching as follows. Each vertex belong- ing to Hi or Fi that EmulatePhase removes in the calls to LocalPhase can decrease the maximum matching size in the graph induced by the remaining vertices by one. We show that the matching that EmulatePhase constructs in the process captures on average at least a constant fraction of that loss. We also show that the effect of removing Ri is negligible. More precisely, in Section 4.2 we prove the following lemma. 16 Lemma 4.2. Let ∆, G⋆ = (V⋆, E⋆), m, and D be parameters for EmulatePhase such that • D is an independent and ǫ-near uniform distribution on assignments of vertices V⋆ to [m] for ǫ ∈ [0, 1/200], m ≥ 4000µ−2 R ln2 n, • ∆ • the maximum degree of a vertex in G⋆ is at most 3 2 ∆. For each i ∈ [m], let Hi, Fi, and Mi be the sets constructed by LocalPhase for the i-th induced subgraph. Then, the following relationship holds for their expected sizes: Xi∈[m] E [Hi ∪ Fi] ≤ n−9 + 1200 Xi∈[m] E [Mi] . Note that Lemma 4.2 requires that the vertices are distributed independently and near uniformly in the m sets. This is trivially the case right after the vertices are partitioned independently at random. However, in the final algorithm, after we partition the vertices, we run multiple phases on each machine. In the rest of this section we show that running a single phase preserves independence of vertex distribution and only slightly disturbs the uniformity (Lemma 4.3 and Lemma 4.4). As we have mentioned before, independence stems from the fact that we use reference sets to estimate vertex degrees. We discard them at the end and condition on them, which leads to the independence of the distribution of vertices that are not removed. Lemma 4.3. Let D be an independent distribution of assignments of vertices in V⋆ to [m]. Let C be a non- zero probability m-configuration that can be constructed by EmulatePhase for D. Let V ′ ⋆ be the set of vertices of V⋆ that are not fixed by C. Then D[C] is an independent distribution of vertices in V ′ ⋆ on [m]. Independence of the vertex assignment is a very handy feature that allows us to use Chernoff-like con- centration inequalities in the analysis of multiple phase emulation. However, although the vertex assignment of non-removed vertices remains independent across machines from phase to phase, as stated by Lemma 4.3, their distribution is not necessarily uniform. Fortunately, we can show it is near uniform. The proof of near uniformity is the most involved proof in this paper. In a nutshell, the proof is structured as follows. We pick an arbitrary vertex v that has not been removed and show that with high probability it has the same number of neighbors in all sets Ri. The same property holds for v's neighbors in all sets Hi. We use this to show that the probability of a fixed configuration of sets removed in a single phase is roughly the same for all assignments of v to subgraphs. In other words, if v was distributed nearly uniformly before the execution of EmulatePhase, it is distributed only slightly less uniformly after the execution. Lemma 4.4. Let ∆, G⋆ = (V⋆, E⋆), m, and D be parameters for EmulatePhase such that • D is an independent and ǫ-near uniform distribution on assignments of vertices V⋆ to [m] for ǫ ∈ [0, (200 ln n)−1], m ≥ 4000µ−2 • ∆ R ln2 n. Let C be an m-configuration constructed by EmulatePhase. With probability at least 1 − n−4 both the following properties hold: • The maximum degree in the graph induced by the vertices not fixed in C is bounded by 3 4 ∆. • D[C] is 60α(cid:16)(cid:0) ∆ m(cid:1)−1/4 + ǫ(cid:17)-near uniform. 17 4.2 Expected matching size Now we prove Lemma 4.2, i.e. we show that EmulatePhase computes a large matching. In the proof we argue that the expected total size of sets Hi and Fi is not significantly impacted by relatively low-degree vertices classified as heavy or by an unlucky assignment of vertices to subgraphs resulting in local vertex degrees not corresponding to global degrees. Namely, we show that the expected number of friends a heavy vertex adds is O(1) and at the same time the probability that the vertex gets matched is Ω(1). Lemma 4.2. Let ∆, G⋆ = (V⋆, E⋆), m, and D be parameters for EmulatePhase such that • D is an independent and ǫ-near uniform distribution on assignments of vertices V⋆ to [m] for ǫ ∈ [0, 1/200], m ≥ 4000µ−2 R ln2 n, • ∆ • the maximum degree of a vertex in G⋆ is at most 3 2 ∆. For each i ∈ [m], let Hi, Fi, and Mi be the sets constructed by LocalPhase for the i-th induced subgraph. Then, the following relationship holds for their expected sizes: Xi∈[m] E [Hi ∪ Fi] ≤ n−9 + 1200 Xi∈[m] E [Mi] . Proof. We borrow more notation from EmulatePhase and the m executions of LocalPhase initiated by it. For i ∈ [m], Vi is the set inducing the i-th subgraph. Value ∆⋆ = ∆ m is the rescaled threshold passed to the executions of LocalPhase. Ri is the reference set created by LocalPhase for the i-th induced subgraph. For each induced subgraph, LocalPhase computes a maximal matching Mi in Line 5. While such a matching is always large-its size is at least half the maximum matching size-it is hard to relate its size directly to the sizes of Hi and Fi. Therefore, we first analyze the size of a matching that would be created by MatchHeavy(G⋆[Hi ∪ Fi], Hi, Fi). We refer to this matching as fMi and we later use the inequality (cid:12)(cid:12)(cid:12)fMi(cid:12)(cid:12)(cid:12) ≤ 2Mi. We partition each Hi, i ∈ [m], into two sets: H ′ Si∈[m] Hi? Suppose that v ∈ Vk, where k ∈ [m]. The expected number of v's neighbors in Rk is at most (1 + ǫ) · µR · 1 independence, Lemma 4.1, and the lower bound on ∆⋆, we obtain the following bound: i is the subset of vertices in Hi of degree i. We start by bounding the expected 8 ∆ is included in 16 µR∆⋆ due to the independence and ǫ-near uniformity of D[C]. Using the i. What is the probability that a given vertex v of degree less than 1 less than 1 total size of sets H ′ i,t+1 is its complement, i.e., H ′′ i i . H ′ def= Hi \ H ′ 8 ∆/m ≤ 3 8 ∆ in G⋆. H ′′ i and H ′′ 1 1 4 3 ·(cid:18) 1 3(cid:19)2 µR∆⋆(cid:21) ≤ 2 exp − µR∆⋆! ≤ 2 exp (−27 ln n) = 2n−27. Pr(cid:20)µRbdv > 4 ∆⋆, the probability that v is selected to Hk is at most µH(bdv/∆⋆) ≤ µH(1/4) ≤ 1 E [H ′ If bdv ≤ 1 thatPi∈[m] We also partition the sets of friends, Fi for i ∈ [m], into two sets each: F ′ 2 n−12. Hence 2 n−12 ≤ n−12. This implies i and F ′′ i . This partition is based on the execution of MatchHeavy for the i-th subgraph. In Line 1, this algorithm selects for every v is selected to Hk-and therefore to H ′ i] ≤ n · n−12 = n−11. k-with probability at most 2n−27 + 1 3 16 · 18 i . Obviously, a heavy vertex in H ′ vertex v ∈ Fi a random heavy neighbor v⋆ ∈ Hi. If v⋆ ∈ H ′ we assign v to F ′′ inequality and the upper bound onPi∈[m] most n−11. Even if for all i ∈ [m], all vertices in Fi select a heavy neighbor in H ′ the total expected number of vertices in sets F ′ i, we assign v to F ′ i can be selected only if H ′ i . Analogously, if v⋆ ∈ H ′′ i , i is non-empty. By Markov's i is non-empty is at i whenever it is available, Before we proceed to bounding sizes of the remaining sets, we prove that with high probability, all vertices have a number of neighbors close to the expectation. Let ϕ : V⋆ → [m] be the assignment of vertices to subgraphs. We define E as the event that for all v ∈ V⋆, 1 i], the probability that at least one set H ′ E [H ′ Eh(cid:12)(cid:12)(cid:12)F ′ i,t+1(cid:12)(cid:12)(cid:12)i ≤ n · n−11 = n−10. i is at mostPi∈[m] m N (v) ∩ V⋆ −(cid:12)(cid:12)N (v) ∩ Vϕ(v)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ m N (v) ∩ V⋆ − E(cid:2)(cid:12)(cid:12)N (v) ∩ Vϕ(v)(cid:12)(cid:12)(cid:3)(cid:12)(cid:12)(cid:12)(cid:12) ≤ ǫ · ∆ m ≤ 3 400 2 + 3 1 16 (cid:12)(cid:12)(cid:12)(cid:12) ∆⋆. ∆⋆. 3 2 1 (cid:12)(cid:12)(cid:12)(cid:12) Consider first one fixed v ∈ V⋆. The degree of v in G⋆ is N (v) ∩ V⋆ ≤ 3 2 ∆. Due to the near-uniformity and independence, Lemma 4.1, and the lower bound on ∆⋆ (i.e., ∆⋆ = ∆ This in particular implies that E(cid:2)(cid:12)(cid:12)N (v) ∩ Vϕ(v)(cid:12)(cid:12)(cid:3) ≤(cid:0) 3 Pr(cid:20)(cid:12)(cid:12)E(cid:2)(cid:12)(cid:12)N (v) ∩ Vϕ(v)(cid:12)(cid:12)(cid:3) −(cid:12)(cid:12)N (v) ∩ Vϕ(v)(cid:12)(cid:12)(cid:12)(cid:12) > 1 20 m ≥ 4000µ−2 400(cid:1) ∆⋆ ≤ 2∆⋆. Using the independence of D, ∆⋆(cid:21) ≤ 2 exp − R ln2 n = 4 · 1015 · ln4 n), 3 ·(cid:18) 1 2(cid:19)2 ≤ 2 exp(cid:0)−(1012 + 3) ln n(cid:1) ≤ n−(1012+2) ≤ n−12. · 2∆⋆! 20 · 1 1 As a result, with this probability, we have 1 ∆⋆. (cid:12)(cid:12)(cid:12)(cid:12) 1 20 1 16 ∆⋆ + 3 400 ∆⋆ ≤ m N (v) ∩ V⋆ −(cid:12)(cid:12)N (v) ∩ Vϕ(v)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ By the union bound, this bound holds for all vertices in V⋆ simultaneously-and hence E occurs-with probability at least 1 − n · n−12 = 1 − n−11. i andPi∈[m] F ′′ If E does not occur, we can bound bothPi∈[m] H ′′ i by n. This contributes at most n−11·n = n−10 to the expected size of each of these quantities. Suppose now that E occurs. Consider an arbi- 16 ∆⋆(cid:3) ⊆ i for some i. The number of neighbors of v in Vi lies in the range(cid:2) 1 trary v ∈ H ′′ 16 ∆⋆, 2∆⋆(cid:3). Moreover, the expected number of vertices w ∈ F ′′ (cid:2) 1 that select v in w⋆ in Line 1 of i ] ≤ 1 2 . It follows that E [F ′′ MatchHeavy is bounded by 2∆⋆ · i ], given E. We now lower bound the expected size of fMi given E. What is the probability that some vertex w ∈ Fi selects v as w⋆ in MatchHeavy and (v, w) is added tofMi? This occurs if one of v's neighbors w is added to Fi and selects v as w⋆, and additionally, v and w are colored blue and red, respectively. The number of v's neighbors is at least 1 16 ∆⋆. Since each vertex w in Vi has at most 2∆⋆ neighbors, the number of heavy neighbors of w is bounded by the same number. This implies that in the process of selecting Fi, only the first branch in the definition of µF is used and each vertex w is included with probability exactly equal to the number of its neighbors in Hi divided by 4∆t+1. Then each heavy neighbor of w is selected as w⋆ with probability one over the number of heavy neighbors 8 ∆⋆ − 1 E [H ′′ 2 ∆⋆ + 1 16 ∆⋆, 3 = 1 4∆⋆ 1 2 i 19 of w. What this implies is that each neighbor w of v is selected for Fi and selects v as w⋆ with probability exactly (4∆⋆)−1. Hence the probability that v is not selected as w⋆ by any of its at least 1 16 ∆⋆ neighbors w can be bounded by 16 ∆⋆ (cid:18)1 − 1 4∆⋆(cid:19) 1 ≤ exp(cid:18)− 1 4∆⋆ · 1 16 ∆⋆(cid:19) = e−1/64. Therefore the probability that v is selected by some vertex w ∈ Fi as w⋆ is at least 1 − e−1/64 ≥ 1/100. Then with probability 1/4, these two vertices have appropriate colors and this or another edge incident to v with the same properties is added to fMi. In summary, the probability that an edge (v, w) for some w as described is added to fMi is at least 1/400. Since we do not count any edge in the matching twice for two heavy vertices, by the linearity of expectation Eh(cid:12)(cid:12)(cid:12)fMi(cid:12)(cid:12)(cid:12)i ≥ 1 E(cid:2)(cid:12)(cid:12)H ′′ i ] given E. Overall, given E, we have Xi∈[m] E [H ′′ 400 In general, without conditioning on E, We now combine bounds on all terms to finish the proof of the lemma. 3 Eh(cid:12)(cid:12)(cid:12)fMi(cid:12)(cid:12)(cid:12)i . 2 Xi∈[m] i(cid:12)(cid:12)(cid:3) ≤ 600 Xi∈[m] E(cid:2)(cid:12)(cid:12)H ′′ i(cid:12)(cid:12) +(cid:12)(cid:12)F ′′ i(cid:12)(cid:12)(cid:3) ≤ Eh(cid:12)(cid:12)(cid:12)fMi(cid:12)(cid:12)(cid:12)i . Xi∈[m] i(cid:12)(cid:12)(cid:3) ≤ 2 · n−10 + 600 Xi∈[m] E(cid:2)(cid:12)(cid:12)H ′′ i(cid:12)(cid:12) +(cid:12)(cid:12)F ′′ E [Hi ∪ Fi] ≤ Xi∈[m] i(cid:12)(cid:12) +(cid:12)(cid:12)H ′′ i(cid:12)(cid:12) +(cid:12)(cid:12)F ′ E(cid:2)(cid:12)(cid:12)H ′ i(cid:12)(cid:12) +(cid:12)(cid:12)F ′′ i(cid:12)(cid:12)(cid:3) Eh(cid:12)(cid:12)(cid:12)fMi(cid:12)(cid:12)(cid:12)i ≤ n−11 + n−10 + 2n−10 + 600 Xi∈[m] ≤ n−9 + 1200 Xi∈[m] E [Mi] . Xi∈[m] 4.3 Independence Next we prove Lemma 4.3. We start with an auxiliary lemma that gives a simple criterion under which an independent distribution remains independent after conditioning on a random event. Consider a random vector with independently distributed coordinates. Suppose that for any value of the vector, a random event E occurs when all coordinates "cooperate", where each coordinate cooperates independently with probabil- ity that depends only on the value of that coordinate. We then show that the distribution of the vector's coordinates given E remains independent. Lemma 4.5. Let k be a positive integer and A an arbitrary finite set. Let X = (X1, . . . , Xk) be a random vector in Ak with independently distributed coordinates. Let E be a random event of non-zero probability. If there exist functions pi : A → [0, 1], for i ∈ [k], such that for any x = (x1, . . . , xk) ∈ Ak appearing with non-zero probability, then the conditional distribution of coordinates in X given E is independent as well. Pr[EX = x] = pi(xi), kYi=1 20 Proof. Since the distribution of coordinates in X is independent, there are k probability mass functions p′ i(xi). The probability of E can be expressed as i : A → [0, 1], i ∈ [k], such that for every x = (x1, . . . , xk) ∈ Ak, Pr[X = x] = Qk i=1 p′ Pr[E] = Xx=(x1,...,xk)∈Ak = Xx=(x1,...,xk)∈Ak Pr[E ∧ X = x] = Xx=(x1,...,xk)∈Ak kYi=1 kYi=1Xy∈A pi(xi)p′ i(xi) = Pr[X=x]>0 pi(y)p′ i(y). Pr[EX = x] · Pr[X = x] Note that since the probability of E is positive, each multiplicative termPy∈A pi(y)p′ i(y), i ∈ [k], in the above expression is positive. We can express the probability of any vector x = (x1, . . . , xk) ∈ Ak given E as follows: Pr[X = xE] = Pr[E ∧ X = x] = Pr[EX = x] · Pr[X = x] Pr[E] Pr[E] i=1 pi(xi)p′ i(xi) = Qk Qk i=1Py∈A pi(y)p′ kYi=1 i(xi)/Py∈A pi(y)p′ i(y) = pi(xi)p′ i(xi) . i(y) Py∈A pi(y)p′ i(y) for each i ∈ [k]. Each p′′ We define p′′ i : A → [0, 1] as p′′ probability mass function on A. As a result we have Pr[X = xE] =Qk i is a valid i (xi), which proves that the distribution of coordinates in X given E is still independent with each coordinate distributed according to its probability mass function p′′ i . i (x) def= pi(xi)p′ i=1 p′′ We now prove Lemma 4.3 by applying Lemma 4.5 thrice. We refer to functions pi, which describe the probability of each coordinate cooperating, as cooperation probability functions. Lemma 4.3. Let D be an independent distribution of assignments of vertices in V⋆ to [m]. Let C be a non- zero probability m-configuration that can be constructed by EmulatePhase for D. Let V ′ ⋆ be the set of vertices of V⋆ that are not fixed by C. Then D[C] is an independent distribution of vertices in V ′ ⋆ on [m]. Proof. C can be expressed as C =(cid:0){R⋆ i }i∈[m],{H ⋆ i }i∈[m],{F ⋆ i }i∈[m](cid:1) i , H ⋆ i , and F ⋆ for some subsets R⋆ i of V⋆, where i ∈ [m]. We write Φ to denote the random assignment of vertices to sets selected in Line 1 of EmulatePhase. Φ is a random variable distributed according to D. Let ER be the event that for all i ∈ [m], the reference set Ri generated for the i-th induced subgraph by LocalPhase equals exactly R⋆ i . A vertex v that is assigned to a set Vi is included in Ri with probability exactly µR, independently of other vertices. Hence once we fix an assignment ϕ : V⋆ → [m] of vertices to sets Vi, we can express the probability of ER as a product of probabilities that each vertex cooperates. More as follows. formally, Pr[ERΦ = ϕ] =Qv∈V⋆ qv(ϕ(v)) for cooperation probability functions qv : [m] → [0, 1] defined • If v ∈Si∈[m] R⋆ i , there is exactly one i ∈ [m] such that v ∈ R⋆ i . If v is not assigned to Vi, ER cannot occur. If it is, v cooperates with ER with probability exactly µR, i.e., the probability of the selection for Ri. For this kind of v, the cooperation probability function is qv(i) def=(µR if v ∈ R⋆ i , if v 6∈ R⋆ i . 0 21 • If v 6∈Si∈[m] R⋆ i , v cooperates with ER if it is not selected for Rϕ(v), independently of its assignment ϕ(v), which happens with probability exactly 1 − µR. Therefore, the cooperation probability can be defined as qv(i) def= 1 − µR for all i ∈ [m]. We invoke Lemma 4.5 to conclude that the conditional distribution of values of Φ given ER is independent as well. We now define an event EH that both ER occurs and for all i ∈ [m], Hi, the set of heavy vertices constructed for the i-th subgraph equals exactly H ⋆ i . We want to show that the conditional distribution of values of Φ given EH is independent. Note that if Φ is selected from the conditional distribution given ER (i.e., all sets Ri are as expected) and we fix the assignment φ : V⋆ → [m] of vertices to sets Vi, then each vertex v ∈ V⋆ is assigned to Hφ(v)-this the only set Hi to which it can be assigned-independently of other vertices. As a result, we can express the probability of EH given ER and ϕ being the assignment as a q′ v(ϕ(v)) for cooperation probability functions q′ v : [m] → [0, 1] defined as follows, where ∆⋆ is the threshold used in the m executions of LocalPhase. product of cooperation probabilities for each vertex. More precisely, Pr[EHΦ = ϕ,ER] =Qv∈V⋆ • If v ∈ Si∈[m] H ⋆ i . EH can only occur if v is in- cluded in the corresponding Hi. This cannot happen if v is not assigned to the corresponding Vi by ϕ. If v is assigned to this Vi, it has to be selected for Hi, which happens with probability µH (N (v) ∩ R⋆ i /(µR∆⋆)). The cooperation probability function can be written in this case as i , then there is exactly one i such that v ∈ H ⋆ v(i) def=(µH(N (v) ∩ R⋆ 0 q′ i /(µR∆⋆)) if v ∈ H ⋆ i , if v 6∈ H ⋆ i . • If v 6∈Si∈[m] H ⋆ EH to occur. This happens with probability 1 − µH(N (v) ∩ R⋆ v(i) def= 1 − µH(N (v) ∩ R⋆ q′ i , v cannot be included in Hi corresponding to the set Vi to which it is assigned for i /(µR∆⋆)). Hence, we can define i /(µR∆⋆)) for all i ∈ [m]. We can now invoke Lemma 4.5 to conclude that the distribution of values of Φ given EH is independent. Finally, we define EF to be the event that both EH occurs and for each i ∈ [m], Fi, the set of friends selected for the i-th induced subgraph, equals exactly F ⋆ i . We observe that once Φ is fixed to a specific assignment ϕ : V⋆ → [m] and EH occurs (i.e., all sets Ri and Hi are as in C), then each vertex is indepen- dently included in Fϕ(v) with some specific probability that depends only on Hϕ(v), which is already fixed. In this setting, we can therefore express the probability of EF , which exactly specifies the composition of sets Fi, as a product of values provided by some cooperation probability functions q′′ v : [m] → [0, 1]. More v (ϕ(v)) for q′′ q′′ v that we define next. i , then there is exactly one i such that v ∈ F ⋆ i . EF cannot occur if v is not assigned to precisely, Pr[EFΦ = ϕ,EH ] =Qv∈V⋆ • If v ∈Si∈[m] F ⋆ Vi and selected for Fi. Hence, the cooperation probability function for v is if v ∈ F ⋆ i , if v 6∈ F ⋆ i . v (i) def=(µF (N (v) ∩ H ⋆ i /∆⋆) q′′ 0 • If v 6∈Si∈[m] F ⋆ EF to occur. Hence, q′′ v (i) def= 1 − µF (N (v) ∩ H ⋆ i⋆,t/∆t). i , to whichever set Vi vertex v is assigned, it should not be included in Fi in order for We invoke Lemma 4.5 to conclude that the distribution of values of Φ given EF is independent as well. This is a distribution on assignments for the entire set V⋆. If we restrict it to assignments of V ′ ⋆ ⊆ V⋆, we obtain a distribution that first, is independent as well, and second, equals exactly D[C]. 22 4.4 Near Uniformity In this section we prove Lemma 4.4. We begin by showing a useful property of µH (see Table 2 for defini- tion). Recall that GlobalAlg selects H, the set of heavy vertices, by taking all vertices of degree at least ∆/2. In LocalPhase the degree estimate of each vertex depends on the number of neighbors in the refer- ence set in the vertex's induced subgraph. We want the decision taken for each vertex to be approximately the same, independently of which subgraph it is assigned to. Therefore, we use µH-which specifies the probability of the inclusion in the set of heavy vertices-which is relatively insensitive to small argument changes. The next lemma proves that this is indeed the case. Small additive changes to the parameter x to µH have small multiplicative impact on both µH(x) and 1 − µH(x). Lemma 4.6 (Insensitivity of µH ). Let δ ∈ [0, (α/2)−1] = [0, (48 ln n)−1]. For any pair x and x′ of real numbers such that x − x′ ≤ δ, and Proof. We define an auxiliary function f : R → [0, 1]: µH(x′) ∈JµH(x)(1 ± αδ)K 1 − µH(x′) ∈J(1 − µH(x))(1 ± αδ)K . f (r) def=( 1 2 exp(cid:0) α 2 r(cid:1) if r ≤ 0, 2 exp(cid:0)− α 2 r(cid:1) 1 − 1 if r > 0. It is easy to verify that for all r ∈ R, µH(r) = f (r − 1/2) and 1 − µH(r) = f (−(r − 1/2)). Therefore, in order to prove the lemma, it suffices to prove that for any r and r′ such that r − r′ ≤ δ, f (r)(1 − αδ) ≤ f (r′) ≤ f (r)(1 + αδ), (1) i.e., a small additive change to the argument of f has a limited multiplicative impact on the value of f . Note that f is differentiable in both (−∞, 0) and (0,∞). Additionally, it is continuous in the entire range-the left and right branch of the function meet at 0-and both the left and right derivatives at 0 are equal. This implies that it is differentiable at 0 as well. Its derivative is f ′(r) =( α α 2 r(cid:1) 4 · exp(cid:0) α 4 · exp(cid:0)− α 2 r(cid:1) if r ≤ 0, if r > 0, which is positive for all r, and therefore, f is strictly increasing. Note that f ′ is increasing in (−∞, 0] and decreasing in [0,∞). Hence the global maximum of f ′ equals f ′(0) = α/4. In order to prove Inequality 1 for all r and r′ such that r − r′ ≤ δ, we consider two cases. Suppose first that r ≥ 0. By the upper bound on the derivative of f , f (r) − α 4 · r − r′ ≤ f (r′) ≤ f (r) + α 4 · r − r′. Since r ≥ 0, f (r) ≥ 1/2. This leads to α 2 · r − r′ ≤ f (r′) ≤ f (r) + f (r) · f (r) − f (r) · α 2 · r − r′. By the bound on r − r′, f (r)(1 − αδ) ≤ f (r′) ≤ f (r)(1 + αδ), 23 Suppose now that r < 0. Since f is increasing, it suffices to bound the value of f from below at r − δ which finishes the proof in the first case. and from above and at r + δ. For r − δ, we obtain f (r − δ) = 1 2 exp(cid:16) α ≥ f (r)(cid:16)1 − 2 α 2 For r + δ, let us first define a function g : R → R as 1 2 g(y) def= α 2 δ(cid:17) (r − δ)(cid:17) = f (r) exp(cid:16)− δ(cid:17) ≥ f (r)(1 − αδ). exp(cid:16) α (r + δ)(cid:17) = f (r) · exp(cid:16) α y(cid:17) . 2 1 2 exp(cid:16) α 2 For y ≤ 0, f (y) = g(y). For y > 0, g′(y) ≥ f ′(y) and hence, for any y ∈ R, g(y) ≥ f (y). As a result, we obtain f (r + δ) ≤ g(r + δ) = By the bound on δ in the lemma statement, α 2 δ ≤ 1. It follows from the convexity of the exponential function that for any y ∈ [0, 1], exp(y) ≤ y · exp(1) + (1 − y) · exp(0) ≤ 3y + (1 − y) = 1 + 2y. Continuing the reasoning, 2 δ(cid:17) . which finishes the proof of Inequality (1). f (r + δ) ≤ f (r) ·(cid:16)1 + 2 · α 2 δ(cid:17) = f (r)(1 + αδ), The main result of this section is Lemma 4.4 that states that if a distribution D of vertex assignments is near uniform, then EmulatePhase constructs a configuration C such that D[C] is near uniform as well, and also, the maximum degree in the graph induced by the vertices not removed by EmulatePhase is bounded. Lemma 4.4. Let ∆, G⋆ = (V⋆, E⋆), m, and D be parameters for EmulatePhase such that • D is an independent and ǫ-near uniform distribution on assignments of vertices V⋆ to [m] for ǫ ∈ [0, (200 ln n)−1], m ≥ 4000µ−2 • ∆ R ln2 n. Let C be an m-configuration constructed by EmulatePhase. With probability at least 1 − n−4 both the following properties hold: • The maximum degree in the graph induced by the vertices not fixed in C is bounded by 3 4 ∆. • D[C] is 60α(cid:16)(cid:0) ∆ m(cid:1)−1/4 + ǫ(cid:17)-near uniform. Proof overview (of Lemma 4.4). This is the most intricate proof of the entire paper. We therefore provide a short overview. First, we list again the variables in EmulatePhase and LocalPhase to which we refer in the proof and define additional convenient symbols. Then we introduce five simple random events (Events 1–5) that capture properties needed to prove Lemma 4.4. In Claim 4.7, we show that the proba- bility of all these events occurring simultaneously is high. The proof of the claim follows mostly from a repetitive application of the Chernoff bound. In the next claim, Claim 4.8, we show that the occurrence of 24 all the events has a few helpful consequences. First, high degree vertices get removed in the execution of EmulatePhase (which is one of our final desired properties). Second, each vertex v that is not fixed in C has a very similar number of neighbors in all sets Ri and it has a very similar number of neighbors in all sets Hi. In the final proof of Lemma 4.4, we use the fact that this implies that to whichever set Vi vertex v was assigned in EmulatePhase, the probability of its removal in EmulatePhase was more or less the same. This leads to the conclusion that if v was distributed nearly uniformly in D, it is distributed only slightly less uniformly in D[C]. Notation. To simplify the presentation, for the rest of Section 4.4, we assume that ∆, G⋆ = (V⋆, E⋆), m, and D are the parameters to EmulatePhase as in the statement of Lemma 4.4. Additionally, for each i ∈ [m], Ri, Hi, and Fi are the sets constructed by LocalPhase for the i-th subgraph in the ex- ecution of EmulatePhase. We also write C to denote the corresponding m-configuration, i.e., C = subgraph to which it was assigned. This estimate is computed in Line 2 of LocalPhase. We also use ∆⋆ to denote the rescaled threshold passed in all calls to LocalPhase, i.e., ∆⋆ = ∆ m . (cid:0){Ri}i∈[m],{Hi}i∈[m],{Fi}i∈[m](cid:1). Furthermore, for each v ∈ V⋆, bdv is the estimate of v's degree in the We also introduce additional notation, not present in EmulatePhase or LocalPhase. For each def= N (v) ∩ V⋆, i.e., dv is the degree of v in G⋆. For each vertex v ∈ V⋆, we also introduce a v ∈ V⋆, dv def= µH(dv/∆), which can be seen as a very rough approximation of v's probability notion of its weight: wv of being selected for the set of heavy vertices. For any v ∈ V⋆ and U ⊆ V⋆, we also introduce notation for the total weight of v's neighbors in U : Wv(U ) def= Xu∈N (v)∩U wu. Finally, for all i ∈ [m] and v ∈ V⋆, we also introduce a slightly less intuitive notion of the expected number of heavy neighbors of v in the i-th subgraph after the degree estimates are fixed in Line 2 of LocalPhase and before vertices are assigned to the heavy set in Line 3: hv,i def= Xu∈N (v)∩Vi Obviously, each hv,i is a random variable. µH(cid:16)bdu/∆⋆(cid:17) . Convenient random events. We now list five random events that we hope all to occur simultaneously with high probability. The first event intuitively is the event that high-degree vertices are likely to be included in the set of heavy vertices in Line 3 of LocalPhase. Event 1 For each vertex v ∈ V⋆ such that dv ≥ 3 µH(cid:16)bdv/∆⋆(cid:17) ≥ 1 − Another way to define this event would be to state that bdv for such vertices v is high, but this form is more suitable for our applications later. The next event is the event that all such vertices are in fact classified as 4 ∆, 1 2 n−6. 25 heavy. Each vertex v ∈ V⋆ such that dv ≥ 3 Event 2 4 ∆ belongs toSi∈[m] Hi. The next event is the event that low-degree vertices have a number of neighbors in each set Ri close to the mean. This implies that if we were able to move a low-degree vertex v to Vi, for any i ∈ [m], its estimated degree bdv would not change significantly. Event 3 For each vertex v ∈ V⋆ such that dv < 3 4 ∆ and each i ∈ [m], 1 µR N (v) ∩ Ri − (cid:12)(cid:12)(cid:12)(cid:12) ⋆ + ǫ∆⋆. 3 4 dv m(cid:12)(cid:12)(cid:12)(cid:12) ≤ ∆3/4 As a reminder, we use Wv(U ) to denote the expected number of vertices in N (v) ∩ U that are selected as heavy, where every vertex u is selected with respect to its global degree du. The next event shows that Wv(Vi) does not deviate much from its mean. Event 4 For each vertex v ∈ V⋆ such that dv < 3 4 ∆ and each i ∈ [m], Wv(Vi) − Wv(V⋆)/m ≤ ∆3/4 ⋆ + 3 4 ǫ∆⋆. Recall that hv,i intuitively expresses the expected number of v's neighbors in the i-th induced subgraph at some specific stage in the execution of LocalPhase for the i-th induced subgraph. The final event is the event that for all bounded hv,i, the actual number of v's neighbors in Hi does not deviate significantly from hv,i. Event 5 For each vertex v ∈ V⋆ and each i ∈ [m], if hv,i ≤ 2∆⋆, then N (v) ∩ Hi − hv,i ≤ ∆3/4 ⋆ . High probability of the random events. We now show that the probability of all the events occurring is high. The proof follows mostly via elementary applications of the Chernoff bound. Claim 4.7. If ǫ ∈ [0, 1/100] and ∆ ity at least 1 − n−4. m ≥ 4000µ−2 R ln2 n, then Events 1–5 occur simultaneously with probabil- R ln2 n = 4 · 1015 · ln4 n. In the proof of the lemma, we extensively use the fact that ∆⋆ = ∆ Proof. We consider all events in order and later show by the union bound that all of them hold simulta- m ≥ neously with high probability. 4000µ−2 First, we consider Event 1 and Event 2, which we handle together. Consider a vertex v such that dv ≥ 4 ∆. Let i⋆ be the index of the set to which it is assigned. Since D is ǫ-near uniform, the expectation of N (v) ∩ Ri⋆, the number of v's neighbors in Ri⋆, is at least (1 − ǫ) 3 400 µR∆⋆. Since vertices are both assigned to machines independently and included in the reference set independently as well, we can 4 µR ∆ m ≥ 297 3 26 · 1 1 405 297 400 8 µR∆⋆ is at most 10 · 297 2 exp − apply Lemma 4.1 to bound the deviation with high probability. The probability that the number of neighbors is smaller than 9 400 µR∆⋆ ≥ 5 3 ·(cid:18) 1 10(cid:19)2 Hence with probability at least 1 − 1 v is not included in the set of heavy vertices in Line 3 of LocalPhase with probability at most 1 µR∆⋆(cid:19) ≤ 2n−9 ≤ 8 ∆⋆ and µH(cid:16)bdv/∆⋆(cid:17) ≥ 1 − 1 µR∆⋆! ≤ 2 exp(cid:18)− 2 n−6, bdv ≥ 5 Therefore, v has the desired value of µH(cid:16)bdv/∆⋆(cid:17) and belongs to Hi⋆ with probability at least 1 − n−6. By the union bound, this occurs for all high degree vertices with probability at least 1− n−5, in which case both We now show that Event 3 occurs with high probability. Let v be an arbitrary vertex such that dv < 3 4 ∆ def= N (v) ∩ Ri. Xv,i is a random variable. Since D is ǫ-near uniform, E [Xv,i] ∈ and let i ∈ [m]. Let Xv,i J(1 ± ǫ)µRdv/mK. In particular, due to the bounds on dv and ǫ, E[Xv,i] ≤ µR∆⋆. Due to the independence, we can use Lemma 4.1 to bound the deviation of Xv,i from its expectation. We have 2 n−6. If this is the case, 2 n−6. Event 1 and Event 2 occur. n−6. 1 2 Pr(cid:16)Xv,i − E[Xv,i] > µR∆3/4 1 1 3 ∆1/4 µR∆1/2 3 · 1 ⋆ (cid:17) ≤ 2 exp− · µR∆⋆ ⋆ !2 ⋆ (cid:19) ≤ 2n−21. = 2 exp(cid:18)− m(cid:12)(cid:12)(cid:12)(cid:12) ≤ µR∆3/4 m(cid:12)(cid:12)(cid:12)(cid:12) ≤ Xv,i − E[Xv,i] +(cid:12)(cid:12)(cid:12)(cid:12)E[Xv,i] − µR m(cid:12)(cid:12)(cid:12)(cid:12) ≤ ∆3/4 1 µR N (v) ∩ Ri − m(cid:12)(cid:12)(cid:12)(cid:12) =(cid:12)(cid:12)(cid:12)(cid:12) ≤ µR∆3/4 ⋆ + ǫµR ǫµR∆⋆. ⋆ + ⋆ + ǫ∆⋆. 3 4 3 4 dv dv dv dv (cid:12)(cid:12)(cid:12)(cid:12)Xv,i − µR (cid:12)(cid:12)(cid:12)(cid:12) Xv,i µR − dv m We now move on to Event 4. Consider a vertex v such that dv < 3 By the union bound, this holds for all v and i of interest-and therefore, Event 3 occurs-with probability at least 1 − V⋆ · m · 2n−21 ≥ 1 − n−5. 4 ∆ and i ∈ [m]. Note that since the weight of every vertex is at most 1, Wv(V⋆)/m ≤ dv/m < 3 4 ∆⋆. Since D[C] is ǫ-near uniform, E [Wv(Vi)] ∈ J(1 ± ǫ)Wv(V⋆)/mK. In particular, E [Wv(Vi)] ≤ 101 4 ∆⋆ ≤ ∆⋆. Since vertices are assigned to machines independently, we can apply Lemma 4.1 to bound the deviation of Wv(Vi) from the expectation: ⋆ (cid:17) ≤ 2 exp− = 2 exp(cid:18)− · ∆⋆ 3 · 1 ⋆ !2 ⋆ (cid:19) ≤ 2n−21. Pr(cid:16)Wv(Vi) − E [Wv(Vi)] > ∆3/4 100 Wv(V⋆)/m ≤ 101 100 · 3 ∆1/4 ∆1/2 1 3 1 27 Hence with probability 1 − 2n−21, we have By dividing both sides by µR, we obtain the desired bound As a result, with probability at least 1 − 2n−21, Wv(Vi) − Wv(V⋆)/m ≤ Wv(Vi) − E [Wv(Vi)] + E [Wv(Vi)] − Wv(V⋆)/m 3 4 ⋆ + ǫWv(V⋆)/m ≤ ∆3/4 ⋆ + ǫdv/m ≤ ∆3/4 ≤ ∆3/4 ⋆ + ǫ∆⋆. By the union bound, this holds for all v and i of interest-and therefore, Event 4 occurs-with probability at least 1 − V⋆ · m · 2n−21 ≥ 1 − n−5. To show that Event 5 occurs with high probability, recall first that hv,i is the expected number of v's neighbors to be added in Line 3 to Hi in the execution of LocalPhase for the i-th subgraph. Note that the decision of adding a vertex to Hi is made independently for each neighbor of v. Fix a v ∈ V⋆ and i ∈ [m] such that hv,i ≤ 2∆⋆. We apply Lemma 4.1 to bound the probability of a large deviation from the expectation: Pr(cid:16)N (v) ∩ Hi − hv,i > ∆3/4 ⋆ (cid:17) ≤ 2 exp− = 2 exp(cid:18)− 1 6 1 2∆1/4 · 2∆⋆ ⋆ !2 3 · 1 ⋆ (cid:19) ≤ 2n−10. ∆1/2 By the union bound the probability that this bound does not hold for some v and i such that hv,i ≤ 2∆⋆ is by the union bound at most V⋆· m· 2n−10 ≤ n−5. Hence, Event 5 occurs with probability at least 1− n−5. In summary, Events 1–5 occur simultaneously with probability at least 1− 4· n−5 ≥ 1− n−4 by another application of the union bound. Consequences of the random events. We now show that if all the random events occur, then a few helpful properties hold for every vertex v that is not fixed by the constructed configuration C. Namely, v's degree is at most 3 4 ∆, the number of v's neighbors is similar in all sets Ri is approximately the same, and the number of v's neighbors is similar in all sets Hi. Claim 4.8. If Events 1–5 occur for ǫ ∈ [0, (200 ln n)−1] and ∆ properties hold for every vertex v ∈ V⋆ that is not fixed by C: R ln2 n, then the following m ≥ 4000µ−2 1. dv < 3 4 ∆. 2. There exists χv such that for all i ∈ [m], ⋆ + ǫ∆⋆(cid:17)z . m ≥ 4000µ−2 28 3. There exists ψv ∈(cid:2)0, 3 ⋆ + 3 4 ǫ∆⋆(cid:19){ . N (v) ∩ Ri /µR ∈sχv ±(cid:18)∆3/4 4 ∆⋆(cid:3) such that for all i ∈ [m], N (v) ∩ Hi ∈rψv ± α(cid:16)∆3/4 R ln2 n = 4 · 1015 · ln4 n. To prove Proof. We use in the proof of the claim the fact that ∆⋆ = ∆ the lemma, we fix a vertex v that is not fixed by C. The first property is directly implied by Event 2. Suppose that dv ≥ 3 4 ∆. Then v is included in the Hi corresponding to the subgraph to which it has been assigned and v is fixed by C. We obtain a contradiction that implies that dv < 3 4 ∆. For the second property, we now know that dv < 3 4 ∆. The property follows then directly from Event 3 with χv def= dv/m. The last property requires a more complicated reasoning. We set ψv any i ∈ [m]. By Event 4, Wv(Vi) ∈sψv ±(cid:18)∆3/4 ⋆ + 3 4 ǫ∆⋆(cid:19){ . def= Wv(V⋆)/m < 3 4 ∆⋆. Consider (2) Consider now an arbitrary u ∈ V⋆. We bound the difference between wu = µH (du/∆), which can be seen as the ideal probability of the inclusion in the set of heavy vertices, and µH(cid:16)bdu/∆⋆(cid:17), the actual probability 4 ǫ(cid:17). We of this event in Line 3 of the appropriate execution of LocalPhase. Let δ⋆ consider two cases. def= α(cid:16)∆−1/4 + 3 ⋆ • If du < 3 4 ∆, by Event 3, the monotonicity of µH , and Lemma 4.6, µH(cid:16)bdu/∆⋆(cid:17) ∈sµH(cid:18)du ∆ ±(cid:18)∆−1/4 ⋆ + 3 4 ǫ(cid:19)(cid:19){ ⊆Jwu · (1 ± δ⋆)K . Note that Lemma 4.6 is applied properly because ∆−1/4 (48 ln n)−1. ⋆ • If du ≥ 3 (cid:2)1 − 1 which is the same bound as in the previous case. ⋆ 4 ∆, by Event 1, µH(cid:16)bdu/∆⋆(cid:17) ∈ (cid:2)1 − 1 2 n−12, 1(cid:3). Because ∆⋆ is relatively small, i.e., ∆⋆ ≤ n, µH(cid:16)bdu/∆⋆(cid:17) ∈rwu(cid:16)1 ± ∆−1/4 µH(cid:16)bdu/∆⋆(cid:17) ∈u hv,i = Xu∈N (v)∩Vi =JWv (Vi) · (1 ± δ⋆)K . + 3 4 ǫ ≤ (200 ln n)−1 + (200 ln n)−1 ≤ 2 n−6, 1(cid:3). Concurrently, wu ∈ [µH(3/4), 1] = (cid:17)z ⊆Jwu · (1 ± δ⋆)K , v(1 ± δ⋆) · Xu∈N (v)∩Vi wu} ~ (3) It follows from the bound that we just obtained and the definitions of Wv and hv,i that We now combine bounds (2) and (3): hv,i ∈(cid:20)ψv (1 − δ⋆) −(cid:18)∆3/4 ⊆sψv ±(cid:18)ψvδ⋆ +(cid:18)∆3/4 ⋆ + ⋆ + 3 4 ǫ∆⋆(cid:19) (1 + δ⋆) , ψv (1 + δ⋆) +(cid:18)∆3/4 ǫ∆⋆(cid:19) (1 + δ⋆)(cid:19){ . 3 4 ⋆ + 3 4 ǫ∆⋆(cid:19) (1 + δ⋆)(cid:21) Due to the lower bound on ∆⋆, we obtain δ⋆ ≤ α(cid:0)(200 ln n)−1 + (200 ln n)−1(cid:1) ≤ 1. This enables us to 29 simplify and further transform the bound on hv,i: ⋆ + hv,i ∈sψv ±(cid:18)ψvδ⋆ + 2(cid:18)∆3/4 ⊆sψv ±(cid:18) 3 ⊆sψv ± α(cid:18) 4 ⋆ + ǫ∆⋆(cid:19){ . α∆3/4 ∆3/4 ⋆ + 9 16 4 5 3 4 ǫ∆⋆(cid:19)(cid:19){ αǫ∆⋆ + 2∆3/4 ⋆ + 3 2 ǫ∆⋆(cid:19){ By applying the bound on ∆⋆ again, we obtain a bound on the magnitude of the second term in the above bound: α(cid:18) 4 5 ∆3/4 ⋆ + ǫ∆⋆(cid:19) = α(cid:18) 4 5 ∆−1/4 ⋆ + ǫ(cid:19) ∆⋆ ≤ 96 ln n(cid:18) 1 200 ln n + 1 200 ln n(cid:19) ∆⋆ ≤ ∆⋆. This implies that hv,i ≤ ψv+∆⋆ ≤ 2∆⋆. The condition in Event 5 holds, and therefore, N (v) ∩ Hi − hv,i ≤ ∆3/4 . We combine this with the bound on hv,i to obtain ⋆ N (v) ∩ Hi ∈sψv ±(cid:18)α 4 5 ∆3/4 ⋆ + αǫ∆⋆ + ∆3/4 ⋆ (cid:19){ ⊆rψv ± α(cid:16)∆3/4 ⋆ + ǫ∆⋆(cid:17)z . Wrapping up the proof of near uniformity. We now finally prove Lemma 4.4. Recall that it states that an ǫ-near uniform D is very likely to result in a near uniform D[C] with a slightly worse parameter and that all vertices not fixed by C have bounded degree. The proof combines the last two claims: Claim 4.7 and Claim 4.8. We learn that C, the m-configuration constructed in the process is very likely to have the properties listed in Claim 4.8. One of those properties is exactly the property that all vertices not fixed by C have bounded degree. Hence we have to prove only the near uniformity property. We accomplish this by observing that the probability of C equal to a specific m-configuration C⋆ with good properties-those in Claim 4.8-does not depend significantly on to which induced subgraph a given vertex v not fixed in C⋆ is assigned. This can be used to show that the conditional distribution of v given that C = C⋆ is near uniform as desired. ⋆ when EmulatePhase is run for D and has the properties specified by Claim 4.8. Consider an arbitrary + ǫ(cid:17)-near uniform for C with this set of properties. Proof of Lemma 4.4. By combining Claim 4.7 and Claim 4.8, we learn that with probability at least 1− n−4, all properties listed in the statement of Claim 4.8 hold for C, the configuration constructed by EmulatePhase. Since one of the properties is exactly the same as in the statement of Lemma 4.4, it suffices to prove the other one: that D[C] is 60α(cid:16)∆−1/4 Fix eC = (cid:16){eRi}i∈[m],{eHi}i∈[m],{eFi}i∈[m](cid:17) to be an m-configuration that has non-zero probability vertex v ∈ V⋆. In order to prove the near uniformity of DheCi, we show that v is assigned by it almost uniformly to [m]. Let E be the event that EmulatePhase constructs eC, i.e., C = eC. For each i ∈ [m], let E→i be the event that v is assigned to the i-th induced subgraph. Let p : [m] → [0, 1] be the probability mass function describing the probability of the assignment of v to each of the m subgraphs in D. Obviously, p(i) = Pr[E→i] for all i ∈ [m]. Due to the ǫ-near uniformity of D, p(i) =q 1 def= Pr[EE→i]. In order to express all qi's in a suitable form, we conduct a For each i ∈ [m], let qi thought experiment. Suppose v were not present in the graph, but the distribution of all the other vertices in m (1 ± ǫ)y. 30 does the probability of E change if we add v back and condition on its assignment to a machine i? Note first that conditioning on E→i does not impact the distribution of the other vertices, because vertices are assigned to machines independently in D. In order for E still to occur in this scenario, v cannot be assigned to any behavior of other vertices, which only depends on the content of these sets and independent randomized decisions to include vertices. As a result we can express qi as a product of q⋆ and three probabilities: of v the modified D remained the same. Let q⋆ be the probability of E, i.e., C = eC, in this modified scenario. How of eRi, eHi, or eFi, for which it is considered. Additionally, as long as this the case, v does not impact the not being included in sets eRi, eHi, or eFi. qi = q⋆ · (1 − µR) ·1 − µH (cid:12)(cid:12)(cid:12)N (v) ∩ eHi(cid:12)(cid:12)(cid:12)  . ∆⋆ ∆⋆ (4) Using the properties listed in Claim 4.8, we have (cid:12)(cid:12)(cid:12)N (v) ∩ eRi(cid:12)(cid:12)(cid:12) /µR (cid:12)(cid:12)(cid:12)N (v) ∩ eRi(cid:12)(cid:12)(cid:12) /µR ∈sχv ±(cid:18)∆3/4 (cid:12)(cid:12)(cid:12)N (v) ∩ eHi(cid:12)(cid:12)(cid:12) ∈rψv ± α(cid:16)∆3/4  ·1 − µF ǫ∆⋆(cid:19){ , ⋆ + ǫ∆⋆(cid:17)z , ⋆ + 3 4 and where χv and ψv are constants independent of machine i to which v has been assigned and ψ ≤ 3 4 ∆⋆. In the next step, we use these bounds to derive bounds on the multiplicative terms in Equation (4) that may depend on i. We also repeatedly use the bounds ∆⋆ = ∆ from the lemma statement. First, due to Lemma 4.6, m ≥ 4000µ−2 1 − µH (cid:12)(cid:12)(cid:12)N (v) ∩ eRi(cid:12)(cid:12)(cid:12) /µR ∆⋆ R ln2 n = 4 · 1015 · ln4 n and ǫ ≤ (200 ln n)−1 ǫ(cid:19)(cid:19){ ∆⋆ ±(cid:18)∆−1/4 ∆⋆(cid:19)(cid:19) ·(cid:18)1 ± α(cid:18)∆−1/4 ǫ(cid:19)(cid:19){ . 3 4 3 4 + + ⋆ ⋆  ∈s1 − µH(cid:18) χv ⊆s(cid:18)1 − µH(cid:18) χv (Note that the application of Lemma 4.6 was correct, because ∆−1/4 (96 ln n)−1.) Second, ⋆ + 3 4 ǫ ≤ (200 ln n)−1 + (200 ln n)−1 < Since ψv/∆⋆ ≤ 3 µF in the above bound is always less than 4, and therefore, only one branch of µF 's definitions gets applied. Hence, we can eliminate µF : ⋆ 1 − µF 4 and α(cid:16)∆−1/4 1 − µF ⋆ ∆⋆ + ǫ(cid:17)(cid:19){ . ∆⋆ ± α(cid:16)∆−1/4  ∈s1 − µF(cid:18) ψv (cid:12)(cid:12)(cid:12)N (v) ∩ eHi(cid:12)(cid:12)(cid:12) + ǫ(cid:17) ≤ (96 ln n) ·(cid:0)(200 ln n)−1 + (200 ln n)−1(cid:1) < 1, the argument to (cid:12)(cid:12)(cid:12)N (v) ∩ eHi(cid:12)(cid:12)(cid:12) 4(cid:16)∆−1/4 + ǫ(cid:17){ . ψv 4∆⋆ ± ∆⋆ α ⋆  ∈s1 − 31 Since 1 − ψv 4∆⋆ ≥ 3 4 , we can further transform the bound to α ψv ∆⋆ 4∆⋆(cid:19)(cid:16)1 ± (cid:12)(cid:12)(cid:12)N (v) ∩ eHi(cid:12)(cid:12)(cid:12) 1 − µF  ∈s(cid:18)1 − 4 ǫ(cid:17) and δ2 + ǫ(cid:17). As a result, every qi can be expressed as qi = ηvλiλ′ 3(cid:16)∆−1/4 i ∈J1 ± δ2K. For every i, we can also write Pr[E ∧ E→i] = Pr[EE→i] · Pr[E→i] = ηvλiλ′ 3(cid:16)∆−1/4 + ǫ(cid:17)(cid:17){ . i · p(i) = iλ′′ i , λiλ′ ηv m def= α + 3 ⋆ ⋆ i, where ηv is a constant independent of i, λi ∈J1 ± δ1K, and λ′ Let δ1 def= α(cid:16)∆−1/4 ⋆ where λ′′ D given E: i ∈J1 ± ǫK. We now express the conditional probability of v being assigned to the i-th subgraph in Note that for any i, this implies that Pr[E→iE] = Pr[E ∧ E→i] j=1 Pr[E ∧ E→j] = Pm λiλ′ iλ′′ i j=1 λjλ′ . jλ′′ j Pm 1 m · (1 − δ1)(1 − δ2)(1 − ǫ) (1 + δ1)(1 + δ2)(1 + ǫ) ≤ Pr[E→iE] ≤ 1 m · (1 + δ1)(1 + δ2)(1 + ǫ) (1 − δ1)(1 − δ2)(1 − ǫ) . (5) Observe that and δ1 ≤ (96 ln n) ·(cid:0)(7000 ln n)−1 + (250 ln n)−1(cid:1) < 1/2, 3 · (96 ln n) ·(cid:0)(7000 ln n)−1 + (200 ln n)−1(cid:1) < 1/2. 1 δ2 ≤ Hence all of δ1, δ2, and ǫ are at most 1/2. We can therefore transform (5) to 1 m · (1 − δ1)2(1 − δ2)2(1 − ǫ)2 ≤ Pr[E→iE] ≤ 1 m · (1 + δ1)(1 + δ2)(1 + ǫ)(1 + 2δ1)(1 + 2δ2)(1 + 2ǫ), and then Hence 1 m · (1 − 2δ1 − 2δ2 − 2ǫ) ≤ Pr[E→iE] ≤ 1 m · (1 + 45δ1 + 45δ2 + 45ǫ). Pr[E→iE] ∈s 1 m · (1 ± 45(δ1 + δ2 + ǫ)){ ⊆s 1 m ·(cid:16)1 ± 60α(cid:16)∆−1/4 ⋆ + ǫ(cid:17)(cid:17){ , which finishes the proof that DheCi is 60α(cid:16)∆−1/4 ⋆ 5 Parallel Algorithm + ǫ(cid:17)-near uniform. In this section, we introduce our main parallel algorithm. It builds on the ideas introduced in EmulatePhase. EmulatePhase randomly partitions the graph into m induced subgraphs and runs on each of them LocalPhase, which resembles a phase of GlobalAlg. As we have seen, the algorithm performs well even if vertices are assigned to subgraphs not exactly uniformly so long as the assignment is fully inde- pendent. Additionally, with high probability, if we condition on the configuration of sets Ri, Hi, and Fi 32 that were removed, the distribution of assignments of the remaining vertices is still nearly uniform and also independent. These properties allow for the main idea behind the final parallel algorithm. We partition vertices ran- domly into m induced subgraphs and then run LocalPhase multiple times on each of them with no repar- titioning in the meantime. In each iteration, for a given subgraph, we halve the local threshold ∆⋆. This corresponds to multiple phases of the original global algorithm. As long as we can show that this approach leads to finding a large matching, the obvious gain is that multiple phases of the original algorithm translate to O(1) parallel rounds. This approach enables our main result: the parallel round complexity reduction from O(log n) to O((log log n)2). Algorithm 5: ParallelAlg(G, S) The final parallel matching algorithm Input: • graph G = (V, E) on n vertices • parameter S ∈ Z+ such that S ≤ n and S = nΩ(1) (each machine uses O(S) space) Output: matching in G 1 ∆ ← n, V ′ ← V , M ← ∅ 2 while ∆ ≥ n S (200 ln n)32 do /* High-probability invariant: maximum degree in G[V ′] bounded by 3 2 ∆ */ 3 4 5 6 7 8 9 10 11 /* number of phases to emulate */ Partition V ′ into m sets V1, . . . , Vm by assigning each vertex independently uniformly at random. foreach i ∈ [m] do in parallel /* number of machines used */ m ←jq n∆ S k 16 log120α (∆/m)(cid:7) τ ←(cid:6) 1 for j ∈ [τ ] do (Vi, Mi,j) ← LocalPhase(cid:0)i, G[Vi], ∆/(cid:0)2j−1m(cid:1)(cid:1) V ′ ←Sm M ← M ∪Sm If the number of edges in G[Vi] is greater than 8S, Vi ← ∅. i=1Sτ ∆ ← ∆/2τ i=1 Vi j=1 Mi,j 12 Compute degrees of vertices V ′ in G[V ′] and remove from V ′ vertices of degree at least 2∆. 13 Directly simulate M ′ ← GlobalAlg(G[V ′], 2∆), using O(1) rounds per phase. 14 return M ∪ M ′ We present ParallelAlg, our parallel algorithm, as Algorithm 5. We write S to denote a parameter specifying the amount of space per machine. After the initialization of variables, the algorithm enters the main loop in Lines 2–11. The loop is executed as long as ∆, an approximate upper bound on the maximum degree in the remaining graph, is large enough. The loop implements the idea of running multiple iterations of LocalPhase on each induced subgraph in a random partition. At the beginning of the loop, the algorithm decides on m, the number of machines, and τ , the number of phases to be emulated. Then it creates a random partition of the current set of vertices that results in m induced subgraphs. Next for each subgraph, the algorithm first runs a security check that the set of edges fits onto a single machine (see Line 7). If it does not, which is highly unlikely, the entire subgraph is removed from the graph. Otherwise, the entire subgraph is sent to a single machine that runs τ consecutive iterations of LocalPhase. Then the vertices not removed in the executions of LocalPhase are collected for further computation and new matching edges are added to the matching being constructed. During the execution of the loop, the maximum degree in the graph induced by V ′, the set of vertices to be considered is bounded by 3 2 ∆ with high probability. Once 33 the loop finishes, we remove from the graph vertices of degree higher than 2∆-there should be none-and we directly simulate GlobalAlg on the remaining graph, using O(1) rounds per phase. 5.1 Some Properties of Thresholds Before we analyze the behavior of the algorithm, we observe that the value of ∆ m inside the main loop is at least polylogarithmic and that the same property holds for the rescaled threshold that is passed to LocalPhase. Lemma 5.1. Consider a single iteration of the main loop of ParallelAlg (Lines 2–11). Let ∆ and m be set as in this iteration. The following two properties hold: • ∆/m ≥ (200 log n)16. • The threshold ∆/(cid:0)2j−1m(cid:1) passed to LocalPhase in Line 8 is always at least (∆/m)15/16 ≥ R ln2 n. 4000µ−2 Proof. Let τ be also as in this iteration of the loop. The smallest threshold passed to LocalPhase is ∆/(2τ −1m). Let λ def= S∆/n, where S is the parameter to ParallelAlg. Due to the condition in √λ. This implies that Line 2, λ ≥ (200 ln n)32. Note that ∆ = λn/S. Hence m ≤ pn∆/S = n ∆/m ≥ √λ ≥ (200 ln n)16, which proves the first claim. Due to the definition of τ , S This implies that 2τ −1 ≤ (120α)τ −1 ≤ (∆/m)1/16. ∆/(2τ −1m) ≥ (∆/m)15/16 ≥ (200 ln n)15 > 4 · 1015 · ln4 n = 4000µ−2 R ln2 n. We also observe that the probability of any set of vertices deleted by the security check in Line 7 of ParallelAlg is low as long as the maximum degree in the graph induced by the remaining vertices is bounded. Lemma 5.2. Consider a single iteration of the main loop of ParallelAlg and let ∆ and V ′ be as in that iteration. If the maximum degree in G[V ′] is bounded by 3 2 ∆, then the probability of any subset of vertices deleted in Line 7 is n−8. Proof. Let m be as in the same iteration of the main loop of ParallelAlg. Consider a single vertex v ∈ V ′. The expected number of v's neighbors assigned to the same subgraph is at most 3 2 ∆/m. Recall that due to Lemma 5.1, ∆ m ≥ 200 ln n. Since the assignment of vertices to machines is fully independent, by Lemma 4.1 (i.e., the Chernoff bound), the probability that v has more than 2∆/m neighbors is bounded by 2 exp − 1 3 ·(cid:18) 1 3(cid:19)2 3 2 · · ∆ m! ≤ 2 exp(cid:18)− 1 18 · 200 ln n(cid:19) ≤ n−10. Therefore, by the union bound, with probability 1− n−9, no vertex has more than 2∆ neighbors in the same induced subgraph. As V ′ ≤ n, the expected number of vertices in each set Vi constructed in the iteration of the main loop is at most n/m ≥ ∆/m ≥ 200 ln n. What is the probability that Vi > 2n/m? By the independence of vertex assignments and Lemma 4.1, the probability of such event is at most 2 exp(cid:18)− 1 3 · n m(cid:19) ≤ 2 exp(cid:18)− 1 3 · 200 ln n(cid:19) ≤ n−10. 34 Again by the union bound, the event Vi ≤ 2n/m, for all i simultaneously, occurs with probability at least 1− n−9. Combining both bounds, with probability at least 1− 2n−9 ≥ 1− n−8, all induced subgraphs have at most 2n/m vertices and the degree of every vertex is bounded by 2∆/m. Hence the number of edges in 2 · 2n one induced subgraph is at most 1 m2 . By the definition of m and the setting of parameters 2q n∆ in the algorithm, m ≥ 1 S , where S is the parameter to ParallelAlg. This implies that the number of edges is at most 2n∆/(cid:18) 1 S (cid:19)2 2q n∆ = 8S in every induced subgraph with probability 1 − n−8, in which case no set Vi is deleted in Line 7 of ParallelAlg. m = 2n∆ m · 2∆ 5.2 Matching Size Analysis The parallel algorithm runs multiple iterations of LocalPhase on each induced subgraph, without reparti- tioning. A single iteration on all subgraphs corresponds to running EmulatePhase once. We now show that in most cases, the global algorithm simulates EmulatePhase on a well behaved distribution with in- dependently assigned vertices and all vertices distributed nearly uniformly conditioned on the configurations of the previously removed sets Ri, Hi, and Fi. We also show that the maximum degree in the remaining graph is likely to decrease gracefully during the process. Lemma 5.3. With probability at least 1 − n−3: • all parallel iterations of LocalPhase in ParallelAlg on each induced subgraph correspond to running EmulatePhase on independent and (200 ln n)−1-near uniform distributions of assign- ments, • the maximum degree of the graph induced by the remaining vertices after the k-th simulation of EmulatePhase is 3 2 ∆/2k. def= ∆/(cid:0)2j−1m(cid:1) be the threshold passed to LocalPhase Proof. We first consider a single iteration of the main loop in ParallelAlg. Let ∆, τ , and m be set as in this iteration of the loop. For j ∈ [τ ], let ∆j for the j-th iteration of LocalPhase on each of the induced subgraphs. The parallel algorithm assigns vertices to subgraphs and then iteratively runs LocalPhase on each of them. In this analysis we ignore the exact assignment of vertices to subgraphs until they get removed as a member of one of sets Ri, Hi, or Fi. Instead we look at the conditional distribution on assignments given the configurations of sets Ri, Hi, and Fi removed in the previous iterations corresponding to EmulatePhase. We write Dj, 1 ≤ j ≤ τ , to denote this distribution of assignments before the execution of j-th iteration of LocalPhase on the induced subgraphs, which corresponds to the j-th iteration of EmulatePhase for this iteration of the main loop of ParallelAlg. Additionally, we write Dτ +1 to denote the same distribution after the τ -th iteration, i.e., at the end of the execution of the parallel block in Lines 6–8 of ParallelAlg. Due to Lemma 4.3, the distributions of assignments are all independent. We define ǫj, j ∈ [τ + 1], to be the minimum positive value such that Dj is ǫj-near uniform. Obviously, ǫ1 = 0, since the first distribution corresponds to a perfectly uniform assignment. We want to apply Lemma 4.4 inductively to bound the value of ǫj+1 as a function of ǫj with high probability. The lemma lists two conditions: ǫj must be at most (200 ln n)−1 and the threshold passed to EmulatePhase has to be at least 4000µ−2 H ln2 n. The latter condition holds due to Lemma 5.1. Hence as long as ǫj is sufficiently small, Lemma 4.4 implies that with probability at least 1 − n−4, ǫj+1 ≤ 60α (cid:18) ∆ 2τ −1m(cid:19)−1/4 + ǫj! ≤ 60α (cid:18) ∆ m(cid:19)−15/64 + ǫj! , 35 and no high degree vertex survives in the remaining graph. One can easily show by induction that if this for all j ∈ [τ + 1]. In particular, by the definition of τ and Lemma 5.1, for any j ∈ [τ ], recursion is satisfied for all 1 ≤ j ≤ τ , then ǫj ≤ (120α)j−1 ·(cid:0) ∆ ·(cid:18) ∆ m(cid:19)−15/64 ǫj ≤ (120α)τ −1 ·(cid:18) ∆ m(cid:19)−15/64 m(cid:19)1/16 ≤(cid:18) ∆ m(cid:1)−15/64 ≤(cid:18) ∆ m(cid:19)−11/64 ≤ (200 ln n)−1, This implies that as long the unlikely events specified in Lemma 4.4 do not occur for any phase in any iteration of the main loop of ParallelAlg, we obtain the desired properties: all intermediate distributions of possible assignments are (200 ln n)−1-near uniform and the maximum degree in the graph decreases at the expected rate. It remains to bound the probability of those unlikely events occurring for any phase. By the union bound, their total probability is at most log n · n−4 ≤ n−3. We now prove that the algorithm finds a large matching with constant probability. Theorem 5.4. Let MOPT be an arbitrary maximum matching in a graph G. With Ω(1) probability, ParallelAlg constructs a matching of size Ω(MOPT). Proof. By combining Lemma 5.2 and Lemma 5.3, we learn that with probability at least 1−n·n−8−n−3 ≥ 1 − 2n−3, we obtain a few useful properties. First, all relevant distributions corresponding to iterations of EmulatePhase are independent and (200 ln n)−1-near uniform. Second, the maximum degree in the graph induced by vertices still under consideration is bounded by 3 2 ∆ before and after every simulated execution of EmulatePhase, where ∆ is the corresponding. As a result, no vertex is deleted in Lines 7 or 12 due to the security checks. We now use Lemma 4.2 to lower bound the expected size of the matching created in every EmulatePhase simulation. Let τ⋆ be the number of phases we simulate this way. We have τ⋆ ≤ log n. Let Hj , Fj, and Mj be random variables equal to the total size of sets Hi, Fi, and Mi created in the j-th phase. If the corre- sponding distribution in the j-th phase is near uniform and the maximum is bounded, Lemma 4.2 yields i.e., 1 E [Mj] ≥ E [Hj + Fj] ≤ n−9 + 1200 · E [Mj] , 1200(cid:0)E [Hj + Fj] − n−9(cid:1) . 1200(cid:0)E [Hj + Fj] − n−9(cid:1) − 2n−3 · 1 n 2 , Xj∈[τ⋆] E [Mj] ≥ Xj∈[τ⋆] Overall, without the assumption that the conditions of Lemma 4.2 are always met, we obtain a lower bound in which we consider the worst case scenario that we lose as much as n/2 edges in the size of the con- structed matching when the unlikely negative events happen. ParallelAlg continues the construction of a matching by directly simulating the global algorithm. Let τ ′ ⋆ be the number of phases in that part of the algorithm. We define H′ ⋆], to be random variables equal to the size of sets H, F , j, and M′ j, F′ and fM in GlobalAlg in the j-th phase of the simulation. By Lemma 3.3, we have j , for j ∈ [τ ′ E(cid:2)M′ j(cid:3) ≥ Xj∈[τ ′ ⋆] Xj∈[τ ′ ⋆] 36 1 50(cid:0)E(cid:2)H′ j + F′ j(cid:3)(cid:1) . By combining both bounds we obtain a lower bound on the size of the constructed matching. Let M⋆ def= Xj∈[τ⋆] E [Mj] + Xj∈[τ ′ ⋆] E(cid:2)M′ j(cid:3) be the expected matching size, and let V⋆ def= Xj∈[τ⋆] E [Hj + Fj] + Xj∈[τ ′ ⋆] j + F′ E(cid:2)H′ j(cid:3) . We have M⋆ ≥ 1 1200 V⋆ − 1 n2 . Consider a maximum matching MOPT. At the end of the algorithm, the graph is empty. The expected number of edges in MOPT incident to a vertex in one of the reference sets is bounded by MOPT · 2µR · log n ≤ 10−5MOPT. The expected number of edges removed by the security checks is bounded by n 2 ·n−3. Hence the expected number of edges in MOPT deleted as incident to vertices that are heavy or are friends is at least (1 − 10−5)MOPT − 1/(2n2). Since we can assume without the loss of generality that the graph is non-empty, it is at least 1 n2 . For sufficiently large n (say, n ≥ 50), M⋆ ≥ Ω (MOPT) and by an averaging argument, ParallelAlg has to output an O(1)-multiplicative approximation to the maximum matching with Ω(1) probability. For smaller n, it is not difficult to show that at least one edge is output by the algorithm with constant probability as long as it is not empty. 2MOPT. Hence V⋆ ≥ 1 2MOPT, and M⋆ ≥ 1 2400MOPT − 1 Finally, we want to argue that the above procedure can be used to compute 2 + ǫ approximation to maximum matching at the cost of increasing the running time by a factor of log(1/ǫ). The idea is to; execute algorithm ParallelAlg to compute constant approximate matching; remove this matching from the graph; and repeat. Corollary 5.5. Let MOPT be an arbitrary maximum matching in a graph G. For any ǫ > 0, executing ParallelAlg on G and removing a constructed matching repetitively, O(log(1/ǫ)) times, finds a multi- plicative (2 + ǫ)-approximation to maximum matching, with Ω(1) probability. Proof. Assume that the ParallelAlg succeeds with probability p and computes c-approximate matching. Observe that each successful execution of ParallelAlg finds a matching Mc of size at least 1 cMOPT. Removal of Mc from the graph decreases the size of optimal matching by at least 1 cMOPT and at most by 2 cMOPT, because each edge of Mc can be incident to at most two edges of MOPT. Hence, when the size of the remaining matching drops to at most ǫMOPT, we have an 2 + ǫ-multiplicative approximation to maximum matching constructed. The number t of successful applications of ParallelAlg need to satisfy. (cid:18)1 − 1 c(cid:19)t ≤ ǫ. This gives t = O(log(1/ǫ)). In ⌈t/p⌉ = O(log(1/ǫ)) executions, we have t successes with probability at least 1/2 by the properties of the median of the binomial distribution. 37 6 MPC Implementation Details In this section we present details of an MPC implementation of our algorithm. We also analyze its round and space complexity. In the description we heavily use some of the subroutines described in [GSZ11]. While the model used there is different, the properties of the distributed model used in [GSZ11] also hold in the MPC model. Thus, the results carry over to the MPC model. The results of [GSZ11] allow us to sort a set A of O(N ) key-value pairs of size O(1) and for every element of a sorted list, compute its index. Moreover, we can also do a parallel search: given a collection A of O(N ) key-value pairs and a collection of O(N ) queries, each containing a key of an element of A, we can annotate each query with the corresponding key-value pair from A. Note that multiple queries may ask for the same key, which is nontrivial to parallelize. If S = nΩ(1), all the above operations can be implemented in O(1) rounds. The search operation allows us to broadcast information from vertices to their incident edges. Namely, we can build a collection of key-value pairs, where each key is a vertex and the value is the corresponding information. Then, each edge {u, v} may issue two queries to obtain the information associated with u and v. 6.1 GlobalAlg We first show how to implement GlobalAlg, which is called in Line 13 of ParallelAlg. Lemma 6.1. Let S = nΩ(1). There exists an implementation of GlobalAlg in the MPC model, which with high probability executes O(lne∆) rounds and uses O(S) space per machine. Proof. We first describe how to solve the following subproblem. Given a set X of marked vertices, for each vertex v compute N (v) ∩ X. When all vertices are marked, this just computes the degree of every vertex. The subproblem can be solved as follows. Create a set AX = {(u, v) u ∈ V, v ∈ X,{u, v} ∈ E} ∪ {(v,−∞), (v,∞) v ∈ V }, and sort its elements lexicographically. Denote the sorted sequence by QX . Then, for each element of AX compute its index in QA. Note that N (v) ∩ X is equal to the number of elements in QX between (v,−∞) and (v,∞). Thus, having computed the indices of these two elements, we can compute N (v) ∩ X. Let us now describe how to implement GlobalAlg. We can compute the degrees of all vertices, as described above. Once we know the degrees, we can trivially mark the vertices in H. The next step is to compute F and for that we need to obtain N (v) ∩ H, which can be done as described above. After that, GlobalAlg computes a matching in G[H ∪ F ] by calling MatchHeavy (see Algorithm 2). In the first step, MatchHeavy assigns to every v ∈ F a random neighbor v⋆ in H. This can again be easily done by using the sequence QH (i.e. QX build for X = H). Note that for each v ∈ F we know the number of neighbors of v that belong to H. Thus, each vertex v can pick an integer rv ∈ [1,N (v) ∩ H] uniformly at random. Then, by adding rv and the index of (v,−∞) in QH , we obtain the index in QH , which corresponds to an edge between v and its random neighbor in H. The remaining lines of MatchHeavy are straightforward to implement. The vertices can trivially pick their colors. After that, the set E⋆ can be easily computed by transmitting data from vertices to their adjacent edges. Implementing the following steps of MatchHeavy is straightforward. Finally, picking the edges to be matched is analogous to the step, when for each v ∈ F we picked a random neighbor in H. Overall, each phase of GlobalAlg (that is, iteration of the main loop) is executed in O(1) rounds. Thus, by Lemma 3.3, GlobalAlg can be simulated in O(lne∆) rounds as advertised. 38 6.2 Vertex and edge partitioning We now show how to implement Line 5 and compute the set of edges that are used in each call to LocalPhase in Line 8 of ParallelAlg. Our goal is to annotate each edge with the machine number it is supposed to go to. To that end, once the vertices pick their machine numbers, we broadcast them to their adjacent edges. Every edge that receives two equal numbers x is assigned to machine x. In the implementation we do not check whether a machine is assigned too many edges (Line 7), but rather show in Lemma 5.2 that not too many edges are assigned with high probability. 6.3 LocalPhase We now discuss the implementation of LocalPhase. Observe that LocalPhase is executed locally. Therefore, the for loop at Line 8 of ParallelAlg can also be executed locally on each machine. Thus, we only explain how to process the output of LocalPhase. Instead of returning the set of vertices and matched edges at Line 6 of LocalPhase, each vertex that should be returned is marked as discarded, and each matched edge is marked as matched. After that, we need to discard edges, whose at least one endpoint has been discarded. This can be done by broadcasting information from vertices to adjacent edges. Note that some of the discarded edges might be also marked as matched. 6.4 Putting all together Lines 5, 7 and 8 can be implemented as described in sections 6.2 and 6.3. Lines 9 and 10 do not need an actual implementation, as by that point all the vertices that are not marked as discarded constitute V ′, and all the edges incident to V \ V ′ will be marked as discarded. Similarly, all the matched edges will be marked as matched by the implementation of LocalPhase. All the edges and vertices that are marked as discarded will be ignored in further processing. After all the rounds are over, the matching consists of the edges marked as matched. Let ∆⋆ be the value of ∆ at Line 12, and hence the value of ∆ at the end of the last while loop iteration. Let ∆′ be the value of ∆ just before the last iteration, i.e. ∆⋆ = ∆′/2τ , for the corresponding τ . Now consider the last call of LocalPhase at Line 8. The last invocation has ∆′/(2τ −1) as a parameter. On the other hand, by Claim 4.7 and Claim 4.8 we know that after the last invocation of LocalPhase with high probability there is no vertex that has degree greater then 3 4 ∆′/(2τ −1) < 2∆⋆. Therefore, with high probability there is no vertex that should be removed at Line 12, and hence we do not implement that line either. An implementation of Line 13 is described in Section 6.1. Finally, we can state the following result. Lemma 6.2. There exists an implementation of ParallelAlg in the MPC model that with high probabil- ity executes O(cid:0)(log log n)2 + max(cid:0)log n S , 0(cid:1)(cid:1) rounds. Proof. In the proof we analyze the case S ≤ n. Otherwise, for the case S > n, we think of each machine being split into ⌊S/n⌋ "smaller" machines, each of the smaller machines having space n. We will analyze the number of iterations of the while loop ParallelAlg performs. Let ∆i and τi be the value of ∆ and τ at the end of iteration i, respectively. Then, from Line 3 and Line 4 we have τi =(cid:24) 1 16 log120α (∆i−1/m)(cid:25) ≥ 1 16 log120α (∆i−1/m) ≥ log120αr S∆i−1 n . 1 16 39 Define γ := 1 32 log2 120α . By plugging in the above bound on τi, from Line 11, we derive ∆i = ∆i−1 · 2τi ≤ ∆i−1 · 2− 1 16 log120α q S∆i−1 n = ∆i−1 · 2− S∆i−1 log2 32 log2 120α = ∆1−γ n S(cid:17)γ i−1 (cid:16) n (6) To obtain the number of iterations the while loop of ParallelAlg performs, we derive for which i ≥ 1 the condition at Line 2 does not hold. Unraveling ∆i−1 further from (6) gives ∆i ≤ ∆(1−γ)i 0 S(cid:17)1−(1−γ)i Observe that (c log log n)−1 ≤ γ ≤ (32 log log n)−1 < 1/2, for an absolute constant c and n ≥ 4. 1−(1−γ) = n(1−γ)i(cid:16) n ≤ n(1−γ)i(cid:16) n S(cid:17)γ 1−(1−γ)i (cid:16) n S(cid:17)γ Pi−1 j=0(1−γ)j For S ≤ n and as γ < 1/2 we have On the other hand, for i⋆ = log log n γ . n S S(cid:17)1−(1−γ)i (cid:16) n ≤ ≤ c(log log n)2 we have n(1−γ)i⋆ < log n. Now putting together (7), (8), and (9) we conclude ∆i⋆ < n S ln n, (7) (8) (9) Total round complexity. Every iteration of the while loop can be executed in O(1) MPC rounds with and hence the number of iteration the while loop of ParallelAlg performs is O(cid:0)(log log n)2(cid:1). probability at least 1 − 1/n3. Since there are O(cid:0)(log log n)2(cid:1) iterations of the while loop, all the iterations of the loop can be performed in O(cid:0)(log log n)2(cid:1) many rounds with probability at least 1 − 1/n2. S (ln n)32(cid:1)(cid:1) rounds. Putting the both bounds of Line 13 of ParallelAlg can be performed in O(cid:0)log(cid:0) n S(cid:1) for the case together we conclude that the round complexity of ParallelAlg is O(cid:0)(log log n)2 + log n of space n) the round complexity is O(cid:0)(log log n)2(cid:1). S ≤ n. For the case S > n (recall that in this regime we assume that each machine is divided into machines On the other hand, by Lemma 6.1 and the condition at Line 2 of ParallelAlg, the computation Acknowledgments We thank Sepehr Assadi, Mohsen Ghaffari, Cameron Musco, Christopher Musco, Seth Pettie, and Govind Ramnarayan for helpful discussions and comments. A. Czumaj was supported in part by the Centre for Dis- crete Mathematics and its Applications (DIMAP), Royal Society International Exchanges Scheme 2013/R1, IBM Faculty Award, and the EPSRC award EP/N011163/1. A. M adry was supported in part by an Alfred P. Sloan Research Fellowship, Google Research Award, and the NSF grant CCF-1553428. S. Mitrovi´c was supported in part by the Swiss NSF grant P1ELP2_161820. P. Sankowski was partially supported by grant NCN2014/13/B/ST6/00770 of Polish National Science Center and ERC StG grant TOTAL no. 677651. 40 References [ABB+17] Sepehr Assadi, MohammadHossein Bateni, Aaron Bernstein, Vahab S. Mirrokni, and Cliff Stein. Coresets meet EDCS: algorithms for matching and vertex cover on massive graphs. CoRR, abs/1711.03076, 2017. [ABI86] 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. [AG15] Kook Jin Ahn and Sudipto Guha. Access to data and number of iterations: Dual primal algo- rithms for maximum matching under resource constraints. In Proceedings of the 27th ACM on Symposium on Parallelism in Algorithms and Architectures, SPAA 2015, Portland, OR, USA, June 13–15, 2015, pages 202–211, 2015. [AK17] Sepehr Assadi and Sanjeev Khanna. Randomized composable coresets for matching and vertex cover. In Proceedings of the 29th ACM Symposium on Parallelism in Algorithms and Architec- tures, SPAA 2017, Washington DC, USA, July 24–26, 2017, pages 3–12, 2017. [ANOY14] Alexandr Andoni, Aleksandar Nikolov, Krzysztof Onak, and Grigory Yaroslavtsev. Parallel algorithms for geometric graph problems. In Proceedings of the 46th ACM Symposium on Theory of Computing, STOC 2014, New York, NY, USA, May 31–June 3, 2014, pages 574–583, 2014. [Ass17] Sepehr Assadi. Simple round compression for parallel vertex cover. CoRR, abs/1709.04599, September 2017. [BCH17] Sayan Bhattacharya, Deeparnab Chakrabarty, and Monika Henzinger. Deterministic fully dy- namic approximate vertex cover and fractional matching in O(1) amortized update time. In Proceedings of the 19th International Conference on Integer Programming and Combinatorial Optimization, IPCO 2017, Waterloo, ON, Canada, June 26–28, 2017, pages 86–98, 2017. [BH87] [BHI15] [BHN16] [BHN17] Paul Beame and Johan Hastad. Optimal bounds for decision problems on the CRCW PRAM. In Proceedings of the 19th Annual ACM Symposium on Theory of Computing, STOC 1987, pages 83–93, New York, NY, USA, 1987. Sayan Bhattacharya, Monika Henzinger, and Giuseppe F. Italiano. Deterministic fully dynamic data structures for vertex cover and matching. In Proceedings of the 26th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, San Diego, CA, USA, January 4–6, 2015, pages 785–804, 2015. Sayan Bhattacharya, Monika Henzinger, and Danupon Nanongkai. New deterministic approx- imation algorithms for fully dynamic matching. In Proceedings of the 48th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2016, Cambridge, MA, USA, June 18– 21, 2016, pages 398–411, 2016. Sayan Bhattacharya, Monika Henzinger, and Danupon Nanongkai. Fully dynamic approxi- mate maximum matching and minimum vertex cover in O(log3 n) worst case update time. In Proceedings of the 28th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2017, Barcelona, Spain, Hotel Porta Fira, January 16–19, pages 470–489, 2017. 41 [BKS13] Paul Beame, Paraschos Koutris, and Dan Suciu. Communication steps for parallel query pro- cessing. In Proceedings of the 32nd ACM SIGMOD-SIGACT-SIGART Symposium on Princi- ples of Database Systems, PODS 2013, New York, NY, USA, June 22–27, 2013, pages 273–284, 2013. [BKS14] Paul Beame, Paraschos Koutris, and Dan Suciu. Skew in parallel query processing. In Pro- ceedings of the 33rd ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS'14, Snowbird, UT, USA, June 22–27, 2014, pages 212–223, 2014. [BS15] [BS16] [DG04] Aaron Bernstein and Cliff Stein. Fully dynamic matching in bipartite graphs. In Proceedings of the 42nd International Colloquium on Automata, Languages, and Programming, ICALP 2015, Kyoto, Japan, July 6–10, 2015, Proceedings, Part I, pages 167–179, 2015. Aaron Bernstein and Cliff Stein. Faster fully dynamic matchings with small approximation ra- tios. In Proceedings of the 27th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2016, Arlington, VA, USA, January 10–12, 2016, pages 692–711, 2016. Jeffrey Dean and Sanjay Ghemawat. MapReduce: Simplified data processing on large clusters. In Proceedings of the 6th Conference on Symposium on Opearting Systems Design & Imple- mentation, Volume 6, OSDI'04, pages 10–10, Berkeley, CA, USA, 2004. USENIX Association. [DG08] Jeffrey Dean and Sanjay Ghemawat. MapReduce: Simplified data processing on large clusters. Commununication of the ACM, 51(1):107–113, January 2008. [Edm65] Jack Edmonds. Paths, trees and flowers. Canadian Journal of Mathematics, pages 449–467, 1965. [FG17] Manuela Fischer and Mohsen Ghaffari. Deterministic distributed matching: Simpler, faster, better. CoRR, abs/1703.00900, 2017. [FMS+10] Jon Feldman, S. Muthukrishnan, Anastasios Sidiropoulos, Clifford Stein, and Zoya Svitk- ina. On distributing symmetric streaming computations. ACM Transactions on Algorithms, 6(4):66:1–66:19, 2010. [GSZ11] Michael T. Goodrich, Nodari Sitchinava, and Qin Zhang. Sorting, searching, and simulation in the MapReduce framework. In International Symposium on Algorithms and Computation, pages 374–383. Springer, 2011. [HKP99] Michał Ha´n´ckowiak, Michał Karo´nski, and Alessandro Panconesi. A faster distributed algo- rithm for computing maximal matchings deterministically. In Proceedings of the Eighteenth Annual ACM Symposium on Principles of Distributed Computing, PODC '99, pages 219–228, New York, NY, USA, 1999. ACM. [HKP01] Michał Ha´n´ckowiak, Michał Karo´nski, and Alessandro Panconesi. On the distributed complex- ity of computing maximal matchings. SIAM Journal on Discrete Mathematics, 15(1):41–57, 2001. [HRVZ15] Zengfeng Huang, Božidar Radunovi´c, Milan Vojnovi´c, and Qin Zhang. Communication com- plexity of approximate matching in distributed graphs. In Proceedings of the 32nd Interna- tional Symposium on Theoretical Aspects of Computer Science, STACS 2015, March 4–7, 2015, Garching, Germany, pages 460–473, 2015. 42 [IBY+07] Michael Isard, Mihai Budiu, Yuan Yu, Andrew Birrell, and Dennis Fetterly. Dryad: Distributed data-parallel programs from sequential building blocks. SIGOPS Operating Systems Review, 41(3):59–72, March 2007. [II86] [IS86] Amos Israeli and Alon Itai. A fast and simple randomized parallel algorithm for maximal matching. Information Processing Letters, 22(2):77–80, 1986. Amos Israeli and Yossi Shiloach. An improved parallel algorithm for maximal matching. Infor- mation Processing Letters, 22(2):57–60, 1986. [KKS14] Michael Kapralov, Sanjeev Khanna, and Madhu Sudan. Approximating matching size from random streams. In Proceedings of the 25th Annual ACM-SIAM Symposium on Discrete Algo- rithms, SODA 2014, Portland, Oregon, USA, January 5–7, 2014, pages 734–751, 2014. [KMW06] Fabian Kuhn, Thomas Moscibroda, and Roger Wattenhofer. The price of being near-sighted. In Proceedings of the 17th Annual ACM-SIAM Symposium on Discrete Algorithm, SODA 2006, pages 980–989, Philadelphia, PA, USA, 2006. Society for Industrial and Applied Mathematics. [KSV10] Howard J. Karloff, Siddharth Suri, and Sergei Vassilvitskii. A model of computation for MapRe- duce. In Proceedings of the 21st Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2010, Austin, Texas, USA, January 17–19, 2010, pages 938–948, 2010. [LMSV11] Silvio Lattanzi, Benjamin Moseley, Siddharth Suri, and Sergei Vassilvitskii. Filtering: a method for solving graph problems in MapReduce. In Proceedings of the 23rd Annual ACM Symposium on Parallelism in Algorithms and Architectures, SPAA 2011, San Jose, CA, USA, June 4–6, 2011, pages 85–94, 2011. [LPP15] Zvi Lotker, Boaz Patt-Shamir, and Seth Pettie. Journal of the ACM, 62(5):38:1–38:17, November 2015. Improved distributed approximate matching. [Lub86] Michael Luby. A simple parallel algorithm for the maximal independent set problem. SIAM Journal on Computing, 15(4):1036–1053, 1986. [McG05] Andrew McGregor. Finding graph matchings in data streams. In Approximation, Randomization and Combinatorial Optimization, Algorithms and Techniques, 8th International Workshop on Approximation Algorithms for Combinatorial Optimization Problems, APPROX 2005 and 9th InternationalWorkshop on Randomization and Computation, RANDOM 2005, Berkeley, CA, USA, August 22-24, 2005, Proceedings, pages 170–181, 2005. [OR10] Krzysztof Onak and Ronitt Rubinfeld. Maintaining a large matching and a small vertex cover. In Proceedings of the 42nd ACM Symposium on Theory of Computing, STOC 2010, Cambridge, Massachusetts, USA, 5–8 June 2010, pages 457–464, 2010. [PR07] Michal Parnas and Dana Ron. Approximating the minimum vertex cover in sublinear time and a connection to distributed algorithms. Theoretical Computer Science, 381(1-3):183–196, 2007. [RVW16] Tim Roughgarden, Sergei Vassilvitskii, and Joshua R. Wang. Shuffles and circuits: On lower bounds for modern parallel computation. In Proceedings of the 28th ACM Symposium on Par- allelism in Algorithms and Architectures, SPAA 2016, Asilomar State Beach/Pacific Grove, CA, USA, July 11–13, 2016, pages 1–12, 2016. 43 [Whi12] Tom White. Hadoop: The Definitive Guide. O'Reilly Media, Inc., 2012. [ZCF+10] Matei Zaharia, Mosharaf Chowdhury, Michael J. Franklin, Scott Shenker, and Ion Stoica. Spark: Cluster computing with working sets. In 2nd USENIX Workshop on Hot Topics in Cloud Com- puting, HotCloud'10, Boston, MA, USA, June 22, 2010. 44
1207.5215
2
1207
2012-07-30T07:37:53
Density Functions subject to a Co-Matroid Constraint
[ "cs.DS", "cs.DM" ]
In this paper we consider the problem of finding the {\em densest} subset subject to {\em co-matroid constraints}. We are given a {\em monotone supermodular} set function $f$ defined over a universe $U$, and the density of a subset $S$ is defined to be $f(S)/\crd{S}$. This generalizes the concept of graph density. Co-matroid constraints are the following: given matroid $\calM$ a set $S$ is feasible, iff the complement of $S$ is {\em independent} in the matroid. Under such constraints, the problem becomes $\np$-hard. The specific case of graph density has been considered in literature under specific co-matroid constraints, for example, the cardinality matroid and the partition matroid. We show a 2-approximation for finding the densest subset subject to co-matroid constraints. Thus, for instance, we improve the approximation guarantees for the result for partition matroids in the literature.
cs.DS
cs
Density Functions subject to a Co-Matroid Constraint∗ Venkatesan T. Chakaravarthy1, Natwar Modani1, Sivaramakrishnan R. Natarajan2, Sambuddha Roy1, and Yogish Sabharwal1 1 2 IBM Research, New Delhi, India {vechakra,namodani,sambuddha,ysabharwal}@in.ibm.com IIT Chennai, India [email protected] Abstract In this paper we consider the problem of finding the densest subset subject to co-matroid con- straints. We are given a monotone supermodular set function f defined over a universe U , and the density of a subset S is defined to be f (S)/S. This generalizes the concept of graph density. Co- matroid constraints are the following: given matroid M a set S is feasible, iff the complement of S is independent in the matroid. Under such constraints, the problem becomes NP-hard. The spe- cific case of graph density has been considered in literature under specific co-matroid constraints, for example, the cardinality matroid and the partition matroid. We show a 2-approximation for finding the densest subset subject to co-matroid constraints. Thus, for instance, we improve the approximation guarantees for the result for partition matroids in the literature. 1 Introduction In this paper, we consider the problem of computing the densest subset with respect to a monotone supermodular function subject to co-matroid constraints. Given a universe U of n elements, a function f : 2U → R+ is supermodular iff f (A) + f (B) 6 f (A ∪ B) + f (A ∩ B) for all A, B ⊆ U . If the sign of the inequality is reversed for all A, B, then we call the function submodular. The function f is said to be monotone if f (A) 6 f (B) whenever A ⊆ B; we assume f (∅) = 0. We define a density function d : 2U → R+ as d(S) , f (S)/S. Consider the problem of maximizing the density function d(S) given oracle access to the function f . We observe that the above problem can be solved in polynomial time (see Theorem 6). The main problem considered in this paper is to maximize d(S) subject to certain constraints that we call co-matroid constraints. In this scenario, we are given a matroid M = (U, I) where I ⊆ 2U is the family of independent sets (we give the formal definition of a matroid in Section 2). A set S is considered feasible iff the complement of S is independent i.e. S ∈ I. The problem is to find the densest feasible subset S given oracle access to f and M. We denote this problem as DEN-M. We note that even special cases of the DEN-M problem are NP-hard [14]. The main result in this paper is the following: ◮ Theorem 1. Given a monotone supermodular function f over a universe U , and a matroid M defined over the same universe, there is a 2-approximation algorithm for the DEN-M problem. ∗ Work done by the third author while he was interning at IBM Research 2 1 0 2 l u J 0 3 ] S D . s c [ 2 v 5 1 2 5 . 7 0 2 1 : v i X r a 2 Density Functions Alternatively one could have considered the same problem under matroid constraints (instead of co-matroid constraints). We note that this problem is significantly harder, since the Densest Subgraph problem can be reduced to special cases of this problem (see [2, 14]). The Densest Subgraph problem is notoriously hard: the best factor approximation known to date is O(n1/4+ǫ) for any ǫ > 0 [3]. Special cases of the DEN-M problem have been extensively studied in the context of graph density, and we discuss this next. 1.1 Comparison to Graph Density Given an undirected graph G = (V, E), the density d(S) of a subgraph on vertex set S is defined as the quantity E(S) , where E(S) is the set of edges in the subgraph induced by the S vertex set S. The densest subgraph problem is to find the subgraph S of G that maximizes the density. The concept of graph density is ubiquitous, more so in the context of social networks. In the context of social networks, the problem is to detect communities: collections of individuals who are relatively well connected as compared to other parts of the social network graph. The results relating to graph density have been fruitfully applied to finding communities in the social network graph (or even web graphs, gene annotation graphs [15], problems related to the formation of most effective teams [9], etc.). Also, note that graph density appears naturally in the study of threshold phenomena in random graphs, see [1]. Motivated by applications in social networks, the graph density problem and its variants have been well studied. Goldberg [11] proved that the densest subgraph problem can be solved optimally in polynomial time: he showed this via a reduction to a series of max-flow computations. Later, others [6, 14] have given new proofs for the above result, motivated by considerations to extend the result to some generalizations and variants. Andersen and Chellapilla [2] studied the following generalization of the above problem. Here, the input also includes an integer k, and the goal is to find the densest subgraph S subject to the constraint S > k. This corresponds to finding sufficiently large dense subgraphs in social networks. This problem is NP-hard [14]. Andersen and Chellapilla [2] gave a 2-approximation algorithm. Khuller and Saha [14] give two alternative algorithms: one of them is a greedy procedure, while the other is LP-based. Both the algorithms have 2-factor guarantees. Gajewar and Sarma [9] consider a further generalization. The input also includes a partition of the vertex set into U1, U2, · · · , Ut, and non-negative integers r1, r2, · · · , rt. The goal is to find the densest subgraph S subject to the constraint that for all 1 6 i 6 t, S ∩ Ui > ri. They gave a 3-approximation algorithm by extending the greedy procedure of Khuller and Saha [14]. We make the following observations: (i) The objective function E(S) is monotone and supermodular. (ii) The constraint S > k (considered by [2]) is a co-matroid constraint; this corresponds to the cardinality matroid. (iii) The constraint considered by Gajewar and Sarma [9] is also a co-matroid constraint; this corresponds to the partition matroid (formal definitions are provided in Section 2). Consequently, our main result Theorem 1 improves upon the above results in three directions: Objective function: Our results apply to general monotone supermodular functions f instead of the specific set function E(S) in graphs. Constraints: We allow co-matroid constraints corresponding to arbitrary matroids. V. Chakaravarthy et. al 3 Approximation Factor: For the problem considered by Gajewar and Sarma [9], we im- prove the approximation guarantee from 3 to 2. We match the best factor known for the at-least-k densest subgraph problem considered in [2, 14]. 1.2 Other Results Knapsack Covering Constraints: We also consider the following variant of the DEN-M problem. In this variant, we will have a weight wi (for i = 1, · · · , U ) for every element i ∈ U , and a number k ∈ N. A set S of elements is feasible if and only if the following condition holds: X i∈S wi > k We call this a knapsack covering constraint. We extend the proof of Theorem 1 to show the following: ◮ Theorem 2. Suppose we are given a monotone supermodular function f over a universe U , weights wi for every element i ∈ U , and a number k ∈ N. Then there is a 3-approximation algorithm for maximizing the density function d(S) subject to knapsack covering constraints corresponding to the weights wi and the number k. Dependency Constraints: Saha et. al[15] consider a variant of the graph density problem. In this version, we are given a specific collection of vertices A ⊆ V ; a subset S of vertices is feasible iff A ⊆ S. We call this restriction the subset constraint. The objective is to find the densest subgraph among subsets satisfying a subset constraint. Saha et. al[15] prove that this problem is solvable in polynomial time by reducing this problem to a series of max-flow computations. We study a generalization of the subset constraint problem. Here, we are given a mono- tone supermodular function f defined over universe U . Additionally, we are given a directed graph D = (U, ~A) over the universe U . A feasible solution S has to satisfy the following if a ∈ S, then every vertex of the digraph D reachable from a also has to be- property: long to S. Alternatively, a ∈ S and (a, b) ∈ ~A implies that b ∈ S. We call the digraph D as the dependency graph and such constraints as dependency constraints. The goal is to find the densest subset S subject to the dependency constraints. We call this the DENdep problem. We note that the concept of dependency constraints generalizes that of the subset constraints: construct a digraph D by drawing directed arcs from every vertex in U to every vertex in A. The motivation for this problem comes from certain considerations in social networks, where we are to find the densest subgraph but with the restriction that in the solution subgraph all the members of a sub-community (say, a family) are present or absent simultaneously. In literature, such a solution S that satisfies the dependency constraints is also called a closure (see [18], Section 3.7.2). Thus our problem can be rephrased as that of finding the densest subset over all closures. We note that dependency constraints are incomparable with co-matroid constraints. In it is not true that if S is a fact dependency constraints are not even upward monotone: feasible subset, any superset of S is feasible. Our result is as follows: ◮ Theorem 3. The DENdep problem is solvable in polynomial time. The salient features of the above result are as follows: 4 Density Functions While the result in [15] is specific to graph density, our result holds for density functions arising from arbitrary monotone supermodular functions. Our proof of this result is LP-based. The work of [15] is based on max-flow computations. We can extend our LP-based approach (via convex programs) to the case for density functions arising from arbitrary monotone supermodular f , while we are not aware as to how to extend the max-flow based computation. The proof technique, inspired by Iwata and Nagano [13] also extends to show "small support" results: thus, for instance, we can show that for the LP considered by [14] for the at-least-k-densest subgraph problem, every non-zero component of any basic feasible solution is one of two values. Combination of Constraints: We also explore the problem of finding the densest subset subject to a combination of the constraints considered. We are able to prove results for the problem of maximizing a density function subject to (a) co-matroid constraints and (b) subset constraints. Suppose we are given a monotone supermodular function f over a universe U , a matroid M = (U, I), and a subset of elements A ⊆ U . A subset S is called feasible iff (1) S satisfies the co-matroid constraints wrt M (i.e. S ∈ I) and (2) S satisfies the subset constraint wrt A (i.e. A ⊆ S). We show the following: ◮ Theorem 4. There is a 2-approximation algorithm for the problem of maximizing the density function d(S) corresponding to a monotone supermodular function f , subject to the co-matroid and subset constraints. 1.3 Related Work Recently, there has been a considerable interest in the problems of optimizing submodular functions under various types of constraints. The most common constraints that are con- sidered are matroid constraints, knapsack constraints or combinations of the two varieties. Thus for instance, Calinescu et. al [5] considered the problem of maximizing a monotone submodular function subject to a matroid constraint. They provide an algorithm and show that it yields a (1 − 1/e)-approximation: this result is essentially optimal (also see the re- cent paper [8] for a combinatorial algorithm for the same). Goemans and Soto [10] consider the problem of minimizing a symmetric submodular function subject to arbitrary matroid constraints. They prove the surprising result that this problem can be solved in polyno- mial time. In fact, their result extends to the significantly more general case of hereditary constraints; the problem of extending our results to arbitrary hereditary functions is left open. The density functions that we consider may be considered as "close" to the notion of supermodular functions. To the best of our knowledge, the general question of maximizing density functions subject to a (co-)matroid constraint has never been considered before. 1.4 Proof Techniques We employ a greedy algorithm to prove Theorems 1 and 2. Khuller and Saha [14] and Gajewar and Sarma [9] had considered a natural greedy algorithm for the problem of max- imizing graph density subject to co-matroid constraints corresponding to the cardinality matroid and partition matroid respectively. Our greedy algorithm can be viewed as an ab- straction of the natural greedy algorithm to the generalized scenario of arbitrary monotone supermodular functions. However, our analysis is different from that in [14, 9]: the efficacy V. Chakaravarthy et. al 5 of our analysis is reflected in the fact that we improve on the guarantees provided by [9]. While they provide a 3-approximation algorithm for the graph density problem with par- tition matroid constraints, we use the modified analysis to obtain a 2-factor guarantee. In both of the earlier papers [14, 9], a particular stopping condition is employed to define a set Dℓ useful in the analysis. For instance, in Section 4.1 of [9] they define Dℓ using the optimal set H ∗ directly. We choose a different stopping condition to define the set Dℓ; it turns out that this choice is crucial for achieving a 2-factor guarantee. We prove Theorem 3 using LP-based techniques. In fact, we provide two proofs for the same. Both our techniques also provide alternate new proofs of the basic result that graph density is computable in polynomial time. The first proof method is inspired by Iwata and Nagano [13]. The second proof method invokes Cramer's rule to derive the conclusion. 1.5 Organization We present the relevant definitions in Section 2. We proceed to give the proof of Theorem 1 in Section 3, while the proof of Theorem 2 is presented in Section 4. The proof of Theorem 3 is presented in Section 5. and the proof of Theorem 4 is in Section 6. 2 Preliminaries In this paper, we will use the following notation: given disjoint sets A and B we will use A+B to serve as shorthand for A∪B. Vice versa, when we write A+B it will hold implicitly that the sets A and B are disjoint. Monotone: A set function f is called monotone if f (S) 6 f (T ) whenever S ⊆ T . Supermodular: A set function f : 2U → R+ over a universe U is called supermodular if the following holds for any two sets A, B ⊆ U : f (A) + f (B) 6 f (A ∪ B) + f (A ∩ B) If the inequality holds (for every A, B) with the sign reversed, then the function f is called submodular. In this paper, we will use the following equivalent definition of supermodularity: given disjoint sets A, B and C, f (A + C) − f (A) 6 f (A + B + C) − f (A + B) We can think of this as follows: the marginal utility of the set of elements C to the set A increases as the set becomes "larger" (A + B instead of A). It is well known (see [12, 17]) that supermodular functions can be maximized in poly- nomial time (whereas submodular functions can be minimized in polynomial time). Let us record this as: ◮ Theorem 5. Any supermodular function f : 2U → R+ can be maximized in polynomial time. We also state the following folklore corollary: ◮ Corollary 6. Given any supermodular function f : 2U → R+, we can find maxS polynomial time. f (S) S in For completeness, a proof of this Corollary is included in Section 5.2. Density Function: Given a function f over U , the density of a set S is defined to be d(S) = f (S) S . Matroid: A matroid is a pair M = (U, I) where I ⊆ 2U , and 6 Density Functions i ← 1 Hi ← arg maxX Di ← Hi while Di infeasible do f (X) X Hi+1 ← arg maxX:X∩Di=∅ Di+1 ← Di + Hi+1 i ← i + 1 end while L ← i for i = 1 → L do f (Di+X)−f (Di) X Add arbitrary vertices to Di to make it minimal feasible Call the result D′ i end for Output the subset among the D′ i's with the highest density Figure 1 Main Algorithm 1. (Hereditary Property) ∀B ∈ I, A ⊂ B =⇒ A ∈ I. 2. (Extension Property) ∀A, B ∈ I : A < B =⇒ ∃x ∈ B \ A : A + x ∈ I Matroids are generalizations of vector spaces in linear algebra and are ubiquitous in combin- atorial optimization because of their connection with greedy algorithms. Typically the sets in I are called independent sets, this being an abstraction of linear independence in linear algebra. The maximal independent sets in a matroid are called the bases (again preserving the terminology from linear algebra). An important fact for matroids is that all bases have equal cardinality -- this is an outcome of the Extension Property of matroids. Any matroid is equipped with a rank function r : 2U → R+. The rank of a subset S is defined to be the size of the largest independent set contained in the subset S. By the Extension Property, this is well-defined. See the excellent text by Schrijver [16] for details. Two commonly encountered matroids are the (i) Cardinality Matroid: Given a universe U and r ∈ N, the cardinality matroid is the matroid M = (U, I), where a set A is independent (i.e. belongs to I) iff A 6 r. (ii) Partition Matroid: Given a universe U and a partition of U as U1, · · · , Ur and non-negative integers r1, · · · , rt, the partition matroid is M = (U, I), where a set A belongs to I iff A ∩ Ui 6 ri for all i = 1, 2, · · · , t. Convex Programs: We will need the definition of a convex program, and that they can be solved to arbitrary precision in polynomial time, via the ellipsoid method(see [12]). We refer the reader to the excellent text [4]. 3 Proof of Theorem 1 We first present the algorithm and then its analysis. To get started, we describe the intuition behind the algorithm. Note that co-matroid constraints are upward monotone: if a set S is feasible for such constraints, then any superset of S is also feasible. Thus, it makes sense to find a maximal subset of U with the maximum density. In the following description of the algorithm, one may note that the sets D1, D2, · · · , Di are an attempt to find the maximal subset with the largest density. Given this rough outline, the algorithm is presented in Figure 1. We note that we can find the maximum maxX:X∩Di=∅ f (Di+X)−f (Di) X in polynomial time. V. Chakaravarthy et. al 7 This is because the function f (Di + X) for a fixed Di is supermodular (and we appeal to Corollary 6). Let H ∗ denote the optimal solution, i.e. the subset that maximizes the density d(S) subject to the co-matroid constraints. Let d∗ denote the optimal density, so that f (H ∗) = d∗·H ∗. We can make the following easy claim: ◮ Claim 1. The subset D1 obeys the inequality d(D1) > d∗. This is because D1 is the densest subset in the universe U , while d∗ is the density of a specific subset H ∗. In the following, we will have occasion to apply the following lemmas. ◮ Lemma 7. Let a, b, c, d, θ ∈ R+ be such that the inequalities a b it is true that a+c b+d > θ. Thus, if a b d , then a+c d (by setting θ = c > θ and c d > c > c b+d d ). > θ hold. Then Also, ◮ Lemma 8. Let a, b, c, d ∈ R+ be real numbers such that a b > a b holds. > c−a d−b holds. Suppose a > c, b > d. Then the inequality a−c b−d Suppose c > a, d > b. Then the inequality c d > c d holds. We make the following claim: ◮ Claim 2. The sequence of subsets D1, D2, · · · , DL obeys the following ordering: f (D1) D1 > f (D2) − f (D1) D2 − D1 > · · · > f (Di+1) − f (Di) Di+1 − Di > · · · > f (DL) − f (DL−1) DL − DL−1 Proof. Consider any term in this sequence, say f (Di+1)−f (Di) Di+1−Di as arg max of f (Di+X)−f (Di) f (Di+X)−f (Di) quantity is larger than f (Di+2)−f (Di) Di+2−Di part of Lemma 8, we get that . Therefore, maxX X X . Note that Hi+1 was chosen = f (Di+1)−f (Di) Di+1−Di . Hence this (as long as Di+2 is well defined). Now from the second f (Di+1) − f (Di) Di+1 − Di > f (Di+2) − f (Di) Di+2 − Di > f (Di+2) − f (Di+1) Di+2 − Di+1 ◭ Via an application of Lemma 7, we then have: ◮ Claim 3. Given any i (1 6 i 6 L), the following holds: f (Di) Di > f (Di) − f (Di−1) Di − Di−1 Proof. We will the prove the statement by induction. Base Case: We implicitly assume that D0 = ∅, and hence the case for i = 1 holds. Induction Step: Assume the statement by induction for i = k, and we prove it for i = k+1. Thus, by hypothesis we have f (Dk) Dk > f (Dk) − f (Dk−1) Dk − Dk−1 Now by Claim 2 we have that f (Dk) − f (Dk−1) Dk − Dk−1 > f (Dk+1) − f (Dk) Dk+1 − Dk 8 Density Functions Thus, f (Dk) Dk > f (Dk+1) − f (Dk) Dk+1 − Dk Applying Lemma 7, we get: f (Dk+1) Dk+1 > f (Dk+1) − f (Dk) Dk+1 − Dk Thus we have proven the Claim by induction. ◭ The analysis will be broken up into two parts. We will consider the set Dℓ in the sequence D1, D2, · · · , DL such that the following hold: f (Dℓ) − f (Dℓ−1) Dℓ − Dℓ−1 > d∗ 2 but f (Dℓ+1) − f (Dℓ) Dℓ+1 − Dℓ < d∗ 2 Since d(D1) ≥ d∗ by Claim 1, such an ℓ will exist or ℓ = L. If ℓ = L, then we have a feasible solution DL with the property that f (DL)−f (DL−1) 2 . Therefore, by Claim 3 we have DL−DL−1 that d(DL) > d∗ 2 and we are done in this case. > d∗ D′ So we may assume that ℓ < L so that Dℓ is not feasible. In this case, we will prove that ℓ has the correct density, i.e. that d(D′ To this end, we will prove two facts about Dℓ and that will yield the desired result: ℓ) > d∗ 2 . ◮ Claim 4. f (Dℓ) − f (Dℓ ∩ H ∗) > d∗ 2 (Dℓ − Dℓ ∩ H ∗) Proof. Note that Dℓ = H1 + H2 + · · · + Hℓ. For brevity, for 1 6 i 6 ℓ, denote Hi ∩ H ∗ as Ai (thus, Ai ⊆ Hi for every i). Thus, Dℓ ∩ H ∗ = A1 + A2 + · · · + Aℓ. We will prove the following statement by induction on i (for 1 6 i 6 ℓ): f (H1 +H2 +· · ·+Hi)−f (A1 +A2 +· · ·+Ai) > d∗ 2 (H1 +H2 +· · ·+Hi−A1 +A2 +· · ·+Ai) Base Case: For i = 1, we have to prove that: f (H1) − f (A1) H1 − A1 > d∗ 2 Since H1 is the densest subset, we have f (H1) H1 > f (A1) A1 and we may apply (the first part of) Lemma 8 to obtain the desired. Induction Step: Assume the statement to be true for i, and we will prove it for i + 1. V. Chakaravarthy et. al 9 Consider the following chain: f (H1 + · · · + Hi + Hi+1) − f (H1 + · · · + Hi) Hi+1 f (H1 + · · · + Hi + Ai+1) − f (H1 + · · · + Hi) Ai+1 f (A1 + · · · + Ai + Ai+1) − f (A1 + · · · + Ai) Ai+1 Hi+1arg max > supermodular > We would now like to apply Lemma 8 to the first and last terms in the above chain. To this end, let us check the preconditions: f (H1 + · · · + Hi + Hi+1) − f (H1 + · · · + Hi) supermodular monotone > f (H1 + · · · + Hi + Ai+1) − f (H1 + · · · + Hi) > f (A1 + · · · + Ai + Ai+1) − f (A1 + · · · + Ai) Also, clearly, Hi+1 > Ai+1. Thus, the preconditions in Lemma 8 hold, and we have that f (H1 + · · · + Hi+1) − f (A1 + · · · + Ai+1) − f (H1 + · · · + Hi) + f (A1 + · · · + Ai) f (H1 + · · · + Hi + Hi+1) − f (H1 + · · · + Hi) Hi+1 > d∗ 2 Hi+1 − Ai+1 > Applying Lemma 7 to the first term in the above chain and the induction statement for ◭ i, we obtain the desired result for i + 1. Hence done. The next claim lower bounds the value f (Dℓ ∩ H ∗). Building up to the Claim, let us note that Dℓ ∩ H ∗ 6= ∅. If the intersection were empty, then H ∗ is a subgraph of density d∗, and so Hℓ+1 would be a subgraph of density at least d∗. But then, f (Dℓ + Hℓ+1) − f (Dℓ) Hℓ+1 supermodular > f (Hℓ+1) Hℓ+1 > d∗ But this contradicts the choice of Dℓ. ◮ Claim 5. f (Dℓ ∩ H ∗) > d∗ 2 Dℓ ∩ H ∗ + d∗ 2 H ∗ Proof. Let X = H ∗ −Dℓ ∩H ∗. Then, X ∩Dℓ = ∅ and Dℓ +X = Dℓ ∪H ∗. Then by definition of Dℓ, we know that f (Dℓ+X)−f (Dℓ) Dℓ+1−Dℓ < d∗/2. Thus, f (Dℓ ∪ H ∗) − f (Dℓ) 6 d∗ 2 (H ∗ − Dℓ ∩ H ∗). 6 f (Dℓ+1)−f (Dℓ) X Therefore, f (Dℓ ∪ H ∗) + f (Dℓ ∩ H ∗) 6 f (Dℓ) + f (Dℓ ∩ H ∗) + d∗ Applying supermodularity we have that f (Dℓ ∪ H ∗) + f (Dℓ ∩ H ∗) > f (Dℓ) + f (H ∗). 2 (H ∗ − Dℓ ∩ H ∗) > f (H ∗). The claim ◭ Thus, cancelling f (Dℓ) gives us that f (Dℓ ∩ H ∗) + d∗ follows by observing that d∗ = f (H ∗) H ∗ . 2 (H ∗ − Dℓ ∩ H ∗). Note that this claim also implies that the density of the set Dℓ ∩ H ∗ is at least d∗. Intuitively, Dℓ ∩ H ∗ is a subset that has "enough f -value" as well as a "good" density. 10 Density Functions We may now combine the statements of Claim 4 and Claim 5 to get the following chain of inequalities: f (Dℓ) Claim 4 > f (Dℓ ∩ H ∗) + d∗ 2 Dℓ − d∗ 2 Dℓ ∩ H ∗ Claim 5 > d∗ 2 Dℓ + d∗ 2 H ∗ Consider D′ ℓ: this is obtained from Dℓ by adding suitably many elements to make Dℓ feasible. Let r be the minimum number of elements to be added to Dℓ so as to make it feasible. Since H ∗ is a feasible solution too, clearly, r 6 H ∗. With this motivation, we define the Extension Problem for a matroid M. The input is a matroid M = (U, I) and a subset A ⊆ U . The goal is to find a subset T of minimum cardinality such that A ∪ T ∈ I. Lemma 9 shows that we can find such a subset T in polynomial time. Thus, we would have that: d(D′ ℓ) = f (D′ ℓ) Dℓ + r > f (Dℓ) Dℓ + r > f (Dℓ) Dℓ + H ∗ > d∗/2 and we are done with the proof of Theorem 1, modulo the proof of Lemma 9. We proceed to present the lemma and its proof: ◮ Lemma 9. The Extension Problem for matroid M and subset A can be solved in polyno- mial time. Proof. The proof considers the base polyhedron of the matroid (see the text by Schrijver [16]). We will have a variable xi for each element i ∈ U \ A, where xi = 1 would indicate that we pick the element i in our solution T . For brevity, we will also maintain a variable yi that indicates whether i is absent from the solution T . Thus for every i, we will maintain that xi + yi = 1. Given an arbitrary set S, we will let r(S) denote the rank of the subset S in the matroid M. The following is a valid integer program for the Extension Problem (where y(S) is short- hand for Pi∈S yi). The linear program to the right is the relaxation of the integer program, and with variables xi eliminated. min X xi s.t. IP1 : i∈U xi + yi = 1 y(S) 6 r(S) xi = 1 xi, yi ∈ {0, 1} for all i ∈ U . for all S ⊆ U for all i ∈ U for all i ∈ A min X (1 − yi) LP1 : s.t. i∈U y(S) 6 r(S) yi = 0 yi > 0 for all S ⊆ U for all i ∈ A for all i ∈ U . The linear program LP1 can also be formulated as a maximization question. To be precise, let VAL(LP1) denote the value of the program LP1. Then VAL(LP1) = U − VAL(LP2), where LP2 is as follows: max X yi LP2 : s.t. i∈U y(S) 6 r(S) yi = 0 yi > 0 for all S ⊆ U for all i ∈ A for all i ∈ U . Now, by folklore results in matroid theory (cf. [16]), we have that solutions to LP2 are integral and can be found by a greedy algorithm. Thus, we can solve IP1 in polynomial ◭ time, and this proves the statement of the Lemma. V. Chakaravarthy et. al 11 i ← 1 Hi ← arg maxX Di ← Hi while Di infeasible do f (X) X Hi+1 ← arg maxX:X∩Di=∅ Di+1 ← Di + Hi+1 i ← i + 1 end while L ← i for i = 1 → L do f (Di+X)−f (Di) X Order the vertices i in U \ Di by non-increasing order of weights wi Add vertices from U \ Di in this order to Di until feasibility is attained Let the result be D′ i end for Output the subset among the D′ i's with the highest density Figure 2 Algorithm for Knapsack constraints 4 Proof of Theorem 2 In order to prove this result, we will have to modify the algorithm presented in Section 3. In the analysis, we will correspondingly modify the definition of the set Dℓ. Then we will apply (modified versions of) Claim 4 and Claim 5 to derive the result. The modified algorithm is as shown in Figure 2. Consider the set Dℓ in the sequence D1, D2, · · · , DL such that the following hold: f (Dℓ) − f (Dℓ−1) Dℓ − Dℓ−1 > d∗ 3 but f (Dℓ+1) − f (Dℓ) Dℓ+1 − Dℓ < d∗ 3 As earlier, if there is no such ℓ < L for which this holds, this implies that DL satisfies f (DL)−f (DL−1) > d∗/3. But this gives a 3-approximation in this case since DL is feasible DL−DL−1 and d(DL) > f (DL) − f (DL−1) DL − DL−1 Let us consider the other case where ℓ < L and Dℓ is infeasible. Let H ∗ denote the optimal solution. We state modified versions of Claim 4 and Claim 5. ◮ Claim 6. (modified Claim 4) f (Dℓ) − f (Dℓ ∩ H ∗) > d∗ 3 (Dℓ − Dℓ ∩ H ∗) ◮ Claim 7. (modified Claim 5) f (Dℓ ∩ H ∗) > d∗ 3 Dℓ ∩ H ∗ + 2d∗ 3 H ∗ 12 Density Functions These modified claims may be proven analogously to the original claims, taking into account the new definition for Dℓ. Now note that given a set Dℓ, in order to make the set feasible for the knapsack cover constraint, we pick the elements with the largest weights wi so that feasibility is attained. The usual knapsack greedy algorithm shows that this is a 2-approximation to the optimal knapsack cover. Thus, if we add r elements, then r ≤ 2H ∗. Thus we have that, f (D′ ℓ) D′ ℓ > f (Dℓ) Dℓ + r > f (Dℓ) Dℓ + 2H ∗ > d∗ 3 Thus we have proven a 3-approximation. 5 Proof of Theorem 3 We will present the proof for the case of the graph density function, i.e. where f (S) = E(S). The proof for arbitrary f will require a passage to the Lovász Extension Lf (x) of a set function f (S). In fact we will present two proofs of this fact for the special case of the graph density function. To the best of our knowledge, both the proofs are new, and seems simpler than existing proofs. For both the proofs, we will use the same LP. First Proof: We will augment the LP that Charikar [6] uses to prove that graph density is computable in polynomial time. Given a graph G = (V, E), there are edge variables ye and vertex variables xi in the LP. We are also given an auxiliary dependency digraph D = (V, ~A) on In the augmented LP, we also have constraints xi 6 xj if there is an the vertex set V . arc from i to j in the digraph D = (V, ~A). The DENdep problem is modelled by the linear program LP3. max X s.t. X e∈E ye xi = 1 LP3 : i ye 6 xi xi 6 xj xi > 0 for all e ∼ i, e ∈ E for all (i, j) ∈ ~A for all i ∈ V (G) . CP1 : max X s.t. X e=(i,j)∈E min{xi, xj} xi = 1 i xi 6 xj xi > 0 for all (i, j) ∈ ~A for all i ∈ V (G) . Suppose we are given an optimal solution H ∗ to the DENdep problem. Let VAL(LP3) denote the feasible value of this LP: we will prove that VAL(LP3) = d(H ∗). VAL(LP3) > d(H ∗): We let H ∗ = ℓ, and xi = 1/ℓ for i ∈ H ∗, and 0 otherwise. Likewise, we set ye = 1/ℓ for e ∈ E(H ∗), and 0 otherwise. Note that H ∗ is feasible, so if a ∈ H ∗ and (a, b) ∈ ~A, then it also holds that b ∈ H ∗. We may check that the assignment x and y is feasible for the LP. So, d(H ∗) = E(H ∗) VAL(LP3) 6 d(H ∗): is achieved as the value of a feasible assignment to the LP. ℓ In the rest of the proof, we will prove that there exists a subgraph H such that VAL 6 d(H). First, it is easy to observe that in any optimal solution of the above LP, the variables ye will take the values min{xi, xj} where e = (i, j). Thus, we may eliminate the variables ye from the program LP3 to obtain the program CP1. We claim that CP1 is a convex program. Given two concave functions, the min operator preserves concavity. Thus, the objective function of the above modified program is concave. Hence we have a convex program: here, the objective to be maximized is concave, subject to linear constraints. We may solve the V. Chakaravarthy et. al 13 program CP1 and get an output optimal solution x∗. Relabel the vertices of V such that the following holds: x∗ n. If there are two vertices with (modified) indices a and b where a < b and there is an arc (a, b) ∈ ~A, then we have the equalities x∗ a+1 = · · · = x∗ b . We will replace the inequalities in the program CP1 as follows: 2 > · · · > x∗ a = x∗ 1 > x∗ max X s.t. X xi = 1 e=(i,j)∈E:i<j xj LP4 : i xi > xi+1 xn > 0 for all i ∈ {1, 2, · · · , (n − 1)} . where some of the inequalities xi > xi+1 may be equalities if there is an index a with a 6 i and an index b with b > (i+1) such that (a, b) ∈ ~A. Note also that because of the ordering of the variables of this LP, the objective function also simplifies and becomes a linear function. Clearly x∗ is a feasible solution to this LP. Thus the value of this LP is no less than the value of CP1. Consider a BFS x to LP4. The program LP4 has (n + 1) constraints, and n variables. Given the BFS x, call a constraint non-tight if it does not hold with equality under the solution x. Thus, there may be at most one non-tight constraint in LP4. In other words, there is at most one constraint xi > xi+1 that is a strict inequality. This, in turn, implies that all the non-zero values in x are equal. Let there be ℓ such non-zero values. From the equality Pi xi = 1, we get that each non-zero xi = 1/ℓ. Let H denote the set of indices i which have non-zero xi values. Then the objective value corresponding to this BFS x is E(H)/ℓ = d(H). Thus we have proven that d(H) > VAL(LP4) > VAL(CP1) = VAL(LP3), as required. This completes the proof of Theorem 3. ◭ Remarks about the proof: We remark that the objective in the convex program CP1 is precisely the Lovász Ex- tension Lf (x) for the specific function f = E(S). Thus our proof shows that the LP provided by Charikar [6] is precisely the Lovász Extension for the specific supermodular function E(S). Note that there are other proofs possible for this result. For instance, one can follow the basic argument of Charikar to show that LP3 satisfies d(H ∗) = VAL(LP3). The proof we provide above is new, and is inspired by the work of Iwata and Nagano [13]. Via our proof, we also prove that any BFS for the basic graph density LP has the property that all the non-zero values are equal. This fact is not new: it was proven by Khuller and Saha [14] but we believe our proof of this fact is more transparent. Second Proof: Again, let us consider the program LP3. Similar to the above, it will suffice to prove that the BFS solutions to this LP have the property that all non-zero components are equal. Consider the constraint matrix B that consists of the LHS of the non-trivial constraints in the above LP, without the constraint Pi xi = 1. Thus B consists of rows for the constraints ye 6 xi (for e ∈ E : e ∼ i) and the constraints xi 6 xj for (i, j) ∈ ~A. The matrix B is TUM: this is because it can easily be realised as the incidence matrix of a digraph. Thus the original constraint matrix consists of the matrix B augmented by a single (non- trivial) constraint, consisting of the sum of the xi's being equal to 1; and also the (trivial) 14 Density Functions nonnegativity constraints xi ≥ 0 and ye ≥ 0. Let B′ denote this augmented matrix. Note that B′ need not be TUM. Consider a basic feasible solution (BFS) ev = (y1, · · · , ye, · · · , ym, x1, · · · , xi, · · · , xn). Since ev consists of (m + n) variables, there are (m + n) constraints in the constraint matrix B′ that are tight. Consider the submatrix T formed by the tight constraints in the matrix B′. Since the constraint Pi xi = 1 is always tight, this will be included as a row in the matrix T . Without loss of generality, let this row be the last row r of T . Thus, ev is the unique solution to the linear system T v = b, where bT = (0, 0, · · · , 0, 1). Note that, by previous considerations, the submatrix T ′ of the matrix T consisting of all the rows of T but the last one, is TUM (since T ′ is then a submatrix of the matrix B). The sth component (for 1 ≤ s ≤ (m + n)) of ev may be found by Cramer's rule as evs = det(Ts) det(T ) , where Ts is the matrix T with the sth column replaced by the vector b. Note that det(T ) is at most V (G) = n. This is because the row r has at exactly n 1's, so we may expand the determinant by row r. Any sub-determinant to be computed in this row-wise expansion of the determinant is a submatrix of T , thus is TUM. Therefore, det(T ) is a sum of at most n +1's and −1's thus, is (say) k where k ≤ n. Consider the computation of det(Ts). The matrix Ts has its sth column replaced by the vector b, which has precisely one 1. So we may expand the determinant of Ts by its sth column, and thereby, the determinant is that of a square submatrix of the matrix T . This means that det(Ts) is 0, 1 or −1. Thus, every component of ev is precisely 0 or 1 LP is ≥ 0, thus the third possibility is excluded. This completes the proof. k , or − 1 k . However every component in the ◭ 5.1 Arbitrary monotone supermodular functions: We now proceed to consider the case where we are given an arbitrary monotone supermodular function f over the universe U and a directed graph D = (U, ~A), where the arcs in ~A specify the dependencies. To extend our results to this, we will need the concept of the Lovász Extension. The Lovász Extension Lf : [0, 1]U → R, first defined by Lovász, is an extension of an arbitrary set function f : 2U → R. We proceed with the formal definition: ◮ Definition 10. (Lovász Extension) Fix x ∈ [0, 1]U , and let U = {v1, v2, · · · , vn} be such that x(v1) ≥ x(v2) ≥ · · · ≥ x(vn). For 0 ≤ i ≤ n, let Si = {v1, v2, · · · , vi}. Let {λi}n i=0 be the unique coefficients with λi ≥ 0, and Pi λi = 1 such that: x = nX i=0 λi1Si It is easy to see that λn = x(vn), and for 0 ≤ i < n, we have λi = x(vi) − x(vi+1) and λ0 = 1 − x(v1). The value of the Lovász Extension of f at x is defined as Lf (x) = X λif (Si) i For motivation behind the definition, refer to the excellent survey on submodular func- tions by Dughmi [7]. The Lovász Extension enjoys the following properties: Lf is concave iff f is supermodular. If f is supermodular, the maximum value of f (S) is the same as the maximum value of Lf (x). V. Chakaravarthy et. al 15 Restricted to the subspace x1 ≥ x2 ≥ · · · ≥ xn, the function Lf is linear. We are now ready to describe our convex program CP for computing the densest subset of the universe U subject to dependency constraints. For details on convex programming, one may consult the text [4]. The program has variables x1, x2, · · · , xn corresponding to the elements i ∈ U . Since f (S) is supermodular, the corresponding Lovász Extension LE(x) is concave. max L(x) CP : s.t. hx,~1i = 1 xi 6 xj xi > 0 for all (i, j) ∈ ~A for all i ∈ V (G) . This convex programming problem can be solved to arbitrary precision in polynomial time by the ellipsoid method (see [12]). 1 > x∗ As in the first proof above, we will relabel the elements of the universe so that x∗ 2 > n. But now, by the property of the Lovász Extension, we see that L(x) is a linear · · · > x∗ function in this subspace. Now, the rest of the first proof carries over and gives us the result for arbitrary monotone supermodular f . 5.2 Proof of Corollary 6 There are many ways to see this. One way is to consider the convex program above for the Lovász Extension of the monotone supermodular function f . max L(x) CP2 : s.t. hx,~1i = 1 xi > xi+1 xn > 0 for all i ∈ {1, 2, · · · , (n − 1)} . As in the proof above, we can see that this has solutions x∗ where all the nonzero xi's are equal, and that this corresponds to choosing a subset S so that L(x∗) = f (S)/S. Thus, we see that maxS f (S)/S is computable in polynomial time. Yet another way of verifying Corollary 6 is to consider the sequence of functions g(α, S) , f (S) − αS (for fixed α > 0). Note that each g(α, S) is supermodular for any fixed α, and so can be maximized in polynomial time. Also observe that if maxS f (S)/S > α for some α, then maxS g(α, S) > 0. Conversely, if maxS f (S)/S 6 α then maxS g(α, S) 6 0. Thus, we can find maxS f (S)/S by a binary search over α and maximizing the corresponding functions g(α, S). 6 Proof of Theorem 4 To fix the notation, in this problem, we are given a monotone supermodular function f over a universe U , a matroid M = (U, I), and a set A ⊆ U . 16 Density Functions The only modification that we have to make to Algorithm 1 is that we will choose the first set H1 such that H1 maximizes the density of all subsets that contain the set A. Note that we can do this in polynomial time. Apart from this, the construction of the sets H2, H3, · · · , HL and the sets D1, D2, · · · , DL are the same as in Algorithm 1. So, each Di contains A, and the candidate feasible solutions D′ i also contain A. The analysis of the modified algorithm is the same as in Section 3. Thus we obtain a 2-approximation algorithm as promised in Theorem 4. 7 Open Problems One interesting open direction is to investigate the maximization of density functions subject to combinations of constraints. In this paper, we consider the combination of a single matroid and a subset constraint. In general, one could ask similar questions about combinations of multiple matroid constraints or a matroid and a dependency constraint for instance. Another open question is to derive a LP-based technique to prove the result in Theorem 1. References 1 Noga Alon and Joel H. Spencer. The Probabilistic Method. Wiley, New York, 1992. 2 Reid Andersen and Kumar Chellapilla. Finding dense subgraphs with size bounds. In WAW, pages 25 -- 37, 2009. 3 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. In STOC, pages 201 -- 210, 2010. Stephen Boyd and Lieven Vandenberghe. Convex Optimization. Cambridge University Press, 2004. 4 5 Gruia Călinescu, Chandra Chekuri, Martin Pál, and Jan Vondrák. Maximizing a monotone submodular function subject to a matroid constraint. SIAM J. Comput., 40(6):1740 -- 1766, 2011. 6 Moses Charikar. Greedy approximation algorithms for finding dense components in a graph. 7 In APPROX, pages 84 -- 95, 2000. Shaddin Dughmi. Submodular functions: Extensions, distributions, and algorithms. a survey. CoRR, abs/0912.0322, 2009. 8 Yuval Filmus and Justin Ward. A tight combinatorial algorithm for submodular maximiz- ation subject to a matroid constraint. In FOCS, 2012. 9 Amita Gajewar and Atish Das Sarma. Multi-skill collaborative teams based on densest subgraphs. In SDM, pages 165 -- 176, 2012. 10 Michel X. Goemans and José A. Soto. Symmetric submodular function minimization under hereditary family constraints. CoRR, abs/1007.2140, 2010. 11 Andrew V. Goldberg. Finding a maximum density subgraph. Technical report, UC Berke- ley, 1984. 12 Martin Grötschel, László Lovász, and Alexander Schrijver. The ellipsoid method and its 13 consequences in combinatorial optimization. Combinatorica, 1(2):169 -- 197, 1981. Satoru Iwata and Kiyohito Nagano. Submodular function minimization under covering constraints. In FOCS, pages 671 -- 680, 2009. Samir Khuller and Barna Saha. On finding dense subgraphs. In ICALP, 2009. 14 15 Barna Saha, Allison Hoch, Samir Khuller, Louiqa Raschid, and Xiao-Ning Zhang. Dense In RECOMB, subgraphs with restrictions and applications to gene annotation graphs. pages 456 -- 472, 2010. 16 A. Schrijver. Combinatorial Optimization - Polyhedra and Efficiency. Springer, 2003. V. Chakaravarthy et. al 17 17 Alexander Schrijver. A combinatorial algorithm minimizing submodular functions in strongly polynomial time. J. Comb. Theory, Ser. B, 80(2):346 -- 355, 2000. 18 D.M. Topkis. Supermodularity and Complementarity. Princeton University Press, 1998.
1704.04538
2
1704
2017-04-21T13:01:58
A Simple Randomized Algorithm to Compute Harmonic Numbers and Logarithms
[ "cs.DS" ]
Given a list of N numbers, the maximum can be computed in N iterations. During these N iterations, the maximum gets updated on average as many times as the Nth harmonic number. We first use this fact to approximate the Nth harmonic number as a side effect. Further, using the fact the Nth harmonic number is equal to the natural logarithm of N plus a constant that goes to zero with N, we approximate the natural logarithm from the harmonic number. To improve accuracy, we repeat the computation over many lists of uniformly generated random numbers. The algorithm is easily extended to approximate logarithms with integer bases or rational arguments.
cs.DS
cs
A Simple Randomized Algorithm to Compute Harmonic Numbers and Logarithms Ali Dasdan KD Consulting Saratoga, CA, USA [email protected] October 19, 2018 Abstract Given a list of N numbers, the maximum can be computed in N iterations. During these N iterations, the maximum gets updated on average as many times as the Nth harmonic number. We first use this fact to approximate the Nth harmonic number as a side effect. Further, using the fact the Nth harmonic number is equal to the nat- ural logarithm of N plus a constant that goes to zero with N, we approximate the natural logarithm from the harmonic number. To improve accuracy, we repeat the computation over many lists of uni- formly generated random numbers. The algorithm is easily extended to approximate logarithms with integer bases or rational arguments. 1 Introduction We approximately compute the harmonic number and the natural logarithm of an integer as a side effect of computing the maximum of a list of x numbers randomly drawn from a uniform distribution. The key point of this compu- tation is that it basically uses only counting. To improve accuracy, we repeat the computation multiple times and take the average. Using the basic prop- erties of the natural logarithm function, it is simple to extend the algorithm to approximate the logarithms with integer bases or rational arguments. The details follow. 1 2 Computing the Maximum Figure 1: A Python function to compute the maximum over a list of x numbers in the interval [0.0, 1.0), where x > 0. Given a list of x numbers in the interval [0.0, 1.0), where x > 0, the algo- rithm (written in the Python programming language) in Figure 1 computes the maximum in x iterations. It is well known that during these iterations, the maximum gets updated Hx times on average, where Hx is the xth har- monic number [1]. The reason for this fact is that in a list of x numbers randomly drawn from a uniform distribution, each number has a probability of 1/x of being the maximum. 3 Computing the Harmonic Number and the Natural Logarithm The xth harmonic number Hx is defined as the series x(cid:88) i=1 Hx = 1 i = ln(x) + γ + x (1) where γ is the Euler-Mascheroni constant (roughly equal to 0.57721) and x, which is in the interval ( 2x), approaches 0 as x goes to infinity [2]. 1 2(x+1) , 1 We can rewrite this equation to compute ln(x) as ln(x) = Hx − γ − x. (2) This means an approximation to Hx can be converted to an approximation to ln(x). The algorithm (written in the Python programming language) is given in Figure 2. The inner loop computes the maximum over x uniformly random 2 Figure 2: A Python function to approximate the natural logarithm as an average over n iterations of the maximum computation. Each maximum computation goes over x uniformly random numbers and produces a new approximation to the xth harmonic number Hx. numbers. The outer loop with n iterations is for accuracy improvement; it computes an approximation to Hx every iteration as a side effect of the max- imum computation rather than the result of the summation in Equation 1. This Hx computation is an approximation due to two reasons: 1) Hx is never an integer except for x = 1 [2], and 2) it is a probabilistic estimate. After these loops exit, the final Hx is set to the average over all these approx- imations. The natural logarithm is then approximated at the end of this algorithm using Equation 2, where we set x to its upper bound of 1/(2x). 4 Results Some results from limited experiments as shown in Figure 3 indicate that the approximation quality is relatively good especially with larger arguments. In this figure, the approximate ln(x) is the value computed by the algorithm in the previous section and the library ln(x) is the log function from the Python Math library. 3 Though we used 1000 repetitions for the results shown, separate limited experiments show that the approximation quality gets better after as low as 10 repetitions. Figure 3: The approximation results on powers of 4 from 1 to 8 with 1000 iterations. The library ln(x) is math.log() from Python's math library. Both relative and absolute errors are small. Relative error decreases with larger inputs. Note that we multiplied the absolute error by 10 to make it visible in this plot. 5 Pros and Cons This algorithm to approximate the harmonic number and the natural loga- rithm takes time proportional to the product of x and n. Even for n = 1, the time is linear in x. As such, this is probably not an efficient way of computing the harmonic number or the natural logarithm. What is the use of this algorithm then? One reason, possibly the main reason, why this algorithm may be inter- esting is that it approximately computes a function that occurs in its own time complexity analysis. Here the functions are the harmonic number as well as the natural logarithm. Another reason is that this algorithm uses integer arithmetic only except for the final averaging and error computation. Finally, this algorithm is easily parallelizable since the maximum of a list is equal to the maximum over the maximums of parts of the list. 4 In the technical literature, there are of course many formulas and algo- rithms for computing both functions [2]. This is expected as the harmonic number and the natural logarithm are so fundamental. This paper is not meant to provide any comparisons with those algorithms or to claim that it is better; it is mainly a fun application on the use of the side effect of a well known and simple algorithm, namely, the maximum computation. 6 Conclusions We provide a simple algorithm that exploits the time complexity expression of the maximum computation of a list of numbers to approximate the harmonic number and then using it to approximate the natural logarithm. Limited experiments show that the approximations are good with small relative and absolute errors. We hope others may find this algorithm interesting enough to study and potentially improve. At a minimum this paper might hopefully inspire some exercises for students of a basic algorithms book like [1]. References [1] T. Cormen, C. S. R. Rivest, and C. Leiserson. Introduction to Algorithms. McGraw-Hill Higher Education, 2nd edition, 2001. [2] J. Sondow and E. Weisstein. Harmonic number. MathWorld -- A Wolfram Web Resource. Wolfram, Apr http://mathworld.wolfram.com/HarmonicNumber.html. In From 2007. 5
1208.5247
1
1208
2012-08-26T20:03:04
Faster Clustering via Preprocessing
[ "cs.DS", "cs.CG" ]
We examine the efficiency of clustering a set of points, when the encompassing metric space may be preprocessed in advance. In computational problems of this genre, there is a first stage of preprocessing, whose input is a collection of points $M$; the next stage receives as input a query set $Q\subset M$, and should report a clustering of $Q$ according to some objective, such as 1-median, in which case the answer is a point $a\in M$ minimizing $\sum_{q\in Q} d_M(a,q)$. We design fast algorithms that approximately solve such problems under standard clustering objectives like $p$-center and $p$-median, when the metric $M$ has low doubling dimension. By leveraging the preprocessing stage, our algorithms achieve query time that is near-linear in the query size $n=|Q|$, and is (almost) independent of the total number of points $m=|M|$.
cs.DS
cs
Faster Clustering via Preprocessing∗ Tsvi Kopelowitz Robert Krauthgamer Weizmann Institute of Science {tsvi.kopelowitz,robert.krauthgamer}@weizmann.ac.il October 26, 2018 Abstract We examine the efficiency of clustering a set of points, when the encompassing metric space may be preprocessed in advance. In computational problems of this genre, there is a first stage of preprocessing, whose input is a collection of points M ; the next stage receives as input a query set Q ⊂ M , and should report a clustering of Q according to some objective, such as 1-median, in which case the answer is a point a ∈ M minimizing Pq∈Q dM (a, q). We design fast algorithms that approximately solve such problems under standard clustering objectives like p-center and p-median, when the metric M has low doubling dimension. By leveraging the preprocessing stage, our algorithms achieve query time that is near-linear in the query size n = Q, and is (almost) independent of the total number of points m = M . 2 1 0 2 g u A 6 2 ] S D . s c [ 1 v 7 4 2 5 . 8 0 2 1 : v i X r a ∗This work was supported in part by The Israel Science Foundation (grant #452/08), by a US-Israel BSF grant #2010418, and by the Citi Foundation. 1 Introduction Clustering is a ubiquitous computational task of prime importance in numerous applications and domains, including machine learning, image processing, and bioinformatics. While the clustering problem has several variations, it often falls within the following framework of metric clustering: given a set of points Q in a metric space (M, d), choose a set of centers C (in that same metric space) so as to minimize some objective function of Q and the centers C. For example, in the p-median problem, the goal is to find a set of p centers C ⊆ M that minimizes the objective med(Q, C) := Pq∈Q d(q, C), where we define d(q, C) := minc∈C d(q, c). Our focus here is on understanding whether an initial preprocessing stage can speed up the process of (metric) clustering. Concretely, we are interested in algorithms for efficient clustering of Q when the metric M can be preprocessed in advance. Throughout, we denote the number of center candidates by m = M , and the number of query points by n = Q. The goal is to answer queries with time close to linear in n and (almost) independent of m. To our knowledge, no previous research on (metric) clustering problems has addressed the issue of preprocessing. Past work has largely focused on the offline problem, where the entire input is given at once, either because M is implicit (e.g., a Euclidean space) or because M is given together with Q (called discrete centers). Other past work studied the online version, where points arrive one by one (the data-stream model). Clustering with preprocessing can model, for example, the following scenario. Consider a huge corpus of documents (M ) with distances between the documents (d) defining a metric space. Given a relatively small subset of the documents (Q), we may wish to quickly cluster them using centers from the corpus. Since preprocessing needs to be done only once, it has the benefit that even a huge corpus can be processed, by pooling together many machines or by running it for several days. The first problem we consider is the p-median problem defined above. A second problem of interest, called p-center, is to find a set of p centers C ⊆ M that minimizes the objective cntr(Q, C) := maxq∈Q{d(q, C)}. Observe that when n = 1 and p = 1, both the p-median and p-center problems receive a sin- gle input point q and seek the point of M that is closest to q, which is precisely the famous nearest neighbor search (NNS) problem. Even for this special case of NNS (i.e., n = p = 1), Krauthgamer and Lee [KL04a] have shown that achieving approximation factor better than 7 5 in a general metric requires query time that depends on the doubling dimension of the metric, regard- less of the preprocessing. (Throughout, we denote the doubling dimension by ddim = ddim(M ); see Section 1.4 for a formal definition.) It thus follows that for general n and p, one must con- sider metrics M whose doubling dimension is bounded, and we indeed assume as such. We also assume that computing the distance between two points takes O(1) time. This whole approach follows an established line of research that covers a host of problems including nearest neighbor search [KL04b, HM06, BKL06, CG06] as well as routing, distance estimation, the traveling sales- man problem and classification see e.g. [AGGM06, KRX08], [KSW09, Sli07], [Tal04, BGK12], and [BLL09, GKK10]. 1 1.1 Results We provide the first clustering algorithms that leverage a preprocessing stage to obtain improved query time. Specifically, we design algorithms that compute (1+ε) -- approximation for the p-median and p-center problems; the precise time and space bounds are presented in Table 1. Observe that the query time is near-linear in n and is (almost) independent of M , assuming the other parameters (ε−1, p and ddim) are small. For sake of simplicity, we let our results depend on the aspect ratio of M , denoted ∆ = ∆(M ). Such bounds can usually be refined, replacing e.g. log ∆ terms with log n, by adapting our algorithms using known techniques and data structures, but it would clutter the presentation of our main ideas. Interestingly, we use essentially the same data structure for all problems solved. All our space bounds are expressed in terms of machine words, which as usual can accommodate a pointer to a data point or a single distance value. Problem 1-median Theorem 4.1 p-median Theorem 7.1 p-center Theorem 6.1 Preprocessing time Space Query Time 2O(ddim)m log ∆ log log ∆ 2O(ddim)m O(n log n + 2O(ddim) log ∆ + ε−O(ddim)) 2O(ddim)m log ∆ log log ∆ 2O(ddim)m 2O(ddim)m log ∆ log log ∆ 2O(ddim)m O(n log n + ε−O(p·ddim)(p log n)O(p) + ε−O(ddim)(p log n)O(1) · log log log ∆) O(n log n + p log log log ∆ + pp+1 · ε−O(p·ddim)) Table 1: Our algorithms for (1 + ε) -- approximation of clustering problems. We point two possible extensions of our results. First, one may ask about updates to M , i.e., inserting and deleting points. Our data structure is similar to previous work on NNS, and thus we expect the methods known there (see e.g. [KL04b]) to apply also in our case, although we did not check all the details. Second, we assume throughout that Q ⊂ M . One may remove this restriction, possibly adapting the definition of ddim and ∆ to refer to M ∪ Q. Again, we have not checked the details, but we expect this is possible by roughly applying the procedure of inserting Q to M before executing the query Q, except that now we cannot use points of Q \ M as centers. Our bounds for clustering with preprocessing are in a new model that was not studied before, and thus cannot be compared directly with previous work. But of course, all of our results immediately imply also algorithms for the respective offline problems, where the input includes both Q and M . Since our preprocessing time is near linear in m, these are pretty efficient as well. Even for the offline problems, our results are new, as we are not aware of previous work on clustering (p-median and p-center) in metric spaces of bounded doubling dimension. Notice that a naive algorithm, which exhaustively tries all possible sets of centers (with no preprocessing) finds an optimal solution but takes runtime (cid:0)m p(cid:1)np, which is significantly higher even for p = 1. Another possible comparison is with the respective Euclidean problems; this is only for the sake of analogy and is discussed in Section 1.3. We also point out that our 1-median algorithm is deterministic, while previous algorithms achieving (1+ ε) -- approximation for 1-median, even in Euclidean metrics, are randomized [Ind99, BHI02, KSS10]. 2 1.2 Techniques Our algorithms build on several techniques from prior work. The common algorithmic paradigm for the NNS problem in metrics with low doubling dimension [KL04b, HM06, BKL06, CG06] (which in our context is just the special case p = n = 1), is to look for an answer (center point) by restricting attention to a sequence of search balls, whose radii are decreasing, usually by a constant factor. When the ball's radius becomes small enough, the algorithms revert to exhaustively trying a small set of candidates inside the search ball, with the property that at least one candidate in the set must be a good enough approximation to an optimal answer. Such a set of candidates is sometimes called a centroid set [HM04]. We follow this paradigm, but extend and modify it for our needs. We further borrow a technique of constructing a coreset [BHI02], which essentially assigns points in Q to a small set of "representatives" R, so that solving the clustering problem on the weighted set R provides a good approximation for clustering Q. The weight of a representative r ∈ R is simply the number of query points q ∈ Q assigned to it. In contrast to previous work on coresets and on centroid sets, we have the leverage of preprocessing M , and our challenge is to quickly construct such sets for Q during query time. We also devise a new technique (new at least in the context of our clustering problems) of "projecting" the data structure constructed for M (during preprocessing) onto the query set Q ⊂ M . While a data structure for Q can be constructed from scratch in time 2O(ddim)n log n, the projection can be constructed even faster, in time O(n log n). But even more importantly, the projected data structure inherently provides hooks into the larger set M , and these hooks are crucial for our goal of locating centers in M , which is (generally) a much richer point set than Q. 1.3 Related Work Metrics with bounded doubling dimension are known to generalize Euclidean metrics of fixed- dimension. Below we briefly mention known algorithms achieving (1 + ε) -- approximation for the p-median and p-center problems in Euclidean spaces of fixed dimension D. These are only intended to be a crude analogy to our results, possibly providing yet another perspective. Often, different tradeoffs are possible between the number of centers p and the dimension D. We do not discuss approximation algorithms for general metrics, as these do not achieve (1 + ε) -- approximation. We start with the p-median problem. Arora, Raghavan and Rao [ARR98] were the first to obtain (1 + ε) -- approximation, via a divide-and-conquer approach based on quadtrees and dynamic programming. This approach was later improved by Kolliopoulos and Rao [KR07] and by Badoiu, Har-Peled, and Indyk [BHI02]. Har-Peled and Mazumdar [HM04] added another technique of find- ing coresets, and obtained running time O(n + pp+2ε−(2D+1)p logp+1 n logp 1 ε ). Kumar, Sabharwal, and Sen [KSS10] showed a different approach, based on finding centroid sets, that runs in time 2(p/ε)O(1) n. These approaches were later combined by Chen [Che06], who obtains improved runtime when the dimension D is large. For the p-center problem, Agarwal and Procopiuc [AP02] obtain (1 + ε) -- approximation in time O(n log p) + (p/ε)O(Dp1−1/D ). Badoiu, Har-Peled, and Indyk [BHI02] show an algorithm that runs in time pO(p/ε2)Dn. 3 1.4 Preliminaries Let (M, d) be a finite metric space. The doubling dimension of M , denoted ddim = ddim(M ), is the smallest k > 0 such that every ball (in M ) can be covered by 2k balls of half the radius. We denote the diameter of the metric by diam(M ) := maxx,y∈M d(x, y), and its aspect ratio (or spread) by ∆(M ) := max{d(x,y): x,y∈M } min{d(x,y): x6=y∈M } . Let r > 0. An r-net of a point set S ⊂ M is a subset N ⊆ S satisfying: (a) packing property: for all x, y ∈ N we have d(x, y) ≥ r; and (b) covering property: for all x ∈ S we have d(x, N ) < r. 1 Such a net always exists, and can be constructed greedily by considering the points one by one in an arbitrary order. 2 Our Data Structure The Net Hierarchy. Our data structure is based on a lot of previous work on algorithms and data structures for doubling metrics, in particular for nearest neighbor search [KL04b, HM06, BKL06, CG06]. But despite the overall similarity, some technical details differ slightly from each of those papers. Let itop := ⌈log2 diam(M )⌉, and assume for simplicity that the minimum interpoint distance in M is minx6=y∈M d(x, y) = 1 (otherwise we need to introduce ibot as its logarithm). Let Y0 = M , and for i = 1, . . . , itop let Yi be a 2i-net of Yi−1. Note that it is not necessarily a 2i- net of M , but it does cover M indirectly via the nets at lower levels. We sometimes refer to Yi as the level i net. By definition, Yi ⊆ Yi−1, so when we refer to y ∈ Yi we mean the copy of y which is in Yi. These nets form a natural hierarchy, with Y0 being on the bottom, and a singleton Yitop = {ytop} at the top of the hierarchy. This hierarchy may be represented by a directed acyclic graph GM , whose vertex set is the union of all the nets Yi (so a point y ∈ M may have multiple copies in this graph), and with an arc from every yi ∈ Yi to every yi−1 ∈ Yi−1 for which d(yi, yi−1) ≤ 2i. We prefer not to maintain the graph GM explicitly; instead, our data structure has two main components, a tree T and a collection of c-lists, which are defined below. The Tree T . The hierarchy is represented by a tree that is defined as follows. First construct GM as explained above. Next, every node in GM keeps only one of its incoming arcs that is chosen arbitrarily except for giving higher priority to the arc coming from another copy of the same point of M (if it exists). The surviving arcs define (when ignoring the edge orientations) a tree, denoted T = TM , which is rooted at ytop. Because of the prioritization rule, whenever a point y ∈ Yi has only one child in the tree T , this child must correspond to the same point y but in Yi−1. Thus, every non-branching path in T consists of copies of the same point in M in consecutive nets. By contracting each such path while recording the range of nets in which it participates, we can store the tree T more compactly, using only O(m) space (recall the tree has m leaves). However, as explained a bit later, we actually employ a more limited compaction, that results with a weaker space bound 2O(ddim)m. We supplement T with a data structure that supports constant-time lowest common ancestor (LCA) queries using an additional 2O(ddim)m words [HT84] (see also [BF00] for a simplified ver- sion). For the 1-center and p-center algorithms, we supplement T also with a data structure for weighted level ancestor queries [FM96, KL07], which locate an ancestor of q ∈ M at level i (i.e., 1Another common definition has a strict inequality in condition (a) rather than in (b). Our analysis can be adapted to this definition by changing constants. 4 in Yi) in O(log log log ∆) time. The preprocessing for the weighted level ancestor queries requires 2O(ddim)m log log log ∆ time. The c-Lists. For some constant c ≥ 1 that will be determined later, we maintain for every net point y ∈ Yi a so-called c-list Ly,i,c := {z ∈ Yi−1 : d(y, z) ≤ c · 2i}. The c-lists allow us to traverse the ball of radius c2i in the next level of the hierarchy. If c = 1, this list can be viewed as the set of arcs leaving y ∈ Yi in GM . When c ≥ 1, these lists can be used (via straightforward filtering) to recover the arcs of GM . Since c is an absolute constant, the size of each c-list is at most cO(ddim) ≤ 2O(ddim) (see e.g. [GKL03, KL04b]). We do not store the c-list explicitly for every point in every net, as this might require too much space. We say that a c-list of a point y ∈ Yi is trivial if it has size 1, in which case the only point in this list must be the copy of y in Yi−1. We store only nontrivial c-lists, the number of which is at most 2O(ddim)m [KL04b, Theorem 2.1]. It follows that the total space usage for the c-lists is 2O(ddim)m. The nontrivial c-lists also limit the compaction of the tree T as follows. We compact T only along paths whose nodes are both non-branching and have trivial c-lists. By the above bound on the number of nontrivial c-lists, our limited compaction of T uses at most 2O(ddim)m space. Preprocessing time. The preprocessing stage first employs the data structure of [KL04b] to construct the c-lists in 2O(ddim)m log ∆ log log ∆ time, by simply inserting the data points one after the other. We then scan this structure, from top to bottom, to introduce direct pointers as dictated by the c-lists (i.e., from Ly,i,c to relevant Lz,i−1,c), and also construct the tree T in its compacted version. This entire process takes 2O(ddim)m log ∆ log log ∆ time. Projected Tree. A key tool in getting faster runtime is a projection of the tree T = TM onto a subset of points Q ⊆ M . The idea is to consider the subtree of T induced by the leaves that are points in Q. We will denote this projected tree T Q. Observe that this projected tree might be very different from the tree TQ that would be constructed for Q independently of M ; in particular, the latter cannot contain points from M \ Q. In the interest of runtime, we maintain the projected tree somewhat implicitly; what the data structure stores explicitly is a compacted version, in which all non-branching paths of T Q are contracted, and this clearly uses only O(n) space. Notice that such a contracted path of T Q might contain nodes that are branching in T , which possibly correspond to distinct data points in M . Although we have only the compacted version of T Q at hand, we can implement a traversal down the un-compacted tree T Q, as described in Lemma 2.2. To aid in the construction of the projected tree, we number the leaves of T in depth-first search (DFS) order. In addition, for every node u ∈ T Q we denote by wt(u) the number of leaves in its subtree. We can compute the weight of all the nodes in T Q in time O(n) by a simple scan. Lemma 2.1. When a query Q is given, the compacted version of T Q can be computed in time O(n log n). Proof (Sketch). To create T Q, first sort Q according to the DFS numbering. Notice that the order in which points from Q are encountered when performing a DFS on T is exactly the order in which they would be encountered had we performed a DFS on T Q. Hence the sorted Q gives us this 5 order. We now use LCA queries to simulate the DFS on T Q, in order to construct T Q. This is done as follows. Denote by Qi ⊆ Q the first i − 1 points in the ordered Q. We scan Q by the DFS order, and when we reach the ith point, say qi ∈ Q, we assume we have already constructed T Qi−1 on the first i − 1 points of Q. We now wish to insert qi to this tree to obtain T Qi. To do this, compute u = LCA(qi−1, qi). This node u, which has to be part of T Qi, is either on the path from the leaf corresponding to qi to the root of T Qi−1, or is an ancestor of the root of T Qi−1. To locate its exact position, we traverse T Qi−1 from the leaf corresponding to qi−1 upwards towards the root, testing at each node v if this is the location into which u should be inserted. The testing at v is performed via an LCA query between v and u. If the LCA query returns u, then the traversal needs to continue. If not, then u is inserted as a child of v, either breaking an edge or inserting a new leaf. The entire process simulates the DFS search on T Q and hence takes O(n) time. The next lemma is used to traverse the un-compacted tree T Q while using the data structure of its compacted version. Lemma 2.2. Given the compacted T Q, a node v in the un-compacted version of T Q together with its weight wt(v), and node w which is the closest descendant of v in the compacted T Q (and could possibly be v itself ), it is possible to locate the children of v in the un-compacted T Q, together with their weights, in time 2O(ddim). Proof. Suppose first that v is a branching node in T Q. For each child u of v in the compacted tree T Q, we find the respective child of v in the un-compacted T Q as follows: Run an LCA query between u and every child of v in T . All of those queries will return v, except for one query that will return the required child of v in the un-compacted tree (the one that is also an ancestor of u). The total time for all such queries is 2O(ddim). Suppose next that v is a non-branching node, and hence is not a part of the compacted version of T Q. We find the child of v that is an ancestor of w in the un-compacted tree as follows: Perform an LCA query between w and each of v's children in T . All of those queries will return v, except for one query that will not return v, but rather the child of v that is also an ancestor of w, denoted by w′. Notice that in this case, w is also the closest descendant of w′ in the compacted T Q, which is needed to continue our traversal and proceed to w′. Standard Operations on the Net Hierarchy. A basic operation in a net hierarchy is a recur- sive scan, where given a point yi ∈ Yi, we scan its c-lists and apply the same procedure recursively on these points. During this process, we discard any duplicates we find (e.g., if we reach the same point in Yi−2 via different points in Yi−1). Definition 2.1. Let y ∈ Yi. A point x ∈ M is called a c-list-descendant of y if it can be reached from y using a recursive scan of the c-lists. We then also say that y is a c-list-ancestor of x. Lemma 2.3. Let y ∈ Yi, and let x ∈ Yj be a c-list-descendant of y. Then d(x, y) ≤ c2i+1 − c2j+1. Proof. The proof is by induction on i − j. The base case is trivial. For the inductive step, for every y ∈ Yi, the distance between y and any of the points in its c-list is at most c2i. For every x ∈ Yj which is a c-list-descendant of y, there exists a yi−1 ∈ Ly,i,c such that x is a c-list-descendant of yi−1. Therefore, d(x, y) ≤ d(x, yi−1) + d(yi−1, y) ≤ c2i − c2j+1 + c2i = c2i+1 − c2j+1. Notice that a point x can be a c-list-descendant of y even if in the tree T it is not a descendant of y. However, ancestors and descendants in T also have bounds on the distance between them. 6 Lemma 2.4. Let y be an ancestor of x in T , such that y ∈ Yi and x ∈ Yj, where i > j. Then d(x, y) ≤ 2i+1 − 2j+1 < 2i+1. Proof. The distance between a parent from Yi and its child in T is at most 2i. Therefore, by summation on the path from y to x in T , and the triangle inequality d(x, y) ≤ Pi k=j+1 2k = 2i+1 − 2j+1. The following lemma is crucial to searching the vicinity of a given point with some refinement factor ε > 0, by executing a recursive scan with limited depth. This process will be used several times in our various algorithms. Lemma 2.5 (Descendents Search with Refinement ε). Let y ∈ Yi and x ∈ M be such that d(x, y) ≤ 2i, and suppose c ≥ 3. Then for every refinement constant 0 < ε ≤ 1/2, a recursive scan of c-lists that stops at level i − log(1/ε) will traverse a point x′ ∈ Yi−log(1/ε) for which d(x, x′) ≤ ε2i. In addition, the number of points traversed in such a scan is at most ε−O(ddim). Proof. Let xε be the ancestor of x in T who is in the Yi−log(1/ε) net, and so by Lemma 2.4 we have that d(x, xε) ≤ 2i−log 1 ε + 1 ≤ j ≤ i and every yj ∈ Yj such that d(x, yj) ≤ 2j+1, the recursive scan of c-lists from yj will reach xε. This will suffice as for every x such that d(x, y) ≤ 2i, we also have d(x, y) ≤ 2i+1. For the base case, j = i − log 1 ε + 1, and so d(yj, xε) ≤ d(yj, x) + d(x, xε) ≤ 2j+1 + 2j ≤ c2j, and so xε is in the c-list for yj. ε +1. We prove by induction that for every i − log 1 For the induction step, assume that the claim is correct for j − 1. Consider xj−1 ∈ Yj−1 which is the ancestor of xε in T , and therefore is also an ancestor of x. Then by Lemma 2.4, d(x, xj−1) ≤ 2j and by the induction hypothesis, a recursive scan on the c-lists starting from xj−1 will reach xε. Then d(xj−1, yj) ≤ d(xj−1, x) + d(x, yj) ≤ 2j + 2j+1 ≤ c2j, and so a recursive scan on the c-lists starting from yj must go through xj−1 and eventually reach xε. The number of points traversed can be bounded as follows. Each point x not in Yi−log(1/ε) that is encountered needs to scan its c-list which is of size 2O(ddim). So at k levels beneath y we scan at most 2O(ddim ·k) points. The last level scanned is when k = log 1 ε , so using a geometric series we obtain that the total number of points scanned is 2O(ddim · log(1/ε)) = ε−O(ddim). 3 A Simple Algorithm for 1-median In this section we provide a simple iterative algorithm for 1-median, for the purpose of explaining the basic approach used by our main result for 1-median in Section 4. This basic approach is similar, but not identical, to the known algorithms for NNS [KL04b, HM06, BKL06, CG06]. We remark that there is a well-known randomized algorithm that achieves an (expected) 2 -- approximation for 1-median by picking a random point from Q to be the center. Below, we present a deterministic 6 -- approximation algorithm, which has the advantage that it is then easily refined to achieve (1+ε) -- approximation. Unlike that randomized algorithm, ours can probably be adapted to the case where Q need not be a subset of M (or alternatively, when the center must come from M \ Q). Theorem 3.1. There is an algorithm that preprocesses a finite metric M in 2O(ddim)m log ∆(M ) log log ∆(M ) time using 2O(ddim)m space, so that subsequent 1-median queries on a set Q ⊆ M , can be answered within (1 + ε) -- approximation (for any desired 0 < ε ≤ 1 2 ) in time n(2O(ddim) log ∆ + ε−O(ddim)). 7 The preprocessing algorithm simply builds the net hierarchy for the metric M (see Section 2). The query algorithm is described in Figure 1. For convenience, we use the shorthand med(y, Q) for med({y}, Q). By convention, for all i < 0 we define Yi := M (similarly to Y0), and note that the corresponding c-lists can be computed on the fly by a direct filtering of the respective c-list at level 0. 1. let y ← ytop 2. for each i from itop down to −3 let y ← argminz∈Ly,i,7 med(Q, z) 3. if med(Q, y) > 3n · 2i−1 then return y. 4. else y ← y. 5. 6. return y. Figure 1: Simple algorithm for 1-median query on a set Q ⊂ M Correctness Analysis. Assume for now that the algorithm returns from line 4. (We discuss later the more special case where the algorithm reaches line 6.) For the following, let i∗ be the final value of i (i.e., at line 4), and let y and y refer to their values in the algorithm at the end of the execution. It can be verified that the condition in line 4 must fail at least once, by considering ytop as a potential center y, and bounding the distance between every point in Q ⊂ M to ytop using Lemma 2.4. Therefore, Pq∈Q d(q, y) > 3n · 2i∗−1, and Pq∈Q d(q, y) ≤ 3n · 2i∗ . (1) Let a ∈ M be an optimal solution to the 1-median problem on Q. Let ai∗−1 ∈ Yi∗−1 be an ancestor of a in T . Then d(ai∗−1, a) ≤ 2i∗ Lemma 3.2. d(ai∗−1, y) ≤ 7 · 2i∗ , and thus ai∗−1 ∈ Ly,i∗,7. by Lemma 2.4. Proof. Using the triangle inequality, the optimality of a ∈ M , and then (1), n · d(ai∗−1, y) ≤ X d(ai∗−1, a) + 2 X [d(ai∗−1, a) + d(a, q) + d(q, y)] ≤ X q∈Q q∈Q q∈Q d(q, y) ≤ 7 · n2i∗ . Lemma 3.3. Pq∈Q d(q, a) > n · 2i∗−1. Proof. By Lemma 3.2, when the algorithm computes y in the final iteration, one of the options it considers is ai∗−1, and so d(q, y) ≤ X [d(q, a) + d(a, ai∗−1)] ≤ X d(q, ai∗−1) ≤ X d(q, a) + n · 2i∗ . q∈Q q∈Q q∈Q X q∈Q Combining this with (1) and rearranging, the lemma follows. Thus, if we returned from line 4, then using (1), the approximation factor achieved is Pq∈Q d(q,y) Pq∈Q d(q,a) < 3·n·2i∗ n·2i∗−1 = 6. If we returned from line 6, Lemma 3.2 holds also for i = −3, and thus at the last execution of line 3, we have d(a, y) ≤ 7 23 . But since there cannot be two points with distance less than 7 23 < 1, we see that y = a, and the returned point is an optimal solution a. We remark that a similar effect can be achieved by stopping at i = 0, possibly increasing the value of c. 8 3.1 Refinement to (1 + ε) -- approximation We now improve the approximation factor to 1 + ε for an arbitrary ε ∈ (0, 1 2 ]. We can utilize the fact that a is a descendant of ai∗−1 in T , so d(a, ai∗−1) ≤ 2i∗ , and that ai∗−1 ∈ Ly,i∗,c. As such, we perform a descendant search with refinement constant ε/2, starting from each member of Ly,i∗,c. . For each point By Lemma 2.5, we are guaranteed to traverse a point a ε 2 x traversed in this process, we compute med(Q, x), and eventually report a center candidate x with minimal objective value med(Q, x). Using (1) again, this objective value is such that d(a, a ε 2 ) ≤ ε 2 2i∗ med(Q, x) ≤ med(Q, a ε 2 ) ≤ X q∈Q hd(q, a) + d(q, a ε 2 )i ≤ med(Q, a) + ε 2 n2i∗ ≤ (1 + ε) med(Q, a). 3.2 Runtime Analysis The running time of the first part of the algorithm is 2O(ddim)n log ∆, as there are at most O(log ∆) levels, and at each level we compute the distance from every point in Q to every point z ∈ Ly,i,7. In the second part of the algorithm (the descendants search) we compute the cost of each of the ε−O(ddim) center candidates in O(n) time. The total runtime is n(2O(ddim) log ∆ + ε−O(ddim)), and the space usage is just that of the hierarchy, which is 2O(ddim)m. 4 An Efficient Algorithm for 1-median Theorem 4.1. There is an algorithm that preprocesses a finite metric M of size m in time 2O(ddim)m log ∆(M ) log log ∆(M ) using 2O(ddim)m memory words, so that subsequent 1-median queries on a set Q ⊆ M of size n can be answered within approximation factor 1 + ε (for any desired 0 < ε ≤ 1/2) in time O(n log n) + 2O(ddim) log ∆(M ) + ε−O(ddim). This theorem builds on the simple algorithm from Section 3, refining the approach therein using two main ideas. First, as we iterate down the levels i, some query points q ∈ Q might get further away from the current center yi ∈ Yi. But then, picking any c-list-descendant of yi as the final center will give approximately the same contribution from those far query points. This speeds up the traversal down the hierarchy as query points need not be considered once they get far enough from yi. The second idea is to cluster query points that are close to each other, relative to the current level i, into one (weighted) representative point. This (crude) clustering must be computed quickly, and indeed it is achieved using the projection tree T Q. Once we bound the number of weighted representatives under consideration in each iteration, we obtain a significant speedup. Algorithm Description. We first describe a constant factor approximation algorithm, which is detailed in Figure 2 using α, c′ > 0 to denote sufficiently large constants. Similarly to the simple algorithm in Section 3, the algorithm iterates (in lines 3 -- 12) down the levels i, while maintaining a candidate center yi ∈ Yi. However, the iterations here start at the root of T Q (instead of at ytop). Observe that the next candidate yi−1 is always chosen from the c-list of yi (lines 9,12). During the iterations, the algorithm maintains also a set Ri of representatives to some points of Q, those points that are not too far, as explained next. The level i representative of a point q ∈ Q, denoted ri(q), is the (unique) ancestor r ∈ Yi of q in T Q. Notice that this is the same ancestor as in the tree T . The algorithm also uses, for each representative r ∈ Ri, a weight denoted wt(r), which 9 1 . compute T Q 2 . let iroot ← level(root(T Q)); yiroot−1 ← root(T Q); Riroot ← {root(T Q)}; sum ← 0 3 . foreach i from iroot − 1 down to 0 4 . 5 . 6 . 7 . 8. 9. 10. 11. 12. 13. return y−1 if d(r, yi) > c′ · 2i then let sum ← sum + wt(r) · d(r, yi) else let Ri ← Ri ∪ {children of r in non-compacted T Q}. let y ← argminx∈Lyi,i,c{Pr∈Ri if sum + Pr∈Ri then return yi else yi−1 ← y let Ri ← ∅ foreach r ∈ Ri+1 d(r, x) · wt(r)} d(r, y) · wt(r) > α · n · 2i−1 Figure 2: Efficient Algorithm for 1-median query on a set Q ⊂ M is the number of points in Q that have r as an ancestor in T Q. This weight is calculated for each node in T Q during the tree's construction in line 1. The set of representatives Ri is constructed (in lines 4,8) from children of Ri+1 in T Q, which clearly maintains the invariant Ri ⊂ Yi. In this process, we skip (via the condition in line 6) representatives r ∈ Ri+1 that are far enough from yi, in which case we add their weighted distance wt(r) · d(r, yi) to a variable called sum. The purpose of this variable is to accumulate all those weighted distances, but note that each weighted distance is taken relative to yi at the iteration in which the representative r fails the condition in line 6. Denote by sumi the value of variable sum at the end of iteration i. For representatives r ∈ Ri+1 that are close enough to yi, we need to compute their children in the un-compacted T Q (in line 8). For simplicity sake, the algorithm's description assumes that the tree T Q is available in its un-compacted version. The necessary operations can be implemented using the data structure for the compacted version by Lemma 2.2. 4.1 Correctness Analysis We say a point q ∈ Q is far at level i if it has no representative in Ri, which means that during some iteration i′ > i its representative was skipped. A point q ∈ Q is near if it is not far. Let Fi denote the points of Q that are far at level i, and similarly Ni = Q \ Fi for the points that are near. Notice that Fi ⊇ Fi+1 and Ni ⊆ Ni+1. Let i∗ be the value of i at the end of the execution. This is the "last" level (time-wise) considered by the algorithm, and the analysis shall rely on the corresponding partition Q = Ni∗ ∪ Fi∗ . For q ∈ Q, we denote its representative in Ri by ri(q). We let rq be the "last" representative of q, formally defined as follows. If q ∈ Fi∗, define iq as the smallest i such that q ∈ Ni. Intuitively, this is the "last level" in which q has a representative, and also the (unique) value of i such that q ∈ Ni \ Ni−1 = Fi−1 \ Fi (assuming by convention Ni∗−1 = ∅ and Fi∗−1 = Q). Otherwise (i.e., q ∈ Ni∗), define iq := i∗. In both cases, let rq := riq (q). Notice that rq ∈ Yiq . At iteration i, the variable called sum receives (in line 7) a contribution for every point q ∈ Fi \Fi+1. Observe that this contribution is proportional to d(ri+1(q), yi), and the last representative 10 of q is at level iq = i + 1. Hence, rq = riq (q) = ri+1(q), and by the condition in line 6, d(rq, yiq−1) = d(ri+1(q), yi) > c′2i = c′2iq−1. Summing the aforementioned contributions over all iterations up to i, we see that sumi = X i′≥i X q∈Fi′ \Fi′+1 d(ri′+1(q), yi′) = X q∈Fi d(rq, yiq−1). In addition, rq ∈ Yiq and is an ancestor of q in T .Thus, by Lemma 2.4, ∀q ∈ Q, ∀q ∈ Ni∗, d(q, rq) ≤ 2iq+1 d(q, rq) ≤ 2i∗+1. (2) (3) (4) (5) Below, y refers to its value at the end of the execution. We assume from now on that the algorithm halts during some iteration and returns the value from line 11. Similarly to Section 3, the special case where the algorithm returns from line 13 is proved by replacing Eqn. (6) and its consequences with the fact that we reached iteration i = 0. Thus, at the last iteration, i = i∗, the algorithm halts, and sumi∗ + X r∈Ri∗ d(r, y) · wt(r) = sumi∗ + X q∈Ni∗ d(rq, y) > α · n · 2i∗−1. (6) Similarly, at the previous to last iteration i = i∗ + 1 and y is assigned yi∗, hence sumi∗+1 + X r∈Ri∗+1 d(r, yi∗ ) · wt(t) = sumi∗+1 + X q∈Ni∗+1 d(ri∗+1(q), yi∗ ) ≤ α · n · 2i∗ . (7) This inequality holds even in the special case where i∗ = iroot − 1 and there was no previous to last iteration. Indeed, we have that Fi∗+1 = ∅, sumi∗+1 = 0, Ri∗+1 = {root(T Q)} and yi∗ = root(T Q), and therefore, sumi∗+1 + Pr∈Ri∗+1 Lemma 4.2. sumi∗ + Pq∈Ni∗ d(rq, yi∗ ) ≤ (α + 2) · n · 2i∗ Proof. We write the lefthand-side as d(r, yi∗ ) = 0 ≤ α · n · 2i∗ . . sumi∗ + X q∈Ni∗ d(rq, yi∗) = = sumi∗+1 + X q∈Ni∗ +1−Ni∗ ≤ sumi∗+1 + X q∈Ni∗ +1−Ni∗ d(ri∗+1(q), yi∗ ) + X q∈Ni∗ d(ri∗+1(q), yi∗ ) + X q∈Ni∗ ≤ sumi∗+1 + X q∈Ni∗ +1 d(ri∗+1(q), yi∗ ) + n2i∗+1, d(ri∗ (q), yi∗) [d(ri∗ (q), ri∗+1(q)) + d(ri∗+1(q), yi∗ )] where the last inequality follows from ri∗(q) being a child of ri∗+1(q) in T Q. The lemma then follows by plugging in Eqn. (7). 11 For every q ∈ Fi∗ , we have by Eqn. (2) that d(q, rq) ≤ 2iq+1 ≤ 4 In addition, d(yiq−1, yi∗) ≤ c2iq ≤ 2c c′ d(rq, yiq−1), because yi∗ is a c-list-descendant of yiq−1 and thus Lemma 2.3 applies. To simplify notation, define β := 4 c′ and notice it can be made an arbitrarily small positive constant by controlling c′. For example, it is always possible to make β = 1 2 . We can now show that with respect to the query points Fi∗ , our estimate sumi∗ is a good approximation for the cost of picking yi∗ as the center. c′ d(rq, yiq−1). c′ + 2c X q∈Fi∗ d(q, yi∗ ) ≤ X q∈Fi∗ (cid:2)d(q, rq) + d(rq, yiq−1) + d(yiq−1, yi∗)(cid:3) ≤ (1 + 4 c′ + 2c c′ ) X q∈Fi∗ d(rq, yiq−1) = (1 + β)sumi∗. (8) In addition, we show that with respect to the query points Ni∗, the representatives give a good approximation as well. X q∈Ni∗ d(q, yi∗ ) ≤ X q∈Ni∗ [d(q, rq) + d(rq, yi∗)] ≤ n2i∗+1 + X q∈Ni∗ d(rq, yi∗). (9) Let a ∈ M be an optimal solution to the 1-median problem Q, and let ai∗−1 ∈ Yi∗−1 be an . We next prove that yi∗ is near ai∗−1, and thus also ancestor of a in T . Thus, d(ai∗−1, a) ≤ 2i∗ near a itself. Lemma 4.3. d(ai∗−1, yi∗) ≤ c2i∗ and therefore ai∗−1 ∈ Lyi∗ ,i∗,c. Proof. We start with the lefthand-side multiplied by n n · d(ai∗−1, yi∗ ) = X q∈Q d(ai∗−1, yi∗) [d(ai∗−1, a) + d(a, q) + d(q, yi∗ )] by triangle inequality ≤ X q∈Q ≤ n2i∗ = n2i∗ ≤ n2i∗ ≤ 5n2i∗ ≤ cn2i∗ . + 2 X q∈Q d(q, yi∗) + 2h X q∈Fi∗ d(q, yi∗ ) + X q∈Ni∗ d(q, yi∗)i by optimality of a + 2(cid:2)(1 + β)sumi∗ + n2i∗+1 + X + 2(1 + β)(α + 2) · n · 2i∗ q∈Ni∗ d(rq, yi∗)(cid:3) by Eqns. (8),(9) by Lemma 4.2 For the last inequality we need to pick a large enough constant c > 0. (Recall that β can be made to be 1 2 increasing c′ as needed.) Dividing all by n completes the proof. We now want to prove the guarantee of our approximation. To this end we need an upper bound on the cost of the algorithm's solution, which we establish by analyzing the stopping condition iteration. Lemma 4.4. Pq∈Q d(q, yi∗) ≤ [2 + (1 + β)(α + 2)]n2i∗ . 12 Proof. First, each q is close to rq and thus X q∈Ni∗ d(q, yi∗ ) ≤ X q∈Ni∗ [d(rq, q) + d(rq, yi∗)] ≤ n2i∗+1 + X q∈Ni∗ d(rq, yi∗). Thus, X q∈Q d(q, yi∗ ) = X q∈Ni∗ d(q, yi∗) + X q∈Fi∗ d(q, yi∗) ≤ n2i∗+1 + X q∈Ni∗ d(rq, yi∗) + (1 + β)sumi∗ ≤ n2i∗+1 + (1 + β)(sumi∗ + X q∈Ni∗ ≤ [2 + (1 + β)(α + 2)] n2i∗ . d(rq, yi∗)) Lemma 4.5. sumi∗ ≤ 1 1−β Pq∈Fi∗ d(q, a). Proof. First notice that d(a, yiq −1) ≤ d(a, ai∗−1) + d(ai∗−1, yiq−1) + c2iq − c2i∗ ≤ 2i∗ ≤ c2iq 2c c′ d(rq, yiq−1), ≤ where the bound on d(ai∗−1, yiq−1) follows from Lemma 2.3. Therefore, X q∈Fi∗ d(q, a) ≥ X q∈Fi∗ [d(rq, yiq−1) − d(q, rq) − d(a, yiq −1)] ≥ (1 − β)sumi∗. We are now ready to provide a lower bound on the optimal solution. Recall that y refers to its value at the end of the algorithm. Lemma 4.6. Pq∈Q d(q, a) > (α/2 − 3)(1 − β)n2i∗ (assuming the algorithm returns from line 11). 13 Proof. α · n · 2i∗−1 < sumi∗ + X q∈Ni∗ d(rq, y) (6) ≤ sumi∗ + X q∈Ni∗ ≤ sumi∗ + X q∈Ni∗ d(rq, ai∗−1) by Lemma 4.3 and choice of y [d(rq, q) + d(q, a) + d(a, ai∗−1)] ≤ sumi∗ + n2i∗+1 + X q∈Ni∗ d(q, a) + n2i∗ ≤ 3n2i∗ ≤ 3n2i∗ + 1 1−β X q∈Fi∗ d(q, a) + X q∈Ni∗ d(q, a) by Lemma 4.5 + 1 1−β X q∈Q d(q, a). We conclude that the algorithm achieves approximation factor Pq∈Q d(q, yi∗ ) Pq∈Q d(q, a) ≤ [2 + (1 + β)(α + 2)]n2i∗ (1 − β)(α/2 − 3)n2i∗ = [2 + (1 + β)(α + 2)] (1 − β)(α/2 − 3) . 4.2 Refinement to (1 + ε) -- approximation Our goal now is to improve the approximation factor to 1 + ε for arbitrary ε > 0. We can utilize the fact that a is a descendant of ai∗−1 in T , so d(a, ai∗−1) ≤ 2i∗ , and that ai∗−1 ∈ Lyi∗ ,i∗,c. As such, we can perform a descendant search, as in Lemma 2.5, starting from each member of Lyi∗ ,i∗,c, with refinement constant ε′ = Θ(ε). By Lemma 2.5 we are guaranteed to traverse a point aε′ such that d(a, aε′) ≤ ε′2i∗ . However, we wish to avoid the high runtime of computing the cost of each center candidate by summing the distances from all of Q to that point. Instead, we once again speed up the process by removing far points, and using weighted representatives for the rest. Speeding up the descendants search. Define the set of far points F = {q ∈ Q : d(q, yi∗ ) > 2ε′ 2i∗} for some ε′ > 0 to be determined later. The set of near points is N := Q \ F . The 3c points in F are ignored in this phase of the algorithm. For the points in N we wish to find good representatives so that the number of representatives is few, and the additive distortion caused by replacing the query points in N with their representative is very small. To this end, consider the set of representatives obtained as follows. Each point q ∈ N is mapped to its ancestor in the compacted T Q which is in Yk for the largest k ≤ i∗ − log(1/ε′′) for ε′′ > 0 to be determined later. Call this set of representatives Rε′′, and give each r ∈ Rε′′ a weight wt(r) which is the number of points in N that were mapped to r. Notice that the process of this mapping and weighting can be done efficiently by scanning the compacted T Q in O(n) time. Now, for each center candidate x obtained by a descendants search from each of the points in Lyi∗ ,i∗,c by using Lemma 2.5 with refinement constant ε′′, we compute Pr∈Rε′′ d(r, x) · wt(r), and take the candidate which minimizes this cost. 14 We want to argue that the candidate returned is a 1 + ε approximation from the optimum. Denote this candidate by x. Notice that one of the candidates must be a point aε′′ which is an ancestor of a in T and is in Yk for some k ≤ i∗ − log(1/ε′′). Therefore, Pr∈Rε′′ d(r, x) · wt(r) ≤ Pr∈Rε′′ d(r, aε′′ ) · wt(r). Lemma 4.7. Pq∈Q d(q, x) ≤ (1 + ε)Pq∈Q d(q, a). Proof. Denote by xi∗−1 the c-list-ancestor of x in Lyi∗ ,i∗,c ⊆ Yi∗−1. First, for every q ∈ F , d(q, x) ≤ d(q, yi∗ ) + d(yi∗, xi∗−1) + d(xi∗−1, x) ≤ d(q, yi∗ ) + c2i∗−1 + c2i∗ ≤ d(q, yi∗ ) + ε′d(q, yi∗ ) = (1 + ε′)d(q, yi∗ ), and similarly, by xi∗−1 ∈ Lyi∗ ,i∗,c and Lemma 2.3 since q ∈ F d(q, yi∗) ≤ d(q, a) + d(a, ai∗−1) + d(ai∗−1, yi∗) ≤ d(q, a) + 2i∗ + c2i∗ ≤ d(q, a) + ε′d(q, yi∗ ). by Lemma 4.3 since q ∈ F Therefore, d(q, yi∗ ) ≤ d(q,a) 1−ε′ . Combining this with our earlier inequality, we get d(q, x) ≤ X q∈F 1 + ε′ 1 − ε′ X q∈F d(q, a). For the near points, we have X q∈N d(q, x) ≤ X q∈N d(q, aε′′) ≤ X q∈N (cid:2)d(q, a) + d(a, aε′′)(cid:3) ≤ X q∈N (cid:2)d(q, a) + ε′′2i∗+1(cid:3). Altogether, the cost of the reported center candidate x is (10) (11) d(q, x) ≤ X q∈Q ≤ ≤ q∈F 1 + ε′ 1 − ε′ X 1 + ε′ 1 − ε′ X 1 + ε′ 1 − ε′ X q∈Q q∈Q d(q, a) + X q∈N [d(q, a) + ε′′2i∗+1] by Eqns. (10),(11) d(q, a) + 2ε′′n2i∗ d(q, a) + 2ε′′ (α/2 − 3)(1 − β) X q∈Q d(q, a) by Lemma 4.6 = (cid:16) 1 + ε′ 1 − ε′ + 2ε′′ (α/2 − 3)(1 − β)(cid:17) X q∈Q d(q, a). Setting ε′′ := (α/2−3)(1−β)ε 2 and ε′ := ε ε+2 , we get that Pq∈Q d(q, x) ≤ (1 + ε)Pq∈Q d(q, a). 15 4.3 Runtime Analysis In the first part, the compacted version of T Q is constructed (in line 1) in time O(n log n) using Lemma 2.1. At each iteration i we locate y (in line 9), which becomes yi∗. The runtime of this step is proportional to the number of candidates in the c-list multiplied by the size Ri. The number of candidates is Ly,i,c ≤ 2O(ddim). The size of Ri is at most the number of points in Yi which are at most c′2i away from yi. We conclude that Ri ≤ 2ddim log(c′2i+1/2i) ≤ 2O(ddim). Computing Ri from Ri+1 takes 2O(ddim) time per member of Ri+1, for a total of 2O(ddim) per iteration i. Thus, the total time spent on finding yi∗ is O(n log n + 2O(ddim) log ∆). For the descendants search used in the refinement to (1 + ε) -- approximation, we can bound the number of representatives as follows. Lemma 4.8. Rε′′ ≤ ε−O(ddim). Proof. If all of the representatives are in Yi∗−log(1/ε′′) then the size of Rε′′ is at most the number of points in Yi∗−log(1/ε′′) which are at most 3c away from yi∗. The number of such points is bounded above by 2ε′ 2i∗ 2O(ddim log( 3c 2ε′ 2i∗ /2i∗ −log(1/ε′′ )) = 2O(ddim log 3c 2ε′ε′′ ) ≤ ε−O(ddim). However, the representatives do not all have to be in Yi∗−log(1/ε′′). To overcome this, we charge each representative in Rε′′ to a different point in Yi∗−log(1/ε′′). This mapping is done by assigning to each point in Rε′′ its ancestor in the un-compacted T Q which is in Yi∗−log(1/ε′′). Notice that no two points in Rε′′ can be assigned to the same point in Yi∗−log(1/ε′′), as otherwise there would be another node in the compacted T Q which is an ancestor of those two points and in Yk for k ≤ i∗ − log(1/ε′′), which contradicts the method in which the representatives were picked. The total cost of the descendants search is the number of representatives multiplied by the number of center candidates. From Lemma 2.5 we know that the number of candidates is at most ε′′−O(ddim) ≤ ε−O(ddim), and therefore, the runtime of this refinement stage is bounded by ε−O(ddim). Overall, the runtime of computing a (1 + ε) -- approximation for the 1-median is O(n log n) + 2O(ddim) log ∆(M ) + ε−O(ddim), and this completes the proof of Theorem 4.1. 5 Algorithm for 1-Center It is helpful to see the solution for the 1-center problem prior to seeing the solution for the p-center problem, as many of the ideas are similar, and the exposition with only one center is simpler. Therefore, we first prove the following. Theorem 5.1. There is an algorithm that preprocesses a finite metric M in time 2O(ddim)m log ∆ log log ∆(M ) using 2O(ddim)m memory words, where m = M , ddim = ddim(M ) and ∆ = ∆(M ), so that subse- quent 1-center queries on a set Q ⊆ M , can be answered with approximation factor 1 + ε, for any desired 0 < ε ≤ 1/2, in time O(n log n + log log log ∆ + ε−O(ddim)) , where n = Q. The preprocessing algorithm simply builds the net hierarchy for the metric M , and prepares it for weighted level ancestor queries (see Section 2). For the query, we first recall a trivial algorithm that provides a 2 -- approximation for the 1-center problem on a query set Q ⊂ M , and then refine it to provide a (1 + ε) -- approximation. 16 Let a ∈ M be an optimal center, and denote its value by OPT := maxq∈Q d(a, q). Notice that every point y ∈ Q gives a 2 -- approximation, because its objective value is ALG0 := max q∈Q d(y, q) ≤ max q∈Q {d(y, a) + d(a, y)} ≤ 2 · OPT. We thus pick any point y ∈ Q as our first approximation, and proceed to the refinement stage. Refinement to (1 + ε) -- approximation. Let i be an integer such that 2i−1 < ALG0 ≤ 2i, and notice that OP T ≤ ALG0 ≤ 2i. We begin by locating the ancestor yi ∈ Yi of y in T . This can be done using a weighted level ancestor query [FM96, KL07]. We next show that a is fairly close to yi. Lemma 5.2. Let ai−1 ∈ Yi−1 be an ancestor of a in T . Then ai−1 ∈ Lyi,i,6. Proof. For every point q ∈ Q, d(ai−1, yi) ≤ d(ai−1, a) + d(a, q) + d(q, y) + d(y, yi) ≤ 2i + OPT + 2 · OPT + 2i+1 ≤ 6 · 2i. This lemma implies that the optimal center a is a descendant in T of some point in Lyi,i,6. Executing a descendants search from all the points in Lyi,i,6 by using Lemma 2.5 with refinement constant ε will guarantee that we traverse a point aε such that d(a, aε) ≤ ε2i. Denote the set of the points seen in such a descendants search by D. Unfortunately, this process computes (separately) the cost of each candidate traversed by taking the maximum distances from all of Q to that candidate, which would take time ε−O(ddim)n. We can speed up this process by using (a few) representatives of Q, as is explained next. Speeding up the descendants search. We wish to find a bounded-size set of representatives for the points in Q, such that the distortion caused by considering them (instead of Q) is small. To this end, consider the set of representatives obtained as follows. Each point q ∈ Q is mapped to its ancestor in the compacted T Q which is in Yk for the largest k ≤ i − log(1/ε′), for some refinement constant ε′ = Θ(ε) to be determined later. Call this set of representatives Rε′. Notice that Rε′ is a subset of the compacted T Q and thus the process of this mapping can be done efficiently by scanning the compacted T Q in linear time. Now, for each center candidate x ∈ D we compute maxr∈Rε′ d(r, x), and return the candidate x that minimizes this cost. The next lemma shows that this algorithm achieves (1 + ε) -- approximation. Lemma 5.3. cntr(Q, {x}) = maxq∈Q d(x, q) ≤ (1 + ε)OPT. Proof. Every q ∈ Q has a representative in Rε′, for which we can apply Lemma 2.4 and the triangle inequality, and thus max q∈Q d(x, q) < max r∈Rε′ d(x, r) + ε′2i+1. Recall that one of the center candidates is some aε′ ∈ Yi−log(1/ε′) that is an ancestor of a in T . Therefore, the returned center x satisfies max r∈Rε′ d(x, r) ≤ max r∈Rε′ d(aε′, r). 17 Let r∗ ∈ Rε′ be a maximizer for the righthand side, and let q∗ ∈ Q be such that r∗ is a representative of q∗. Using the triangle inequality and Lemma 2.4 again, d(aε′, r∗) ≤ d(a, aε′) + d(a, q∗) + d(q∗, r∗) ≤ OPT + 2 · ε′2i+1. Recalling from earlier that 2i < 2ALG0 ≤ 4OPT, we finally combine the inequalities above and conclude that maxq∈Q d(x, q) ≤ OPT + 3 · ε2i+1 ≤ (1 + 24ε)OPT. To complete the proof, set ε′ to be a power of 2 in the range [ ε 48 , ε 24 ]. Runtime. The running time of the above query process is as follows. Locating yi using a weighted level ancestor query takes O(log log log ∆) time as there are only log ∆ possible nets. After con- structing T Q in O(n log n) time, the mapping of every q ∈ Q to its representative takes, alto- gether, O(n) time. The descendants search for each of the O(2ddim) points in Lyi,i,6 takes time ε′−O(ddim) ≤ ε−O(ddim) time, which also bounds the number of candidates. The number of repre- sentatives for Q is bounded by the following lemma. Lemma 5.4. Rε′ ≤ ε−O(ddim). Proof. If all of the representatives are in Yi−log 1 points in Yi−log 1 by then the size of Rε′ is at most the number of which are at most 2i away from yi. The number of such points is bounded above ε′ ε′ 2ddim · log(2i/2i−log(1/ε′)) = (1/ε′)O(ddim) = ε−O(ddim). However, the representatives do not all have to be in Yi∗−log(1/ε′). To overcome this, we charge each representative in Rε′ to a different point in Yi∗−log(1/ε′). This mapping is done by assigning to each point in Rε′ its ancestor in the un-compacted T Q which is in Yi∗−log(1/ε′). Notice that no two points in Rε′ can be assigned to the same point in Yi∗−log(1/ε′), as otherwise there would be another node in the compacted T Q which is an ancestor of those two points and in Yk for k ≤ i∗ − log(1/ε′), which contradicts the method in which the representatives were picked. It follows that the time it takes to evaluate the cost of all center candidates is (altogether) ε−O(ddim), and thus the algorithm's total runtime of is O(n log n + log log log ∆ + ε−O(ddim)). 6 Algorithm for p-center Theorem 6.1. There is an algorithm that preprocesses a finite metric M in time 2O(ddim)m log ∆ log log ∆ using 2O(ddim)m memory words, where m = M , ddim = ddim(M ) and ∆ = ∆(M ), so that subse- quent p-center queries on a set Q ⊆ M , can be answered with approximation factor 1 + ε, for any desired 0 < ε ≤ 1/2, in time O(n log n + p log log log ∆ + pp+1ε−O(p·ddim)) , where n = Q. The preprocessing algorithm simply builds the net hierarchy for the metric M , and prepares it for weighted level ancestor queries (see Section 2). For the query, we first use the algorithm of Gonzalez from [Gon85] on Q, which obtains a 2-approximation for the p-center in O(p · n) In other words, the algorithm locates a set B ⊂ Q of size p such that if we denote its time. objective value as ALG0 := maxq∈Q d(q, B), and if A ⊂ M is an optimal p-center set with value OPT := maxq∈Q d(q, A), then ALG0 ≤ 2 · OPT. 18 6.1 Refinement to (1 + ε) -- approximation. Let i be an integer such that 2i−1 < ALG0 ≤ 2i. For each b ∈ B locate the ancestor bi ∈ Yi of b in T . This can be done using a weighted level ancestor query [FM96, KL07]. For a center a ∈ OPT, let ai−1 ∈ Yi−1 be an ancestor of a in T . Lemma 6.2. For every a ∈ OPT there exists a point b ∈ B such that ai−1 ∈ Lbi,i,6. For every point q ∈ Q which is assigned to a in OPT, let b be the center of the cluster of q in B. Then d(ai−1, bi) ≤ d(ai, a) + d(a, q) + d(q, b) + d(b, bi) ≤ 2i + OPT + 2 · OPT + 2i+1 ≤ 6 · 2i. This implies that a center a ∈ A is a descendant in T of some point in Sb∈B Lbi,i,6. Performing a descendants search from each of the points in Lbi,i,6 by using Lemma 2.5 for some refinement constant ε′ = θ(ε) to be determined later, will guarantee that for each a ∈ OPT we traverse a point a such that d(a, a) ≤ ε′2i. Denote the union of the points seen in such a descendants search by D. Unfortunately, this process computes (separately) the cost of each subset of size p of candidates traversed by taking the maximum distances from all of Q to that subset, which would take time ε−O(ddim)np. We can speed up this process by using (a few) representatives of Q. Speeding up the descendants search. We wish to find a bounded-size set of representatives for the points in Q, such that the distortion caused by considering them (instead of Q) is small. To this end, consider the set of representatives obtained as follows. Each point q ∈ Q is mapped to its ancestor in the compacted T Q which is in Yk for the largest k ≤ i − log(1/ε′), for some refinement constant ε′ = Θ(ε) to be determined later. Call this set of representatives Rε′. Notice that Rε′ is a subset of the compacted T Q and thus the process of this mapping can be done efficiently by scanning the compacted T Q in linear time. Now, for each set of p center candidates X ⊂ D we compute maxr∈Rε′ d(r, X), and take the set of candidates X that minimizes this cost. The next lemma shows that this algorithm achieves (1 + ε) -- approximation. Lemma 6.3. cntr(Q, { X}) = maxq∈Q d( X, q) ≤ (1 + ε)OPT. Proof. Every q ∈ Q has a representative in Rε′, for which we can apply Lemma 2.4 and the triangle inequality, and thus max q∈Q d( X, q) < max r∈Rε′ d( X, r) + ε′2i+1. Recall that one of the sets of center candidates is some Aε ⊂ Yi−log(1/ε′) that is the set of ancestors of every a ∈ A in T , where A is an optimal solution. Therefore, the returned center set X satisfies max r∈Rε′ d( X, r) ≤ max r∈Rε′ d(Aε′, r). Let r∗ ∈ Rε′ be a maximizer for the righthand side, and let q∗ ∈ Q be such that r∗ is a representative of q∗. Let a ∈ A be the center in A which is closest to q∗, and let aε′ be the ancestor of a in Aε′. Using the triangle inequality and Lemma 2.4 again, d(Aε′, r∗) ≤ d(aε′, a) + d(a, q) + d(q, r∗) ≤ OPT + 2 · ε′2i+1. Recalling from earlier that 2i < 2ALG0 ≤ 4OPT, we finally combine the inequalities above and conclude that maxq∈Q d( X, q) ≤ OPT + 3 · ε2i+1 ≤ (1 + 24ε)OPT. To complete the proof, set ε′ to be a power of 2 in the range [ ε 48 , ε 24 ]. 19 6.2 Runtime The running time of the above process is as follows. Locating bi for all b ∈ B using a weighted level ancestor queries takes O(p log log log ∆) as there are only log ∆ possible nets. After constructing T Q in O(n log n) time, the mapping of each q ∈ Q to its representative takes another O(n) time. The descendants search from all of the O(2ddim) points in Lbi,i,6 takes O(pε′−O(ddim)) = O(pε−O(ddim)), which also bounds the number of candidates. The number of representatives can be bounded by the following lemma. Lemma 6.4. Rε′ ≤ pε−O(ddim). Proof. If all of the representatives are in Yi∗−log(1/ε′) then the size of Rε′ is at most the number of points in Yi−log(1/ε′) which are at most 2i away from each of the p points in B. The number of such points is bounded above by pε′−O(ddim) ≤ pε−O(ddim). However, the representatives do not all have to be in Yi∗−log(1/ε′). To overcome this, we charge each representative in Rε′ to a different point in Yi∗−log(1/ε′). This mapping is done by assigning to each point in Rε′ its ancestor in the un-compacted T Q which is in Yi∗−log(1/ε′). Notice that no two points in Rε′ can be assigned to the same point in Yi∗−log(1/ε′), as otherwise there would be another node in the compacted T Q which is an ancestor of those two points and in Yk for k ≤ i∗ − log(1/ε′), which contradicts the method in which the representatives were picked. Thus, the time it takes to test each of the (cid:0)pε−O(ddim) (cid:1) candidates is at most O(pε−O(ddim)), and the total runtime of the algorithm is O(n log n + p log log log ∆ + pp+1ε−p·ddim). Notice that the runtime of the algorithm of Gonzalez is O(np), which is always bounded from above by O(n log n + pp−1), and can thus be absorbed by the other terms. p 7 Algorithm for p-median Theorem 7.1. There is an algorithm that preprocesses a finite metric M in time 2O(ddim)m log ∆ log log ∆ using 2O(ddim)m memory words, where m = M , ddim = ddim(M ), and ∆ = ∆(M ), so that subse- quent p-median queries on a set Q ⊆ M of size n, can be answered within approximation factor 1+ε, for any desired ε ∈ (0, 1 2 ], in time O(n log n) + ε−O(ddim)(p · log n)O(1) · log log log ∆ + ε−O(p·ddim)(p · log n)O(p). To a large extent, we follow an algorithm of Har-Peled and Mazumdar [HM04] for approximating p-median clustering in Euclidean space. Their algorithm runs in time roughly O(n + exp(ε−d)(p · log n)O(1)), where d is the dimension in Euclidean space (in a scenario without preprocessing). In order to give a flavor of our preprocessing model, we focus on the case of small p and employ an abridged version of their algorithm, with runtime that grows exponentially with p. We note that following their techniques more closely may possibly reduce the runtime, like eliminating the exponential dependence on p. Proof (Sketch). At a high level, the algorithm of Har-Peled and Mazumdar [HM04] works as follows. First, construct a set A of p := p · logO(1) n centers that provides a constant factor approximation of the p-median (formally, it is a bicriteria approximation, since p > p). Next, construct a core-set 20 S by building an exponential grid (as defined below) around each of the centers in A, and mapping each point in Q to its (approximate) closest grid point, using near neighbor search. The size of the core-set is roughly S ≤ ε−dA log n (but of course these points have weights that add up to n). This means that every solution to the p-median problem on S is a good approximation for the p- median problem on Q. Finally, construct another set of exponential grids around each of the points in S to obtain a centroid set D, i.e., set of potential centers in the ambient (Euclidean) space, of size roughly D ≤ ε−dSO(1) ≤ ε−2d(p · log n)O(1). Finally, use a variant of the dynamic programming algorithm of Kolliopoulos and Rao [KR07] to quickly compute a near-optimal p-median of S among the potential centers D. This algorithm of Har-Peled and Mazumdar [HM04] carries over to our scenario (possibly using some different black-box data structures, for example to solve nearest neighbor search), except for the following two main ingredients. The first is the construction of the exponential grid, which strongly relies on being in Euclidean space, and the ability to define points in ambient space, which we do not enjoy in doubling dimension metrics. The second is the dynamic programming solution of Kolliopoulos and Rao [KR07], which also exploits the Euclidean space structure. We solve the exponential grid using T , as shown below, and skip the use of dynamic programming by performing a brute-force search over all size p subsets (of the centroid set). It is plausible that our runtime can be improved by adapting the solution of Kolliopoulos and Rao [KR07] to work in our case as well, and we leave this for future work. Exponential grid. The exponential grid of Har-Peled and Mazumdar [HM04] around a point r with length parameter R > 0 roughly works as follows. They build O(log n) axis-parallel squares, where the jth square has side length of R2j and is partitioned into sub-squares (i.e., a grid) of side length O(εR2j /d), the idea being that areas closer to the point r have smaller cell size, while areas further away have larger cell size. This construction does not carry over to doubling dimension metrics as we cannot define grid points in ambient space. However, we make use of T to provide a set with similar properties. We provide a sketch of the idea in order to ease presentation, but point out that some of our constants can to be refined. Given r, we use a weighted level ancestor query [FM96, KL07] to locate its ancestor rlog R ∈ Ylog R in T . A descendants search, using Lemma 2.5 starting from rlog R with refinement constant ǫ will give us a good resolution for points that are roughly at most distance R away from r. Let rj+log R ∈ Yj+log R be an ancestor of r in T , for 0 ≤ j ≤ O(log n). We perform a descendants search using Lemma 2.5 starting from each such rj+log R, with refinement constant ε. Notice that for a specific j, for points within distance 2j+log R = 2jR from r, the descendant search starting from rj+log R reaches a set of points which are in Yj+log R−log(1/ε) which is similar to the resolution obtained from the exponential grid in Euclidean space. The union of all of the points seen during all of the descendants searches on all O(log n) levels provides a set of size ε−O(ddim) log n, which gives us (i.e., in doubling dimension metrics) the same properties as the exponential grid does in a Euclidean space. Thus we obtain a core-set S and centroid set D both of size at most ε−O(ddim)(p · log n)O(1). Finally, perform an exhaustive search through all subsets of size p of the centroid set D and compute the cost of each such set, which takes total time (cid:0)D p (cid:1) · O(Sp) ≤ ε−O(p·ddim)(p · log n)O(p). Notice that a weighted level ancestor query is performed for each of the points in the core-set S, which increases the runtime by ε−O(ddim)(p · log n)O(1) · log log log ∆. 21 References [AGGM06] I. Abraham, C. Gavoille, A. V. Goldberg, and D. Malkhi. Routing in networks with low doubling dimension. In 26th IEEE International Conference on Distributed Computing Systems, page 75. IEEE, 2006. [AP02] P. K. Agarwal and C. M. Procopiuc. Exact and approximation algorithms for clustering. Algo- rithmica, 33:201 -- 226, 2002. [ARR98] S. Arora, P. Raghavan, and S. Rao. Approximation schemes for euclidean k-medians and related problems. In 13th Annual ACM Symposium on the Theory of Computing, pages 106 -- 113, 1998. [BF00] M. A. Bender and M. Farach-Colton. The LCA problem revisited. In LATIN 2000: Theoretical Informatics, pages 88 -- 94, 2000. [BGK12] Y. Bartal, L.-A. Gottlieb, and R. Krauthgamer. The traveling salesman problem: Low- dimensionality implies a polynomial time approximation scheme. In 44th symposium on Theory of Computing, pages 663 -- 672. ACM, 2012. [BHI02] [BKL06] [BLL09] [CG06] [Che06] [FM96] M. Badoiu, S. Har-Peled, and P. Indyk. Approximate clustering via core-sets. In 34th Annual ACM Symposium on Theory of Computing, pages 250 -- 257, 2002. A. Beygelzimer, S. Kakade, and J. Langford. Cover trees for nearest neighbor. In 23rd interna- tional conference on Machine learning, pages 97 -- 104. ACM, 2006. N. H. Bshouty, Y. Li, and P. M. Long. Using the doubling dimension to analyze the generalization of learning algorithms. Journal of Computer and System Sciences, 75(6):323 -- 335, 2009. R. Cole and L.-A. Gottlieb. Searching dynamic point sets in spaces with bounded doubling dimension. In 38th annual ACM symposium on Theory of computing, pages 574 -- 583. ACM, 2006. K. Chen. On k-median clustering in high dimensions. In 17th Annual ACM-SIAM Symposium on Discrete algorithm, pages 1177 -- 1185. ACM, 2006. M. Farach and S. Muthukrishnan. Perfect hashing for strings: Formalization and algorithms. In 7th Annual Symposium on Combinatorial Pattern Matching, pages 130 -- 140, 1996. [GKK10] L.-A. Gottlieb, L. Kontorovich, and R. Krauthgamer. Efficient classification for metric data. In 23rd Conference on Learning Theory, pages 433 -- 440. Omnipress, 2010. [GKL03] A. Gupta, R. Krauthgamer, and J. R. Lee. Bounded geometries, fractals, and low-distortion embeddings. In 44th Annual IEEE Symposium on Foundations of Computer Science, pages 534 -- 543, October 2003. [Gon85] T. F. Gonzalez. Clustering to minimize the maximum intercluster distance. Theoret. Comput. Sci., 38(2-3):293 -- 306, 1985. [HM04] [HM06] [HT84] [Ind99] S. Har-Peled and S. Mazumdar. On coresets for k-means and k-median clustering. Annual ACM Symposium on Theory of Computing,, pages 291 -- 300, 2004. In 36th S. Har-Peled and M. Mendel. Fast construction of nets in low-dimensional metrics and their applications. SIAM Journal on Computing, 35(5):1148 -- 1184, 2006. D. Harel and R. E. Tarjan. Fast algorithms for finding nearest common ancestors. SIAM J. Comput., 13(2):338 -- 355, 1984. P. Indyk. Sublinear time algorithms for metric space problems. In Proceedings of the 31st Annual ACM Symposium on Theory of Computing, pages 428 -- 434. ACM, 1999. 22 [KL04a] In R. Krauthgamer and J. R. Lee. The black-box complexity of nearest neighbor search. 31st International Colloquium on Automata, Languages and Programming, Lecture Notes in Computer Science, pages 858 -- 869. Springer, July 2004. [KL04b] R. Krauthgamer and J. R. Lee. Navigating nets: Simple algorithms for proximity search. In 15th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 791 -- 801, January 2004. [KL07] [KR07] T. Kopelowitz and M. Lewenstein. Dynamic weighted ancestors. In 18th Annual ACM-SIAM Symposium on Discrete Algorithms,, pages 565 -- 574, 2007. S. G. Kolliopoulos and S. Rao. A nearly linear-time approximation scheme for the euclidean k-median problem. SIAM J. Comput., 37(3):757 -- 782, 2007. [KRX08] G. Konjevod, A. W. Richa, and D. Xia. Dynamic routing and location services in metrics of low doubling dimension. In 22nd International Symposium on Distributed Computing, volume 5218 of Lecture Notes in Computer Science, pages 379 -- 393. Springer, 2008. [KSS10] A. Kumar, Y. Sabharwal, and S. Sen. Linear-time approximation schemes for clustering problems in any dimensions. J. ACM, 57(2), 2010. [KSW09] J. Kleinberg, A. Slivkins, and T. Wexler. Triangulation and embedding using small sets of beacons. J. ACM, 56:32:1 -- 32:37, September 2009. [Sli07] [Tal04] A. Slivkins. Distance estimation and object location via rings of neighbors. Distributed Com- puting, 19:313 -- 333, 2007. K. Talwar. Bypassing the embedding: Algorithms for low dimensional metrics. In Proceedings of the 36th Annual ACM Symposium on Theory of Computing, pages 281 -- 290, 2004. 23
1703.06053
2
1703
2017-03-21T12:29:29
Fast Non-Monotone Submodular Maximisation Subject to a Matroid Constraint
[ "cs.DS" ]
In this work we present the first practical $\left(\frac{1}{e}-\epsilon\right)$-approximation algorithm to maximise a general non-negative submodular function subject to a matroid constraint. Our algorithm is based on combining the decreasing-threshold procedure of Badanidiyuru and Vondrak (SODA 2014) with a smoother version of the measured continuous greedy algorithm of Feldman et al. (FOCS 2011). This enables us to obtain an algorithm that requires $O(\frac{nr^2}{\epsilon^4} \big(\frac{a+b}{a}\big)^2 \log^2({\frac{n}{\epsilon}}))$ value oracle calls, where $n$ is the cardinality of the ground set, $r$ is the matroid rank, and $ b, a \in \mathbb{R}^+$ are the absolute values of the minimum and maximum marginal values that the function $f$ can take i.e.: $ -b \leq f_S(i) \leq a$, for all $i\in E$ and $S\subseteq E$, (here, $E$ is the ground set). The additional value oracle calls with respect to the work of Badanidiyuru and Vondrak come from the greater spread in the sampling of the multilinear extension that the possibility of negative marginal values introduce.
cs.DS
cs
Fast Non-Monotone Submodular Maximisation Subject to a Matroid Constraint Pau Segui-Gasco ∗† Hyo-Sang Shin † Abstract In this work we present the first practical (cid:0) 1 e − ǫ(cid:1)-approximation algorithm to maximise a general non-negative submodular function subject to a matroid constraint. Our algorithm is based on combining the decreasing-threshold procedure of Badanidiyuru and Vondrak (SODA 2014) with a smoother version of the measured continuous greedy algorithm of Feldman et al. (FOCS 2011). This enables us to obtain an algorithm that requires O( nr2 log2( n ǫ )) value oracle calls, where d, ¯d ∈ R+ are the absolute values n is the cardinality of the ground set, r is the matroid rank, and ¯ d ≤ fS(i) ≤ ¯d, of the minimum and maximum marginal values that the function f can take i.e.: − ¯ for all i ∈ E and S ⊆ E, where E is the ground set. The additional value oracle calls with respect to the work of Badanidiyuru and Vondrak come from the greater spread in the sampling of the multilinear extension that the possibility of negative marginal values introduce. ǫ4 (cid:0) ¯d+ d ¯ ¯d (cid:1)2 1 Introduction Submodular maximisation problems have drawn a lot of attention recently [1]. This interest is due to a good confluence of theoretical results and practical applicability. Intuitively, a submodular set function is said to be so because it exhibits diminishing marginal returns, i.e.: the marginal value that an element adds to a set decreases as the size of the set increases. This simple property arises naturally in many applications and is what enables good theoretical tractability. It has been used in a variety of application domains, to name but a few: markets [2, 3], influence in networks [4], document summarisation [5], and sensor placement [6, 7]. In particular, this paper focuses on matroid-constrained submodular maximization of a general non-negative submodular function. Matroids are an incredibly powerful abstraction of independence. They capture seemingly disconnected notions such as linear independence, forests in graphs, traversals, among many others. Interestingly, with linear sum objectives (modular function), they are inextricably linked with the greedy algorithm. If the greedy algorithm is optimal, then there is an implicit matroid; if there is a matroid then the greedy algorithm is optimal [8]. They provide a flexible framework to characterise a variety of relevant constraints such as: partitions, schedules, cardinality, or even rigidity. ∗[email protected] †Centre for Autonomous and Cyber-Physical Systems, Institute of Aerospace Sciences, School of Aerospace Transport and Manufacturing, Cranfield University, Bedfordshire, UK. 1 1 Introduction 2 Importantly, the combination of a submodular function and a matroid constraint plays a uni- fying role for many well-known combinatorial optimisation problems such as: Submodular Welfare (also known as Submodular Task Allocation), Max k-Cover, Max Generalised Assignment, Max Facility Location, and Constrained Max Cut (e.g. Max Bisection) among others. However, maximising a submodular function subject to a matroid constraint is NP-Hard. Hence much of the research effort has focused on obtaining good approximation algorithms. A classic re- sult by Nemhauser, Wolsey, and Fisher [9] shows that the Greedy Algorithm is a 1 2 -approximation for non-negative monotone submodular functions. More recently, a fruitful avenue of research was spurred by Vondrak [10, 11] by showing that solving a relaxation of the problem based on the multilinear extension using the Continuous Greedy Algorithm and then rounding the result yields good approximation algorithms. They present their result in the context of non-negative monotone submodular functions to yield a (1 − 1 e )-approximation. Shortly after, Feldman et al. [12] modified Vondrak's algorithm to develop the Measured Continuous Greedy Algorithm which supported both non-negative non-monotone and monotone submodular functions. Their algorithm was the first to achieve a 1 e -approximation for general non-negative submodular functions subject to a matroid constraint. Both continuous greedy algorithms can find the aforementioned approximation bounds for solving relaxation problems subject to the more general constraint class of down-closed solvable polytopes. An important breakthrough in this field are Contention Resolution Schemes, a rounding framework proposed in [13], because they provide a paradigm for developing rounding schemes for a combination of useful constraints including matroids and knapsacks. Thus the combination of con- tinuous greedy relaxations and Contention Resolution schemes enabled approximation algorithms for many important submodular maximization problems. However, continuous greedy algorithms are impractically slow. Vondrak's algorithm required Θ(n8) value oracle calls, while Feldman's Measured Continuous Greedy requires O(n6) assuming oracle access to the multilinear extension, which needs to be sampled in general, creating additional overhead, possibly around O(n3) or O(n2). algorithm that uses O(cid:0) nr To remedy this, Badanidiyuru and Vondrak [14] proposed an efficient(cid:0)1 − 1 e − ǫ(cid:1)-approximation ǫ(cid:1) value oracle calls, for non-negative monotone submodular function maximisation subject to a matroid constraint. Where n is the cardinality of the ground set, and r is the rank of the matroid. They achieve this by using a Decreasing-Threshold procedure that enables a reduction of both the number of steps and the number of samples needed at each step of the continuous greedy process. ǫ4 log2 n In the inapproximability front, for matroid constrained non-negative monotone submodular maximisation Feige [15] showed that improving over the 1 − 1 e threshold is NP-Hard, and so the continuous greedy guarantees are tight. In the non-monotone case, [16] showed that no polynomial time algorithm can achieve an approximation better than 0.478. Closing the gap between 1 e and 0.478 remains an important open problem where recent advances have been made: Ene and Nguyen in [17] give a 0.372-approximation, while Feldman et al in [18] improve it to a 0.385-approximation. This improvements are relatively small, recall that 1 e ≈ 0.368, but show that there is room for future improvement. Both algorithms are based on the measured continuous greedy, and would therefore benefit from the techniques presented here. Our contribution in this work is the first(cid:0) 1 non-negative submodular function subject to a matroid constraint with a practical time complexity. Our algorithm is based on combining the Decreasing-Threshold procedure of [14] with a smoother version of the measured continuous greedy algorithm of [12]. This allows us to obtain an algorithm that requires O( nr2 d, ¯d ∈ R+ are the absolute values of ¯ ǫ )) value oracle calls, where e − ǫ(cid:1)-approximation algorithm to maximise a general log2( n ǫ4 (cid:0) ¯d+ d ¯ ¯d (cid:1)2 1 Introduction 3 d ≤ fS(i) ≤ ¯d, the minimum and maximum marginal values that the function f can take, i.e. − ¯ for all i ∈ E and S ⊆ E. The additional oracle calls with respect to [14] come from the additional spread in the sampling of the multilinear extension that the possibility of negative marginal values introduces. Definitions Let us now introduce the definitions of a matroid and a submodular function. A function f : 2E → R+ on a set E is said to be submodular if: f (A) + f (B) ≥ f (A ∪ B) + f (A ∩ B), for all A, B ⊆ E. (1) A more intuitive, but equivalent, definition can be formulated in terms of the marginal value added by an element: given Y, X ⊆ E satisfying X ⊆ Y and x ∈ E \ Y , then f (X + x) − f (X) ≥ f (Y + x) − f (Y ). Herein we overload the symbol + (−) to use it as shorthand notation for the addition (subtraction) of an element to a set, i.e. S + i = S ∪ {i} (S − i = S \ {i}). A matroid can be defined as follows [8]: a pair M = (E, I) is called a matroid if E is a finite set and I is a nonempty collection of subsets of E satisfying: ∅ ∈ I; if A ∈ I and B ⊆ A, then B ∈ I; and if A, B ∈ I and A < B, then A + z ∈ I for some z ∈ B \ A. A matroid base B ⊆ E is a maximally independent set B ∈ I, that becomes dependent by adding an additional element e ∈ E \ B, i.e. B + e /∈ I. A key property of matroids is that we can exchange elements between bases, let B denote the set of all bases of a matroid M, then the exchange property can be is formalised as follows: Lemma 1.1. (Corollary 39.12A in [8]) Let M = (N, I) be a matroid, and B1, B2 ∈ B be two bases. Then there is a bijection φ : B1 → B2 such that for every b ∈ B1 we have B1 − b + φ(b) ∈ B. Now we can formally define our target problem: Given a ground set E, a matroid defined upon it M = (E, I), and a general non-negative submodular function f : 2E → R+, find: max S∈I f (S). (2) A common approach to solve combinatorial optimisation problems is by using relaxation and rounding. This involves solving a continuous problem, in which we allow fractional solutions, and a rounding procedure which transforms the fractional output back to a discrete solution. Now let us explain the relaxation that is used in continuous greedy algorithms. There are two key elements needed to define the relaxation: the domain that contains fractional solutions, and a function to evaluate fractional solutions. In our problem, the most natural representation for the domain is the matroid polytope P (M), which is the convex hull of the incidence vectors of the independent sets in the matroid, i.e.: P (M) = Conv({1S : ∀S ∈ I}) [8]. Here 1S denotes the incidence vector of a set S ⊆ E, which contains a 1 for each element in S and 0 elsewhere, thus 1S ∈ [0, 1]E. The function for evaluation of fractional solutions is the multilinear extension: given a set E and a submodular set function f : 2E → R+, its multilinear extension F : [0, 1]E → R+ is defined as: F (y) , E[f (R(y))] = XS⊆E f (S)Yi∈S yiYj /∈S (1 − yj), (3) where R(y) is a random set containing each element i ∈ E with probability yi. Additionally, F can be lower bounded in terms of f : 2 Algorithm 4 Lemma 1.2. (from [12]) Let f : 2E → R+ be a submodular function; let F : [0, 1]E → R+ be the multilinear extension of f ; and let y ∈ [0, 1]E be a vector whose components are bounded by a, i.e. yi ≤ a, ∀i ∈ E. Then, for every S ⊆ E, we have that F (y ∨ 1S) ≥ (1 − a)f (S). (4) A key magnitude used in the Measured Continuous Greedy Algorithm is the marginal value of an element e ∈ E given a fractional solution y ∈ P (M), we refer to it by ∆Fe(y), defined as follows: ∆Fe(y) , E[fR(y)(e)] = F (y ∨ 1e) − F (y). (5) In other words, it is the value that would be created by adding the full element i to the fractional solution y. Here we have used the common shorthand notation for the marginal value of an element fS(e) = f (S + e) − f (S). In general, given an arbitrary non-negative submodular function there is no closed form of multilinear extension that enables us to evaluate it efficiently. The usual way to deal with this is to sample it, and so we need the following concentration inequality that enables us to bound the sampling error: Lemma 1.3. (Hoeffding Bound, Theorem 2 in [19]) Let X1, ..., Xm be independent random variables such that for each i, a ≤ Xi ≤ b, with a, b ∈ R. Let X = 1 i=1 Xi. Then Pr[ X − E(X) > t] ≤ 2e . mPm − 2t2 (b−a)2 m In this work we shall not dwell on the rounding step. Suffice it to say that there exist algorithms, such as Contention Resolution Schemes [20], Pipage-Rounding [21, 11, 22], or Swap-Rounding [13], that given a general non-negative submodular function f , its multilinear extension F , and a point y ∈ P (M), find a set S ∈ I, such that f (S) ≥ F (y). The most efficient technique is Swap-Rounding, and its results are used in [14]. However, the swap-rounding results in [13] hinge around Chernoff-like concentration bounds for monotone submodular functions, but in light of the concentration bounds for non-monotone submodular functions in [23], we believe that this technique can be adapted to work with non-monotone submodular functions. 2 Algorithm The algorithm we present here is based on the Decreasing-Threshold procedure that enabled Badani- diyuru and Vondrak [14] to achieve a very efficient algorithm, O( nr ǫ ), for maximising a non- negative monotone submodular function subject to a matroid constraint. The continuous greedy algorithm finds an approximate solution to the relaxation, y ∈ P (M), by integrating between t = 0 to t = 1 the differential equation dy basically the standard continuous greedy algorithm, but uses a much more efficient Decreasing- Threshold procedure to find the maximum marginal improvement direction, i.e. vi ∀i ∈ E in the equation above, in each iteration. To enable an approximation algorithm for the non-monotone case Feldman [12] proposed the measured continuous greedy algorithm, which similarly integrates dt = argmaxv∈P (M)Pi∈E ∆Fi(y)vi. The algorithm in [14] is ǫ4 log2 n 2 Algorithm 5 Algorithm 1: Accelerated Measured Continuous Greedy Input : f : 2E → R+, ǫ ∈ [0, 1], I ⊆ 2E. Output: A point y ∈ P (M), such that F (y) ≥ ( 1 e − 2ǫ)f (OP T ). // Initialisation y(0) ← 0 δ ← ǫ // Main Loop for t = {0, δ, 2δ, 3δ, . . . , 1 − δ} do B(t) ← Decreasing-Threshold(f, y(t), ǫ, δ, I ) for i ∈ E do if i ∈ B(t) then yi(t + δ) ← 1 + e−δ(yi(t) − 1) else yi(t + δ) ← yi(t) Return: y(1) Algorithm 2: Decreasing-Threshold Input : f : 2E → R+, y ∈ [0, 1]E , ǫ ∈ [0, 1], δ ∈ [0, 1], I ⊆ 2E . Output: A set B ⊆ E, such that B ∈ I. // Initialisation B ← ∅; ¯d ← maxi∈E f (i); ¯y′ ← maxi∈E(1 + e−δ(yi − 1)); // Main Loop for (w = d; w ≥ ǫ for e ∈ E do ¯d r (1 − ¯y′); w ← w(1 − ǫ)) do we(B, y) ← ∆Fe(y(B, δ)), // averaging O(cid:18) r2 ǫ2(cid:0) if we(B, y) ≥ w and B + e ∈ I then ¯d+ d ¯ ¯d (cid:1)2 log(E)(cid:19) iid random samples. B ← B + e Return: B *Note that the notation y(B, δ) means yi(B, δ) = yi(t) for i /∈ B, and yi(B, δ) = 1 + e−δ(yi − 1) for i ∈ B. 3 Algorithm Analysis 6 dy(t) here). dt = (1 − y(t)) ⊙ argmaxv∈P (M)Pi∈E ∆Fi(y)vi (⊙ represents element by element multiplication The advantage of the Decreasing-Threshold procedure is that it requires a smaller number of integration steps and a smaller number of samples per step. Here we apply its key idea to the measured continuous greedy. However, we need to perform two crucial modifications. The first modification is a smoother version of the integration rule in the measured continuous greedy algorithm of Feldman et al. [12]. We use an update step that makes the algorithm more continuous- like. Instead of using the integration step y(t + δ) = y(t) + δ(1 − y(t)) as proposed by [12], we increment the solution at a rate of dy(t) dt = 1 − y(t) by using the integration rule: y(t + δ) = 1 + e−δ(y(t) − 1), see Algorithm 1. This allows us to smooth the tradeoff between error and running time. The second modification is in the sampling error up to which we estimate the marginal values of the multilinear extension in the Decreasing-Threshold procedure. Badanidiyuru and Vondrak [14] used an additive and multiplicative error bound which enabled them to use only O( 1 ǫ2 r log(n)) samples. However, since our algorithm is meant to work with non-monotone functions, we may have negative marginal values, this increases the number of samples required for two reasons: first, it prevents us from using a multiplicative-additive error bound; and second the marginal values, when sampled, have inherently more spread. To quantify our error we use Hoeffding's concentration d, ¯d ∈ R+ are the absolute values of ¯ d ≤ fS(i) ≤ ¯d, for the minimum and maximum marginal values that the function f can take, i.e. − ¯ all i ∈ E and S ⊆ E. (Recall that if f were to be monotone we would have d = 0.) The resulting ¯ ) value oracle calls. Using only an additive bound instead of an additive and multiplicative introduces an extra O(r) factor in the number of samples required per evaluation of the multilinear extension. inequality, which forces us to use O(cid:0) r2 ǫ2(cid:0) Decreasing-Threshold procedure is presented in Algorithm 2, and it takes an additional O(r(cid:0) While we also incur the additional O(cid:0)(cid:0) ¯d (cid:1)2 ¯d (cid:1)2(cid:1) term to cope with the larger spread that is introduced log(n)(cid:1), where ¯d (cid:1)2 by the possibility of negative marginal values. This results in an algorithm that finds an 1 e − ǫ approximation with a number of value oracle calls of O( nr2 ǫ )). It is not as efficient as the algorithm for the monotone case, but to the best of our knowledge, this constitutes the first practical 1 e − ǫ approximation algorithm for general non-negative submodular function subject to a matroid constraint. ¯d (cid:1)2 ǫ4 (cid:0) log2( n ¯d+ d ¯ ¯d+ d ¯ ¯d+ d ¯ ¯d+ d ¯ 3 Algorithm Analysis We split the analysis of the accelerated measured continuous greedy algorithm in three parts: first we show that the solution produced is feasible, i.e. y(1) ∈ P (M); then we prove the 1 e − ǫ approximation; and finally we study its running time. Feasibility Theorem 3.1. The accelerated measured continuous greedy algorithm produces a feasible fractional solution, i.e., y(1) ∈ P (M). Proof. We follow the approach used by [12]. We first define a vector x that coordinate wise upper- bounds y(1). Then, given that P (M) is down-monotone, we only need to show that x is in P (M) 1 δ −1 l=0 1B(y(lδ)). This is a coordinate-wise upper bound of y(1) because when i ∈ B, we have that yi(t + δ) − yi(t) = 1 + e−δ(yi(t) − 1) − yi(t) = to show that y(1) ∈ P (M). Consider the vector x = δP 3 Algorithm Analysis 7 (1 − e−δ)(1 − yi(t)) ≤ 1 − e−δ ≤ δ, for all δ ∈ [0, 1]; and when i /∈ B yi(t + δ) − yi(t) = 0. We now show that x is in P (M). First, note that by definition 1B ∈ P (M). Then, observe that x/δ is the sum of 1 δ points in P (M), thus (x/δ)/(1/δ) = x is a convex combination of points in P (M), hence x ∈ P (M), and consequently y(1) ∈ P (M). In fact, it is possible to find a point that still lies in P (M) even with a t > 1, specifically stopping at a value depending on a magnitude called the density of the matroid. This yields tighter approximation bounds that match those found for particular matroids, such as partition matroids. Asymptotically, however, these bounds are the same as those presented here. Therefore, in the aim of simplicity, the analysis is carried out with a stopping time of 1. The interested reader is referred to [12]. Now let us establish a bound to the coordinates of y(t) that will become useful later in the analysis of the approximation ratio. Lemma 3.2. At time 0 ≤ t ≤ 1, we have that: yi(t) ≤ 1 − e−t, ∀i ∈ E. (6) Proof. Consider the recurrence g(n + 1) = 1 + e−δ(1 − g(n)), with g(0) = 0. This recurrence has the following solution: g(n) = 1 − e−nδ. Now, in our algorithm t is incremented linearly, so the number of iteration, n, and t are related by t = nδ. At t, all the coordinates of y either, they stay constant, i.e. yi(t + δ) = yi(t), when i /∈ B, or increase, i.e. yi(t + δ) = 1 + e−δ(yi(t) − 1), when i ∈ B. Hence, given that g(n) is non-decreasing, the recurrence g is an upper bound because it corresponds to incrementing in each and every iteration. Consequently, at t, y(t) ≤ g( t δ ) = 1 − e−t. Approximation Ratio First we show the gain that the algorithm makes in a single step, and then use this to build a recurrence relation that yields the approximation ratio. But before we do that, we bound the error introduced by sampling: Corollary 3.3. Given a non-negative submodular function f : 2E → R+, and a point y ∈ [0, 1]E; d ≤ fS(j) ≤ ¯d for all d, ¯d ∈ R+ be the minimum and maximum marginal values of f , such that − let ¯ ¯ S ⊆ E and j ∈ E; let R1, R2, ..., Rm be iid samples drawn from R(y), let wj(y) = 1 i=1 fRi(j); and let f (OP T ) = maxS∈I f (S). Then, mPm Pr(wj (y) − ∆Fj (y) ≥ βf (OP T )) ≤ 2e d(cid:1)2 −2mβ2(cid:0) ¯d ¯d+ ¯ . Proof. Immediate application from the Hoeffding bound in Lemma 1.3, noting that f (OP T ) = maxS∈I f (S) ≥ maxe∈E f ({e}) = ¯d. Now we can present the improvement made by the algorithm in a single step: Lemma 3.4. Let OP T be an optimal solution. Given a fractional solution y, the Decreasing- Threshold produces a set B such that, with y′ = 1 + e−1Bδ ⊙ (y − 1), we have: F (y′) − F (y) ≥ (1 − e−δ)(cid:18)(1 − 4ǫ)(1 − ¯y′)f (OP T ) − F (y′)(cid:19) (7) 3 Algorithm Analysis 8 Proof. This proof follows closely the proof of Claim 4.1 in [14] but with several modifications to avoid assuming monotonicity, namely: the stopping threshold, the sampling error, and the increment bound. Assume that the Decreasing-Threshold procedure returns a sequence of r elements B = {b1, b2, . . . , br}, indexed in the order in which they were chosen. Let O = {o1, o2, . . . , or} be an optimal solution indexed as per the exchange property of the matroids in Lemma 1.1 such that φ(bi) = oi. Additionally, let Bi and Oi denote the first i elements of B and O respectively, i.e. Bi is the sequence in which the elements have been added to B in algorithm 2 up until the ith element was added. If the procedure returns fewer than r elements or the optimal solution contained fewer than r elements, formally we just add dummy elements with value 0, so that B = r and O = r. Now let us bound the marginal values of the elements selected by the Decreasing-Threshold procedure with respect to those in the optimal solution. Recall that y(S, δ) is the notation that we use to refer to the point such that yk(S, δ) = yk if k /∈ S and yk(S, δ) = 1 + e−δ(yk − 1) if k ∈ S. When bi is selected, let w be the current threshold, hence wbi (y(Bi−1, δ)) ≥ w. At this point oi is a candidate element, thus we have one of two situations depending on whether the procedure has finished: if the threshold has not dropped below ǫ r d(1 − ¯y′), the value of woi (y(Bi−1, δ)) must be below the threshold in the previous iteration, i.e. woi (y(Bi−1, δ)) ≤ w (1−ǫ) (otherwise it would have been chosen already); conversely, if the procedure has terminated, bi is a dummy element with value ¯d r (1− ¯y′). 0, and the value of woi (y(Bi−1, δ)) is below the stopping threshold, i.e. woi(y(Bi−1, δ)) ≤ ǫ Consequently, we can relate the marginal value estimate of bi to that of oi: wbi (y(Bi−1, δ)) ≥ (1 − ǫ)woi (y(Bi−1, δ)) − ǫ ¯d r (1 − ¯y′). Note that when bi is selected we have that Bi−1 + bi ∈ I, and by the definition of oi (i.e. the matroid exchange property) Bi−1 + oi ∈ I. Now we need to bound the error incurred by sampling. From Lemma 3.3 we can sample r f (OP T )(1 − ¯y′) by taking the average of the marginal values up to an additive error of β = ǫ log(E)(cid:19) samples with high probability (i.e. with a bad estimate probability decreas- E ). (We do not have a term O( 1 ing with 1 time, t = 1, and the update rule enforce (see Lemma 3.2) that (1 − ¯y′) ≥ 1 1−¯y ′ ) in the number of samples because our stopping e ). Thus, we can write: O(cid:18) r2 ǫ2(cid:0) ¯d+ d ¯ ¯d (cid:1)2 wbi (y(Bi−1, δ)) ≤ ∆Fbi (y(Bi−1, δ)) + woi(y(Bi−1, δ)) ≥ ∆Foi(y(Bi−1, δ)) − f (OP T )(1 − ¯y′) f (OP T )(1 − ¯y′) ǫ r ǫ r which, with ¯d ≤ f (OP T ), can be combined with the prior bound to yield: ∆Fbi (y(Bi−1, δ)) ≥ (1 − ǫ)∆Foi (y(Bi−1, δ)) − 3 ǫ r f (OP T )(1 − ¯y′). (8) Then, we can bound the improvement that the Decreasing-Threshold procedure obtains: 3 Algorithm Analysis 9 F (y′) − F (y) r (F (y(Bi, δ)) − F (y(Bi−1, δ)) (y′ bi − ybi) ∂F ∂ybi(cid:12)(cid:12)(cid:12)(cid:12)y=y(Bi−1,δ) ∂F (1 − e−δ)(1 − ybi) = = = r Xi=1 Xi=1 Xi=1 r ∂ybi(cid:12)(cid:12)(cid:12)(cid:12)y=y(Bi−1,δ) r r ǫ r = (1 − e−δ) ∆Fbi (y(Bi−1, δ)) Xi=1 Xi=1(cid:18)(1 − ǫ)∆Foi (y(Bi−1, δ)) − 3 ≥ (1 − e−δ) f (OP T )(1 − ¯y′)(cid:19) Xi=1(cid:18)∆Foi(y(Bi−1, δ))(cid:19) − 3ǫf (OP T )(1 − ¯y′)(cid:19) = (1 − e−δ)(cid:18)(1 − ǫ) ≥ (1 − e−δ)(cid:18)(1 − ǫ)(cid:0)F (y′ ∨ 1OPT) − F (y′)(cid:1) − 3ǫf (OP T )(1 − ¯y′)(cid:19) ≥ (1 − e−δ)(cid:18)(1 − 4ǫ)(1 − ¯y′)f (OP T ) − F (y′)(cid:19). r The second equality comes from the the multilinearity of F . With the update step y′ = 1 + e−δ(y − 1), we have that the increment is y′ − y = (1 − e−δ)(1 − y), which gives the third inequality. The fourth equality is by definition of ∆Fe. The fifth inequality is by the bound in equation 8, the sixth by submodularity, and the last one by Lemma 1.2. Finally, we can use the above result to build a recurrence relation that yields the 1 e − ǫ approx- imation ratio. Theorem 3.5. The accelerated measured continuous greedy algorithm returns a point y∗ ∈ P (M), such that: F (y∗) ≥(cid:18) 1 e − 2ǫ(cid:19)f (OP T ). (9) Proof. From Lemma 3.4 we have that: F (y(t + δ)) − F (y(t)) ≥ (1 − e−δ)(cid:18)(1 − 4ǫ)(1 − ¯y(t + δ))f (OP T ) − F (y(t + δ))(cid:19) We can now use the bound on the value of the coordinates of y in Lemma 3.2, we have that yi(t) ≤ 1 − e−t ∀i ∈ E, hence we can write: F (y(t + δ)) − F (y(t)) ≥ (1 − e−δ)(cid:18)(1 − 4ǫ)e−(δ+t)f (OP T ) − F (y(t + δ))(cid:19). (10) 3 Algorithm Analysis 10 Consider the recurrence relation a(n + 1) − a(n) = k1(k2 exp(−(n + 1)ǫ) − a(n + 1)), which, with a(0) = a0, has the following solution a(n) = ( 1 k1+1 )n(a0(−k1 + eǫ − 1) + k1k2) − k1k2e−nǫ −k1 + eǫ − 1 . (11) This recurrence is equivalent to equation 3 if we set k1 = (1 − e−δ), k2 = (1 − 4ǫ), n = t δ , and δ = ǫ. Thus, substituting and simplifying assuming that F (0) ≥ 0 (due to the non-negativity of f ), we have the following lower bound on the value of the solution y(t) for any time t ∈ [0, 1]: F (y(t)) ≥ (1 − e−ǫ)(1 − 4ǫ)eǫ(−( t ǫ +1))(eǫ( t e−ǫ + eǫ − 2 ǫ +1)( So, when the algorithm ends at t = 1, we have: F (y(1)) ≥ (1 − e−ǫ)(1 − 4ǫ)eǫ(−( 1 ǫ +1))(eǫ( 1 e−ǫ + eǫ − 2 ǫ +1)( 1 2−e−ǫ )t/ǫ − eǫ) f (OP T ). 1 2−e−ǫ )1/ǫ − eǫ) f (OP T ). We can find a more intuitive version of this bound by observing that, clearly, for 0 ≤ ǫ ≤ 1: 1 e − Hence: (1 − e−ǫ)(1 − 4ǫ)eǫ(−( 1 ǫ +1))(eǫ( 1 e−ǫ + eǫ − 2 ǫ +1)( 1 2−e−ǫ )1/ǫ − eǫ) ≤ 5 e ǫ ≤ 2ǫ F (y(1)) ≥(cid:18) 1 e − 2ǫ(cid:19)f (OP T ). (12) (13) Finally, from Lemma 3.2 we have that y(1) ∈ P (M). Running Time As it is common in the submodular maximisation literature, we quantify the running time in terms of value oracle calls to the submodular function and matroid independence oracle calls. We analyse the running time of the algorithm in two steps: first we study the running time of the Decreasing-Threshold procedure, and then that of the the continuous greedy. Lemma 3.6. The Decreasing-Threshold procedure makes O(cid:18) Er2 ǫ3 log(E) log( r ǫ )(cid:16) ¯d+ d ¯ ¯d (cid:17)2(cid:19) value oracle calls, and O(cid:0) E log r ǫ ǫ(cid:1) independence oracle calls. log ǫ Proof. First, the number of values that the threshold takes in the Decreasing-Threshold procedure to reach the stopping threshold is, considering that the term (1 − ¯y) ≥ 1 e due to Lemma 3.2, log (1−ǫ) ). Second, for each threshold value, the algorithm performs O(E) estimates of ∆Fe, O( and O(E) calls to the independence oracle. Therefore, the number of independence oracle calls is the number of calls per threshold step multiplied by the number of threshold steps, i.e.: r O(cid:18) E ǫ log r ǫ(cid:19), (14) 4 Discussion and Future Work 11 which has been simplified noting that log ǫ log 1−ǫ ≤ 1 r ǫ log( r ǫ ). the number of value oracle calls is Now, each estimate of ∆Fe requires O(cid:18) r2 ǫ2(cid:0) O Er2 log(E) log(cid:16) r log(E)(cid:19) samples. Hence, we can conclude that ǫ(cid:17)(cid:18) ¯d + ¯d (cid:19)2! . ¯d (cid:1)2 ¯d+ d ¯ d ¯ ǫ3 We can now quantify the running time of the whole algorithm. Theorem 3.7. The accelerated measured continuous greedy algorithm makes O(cid:18) Er2 ǫ4 log(E) log( r ǫ )(cid:16) ¯d+ d ¯ ¯d (cid:17)2(cid:19) value oracle calls, and O(cid:0) E ǫ2 log r ǫ(cid:1) independence oracle calls. Proof. Considering that the number of steps of the procedure, with δ = ǫ, is 1 ǫ . The number of calls to boths oracles is simply the number of calls by the Decreasing-Threshold procedure (Algorithm 2) in Lemma 3.6 multiplied by the number of steps in the continuous greedy algorithm (Algorithm 1). 4 Discussion and Future Work In this paper we have presented a 1 e −ǫ-approximation algorithm for general non-negative submodu- lar function maximisation that requires O( nr2 ǫ )) value oracle calls. This is the fastest 1 e -approximation algorithm currently available, which enables the use of general (non-monotone) matroid-constrained submodular maximisation for many applications for which existing algorithms were implausibly slow. We think this is of great significance because there has been a recent surge of interest for applying submodular maximisation in fields where large problem instances are paramount, such as Machine Learning [24, 25, 5], particularly in the field of summarisation where non-monotone submodular functions are natural [26, 27]. Our algorithm is slower than the one ¯d (cid:1)2 ǫ4 (cid:0) log2( n ¯d+ d ¯ presented for the monotone case in [14] by O(cid:0)r(cid:0) values of the multilinear extension up to an additive and multiplicative bound. If we could, then we would reduce the additional value oracle calls required to achieve an algorithm with the same running time, we believe this might be possible. ¯d (cid:1)2(cid:1) due to the inability to sample the marginal ¯d+ d ¯ A future avenue of research would be to combine our work with the very interesting results in [28], where an efficient algorithm is proposed to allow the trade-off of value oracle calls and matroid independence calls for non-negative monotone submodular functions, to enable query trade-off for general non-negative submodular functions. Another interesting path is to combine the more continuous-like measured continuous greedy update step that we present here with the acceleration techniques for strong submodular functions presented in [29] to produce an adaptive step algorithm. This way, in each step we could use a large δ that extended to the boundary of the region of validity of the set B, instead of taking a δ that is small enough to satisfy the worst case. Another obvious improvement on the algorithms presented here would be to combine the ideas from the Lazy Greedy Algorithm [30] to adaptively change the decrement of the threshold in the Decreasing-Threshold procedure. 4 Discussion and Future Work 12 References [1] A. Krause and D. Golovin, "Submodular function maximization," Tractability: Practical Approaches to Hard Problems 3 no. 19, (2012) 8. [2] B. Lehmann, D. Lehmann, and N. Nisan, "Combinatorial auctions with decreasing marginal utilities," in Proceedings of the 3rd ACM conference on Electronic Commerce, pp. 18 -- 28, ACM. 2001. [3] S. Dughmi, T. Roughgarden, and M. Sundararajan, "Revenue submodularity," in Proceedings of the 10th ACM conference on Electronic commerce, pp. 243 -- 252, ACM. 2009. [4] D. Kempe, J. Kleinberg, and ´E. Tardos, "Maximizing the spread of influence through a social network," in Proceedings of the ninth ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 137 -- 146, ACM. 2003. [5] H. Lin and J. Bilmes, "Multi-document summarization via budgeted maximization of submodular functions," in Human Language Technologies: The 2010 Annual Conference of the North American Chapter of the Association for Computational Linguistics, pp. 912 -- 920, Association for Computational Linguistics. 2010. [6] A. Krause, J. Leskovec, C. Guestrin, J. VanBriesen, and C. Faloutsos, "Efficient sensor placement optimization for securing large water distribution networks," Journal of Water Resources Planning and Management 134 no. 6, (2008) 516 -- 526. [7] J. Leskovec, A. Krause, C. Guestrin, C. Faloutsos, J. VanBriesen, and N. Glance, "Cost-effective outbreak detection in networks," in Proceedings of the 13th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 420 -- 429, ACM. 2007. [8] A. Schrijver, Combinatorial Optimization: Polyhedra and Efficiency. Algorithms and Combinatorics. Springer Berlin Heidelberg, 2003. [9] G. L. Nemhauser, L. A. Wolsey, and M. L. Fisher, "An analysis of approximations for maximizing submodular set functionsI," Mathematical Programming 14 no. 1, (Dec, 1978) 265 -- 294. [10] J. Vondrak, "Optimal approximation for the submodular welfare problem in the value oracle model," in Proceedings of the fourtieth annual ACM symposium on Theory of computing - STOC 08, p. 67. ACM Press, New York, New York, USA, May, 2008. [11] G. Calinescu, C. Chekuri, M. P´al, and J. Vondr´ak, "Maximizing a Monotone Submodular Function Subject to a Matroid Constraint," SIAM Journal on Computing 40 no. 6, (Jan, 2011) 1740 -- 1766. [12] M. Feldman, J. Naor, and R. Schwartz, "A Unified Continuous Greedy Algorithm for Submodular Maximization," in 2011 IEEE 52nd Annual Symposium on Foundations of Computer Science, pp. 570 -- 579. IEEE, Oct, 2011. [13] J. Vondr´ak, C. Chekuri, and R. Zenklusen, "Submodular function maximization via the multilinear relaxation and contention resolution schemes," in Proceedings of the forty-third annual ACM symposium on Theory of computing, pp. 783 -- 792, ACM. 2011. 4 Discussion and Future Work 13 [14] A. Badanidiyuru and J. Vondr´ak, "Fast algorithms for maximizing submodular functions," in Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 1497 -- 1514, Society for Industrial and Applied Mathematics. 2014. [15] U. Feige, "A threshold of ln n for approximating set cover," Journal of the ACM (JACM) 45 no. 4, (1998) 634 -- 652. [16] S. O. Gharan and J. Vondr´ak, "Submodular maximization by simulated annealing," in Proceedings of the twenty-second annual ACM-SIAM symposium on Discrete Algorithms, pp. 1098 -- 1116, Society for Industrial and Applied Mathematics. 2011. [17] A. Ene and H. L. Nguyen, "Constrained submodular maximization: Beyond 1/e," in Foundations of Computer Science (FOCS), 2016 IEEE 57th Annual Symposium on, pp. 248 -- 257, IEEE. 2016. [18] N. Buchbinder and M. Feldman, "Constrained Submodular Maximization via a Non-symmetric Technique," arXiv:1611.03253. [19] W. Hoeffding, "Probability inequalities for sums of bounded random variables," Journal of the American statistical association 58 no. 301, (1963) 13 -- 30. [20] C. Chekuri, J. Vondr´ak, and R. Zenklusen, "Submodular Function Maximization via the Multilinear Relaxation and Contention Resolution Schemes," SIAM Journal on Computing 43 no. 6, (Nov, 2014) 1831 -- 1879. [21] A. Ageev and M. Sviridenko, "Pipage Rounding: A New Method of Constructing Algorithms with Proven Performance Guarantee," Journal of Combinatorial Optimization 8 no. 3, (Sep, 2004) 307 -- 328. [22] J. Vondr´ak, "Symmetry and approximability of submodular maximization problems," SIAM Journal on Computing 42 no. 1, (2013) 265 -- 304. [23] J. Vondrak, "A note on concentration of submodular functions," arXiv:1005.2791. [24] B. Mirzasoleiman, A. Badanidiyuru, and A. Karbasi, "Fast constrained submodular maximization: Personalized data summarization," in ICLM'16: Proceedings of the 33rd International Conference on Machine Learning (ICML). 2016. [25] J. Bilmes and W. Bai, "Deep Submodular Functions," arXiv:1701.08939. [26] S. Tschiatschek, R. K. Iyer, H. Wei, and J. A. Bilmes, "Learning mixtures of submodular functions for image collection summarization," in Advances in neural information processing systems, pp. 1413 -- 1421. 2014. [27] A. Dasgupta, R. Kumar, and S. Ravi, "Summarization Through Submodularity and Dispersion.," in ACL (1), pp. 1014 -- 1022. 2013. [28] N. Buchbinder, M. Feldman, and R. Schwartz, "Comparing Apples and Oranges: Query Tradeoff in Submodular Maximization," arXiv:1410.0773. [29] Z. Wang, B. Moran, X. Wang, and Q. Pan, "An accelerated continuous greedy algorithm for maximizing strong submodular functions," Journal of Combinatorial Optimization 30 no. 4, (2015) 1107 -- 1124. [30] M. Minoux, "Accelerated greedy algorithms for maximizing submodular set functions," in Optimization Techniques, pp. 234 -- 243. Springer-Verlag, Berlin/Heidelberg, 1978.
1505.01140
1
1505
2015-05-04T18:47:58
Depth-first search in split-by-edges trees
[ "cs.DS" ]
A layerwise search in a split-by-edges tree (as defined by Br{\ae}ndeland, 2015) of agiven graph produces a maximum independent set in exponential time. A depth-first search produces an independent set, which may or may not be a maximum, in linear time, but the worst case success rate is maybe not high enough to make it really interesting. What may make depth-first searching in split-by-edges trees interesting, though, is the pronounced oscillation of its success rate along the graph size axis.
cs.DS
cs
Depth-first search in split-by-edges trees Asbjørn Braendeland Abstract A split-by-edges tree of a graph G is a binary tree T where the root = V(G), every leaf is an independent set in G, and for every other node N in T with children L and R there is an edge uv in G such that u and v are in N, L = N – v and R = N – u. Every maximum independent set in G is in the same layer M, which is guarantied to be found in a layer by layer search of T. Every depth-first search in T will reach M, and may stop there, if a leaf was hit, or will pass through, to another, smaller, leaf below. For random graphs of a given order and increasing size the succes rates of depth-first searches in split-by-edges trees oscillate between local minima and maxima. The split by edges tree and the uniquified split by edges tree are defined in [1] as follows. Definition 1: Let G be graph and let T be a binary tree of subsets of V(G). Then T is a split-by-edges tree, or SBE-tree, of G if and only if the root of T = V(G), every leaf in T is an independent set of G, and for every other node N in T with children L and R there is a pair of vertices {u, v}  N such that L = N – u, R = N – v, and u and v are adjacent in G. Definition 2: An SBE-tree minus its duplicate nodes is a uniquified SBE-tree, or a USBE-tree. By Corollary 1.1. in [1], which says that every maximal independent set of G is a leaf in every SBE-tre of G, there is a layer MI in T that contains every maximum independent set in G[1], and the distance from the root of T to MI is n – (G), when n = V(G), and (G) is the independence number of G; and it follows from definition 2 that there is a corresponding layer M’I in the uniquified version T’ of T. For random graphs a layer-by-layer search, which is akin to a breadth-first search, through T’ produ- ces M’I in maximum 2O(0.37n) time [1]. A depth-first search through T reaches MI in n – (G) time, but since MI usually also contains non-independent sets, it is far from guarantied that an independent set will be hit, and if not, the search continues until a smaller independent set is found further down. Whether the SBE-tree being searched is uniquified or not, depends on the search method. In a layer-by- layer search the layers are created by the search procedure, which can keep duplicates out of the way. But since the cardinalities of the nodes are unique to each layer, duplicates can only occur layerwise, thus in a depth-first search, where only one node or two sibling nodes are examined per layer, the existence of duplicates is not relevant—which is to say that the tree being searched is not uniquified. The vertices of a graph G can be ordered by degree[1]. A layer-by-layer search for a maximum inde- pendent set in a USBE-tree of G is more efficient if the order is descending and less efficient if the order is ascending than if the order is arbitrary, due to the fact that a descending order gives a slimmer USBE-tree. Somewhat surprisingly, the effect is the opposite for depth-first search. The real surprise is that there is an effect at all, since in an SBE-tree the width of layer Ll = 2l all the way down to the layer that contains the maximum independent sets, regardless of how the graph is arranged. Independent of vertex ordering, the DFS success rate increases if we, instead of always choosing the left branch, choose the one with the fewest edges, or even better, the most stable branch, when the stability of a node N on n vertices is given by the formula ∑ 𝑣  𝑁 𝑛 deg𝐺(𝑁)(𝑣) + 1 1 (1) Figure 1. The curves show the number of successful MIS searches for six variations of depth-first search in the SBE trees of random graphs on 24 vertices. 10 000 graphs where searched for each size ranging from 24 to 276. (That there for some m are less than 10 000 different graphs, has no bearing on the shapes of the curves.) We will return to the peculiar oscillations shown in Figure 1, presently. The curves keep their shapes as n grows, but the success rates drop rather quickly, as shown in Figure 2. Figure 2. The histograms show the number of successful depth-first, most-stable-branch MIS searches in the SBE trees of six random graphs of order 24 to 64. 100 graphs where searched for each size, ranging from n to n(n – 1)/2.The minimum success ratio drops from about 0.71, for n = 24, to about 0.25, for n = 64. The accuracy of an MIS algorithm A for a graph G is the ratio A(G) /(G), when A(G) is the result of applying A to G. Accuracy is subject to the same size related oscillations as success. For n = 24 to 64 the lowest accuracy of depth-first, most-stable-branch searches in SBE-trees falls from 0.917 to 0.841. (A different, but nearly equivalent, type of measure is defined in [2].) 2 In Figure 1 and Figure 2, the numbers of successful depth-first searches for random graphs of a fixed order and increasing size oscillate between local minima and maxima. This oscillation shows up con- sistently in every comparable test, including tests where different random graph generators were used. In the grids on top of Figure 3 the red lines and the blue dottet lines indicate local maxima and minima, respectively, for depth-first searches in graphs of orders 15 to 40. The grid points can be seen as co- ordinates (n, m) of the graph orders and sizes that give the local extrema. The grids are based on 100 runs for each (n, m)1, and the vertical lines have been slightly smoothed. Figure 3. For comparison Figure 3 also contains a grid of (𝑛 2) values, where each dotted line indicates one value. Each vertical line contains a segment of the partial sums of N = (1, …, 40). Conversely, the difference sequences of each vertical line is a segment of N. The corresponding difference sequences for the two upper grids are close to some, but not quite equal to any segments of N. 1 The fact that there is only one graph with n vertices and n(n–1)/2 edges is immaterial, since no algorithm ever fails for this value of m. 3 Reference [1] [2] [3] Braendeland, Asbjørn. Split-by-edges trees. 2015. arXiv:1504.07626 Halldórssonz, Magnús M. Radhakrishnan, Jaikumar. Greed is good: Approximating independent sets in sparse and bounded-degree graphs. 1997 Knuth, Donald E. (1997), The Art Of Computer Programming Vol 1. 3rd ed, Boston: Addison-Wesley, ISBN 0-201-89683-4. 4
1304.7055
1
1304
2013-04-26T02:28:22
An LP-based 3/2-approximation algorithm for the graphic s-t path TSP
[ "cs.DS" ]
We design a new LP-based algorithm for the graphic $s$-$t$ path Traveling Salesman Problem (TSP), which achieves the best approximation factor of 1.5. The algorithm is based on the idea of narrow cuts due to An, Kleinberg, and Shmoys. It partly answers an open question of Seb\H{o}.
cs.DS
cs
An LP-based 3 2-approximation algorithm for the graphic s-t path TSP Zhihan Gao∗ Abstract We design a new LP-based algorithm for the graphic s-t path Traveling Salesman Problem (TSP), which achieves the best approximation factor of 1.5. The algorithm is based on the idea of narrow cuts due to An, Kleinberg, and Shmoys. It partly answers an open question of Sebo. Keywords: approximation algorithms, linear programming, s-t path TSP. 1 Introduction The metric Traveling Salesman Problem (TSP) is one of the most well-known problems in the area of combinatorial optimization. For the metric TSP, Christofides [4] presented an algorithm that achieves an approximation guarantee of 3 2 . Hoogeveen [8] extended the algorithm to the metric s-t path TSP, and proved an approximation guarantee of 5 3 . This had been the best approxima- tion factor for decades until the recent paper [1, An, Kleinberg, and Shmoys] improved on the 5 3 approximation guarantee and presented an algorithm that achieves an approximation guarantee of 1+√5 2 ≈ 1.61803. Most recently, [11, Sebo] further improved the approximation factor to 1.6. For the graphic s-t path TSP, a special case of the metric s-t path TSP, [2, An and Shmoys] provided a sightly improved performance guarantee of ( 5 3 − ǫ). The paper [9, Momke and Svensson] gave a 1.586-approximation algorithm for the graphic s-t path TSP. [10, Mucha] improved the analysis of [9] and obtained a 19 12 + ǫ ≈ 1.58333 + ǫ approximation guarantee for any ǫ > 0 for the graphic s-t path TSP. Recently, [12, Sebo and Vygen] gave the first 1.5-approximation algorithm for the graphic s-t path TSP. Their algorithm and its analysis are sophisticated, and are based on ear decomposition. The algorithm applies both local and global optimization to the ears. In this paper, we present a new 1.5-approximation algorithm for the graphic s-t path TSP. Compared with the algorithm from [12, Sebo and Vygen], our algorithm and its analysis are much simpler. The notion of narrow cuts for s-t path TSP was introduced by [1, An, Kleinberg, and Shmoys]. Our algorithm is based on this idea. In [11], Sebo posed an open question on applying the "Best of Many Christofides" algorithm in [1] to achieve the best approximation guarantees known for the graphic special cases of TSP and its variants. Although our algorithm seems different from the "Best of Many Christofides" algorithm, they share the idea of narrow cuts. From this point of view, our algorithm answers this question partly for the graphic s-t path TSP. The key point of our algorithm is to find a minimal spanning tree that intersects every narrow cut in an odd number of edges. Such a tree guarantees that the minimum size of the edges fixing the wrong degree vertices ∗([email protected]) Dept. of Comb. & Opt., University of Waterloo, Waterloo, Ontario N2L3G1, Canada. 1 is at most half of the optimal value of the linear programming relaxation. Finally, the union of the spanning tree and the fixing edges gives us the 1.5-approximation guarantee. 2 Preliminaries Let G = (V, E) be a connected graph with unit cost on each edge. Let s, t be two given vertices in G. Consider the metric completion (G′, c′) of G where c′ is the cost function on each edge e = (u, v) in G′ such that c′e is the minimal cost of any u-v path in G. The graphic s-t path TSP is to find a minimum cost Hamiltonian path from s to t in G′ with edge costs c′. Denote the cost of this path by OP T (G). For any vertex subset φ ( S ( V , we define δG(S) = {(u, v) ∈ E : u ∈ S, v /∈ S}. If there is no ambiguity, we use δ(S) for short. In particular, if S = {v}, we use δ(v) instead of δ({v}). Let W = {W1, W2, . . . , Wl} be a partition of vertex set V . Define δ(W) = ∪1≤i≤lδ(Wi). Let x ∈ RE. For any F ⊆ E, we define x(F ) = Pe∈F xe. Let 2G be the graph obtained from G by doubling every edge of G. The graphic s-t path TSP of G is equivalent to finding a minimum-size trail in 2G from s to t visiting every vertex at least once (multiple visits are allowed). That is to find a minimum-size connected spanning subgraph of 2G with {s, t} as the odd-degree vertex set. The following linear program (LP) on the original graph G is a relaxation of the graphic s-t path TSP: (L.P.1) minimize : Pe∈E xe subject to : x(δ(W)) ≥ W − 1 ∀ partition W of V x(δ(S)) ≥ 2 2 ≥ xe ≥ 0 ∀∅ ( S ( V, S ∩ {s, t} even ∀e ∈ E Let x∗ be an optimal solution of (L.P.1). Note that (L.P.1) can be solved in polynomial time via the ellipsoid method [7]. We know that Pe∈E x∗e ≤ OP T (G). Let S ⊆ V . If S ∩ {s, t} = 1, we call S an s-t cut. Furthermore, if x∗(δ(S)) < 2, we call S a narrow cut. Lemma 2.1 [1, Lemma 1] Let S1, S2 ⊆ V be two distinct narrow cuts such that s ∈ S1 and s ∈ S2. Then S1 ( S2 or S2 ( S1. Hence, we know that the set of narrow cuts containing s forms a nested family. Let S1, S2, . . . , Sk be all the narrow cuts containing s such that s ∈ S1 ( S2 ( S3 · · · ( Sk ( V . Define Li = Si\Si−1 for i = 1, 2, . . . , k, k + 1 where S0 = φ and Sk+1 = V . Note that each Li is nonempty and ∪1≤i≤k+1Li = V . Let T be a nonempty subset of V with T even. For F ⊆ E, if the set of odd-degree vertices of graph (V, F ) is T , then we call F a T -join. Note that if G is connected, then a T -join always exists. For any S ⊆ V , if S ∩ T is odd, we call it T -odd cut. The following LP formulates the problem of finding a T -join of minimum size: (L.P.2) minimize : Pe∈E xe subject to : x(δ(S)) ≥ 1 ∀ T -odd S xe ≥ 0 ∀e ∈ E Lemma 2.2 [6] The optimal value of (L.P.2) is the same as the minimum size of a T -join. Let F ⊆ E. For any v ∈ V , we call v a wrong degree vertex with respect to F if δ(v) ∩ F is (even if v ∈ {s, t} if v /∈ {s, t}. odd (1) 2 We use the next lemma through the rest of the paper. Lemma 2.3 [3, Lemma 1] Let G = (V, E) be a graph, let s, t be two vertices of G, let F be a set of edges of G, and let T be the set of wrong-degree vertices with respect to F . Then, for any S ⊆ V , if S is T -odd and also satisfies S ∩ {s, t} = 1, then δ(S) ∩ F is even. 3 LP-based 3 2-approximation algorithm In this section, we give an LP-based 3 the algorithm, we need some lemmas. 2 -approximation algorithm for s-t path TSP. Before stating Lemma 3.1 There is a polynomial-time combinatorial algorithm to find all narrow cuts S1, S2, . . . , Sk. Proof. Compute the Gomory-Hu tree for the terminal vertex set V with respect to the capacity x∗ (See [5, Section 3.5.2]). After that, for each edge of the s-t path in the Gomory-Hu tree, check the corresponding cut. We claim that each such cut with x∗ capacity less than 2 is a narrow cut, and there are no other narrow cuts. The correctness of this claim follows from the following observation: For any u ∈ Li, v ∈ Li+1, the narrow cut Si is the unique minimum u-v cut, and furthermore, Si is also a s-t cut. (cid:3) Let H be the support graph of x∗. For any L ⊆ V (H), the subgraph of H induced by L is denoted by H(L). Lemma 3.2 For 1 ≤ p ≤ q ≤ k + 1, H(∪p≤i≤qLi) is connected. Consider the graph H which is the support graph of x∗. Note that x∗(δH (S)) = Proof. x∗(δG(S)) for any φ ⊂ S ⊂ V . In this proof, the notation refers to H, e.g., δ(S) means δH(S). Let L = ∪p≤i≤qLi. We divide the proof into several cases: Case 1: p = 1 and q = k + 1, i.e., H = H(L). The partition cut constraint in (L.P.1) implies that H is connected. Case 2: p = 1 and q < k + 1. Suppose H(L) is not connected. Then, there exist two nonempty vertex sets U1 and U2 such that U1, U2 is a partition of L and there exists no edge between U1 and U2 in H. Without loss of generality, we can assume that s ∈ U1. By the constraints of (L.P.1), we have x∗(δ(U1)) ≥ 1 and x∗(δ(U2)) ≥ 2. However, L = Sq is a narrow cut, which implies x∗(δ(L)) < 2. Note that δ(U1) ∩ δ(U2) = φ and δ(L) = δ(U1) ∪ δ(U2). So, 2 > x∗(δ(L)) = x∗(δ(U1)) + x∗(δ(U2)) ≥ 1 + 2 = 3. This is a contradiction. Case 3: p > 1 and q = k + 1. By the symmetry of s and t, it is the same as Case 2. Case 4: p > 1 and q < k + 1. Suppose H(L) is not connected. Then, similarly there exist two nonempty vertex sets U1 and U2 such that U1, U2 is a partition of L and there exists no edge between U1 and U2 in H. In this case, by the constraints of (L.P.1), we have x∗(δ(U1)) ≥ 2 and x∗(δ(U2)) ≥ 2. Let Y1 = ∪1≤i≤qLi and Y2 = ∪p≤i≤k+1Li. Note that Y1 and Y2 are two narrow cuts. Also, δ(U1) ∪ δ(U2) ⊆ δ(Y1) ∪ δ(Y2). Note that δ(U1) ∩ δ(U2) = φ by the definition of U1 and U2. Thus, 4 > x∗(δ(Y1)) + x∗(δ(Y2)) ≥ x∗(δ(Y1) ∪ δ(Y2)) ≥ x∗(δ(U1) ∪ δ(U2)) = x∗(δ(U1)) + x∗(δ(U2)) ≥ 2 + 2 = 4. This is a contradiction. (cid:3) Corollary 3.3 For every 1 ≤ i ≤ k + 1, H(Li) is connected, and moreover there exists an edge connecting Li and Li+1 in H. 3 Algorithm 1 LP-based approximation for the graphic s-t path TSP Step 1. Find an optimal solution x∗ of (L.P.1) and construct the support graph H of x∗. Step 2. Find the narrow cuts S1, S2, . . . , Sk containing s, and get the corresponding sets L1, L2, . . . , Lk+1 (recall: Li = Si\Si−1 where S0 = φ and Sk+1 = V ). If no narrow cuts exist, take J as a spanning tree in G and go to Step 6. Step 3. For 1 ≤ i ≤ k + 1, find a spanning tree Ji on H(Li). Step 4. Take an edge ei from H connecting Li to Li+1 for 1 ≤ i ≤ k. Let Eb = ∪1≤i≤k{ei}. Step 5. Construct a spanning tree J = (∪1≤i≤k+1Ji) ∪ Eb. Step 6. Let T be the wrong degree vertex set of J. Find the minimum size T -join F in G. Step 7. Output J ∪F (disjoint union of edge sets in 2G). Lemma 3.1 provides a polynomial algorithm for Step 2, and Corollary 3.3 guarantees that Step 3 and Step 4 are feasible. Thus, the LP-based algorithm runs in polynomial time. Lemma 3.4 For F in the LP-based algorithm, we have F ≤ x∗e. 1 2Xe∈E Proof. Firstly, we claim x∗(δ(S)) ≥ 2 for every T -odd cut where T is the wrong degree vertex set of J in the LP-based algorithm. Let S be a T -odd cut. There are two cases to be considered. Case 1: S is not an s-t cut. Then, by the constraint of (L.P.1), we have x∗(δ(S)) ≥ 2 Case 2: S is an s-t cut. If there exist no narrow cuts, then clearly x∗(δ(S)) ≥ 2. Otherwise, for any narrow cut S′, we have J ∩ δ(S′) = 1 by Step 4 of the algorithm. However, by Lemma 2.3, we have J ∩ δ(S) is even. This means S is not a narrow cut. Thus, x∗(δ(S)) ≥ 2. By the claim, we know 1 of (L.P.2). By Lemma 2.2, we have F ≤ 1 2 x∗(δ(S)) ≥ 1 for every T -odd cut S. This implies 1 2 x∗ is a feasible solution (cid:3) 2Pe∈E x∗e. This completes the proof. Remark 3.5 In fact, if we can find a spanning tree J such that J ∩ δ(S) is odd for each narrow cut S, then we can find an edge set F to correct the wrong degree vertices in J such that F ≤ 1 2Pe∈E x∗e. This also holds for the (general) metric s-t path TSP, i.e., for metric costs, if we can find such a spanning tree J, then the minimum cost of the edges fixing the wrong degree vertices in J is at most half of the cost of the optimal solution of LP. Theorem 3.6 The LP-based algorithm is a 3 2 -approximation for the graphic s-t path TSP. Pe∈E x∗e ≤ OP T (G). Also note that F ≤ 1 Proof. Note that J is a spanning tree of G. We consider J as an edge set. So, J = V − 1 ≤ 2 OP T (G). Since J ∪F is a connected spanning subgraph of 2G with {s, t} as the odd-degree vertex set, this gives a s-t Hamiltonian path on the metric completion of G with cost at most J + F . Therefore, the LP-based algorithm is a 3 2 -approximation algorithm. (cid:3) 2Pe∈E x∗e ≤ 1 4 Remark 3.7 By the proof of Theorem 3.6, we can obtain an upper bound 3 2 for the integrality ratio of the (L.P.1). Furthermore, this also implies that the integrality ratio of the path-variant Held-Karp relaxation (See [1]) is at most 3 2 when restricted to graphic metric. Note that [1, Figure 1(b)] presented an example with graphic metric to show the lower bound 3 2 for the integrality ratio of the path-variant Held-Karp relaxation. Hence, from this point of view, our algorithm achieves the best possible approximation guarantee that the LP-based algorithms can get for the graphic s-t path TSP. Acknowledgements. The author is grateful to Joseph Cheriyan for stimulating discussions and indispensable help, and to Zachary Friggstad, Laura Sanit`a and Chaitanya Swamy for their useful comments. References [1] H.-C. An, R. Kleinberg, and D. B. Shmoys. Improving Christofides' algorithm for the s-t path TSP. In STOC, pages 875 -- 886, 2012. [2] H.-C. An and D. B. Shmoys. LP-based approximation algorithms for Traveling Salesman Path Problems. CoRR, abs/1105.2391, 2011. [3] J. Cheriyan, Z. Friggstad, and Z. Gao. Approximating minimum-cost connected T-joins. In APPROX-RANDOM, pages 110 -- 121, 2012. [4] N. Christofides. Worst-case analysis of a new heuristic for the travelling salesman problem. Technical Report 388, Graduate School of Industrial Administration, CMU, 1976. [5] W. J. Cook, W. H. Cunningham, W. R. Pulleyblank, and A. Schrijver. Combinatorial Opti- mization. Wiley-Interscience, 1998. [6] J. Edmonds and E. L. Johnson. Matching: A well-solved class of integer linear programs. In Combinatorial Optimization, pages 27 -- 30, 2001. [7] M. Grotschel, L. Lov´asz, and A. Schrijver. The ellipsoid method and its consequences in combinatorial optimization. Combinatorica, 1(2):169 -- 197, 1981. [8] J. Hoogeveen. Analysis of Christofides' heuristic: Some paths are more difficult than cycles. Operations Research Letters, 10:291 -- 295, 1991. [9] T. Momke and O. Svensson. Approximating graphic TSP by matchings. In FOCS, pages 560 -- 569, 2011. [10] M. Mucha. 13/9-approximation for graphic TSP. In STACS, pages 30 -- 41, 2012. [11] A. Sebo. Eight-fifth approximation for TSP paths. CoRR, abs/1209.3523, 2012. To appear in IPCO 2013. [12] A. Sebo and J. Vygen. Shorter tours by nicer ears: 7/5-approximation for graphic TSP, 3/2 for the path version, and 4/3 for two-edge-connected subgraphs. CoRR, abs/1201.1870, 2012. 5
1602.08820
1
1602
2016-02-29T04:38:50
Compressing Graphs and Indexes with Recursive Graph Bisection
[ "cs.DS", "cs.SI" ]
Graph reordering is a powerful technique to increase the locality of the representations of graphs, which can be helpful in several applications. We study how the technique can be used to improve compression of graphs and inverted indexes. We extend the recent theoretical model of Chierichetti et al. (KDD 2009) for graph compression, and show how it can be employed for compression-friendly reordering of social networks and web graphs and for assigning document identifiers in inverted indexes. We design and implement a novel theoretically sound reordering algorithm that is based on recursive graph bisection. Our experiments show a significant improvement of the compression rate of graph and indexes over existing heuristics. The new method is relatively simple and allows efficient parallel and distributed implementations, which is demonstrated on graphs with billions of vertices and hundreds of billions of edges.
cs.DS
cs
Compressing Graphs and Indexes with Recursive Graph Bisection Laxman Dhulipala1, Igor Kabiljo2, Brian Karrer2, Giuseppe Ottaviano2, Sergey Pupyrev2, and Alon Shalita2 1Carnegie Mellon University 2Facebook Abstract Graph reordering is a powerful technique to increase the locality of the representations of graphs, which can be helpful in several applications. We study how the technique can be used to improve compression of graphs and inverted indexes. We extend the recent theoretical model of Chierichetti et al. (KDD 2009) for graph compres- sion, and show how it can be employed for compression-friendly reordering of social networks and web graphs and for assigning document identifiers in inverted indexes. We design and implement a novel theoretically sound reordering algorithm that is based on recursive graph bisection. Our experiments show a significant improvement of the compression rate of graph and indexes over existing heuristics. The new method is relatively simple and allows efficient parallel and distributed implementations, which is demonstrated on graphs with billions of vertices and hundreds of billions of edges. 1 Introduction Many real-world systems and applications use in-memory representation of indexes for serving ad- jacency information in a graph. A popular example is social networks in which the list of friends is stored for every user. Another example is an inverted index for a collection of documents that stores, for every term, the list of documents where the term occurs. Maintaining these indexes requires a compact, yet efficient, representation of graphs. How to represent and compress such information? Many techniques for graph and index com- pression have been studied in the literature [24, 37]. Most techniques first sort vertex identifiers in an adjacency list, and then replace the identifiers (except the first) with differences between con- secutive ones. The resulting gaps are encoded using some integer compression algorithm. Note that using gaps instead of original identifiers decreases the values needed to be compressed and results in a higher compression ratio. We stress that the success of applying a particular encoding algorithm strongly depends on the distribution of gaps in an adjacency list: a sequence of small and regular gaps is more compressible than a sequence of large and random ones. This observation has motivated the approach of assigning identifiers in a way that optimizes compression. Graph reordering has been successfully applied for social networks [8, 13]. In that scenario, placing similar social actors nearby in the resulting order yields a significant compression improvement. Similarly, lexicographic locality is utilized for compressing the Web graph: when pages are ordered by URL, proximal pages have similar sets of neighbors, which results in an increased 1 compression ratio of the graph, when compared with the compression obtained using the original graph [9,29]. In the context of index compression, the corresponding approach is called the document identifier assignment problem. Prior work shows that for many collections, index compression can be significantly improved by assigning close identifiers to similar documents [6, 7, 15, 32, 34]. In this paper, we study the problem of finding the best "compression-friendly" order for a graph or an inverted index. While graph reordering and document identifier assignment are often studied independently, we propose a unified model that generalizes both of the problems. Although a number of heuristics for the problems exists, none of them provides any guarantees on the resulting quality. In contrast, our algorithm is inspired by a theoretical approach with provable guarantees on the final quality, and it is designed to directly optimize the resulting compression ratio. Our main contributions are the following. • We analyze and extend the formal model of graph compression suggested in [13]; the new model is suitable for both graph reordering and document identifier assignment problems. We show that the underlying optimization problem is NP-hard (thus, resolving an open question stated in [13]), and suggest an efficient approach for solving the problem, which is based on approximation algorithms for graph reordering. • Based on the theoretical result, we develop a practical algorithm for constructing compression- friendly vertex orders. The algorithm uses recursive graph bisection as a subroutine and tries to optimize a desired objective at every recursion step. Our objective corresponds to the size of the graph compressed using delta-encoding. The algorithm is surprisingly simple, which allows for efficient parallel and distributed implementations. • Finally, we perform an extensive set of experiments on a collection of large real-world graphs, including social networks, web graphs, and search indexes. The experiments indicate that our new method outperforms the state-of-the-art graph reordering techniques, improving the resulting compression ratio. Our implementation is highly scalable and is able to process a billion-vertex graph in a few hours. The paper is organized as follows. We first discuss existing approaches for graph reordering, assigning document identifiers, and the most popular encoding schemes for graph and index repre- sentation (Section 2). Then we consider algorithmic aspects of the underlying optimization problem. We analyze the models for graph compression suggested by Chierichetti et al. [13] and suggest our generalization in Section 3.1. Next, in Section 3.2, we examine existing theoretical techniques for the graph reordering problem and use the ideas to design a practical algorithm. A detailed description of the algorithm along with the implementation details is presented in Section 4, which is followed by experimental Section 5. We conclude the paper with the most promising future directions in Section 6. 2 Related Work There exists a rich literature on graph and index compression, that can be roughly divided into three categories: (1) structural approaches that find and merge repeating graph patterns (e.g., cliques), (2) encoding adjacency data represented by a list of integers given some vertex/document order, and (3) finding a suitable order of graph vertices. Our focus is on the ordering techniques. We discuss the existing approaches for graph reordering, followed by an overview of techniques for document identifier assignment. Since many integer encoding algorithms can benefit from such a reordering, we also outline the most popular encoding schemes. 2 Graph Reordering Among the first approaches for compressing large-scale graphs is a work by Boldi and Vigna [9], who compress web graphs using a lexicographical order of the URLs. Their compression method relies on two properties: locality (most links lead to pages within the same host) and similarity (pages on the same host often share the same links). Later Apostolico and Drovandi [2] suggest one of the first ways to compress a graph assuming no a priori knowledge of the graph. The technique is based on a breadth-first traversal of the graph vertices and achieves a better compression rate using an entropy-based encoding. Chierichetti et al. [13] consider the theoretical aspect of the reordering problem motivated by compressing social networks. They develop a simple but practical heuristic for the problem, called shingle ordering. The heuristic is based on obtaining a fingerprint of the neighbors of a vertex and positioning vertices with identical fingerprints close to each other. If the fingerprint can capture locality and similarity of the vertices, then it can be effective for compression. This approach is also called minwise hashing and was originally applied by Broder [10] for finding duplicate web pages. Boldi et al. [8] suggest a reordering algorithm, called Layered Label Propagation, to compress social networks. The algorithm is built on a scalable graph clustering technique by label propa- gation [28]. The idea is to assign a label for every vertex of a graph based on the labels of its neighbors. The process is executed in rounds until no more updates take place. Since the standard label propagation described in [28] tends to produce a giant cluster, the authors of [8] construct a hierarchy of clusters. The vertices of the same cluster are then placed together in the final order. The three-step multiscale paradigm is often employed for the graph ordering problems. First, a sequence of coarsened graphs, each approximating the original graph but having a smaller size, is created. Then the problem is solved on the coarsest level by an exhaustive search. Finally, the process is reverted by an uncoarsening procedure so that a solution for every graph in the sequence is based on the solution for a previous smaller graph. Safro and Temkin [31] employ the algebraic multigrid methodology in which the sequence of coarsened graphs is constructed using a projection of graph Laplacians into a lower-dimensional space. Spectral methods have also been successfully applied to graph ordering problems [20]. Sequencing the vertices is done by sorting them according to corresponding elements of the second smallest eigenvector of graph Laplacian (also called the Fiedler vector). It is known that the order yields the best non-trivial solution to a relaxation of the quadratic graph ordering problem, and hence, it is a good heuristic for computing linear arrangements. Recently Kang and Faloutsos [23] present another technique, called SlashBurn. Their method constructs a permutation of graph vertices so that its adjacency matrix is comprised of a few nonzero blocks. Such dense blocks are easier to encode, which is beneficial for compression. In our experiments, we compare our new algorithm with all of the methods, which are either easy to implement, or come with the source code provided by the authors. Document Identifier Assignment Several papers study how to assign document identifiers in a document collection for better compression of an inverted index. A popular idea is to perform a clustering on the collection and assign close identifiers to similar documents. Shieh et al. [32] propose a reassignment heuristic motivated by the maximum travelling salesman problem (TSP). The heuristic computes a pairwise similarity between every pairs of documents (proportional to the number of shared terms), and then finds the longest path traversing the documents in the graph. An alternative algorithm calculating cosine similarities between documents is suggested by Blandford and Blelloch [7]. Both methods are computationally expensive and are limited to fairly 3 small datasets. The similarity-based approach is later improved by Blanco and Barreiro [6] and by Ding et al. [15], who make it scalable by reducing the size of the similarity graph, respectively through dimensionality reduction and locality sensitive hashing. The approach by Silvestri [34] simply sorts the collection of web pages by their URLs and then assigns document identifiers according to the order. The method performs very well in practice and is highly scalable. This technique however does not generalize to document collections that do not have URL-like identifiers. Encoding Schemes Our algorithm is not tailored specifically for an encoding scheme; any method that can take advantage of lists with higher local density (clustering) should benefit from the reordering. For our experiment we choose a few encoding schemes that should be representative of the state-of-the-art. Most graph compression schemes build on delta-encoding, that is, sorting the adjacency lists (posting lists in the inverted indexes case) so that the gaps between consecutive elements are positive, and then encoding these gaps using a variable-length integer code. The WebGraph framework adds the ability to copy portions of the adjacency lists from other vertices, and has special cases for runs of consecutive integers. Introduced in 2004 by Boldi and Vigna [9], it is still widely used to compress web graphs and social networks. Inverted indexes are usually compressed with more specialized techniques in order to enable fast skipping, which enables efficient list intersection. We perform our experiments with Parti- tioned Elias-Fano and Binary Interpolative Coding. The former, introduced by Ottaviano and Ven- turini [26], provides one of the best compromise between decoding speed and compression ratio. The latter, introduced by Moffat and Stuiver [25], has the highest compression ratio in the literature, with the trade-off of slower decoding by several times. Both techniques directly encode monotone lists, without going through delta-encoding. 3 Algorithmic Aspects Graph reordering is a combinatorial optimization problem with a goal to find a linear layout of an input graph so that a certain objective function (referred to as a cost function or just cost) is optimized. A linear layout of a graph G = (V, E) with n = V vertices is a bijection π : V → {1, . . . , n}. A layout is also called an order, an arrangement, or a numbering of the vertices. In practice it is desirable that "similar" vertices of the graph are "close" in π. This leads to a number of problems that we define next. The minimum linear arrangement (MLA) problem is to find a layout π so that (cid:88) π(u) − π(v) (u,v)∈E is minimized. This is a classical NP-hard problem [18], even when restricted to certain graph classes. The problem is APX-hard under Unique Games Conjecture [14], that is, it is unlikely that an efficient approximation algorithm exists. Charikar et al. [11] suggested the best currently known algorithm with approximation factor O(√log n log log n); see [27] for a survey of results on MLA. A closely related problem is minimum logarithmic arrangement (MLogA) in which the goal is 4 to minimize (cid:88) (u,v)∈E log π(u) − π(v). Here and in the following we denote log(x) = 1 + (cid:98)log2(x)(cid:99), that is, the number of bits needed to represent an integer x. The problem is also NP-hard, and one can show that the optimal solutions of MLA and MLogA are quite different on some graphs [13]. In practice a graph is represented in memory as an adjacency list using an encoding scheme; hence, the gaps induced by consecutive neighbors of a vertex are important for compression. For this reason, the minimum logarithmic cost compressing the list out(v) under π is related to fπ(v, out(v)) = (cid:80)k−1 gap arrangement (MLogGapA) problem is introduced. For a vertex v ∈ V of degree k and an order π, consider the neighbors out(v) = (v1, . . . , vk) of v such that π(v1) < ··· < π(vk). Then the i=1 log π(vi+1) − π(vi). MLogGapA consists in finding an order π, which minimizes (cid:88) v∈V fπ(v, out(v)). To the best of our knowledge, MLogA and MLogGapA are introduced quite recently by Chierichetti et al. [13]. They show that MLogA is NP-hard but left the computational complexity of MLogGapA open. Since the latter problem is arguably more important for applications, we address the open question of complexity of the problem. Theorem 1. MLogGapA is NP-hard. Proof. We prove the theorem by using the hardness of MLogA, which is known to be NP-hard [13]. Let G = (V, E) be an instance of MLogA. We build a bipartite graph G(cid:48) = (V (cid:48), E(cid:48)) by splitting every edge of E by a degree-2 vertex. Formally, we add E new vertices so that V (cid:48) = V ∪ U, where V = {v1, . . . , vn} and U = {u1, . . . , um}. For every edge (a, b) ∈ E, we have two edges in E(cid:48), that is, (a, ui) and (b, ui) for some 1 ≤ i ≤ m. Next we show that an optimal solution for MLogGapA on G(cid:48) yields an optimal solution for MLogA on G, which proves the claim of the theorem. Let R be an optimal order of V (cid:48) for MLogGapA. Observe that without loss of generality, the vertices of V and U are separated in R, that is, R = (vi1, . . . , vin, uj1, . . . , ujm). Otherwise, the vertices can be reordered so that the total objective is not increased. To this end, we "move" all the vertices of V to the left of R by preserving their relative order. It is easy to see that the gaps between vertices of V and the gaps between vertices of U can only decrease. Now the cost of MLogGapA is(cid:88) v∈V (cid:88) u∈U fπu(v, out(v)) + fπv (u, out(u)), where πu = (uj1, . . . , ujm) and πv = (vi1, . . . , vin). Notice that the second term of the sum depends only on the order πv of the vertices in V , and it equals to the cost of MLogA for graph G. Since R is optimal for MLogGapA, the order πv = (vi1, . . . , vin) is also optimal for MLogA. Most of the previous works consider the MLogA problem for graph compression, and the algorithms are not directly suitable for index compression. Contrarily, an inverted index is generally represented by a directed graph (with edges from terms to documents), which is not captured by the MLogGapA problem. In the following, we suggest a model, which generalizes both MLogA and MLogGapA and better expresses graph and index compression. 5 3.1 Model for Graph and Index Compression Intuitively, our new model is a bipartite graph comprising of query and data vertices. A query vertex might correspond to an actor in a social network or to a term in an inverted index. Data vertices are an actor's friends or documents containing the term, respectively. The goal is to find a layout of data vertices. Formally, let G = (Q ∪ D, E) be an undirected unweighted bipartite graph with disjoint sets of vertices Q and D. We denote D = n and E = m. The goal is to find a permutation, π, of data vertices, D, so that the following objective is minimized: (cid:88) degq −1(cid:88) q∈Q i=1 log(π(ui+1) − π(ui)), where degq is the degree of query vertex q ∈ Q, and q's neighbors are {u1, . . . , udegq} with π(u1) < ··· < π(udegq ). Note that the objective is closely related to minimizing the number of bits needed to store a graph or an index represented using the delta-encoding scheme. We call the optimiza- tion problem bipartite minimum logarithmic arrangement (BiMLogA), and the corresponding cost averaged over the number of gaps LogGap. Note that BiMLogA is different from MLogGapA in that the latter does not differentiate between data and query vertices (that is, every vertex is query and data in MLogGapA), which is unrealistic in some applications. It is easy to see that the new problem generalizes both MLogA and MLogGapA: to model MLogA, we add a query vertex for every edge of the input graph, as in the proof of Theorem 1; to model MLogGapA, we add a query for every vertex of the input graph; see Figure 1. Moreover, the new approach can be naturally applied for compressing directed graphs; to this end, we only consider gaps induced by outgoing edges of a vertex. Clearly, given an algorithm for BiMLogA, we can easily solve both MLogA and MLogGapA. Therefore, we focus on this new problem in the next sections. (a) Original graph (b) MLogA (c) MLogGapA Figure 1: Modeling of MLogA and MLogGapA with a bipartite graph with query (red) and data (blue) vertices. How can one solve the above ordering problems? Next we discuss the existing theoretical ap- proaches for solving graph ordering problems. We focus on approximation algorithms, that is, effi- cient algorithms for NP-hard problems that produce sub-optimal solutions with provable quality. 3.2 Approximation Algorithms To the best of our knowledge, no approximation algorithms exist for the new variants of the graph ordering problem. However, a simple observation shows that every algorithm has approximation factor O(log n). Note that the cost of a gap between u ∈ D and v ∈ D in BiMLogA cannot exceed 6 2134213412132334213410203040 log n, as π(v) − π(u) ≤ n for every permutation π. On the other hand, the cost of a gap is at least 1. Therefore, an arbitrary order of vertices yields a solution with the cost, which is at most log n times greater than the optimum. In contrast, the well-studied MLA does not admit such a simple approximation and requires more involved algorithms. We observe that most of the existing algorithms for MLA and related ordering problems employ the divide-and-conquer approach; see Algorithm 1. Such algorithms partition the vertex set into two sets of roughly equal size, compute recursively an order of each part, and "glue" the orderings of the parts together. The crucial part is graph bisection or more generally balanced graph partitioning, if the graph is split into more than two parts. Input: graph G 1. Find a bisection (G1, G2) of G; 2. Recursively find linear arrangements for G1 and G2; 3. Concatenate the resulting orderings; Algorithm 1: Graph Reordering using Graph Bisection The first non-trivial approximation algorithm for MLA follows the above approach. Hancen [19] proves that Algorithm 1 yields an O(α log n)-approximation for MLA, where α indicates how close is the solution of the first step (bisection of G) to the optimum. Later, Charikar et al. [12] shows that a tighter analysis is possible, and the algorithm is in fact O(α)-approximation for d-dimensional MLA. Currently, α = O(√log n) is the best known bound [3]. Subsequently, the idea of Algorithm 1 was employed by Even et al. [16], Rao and Richa [30], and Charikar et al. [11] for composing approximation algorithms for MLA. The techniques use the recursive divide-and-conquer approach and utilize a spreading metric by solving a linear program with an exponential number of constraints. Inspired by the algorithms, we design a practical approach for the BiMLogA problem. While solving a linear program is not feasible for large graphs, we utilize recursive graph partitioning in designing the algorithm. Next we describe all the steps and provide implementation-specific details. 4 Compression-Friendly Graph Reordering Assume that the input is an undirected bipartite graph G = (Q∪D, E), and the goal is to compute an order of D. On a high level, our algorithm is quite simple; see Algorithm 1. The reordering method is based on the graph bisection problem, which asks for a partition of graph vertices into two sets of equal cardinality so as to minimize an objective function. Given an input graph G with D = n, we apply the bisection algorithm to obtain two disjoint sets V1, V2 ⊆ D with V1 = (cid:98)n/2(cid:99) and V2 = (cid:100)n/2(cid:101). We shall lay out V1 on the set {1, . . . ,(cid:98)n/2(cid:99)} and lay out V2 on the set {(cid:100)n/2(cid:101), . . . , n}. Thus, we have divided the problem into two problems of half the size, and we recursively compute good layouts for the graphs induced by V1 and V2, which we call G1 and G2, respectively. Of course, when there is only one vertex in G, the order is trivial. How to bisect the vertices of the graph? We use a graph bisection method, similar to the popular Kernighan-Lin heuristic [21]; see Algorithm 2. Initially we split D into two sets, V1 and V2, and define a computational cost of the partition, which indicates how "compression-friendly" the partition is. Next we exchange pairs of vertices in V1 and V2 trying to improve the cost. To this end we compute, for every vertex v ∈ D, the move gain, that is, the difference of the cost after moving v from its 7 current set to another one. Then the vertices of V1 (V2) are sorted in the decreasing order of the gains to produce list S1 (S2). Finally, we traverse the lists S1 and S2 in the order and exchange the pairs of vertices, if the sum of their move gains is positive. Note that unlike classical graph bisection heuristics [17,21], we do not update move gains after every swap. The process is repeated until the convergence criterion is met (no swapped vertices) or the maximum number of iterations is reached. Input : graph G = (Q ∪ D, E) Output: graphs G1 = (Q ∪ V1, E1), G2 = (Q ∪ V2, E2) determine an initial partition of D into V1 and V2; repeat gains[v] ← ComputeM oveGain(v) for v ∈ D do S1 ← sorted V1 in descending order of gains; S2 ← sorted V2 in descending order of gains; for v ∈ S1, u ∈ S2 do if gains[v] + gains[u] > 0 then exchange v and u in the sets; else break until converged or iteration limit exceeded; return graphs induced by Q ∪ V1 and Q ∪ V2 Algorithm 2: Graph Bisection To initialize the bisection, we consider the following two alternatives. A simpler one is to arbi- trarily split D into two equal-sized sets. Another approach is based on shingle ordering (minwise hashing) suggested in [13]. To this end, we order the vertices as described in [13] and assign the first (cid:98)n/2(cid:99) vertices to V1 and the last (cid:100)n/2(cid:101) to V2. Algorithm 2 tries to minimize the following objective function of the sets V1 and V2, which is motivated by BiMLogA. For every vertex q ∈ Q, let deg1(q) = {(q, v) : v ∈ V1}, that is, the number of adjacent vertices in set V1; define deg2(q) similarly. Then the cost of the partition is (cid:18) (cid:88) q∈Q deg1(q) log( n1 deg1(q) + 1 ) + deg2(q) log( n2 deg2(q) + 1 ) , (cid:19) where n1 = V1 and n2 = V2. The cost estimates the required number of bits needed to represent G using delta-encoding. If the neighbors of q ∈ Q are uniformly distributed in the final arrangement of V1 and V2, then the the average gap between consecutive numbers in the q's adjacency list is gap1 := n1/(deg1(q)+1) and gap2 := n2/(deg2(q)+1) for V1 and V2, respectively; see Figure 2. There are (deg1(q) − 1) gaps between vertices in V1 and (deg2(q) − 1) gaps between vertices in V2. Hence, we need approximately (deg1(q)− 1) log(gap1) + (deg2(q)− 1) log(gap2) bits to compress the within- group gaps. In addition, we have to account for the average gap between the last vertex of V1 and the first vertex of V2, which is (gap1 + gap2). Assuming that n1 = n2, we have log(gap1 + gap2) = log(gap1) + log(gap2) + C, where C is a constant with respect to the data vertex assignment, and hence, it can be ignored in the optimization. Adding this between-group contribution to the within-group contributions gives the above expression. 8 Figure 2: Partitioning D into V1 and V2 for a query q ∈ Q with deg1(q) = 3 and deg2(q) = 2. Note that using the cost function, it is straightforward to implement ComputeM oveGain(v) function from Algorithm 2 by traversing all the edges (q, v) ∈ E for v ∈ D and summing up the cost differences of moving v to another set. Combining all the steps of Algorithm 1 and Algorithm 2, we have the following claim. Implementation Theorem 2. The algorithm produces a vertex order in O(m log n + n log2 n) time. Proof. There are (cid:100)log n(cid:101) levels of recursion. Each call of graph bisection requires computing move gains and sorting of n elements. The former can be done in O(m) steps, while the latter requires O(n log n) steps. Summing over all subproblems, we get the claim of the theorem. 4.1 Due to the simplicity of the algorithm, it can be efficiently implemented in parallel or distributed manner. For the former, we notice that two different recursive calls of Algorithm 1 are indepen- dent, and thus, can be executed in parallel. Analogously, a single bisection procedure can easily be parallelized, as each of its steps computes independent values for every vertex, and a parallel implementation of sorting can be used. In our implementation, we employ the fork-join computation model in which small enough graphs are processed sequentially, while larger graphs which occur on the first few levels of recursion are solved in parallel manner. Our distributed implementation relies on the vertex-centric programming model and runs in the Giraph framework1. In Giraph, a computation is split into supersteps that consists of processing steps: (i) a vertex executes a user-defined function based on local vertex data and on data from adjacent vertices, (ii) the resulting output is sent along outgoing edges. Supersteps end with a synchronization barrier, which guarantees that messages sent in a given superstep are received at the beginning of the next superstep. The whole computation is executed iteratively for a certain number of rounds, or until a convergence property is met. Algorithm 2 is implemented in the vertex-centric model with a simple modification. The first two supersteps compute move gains for all data vertices. To this end, every query vertex calculates the differences of the cost function when its neighbor moves from a set to another one. Then, every data vertex sums up the differences over its query neighbors. Given the move gains, we exchange the vertices as follows. Instead of sorting the move gains, we construct, for both sets, an approximate histogram (e.g., as described in [5]) of the gain values. Since the size of the histograms is small enough, we collect the data on a dedicated host, and decide how many vertices from each bin should exchange its set. On the last superstep, this information is propagated over all data vertices and the corresponding swaps take effect. 1http://giraph.apache.org 9 qV1V2{gap1(q){gap2(q) 5 Experiments We design our experiments to answer two primary questions: (i) How well does our algorithm compress graphs and indexes in comparison with existing techniques? (ii) How do various parameters of the algorithm contribute to the solution, and what are the best parameters? 5.1 Dataset For our experiments, we use several publicly available web graphs, social networks, and inverted document indexes; see Table 1. In addition, we run evaluation on two large subgraphs of the Face- book friendship graph and a sample of the Facebook search index. These private datasets serve to demonstrate scalability of our approach. We do not release the datasets and our source code due to corporate restrictions. Before running the tests, all the graphs are made unweighted and converted to bipartite graphs as described in Section 3.1. Our dataset is as follows. • Enron represents an email communication network; data is available at https://snap.stanford. edu/data. • AS-Oregon is an Autonomous Systems peering information inferred from Oregon route-views in 2001; data is available at https://snap.stanford.edu/data. • FB-NewOrlean contains a list of all of the user-to-user links from the Facebook New Orleans network; the data was crawled and anonymized in 2009 [36]. • web-Google represents web pages with hyperlinks between them. The data was released in 2002 by Google; data is available at https://snap.stanford.edu/data. • LiveJournal is an undirected version of the public social graph (snapshot from 2006) con- taining 4.8 million vertices and 42.9 million edges [35]. • Twitter is a public graph of tweets, with about 41 million vertices (twitter accounts) and 2.4 billion edges (denoting followership) [22]. • Gov2 is an inverted index built on the TREC 2004 Terabyte Track test collection, consisting of 25 million .gov sites crawled in early 2004. • ClueWeb09 is an inverted index built on the ClueWeb 2009 TREC Category B test collection, consisting of 50 million English web pages crawled in 2009. • FB-Posts-1B is an inverted index built on a sample of one billion Facebook posts, containing the longest posting lists. Since the posts have no hierarchical URLs, the Natural order for this index is random. • FB-300M and FB-1B are two subgraphs of the Facebook friendship graph; the data was anonymized before processing. To build the inverted indexes for Gov2 and ClueWeb09 the body text was extracted using Apache Tika2 and the words were lowercased and stemmed using the Porter2 stemmer; no stopwords were removed. We consider only long posting lists containing more than 4096 elements. 5.2 Techniques We compare our new algorithm (referred to as BP) with the following competitors. • Natural is the most basic order defined for a graph. For web graphs and document indexes, the order is the URL lexicographic ordering used in [9, 29]. For social networks, the order is induced by the original adjacency matrix. 2http://tika.apache.org 10 Graph Enron AS-Oregon FB-NewOrlean web-Google LiveJournal Twitter Gov2 ClueWeb09 FB-Posts-1B FB-300M FB-1B Q 9,660 13,579 63,392 356,648 4,847,571 41,652,230 39,187 96,741 60 × 103 300 × 106 1 × 109 D 9,660 13,579 63,392 356,648 4,847,571 41,652,230 24,618,755 50,130,884 1 × 109 300 × 106 1 × 109 E 224,896 74,896 1,633,662 5,186,648 85,702,474 2,405,026,092 5,322,924,226 14,858,911,083 20 × 109 90 × 109 300 × 109 Table 1: Basic properties of our dataset. • BFS is given by the bread-first search graph traversal algorithm as utilized in [2]. • Minhash is the lexicographic order of 10 minwise hashes of the adjacency sets. The same approach with only 2 hashes is called double shingle in [13]. • TSP is a heuristic for document reordering suggested by Shieh et al. [32], which is based on solv- ing the maximum travelling salesman problem. We implemented the variant of the algorithm that performs best in the authors' experiments. Since the algorithm is computationally expen- sive, we run it on small instances only. The sparsification techniques presented in [6,15] would allow us to scale to the larger graphs, but they are too complex to re-implement faithfully. • LLP represents an order computed by the Layered Label Propagation algorithm [8]. • Spectral order is given by the second smallest eigenvector of the Laplacian matrix of the graph [20]. • Multiscale is an algorithm based on the multi-level algebraic methodology suggested for solving MLogA [31]. • SlashBurn is a method for matrix reordering [23]. 5.3 Effect of BP parameters BP has a number of parameters that can affect its quality and performance. In the following we discuss some of the parameters and explain our choice of their default values. An important aspect of BP is how two sets, V1 and V2, are initialized in Algorithm 2. Arguably the initialization procedure might affect the quality of the final vertex order. To verify the hypothesis, we implemented four initialization techniques that bisect a given graph: Random, Natural, BFS, and Minhash. The techniques order the data vertices, D, using the corresponding algorithm, and then split the order into two sets of equal size. In the experiment, we intentionally consider only the simplest and most efficient bisection techniques so as to keep the complexity of the BP algorithm low. Figure 3 illustrates the effect of the initialization methods for graph bisection. Note that initialization plays a role to some extent, and there is no consistent winner. BFS is the best initialization for three of the graphs but does not produce an improvement on the indexes. One explanation is that the indexes contain high-degree query vertices, that make the BFS order essentially random. Overall, the difference between the final results is not substantial, and even the worst initialization yields better orders than the alternative algorithms do. Therefore, we utilize the simplest approach, Random, for graphs and Minhash for indexes as the default technique for bisection initialization. 11 Figure 3: LogGap cost of the resulting order pro- duced with different initialization approaches for graph bisection. Figure 4: LogGap cost of the resulting order pro- duced with a fixed depth of recursion. Note that the last few splits make insignificant contribu- tions to the final quality. Figure 5: The average percentage of moved vertices on an iteration of Algorithm 2 for various levels of recursion. The data is computed for LiveJournal. Is it always necessary to perform log n levels of recursion to get a reasonable solution? Figure 4 shows the quality of the resulting vertex order after a fixed number, i, of recursion splits. For every i (that is, when there are 2i disjoint sets), we stop the algorithm and measure the quality of the order induced by the random assignment of vertices respecting the partition. It turns out that graph bisection is beneficial only when D contains more than a few tens of vertices. In our implementation, we set (log n−5) for the depth of recursion, which slightly reduces the overall running time. It might be possible to improve the final quality by finding an optimal solution (e.g., using an exhaustive search or a linear program) for small subgraphs on the lowest levels of the recursion. We leave the investigation for future research. Figure 5 illustrates the speed of convergence of our optimization procedure utilized for improv- ing graph partitioning in Algorithm 2. The two sets approach a locally optimal state within a few iterations. The number of required iterations increases, as the depth of recursion gets larger. Gen- erally, the number of moved vertices per iteration does not exceed 1% after 20 iterations, even for the deepest recursion levels. Therefore, we use 20 as the default number of iterations in all our experiments. 12 6420LogGap costAS-OregonFB-NewOrleanweb-GoogleLiveJournalGov2 Random Natural BFS Minhash1614121086420LogGap cost20151050depth of recursion AS-Oregon FB-NewOrlean web-Google LiveJournal302520151050moved vertices per iteration, %20151050iterationRecursion depth: 0 3 9 12 15 (a) Natural (b) BFS (c) Minhash (d) TSP (e) LLP (f) Spectral (g) Multiscale (h) SlashBurn (i) BP Figure 6: Adjacency matrices of FB-NewOrlean after applying various reordering algorithms; nonzero elements are blue. 5.4 Compression ratio Table 2 presents a comparison of various reordering methods on social networks and web graphs. We evaluate the following measures: (i) the cost of the BiMLogA problem (LogGap), (ii) the cost of the MLogA problem (the logarithmic difference averaged over the edges, Log), (iii) the average number of bits per edge needed to encode the graph with WebGraph [9] (referred to as BV). The results suggest that BP yields the best compression on all but one instance, providing an 5−20% improvement over the best alternative. An average gain over a non-reordered solution reaches impressive 50%. The runner-up approaches, TSP, LLP, and Multiscale, also significantly outperform the natural order. However, their straightforward implementations are not scalable for large graphs (none of them is able to process Twitter within a few hours), while efficient implementations are arguably more complicated than BP. The computed results for FB-300M and FB-1B demonstrate that the new reordering technique is beneficial for very large graphs, too. Unfortunately, we were not able to calculate the compression rate for the graphs, as WebGraph [9] does not provide distributed implementation. However, the experiment indicates that BP outperforms Natural by around 50% and outperforms Minhash by around 30%. The compression ratio of inverted indexes is illustrated in Table 3, where we evaluate the Parti- tioned Elias-Fano [26] encoding and Binary Interpolative Coding [25] (respectively PEF and BIC). Here the results are reported in average bits per edge. Again, our new algorithm largely outperforms existing approaches in terms of both LogGap cost and compression rate. BP has a large impact on the indexes, achieving a 22% and a 15% compression improvement over alternatives; these gains are almost identical for PEF and BIC. An interesting question is why does the new algorithm perform best on most of the tested graphs. In Figure 7 we analyze the number of gaps between consecutive numbers of graph adjacency lists. It turns out that BP and LLP have quite similar gap distributions, having notably more shorter gaps than the alternative methods. Note that the number of edges that the BV encoding is able to copy is related to the number of consecutive integers in the adjacency lists; hence short gaps strongly influences its performance. At the same time, BP is slightly better at longer gaps, which is a reason 13 Graph Enron AS-Oregon FB-NewOrlean web-Google LiveJournal Twitter FB-300M FB-1B 5.01 4.86 4.91 3.95 3.96 5.43 4.23 5.11 3.69 7.88 4.71 4.47 3.59 4.42 5.64 4.53 4.50 3.15 9.74 7.16 7.06 5.62 5.37 7.64 5.90 8.37 4.99 Algorithm LogGap Natural BFS Minhash TSP LLP Spectral Multiscale SlashBurn BP Natural BFS Minhash TSP LLP Spectral Multiscale SlashBurn BP Natural BFS Minhash TSP LLP Spectral Multiscale SlashBurn BP Natural BFS Minhash TSP LLP Spectral Multiscale SlashBurn BP Natural BFS Minhash LLP BP Natural BFS Minhash BP Natural Minhash BP Natural Minhash BP 13.39 5.57 5.65 3.28 3.75 6.68 2.72 8.02 3.17 10.43 10.52 10.79 7.46 7.03 15.23 12.87 10.43 7.91 17.65 13.06 8.39 19.63 14.60 8.66 14 BV 7.80 7.70 7.68 6.58 6.51 8.60 6.90 8.05 6.24 13.34 7.97 7.56 6.66 7.47 8.76 7.31 8.74 6.25 14.64 10.79 10.62 8.96 8.54 11.79 9.25 12.65 8.16 20.08 7.69 6.87 4.77 5.13 9.16 4.10 10.29 4.68 14.61 14.69 15.07 11.12 10.73 21.56 17.99 14.76 11.62 Log 9.82 9.97 10.12 9.46 8.55 9.41 8.00 10.18 8.26 12.06 11.06 11.17 10.39 8.32 9.53 7.23 10.66 9.21 14.29 12.63 12.57 11.61 9.41 11.49 9.58 13.06 9.45 16.74 11.21 13.14 7.99 6.70 10.25 4.82 14.46 7.74 17.44 17.59 17.76 12.25 12.79 23.65 22.69 21.98 20.50 25.34 24.9 18.13 27.22 26.89 18.36 Table 2: Reordering results of various algorithms on graphs: the costs of MLogA, BiMLogA, and the number of bits per edge required by BV. The best results in every column are highlighted. We present the results that completed the computation within a few hours. Index Gov2 ClueWeb09 FB-Posts-1B 2.52 2.44 2.52 1.95 3.12 3.00 3.12 2.44 Algorithm LogGap PEF BIC Natural BFS Minhash BP Natural BFS Minhash BP Natural Minhash BP 4.99 4.99 4.99 4.34 4.05 4.06 4.05 3.50 2.12 2.07 2.12 1.81 2.91 2.91 2.91 2.55 8.03 3.41 2.95 10.19 4.96 4.18 9.95 4.24 3.61 Table 3: Reordering results of various algorithms on inverted indexes with highlighted best results. (a) FB-NewOrlean (b) LiveJournal Figure 7: Distribution of gaps between consecutive elements of graph adjacency lists induced by various algorithms. why the new algorithm yields a higher compression ratio. We point out that the cost of BiMLogA, LogGap, is more relevant for the compression rate than the cost of MLogA; see Figure 8. The observation agrees with the previous evaluation of Boldi et al. [8] and motivates our research on the former problem. The Pearson correlation coefficients between the LogGap cost and the average number of bit per edge using BV, PEF, and BIC encoding schemes are 0.9853, 0.8487, and 0.8436, respectively. While the high correlation between LogGap and BV is observed earlier [9,13], the relation between LogGap and PEF or BIC is a new phenomenon. A possible explanation is that the schemes encode a sequence of k integers in the range [1..n] using close to the information-theoretic minimum of k(1 +(cid:98)log2(n/k)(cid:99)) bits [26], which is equivalent to our optimization function utilized in Algorithm 2. It might be possible to construct a better model for the two encoding schemes, where the cost of the optimization problem has a higher correlation with the final compression ratio. For example, this can be achieved by increasing the weights of "short" gaps that are generally require more than log(gap) bits. We leave the question for future investigation. Figure 6 presents an alternative comparison of the impact of the reordering algorithms on the FB-NewOrlean graph. Note that only BP and LLP are able to find communities in the graph (dense subgraphs), that can be compressed efficiently. The recursive nature of BP is also clearly visible. 15 500x1034003002001000gap count161412108642log2(gap length) Natural BFS Minhash TSP LLP Spectral Multiscale SlashBurn BP20x106151050gap count222018161412108642log2(gap length) Natural BFS Minhash LLP BP Figure 8: LogGap cost against the average number of bits per edge using various encoding schemes. 5.5 Running time We created and tested two implementations of our algorithm, parallel and distributed. The parallel version is implemented in C++11 and compiled with the highest optimization settings. The tests are performed on a machine with Intel(R) Xeon(R) CPU E5-2660 @ 2.20GHz (32 cores) with 128GB RAM. Our algorithm is highly scalable; the largest instances of our dataset, Gov2, ClueWeb09 and FB-Posts-1B, are processed with BP within 29, 129, and 163 minutes, respectively. In contrast, even the simplest Minhash takes 14, 42, and 70 minutes for the indexes. Natural and BFS also have comparable running times on the graphs. Our largest graphs, Twitter and LiveJournal, require 149 and 3 minutes; all the smaller graphs are processed within a few seconds. In comparison, the author's implementation of LLP with the default settings takes 23 minutes on LiveJournal and is not able to process Twitter within a reasonable time. The other alternative methods are less efficient; for instance, Multiscale runs 12 minutes and TSP runs 3 minutes on web-Google. The single-machine implementation of BP is also memory-efficient, utilizing less than twice the space required to store the graph edges. The distributed version of BP is implemented in Java. We run experiments using the distributed implementation only on FB-300M and FB-1B graphs, using a cluster of a few tens of machines. FB-300M is processed within 350 machine-hours, while the computation on FB-1B takes around 2800 machine-hours. In comparison, the running time of the Minhash algorithm is 20 and 60 machine- hours on the same cluster configuration, respectively. Despite the fact that our implementation is a part of a general graph partitioning framework [1], which is not specifically optimized for the problem, BP scales almost linearly with the size of the utilized cluster and processes huge graphs within a few hours. 6 Conclusions and Future Work We presented a new theoretically sound algorithm for graph reordering problem and experimentally proved that the resulting vertex orders allow to compress graphs and indexes more efficiently than the existing approaches. The method is highly scalable, which is demonstrated via evaluation on several graphs with billions of vertices and edges. While we see impressive gains in the compression ratio, we believe there is still much room for further improvement. In particular, our graph bisection technique ignore the freedom of orienting the decomposition tree. An interesting question is whether a postprocessing step that "flips" left and right children of tree nodes can be helpful. It is shown 16 20151050LogGap cost1614121086420number of bits per edge PEF BIC BV in [4] that there is an O(n2.2)-time algorithm that computes an optimal tree orientation for the MLA problem. Whether there exists a similar algorithm for MLogA or BiMLogA, is open. While our primary motivation is compression, graph reordering plays an important role in a number of applications. In particular, various graph traversal algorithms can be accelerated if the in- memory graph layout takes advantage of the cache architecture. Improving vertex and edge locality is important for fast node/link access operations, and thus can be beneficial for generic graph algorithms and applications [33]. We are currently working on exploring this area and investigating how reordering of graph vertices can improve cache and memory utilization. From the theoretical point of view, it is interesting to devise better approximation algorithms for the MLogA and BiMLogA problems. 7 Acknowledgments We thank Yaroslav Akhremtsev, Mayank Pundir, and Arun Sharma for fruitful discussions of the problem. We thank Ilya Safro for the help with running experiments with the Multiscale method. References [1] A, B. Shalita, I. K. Karrer, A. Sharma, A. Presta, A. Adcock, H. Kllapi, and M. Stumm. Social hash: An assignment framework for optimizing distributed systems operations on social networks. In Networked Systems Design and Implementation, 2016. [2] A. Apostolico and G. Drovandi. Graph compression by BFS. Algorithms, 2(3):1031–1044, 2009. [3] S. Arora, S. Rao, and U. Vazirani. Expander flows, geometric embeddings and graph partition- ing. Journal of the ACM, 56(2):5, 2009. [4] R. Bar-Yehuda, G. Even, J. Feldman, and J. Naor. Computing an optimal orientation of a balanced decomposition tree for linear arrangement problems. JGAA, 5(4):1–27, 2001. [5] Y. Ben-Haim and E. Tom-Tov. A streaming parallel decision tree algorithm. The Journal of Machine Learning Research, 11:849–872, 2010. [6] R. Blanco and Á. Barreiro. Document identifier reassignment through dimensionality reduction. In Adv. Inf. Retr., pages 375–387. 2005. [7] D. Blandford and G. Blelloch. Index compression through document reordering. In Data Compression Conference, pages 342–351, 2002. [8] P. Boldi, M. Rosa, M. Santini, and S. Vigna. Layered label propagation: A multiresolution coordinate-free ordering for compressing social networks. In World Wide Web, pages 587–596, 2011. [9] P. Boldi and S. Vigna. The WebGraph framework I: Compression techniques. In World Wide Web, pages 595–602, 2004. [10] A. Z. Broder. On the resemblance and containment of documents. In Compression and Com- plexity of Sequences, pages 21–29, 1997. 17 [11] M. Charikar, M. T. Hajiaghayi, H. Karloff, and S. Rao. l2 2 spreading metrics for vertex ordering problems. Algorithmica, 56(4):577–604, 2010. [12] M. Charikar, K. Makarychev, and Y. Makarychev. A divide and conquer algorithm for d- dimensional arrangement. In Symposium on Discrete Algorithms, pages 541–546, 2007. [13] F. Chierichetti, R. Kumar, S. Lattanzi, M. Mitzenmacher, A. Panconesi, and P. Raghavan. On compressing social networks. In Knowledge Discovery and Data Mining, pages 219–228, 2009. [14] N. R. Devanur, S. A. Khot, R. Saket, and N. K. Vishnoi. Integrality gaps for sparsest cut and minimum linear arrangement problems. In Symposium on Theory of Computing, pages 537–546, 2006. [15] S. Ding, J. Attenberg, and T. Suel. Scalable techniques for document identifier assignment in inverted indexes. In World Wide Web, pages 311–320, 2010. [16] G. Even, J. S. Naor, S. Rao, and B. Schieber. Divide-and-conquer approximation algorithms via spreading metrics. Journal of the ACM, 47(4):585–616, 2000. [17] C. M. Fiduccia and R. M. Mattheyses. A linear-time heuristic for improving network partitions. In Design Automation, pages 175–181, 1982. [18] M. R. Garey and D. S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman & Co., 1979. [19] M. D. Hansen. Approximation algorithms for geometric embeddings in the plane with appli- cations to parallel processing problems. In Foundations of Computer Science, pages 604–609, 1989. [20] M. Juvan and B. Mohar. Optimal linear labelings and eigenvalues of graphs. Discrete Applied Mathematics, 36(2):153–168, 1992. [21] B. W. Kernighan and S. Lin. An efficient heuristic procedure for partitioning graphs. Bell System Technical Journal, 49(2):291–307, 1970. [22] H. Kwak, C. Lee, H. Park, and S. Moon. What is Twitter, a social network or a news media? In World Wide Web, pages 591–600, 2010. [23] Y. Lim, U. Kang, and C. Faloutsos. SlashBurn: Graph compression and mining beyond caveman communities. IEEE Transactions on Knowledge and Data Engineering, 26(12):3077–3089, 2014. [24] S. Maneth and F. Peternek. A survey on methods and systems for graph compression. arXiv preprint arXiv:1504.00616, 2015. [25] A. Moffat and L. Stuiver. Binary interpolative coding for effective index compression. Infor- mation Retrieval, 3(1), 2000. [26] G. Ottaviano and R. Venturini. Partitioned Elias-Fano indexes. 2014. In SIGIR, pages 273–282, [27] J. Petit. Addenda to the survey of layout problems. Bulletin of EATCS, 3(105), 2013. 18 [28] 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. [29] K. H. Randall, R. Stata, R. G. Wickremesinghe, and J. L. Wiener. The link database: Fast access to graphs of the web. In Data Compression Conference, pages 122–131, 2002. [30] S. Rao and A. W. Richa. New approximation techniques for some ordering problems. Symposium on Discrete Algorithms, pages 211–219, 1998. In [31] I. Safro and B. Temkin. Multiscale approach for the network compression-friendly ordering. Journal of Discrete Algorithms, 9(2):190–202, 2011. [32] W.-Y. Shieh, T.-F. Chen, J. J.-J. Shann, and C.-P. Chung. Inverted file compression through document identifier reassignment. Information Processing & Management, 39(1):117–131, 2003. [33] J. Shun, L. Dhulipala, and G. E. Blelloch. Smaller and faster: Parallel processing of compressed graphs with Ligra+. In Data Compression Conference, pages 403–412, 2015. [34] F. Silvestri. Sorting out the document identifier assignment problem. In European Conference on IR Research, pages 101–112. Springer, 2007. [35] J. Ugander and L. Backstrom. Balanced label propagation for partitioning massive graphs. In Web Search and Data Mining, pages 507–516, 2013. [36] B. Viswanath, A. Mislove, M. Cha, and K. P. Gummadi. On the evolution of user interaction in Facebook. In Workshop on Social Networks, 2009. [37] I. H. Witten, A. Moffat, and T. C. Bell. Managing gigabytes: compressing and indexing docu- ments and images. Morgan Kaufmann, 1999. 19
1505.01962
2
1505
2015-10-16T14:33:46
Applying Sorting Networks to Synthesize Optimized Sorting Libraries
[ "cs.DS", "cs.MS" ]
This paper shows an application of the theory of sorting networks to facilitate the synthesis of optimized general purpose sorting libraries. Standard sorting libraries are often based on combinations of the classic Quicksort algorithm with insertion sort applied as the base case for small fixed numbers of inputs. Unrolling the code for the base case by ignoring loop conditions eliminates branching and results in code which is equivalent to a sorting network. This enables the application of further program transformations based on sorting network optimizations, and eventually the synthesis of code from sorting networks. We show that if considering the number of comparisons and swaps then theory predicts no real advantage of this approach. However, significant speed-ups are obtained when taking advantage of instruction level parallelism and non-branching conditional assignment instructions, both of which are common in modern CPU architectures. We provide empirical evidence that using code synthesized from efficient sorting networks as the base case for Quicksort libraries results in significant real-world speed-ups.
cs.DS
cs
Applying Sorting Networks to Synthesize Optimized Sorting Libraries(cid:63) Michael Codish1, Lu´ıs Cruz-Filipe2, Markus Nebel2, and Peter Schneider-Kamp2 1 Department of Computer Science, Ben-Gurion University of the Negev, Israel 2 Dept. Mathematics and Computer Science, Univ. of Southern Denmark,Denmark Abstract. This paper presents an application of the theory of sorting networks to facilitate the synthesis of optimized general-purpose sorting libraries. Standard sorting libraries are often based on combinations of the classic Quicksort algorithm with insertion sort applied as base case for small, fixed, numbers of inputs. Unrolling the code for the base case by ignoring loop conditions eliminates branching, resulting in code equiv- alent to a sorting network. This enables further program transformations based on sorting network optimizations, and eventually the synthesis of code from sorting networks. We show that, if considering the number of comparisons and swaps, the theory predicts no real advantage of this approach. However, significant speed-ups are obtained when taking ad- vantage of instruction level parallelism and non-branching conditional assignment instructions, both of which are common in modern CPU ar- chitectures. We provide empirical evidence that using code synthesized from efficient sorting networks as the base case for Quicksort libraries results in significant real-world speed-ups. 1 Introduction General-purpose sorting algorithms are based on comparing, and possibly ex- changing, pairs of inputs. If the order of these comparisons is predetermined by the number of inputs to sort and does not depend on their concrete values, then the algorithm is said to be data-oblivious. Such algorithms are well suited for e.g. parallel sorting or secure multi-party computations. Sorting functions in state-of-the-art programming language libraries (such as the GNU C Library) are typically based on a variant of Quicksort, where the base cases of the recursion apply insertion sort: once the subsequence to sort considered by Quicksort falls under a certain length M , it is sorted using insertion sort. The reasons for using such base cases is that, both theoretically and empirically, insertion sort is faster than Quicksort for sorting small numbers of elements. Typical values of M are 4 (e.g. in the GNU C library) or 8. Generalizing this construction, we can take any sorting algorithm based on the divide-and-conquer approach (e.g. Quicksort, merge sort), and use another (cid:63) Supported by the Israel Science Foundation, grant 182/13 and by the Danish Council for Independent Research, Natural Sciences. sorting method once the number of elements to sort in one partition does not exceed a pre-defined limit M . The guiding idea here is that, by supplying opti- mized code for sorting up to M inputs, the overall performance of the sorting algorithm can be improved. One obvious way to supply optimized code for sort- ing up to M inputs is to provide a unique optimized implementaton of sorting m elements, for each m ≤ M . This approach leads directly to the following problem: For a given fixed num- ber M , how can we obtain an efficient way to sort M elements on a modern CPU? Similar questions have been asked since the 1950s, though obviously with a different notion of what constitutes a modern CPU. Sorting networks are a classical model of comparison-based sorting that pro- vides a framework for addressing such questions. In a sorting network, n inputs are fed into n channels, connected pairwise by comparators. Each comparator compares the two inputs from its two channels, and outputs them sorted back to the same two channels. Consecutive comparators can be viewed as a "parallel layer" if no two touch the same channel. Sorting networks are data-oblivious al- gorithms, as the sequence of comparisons performed is independent of the actual input. For this reason, they are typically viewed as hardware-oriented algorithms, where data-obliviousness is a requirement and a fixed number of inputs is given. In this paper, we examine how the theory of sorting networks can improve the performance of general-purpose software sorting algorithms. We show that replacing the insertion sort base case of a Quicksort implementation as found in standard C libraries by optimized code synthesized from logical descriptions of sorting networks leads to significant improvements in execution times. The idea of using sorting networks to guide the synthesis of optimized code for base cases of sorting algorithms may seem rather obvious, and, indeed, has been pursued earlier. A straightforward attempt, described in [10], has not re- sulted in significant improvements, though. In this paper we show that this is not unexpected, providing theoretical and empirical insight into the reasons for these rather discouraging results. In a nutshell, we provide an average case analysis of the complexity w.r.t. measures such as number of comparisons and number of swaps. From the complexity point of view, code synthesized from sort- ing networks can be expected to perform slightly worse than unrolled insertion sort. Fortunately, for small numbers (asymptotic) complexity arguments are not always a good predictor of real-world performance. The approach taken in [7] matches the advantages of sorting networks with the vectorization instruction sets available in some modern CPU architectures. The authors obtain significant speedups by implementing parallel comparators as vector operations, but they require a complex heuristic algorithm to generate sequences of bit shuffling code that needs to be executed between comparators. Their approach is also not fully general, as they target a particular architecture. In this paper, we combine the best of both these attempts by providing a straightforward implementation of sorting networks that still takes advantage of the features of modern CPU architectures, while keeping generality. We obtain speedups comparable to [7], but our requirements to the instruction set are sat- isfied by virtually all modern CPUs, including those without vector operations. The success of our approach is based on two observations. -- Sorting networks are data-oblivious and the order of comparisons is fully determined at compile time, i.e., they are free of any control-flow branching. Comparators can also be implemented without branching, and on modern CPU architectures even efficiently so. -- Sorting networks are inherently parallel, i.e., comparators at the same level can be performed in parallel. Conveniently, this maps directly to implicit in- struction level parallelism (ILP) common in modern CPU architectures. This feature allows parallel execution of several instructions on a single thread of a single core, as long as they are working on disjoint sets of registers. Avoiding branching and exploiting ILP are tasks also performed through program transformations by the optimization stages of modern C compilers, e.g., by unrolling loops and reordering instructions to minimize data-dependence between neighbouring instructions. They are though both restricted by the data- dependencies of the algorithms being compiled and, consequently, of only limited use for data-dependent sorting algorithms, like insertion sort. Throughout this paper, for empirical evaluations we run all code on an Intel Core i7, measuring runtime in CPU cycles using the time stamp counter register using the RDTSC instruction. As a compiler for all benchmarks, we used LLVM 6.1.0 with clang-602.0.49 as frontend on Max OS X 10.10.2. We also tried GCC 4.8.2 on Ubuntu with Linux kernel 3.13.0-36, yielding comparable results. The remainder of the paper is organized as follows. Section 2 provides back- ground information and formal definitions for both sorting algorithms and hard- ware features. In Section 3, we theoretically compare Quicksort and the best known sorting networks w.r.t. numbers of comparisons and swaps. We aggres- sively unroll insertion sort until we obtain a sorting network in Section 4, and in Section 5 we show how to implement individual comparators efficiently. We empirically evaluate our contribution as a base case of Quicksort in Section 6, before concluding and giving an outlook on future work in Section 7. 2 Background 2.1 Quicksort with Insertion Sort for Base Case For decades, Quicksort has been used in practice, due to its efficiency in the average case. Since its first publication by Hoare [8], several modifications were suggested to improve it further. Examples are the clever choice of the pivot, or the use of a different sorting algorithm, e.g., insertion sort, for small subprob- lem sizes. Most such suggestions have in common that the empirically observed efficiency can be explained on theoretical grounds by analyzing the expected number of comparisons, swaps, and partitioning stages (see [13] for details). Figure 1 presents a comparison of the common spectrum of data-dependent sorting algorithms for small numbers of inputs, depicting the number of inputs 1600 1400 1200 1000 800 600 400 200 0 Quicksort (C library, with compare function) selection sort (Sedgewick) Quicksort (Sedgewick) shell sort (Sedgewick) insertion sort (Sedgewick) + × ∗ (cid:3) (cid:4) ∗ + × (cid:4) (cid:3) ∗ × + (cid:4) (cid:3) 2 + ∗ × (cid:4) (cid:3) 4 + ∗ × (cid:4) (cid:3) + ∗ (cid:3) × (cid:4) 6 + ∗ × (cid:3) (cid:4) + ∗ × (cid:3) (cid:4) 8 + × ∗ (cid:3) (cid:4) + × ∗ (cid:3) (cid:4) + × ∗ (cid:3) (cid:4) + × ∗ (cid:3) (cid:4) + × ∗ (cid:3) (cid:4) + × ∗ (cid:3) (cid:4) 10 12 14 Fig. 1. Comparison of different sorting algorithms for small numbers of inputs. (x-axis) together with the number of cycles required to sort them (y-axis), av- eraged over 100 million random executions. The upper curve in the figure is obtained from the standard Quicksort implementation in the C library (which is at some disadvantage, as it requires a general compare function as an argument). The remaining curves are derived from applying standard sorting algorithms, as detailed by Sedgewick [14]; the code was taken directly from the book's web page, http://algs4.cs.princeton.edu/home/. Insertion sort is the clear winner. 2.2 Sorting Networks A comparator network on n channels is a finite sequence C = c1, . . . , ck of comparators, where each comparator c(cid:96) is a pair (i(cid:96), j(cid:96)) with 1 ≤ i(cid:96) < j(cid:96) ≤ n. The size of C is the number k of comparators it contains. Given an input x ∈ Dn, where D is any totally ordered domain, the output of C on x is the sequence C(x) = xn, where x(cid:96) is defined inductively as follows: x0 = x, and x(cid:96) is obtained from x(cid:96)−1 by swapping the elements in positions i(cid:96) and j(cid:96), in case xi(cid:96) < xj(cid:96). C is a sorting network if C(x) is sorted for all C ∈ Dn. It is well known (see e.g. [9]) that this property is independent of the concrete domain D. Comparators may act in parallel. A comparator network C has depth d if C is the concatenation of L1, . . . , Ld, where each Li is a layer : a comparator network with the property that no two of its comparators act on a common channel. Figure 2 depicts a sorting network on 5 channels in the graphical notation we will use throughout this paper. Comparators are depicted as vertical lines, and layers are separated by a dashed line. The numbers illustrate how the input 10101 ∈ {0, 1}5 propagates through the network. This network has 6 layers and 9 comparators. There are two main notions of optimality of sorting networks in common use: size optimality, where one minimizes the number of comparators used in the network; and depth optimality, where one minimizes the number of execution steps, taking into account that some comparators can be executed in parallel. 1 0 1 0 1 0 1 1 0 1 0 1 1 0 1 0 1 0 1 1 0 1 0 1 1 0 1 0 1 1 0 0 1 1 1 Fig. 2. A sorting network on 5 channels operating on the input 10101. Given n inputs, finding the minimal size sn and depth tn of a sorting net- work is an extremely hard problem that has seen significant progress in recent years. The table below details the best currently known bounds. The values for n ≤ 8 are already listed in [9]; the values of t9 and t10 were proven exact by Parberry [11], those of t11 -- t16 by Bundala and Z´avodn´y [1], and t17 was recently computed by Ehlers and Muller [5] using results from [3,4]. Finally, the values of s9 and s10 were first given in [2]. n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 sn 0 1 3 5 9 12 16 19 25 29 35 39 45 51 56 60 73 33 37 41 45 49 53 58 tn 0 1 3 3 5 5 6 6 7 7 8 8 9 9 9 9 10 Oblivious versions of classic sorting algorithms can also be implemented as sorting networks, as described in [9]. Figure 3 (a) shows an oblivious version of insertion-sort. The vertical dashed lines highlight the 4 iterations of "insertion" required to sort 5 elements. Figure 3 (b) shows the same network, with compara- tors arranged in parallel layers. Bubble-sort can also be implemented as a sorting network as illustrated in Figure 3 (c), where the vertical dashed lines illustrate the 4 iterations of the classic bubble-sort algorithm. When ordered according to layers, this network becomes identical to the one in Figure 3 (b). (a) (b) (c) Fig. 3. Sorting networks for insertion sort (a) and bubble-sort (c) on 5 inputs, dashed lines separating iterations. When parallelized, both networks become the same (b). 2.3 Modern CPU Architectures Modern CPU architectures allow multiple instructions to be performed in par- allel on a single thread. This ability is called instruction-level parallelism (ILP), and is built on three modern micro-architectural techniques1: -- superscalar instruction pipelines, i.e., pipelines with the ability to hold and execute multiple instructions at the same time -- dynamic out-of-order execution, i.e., dynamic reordering of instructions re- specting data dependencies -- redundant execution units, i.e., multiple Arithmetic Logic Units per core Together, these features allow execution of instructions in an order that mini- mizes data dependencies, so that multiple redundant execution units can be used at the same time. This is often termed implicit ILP, in contrast to the explicit ILP found in vector operations. Example 1. Consider the C expression (x+y)*(z+u). Assume the variables x, y, z, and u are loaded in registers eax, ebx, ecx, and edx. Then the evaluation of the above expression is compiled to three machine instructions: ADD eax,ebx; ADD ecx,edx; MUL eax,ecx, with the result in ecx. Here, the first two instructions are data-independent and can be executed in parallel, while the last one depends on the results of those, and is executed in another CPU cycle. Conditional branching instructions are the most expensive instructions on pipelined CPUs, as they require flushing and refilling the pipeline. In order to minimize their cost, modern CPU architectures employ dynamic branch predic- tion. By keeping the pipeline filled with the instructions of the predicted branch, the cost of branching is severely alleviated. Unfortunately, branch prediction can- not be perfect, and when the wrong branch is predicted, the pipeline needs to be flushed and refilled -- an operation taking many CPU cycles. In order to avoid branching instructions for "small" decisions, e.g., decid- ing whether to assign a value or not, modern CPU architectures also feature conditional instructions. Depending on flags set by e.g. a comparison, either an assignment of a value of a register will be performed, or the instruction will be ignored. In both cases, the pipeline is filled with the subsequent instructions, and the cost of the operation is smaller than a possible branch prediction failure. Example 2. Consider the C statement if (x == 42) x = 23; with variable x loaded in eax. Without conditional move instructions, this is compiled to code with a conditional branching instruction, i.e. CMP eax,42; JNZ after; MOV eax, 23, where after is the address of the instruction following the MOV in- struction. Alternatively, using conditional instructions, we obtain CMP eax, 42; CMOVZ eax, 23. This code not only saves one machine code instruction, but most importantly avoids the huge performance impact of a mispredicted branch. 1 For details on these features of modern microarchitectures see e.g. [6,15]. Table 1. Average number of comparisons and swaps when executing optimal sorting networks with at most M = 14 inputs. n 1 comparisons 0 2 1 3 3 4 5 5 9 6 7 8 12 16 19 9 25 10 29 11 35 12 39 13 45 14 51 swaps 0.0 0.5 1.5 2.7 4.8 6.6 8.6 10.6 13.0 11.1 19.4 22.4 20.0 26.5 3 Quicksort with Sorting Networks for Base Case The general theme of this paper is to derive, from sorting networks, optimized code to sort small numbers of inputs, and then to apply this code as the base case in a Quicksort algorithm. In this section, we compare precise average case results for the number of comparisons and swaps performed by a classic Quicksort algorithm and by a modification that uses sorting networks on subproblems of size at most 14. We choose 14 for this analysis, as it is the largest value n for which we could conveniently measure the number of comparisons and swaps for all n! permutations. We used the best-known (w.r.t. size) sorting networks (optimal for up to 10 inputs) in order to obtain the most favorable comparison numbers for sorting networks. To this end, we assume the algorithm to act on random permutations of size n, each being the input with equal probability. Let Cn (resp. Sn) denote the expected number of comparisons (resp. swaps) performed by classic Quicksort on (random) inputs of size n. Let furthermore Cn and Sn denote the corresponding quantities for Quicksort using sorting networks for inputs smaller than 15. It is standard to set up recurrence relations for those quantities which typically obey a pattern such as: Tn(a, b) = a · n + b + 1 g(n) n 1≤j≤n Tj−1(a, b) + Tn−j(a, b) if n > M , otherwise. (cid:40) (cid:80) Here, a and b have to be chosen properly to reflect the parameter's (compar- isons, swaps) behavior, M determines the maximum subproblem size for which a different algorithm (insertion sort, sorting networks) is used, and g accounts for the costs of that algorithm. In order to analyze classic Quicksort as proposed by Hoare, we have to choose a = 1, b = −1 (resp. a = 1 3 ) for compar- isons (resp. swaps), together with M = 0 and g(0) = 0. For the analysis of our proposed modification using sorting networks for subproblems of small sizes, we set M = 14 together with the values for g as given in Table 1. Using standard algebraic manipulations, it is possible to solve this recurrence explicitly to obtain a formula for Tn(a, b) in terms of n, M , a and b. Defining tn = a · n + b and ∇tn = tn − tn−1, one finds (see [12] for details) that, for n > M , 6 , b = 2 Tn(a, b) = 2(n + 1) ∇tk k + 1 + n + 1 M + 2 (tM +1 + TM +1(a, b)) − tn . (cid:88) M +2≤k≤n Computing the closed form expressions for(cid:80) choices of tn, we finally get Cn = 2n ln(n + 1) − 2.84557n + o(n) Cn = 2n ln(n + 1) − 2.44869n + o(n) M +2≤k≤n ∇tk k+1 for the different Sn = Sn = 1 3 1 3 n ln(n + 1) + 0.359072n + o(n) n ln(n + 1) + 0.524887n + o(n) We see that, when increasing n, both parameters get worse by our modification of classic Quicksort. Even for small n and optimal size sorting networks, there is no advantage w.r.t. the numbers of comparisons or swaps. In conclusion, we cannot hope to get a faster sorting algorithm simply by switching to sorting networks for small subproblems -- at least not on grounds of our theoretical investigations. And, by transitivity, replacing insertion sort by sorting networks in the base case should result in an even worse behavior w.r.t. both parameters. 4 Unrolling the Base Case In this section, we show how to unroll an implementation of insertion sort, step by step, until we finally obtain code equivalent to a sorting network. We take the basic insertion sort code from Sedgewick [14], and, for illustration, assume that the fixed number of inputs is n = 5. We experimented also with optimized variants (e.g. making use of sentinels to avoid the j>0 check), but did not find any of them to be faster for small inputs given a modern C compiler. # define SWAP (x , y ) { int tmp = a [ x ]; a [ x ] = a [ y ]; a [ y ] = tmp ;} static inline void sort5 ( int *a , int n ) { n =5 for ( int i = 1; i < n ; i ++) for ( int j = i ; j > 0 && a [ j ] < a [j -1]; j - -) SWAP (j -1 , j ) } Applying partial evaluation and (outer) loop unrolling results in: static inline void s o r t 5 _ u n r o l l e d ( int * a ) { for ( int j = 1; j > 0 && a [ j ] < a [j -1]; j - -) SWAP (j -1 , j ) for ( int j = 2; j > 0 && a [ j ] < a [j -1]; j - -) SWAP (j -1 , j ) for ( int j = 3; j > 0 && a [ j ] < a [j -1]; j - -) SWAP (j -1 , j ) for ( int j = 4; j > 0 && a [ j ] < a [j -1]; j - -) SWAP (j -1 , j ) } The condition in the inner loop is data-dependent, hence no sound and complete program transformation can be applied to unroll them. To address this, we move the data-dependent part of the loop condition to the statement in the body of the loop, while always iterating the variable j down to 1. static inline void s o r t 5 _ o b l i v i o u s ( int * a ) { for ( int j = 1; j > 0; j - -) if ( a [ j ] < a [j -1]) SWAP (j -1 , j ) for ( int j = 2; j > 0; j - -) if ( a [ j ] < a [j -1]) SWAP (j -1 , j ) for ( int j = 3; j > 0; j - -) if ( a [ j ] < a [j -1]) SWAP (j -1 , j ) for ( int j = 4; j > 0; j - -) if ( a [ j ] < a [j -1]) SWAP (j -1 , j ) } Now we can now apply (inner) loop unrolling and obtain: static inline void s o r t 5 _ o b l i v o u s _ u n r o l l e d ( int * a ) { if ( a [1] < a [0]) SWAP (0 , 1) if ( a [2] < a [1]) SWAP (1 , 2) if ( a [1] < a [0]) SWAP (0 , 1) if ( a [3] < a [2]) SWAP (2 , 3) if ( a [2] < a [1]) SWAP (1 , 2) if ( a [1] < a [0]) SWAP (0 , 1) if ( a [4] < a [3]) SWAP (3 , 4) if ( a [3] < a [2]) SWAP (2 , 3) if ( a [2] < a [1]) SWAP (1 , 2) if ( a [1] < a [0]) SWAP (0 , 1) } All the statements in the body of sort5 oblivous unrolled are now conditional swaps. For readability, we move the condition into the macro. COMPs on the same line indicate that they originate from the same iteration of insertion sort: # define COMP (x , y ) { if ( a [ y ] < a [ x ]) SWAP (x , y ) } static inline void s o r t 5 _ f i g 3 a ( int * a ) { COMP (0 , 1) COMP (1 , 2) COMP (2 , 3) COMP (3 , 4) COMP (0 , 1) COMP (1 , 2) COMP (2 , 3) } COMP (0 , 1) COMP (1 , 2) COMP (0 , 1) This sequence is equivalent to the sorting network in Figure 3 (a). Thus, we can apply the reordering of comparators that resulted in Figure 3 (b) to obtain the following implementation, where we reduce the number of layers to 7 (here, COMPs on the same line indicate a layer in the sorting network): static inline void s o r t 5 _ f i g 3 b ( int * a ) { COMP (0 , 1) COMP (1 , 2) COMP (0 , 1) COMP (1 , 2) COMP (0 , 1) COMP (1 , 2) COMP (0 , 1) } COMP (2 , 3) COMP (3 , 4) COMP (2 , 3) 700 600 500 400 300 200 100 0 insertion sort unrolled insertion sort insertion sorting network compressed insertion sorting network optimal sorting network + × ∗ (cid:3) (cid:4) × ∗ (cid:4) (cid:3) + ∗ × (cid:4) (cid:3) + 2 × ∗ (cid:3) (cid:4) + 4 × ∗ (cid:3) (cid:4) + × ∗ (cid:3) (cid:4) + 6 × ∗ (cid:4) (cid:3) + ∗ + × (cid:3) (cid:4) 8 ∗ (cid:3) + × (cid:4) ∗ (cid:3) + × (cid:4) ∗ + (cid:3) × (cid:4) ∗ (cid:3) + × (cid:4) ∗ (cid:3) + × (cid:4) + ∗ (cid:3) × (cid:4) 10 12 14 Fig. 4. Comparison of insertion sort with (unrolled) comparator based code for small numbers of inputs. Figure 4 presents a comparison of a standard insertion sort (code from [14]) with the several optimized versions, depicting the number of inputs (x-axis) to- gether with the number of cycles required to sort them (y-axis), averaged over 100 million random executions. The curve labeled "insertion sort" portrays the same data as the corresponding curve in Figure 1. The curve labeled "unrolled insertion sort" corresponds to the unrolled version of insertion sort (in the style of function sort5 unrolled). The other three curves correspond to code derived from different types of sorting networks: the "insertion sorting network" from Figure 3 (a) and function sort5 fig3a; the "compressed insertion sorting net- work" from Figure 3 (b) and function sort5 fig3b; and the "optimal sorting network", corresponding to the use of a best (smallest) known sorting network. From the figure, it is clear that standard sorting network optimizations such as reordering of independent comparators [9] give a slight performance boost. But there is another clear message: even going beyond standard program trans- formations by breaking data-dependence and obtaining a sequence of conditional swaps (i.e., a sorting network), we do not manage to make any significant im- provements of the performance of sorting implementations for small numbers of inputs. Furthermore, even when using size-optimal sorting networks, we obtain no real benefit over compiler-optimized insertion sort. This is in line with the theoretical results on average case complexity discussed in the previous section. 5 Implementing Sorting Networks Efficiently The results in the previous two sections explained the rather discouraging re- sults obtained by a naive attempt to use sorting networks as the base case of a divide-and-conquer sorting algorithm: they are simply not faster than e.g. inser- tion sort -- at least when implemented naively. In this section we show how to exploit two main properties of sorting networks, together with features of mod- ern CPU architectures, and obtain speed-ups of a factor higher than 3 compared to unrolled insertion sort. We first observe that, as sorting networks are data-oblivious, the order of comparisons is fully determined at compile time, i.e., their implementation is free of any control-flow branching. Unfortunately, the naive implementation of each comparator involves branching to decide whether to perform a swap. The path taken depends entirely on the specific inputs to be sorted, and as such branch prediction necessarily does not perform very well. Luckily, we can also implement comparators without branching. To this end, we use a conditional assignment (defined by the macro COND below), which can be compiled to the conditonal move (CMOV) instruction available on modern CPU architectures. This approach proved to be very fruitful. For illustration, from the optimal-size sorting network for 5 inputs portrayed in Figure 2, we synthesize the following C function sort5 best, where each row in the code corresponds to a layer in the sorting network: # define COND (c ,x , y ) { x = ( c ) ? y : x ; } # define COMP (x , y ) { int ax = a [ x ]; COND ( a [ y ] < ax , a [ x ] , a [ y ]) ; \ ) ; } COND ( a [ y ] < ax , a [ y ] , ax static inline void s o r t 5 _ b e s t ( int * a ) { COMP (0 , 1) COMP (2 , 4) COMP (2 , 3) COMP (0 , 3) COMP (0 , 2) COMP (1 , 2) COMP (3 , 4) COMP (1 , 4) COMP (1 , 3) } The comparator macro that compares and conditionally swaps the values at indices x and y works as follows: 1. Keep a copy of the value at index x. 2. Compare (once) the value at index y with the stored value from x. 3. If the value was greater, copy the value at index y to index x. Otherwise, do nothing. 4. If the value was greater, write the old copied value from x to index y. Oth- erwise, do nothing. Correctness follows directly by case analysis. If the value at index y was not greater than the value at index x, the two conditional assignments do not change anything, and all we did was an unnecessary copy of the valued at index x. If the value at index y was greater than the value at index y, we essentially perform a classic swap using ax as the temporary variable. Given a sufficient optimization level (-O2 and above), the above code is com- piled by the LLVM (or GNU) C compiler to use two conditional move (CMOV) instructions, resulting in a totally branching free code for sort5 best. As can be expected, the other two instructions are a move (MOV) and a compare (CMP) instruction. In other words, each comparator is implemented by exactly four non-branching machine code instructions. Alternatively, we could implement the comparator applying the folklore idea of swapping values using XORs to eliminate one conditional assignment:2 # define COND (c ,x , y ) { x = ( c ) ? y : x ; } # define COMP (x , y ) { int ax = a [ x ]; COND ( a [ y ] < ax , a [ x ] , a [ y ]) ; \ a [ y ] ^= ax ^ a [ x ]; } This alternative comparator performs a conditional swap as follows: 1. Keep a copy of the value at index x. 2. If the value at index y is greater than the value at index x, copy the value at index y to index x. 3. Bitwise XOR the value at index y with the copied old and the new value at index x. Step 3 works because, if the condition holds, then ax and the value at index x cancel out, leaving the value at y unchanged, while otherwise the value at y and ax cancel out, effectively assigning the original value from index x to index y. We also implemented this variant, and observed that it compiles down to five instructions (MOV, CMP, CMOV, and two XORs). We benchmarked the two variants and observed that they are indistinguishable in practice, with differences well within the margin of measurement error. Thus, we decided to continue with this second version, as the XOR instructions are more "basic" and can therefore be expected to behave better w.r.t. e.g. instruction level parallelism. A third approach would be to define branching-free minimum and maximum operations,3 and use them to assign the minimum to the upper channel and the maximum to the lower channel of the comparator. We tested this approach, but found that it did not compile to branching-free code. Even if it did, the number of instructions involved would be rather large, eliminating any chance of competing with the two previous variants. The reader might wonder whether a different SWAP macro could similarly speed up the working of standard insertion sort. The answer is a clear no, as the standard swapping operation is implemented by only three operations. Tricks like using XORs only increase the number of instructions to execute, while not reducing branching in the code. We implemented and benchmarked several alter- native SWAP macros, finding only detrimental effects on measured performance. Figure 5 compares three sorting algorithms for small numbers of inputs: (1) the unrolled insertion sort (also plotted in Figure 4); (2) code derived from a standard insertion sorting network (also plotted in Figure 4); (3) the same insertion sorting network but with a non-branching version of the COMP macro. We compare the number of branches encountered and mispredicted (averaged 2 See https://graphics.stanford.edu/~{}seander/bithacks.html# SwappingValuesXOR 3 See IntegerMinOrMax https://graphics.stanford.edu/~{}seander/bithacks.html# 140 120 100 80 60 40 20 0 unrolled insertion sort #branches insertion sorting network #branches non-branching insertion sorting network #branches unrolled insertion sort #mispredicts insertion sorting network #mispredicts non-branching insertion sorting network #mispredicts + × ∗ (cid:3) (cid:4) ◦ × ∗ + (cid:4) ◦ (cid:3) × ∗ ◦ (cid:4) (cid:3) + 2 × ∗ + (cid:4) (cid:3) ◦ 4 × ∗ + (cid:4) (cid:3) ◦ × + ∗ (cid:4) (cid:3) ◦ 6 × + ∗ (cid:4) (cid:3) ◦ × + ∗ (cid:4) (cid:3) ◦ 10 × + ∗ (cid:4) (cid:3) ◦ × + ∗ (cid:4) (cid:3) ◦ 8 × + ∗ (cid:4) (cid:3) ◦ × + ∗ (cid:4) (cid:3) ◦ 14 × + ∗ (cid:4) (cid:3) ◦ × + ∗ (cid:4) (cid:3) ◦ 12 Fig. 5. Comparing the number of branches, encountered and mispredicted, in optimized sorting algorithms for small numbers of inputs. over 100 million random executions). From the figure it is clear that the number of branches encountered (and mispredicted) is larger for both unrolled insertion sort and a naive implementation of sorting networks. In contrast, the branching- free implementation exhibits a nearly constant level of branches encountered and mispredicted. These branches actually originate from the surrounding test code (filling an array with random numbers, computing random numbers, and checking that the result is actually sorted). Our second observation is that sorting networks are inherently parallel, i.e., comparators at the same level can be performed simultaneously. This parallelism can be mapped directly to instruction level parallelism (ILP). The ability to make use of ILP has further performance potential. In order to demonstrate this potential, we constructed artificial test cases with varying levels of data dependency. Given a natural number m, we construct a comparator network of size 1000 consisting of subsequences of m parallel comparators. We would expect that, as m grows, we would see more use of ILP. 5000 4500 4000 3500 3000 2500 2000 1500 1000 + + 0 1 2 + 3 + 4 + 5 + 6 + 7 + 8 9 Fig. 6. ILP on comparator networks of length 1000 with differing levels of parallelism. 700 600 500 400 300 200 100 0 unrolled insertion sort insertion sorting network compressed insertion sorting network optimal sorting network non-branching insertion sorting network non-branching compressed insertion sorting network non-branching optimal sorting network × ∗ (cid:3) • ◦ + (cid:4) × ∗ ◦ • (cid:3) (cid:4) + 2 × ∗ (cid:3) + ◦ • (cid:4) 4 × ∗ (cid:3) + ◦ • (cid:4) × ∗ (cid:3) + ◦ (cid:4) • 6 × ∗ (cid:3) + ◦ (cid:4) • × ∗ (cid:3) + (cid:4) ◦ • 8 + × ∗ (cid:3) (cid:4) ◦ • ∗ × + (cid:3) (cid:4) ◦ • × ∗ (cid:3) + (cid:4) ◦ • × ∗ (cid:3) + (cid:4) ◦ • × ∗ (cid:3) + (cid:4) ◦ • × ∗ (cid:3) + (cid:4) ◦ • 12 14 × ∗ (cid:3) + (cid:4) ◦ • 10 Fig. 7. Comparison of sorting networks for small numbers of inputs: non-branching sorting networks are fastest. In Figure 6, the values for m are represented on the x-axis, while the y-axis (as usual) indicates the averaged number of CPU cycles. Indeed, we see significant performance gains when going from m = 1 to m = 2 and m = 3. From this value onwards, performance stays unchanged. This is the result of each comparator being compiled to 5 assembler instructions when using optimization level -O3. Then we obtain slightly under 2 CPU cycles per comparator. Combining the gains from ILP with the absence of branching, we obtain large speed-ups for small inputs when comparing to both insertion sort and naive implementations of sorting networks. In Figure 7, we show the magni- tude of the improvements obtained. Once again we plot the number of inputs on the x-axis against the number of cycles required to sort then on the y-axis, averaged over 100 million random executions. We consider the unrolled inser- tion sort, the three sorting networks from Figure 4 (insertion sorting network, compressed insertion sorting network, and optimal sorting network), and these same three sorting networks using non-branching comparators (non-branching insertion sorting network, non-branching compressed insertion sorting network, and non-branching optimal sorting network). The figure shows that using the best known (optimal) sorting networks in their non-branching forms results in a speed-up by a factor of more than 3. 6 Quicksort with Sorting Network Base Case We now demonstrate that optimizing the code in the base case of a Quicksort algorithm translates to real-world savings when applying the sorting function. To this end, we use as base cases (1) the (empirically) best variant of insertion sort unrolled by applying program transformations to the algorithm from [14], and (2) the fastest non-branching code derived from optimal (size) sorting networks. 170,000 160,000 150,000 140,000 130,000 120,000 110,000 unrolled insertion sort non-branching optimal sorting network + × + × + × + × + × + × + × 2 4 6 + × + × 8 + × + × 10 + × 12 + + × × 14 Fig. 8. Quicksort: comparing insertion sort at the base case with non-branching optimal sorting networks at the base case. Plotting base case size (x axis) and number of cycles (averaged over one million random runs). In Figure 8 we depict the results of sorting lists of 10,000 elements. The y-axis measures the number of cycles (averaged over one million random runs), and the x-axis specifies the limit at which Quicksort reverts to a base case. For example, the value 8 indicates that the algorithm uses a base case whenever it is required to sort a sequence of length at most 8 elements. The value 2 corresponds to the case where the base case has no impact. To quantify the impact of the choice of base case, we compare to the case for value 2 (on the x-axis). For insertion sort we see a 2 -- 12% reduction in runtime depending on the limit, and for non-branching sorting networks we achieve instead 7 -- 23% reduction in runtime. 7 Conclusion In this paper, we showed, both theoretically and empirically, that using code derived naively from sorting networks is not advantageous to sort small numbers of inputs, compared to the use of standard data-dependent sorting algorithms like insertion sort. Furthermore, we showed that program transformations are of only limited utility for improving insertion sort on small numbers of inputs. By contrast, we showed how to synthesize simple yet efficient implementa- tions of sorting networks, and gave insight into the microarchitectural features that enable this implementation. We demonstrated that we do obtain significant speed-ups compared to naive implementations such as [10]. A further empirical comparison between our implementation and the one described in [7] (not de- tailed in this paper) shows similar performance and scaling behavior. However, our approach allows the exploitation of instruction-level parallelism without the need for a complex instruction set-specific algorithm, as required by [7]. We also provided further evidence that efficient sorting networks are useful as a base case in divide-and-conquer sorting algorithms such as, e.g., Quicksort. Our results also show that using different sorting networks has measurable impact on the efficiency of the synthesized C code. While previous research on finding optimal sorting networks has focused on optimal depth or optimal size, in the future we plan to identify criteria that will lead to optimal performance in this context. What are the parameters that determine real-world efficiency of the synthesized code, and how can we find sorting networks that optimize these parameters? We also plan to explore other target architectures, such as GPUs, and to benchmark our approach as base case for other sorting algorithms, such as merge sort. References 1. D. Bundala and J. Z´avodn´y. Optimal sorting networks. In A.-H. Dediu, C. Mart´ın- Vide, J.L. Sierra-Rodr´ıguez, and B. Truthe, editors, LATA 2014, volume 8370 of LNCS, pages 236 -- 247. Springer, 2014. 2. M. Codish, L. Cruz-Filipe, M. Frank, and P. Schneider-Kamp. Twenty-five com- parators is optimal when sorting nine inputs (and twenty-nine for ten). In ICTAI 2014, pages 186 -- 193. IEEE, December 2014. 3. M. Codish, L. Cruz-Filipe, and P. Schneider-Kamp. The quest for optimal sorting networks: Efficient generation of two-layer prefixes. In F. Winkler, V. Negru, T. Ida, T. Jebelan, D. Petcu, S.M. Watt, and D. Zaharie, editors, SYNASC 2014, pages 359 -- 366. IEEE, 2015. 4. M. Codish, L. Cruz-Filipe, and P. Schneider-Kamp. Sorting networks: the end game. In A.-H. Dediu, E. Formenti, C. Mart´ın-Vide, and B. Truthe, editors, LATA 2015, volume 8977 of LNCS, pages 664 -- 675. Springer, 2015. 5. T. Ehlers and M. Muller. New bounds on optimal sorting networks. In A. Beck- mann, V. Mitrana, and M.I. Soskova, editors, CiE 2015, volume 9136 of LNCS, pages 167 -- 176. Springer, 2015. 6. J.A. Fisher, P. Faraboschi, and C. Young. Embedded Computing: A VLIW Ap- proach to Architecture, Compilers, and Tools. Morgan Kaufman, 2005. 7. T. Furtak, J.N. Amaral, and R. Niewiadomski. Using SIMD registers and instruc- tions to enable instruction-level parallelism in sorting algorithms. In SPAA '07, pages 348 -- 357. ACM, 2007. 8. C.A.R. Hoare. Quicksort. Comput. J., 5(1):10 -- 15, 1962. 9. D.E. Knuth. The Art of Computer Programming, Volume III: Sorting and Search- ing. Addison-Wesley, 1973. 10. B. Lopez and N. Cruz-Cortes. On the usage of sorting networks to big data. In H.R. Arabnia, M.Q. Yang, G. Jandieri, J.J. Park, A.M.G. Solo, and F.G. Tinetti, editors, Advances in Big Data Analytics: The 2014 WorldComp International Conference Proceedings. Mercury Learning and Information, 2014. 11. I. Parberry. A computer-assisted optimal depth lower bound for nine-input sorting networks. Mathematical Systems Theory, 24(2):101 -- 116, 1991. 12. R. Sedgewick. The analysis of quicksort programs. Acta Inf., 7:327 -- 355, 1977. 13. R. Sedgewick and P. Flajolet. An introduction to the analysis of algorithms. Addison-Wesley-Longman, 1996. 14. R. Sedgewick and K. Wayne. Algorithms. Addison-Wesley, 2011. 4th Edition. 15. J. Silc, B. Robic, and T. Ungerer. Processor Architecture: From Dataflow to Su- perscalar and Beyond. Springer, 1999.
1608.06462
1
1608
2016-08-23T11:10:10
On Low-High Orders of Directed Graphs: Incremental Algorithms and Applications
[ "cs.DS" ]
A flow graph $G=(V,E,s)$ is a directed graph with a distinguished start vertex $s$. The dominator tree $D$ of $G$ is a tree rooted at $s$, such that a vertex $v$ is an ancestor of a vertex $w$ if and only if all paths from $s$ to $w$ include $v$. The dominator tree is a central tool in program optimization and code generation and has many applications in other diverse areas including constraint programming, circuit testing, biology, and in algorithms for graph connectivity problems. A low-high order of $G$ is a preorder $\delta$ of $D$ that certifies the correctness of $D$ and has further applications in connectivity and path-determination problems. In this paper, we first consider how to maintain efficiently a low-high order of a flow graph incrementally under edge insertions. We present algorithms that run in $O(mn)$ total time for a sequence of $m$ edge insertions in an initially empty flow graph with $n$ vertices.These immediately provide the first incremental certifying algorithms for maintaining the dominator tree in $O(mn)$ total time, and also imply incremental algorithms for other problems. Hence, we provide a substantial improvement over the $O(m^2)$ simple-minded algorithms, which recompute the solution from scratch after each edge insertion. We also show how to apply low-high orders to obtain a linear-time $2$-approximation algorithm for the smallest $2$-vertex-connected spanning subgraph problem (2VCSS). Finally, we present efficient implementations of our new algorithms for the incremental low-high and 2VCSS problems and conduct an extensive experimental study on real-world graphs taken from a variety of application areas. The experimental results show that our algorithms perform very well in practice.
cs.DS
cs
On Low-High Orders of Directed Graphs: An Incremental Algorithm and Applications Loukas Georgiadis∗ Aikaterini Karanasiou∗ Giannis Konstantinos∗ Luigi Laura† October 15, 2018 Abstract A flow graph G = (V, E, s) is a directed graph with a distinguished start vertex s. The dom- inator tree D of G is a tree rooted at s, such that a vertex v is an ancestor of a vertex w if and only if all paths from s to w include v. The dominator tree is a central tool in program optimiza- tion and code generation, and has many applications in other diverse areas including constraint programming, circuit testing, biology, and in algorithms for graph connectivity problems. A low-high order of G is a preorder δ of D that certifies the correctness of D, and has further applications in connectivity and path-determination problems. In this paper we first consider how to maintain efficiently a low-high order of a flow graph incrementally under edge insertions. We present algorithms that run in O(mn) total time for a sequence of m edge insertions in an initially empty flow graph with n vertices. These immediately provide the first incremental certifying algorithms for maintaining the dominator tree in O(mn) total time, and also imply incremental algorithms for other problems. Hence, we provide a substantial improvement over the O(m2) simple-minded algorithms, which recompute the solution from scratch after each edge insertion. We also show how to apply low-high orders to obtain a linear-time 2-approximation algorithm for the smallest 2-vertex-connected spanning subgraph problem (2VCSS). Finally, we present efficient implementations of our new algorithms for the incremental low-high and 2VCSS problems, and conduct an extensive experimental study on real-world graphs taken from a va- riety of application areas. The experimental results show that our algorithms perform very well in practice. Introduction 1 A flow graph G = (V, E, s) is a directed graph (digraph) with a distinguished start vertex s ∈ V . A vertex v is reachable in G if there is a path from s to v; v is unreachable if no such path exists. The dominator relation in G is defined for the set of reachable vertices as follows. A vertex v is a dominator of a vertex w (v dominates w) if every path from s to w contains v; v is a proper dominator of w if v dominates w and v (cid:54)= w. The dominator relation in G can be represented by a tree rooted at s, the dominator tree D, such that v dominates w if and only if v is an ancestor of w in D. If w (cid:54)= s is reachable, we denote by d(w) the parent of w in D. Lengauer and Tarjan [35] presented an algorithm for computing dominators in O(mα(m, n)) time for a flow graph with n vertices and m edges, where α is a functional inverse of Ackermann's function [45]. Subsequently, several linear-time algorithms were discovered [3, 9, 14, 15]. The dominator tree is a central ∗Department of Computer Science & Engineering, University of Ioannina, Greece. E-mail: [email protected], †Dipartimento di Ingegneria Informatica, Automatica e Gestionale, "Sapienza" Universit`a di Roma, Italy. E-mail: [email protected], giannis [email protected]. [email protected]. Figure 1: A flow graph G, its dominator tree D, and two strongly divergent spanning trees B and R. The numbers correspond to a preorder numbering of D that is a low-high order of G. tool in program optimization and code generation [12], and it has applications in other diverse areas including constraint programming [40], circuit testing [5], theoretical biology [2], memory profiling [36], the analysis of diffusion networks [29], and in connectivity problems [19, 20, 21, 22, 24, 30, 31, 32, 33]. A low-high order δ of G [25] is a preorder of the dominator tree D such for all reachable vertices v (cid:54)= s, (d(v), v) ∈ E or there are two edges (u, v) ∈ E, (w, v) ∈ E such that u and w are reachable, u is less than v (u <δ v), v is less than w (v <δ w), and w is not a descendant of v in D. See Figure 1. Every flow graph G has a low-high order, computable in linear-time [25]. Low-high orders provide a correctness certificate for dominator trees that is straightforward to verify [48]. By augmenting an algorithm that computes the dominator tree D of a flow graph G so that it also computes a low-high order of G, one obtains a certifying algorithm to compute D. (A certifying algorithm [37] outputs both the solution and a correctness certificate, with the property that it is straightforward to use the certificate to verify that the computed solution is correct.) Low-high orders also have applications in path-determination problems [47] and in fault-tolerant network design [6, 7, 26]. A notion closely related to low-high orders is that of divergent spanning trees [25]. Let Vr be the set of reachable vertices, and let G[Vr] be the flow graph with start vertex s that is induced by Vr. Two spanning trees B and R of G[Vr], rooted at s, are divergent if for all v, the paths from s 2 4𝑠𝑎𝑏𝑐𝑖𝑔ℎ𝑒𝑑𝑓𝐷15326789104𝑠𝑎𝑏𝑔ℎ𝑐𝑓𝑑𝑒𝑖𝐺19105738264𝑠𝑎𝑏𝑔ℎ𝑐𝑓𝑑𝑒𝑖𝐵19105738264𝑠𝑎𝑏𝑔ℎ𝑐𝑓𝑑𝑒𝑖𝑅1910573826 to v in B and R share only the dominators of v; B and R are strongly divergent if for every pair of vertices v and w, either the path in B from s to v and the path in R from s to w share only the common dominators of v and w, or the path in R from s to v and the path in B from s to w share only the common dominators of v and w. In order to simplify our notation, we will refer to B and R, with some abuse of terminology, as strongly divergent spanning trees of G. Every flow graph has a pair of strongly divergent spanning trees. Given a low-high order of G, it is straightforward to compute two strongly divergent spanning trees of G in O(m) time [25]. Divergent spanning trees can be used in data structures that compute pairs of vertex-disjoint s-t paths in 2-vertex connected digraphs (for any two query vertices s and t) [19], in fast algorithms for approximating the smallest 2-vertex-connected spanning subgraph of a digraph [20], and in constructing sparse subgraphs of a given digraph that maintain certain connectivity requirements [21, 32, 33]. Figure 2: The flow graph of Figure 1 after the insertion of edge (g, d), and its updated dominator tree D(cid:48) with a low-high order, and two strongly divergent spanning trees B(cid:48) and R(cid:48). In this paper we consider how to update a low-high order of a flow graph through a sequence of edge insertions. See Figure 2. The difficulty in updating the dominator tree and a low-high order is due to the following facts. An affected vertex can be arbitrarily far from the inserted edge, and a single edge insertion may cause O(n) parent changes in D. Furthermore, since a low-high order is a preorder of D, a single edge insertion may cause O(n) changes in this order, even if there is only one vertex that is assigned a new parent in D after the insertion. More generally, 3 𝑠5𝑐𝐷′1𝑑4𝑎𝑔32𝑓6𝑒7𝑖8𝑏ℎ9105𝑠𝑎𝑏𝑔ℎ𝑐𝑓𝑑𝑒𝑖𝐺′19104738265𝑠𝑎𝑏𝑔ℎ𝑐𝑓𝑑𝑒𝑖𝐵′19104738265𝑠𝑎𝑏𝑔ℎ𝑐𝑓𝑑𝑒𝑖𝑅′1910473826 we note that the hardness of dynamic algorithms on digraphs has been recently supported also by conditional lower bounds [1]. Our first contribution is to show that we can maintain a low-high order of a flow graph G with n vertices through a sequence of m edge insertions in O(mn) total time. Hence, we obtain a substantial improvement over the naive solution of recomputing a low- high order from scratch after each edge insertion, which takes O(m2) total time. Our result also implies the first incremental certifying algorithms [37] for computing dominators in O(mn) total time, which answers an open question in [25]. We present two algorithms that achieve this bound, a simple and a more sophisticated. Both algorithms combine the incremental dominators algorithm of [23] with the linear-time computation of two divergent spanning trees from [25]. Our more sophisticated algorithm also applies a slightly modified version of a static low-high algorithm from [25] on an auxiliary graph. Although both algorithms have the same worst-case running time, our experimental results show that the sophisticated algorithm is by far superior in practical scenarios. We note that the incremental dominators problem arises in various applications, such as in- cremental data flow analysis and compilation [11, 18, 41, 43], distributed authorization [38], and in incremental algorithms for maintaining 2-connectivity relations in directed graphs [24]. In Sec- tion 4 we show how our result on incremental low-high order maintenance implies the following incremental algorithms that also run in O(mn) total time for a sequence of m edge insertions. • First, we give an algorithm that maintains, after each edge insertion, two strongly divergent spanning trees of G, and answers the following queries in constant time: (i) For any two query vertices v and w, find a path πsv from s to v and a path πsw from s to w, such that πsv and πsw share only the common dominators of v and w. We can output these paths in O(πsv + πsw) time. (ii) For any two query vertices v and w, find a path πsv from s to v that avoids w, if such a path exists. We can output this path in O(πsv) time. • Then we provide an algorithm for an incremental version of the fault-tolerant reachability problem [6, 7]. We maintain a flow graph G = (V, E, s) with n vertices through a sequence of m edge insertions, so that we can answer the following query in O(n) time. Given a spanning forest F = (V, EF ) of G rooted at s, find a set of edges E(cid:48) ⊆ E \ EF of minimum cardinality, such that the subgraph G(cid:48) = (V, EF ∪ E(cid:48), s) of G has the same dominators as G. • Finally, given a digraph G, we consider how to maintain incrementally a spanning subgraph of G with O(n) edges that preserves the 2-edge-connectivity relations in G. We also revisit the problem of computing a smallest 2-vertex-connected spanning subgraph (2VCSS) of a directed graph [10, 20]. We present a linear-time algorithm that computes a 2- approximation of the smallest 2-vertex-connected spanning subgraph (2VCSS) of a 2-vertex-connected digraph. This improves significantly the best previous approximation ratio achievable in linear time for this problem, which was 3 [20]. Our new algorithm is also shown to achieve better performance in practice. 2 Preliminaries Let G = (V, E, s) be a flow graph with start vertex s, and let D be the dominator tree of G. A spanning tree T of G is a tree with root s that contains a path from s to v for all reachable vertices v. We refer to a spanning subgraph F of T as a spanning forest of G. Given a rooted tree T , we denote by T (v) the subtree of T rooted at v (we also view T (v) as the set of descendants of v). Let T be a tree rooted at s with vertex set VT ⊆ V , and let t(v) denote the parent of a vertex v ∈ VT in T . If v is an ancestor of w, T [v, w] is the path in T from v to w. In particular, D[s, v] consists of 4 the vertices that dominate v. If v is a proper ancestor of w, T (v, w] is the path to w from the child of v that is an ancestor of w. Tree T is flat if its root is the parent of every other vertex. Suppose now that the vertex set VT of T consists of the vertices reachable from s. Tree T has the parent property if for all (v, w) ∈ E with v and w reachable, v is a descendant of t(w) in T . If T has the parent property and has a low-high order, then T = D [25]. For any vertex v ∈ V , we denote by C(v) the set of children of v in D. A preorder of T is a total order of the vertices of T such that, for every vertex v, the descendants of v are ordered consecutively, with v first. Let ζ be a preorder of D. Consider a vertex v (cid:54)= s. We say that ζ is a low-high order for v in G, if (d(v), v) ∈ E or there are two edges (u, v) ∈ E, (w, v) ∈ E such that u <ζ v and v <ζ w, and w is not a descendant of v in D. Given a graph G = (V, E) and a set of edges S ⊆ V × V , we denote by G ∪ S the graph obtained by inserting into G the edges of S. 3 Incremental low-high order In this section we describe two algorithms to maintain a low-high order of a digraph through a sequence of edge insertions. We first review some useful facts for updating a dominator tree after an edge insertion [4, 23, 41]. Let (x, y) be the edge to be inserted. We consider the effect of this insertion when both x and y are reachable. Let G(cid:48) be the flow graph that results from G after inserting (x, y). Similarly, if D is the dominator tree of G before the insertion, we let D(cid:48) be the the dominator tree of G(cid:48). Also, for any function f on V , we let f(cid:48) be the function after the update. We say that vertex v is affected by the update if d(v) (its parent in D) changes, i.e., d(cid:48)(v) (cid:54)= d(v). We let A denote the set of affected vertices. Note that we can have D(cid:48)[s, v] (cid:54)= D[s, v] even if v is not affected. We let nca(x, y) denote the nearest common ancestor of x and y in the dominator tree D. We also denote by depth(v) the depth of a reachable vertex v in D. There are affected vertices after the insertion of (x, y) if and only if nca(x, y) is not a descendant of d(y) [42]. A characterization of the affected vertices is provided by the following lemma, which is a refinement of a result in [4]. Lemma 3.1. ([23]) Suppose x and y are reachable vertices in G. A vertex v is affected after the insertion of edge (x, y) if and only if depth(nca(x, y)) < depth(d(v)) and there is a path π in G from y to v such that depth(d(v)) < depth(w) for all w ∈ π. If v is affected, then it becomes a child of nca(x, y) in D(cid:48), i.e., d(cid:48)(v) = nca(x, y). The algorithm (DBS) in [23] applies Lemma 3.1 to identify affected vertices by starting a search from y (if y is not affected, then no other vertex is). To do this search for affected vertices, it suffices to maintain the outgoing and incoming edges of each vertex. These sets are organized as singly linked lists, so that a new edge can be inserted in O(1) time. The dominator tree D is represented by the parent function d. We also maintain the depth in D of each reachable vertex. We say that a vertex v is scanned, if the edges leaving v are examined during the search for affected vertices, and that it is visited if there is a scanned vertex u such that (u, v) is an edge in G. By Lemma 3.1, a visited vertex v is scanned if depth(nca(x, y)) < depth(d(v)). Lemma 3.2. ([23]) Let v be a scanned vertex. Then v is a descendant of an affected vertex in D. 3.1 Simple Algorithm In this algorithm we maintain, after each insertion, a subgraph H = (V, EH ) of G with O(n) edges that has the same dominator tree as G. Then, we can compute a low-high order δ of H in O(EH) = O(n) time. Note that δ is also a valid low-high order of G. Subgraph H is formed by the edges of two divergent spanning trees B and R of G. After the insertion of an edge (x, y), 5 where both x and y are reachable, we form a graph H(cid:48) by inserting into H a set of edges Last(A) found during the search for affected vertices. Specifically, Last(A) contains edge (x, y) and, for each affected vertex v (cid:54)= y, the last edge on a path πyv that satisfies Lemma 3.1. Then, we set H(cid:48) = H ∪ Last(A). Finally, we compute a low-high order and two divergent spanning trees of H(cid:48), which are also valid for G(cid:48). Algorithm SimpleInsertEdge describes this process. Algorithm 1: SimpleInsertEdge(G, D, δ, B, R, e) Input: Flow graph G = (V, E, s), its dominator tree D, a low-high order δ of G, two Output: Flow graph G(cid:48) = (V, E ∪ (x, y), s), its dominator tree D(cid:48), a low-high order δ(cid:48) of G(cid:48), divergent spanning trees B and R of G, and a new edge e = (x, y). and two divergent spanning trees B(cid:48) and R(cid:48) of G(cid:48). 1 Insert e into G to obtain G(cid:48). 2 if x is unreachable in G then return (G(cid:48), D, δ, B, R) else if y is unreachable in G then 3 (D(cid:48), δ(cid:48), B(cid:48), R(cid:48)) ← ComputeLowHigh(G(cid:48)) return (G(cid:48), D(cid:48), δ(cid:48), B(cid:48), R(cid:48)) 4 5 end 6 Let H = B ∪ R. 7 Compute the updated dominator tree D(cid:48) of G(cid:48) and return a list A of the affected vertices, 8 Compute the subgraph H(cid:48) = H ∪ Last(A) of G(cid:48). 9 Compute (D(cid:48), δ(cid:48), B(cid:48), R(cid:48)) ← ComputeLowHigh(H(cid:48)) 10 return (G(cid:48), D(cid:48), δ(cid:48), B(cid:48), R(cid:48)) and a list Last(A) of the last edge entering each v ∈ A in a path of Lemma 3.2. Note that when only x is reachable before the insertion, we re-initialize our algorithm by running the linear-time algorithm of [25, Section 6], which returns both a low-high order and two divergent spanning trees. Lemma 3.3. Algorithm SimpleInsertEdge is correct. Proof. It suffices to show that subgraph H(cid:48) of G(cid:48), computed in line 9, has the same dominator tree with G(cid:48). Note that graph H, formed by two divergent spanning trees B and R of G in line 7, has the same dominator tree D as G. Hence, since Last(A) contains (x, y), the immediate dominator of y is the same in H(cid:48) and in G(cid:48). Let A be the set of affected vertices in G after the insertion of edge (x, y). Since H(cid:48) is a subgraph of G(cid:48), any vertex in V \ A has the same immediate dominator in H(cid:48) and in G(cid:48). It remains to argue that for each vertex v ∈ A \ y, there is a path(cid:98)πyv in H(cid:48) that vertices performed by the algorithm of [23]. We give a corresponding path (cid:98)πyv in H(cid:48). Recall that satisfies Lemma 3.1. Let πyv be the path from y in v in G that was found by the search for affected every vertex on πyv is scanned and that every scanned vertex is a descendant in D of an affected vertex. We argue that for every two successive affected vertices u and w on πyv there is a path πuw from u to w in H(cid:48) that consists of vertices of depth at least depth(w). Note that, by properties of the depth-based search, depth(w) ≤ depth(u). Indeed, let (p, w) be the edge entering w from πyv. Then (p, w) ∈ Last(A) and p is a descendant of u in D. Also, since u dominates p in G, u is an ancestor of p in both spanning trees B and R. We let(cid:98)πuw = B[u, p] · (p, w). All vertices on B[u, p] are dominated by u, since otherwise there would be a path from s to p avoiding u. So,(cid:98)πuw is path from u to w in H(cid:48) that consists of vertices with depth at least depth(w). Lemma 3.4. Algorithm SimpleInsertEdge maintains a low-high order of a flow graph G with n vertices through a sequence of edge insertions in O(mn) total time, where m is the total number of edges in G after all insertions. 6 Proof. Consider the insertion of an edge (x, y). If y was unreachable in G then we compute D, two divergent spanning trees B and R, and a low-high order in O(m) time [25]. Throughout the whole sequence of m insertions, such an event can happen O(n) times, so all insertions to unreachable vertices are handled in O(mn) total time. Now we consider the cost of executing SimpleInsertEdge. when both x and y are reachable in G. Let ν be the number of scanned vertices, and let µ be the number of their adjacent edges. We can update the dominator tree and locate the affected vertices (line 8) in O(ν + µ + n) time [23]. At the same time we can compute the edge set Last(A). Computing H(cid:48) in line 9 takes O(n) time since B ∪ R ∪ Last(A) contains at most 3(n − 1) edges. Also, computing the dominator tree, two divergent spanning trees,, and a low-high order of H(cid:48) in O(n) time [25]. So SimpleInsertEdge runs in O(ν + µ + n) time. . The O(n) term gives a total cost of O(mn) for the whole sequence of m insertions. We distribute the remaining O(ν + µ) cost to the scanned vertices and edges, that is O(1) per scanned vertex or edge. Since the depth in D of every scanned vertex decreases by at least one, a vertex and an edge can be scanned at most O(n) times. Hence, each vertex and edge can contribute at most O(n) total cost through the whole sequence of m insertions. The O(mn) bound follows. 3.2 Efficient Algorithm Here we develop a more practical algorithm that maintains a low-high order δ of a flow graph G = (V, E, s) through a sequence of edge insertions. Our algorithm uses the incremental dominators algorithm of [23] to update the dominator tree D of G after each edge insertion. We describe a process to update δ based on new results on the relation among vertices in D that are affected by the insertion. . These results enable us to identify a subset of vertices for which we can compute a "local" low-high order, that can be extended to a valid low-high order of G after the update. We show that such a "local" low-high order can be computed by a slightly modified version of an algorithm from [25]. We apply this algorithm on a sufficiently small flow graph that is defined by the affected vertices, and is constructed using the concept of derived edges [46]. 3.2.1 Derived edges and derived flow graphs Derived graphs, first defined in [46], reduce the problem of finding a low-high order to the case of a flat dominator tree [25]. By the parent property of D, if (v, w) is an edge of G, the parent d(w) of w is an ancestor of v in D. Let (v, w) be an edge of G, with w not an ancestor of v in D. Then, the derived edge of (v, w) is the edge (v, w), where v = v if v = d(w), v is the sibling of w that is an ancestor of v if v (cid:54)= d(w). If w is an ancestor of v in D, then the derived edge of (v, w) is null. Note that a derived edge (v, w) may not be an original edge of G. For any vertex w ∈ V such that C(w) (cid:54)= ∅, we define the derived flow graph of w, denoted by Gw = (Vw, Ew, w), as the flow graph with start vertex w, vertex set Vw = C(w)∪{w}, and edge set Ew = {(u, v) v ∈ Vw and (u, v) is the non-null derived edge of some edge in E}. By definition, Gw has flat dominator tree, that is, w is the only proper dominator of any vertex v ∈ Vw \ w. We can compute a low-high order δ of G by computing a low-high order δw in each derived flow graph Gw. Given these low-high orders δw, we can compute a low-high order of G in O(n) time by a depth-first traversal of D. During this traversal, we visit the children of each vertex w in their order in δw, and number the vertices from 1 to n as they are visited. The resulting preorder of D is low-high on G. Our incremental algorithm identifies, after each edge insertion, a specific derived flow graph Gw for which a low-high order δw needs to be updated. Then, it uses δw to update the low-high order of the whole flow graph G. Still, computing a low-high order of Gw can 7 be too expensive to give us the desired running time. Fortunately, we can overcome this obstacle by exploiting a relation among the vertices that are affected by the insertion, as specified below. This allows us to compute δw in a contracted version of Gw. 3.2.2 Affected vertices Let (x, y) be the inserted vertex, where both x and y are reachable. Consider the execution of algorithm DBS [23] that updates the dominator tree by applying Lemma 3.1. Suppose vertex v is scanned, and let q be the nearest affected ancestor of v in D. Then, by Lemma 3.1, vertex q is a child of nca(x, y) in D(cid:48), i.e., d(cid:48)(q) = nca(x, y), and v remains a descendant of q in D(cid:48). Lemma 3.5. Let u and v be vertices such that u ∈ D(v). Then, any simple path from v to u in G contains only vertices in D(v). Proof. Since u ∈ D(v), v dominates u, so all paths from s to u contain v. Let πvu be a simple path from v to u. Suppose, for contradiction, that πvu contains a vertex w (cid:54)∈ D(v). Let πwu be the part of πvu from w to u. Since w (cid:54)∈ D(v), there is a path πsw from s to w that avoids v. But then πsw · πwu is a path from s to u that avoids v, a contradiction. Lemma 3.6. Let v be vertex that is affected by the insertion of (x, y), and let w be a sibling of v in D. If there is an edge (u, w) with u a descendant of v in D then w is also affected. Proof. Since v is affected, there is a path πyv from y to v in G that satisfies Lemma 3.1. By Lemma 3.5 and the fact that u is a descendant of v in D, there is a simple path πvu from v to u in G that contains only vertices in D(v). Thus, πyv · πvu · (u, w) is a path from y to w that also satisfies Lemma 3.1. Hence, w is affected. Lemma 3.7. Let v be an ancestor of w in D, and let u be a vertex that is not a descendant of v in D. Then any path from u to w contains v. Proof. Let πuw be a path from u to w. Since u is not a descendant of v, there is a path πsu from s to u that avoids v. Hence, if πuw does not contain v, then πsu · πuw is path from s to w that avoids v, a contradiction. Our next lemma provides a key result about the relation of the affected vertices in D. Lemma 3.8. All vertices that are affected by the insertion of (x, y) are descendants of a common child c of nca(x, y). Proof. Let z = nca(x, y), and let c be the child of z that is an ancestor of y in D. We claim that all affected vertices are descendants of c in D. Suppose, for contradiction, that there is an affected vertex v that is not a descendant of c in D. By Lemma 3.1, v must be a descendant z in D. Also, since the children of z are not affected, v is not a child of z. Hence, v is a proper descendant of another child q of z in D (q (cid:54)= c). Let πyv be a path from y to v in G that satisfies Lemma 3.1. Since y is not a descendant of q, by Lemma 3.7 path πyv must contain q. But then πyv contains a vertex of depth depth(d(v)) or less, which contradicts Lemma 3.1. We shall apply Lemma 3.8 to construct a flow graph GA for the affected vertices. Then, we shall use GA to compute a "local" low-high order that we extend to a valid low-high order of G(cid:48). 8 3.2.3 Low-high order augmentation Let δ be a low-high order of G, and let δ(cid:48) be a preorder of the dominator tree D(cid:48) of G(cid:48). We say that δ(cid:48) agrees with δ if the following condition holds for any pair of siblings u, v in D that are not affected by the insertion of (x, y): u <δ(cid:48) v if and only if u <δ v. Our goal is to show that there is a low-high order δ(cid:48) of G(cid:48) that agrees with δ. Lemma 3.9. Let δ be a low-high order of G before the insertion of (x, y). There is a preorder δ(cid:48) of D(cid:48) that agrees with δ. Proof. By Lemma 3.1, all affected vertices become children of z in D(cid:48). Hence, C(cid:48)(z) ⊇ C(z), and for any v (cid:54)= z, C(cid:48)(v) ⊆ C(v). Then, for each vertex v, we can order the children of v in C(cid:48)(v) that are not affected according to δ. Finally, we insert the affected vertices in any order in the list of children of z. Let δ(cid:48) be the preorder of D(cid:48) that is constructed by a depth-first traversal of D(cid:48) that visits the children of each vertex w in the order specified above. Then, δ(cid:48) agrees with δ. Lemma 3.10. Let δ(cid:48) be a preorder of D(cid:48) that agrees with δ. Let v be a vertex that is not a child of nca(x, y) and is not affected by the insertion of (x, y). Then δ(cid:48) is a low-high order for v in G(cid:48). Proof. Since v is not affected, d(v) is still the parent of v in D after the insertion. So, if (d(v), v) ∈ E, then δ(cid:48) is a low-high order for v in G(cid:48). Now suppose that (d(v), v) (cid:54)∈ E. Then there are two edges (u, v) and (w, v) in E such that u <δ v <δ w, where w is not a descendant of v in D. Let (u, v) and (w, v) be the derived edges of (u, v) and (w, v), respectively, in D. Then u and w are siblings of v in D. Siblings u and w exist and are distinct by the fact that (d(v), v) (cid:54)∈ E and by the parent property of D. Hence, u <δ v <δ w. We argue that after the insertion of (x, y), u (resp., w) remains a sibling of v, and an ancestor of u (resp., w). If this is not the case, then there is an affected vertex q on D[u, u]. But then, Lemma 3.6 implies that v is also be affected, a contradiction. So, both u and w remain siblings of v in D(cid:48), and (u, v) and (w, v) remain the derived edges of (u, v) and (w, v), respectively, in D(cid:48). Then, since δ(cid:48) agrees with δ, δ(cid:48) is a low-high order for v in G(cid:48). We shall use Lemmata 3.1 and 3.10 to show that in order to compute a low-high order of G(cid:48), it suffices to compute a low-high order for the derived flow graph G(cid:48) z, where z = nca(x, y). Still, the computation of a low-high order of G(cid:48) z is too expensive to give us the desired running time. Fortunately, as we show next, we can limit these computations for a contracted version of G(cid:48) z, defined by the affected vertices. Let δ be a low-high order of G before the insertion of (x, y). Also, let z = nca(x, y), and let δz be a corresponding low-high order of the derived flow graph Gz. That is, δz is the restriction of δ to z and its children in D. Consider the child c of z that, by Lemma 3.8, is an ancestor of all the affected vertices. Let α and β, respectively, be the predecessor and successor of c in δz. Note z of C(cid:48)(z) ∪ {z} that results from δz that α or β may be null. An augmentation of δz is an order δ(cid:48) by inserting the affected vertices arbitrarily around c, that is, each affected vertex is placed in an arbitrary position between α and c or between c and β. z. Then, for each child v of z in D, δ(cid:48) is a low-high order for v in G(cid:48). Lemma 3.11. Let z = nca(x, y), and let δz be a low-high order of the derived flow graph Gz before the insertion of (x, y). Also, let δ(cid:48) z be an augmentation of δz, and let δ(cid:48) be a preorder of D(cid:48) that extends δ(cid:48) Proof. Since v is a child of z in D it is not affected. Hence, d(cid:48)(v) = d(v) = z. Let G(cid:48) flow graph of z after the insertion of (x, y). It suffices to show that δ(cid:48) G(cid:48) z. z be the derived z is a low-high order for v in 9 If (z, v) ∈ E, then (z, v) is an edge in G(cid:48) z. So, in this case, δ(cid:48) z is a low-high order for v in G(cid:48) z. Now suppose that (z, v) (cid:54)∈ E. Let δ be a preorder of D that extends δz. Then, there are two edges (u, v) and (w, v) in G such that u <δ v <δ w, where w is not a descendant of v in D. The fact that (z, v) is not an edge implies that u (cid:54)= z and w (cid:54)= z. Let u(cid:48) (resp., w(cid:48)) be the nearest ancestor of u (resp., w) in D(cid:48) that is a child of z. We argue that u(cid:48) exists and satisfies u(cid:48) <δ(cid:48) z v. Let u be the nearest ancestor of u in D. If no vertex on D(z, u] is affected, then u(cid:48) = u. Also, since u <δz v and by the fact that δ(cid:48) z v. Suppose now that there is an affected vertex q on D(z, u]. By Lemma 3.1, q becomes a child of z in D(cid:48), hence u(cid:48) = q. Also, by Lemma 3.8, q is a proper descendant of c, so u = c. Then c <δz v, and by the construction of δ(cid:48) we have u(cid:48) <δ(cid:48) for v in G(cid:48) z. An analogous argument shows that w(cid:48) exists and satisfies v <δ(cid:48) z is an augmentation of δz, we have u(cid:48) <δ(cid:48) z w(cid:48). Thus, δ(cid:48) z is a low-high order z v. z 3.2.4 Algorithm Now we are ready to describe our incremental algorithm for maintaining a low-high order δ of G. For each vertex v that is not a leaf in D, we maintain a list of its children C(v) in D, ordered by δ. Also, for each vertex v (cid:54)= s, we keep two variables low (v) and high(v). Variable low (v) stores an edge (u, v) such that u (cid:54)= d(v) and u <δ v; low (v) = null if no such edge exists. Similarly, high(v) stores an edge (w, v) such that and v <δ w and w is not a descendant of v in D; high(v) = null if no such edge exists. These variables are useful in the applications that we mention in Section 4. Finally, we mark each vertex v such that (d(v), v) ∈ E. For simplicity, we assume that the vertices of G are numbered from 1 to n, so we can store the above information in corresponding arrays low , high, and mark . Note that for a reachable vertex v, we can have low (v) = null or high(v) = null (or both) only if mark (v) = true. Before any edge insertion, all vertices are unmarked, and all entries in arrays low and high are null. We initialize the algorithm and the associated data structures by executing a linear-time algorithm to compute the dominator tree D of G [3, 9] and a linear-time algorithm to compute a low-high order δ of G [25]. So, the initialization takes O(m + n) time for a digraph with n vertices and m edges. Next, we describe the main routine to handle an edge insertion. We let (x, y) be the inserted edge. Also, if x and y are reachable before the insertion, we let z = nca(x, y). Algorithm 2: Initialize(G) 1 Compute the dominator tree D and a low-high order δ of G. 2 foreach reachable vertex v ∈ V \ s do 3 if (d(v), v) ∈ E then set mark (v) ← true find edges (u, v) and (w, v) such that u <δ v <δ w and w (cid:54)∈ D(v) set low (v) ← u and high(v) ← w 4 5 end 6 return (D, δ, mark , low , high) Our main task now is to order the affected vertices according to a low-high order of D(cid:48). To do this, we use an auxiliary flow graph GA = (VA, EA, z), with start vertex z, which we refer to as the derived affected flow graph. Flow graph GA is essentially a contracted version of the derived flow graph G(cid:48) z (i.e., the derived graph of z after the insertion) as we explain later. The vertices of the derived affected flow graph GA are z, the affected vertices of G, their common ancestor c in D that is a child of z (from Lemma 3.8), and two auxiliary vertices α∗ and β∗. Vertex α∗ (resp., 10 Algorithm 3: InsertEdge(G, D, δ, mark , low , high, e) Input: Flow graph G = (V, E, s), its dominator tree D, a low-high order δ of G, arrays Output: Flow graph G(cid:48) = (V, E ∪ (x, y), s), its dominator tree D(cid:48), a low-high order δ(cid:48) of G(cid:48), mark , low and high, and a new edge e = (x, y). and arrays mark(cid:48), low(cid:48) and high(cid:48). 1 Insert e into G to obtain G(cid:48). 2 if x is unreachable in G then return (G(cid:48), D, δ, mark , low , high) else if y is unreachable in G then 3 (D(cid:48), δ(cid:48), mark(cid:48), low(cid:48), high(cid:48)) ← Initialize(G(cid:48)) return (G(cid:48), D(cid:48), δ(cid:48), mark(cid:48), low(cid:48), high(cid:48)) 4 5 end 6 Compute the nearest common ancestor z of x and y in D. 7 Compute the updated dominator tree D(cid:48) of G(cid:48) and return a list A of the affected vertices. 8 foreach vertex v ∈ A do mark(cid:48)(y) ← false if z = x then mark(cid:48)(y) ← true 9 Execute DerivedLowHigh(z, A, mark(cid:48)). 10 Make a dfs traversal of the subtrees of D(cid:48) rooted at each vertex v ∈ A ∪ {c} to compute δ(cid:48). 11 foreach vertex v ∈ A ∪ {c} do 12 find edges (u, v) and (w, v) such that u <δ(cid:48) v <δ(cid:48) w and w (cid:54)∈ D(cid:48)(v) set low(cid:48)(v) ← u and high(cid:48)(v) ← w 13 14 end 15 return (G(cid:48), D(cid:48), δ(cid:48), mark(cid:48), low(cid:48), high(cid:48)) β∗) represents vertices in C(z) with lower (resp., higher) order in δ than c. We include in GA the edges (z, α∗) and (z, β∗). If c is marked then we include the edge (z, c) into GA, otherwise we add the edges (α∗, c) and (β∗, c) into GA. Also, for each edge (u, c) such that u is a descendant of an affected vertex v, we add in GA the edge (v, c). Now we specify the edges that enter an affected vertex w in GA. We consider each edge (u, w) ∈ E entering w in G. We have the following cases: (a) If u is a descendant of an affected vertex v, we add in GA the edge (v, w). (b) If u is a descendant of c but not a descendant of an affected vertex, then we add in GA the edge (c, w). (c) If u (cid:54)= z is not a descendant of c, then we add the edge (α∗, w) if u <δ c, or the edge (β∗, w) if c <δ u. (d) Finally, if u = z, then we add the edge (z, w). (In cases (c) and (d), u = x and w = y.) See Figure 3. Recall that α (resp., β) is the siblings of c in D immediately before (resp., after) c in δ, if it exists. Then, we can obtain GA from G(cid:48) z by contracting all vertices v with v <δ c into α = α∗, and all vertices v with c <δ v into β = β∗. Lemma 3.12. The derived affected flow graph GA = (VA, EA, z) has flat dominator tree. Proof. We claim that for any two distinct vertices v, w ∈ VA\z, v does not dominate w. The lemma follows immediately from this claim. The claim is obvious for w ∈ {α∗, β∗}, since GA contains the edges (z, α∗) and (z, β∗). The same holds for w = c, since GA contains the edge (z, c), or both the edges (α∗, c) and (β∗, c). Finally, suppose w ∈ VA \ {z, α∗, β∗}. Then, by the construction of GA, vertex w is affected. By Lemma 3.8, w ∈ D(c), so Lemma 3.5 implies that there is a path in G 11 Figure 3: The derived affected flow graph GA that corresponds to the flow graph of Figure 1 after the insertion of edge (g, d). from c to w that contains only vertices in D(c). Hence, by construction, GA contains a path from c to w that avoids α∗ and β∗, so α∗ and β∗ do not dominate w. It remains to show that w is not dominated in GA by c or another affected vertex v. Let (x, y) be the inserted edge. Without loss of generality, assume that c <δ x. Since w is affected, there is a path π in G from y to w that satisfies Lemma 3.1. Then π does not contain any vertex in D[c, d(w)]. Also, by the construction of GA, π corresponds to a path πA in GA from β∗ to y that avoids any vertex in A ∩ D[c, d(w)]. Hence, w is not dominated by any vertex in A ∩ D[c, d(w)]. It remains to show that w is not dominated by any affected vertex v in A \ D[c, d(w)]. Since both v and w are in D(c) and v is not an ancestor of w in D, there is a path π(cid:48) in G from c to w that avoids v. By Lemma 3.5, π(cid:48) contains only vertices in D(c). Then, by the construction of GA, π(cid:48) corresponds to a path π(cid:48) A in GA from c to w that avoids v. Thus, v does not dominate w in GA. Lemma 3.13. Let ν and µ, respectively, be the number of scanned vertices and their adjacent edges. Then, the derived affected flow graph GA has ν + 4 vertices, at most µ + 5 edges, and can be constructed in O(ν + µ) time. Proof. The bound on the number of vertices and edges in GA follows from the definition of the derived affected flow graph. Next, we consider the construction time of GA. Consider the edges entering the affected vertices. Let w be an affected vertex, and let (u, w) (cid:54)= (x, y) be an edge of G(cid:48). Let q be nearest ancestor u in C(cid:48)(z). We distinguish two cases: • u is not scanned. In this case, we argue that q = c. Indeed, it follows from the parent property of D and Lemma 3.8 that both u and w are descendants of c in D. Since u is not scanned, no ancestor of u in D is affected, so u remains a descendant of c in D(cid:48). Thus, q = c. • u is scanned. Then, by Lemma 3.2, q is the nearest affected ancestor of u in D. So we can construct the edges entering the affected vertices in GA in two phases. In the first phase we traverse the descendants of each affected vertex q in D(cid:48). At each descendant u of q, we examine the edges leaving u. When we find an edge (u, w) with w affected, then we insert into GA the edge (q, w). In the second phase we examine the edges entering each affected vertex w. When we find an edge (u, w) with u not visited during the first phase (i.e., u was not scanned during the update of D), we insert into GA the edge (c, w). Note that during this construction we may insert the same edge multiple times, but this does not affect the correctness or running time of our overall algorithm. Since the descendants of an affected vertex are scanned, it follows that each phase runs in O(ν + µ) time. 12 𝑠=𝑧𝑐𝐺𝐴𝑑𝛼∗𝑓𝑒𝛽∗ Finally, we need to consider the inserted edge (x, y). Let f be the nearest ancestor of x that is in C(z). Since y is affected, c (cid:54)= f . Hence, we insert into GA the edge (β∗, y) if c <δ f , and the edge (α∗, y) if f <δ c. Note that f is found during the computation of z = nca(x, y), so this test takes constant time. We use algorithm DerivedLowHigh, shown below, to order the vertices in C(cid:48)(z) according to a low-high order of ζ of GA. After computing GA, we construct two divergent spanning trees BA and RA of GA. For each vertex v (cid:54)= z, if (z, v) is an edge of GA, we replace the parent of v in BA and in RA, denoted by bA(v) and rA(v), respectively, by z. Then we use algorithm AuxiliaryLowHigh to compute a low-high order ζ of GA. Algorithm AuxiliaryLowHigh is a slightly modified version of a linear-time algorithm of [25, Section 6.1] to compute a low-high order. Our modified version computes a low-high order ζ of GA that is an augmentation of δz. To obtain such a low-high order, we need to assign to α∗ the lowest number in ζ and to β∗ the highest number in ζ. The algorithm works as follows. While GA contains at least four vertices, we choose a vertex v (cid:54)∈ {α∗, β∗} whose in-degree in GA exceeds its number of children in BA plus its number of children in RA and remove it from GA. (From this choice of v we also have that v (cid:54)= z.) Then we compute recursively a low-high order for the resulting flow graph, and insert v in an appropriate location, defined by bA(v) and rA(v). Algorithm 4: DerivedLowHigh(z, A, mark ) 1 Compute the derived affected flow graph GA = (VA, EA, z). 2 Compute two divergent spanning trees BA and RA of GA. 3 foreach vertex v ∈ VA \ {z, α∗, β∗} do if mark (v) = true then set bA(v) ← z and rA(v) ← z 4 5 end 6 Initialize a list of vertices Λ ← ∅. 7 Compute Λ ← AuxiliaryLowHigh(GA, BA, RA, Λ). 8 Order the set of children C(cid:48)(z) of z in D(cid:48) according to Λ. Lemma 3.14. Algorithm AuxiliaryLowHigh is correct, that is, it computes a low-high order ζ of GA, such that for all v ∈ VA \ {z, α∗, β∗}, α∗ <ζ v <ζ β∗. Proof. We first show that algorithm AuxiliaryLowHigh runs to completion, i.e., it selects every vertex v ∈ VA \ {z, α∗, β∗} at some execution of line 5. The recursive call in line 13 invokes algorithm AuxiliaryLowHigh on a sequence of smaller flow graphs GA. We claim that the following invariants hold for each such flow graph GA: (i) the dominator tree DA of GA is flat; (ii) the subgraphs BA and RA corresponding to GA are divergent spanning trees of GA rooted at z; (iii) for every v (cid:54)= z, either bA(v) = rA(v) = z or bA(v), rA(v), and z are all distinct. For the initial graph GA the invariants hold by construction. Assume that the invariants hold on entry to line 5. Suppose, now, that line 5 chooses a vertex v (cid:54)∈ {α∗, β∗}. Since v has in-degree at most 2 in GA, the choice of v implies that it has at most one outgoing edge. Hence v is a leaf in either BA or RA. If it is a leaf in both, deleting v and its incoming edges preserves all the invariants. Suppose v is a leaf in RA but not BA. Then v has in-degree 2 in GA; that is, bA(v) (cid:54)= rA(v), which 13 Algorithm 5: AuxiliaryLowHigh(GA, BA, RA, Λ) 1 if GA contains only three vertices then 2 set Λ ← (cid:104)α∗, β∗(cid:105) return Λ 3 4 end 5 Let v (cid:54)∈ {α∗, β∗} be a vertex whose in-degree in GA exceeds its number of children in BA plus its number of children in RA. let w be the child of v in BA; replace bA(w) by bA(v) let w be the child of v in RA; and replace rA(w) by rA(v) 6 Delete v and its incoming edges from GA, BA, and RA. 7 if v was not a leaf in BA then 8 9 end 10 else if v was not a leaf in RA then 11 12 end 13 Call AuxiliaryLowHigh(GA, BA, RA, Λ) recursively for the new graph GA. 14 if bA(v) = z then 15 16 end 17 else 18 19 end 20 return Λ insert v anywhere between α∗ and β∗ in Λ insert v just before bA(v) in Λ if rA(v) is before bA(v) in Λ, just after bA(v) otherwise implies by (iii) that bA(v), rA(v), and v are distinct siblings in DA. Let w be the child of v in BA. Since rA(w) (cid:54)= v, v, rA(w), and z are distinct by (iii). Also rA(w) (cid:54)= bA(v), since rA(w) = bA(v) would imply that rA(w) dominates w by (ii). Finally, bA(v) (cid:54)= z, since bA(v) is a sibling of v and hence of w in DA. We conclude that replacing bA(w) by bA(v) in line 8 preserves (iii). This replacement preserves (i) since v does not dominate w, it preserves (ii) since it removes v from the path in BA from s to w. Replacing bA(w) makes v a leaf in BA, after which its deletion preserves (i)-(iii). Now we show that the invariants imply that line 5 can always choose a vertex v. All vertices in VA \ z are leaves in DA. Let X be the subset of VA that consists of the vertices x such that bA(x) (cid:54)= rA(x). Each vertex in X has in-degree 2 in GA, so there are 2X edges that enter a vertex in X. By invariant (iii), each edge leaving a vertex in X enters a vertex in X. Invariant (iii) also implies that at least two edges enter X from VA \ X. Hence, there are at most 2(X − 1) edges that leave a vertex in X, so there must be a vertex v in X with out-degree at most 1. We claim that v can be selected in line 5. First note that the in-degree of v in GA exceeds its out-degree in GA. If v is a leaf in both BA and RA then it can be selected. If not, then v must be a leaf in either BA or RA, since otherwise its common child w in BA and RA would violate (ii). Hence v can be selected in this case also. Finally, we claim that the computed order is low-high for GA, such that α∗ is first and β∗ is last in this order. The latter follows by the assignment in line 2. So the claim is immediate if GA has three vertices. Suppose, by induction, that this is true if GA has k ≥ 3 vertices. Let GA have k + 1 vertices and let v be the vertex chosen for deletion. The insertion position of v guarantees that v has the low-high property. All vertices in GA after the deletion of v have the low-high property in the new GA \ z by the induction hypothesis, so they have the low-high property in the old GA 14 with the possible exception of w, one of whose incoming edges differs in the old and the new GA. Suppose bA(w) differs; the argument is symmetric if rA(w) differs. Now we have that v, w, bA(v), and rA(w) are distinct children of z in DA. Since w has the low-high property in the new GA, it occurs in Λ between rA(w) and bA(v). Insertion of v next to bA(v) leaves w between rA(w) and v, so it has the low-high property in the old GA as well. The correctness of algorithm InsertEdge follows from Lemmata 3.10, 3.11 and 3.14. Lemma 3.15. Algorithm InsertEdge is correct. Proof. Let (G(cid:48), D(cid:48), δ(cid:48), mark(cid:48), low(cid:48), high(cid:48)) be the output of InsertEdge(G, D, δ, mark , low , high, e). We only need to consider the case where both endpoints of the inserted edge e = (x, y) are reachable in G. Let A be the set of affected vertices, and let z = nca(x, y). Also, let c be the child of z in D that is a common ancestor of all vertices in A. We will show that the computed order δ(cid:48) is a low-high order of G(cid:48) that agrees with δ. This fact implies that the arrays mark(cid:48), low(cid:48), high(cid:48) were z) be the restriction of δ (resp., δ(cid:48)) to C(z) (resp., C(cid:48)(z)). Then, by Lemma 3.14, δ(cid:48) z is an augmentation of δz. So, by Lemmata 3.10 and 3.11, δ(cid:48) is a low-high order in G(cid:48) for any vertex v (cid:54)∈ A ∪ {c}. Finally, Lemma 3.14 implies that δ(cid:48) is also a low-high order in G(cid:48) for the vertices in A ∪ {c}. updated correctly, since their entries did not change for the vertices in V \(cid:0)A ∪ {c}(cid:1). By construction, δ(cid:48) agrees with δ. Let δz (resp., δ(cid:48) Theorem 3.16. Algorithm InsertEdge maintains a low-high order of a flow graph G with n vertices through a sequence of edge insertions in O(mn) total time, where m is the total number of edges in G after all insertions. Proof. Consider the insertion of an edge (x, y). If y was unreachable in G then we compute D and a low-high order in O(m) time. Throughout the whole sequence of m insertions, such an event can happen O(n) times, so all insertions to unreachable vertices are handled in O(mn) total time. Now we consider the cost of executing InsertEdge when both x and y are reachable in G. Let ν be the number of scanned vertices, and let µ be the number of their adjacent edges. We can update the dominator tree and locate the affected vertices (line 8) in O(ν + µ + n) time [23]. Computing z = nca(x, y) in line 7 takes O(n) time just by using the parent function d of D. Lines 9 -- 10 and 12 are also executed in O(n) time. The for loop in lines 13 -- 16 takes O(ν + µ) since we only need to examine the scanned edges. (Variables low (c) and high(c) need to be updated only if there is a scanned edge entering c.) It remains to account for time to compute GA and a low-high order of it. From Lemma 3.13, the derived affected flow graph can be constructed in O(ν + µ) time. In algorithm AuxiliaryLowHigh, we represent the list Λ with the off-line dynamic list maintenance data structure of [25], which supports insertions (in a given location) and order queries in constant time. With this implementation, AuxiliaryLowHigh runs in linear-time, that is O(ν + µ). So InsertEdge runs in O(ν + µ + n) time. The O(n) term gives a total cost of O(mn) for the whole sequence of m insertions. We distribute the remaining O(ν + µ) cost to the scanned vertices and edges, that is O(1) per scanned vertex or edge. Since the depth in D of every scanned vertex decreases by at least one, a vertex and an edge can be scanned at most O(n) times. Hence, each vertex and edge can contribute at most O(n) total cost through the whole sequence of m insertions. The O(mn) bound follows. 15 4 Applications of incremental low-high orders 4.1 Strongly divergent spanning trees and path queries We can use the arrays mark , low , and high to maintain a pair of strongly divergent spanning trees, B and R, of G after each update. Recall that B and R are strongly divergent if for every pair of vertices v and w, we have B[s, v]∩ R[s, w] = D[s, v]∩ D[s, w] or R[s, v]∩ B[s, w] = D[s, v]∩ D[s, w]. Moreover, we can construct B and R so that they are also edge-disjoint except for the bridges of G. A bridge of G is an edge (u, v) that is contained in every path from s to v. Let b(v) (resp., r(v)) denote the parent of a vertex v in B (resp., R). To update B and R after the insertion of an edge (x, y), we only need to update b(v) and r(v) for the affected vertices v, and possibly for their common ancestor c that is a child of z = nca(x, y) from Lemma 3.8. We can update b(v) and r(v) of each vertex v ∈ A∪{c} as follows: set b(v) ← d(v) if low (v) = null , b(v) ← low (v) otherwise; set r(v) ← d(v) if high(v) = null , r(v) ← high(v) otherwise. If the insertion of (x, y) does not affect y, then A = ∅ but we may still need to update b(y) and r(y) if x (cid:54)∈ D(y) in order to make B and R maximally edge-disjoint. Note that in this case z = d(y), so we only need to check if both low (y) and high(y) are null. If they are, then we set low (y) ← x if x <δ y, and set high(y) ← x otherwise. Then, we can update b(y) and r(y) as above. Now consider a query that, given two vertices v and w, asks for two maximally vertex-disjoint paths, πsv and πsw, from s to v and from s to w, respectively. Such queries were used in [47] to give a linear-time algorithm for the 2-disjoint paths problem on a directed acyclic graph. If v <δ w, then we select πsv ← B[s, v] and πsw ← R[s, w]; otherwise, we select πsv ← R[s, v] and πsw ← B[s, w]. Therefore, we can find such paths in constant time, and output them in O(πsv + πsw) time. Similarly, for any two query vertices v and w, we can report a path πsv from s to v that avoids w. Such a path exists if and only if w does not dominate v, which we can test in constant time using the ancestor-descendant relation in D [44]. If w does not dominate v, then we select πsv ← B[s, v] if v <δ w, and select πsv ← R[s, v] if w <δ v. 4.2 Fault tolerant reachability Baswana et al. [6] study the following reachability problem. We are given a flow graph G = (V, E, s) and a spanning tree T = (V, ET ) rooted at s. We call a set of edges E(cid:48) valid if the subgraph G(cid:48) = (V, ET ∪ E(cid:48), s) of G has the same dominators as G. The goal is to find a valid set of minimum cardinality. As shown in [26], we can compute a minimum-size valid set in O(m) time, given the dominator tree D and a low-high order of δ of it. We can combine the above construction with our incremental low-high algorithm to solve the incremental version of the fault tolerant reachability problem, where G is modified by edge insertions and we wish to compute efficiently a valid set for any query spanning tree T . Let t(v) be the parent of v in T . Our algorithm maintains, after each edge insertion, a low-high order δ of G, together with the mark , low , and high arrays. Given a query spanning tree T = (V, ET ), we can compute a valid set of minimum cardinality E(cid:48) as follows. For each vertex v (cid:54)= s, we apply the appropriate one of the following cases: (a) If t(v) = d(v) then we do not insert into E(cid:48) any edge entering v. (b) If t(v) (cid:54)= d(v) and v is marked then we insert (d(v), v) into E(cid:48). (c) If v is not marked then we consider the following subcases: If t(v) >δ v, then we insert into E(cid:48) the edge (x, v) with x = low (v). Otherwise, if t(v) <δ v, then we insert into E(cid:48) the edge (x, v) with x = high(v). Hence, can update the minimum valid set in O(mn) total time. We note that the above construction can be easily generalized for the case where T is forest, i.e., when ET is a subset of the edges of some spanning tree of G. In this case, t(v) can be null for some vertices v (cid:54)= s. To answer a query for such a T , we apply the previous construction with the following modification when t(v) is null. If v is marked then we insert (d(v), v) into E(cid:48), as in 16 case (b). Otherwise, we insert both edges entering v from low (v) and high(v). In particular, when ET = ∅, we compute a subgraph G(cid:48) = (V, E(cid:48), s) of G with minimum number of edges that has the same dominators as G. This corresponds to the case k = 1 in [7]. 4.3 Sparse certificate for 2-edge-connectivity Let G = (V, E) be a strongly connected digraph. We say that vertices u, v ∈ V are 2-edge-connected if there are two edge-disjoint directed paths from u to v and two edge-disjoint directed paths from v to u. (A path from u to v and a path from v to u need not be edge-disjoint.) A 2-edge-connected block of a digraph G = (V, E) is defined as a maximal subset B ⊆ V such that every two vertices in B are 2-edge-connected. If G is not strongly connected, then its 2-edge-connected blocks are the 2-edge-connected blocks of each strongly connected component of G. A sparse certificate for the 2-edge-connected blocks of G is a spanning subgraph C(G) of G that has O(n) edges and maintains the same 2-edge-connected blocks as G. Sparse certificates of this kind allow us to speed up computations, such as finding the actual edge-disjoint paths that connect a pair of vertices (see, e.g., [39]). The 2-edge-connected blocks and a corresponding sparse certificate can be computed in O(m + n) time [21]. An incremental algorithm for maintaining the 2-edge-connected blocks is presented in [24]. This algorithm maintains the dominator tree of G, with respect to an arbitrary start vertex s, and of its reversal GR, together with the auxiliary components of G and GR, defined next. Recall that an edge (u, v) is a bridge of a flow graph G with start vertex s if all paths from s to v include (u, v). After deleting from the dominator tree D the bridges of G, we obtain the bridge decomposition of D into a forest D. For each root r of a tree in the bridge decomposition D we define the auxiliary graph Gr = (Vr, Er) of r as follows. The vertex set Vr of Gr consists of all the vertices in Dr. The edge set Er contains all the edges of G among the vertices of Vr, referred to as ordinary edges, and a set of auxiliary edges, which are obtained by contracting vertices in V \ Vr, as follows. Let v be a vertex in Vr that has a child w in V \ Vr. Note that w is a root in the bridge decomposition D of D. For each such child w of v, we contract w and all its descendants in D into v. The auxiliary components of G are the strongly connected components of each auxiliary graph Gr. We sketch how to extend the incremental algorithm of [24] so that it also maintains a sparse certificate C(G) for the 2-edge-connected components of G, in O(mn) total time. It suffices to maintain the auxiliary components in G and GR, and two maximally edge-disjoint divergent span- ning trees for each of G and GR. We can maintain these divergent spanning trees as described in Section 4.1. To identify the auxiliary components, the algorithm of [24] uses, for each auxiliary graph, an incremental algorithm for maintaining strongly connected components [8]. It is easy to extend this algorithm so that it also computes O(n) edges that define these strongly connected components. The union of these edges and of the edges in the divergent spanning trees are the edges of C(G). 5 2-vertex-connected spanning subgraph Let G = (V, E) be a strongly connected digraph. A vertex x of G is a strong articulation point if G \ x is not strongly connected. A strongly connected digraph G is 2-vertex-connected if it has at least three vertices and no strong articulation points [19, 31]. Here we consider the problem of approximating a smallest 2-vertex-connected spanning subgraph (2VCSS) of G. This problem is NP-hard [17]. We show that algorithm LH-Z (given below), which uses low-high orders, achieves a linear-time 2-approximation for this problem. The best previous approximation ratio achievable in 17 Algorithm 6: LH-Z(G) Input: 2-vertex-connected digraph G = (V, E) Output: 2-approximation of a smallest 2-vertex-connected spanning subgraph H = (V, EH ) of G 1 Choose an arbitrary vertex s of G as start vertex. 2 Compute a strongly connected spanning subgraph H = (V \ s, EH ) of G \ s. 3 Set H ← (V, EH ). 4 Compute a low-high order δ of flow graph G with start vertex s. 5 foreach vertex v (cid:54)= s do 6 7 8 9 10 11 12 13 14 15 if there are two edges (u, v) and (w, v) in EH such that u <δ v and v <δ w then do nothing end else if there is no edge (u, v) ∈ EH such that u <δ v then find an edge e = (u, v) ∈ E with u <δ v set EH ← EH ∪ {e} end else if there is no edge (w, v) ∈ EH such that v <δ w then find an edge e = (w, v) ∈ E with v <δ w or w = s set EH ← EH ∪ {e} end 16 17 end 18 Execute the analogous steps of lines 4 -- 17 for the reverse flow graph GR with start vertex s. 19 return H = (V, EH ) linear-time was 3 [20], so we obtain a substantial improvement. The best approximation ratio for √ 2VCSS is 3/2, and is achieved by the algorithm of Cheriyan and Thurimella [10] in O(m2) time, n + n2) by a combination of [10] and [20]. Computing small spanning subgraphs is of or in O(m particular importance when dealing with large-scale graphs, e.g., with hundreds of million to billion edges. In this framework, one big challenge is to design linear-time algorithms, since algorithms with higher running times might be practically infeasible on today's architectures. Let G = (V, E) be a strongly connected digraph. In the following, we denote by GR = (V, ER) the reverse digraph of G that results from G after reversing all edge directions. Lemma 5.1. Algorithm LH-Z computes a 2-vertex-connected spanning subgraph of G. Proof. We need to show that the computed subgraph H is 2-vertex-connected. From [31], we have that a digraph H is 2-vertex connected if and only if it satisfies the following property: For an arbitrary start vertex s ∈ V , flow graphs H = (V, E, s) and H R = (V, ER, s) have flat dominator trees, and H \ s is strongly connected. The digraph H computed by algorithm LH-Z satisfies the latter condition because of line 2. It remains to show that H has flat dominator tree. The same argument applies for H R, thus completing the proof. Let δ be the low-high order δ of G, computed in line 3. We argue that after the execution of the for loop in lines 5 -- 17, δ is also a low-high order for all vertices in H. Consider an arbitrary vertex v (cid:54)= s. Let (x, v) be an edge entering v in the strongly connected spanning subgraph of G computed in line 2. If x >δ v, then, by the definition of δ, there is at least one edge (y, v) ∈ E such that y <δ v. Hence, after the execution of the for loop for v, the edge set EH will contain at least two edges (u, v) and (w, v) such that u <δ v <δ w. On the other hand, if x <δ v, then the definition of δ implies that there an edge (y, v) ∈ E such that 18 Graph Largest SCC n m avg. δ rome99 twitter-higgs-retweet enron web-NotreDame 3352 13086 8271 48715 8855 63537 147353 267647 soc-Epinions1 Amazon-302 WikiTalk web-Stanford web-Google Amazon-601 web-BerkStan 32220 241761 111878 150475 434818 395230 334857 442768 1131217 1477665 1576157 3419124 3301051 4523232 2.64 4.86 17.82 5.49 13.74 4.68 13.21 10.47 7.86 8.35 13.51 n 2249 1099 4441 1409 1462 1416 17117 55414 49430 5179 10893 77480 276049 1106 4927 12795 29145 2VCCs Type m avg. δ 6467 9290 123527 6856 7279 13226 395183 241663 1254898 129897 162295 840829 2461072 8206 28142 347465 439148 2.88 8.45 27.82 4.87 4.98 9.34 23.09 4.36 road network twitter enron mails web trust network co-purchase web 25.39 Wiki communications 25.08 14.90 10.85 8.92 7.42 5.71 27.16 15.07 web co-purchase web Table 1: Real-world graphs used in the experiments, sorted by the file size of their largest SCC. We used both the largest SCC and the some of the 2VCCs (inside the largest SCC) in our experiments. y >δ v or y = s. Notice that in either case y (cid:54)= x. So, again, after the execution of the for loop for v, the edge set EH will contain at least two edges (u, v) and (w, v) such that either u <δ v <δ w, or u <δ v and w = s. It follows that δ is a low-high order for all vertices v (cid:54)= s in H. By [25], this means that H contains two strongly divergent spanning trees B and R of G. Since G has flat dominator tree, we have that B[s, v] ∩ R[s, v] = {s, v} for all v ∈ V \ s. Hence, since H contains B and R, the dominator tree of H is flat. We remark that the construction of H in algorithm LH-Z guarantees that s will have in-degree and out-degree at least 2 in H. (This fact is implicit in the proof of Lemma 5.1.) Indeed, H will contain the edges from s to the vertices in V \ s with minimum and maximum order in δ, and the edges entering s from the vertices in V \ s with minimum and maximum order in δR. Theorem 5.2. Algorithm LH-Z computes a 2-approximation for 2VCSS in linear time. Proof. We establish the approximation ratio of LH-Z by showing that EH ≤ 4n. The approxi- mation ratio of 2 follows from the fact that any vertex in a 2-vertex-connected digraph must have in-degree at least two. In line 2 we can compute an approximate smallest strongly connected span- ning subgraph of G \ s [34]. For this, we can use the linear-time algorithm of Zhao et al. [49], which selects at most 2(n − 1) edges. Now consider the edges selected in the for loop of lines 5 -- 17. Since after line 2, H \ s is strongly connected, each vertex v ∈ V \ s has at least one entering edge (x, v). If x <δ v then lines 10 -- 11 will not be executed; otherwise, v <δ x and lines 14 -- 15 will not be executed. Thus, the for loop of lines 5 -- 17 adds at most one edge entering each vertex v (cid:54)= s. The same argument implies that the analogous steps executed for GR add at most one edge leaving each vertex v (cid:54)= s. Hence, EH contains at most 4(n − 1) at the end of the execution. 6 Empirical Analysis For the experimental evaluation we use the graph datasets shown in Table 1. We wrote our implementations in C++, using g++ v.4.6.4 with full optimization (flag -O3) to compile the code. We report the running times on a GNU/Linux machine, with Ubuntu (12.04LTS): a Dell PowerEdge 19 Figure 4: Incremental low-high order: dynamized 2VC graphs (top) and edge insertion in strongly connected graphs (bottom). Running times, in seconds, and number of edges both shown in loga- rithmic scale. R715 server 64-bit NUMA machine with four AMD Opteron 6376 processors and 128GB of RAM memory. Each processor has 8 cores sharing a 16MB L3 cache, and each core has a 2MB private L2 cache and 2300MHz speed. In our experiments we did not use any parallelization, and each algorithm ran on a single core. We report CPU times measured with the getrusage function, averaged over ten different runs. In Table 1 we can see some statistics about the real-world graphs we used in our experimental evaluation. 6.1 Incremental low-high order. We compare the performance of four algorithms. As a baseline, we use a static low-high order algorithm from [25] based on an efficient implementation of the Lengauer-Tarjan algorithm for computing dominators [35] from [27]. Our baseline algorithm, SLT, constructs, as intermediary, two divergent spanning trees. After each insertion of an edge (x, y), SLT recomputes a low-high order if x is reachable. An improved version of this algorithm, that we refer to as SLT-NCA, tests if the insertion of (x, y) affects the dominator tree by computing the nearest common ancestor If this is the case, then SLT-NCA recomputes a low-high order as SLT. The other of x and y. two algorithms are the ones we presented in Section 3. For our simple algorithm, DBS-DST, we extend the incremental dominators algorithm DBS of [23] with the computation of two divergent spanning trees and a low-high order, as in SLT. Algorithm DBS-DST applies these computations on a sparse subgraph of the input digraph that maintains the same dominators. Finally, we tested an implementation of our more efficient algorithm, DBS-AUX, that updates the low-high order by computing a local low-high order of an auxiliary graph. We compared the above incremental low-high order algorithms in two different field tests. In the first one, we considered 2-vertex connected graphs, and we dynamized them in the following manner: we removed a percentage of edges (i.e., 5%, 10%, and 20% respectively), selected uni- formly at random, that were incrementally added to the graph. Note that during the execution of the algorithms some vertices may be unreachable at first. Also, at the end of all insertions, the final graph has flat dominator tree. In Figure 4 (top) we can see that the algorithms are well 20 0.0010.010.11101001.00010.000100.0001+e41+e51+e6SLTSLT-NCADBS-AUXDBS-DST0.0010.010.11101001.00010.000100.0001+e41+e51+e6SLTSLT-NCADBS-AUXDBS-DST Figure 5: Smallest 2-vertex-connected spanning subgraph. Top: running times, in seconds, and number of edges both shown in logarithmic scale. Bottom: relative size of the resulting 2VCSS. distinguished: our DBS-AUX performs consistently better than the other ones (with the exception of two NotreDame instances). The total running times are given in Table 2. On average, DBS-DST is about 2.84 times faster than SLT-NCA, with their relative performance depending on the density of the graph (the higher the average degree the better DBS-DST performs w.r.t. SLT-NCA.) As we mentioned, the naive SLT is the worst performer. The above observed behavior of the algo- rithms is similar also in the second test. Here, we consider the strongly connected graphs, and we incrementally insert random edges up to a certain percentage of the original number of edges (i.e., as before, 5%, 10%, and 20% respectively). We use strongly connected graphs only in order to guarantee that all vertices are reachable from the selected source. (Strong connectivity has no other effect in these tests.) The endpoints of each new edge are selected uniformly at random, and the edge is inserted if it is not a loop and is not already present in the current graph. The ranking of the algorithms does not change, as we can see in Figure 4 (bottom), but the difference is bigger: we note a bigger gap of more than two orders of magnitude, in particular, between DBS-AUX and the couple SLT-NCA and DBS-DST. This is expected because, unlike the first test, here all edges connect already reachable vertices. This means that DBS-DST and DBS-AUX do not execute a full restart for any of these insertions. The total running times are given in Table 3. 6.2 2-vertex-connected spanning subgraph. In this experimental evaluation we compared four algorithms for computing the (approximated) smallest 2-vertex-connected spanning subgraph. Specifically, we tested two algorithms from [20], FAST which computes a 3-approximation in linear-time by using divergent spanning trees, and FAST-CT which combines FAST with the 3/2-approximation algorithm of Cheriyan and Thurimella [10]. In the experiments reported in [20], the former algorithm achieved the fastest running times, while the latter the best solution quality. We compare these algorithms against our new algorithm LH-Z of Section 5, and a new hybrid algorithm LH-Z-CT, that combines LH-Z with the algorithm of Cheriyan and Thurimella [10]. Algorithm LH-Z-CT works as follows. First, it computes a 1-matching M in the input graph G [16], using bipartite matching as in [10]. Let H be the subgraph of G\s, for arbitrary start vertex s, that contains only the edges in M . We compute the strongly connected components C1, . . . , Ck 21 0.0010.010.11101001.00010.000100.0001.000.0001+e41+e51+e6FASTLH-ZLH-Z-CTFAST-CT1.01.21.41.61.82.01+e41+e51+e6FASTLH-ZLH-Z-CTFAST-CT Graph rome05 rome10 rome20 twitter05 twitter10 twitter20 NotreDame05 NotreDame10 NotreDame20 enron05 enron10 enron20 webStanford05 webStanford10 webStanford20 Amazon05 Amazon10 Amazon20 WikiTalk05 WikiTalk10 WikiTalk20 nodes 2249 2249 2249 1099 1099 1099 1416 1416 1416 4441 4441 4441 5179 5179 5179 55414 55414 55414 49430 49430 49430 starting edges 6144 5820 5174 8826 8361 7432 12565 11903 10581 117351 111174 98822 123402 116907 103918 229580 217497 193330 1192153 1129408 1003918 final edges 6467 6467 6467 9290 9290 9290 13226 13226 13226 123527 123527 123527 129897 129897 129897 241663 241663 241663 1254898 1254898 1254898 SLT SLT-NCA DBS-AUX DBS-DST 0.16457 0.319025 0.639627 0.012953 0.027945 0.070981 0.003421 0.003341 0.003374 0.152272 0.388753 1.40979 0.370119 0.439147 0.329067 26.5169 18.4656 26.7402 20.2353 45.7164 99.6058 0.120026 0.231678 0.646389 0.051123 0.085982 0.198226 0.003981 0.003997 0.01446 0.811483 1.5252 3.08813 0.936905 1.02925 1.04364 37.4155 41.4565 44.8627 113.946 247.601 500.581 0.060632 0.242326 0.231463 0.004682 0.006498 0.018012 0.002727 0.005094 0.004571 0.033019 0.204307 0.999617 0.236135 0.316648 0.323679 8.91418 8.80395 8.66914 4.7007 17.5997 45.9101 0.216091 0.734963 0.772791 0.320313 0.996879 2.06744 0.012942 0.012958 0.019733 51.5453 109.719 158.83 42.1674 51.2838 51.6162 185.868 214.185 230.7 15026.2 24846.2 51682 Table 2: Running times of the plot shown in Figure 4 (top) . Graph rome05 rome10 rome20 twitter05 twitter10 twitter20 enron05 enron10 enron20 NotreDame05 NotreDame10 NotreDame20 Amazon05 Amazon10 Amazon20 WikiTalk05 WikiTalk10 WikiTalk20 webStanford05 webStanford10 webStanford20 nodes 3352 3352 3352 13086 13086 13086 8271 8271 8271 48715 48715 48715 241761 241761 241761 111878 111878 111878 150475 150475 150475 starting edges 8855 8855 8855 63537 63537 63537 147353 147353 147353 267647 267647 267647 1131217 1131217 1131217 1477665 1477665 1477665 1576157 1576157 1576157 final edges 9298 9741 10626 66714 69891 76244 154721 162088 176824 281029 294412 321176 1187778 1244339 1357460 1551548 1625432 1773198 1654965 1733773 1891388 SLT SLT-NCA DBS-AUX DBS-DST 0.07962 0.147052 0.259299 4.2933 8.73372 11.1431 1.72764 3.97011 4.94514 234.757 359.028 585.807 3094.69 5628.51 9157.5 1157.84 1666.28 2124.6 2295.55 3749.12 5381.12 0.185072 0.366822 0.410448 9.94862 25.189 31.7239 11.9889 25.0999 20.1978 375.356 610.29 1168.5 6386.97 11905.7 15871 3414.28 5301.51 7296.72 8403.03 11503.4 15792.1 0.002457 0.005531 0.008154 0.073755 0.120719 0.186917 0.068994 0.09557 0.106017 0.70628 0.79135 1.31932 26.5493 45.1881 60.197 10.3364 14.5151 19.5778 7.028 13.7287 12.7093 0.662001 1.06533 2.74201 26.5965 55.4924 96.3205 82.6084 180.222 353.174 785.012 1691.05 3593.09 >24h >24h >24h >24h >24h >24h >24h >24h >24h Table 3: Running times of the plot shown in Figure 4 (bottom) . 22 Graph Size FAST LH-Z LH-Z-CT FAST-CT rome99 web-NotreDame1 web-NotreDame2 web-BerkStan1 twitter-higgs-retweet web-NotreDame3 web-BerkStan2 web-Stanford Amazon-302 web-BerkStan3 web-Google WikiTalk Amazon-601 nodes 2249 1409 1462 1106 1099 1416 4927 5179 55414 12795 77480 49430 276049 edges 6467 6856 7279 8206 9290 13226 28142 129897 241663 347465 840829 1254898 2461072 time 0.003581 0.002697 0.002784 0.001753 0.000885 0.003182 0.009555 0.022056 0.11804 0.055141 0.182113 0.338172 0.977274 edges 5691 3796 3949 3423 3553 4687 13391 17940 164979 45111 256055 176081 932989 time 0.004513 0.001211 0.005436 0.00393 0.005976 0.005515 0.018985 0.031001 0.164081 0.049862 0.401427 0.548573 1.607812 edges 5370 3356 3545 2795 3143 3990 12296 14583 141467 36328 221327 161128 744345 time 2.099891 0.927683 0.999031 0.525704 1.087169 0.751014 11.223287 22.141856 2986.022813 149.561649 7668.066338 5883.002974 140894.0119 edges 4837 3029 3189 2433 2745 3560 10646 11556 123095 29307 191616 138030 612760 time 5.042213 2.119423 2.262008 0.949573 1.153608 2.143551 23.887951 31.346059 3935.135495 203.913794 20207.08225 4770.705853 298775.2092 edges 5057 3153 3300 2440 2879 3768 11750 12920 132847 32989 211529 143958 688159 Table 4: Running times and number of edges in the resulting 2-vertex-connected spanning subgraph; plots shown in Figure 5 . in H, and form a contracted version G(cid:48) of G as follows. For each strongly connected component Ci of H, we contract all vertices in Ci into a representative vertex ui ∈ Ci. (Contractions are performed by union-find [45] and merging lists of out-edges of G.) Then, we execute the linear- time algorithm of Zhao et al. [49] to compute a strongly connected spanning subgraph of G(cid:48), and store the original edges of G that correspond to the selected edges by the Zhao et al. algorithm. Let Z be this set of edges. We compute a low-high order of G with root s, and use it in order to compute a 2-vertex-connected spanning subgraph W of G using as many edges from Z and M as possible, as in LH-Z. Then, we run the filtering phase of Cheriyan and Thurimella. For each edge (x, y) of W that is not in M , we test if x has two vertex-disjoint paths to y in W \ (x, y). If it does, then we set W ← W \ (x, y). We remark that, similarly to FAST-CT, LH-Z preserves the 3/2 √ approximation guarantee of the Cheriyan-Thurimella algorithm for k = 2 and improves its running time from O(m2) to O(m n+n2), for a digraph with n vertices and m arcs. In our implementation, the bipartite matching is computed via max-flow, using an implementation of the Goldberg-Tarjan push-relabel algorithm [28] from [13], which is very fast in practice. (This implementation was provided by the authors of [13].) In Figure 5 (top) we can see the running times of the four algorithms. (See also Table 4.) It is easy to observe that the algorithms belong to two distinct classes, with FAST and LH-Z being faster than the other two by approximately five orders of magnitude. In the bottom part of Figure 5 we can see the relative size of the smallest spanning subgraph computed by the four algorithms. In all of our experiments, the smallest subgraph was the one computed by our new hybrid algorithm LH-Z-CT. One the other hand, on average LH-Z is only twice as slow as FAST but improves the solution quality by more than 13%. Summing up, if one wants a fast and good solution LH-Z is the right choice. Acknowledgement. We would like to thank Bob Tarjan for valuable comments and suggestions. References [1] A. Abboud and V. Vassilevska Williams. Popular conjectures imply strong lower bounds for In Proc. 55th IEEE Symposium on Foundations of Computer Science, dynamic problems. FOCS, pages 434 -- 443, 2014. 23 [2] S. Allesina and A. Bodini. Who dominates whom in the ecosystem? Energy flow bottlenecks and cascading extinctions. Journal of Theoretical Biology, 230(3):351 -- 358, 2004. [3] S. Alstrup, D. Harel, P. W. Lauridsen, and M. Thorup. Dominators in linear time. SIAM Journal on Computing, 28(6):2117 -- 32, 1999. [4] S. Alstrup and P. W. Lauridsen. A simple dynamic algorithm for maintaining a dominator tree. Technical Report 96-3, Department of Computer Science, University of Copenhagen, 1996. [5] M. E. Amyeen, W. K. Fuchs, I. Pomeranz, and V. Boppana. Fault equivalence identification using redundancy information and static and dynamic extraction. In Proceedings of the 19th IEEE VLSI Test Symposium, March 2001. [6] S. Baswana, K. Choudhary, and L. Roditty. Fault tolerant reachability for directed graphs. In Yoram Moses, editor, Distributed Computing, volume 9363 of Lecture Notes in Computer Science, pages 528 -- 543. Springer Berlin Heidelberg, 2015. [7] S. Baswana, K. Choudhary, and L. Roditty. Fault tolerant reachability subgraph: Generic and optimal. In Proc. 48th ACM Symp. on Theory of Computing, pages 509 -- 518, 2016. To appear. [8] M. A. Bender, J. T. Fineman, S. Gilbert, and R. E. Tarjan. A new approach to incremental cycle detection and related problems. ACM Transactions on Algorithms, 12(2):14:1 -- 14:22, December 2015. [9] A. L. Buchsbaum, L. Georgiadis, H. Kaplan, A. Rogers, R. E. Tarjan, and J. R. Westbrook. Linear-time algorithms for dominators and other path-evaluation problems. SIAM Journal on Computing, 38(4):1533 -- 1573, 2008. [10] J. Cheriyan and R. Thurimella. Approximating minimum-size k-connected spanning subgraphs via matching. SIAM J. Comput., 30(2):528 -- 560, 2000. [11] S. Cicerone, D. Frigioni, U. Nanni, and F. Pugliese. A uniform approach to semi-dynamic problems on digraphs. Theor. Comput. Sci., 203:69 -- 90, August 1998. [12] R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck. Efficiently comput- ing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems, 13(4):451 -- 490, 1991. [13] D. Delling, A. V. Goldberg, I. Razenshteyn, and R. F. Werneck. Graph partitioning with nat- ural cuts. In 25th International Parallel and Distributed Processing Symposium (IPDPS'11), 2011. [14] W. Fraczak, L. Georgiadis, A. Miller, and R. E. Tarjan. Finding dominators via disjoint set union. Journal of Discrete Algorithms, 23:2 -- 20, 2013. [15] H. N. Gabow. The minset-poset approach to representations of graph connectivity. ACM Transactions on Algorithms, 12(2):24:1 -- 24:73, February 2016. [16] H. N. Gabow and R. E. Tarjan. Faster scaling algorithms for general graph matching problems. J. ACM, 38:815 -- 853, 1991. [17] M. R. Garey and D. S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman & Co., New York, NY, USA, 1979. 24 [18] K. Gargi. A sparse algorithm for predicated global value numbering. SIGPLAN Not., 37(5):45 -- 56, May 2002. [19] L. Georgiadis. Testing 2-vertex connectivity and computing pairs of vertex-disjoint s-t paths In Proc. 37th Int'l. Coll. on Automata, Languages, and Programming, pages in digraphs. 738 -- 749, 2010. [20] L. Georgiadis. Approximating the smallest 2-vertex connected spanning subgraph of a directed graph. In Proc. 19th European Symposium on Algorithms, pages 13 -- 24, 2011. [21] L. Georgiadis, G. F. Italiano, L. Laura, and N. Parotsidis. 2-edge connectivity in directed graphs. In Proc. 26th ACM-SIAM Symp. on Discrete Algorithms, pages 1988 -- 2005, 2015. [22] L. Georgiadis, G. F. Italiano, L. Laura, and N. Parotsidis. 2-vertex connectivity in directed graphs. In Proc. 42nd Int'l. Coll. on Automata, Languages, and Programming, pages 605 -- 616, 2015. [23] L. Georgiadis, G. F. Italiano, L. Laura, and F. Santaroni. An experimental study of dynamic In Proc. 20th European Symposium on Algorithms, pages 491 -- 502, 2012. Full dominators. version: CoRR, abs/1604.02711. [24] L. Georgiadis, G. F. Italiano, and N. Parotsidis. Incremental 2-edge-connectivity in directed In Proc. 43nd Int'l. Coll. on Automata, Languages, and Programming, 2016. To graphs. appear. [25] L. Georgiadis and R. E. Tarjan. Dominator tree certification and divergent spanning trees. ACM Transactions on Algorithms, 12(1):11:1 -- 11:42, November 2015. [26] L. Georgiadis and R. E. Tarjan. Addendum to "Dominator tree certification and divergent spanning trees". ACM Transactions on Algorithms, 12(4):56:1 -- 56:3, August 2016. [27] L. Georgiadis, R. E. Tarjan, and R. F. Werneck. Finding dominators in practice. Journal of Graph Algorithms and Applications (JGAA), 10(1):69 -- 94, 2006. [28] A. V. Goldberg and R. E. Tarjan. A new approach to the maximum-flow problem. Journal of the ACM, 35:921 -- 940, October 1988. [29] M. Gomez-Rodriguez and B. Scholkopf. Influence maximization in continuous time diffusion networks. In 29th International Conference on Machine Learning (ICML), 2012. [30] M. Henzinger, S. Krinninger, and V. Loitzenbauer. Finding 2-edge and 2-vertex strongly connected components in quadratic time. In Proc. 42nd Int'l. Coll. on Automata, Languages, and Programming, pages 713 -- 724, 2015. [31] G. F. Italiano, L. Laura, and F. Santaroni. Finding strong bridges and strong articulation points in linear time. Theoretical Computer Science, 447:74 -- 84, 2012. [32] R. Jaberi. Computing the 2-blocks of directed graphs. RAIRO-Theor. Inf. Appl., 49(2):93 -- 119, 2015. [33] R. Jaberi. On computing the 2-vertex-connected components of directed graphs. Discrete Applied Mathematics, 204:164 -- 172, 2016. 25 [34] S. Khuller, B. Raghavachari, and N. E. Young. Approximating the minimum equivalent di- graph. SIAM J. Comput., 24(4):859 -- 872, 1995. Announced at SODA 1994, 177-186. [35] T. Lengauer and R. E. Tarjan. A fast algorithm for finding dominators in a flowgraph. ACM Transactions on Programming Languages and Systems, 1(1):121 -- 41, 1979. [36] E. K. Maxwell, G. Back, and N. Ramakrishnan. Diagnosing memory leaks using graph min- ing on heap dumps. In Proceedings of the 16th ACM SIGKDD international conference on Knowledge discovery and data mining, KDD '10, pages 115 -- 124, 2010. [37] R. M. McConnell, K. Mehlhorn, S. Naher, and P. Schweitzer. Certifying algorithms. Computer Science Review, 5(2):119 -- 161, 2011. [38] M. Mowbray and A. Lain. Dominator-tree analysis for distributed authorization. In Proceedings of the Third ACM SIGPLAN Workshop on Programming Languages and Analysis for Security, PLAS '08, pages 101 -- 112, New York, NY, USA, 2008. ACM. [39] H. Nagamochi and T. Ibaraki. A linear-time algorithm for finding a sparse k-connected span- ning subgraph of a k-connected graph. Algorithmica, 7:583 -- 596, 1992. [40] L. Quesada, P. Van Roy, Y. Deville, and R. Collet. Using dominators for solving constrained In Proc. 8th International Conference on Practical Aspects of Declarative path problems. Languages, pages 73 -- 87, 2006. [41] G. Ramalingam and T. Reps. An incremental algorithm for maintaining the dominator tree In Proc. 21st ACM SIGPLAN-SIGACT Symp. on Principles of of a reducible flowgraph. Programming Languages, pages 287 -- 296, 1994. [42] G. Ramalingam and T. Reps. An incremental algorithm for maintaining the dominator tree of a reducible flowgraph. In Proceedings of the 21st ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 287 -- 296, 1994. [43] V. C. Sreedhar, G. R. Gao, and Y. Lee. Incremental computation of dominator trees. ACM Transactions on Programming Languages and Systems, 19:239 -- 252, 1997. [44] R. E. Tarjan. Finding dominators in directed graphs. SIAM Journal on Computing, 3(1):62 -- 89, 1974. [45] R. E. Tarjan. Efficiency of a good but not linear set union algorithm. Journal of the ACM, 22(2):215 -- 225, 1975. [46] R. E. Tarjan. Fast algorithms for solving path problems. Journal of the ACM, 28(3):594 -- 614, 1981. [47] T. Tholey. Linear time algorithms for two disjoint paths problems on directed acyclic graphs. Theoretical Computer Science, 465:35 -- 48, 2012. [48] J. Zhao and S. Zdancewic. Mechanized verification of computing dominators for formalizing In Proc. 2nd International Conference on Certified Programs and Proofs, pages compilers. 27 -- 42. Springer, 2012. [49] L. Zhao, H. Nagamochi, and T. Ibaraki. A linear time 5/3-approximation for the minimum strongly-connected spanning subgraph problem. Information Processing Letters, 86(2):63 -- 70, 2003. 26
1704.04163
3
1704
2019-01-03T15:37:07
Spectrum Approximation Beyond Fast Matrix Multiplication: Algorithms and Hardness
[ "cs.DS", "cs.LG", "math.NA" ]
Understanding the singular value spectrum of a matrix $A \in \mathbb{R}^{n \times n}$ is a fundamental task in countless applications. In matrix multiplication time, it is possible to perform a full SVD and directly compute the singular values $\sigma_1,...,\sigma_n$. However, little is known about algorithms that break this runtime barrier. Using tools from stochastic trace estimation, polynomial approximation, and fast system solvers, we show how to efficiently isolate different ranges of $A$'s spectrum and approximate the number of singular values in these ranges. We thus effectively compute a histogram of the spectrum, which can stand in for the true singular values in many applications. We use this primitive to give the first algorithms for approximating a wide class of symmetric matrix norms in faster than matrix multiplication time. For example, we give a $(1 + \epsilon)$ approximation algorithm for the Schatten-$1$ norm (the nuclear norm) running in just $\tilde O((nnz(A)n^{1/3} + n^2)\epsilon^{-3})$ time for $A$ with uniform row sparsity or $\tilde O(n^{2.18} \epsilon^{-3})$ time for dense matrices. The runtime scales smoothly for general Schatten-$p$ norms, notably becoming $\tilde O (p \cdot nnz(A) \epsilon^{-3})$ for any $p \ge 2$. At the same time, we show that the complexity of spectrum approximation is inherently tied to fast matrix multiplication in the small $\epsilon$ regime. We prove that achieving milder $\epsilon$ dependencies in our algorithms would imply faster than matrix multiplication time triangle detection for general graphs. This further implies that highly accurate algorithms running in subcubic time yield subcubic time matrix multiplication. As an application of our bounds, we show that precisely computing all effective resistances in a graph in less than matrix multiplication time is likely difficult, barring a major algorithmic breakthrough.
cs.DS
cs
Spectrum Approximation Beyond Fast Matrix Multiplication: Algorithms and Hardness Cameron Musco MIT Praneeth Netrapalli Microsoft Research Aaron Sidford Stanford University [email protected] [email protected] [email protected] Shashanka Ubaru David P. Woodruff University of Minnesota Carnegie Mellon University [email protected] [email protected] Abstract Understanding the singular value spectrum of a matrix A ∈ Rn×n is a fundamental task in countless numerical computation and data analysis applications. In matrix multiplication time, it is possible to perform a full SVD of A and directly compute the singular values σ1, . . . , σn. However, little is known about algorithms that break this runtime barrier. Using tools from stochastic trace estimation, polynomial approximation, and fast linear sys- tem solvers, we show how to efficiently isolate different ranges of A's spectrum and approximate the number of singular values in these ranges. We thus effectively compute an approximate histogram of the spectrum, which can stand in for the true singular values in many applications. We use our histogram primitive to give the first algorithms for approximating a wide class of symmetric matrix norms and spectral sums faster than the best known runtime for matrix multiplication. For example, we show how to obtain a (1 + ǫ) approximation to the Schatten 1-norm (i.e. the nuclear or trace norm) in just O((nnz(A)n1/3 +n2)ǫ−3) time for A with uniform row sparsity or O(n2.18ǫ−3) time for dense matrices. The runtime scales smoothly for general Schatten p-norms, notably becoming O(p nnz(A)ǫ−3) for any real p ≥ 2. At the same time, we show that the complexity of spectrum approximation is inherently tied to fast matrix multiplication in the small ǫ regime. We use fine-grained complexity to give conditional lower bounds for spectrum approximation, showing that achieving milder ǫ dependencies in our algorithms would imply triangle detection algorithms for general graphs running in faster than state of the art matrix multiplication time. This further implies, through a reduction of [WW10], that highly accurate spectrum approximation algorithms running in subcubic time can be used to give subcubic time matrix multiplication. As an application of our bounds, we show that precisely computing all effective resistances in a graph in less than matrix multiplication time is likely difficult, barring a major algorithmic breakthrough. 9 1 0 2 n a J 3 ] S D . s c [ 3 v 3 6 1 4 0 . 4 0 7 1 : v i X r a 1 Introduction Given A ∈ Rn×d, a central primitive in numerical computation and data analysis is to compute A's spectrum: the singular values σ1(A) ≥ . . . ≥ σd(A) ≥ 0. These values can reveal matrix structure and low effective dimensionality, which can be exploited in a wide range of spectral data analysis methods [Jol02, US16]. The singular values are also used as tuning parameters in many numerical algorithms performed on A [GVL12], and in general, to determine some of the most well-studied matrix functions [Hig08]. For example, for any f : R+ → R+, we can define the spectral sum: def = Sf (A) dXi=1 f (σi(A)). Spectral sums often serve as snapshots of A's spectrum and are important in many applications. They encompass, for example, the log-determinant, the trace inverse, the Schatten p-norms, in- cluding the important nuclear norm, and general Orlicz norms (see Section 1.2 for details). While the problem of computing a few of the largest or smallest singular values of A has been exhaustively studied [Par98, Saa11], much less is known about algorithms that approximate the full spectrum, and in particular, allow for the computation of summary statistics such as spectral sums. In nω time, it is possible to perform a full SVD and compute the singular values exactly.1 Here, and throughout, ω ≈ 2.3729 denotes the current best exponent of fast matrix multiplication [Wil12]. However, even if one simply desires, for example, a constant factor approximation to the nuclear norm kAk1, no o(nω) time algorithm is known. We study the question of spectrum approximation, asking whether obtaining an accurate picture of A's spectrum is truly as hard as matrix multiplication, or if it is possible to break this barrier. We focus on spectral sums as a motivating application. 1.1 Our Contributions Upper Bounds: On the upper bound side, we show that significant information about A's spectrum can be determined in o(nω) time, for the current value of ω. We show how to compute a histogram of the spectrum, which gives approximate counts of the number of squared singular values in the ranges [(1− α)tσ2 1(A)] for some width parameter α and for t ranging from 0 to some maximum T . Specifically our algorithm satisfies the following: Theorem 1 (Histogram Approximation -- Informal). Given A ∈ Rn×d, let bt be the number of squared singular values of A on the range [(1 − α)tσ2 1(A)]. Then given error parameter ǫ > 0, with probability 99/100, Algorithm 1 outputs for all t ∈ {0, ..., T}, bt satisfying: 1(A), (1 − α)t−1σ2 1(A), (1− α)t−1σ2 (1 − ǫ)bt ≤ bt ≤ (1 + ǫ)bt + ǫ(bt−1 + bt+1). and κ k(A)+Pd i=k+1 σ2 def = kσ2 For input parameter k ∈ {1, ..., d}, let ¯κ maximum number of nonzeros in a row of A. The algorithm's runtime can be bounded by: d·(1−α)T O nnz(A)k + dkω−1 +pnnz(A)[d · ds(A) + dk]¯κ for sparse A or O(cid:16) ndγ−1+n1/2d3/2√¯κ) poly(ǫ, α) poly(ǫ,α) def = i (A) σ2 k+1(A) (1−α)T . Let ds(A) be the ! √κ⌉ (cid:17) for dense A, where dγ is the time it takes to multiply a O nnz(A)k + dkω−1 + (nnz(A) + dk)⌈ ! or poly(ǫ, α) d × d matrix by a d × k matrix using fast matrix multiplication. 1 Note that an exact SVD is incomputable even with exact arithmetic [TB97]. Nevertheless, direct methods for the SVD obtain superlinear convergence rates and hence are often considered to be 'exact'. 1 This primitive is useful on its own, giving an accurate summary of A's spectrum which can be used in many downstream applications. Setting the parameter k appropriately to balance costs (see overview in Section 1.3), we use it to give the first o(nω) algorithms for computing (1 ± ǫ) relative error approximations to a broad class of spectral sums for functions f , which are a) smooth and b) quickly growing, so that very small singular values cannot make a significant contribution to Sf (A). This class includes for example the Schatten p-norms for all p > 0, the SVD entropy, the Ky Fan norms, and many general Orlicz norms. For a summary of our p-norm results see Table 1. Focusing for simplicity on square matrices, p in with uniformly sparse rows, and assuming ǫ, p are constants, our algorithms approximate kAkp O(nnz(A)) time for any real p ≥ 2.2 For p ≤ 2, we achieve O(cid:16)nnz(A)n 2/p+1pnnz(A)(cid:17) runtime. In the important case of p = 1, this becomes O(cid:16)nnz(A)n1/3 + npnnz(A)(cid:17). Note that npnnz(A) ≤ n2, and for sparse enough A, this bound is subquadratic. For dense A, we use fast 1+.0435p (cid:17) for all p < 2. For p = 1, this gives O(n2.18). matrix multiplication, achieving time O(cid:16)n Even without fast matrix multiplication, the runtime is O(n2.33), and so o(nω) for ω ≈ 2.3729. Lower Bounds: On the lower bound side, we show that obtaining o(nω) time spectrum approxi- mation algorithms with very high accuracy may be difficult. Our runtimes all depend polynomially on the error ǫ, and we show that improving this dependence, e.g., to log(1/ǫ), or even to a better polynomial, would give faster algorithms for the well studied Triangle Detection problem. 2.3729−.0994p 1/p−1/2 1/p+1/2 + n 4/p−1 Specifically, for a broad class of spectral sums, including all Schatten p-norms with p 6= 2, SVD entropy, log det(A), tr(A−1), and tr(exp(A)), we show that any (1 ± ǫ) approximation algorithm running in O(nγǫ−c) time yields an algorithm for triangle detection running in O(nγ+O(c)) time. For γ < ω and sufficiently small c, such an algorithm would improve the state of the art in triangle detection, which currently requires Θ(nω) time on dense graphs. Furthermore, through a reduction of [WW10], any subcubic time triangle detection algorithm yields a subcubic time algorithm for Boolean Matrix Multiplication (BMM). Thus, any spectral sum algorithm achieving subcubic runtime and 1 ǫc accuracy for small enough constant c, must (implicitly) implement fast matrix multiplication. This is in stark contrast to the fact that, for c = 3, for many spectral sums, including all Schatten p-norms with p ≥ 1/2, we obtain subcubic, and in fact o(nω) for ω = 2.3729, runtimes without using fast matrix multiplication (see Table 1 for precise ǫ dependencies). Our lower bounds hold even for well-conditioned matrices and structured matrices like sym- metric diagonally dominant (SDD) systems, both of which admit nearly linear time algorithms for system solving [ST04]. This illustrates a dichotomy between linear algebraic primitives like ap- plying A−1 to a vector and spectral summarization tasks like precisely computing tr(A−1), which in some sense require more global information about the matrix. Our analysis has ramifications regarding natural open problems in graph theory and numerical computation. For example, for graph Laplacians, we show that accurately computing all effective resistances yields an accurate algorithm for computing tr(A−1) of certain matrices, which is enough to give triangle detection. 1.2 Related Work on Spectral Sums The applications of approximate spectral sum computation are very broad. When A is positive semidefinite (PSD) and f (x) = log(x), Sf (A) is the log-determinant, which is important in machine learning and inference applications [Ras04, DKJ+07, FHT08]. For f (x) = 1/x, Sf (A) is the trace of the inverse, used in uncertainty quantification [BCF09] and quantum chromodynamics [SLO13]. 2For any A ∈ Rn×d, nnz(A) denotes the number of nonzero entries in A. 2 p range Sparsity Approx. p > 2 p ≤ 2 p ≤ 2 p > 0 p > 2 p < 2 uniform uniform (1 + ǫ) (1 + ǫ) dense (1 + ǫ) general general general (1 + ǫ) 1/γ 1/γ Runtime 4/p−1 3+p/2 · n f (p,ǫ) O(cid:16) 1 f (p,ǫ) n 2.3729−.0994p O(cid:18) 1 1/p−1/2 1/p+1/2 + n 2/p+1pnnz(A)(cid:21)(cid:19) O(cid:0)nnz(A) · p/ǫ3(cid:1) f (p,ǫ) (cid:20)nnz(A)n 1+.0435p (cid:17) or O(cid:18) 1 f (p,ǫ)hnnz(A)n O(cid:16) 1 p3hnnz(A)n O(cid:16) 1 1+p/2(cid:19) w/o FMM 1+pi(cid:17) O(p nnz(A) · nγ) 1/p+1/2 +γ/2 +pnnz(A) · n 4/p−1 2/p−1i(cid:17) 1 1+p + n1+ 2 1/p−1/2 Theorem Thm 32 Thm 33 Thm 31 Thms 32, 33 Thm 34 Thm 34 Table 1: Summary of our results for approximating the Schatten p-norms. We define f (p, ǫ) = min{1, p3} · ǫmax{3,1+1/p}, which appears as a factor in many of the bounds. The uniform sparsity assumption is that the maximum row sparsity ds(A) ≤ ξ n nnz(A) for some constant ξ. In our theorems, we give general runtimes, parameterized by ξ. When we do not have the uniform sparsity assumption, we are still able to give a (1 + ǫ) approximation in O(ǫ−3 nnz(A)√n + n2) time for example for kAk1. We can also give 1/γ approximation for any constant γ < 1 by paying an nγ/2 factor in our runtime. Note that for dense matrices, for all p we obtain o(nω) runtime, or o(n3) runtime if we do not use fast matrix multiplication. When f (x) = xp, Sf (A) = kAkp p where kAkp is the Schatten p-norm of A. Computation of the Schatten 1-norm, also known as the nuclear or trace norm, is required in a wide variety of applications. It is often used in place of the matrix rank in matrix completion algorithms and other convex relaxations of rank-constrained optimization problems [CR12, DTV11, JNS13, NNS+14]. It appears as the 'graph energy' in theoretical chemistry [Gut92, Gut01], the 'singular value bound' in differential privacy [HLM12, LM12], and in rank aggregation and collaborative ranking [LN15]. Similar to the nuclear norm, general Schatten p-norms are used in convex relaxations for rank-constrained optimization [NHD12, NWC+12]. They also appear in image processing appli- cations such as denoising and background subtraction [XGL+16], classification [LYCG14], restora- tion [XQT+16], and feature extraction [DHJZ15]. When f (x) = −x log x (after A is normalized by kAk1), Sf (A) is the SVD entropy [ABB00], which is used in feature selection [VGLH06, BP14], financial data analysis [Car14, GXL15], and genomic data [ABB00] applications. Despite their importance, prior to our work, few algorithms for fast computation of spectral sums existed. Only a few special cases of the Schatten p-norms were known to be computable efficiently in o(nω) time. These include the Frobenius norm (p = 2) which is trivially computed in O(nnz(A)) time, the spectral norm (p = ∞) which can be estimated via the Lanczos method in O(nnz(A)ǫ− 1 2 ) time [KW92], and the Schatten-p norms for even integers p > 2, or general integers with PSD A. These norms can be approximated in O(nnz(A)ǫ−2) time via trace estimation [Woo14, BCKY16], since when p is even or A is PSD, Ap is PSD and so its trace equals kAkp p. There are a number of works which consider estimating matrix norms in sublinear space and with a small number of passes over A [LNW14, AKR15, LW16a, LW16b, BCKY16, LW17]. However, in these works, the main focus is on space complexity, and no non-trivial runtime bounds are given. We seem to be the first to tackle the arguably more fundamental problem of obtaining the best time complexity for simple norms like the Schatten-p norms, irrespective of space and pass complexity. Another interesting line of works tries to estimate the Schatten-p norms of an underlying co- variance matrix from a small number of samples from the distribution [KV16], or from entrywise sampling under various incoherence assumptions [KO17]. This model is different from ours, as we do not assume an underlying distribution or any incoherence properties. Moreover, even with such 3 assumptions, these algorithms also only give non-trivial sample complexity when either A is PSD and p is an integer, or A is a general matrix but p is an even integer, which as mentioned above are easy to handle from the perspective of time complexity alone. A number of works have focused on computing spectral sums when A has bounded condition number, and relative error results exist for example for the log-determinant, tr(exp(A)), tr(A−1), and the Schatten p-norms [BDKZ15, HMAS17, UCS17]. We are the first to give relative error re- sults in o(ω) time for general matrices, without the condition number dependency. Our histogram approach resembles spectral filtering and spectral density estimation techniques that have been con- sidered in the numerical computation literature [ZWJ15, DNPS16, LSY16, US16, UCS17, USS17]. However, this literature typically requires assuming gaps between the singular values and existing work is not enough to give relative error spectral sum approximation for general matrices 1.3 Algorithmic Approach def Spectral Sums via Trace Estimation: A common approach to spectral sum approximation is to reduce to a trace estimation problem involving the PSD matrix AT A, using the fact that the trace of this matrix equals the sum of its singular values. In fact, this has largely been the only known technique, other than the full SVD, for obtaining aggregate information about A's singular values [Hut90, SLO13, WLK+16, WWZ14, RKA15, FORF16, BDKZ15, HMAS17]. The idea is, letting g(x) = f (x1/2), we have Sf (A) = Sg(AT A). Writing the SVD AT A = UΛUT , and defining the matrix function g(AT A) = Ug(Λ)UT where [g(Λ)]i,i = g([Λ]i,i), we have Sg(AT A) = tr(g(AT A)) since, if g(·) is nonnegative, g(AT A) is PSD and its trace equals the sum of its singular values. It is well known that this trace can be approximated up to (1± ǫ) accuracy by averaging O(ǫ−2) samples of the form xT g(AT A)x where x is a random Gaussian or sign vector [Hut90, AT11]. While g(AT A) cannot be explicitly computed without a full SVD, a common approach is to approximate g with a low-degree polynomial φ [BDKZ15, HMAS17]. If φ has degree q, one can apply φ(AT A) to any vector x in O(nnz(A) · q) time, and so estimate its trace in just O(nnz(A) · q ǫ2 ) time. Unfortunately, for many of the functions most important in applications, e.g., f (x) = xp for odd p, f (x) = x log x, f (x) = x−1, g(x) has a discontinuity at x = 0 and cannot be approximated well by a low-degree polynomial near zero. While the approximation only needs to be good on the 1(A) range [σ2 n(A) is σ2 the condition number, which can be unbounded for general matrices. 1(A)], the required degree q will still typically depend on √κ where κ def= σ2 n(A), σ2 Singular Value Deflation for Improved Conditioning: Our first observation is that, for many functions, it is not necessary to approximate g(x) on the full spectral range. For example, for g(x) = xp/2 (i.e., when Sg(AT A) = kAkp p), setting λ = ( ǫ p)1/p, we have: X{iσi(A)≤λ} n kAkp p ≤ ǫkAkp p . σi(A)p ≤ n · ǫ n kAkp Hence we can safely 'ignore' any σi(A) ≤ λ and still obtain a relative error approximation to Sg(AT A) = kAkp p. The larger p is, the larger we can set λ (corresponding to (1−α)T in Theorem 1) to be, since, after powering, the singular values below this threshold do not contribute significantly p, our 'effective condition number' for approximating g(x) becomes κ = σ2 1 (A) to kAkp p. For kAkp λ2 = . Unfortunately, in the worst case, we may have σ1(A) ≈ kAkp and hence √κ = ( n ǫ )2/p· σ2 1(A) ( n ǫ )1/p. kAk2 Hiding ǫ dependences, this gives runtime O(nnz(A) · n) when p = 1. p 4 To improve the effective condition number, we can apply singular vector deflation. Our above bound on κ is only tight when the first singular value is very large and so dominates kAkp. We can remedy this by flattening A's spectrum by deflating off the top k singular vectors (corresponding to k in Theorem 1), and including their singular values in the spectral sum directly. Specifically, letting Pk be the projection onto the top k singular vectors of A, we consider the k kAkp deflated matrix ¯A p, and thus this singular value cannot dominate the p-norm. As an example, considering p = 1 and ignoring ǫ dependencies, our effective condition number after deflation is = A(I − Pk), which has σ1( ¯A) = σk+1(A). Importantly, σp k+1(A) ≤ 1 def κ = n2 · σ2 k+1(A) kAk2 1 n2 k2 ≤ (1) The runtime required to approximate Pk via an iterative method (ignoring possible gains from fast matrix multiplication) is roughly O(nnz(A)k + nk2). We then require O(nnz(A)√κ + nk√κ) time to approximate the polynomial trace of ¯AT ¯A. The nk√κ term comes from projecting off the top singular directions with each application of ¯AT ¯A. Setting k = √n to balance the costs, we obtain runtime O(nnz(A)√n + n2). 1 p+1 + n2+ 1 For p 6= 1 a similar argument gives runtime O(nnz(A)n p+1 ). This is already a significant improvement over a full SVD. As p grows larger, the runtime approaches O(nnz(A)) reflecting the fact that for larger p we can ignore a larger and larger portion of the small singular values in A and correspondingly deflate off fewer and fewer top values. Unfortunately, we get stuck here. Considering the important Schatten-1 norm, for a matrix with √n singular values each equal to √n and Θ(n) singular values each equal to 1, the tail of small singular values contributes a constant fraction of kAk1 = Θ(n). However, there is no good polynomial approximation to g(x) = x1/2 on the range [1, n] with degree o(√n) (recall that we pick this function since Sg(AT A) = kAk1). So to accurately approximate g(AT A), we either must deflate off all √n top singular values, requiring Θ(nnz(A)√n) time, or apply a Θ(√n) degree polynomial approximation, requiring the same amount of time. Further Improvements with Stochastic Gradient Descent: To push beyond this barrier, we look to stochastic gradient methods for linear systems. When using polynomial approximation, our bounds depend on the condition number of the interval over which we must approximate g(AT A), after ignoring the smallest singular values and deflating off the largest. This is analogous to the condition number dependence of iterative linear system solvers like conjugate gradient or accelerated gradient descent, which approximate f (AT A) for f = 1/x using a polynomial of AT A. However, recent advances in convex optimization offer an alternative. Stochastic gradient meth- ods [JZ13, SSZ14] sample one row, ai, of A at a time, updating the current iterate by adding a multiple of ai. They trade a larger number of iterations for updates that take O(nnz(ai)) time, rather than O(nnz(A)) time to multiply A by a vector. At the same time, these methods give much finer dependencies on the singular value spectrum. Specifically, it is possible to approximately apply (AT A)−1 to a vector with the number of iterations dependent on the average condition number: ¯κ = 1 nPn i=1 σ2 σ2 n(A) i (A) . ¯κ is always at most the standard condition number, κ = σ2 1(A) n(A) . It can be significantly smaller when σ2 A has a quickly decaying spectrum, and hence 1 i=1 σ2 i (A) ≪ σ2 1(A). Further, the case of a quickly decaying spectrum with a few large and many small singular values is exactly the hard case nPn 5 for our earlier approach. If we can understand how to translate improvements on linear system solvers to spectral sum approximation, we can handle this hard case. From Linear System Solvers to Histogram Approximation: The key idea to translating the improved average condition number bounds for linear systems to our problem of approximating Sf (A) is to note that linear system solvers can be used to apply threshold functions to AT A. Specifically, given any vector y, we can first compute AT Ay. We can then apply a fast system solver to approximate (AT A + λI)−1AT Ay. The matrix function rλ(AT A) def= (AT A + λI)−1AT A has a number of important properties. All its singular values are between 0 and 1. Further, any singular value in AT A with value ≥ λ is mapped to a singular value in rλ(AT A) which is ≥ 1/2. Correspondingly, any singular value < λ is mapped to < 1/2. Thus, we can apply a low degree polynomial approximation to a step function at 1/2 to rλ(AT A) to obtain sλ(AT A), which approximates a step function at λ [FMMS16]. For some steepness parameter γ which affects the degree of the polynomial approximation, for x ≥ (1 + γ)λ we have sλ(x) ≈ 1 and for x < (1 − γ)λ, sλ(x) ≈ 0. On the intermediate range x ∈ [(1 − γ)λ, (1 + γ)λ], sλ(x) falls somewhere between 0 and 1. By composing these approximate threshold functions at different values of λ, it is possible to 'split' our spectrum into a number of small spectral windows. For example, sa(AT A)·(I−sb(AT A)) is ≈ 1 on the range [a, b] and ≈ 0 outside this range, with some ambiguity near a and b. Splitting our spectrum into windows of the form [(1 − α)t−1, (1 − α)t] for a width parameter α, and applying trace estimation on each window lets us produce an approximate spectral histogram. Of course, this histogram is not exact and in particular, the 'blurring' of our windows at their boundaries can introduce significant error. However, by applying a random shifting technique and setting the steepness parameter γ small enough (i.e., 1/ poly(α, ǫ)), we can ensure that most of the spectral weight falls outside these boundary regions with good probability, giving Theorem 1. From Histogram Approximation to Spectral Sums: If α is small enough, and f (·) (the function in the spectral sum) and correspondingly g(·) (where g(x) = f (x1/2)) are smooth enough, we can approximate Sf (A) = Sg(AT A) by simply summing over each bucket in the histogram, approximating g(x) by its value at one end of the bucket. This technique can be applied for any spectral sum. The number of windows required (controlled by α) and the histogram accuracy ǫ scale with the smoothness of f (·) and the desired accuracy in computing the sum, introducing polynomial runtime dependencies on these parameters. However, the most important factor determining the final runtime is the smallest value λ (corre- sponding to (1−α)T in Theorem 1) which we must include in our histogram in order to approximate Sf (A). The cost of computing the last bucket of the histogram is proportional to the cost of ap- plying sλ(AT A), and hence of approximately computing (AT A + λI)−1AT Ay. Using stochastic gradient descent this depends on the average condition number of (AT A + λI). Again considering the Schatten 1-norm for illustration, we can ignore any singular values with n kAk1. Hiding ǫ dependence, this means that in our histogram, we must include any 1. This gives us effective average σi(A) ≤ ǫ singular values of AT A with value σi(AT A) = σ2 condition number after deflating off the top k singular values: ¯κ = n2Pn i=k+1 σ2 nkAk2 1 i (A) ≤ n2 kAk2 i (A) ≥ 1 n2σk+1(A) ·Pn nkAk2 1 where the last inequality follows from the observation that σk+1(A) ≤ 1 kAk1. Comparing to (1), this bound is better by an n/k factor. k kAk1 andPn i=k+1 σi(A) ≤ i=k+1 σi(A) n k ≤ (2) 6 Ignoring details and using a simplification of the runtimes in Theorem 1, we obtain an algorithm time to approximate the spectral sum over the deflated matrix. Choosing k to balance these costs, gives our final runtimes. For the nuclear norm, using the bound on ¯κ from (2), we set k = n1/3 which running in O(nnz(A)k+nk2) time to deflate k singular vectors, plus O(cid:16)nnz(A)√¯κ +pnnz(A)nk¯κ(cid:17) gives ¯κ = n2/3 and runtime O(nnz(A)n1/3 + n3/2√ds) where ds ≤ n is the maximum row sparsity. For dense A this is O(n2.33), which is faster than state of the art matrix multiplication time. It can be further accelerated using fast matrix multiplication methods. See details in Section 7. Returning to our original hard example for intuition, we have A with √n singular values at √n and Θ(n) singular values at 1. Even without deflation, we have (again ignoring ǫ dependencies) 1 = Θ(n2), this gives ¯κ = Θ(√n). Thus, ¯κ = Pn we can actually approximate kAk1 in just O(nnz(A)n1/4) time for this matrix. With average condition number dependence, our performance is limited by a new hard case. Consider A with n1/3 singular values at n2/3 and Θ(n) at 1. The average condition number without deflation is nkAk2 kAk2 deflate off nearly all n1/3 top singular vectors, we do not improve this bound significantly. n (cid:17) = Θ(n2/3) giving √¯κ = Θ(n1/3). Further, we can see that unless we . Since kAk2 F = Θ(n3/2) and kAk2 = Θ(cid:16) n5/3 = nkAk2 kAk2 1 F i (A) i=1 σ2 nλ F 1 1.4 Lower Bound Approach We now shift focus to our lower bounds, which explore the fundamental limits of spectrum approx- imation using fine-grained complexity approaches. Fine-grained complexity has had much success for graph problems, string problems, and problems in other areas (see, e.g., [Wil15] for a survey), and is closely tied to understanding the complexity of matrix multiplication. However, to the best of our knowledge it has not been applied broadly to problems in linear algebra. Existing hardness results for linear algebraic problems tend to apply to restricted computational models such as arithmetic circuits [BS83], bilinear circuits or circuits with bounded coefficients and number of divisions [Mor73, Raz03, Shp03, RS03], algorithms for dense linear systems that can only add multiples of rows to each other [KKS65, KS70], and algorithms with restrictions on the dimension of certain manifolds defined in terms of the input [Win70, Win87, Dem13]. In contrast, we obtain conditional lower bounds for arbitrary polynomial time algorithms by showing that faster algorithms for them imply faster algorithms for canonical hard problems in fine-grained complexity. From Schatten 3-norm to Triangle Detection: We start with the fact that the number of triangles in any unweighted graph G is equal to tr(A3)/6, where A is the adjacency matrix. Any algorithm for approximating tr(A3) to high enough accuracy therefore gives an algorithm for detecting if a graph has at least one triangle. A is not PSD, so tr(A3) is actually not a function of A's singular values -- it depends on the signs of A's eigenvalues. However, the graph Laplacian given by L = D−A where D is the diagonal degree matrix, is PSD and we have: kLk3 3 = tr(L3) = tr(D3) − 3 tr(D2A) + 3 tr(DA2) − tr(A3). tr(D2A) = 0 since A has an all 0 diagonal. Further, it is not hard to see that tr(DA2) = tr(D2). So this term and tr(D3) are easy to compute exactly. Thus, if we approximate kLk3 3 up to additive error 6, we can determine if tr(A3) = 0 or tr(A3) ≥ 6 and so detect if G contains a triangle. kLk3 3 ≤ 8n4 for any unweighted graph on n nodes, and hence computing this norm up to (1 ± ǫ) relative error for ǫ = 3/(6n4) suffices to detect a triangle. If we have an O(nγǫ−c) time (1 ± ǫ) approximation algorithm for the Schatten 3-norm, we can thus perform triangle detection in O(nγ+4c) time. 7 Our strongest algorithmic result for the Schatten 3-norm requires just O(n2/ǫ3) time for dense Improving the ǫ dependence to o(1/ǫ(ω−2)/4) = O(1/ǫ.09) for the current value of ω, matrices. would yield an algorithm for triangle detection running in o(nω) time for general graphs, breaking a longstanding runtime barrier for this problem. Even a 1/ǫ1/3 dependence would give a sub- cubic time triangle detection algorithm, and hence could be used to give a subcubic time matrix multiplication algorithm via the reduction of [WW10]. Generalizing to Other Spectral Sums We can generalize the above approach to the Schatten 4-norm by adding λ self-loops to each node of G, which corresponds to replacing A with λI+A. We then consider tr((λI + A)4) = kλI + Ak4 4. This is the sum over all vertices of the number of paths that start at vi and return to vi in four steps. All of these paths are either (1) legitimate four cycles, (2) triangles combined with self loops, or (3) combinations of self-loops and two-step paths from a vertex vi to one of its neighbors and back. The number of type (3) paths is exactly computable using the node degrees and number of self loops. Additionally, if the number of self loops λ is large enough, the number of type (2) paths will dominate the number of type (1) paths, even if there is just a single triangle in the graph. Hence, an accurate approximation to kλI + Ak4 4 will give us the number of type (2) paths, from which we can easily compute the number of triangles. This argument extends to a very broad class of spectral sums by considering a power series expansion of f (x) and showing that for large enough λ, tr (f (λI + A)) is dominated by tr(A3) along with some exactly computable terms. Thus, an accurate approximation to this spectral sum allows us to determine the number of triangles in G. This approach works for any f (x) that can be represented as a power series, with reasonably well-behaved coefficients on some interval of R+, giving bounds for all kAkp with p 6= 2, the SVD entropy, log det(A), tr(A−1), and tr(exp(A)). We further show that approximating tr(A−1) for the A used in our lower bound can be reduced to computing all effective resistances of a certain graph Laplacian up to (1± ǫ) error. Thus, we rule out highly accurate (with 1/ǫc dependence for small c) approximation algorithms for all effective resistances, despite the existence of linear time system solvers (with log(1/ǫ) error dependence) for Laplacians [ST04]. Effective resistances and leverage scores are quantities that have recently been crucial to achieving algorithmic improvements to fundamental problems like graph sparsification [SS08] and regression [LMP13, CLM+15]. While crude multiplicative approximations to the quan- tities suffice for these problems, more recently computing these quantities has been used to achieve breakthroughs in solving maximum flow and linear programming [LS14], cutting plane methods [LSW15], and sampling random spanning trees [KM09, MST15]. In each of these settings having more accurate estimates would be a natural route to either simplify or possibly improve existing results; we show that this is unlikely to be successful if the precision requirements are two high. 1.5 Paper Outline Section 2: Preliminaries. We review notations that will be used throughout. Section 3: Spectral Window Approximation. We show how to approximately restrict the spectrum of a matrix to a small window, which will be our main primitive for accessing the spectrum. Section 4: Spectral Histogram Approximation. We show how our spectral window algorithms can be used to compute an approximate spectral histogram. We give applications to approximating general spectral sums, including the Schatten p-norms, Orlicz norms, and Ky Fan norms. Section 5: Lower Bounds. We prove lower bounds showing that highly accurate spectral sum algorithms can be used to give algorithms for triangle detection and matrix multiplication. 8 Section 6: Improved Algorithms via Polynomial Approximation. We demonstrate how to tighten ǫ dependencies in our runtimes using a more general polynomial approximation approach. Section 7: Optimized Runtime Bounds. We instantiate the techniques of Section 6 give our best runtimes for the Schatten p-norms and SVD entropy. 2 Preliminaries Here we outline notation and conventions used throughout the paper. Matrix Properties: For A ∈ Rn×d we assume without loss of generality that d ≤ n. We let σ1(A) ≥ . . . ≥ σd(A) ≥ 0 denote the matrix's singular values, nnz(A) denote the number of non- zero entries, and ds(A) denote the maximum number of non-zero entries in any row. Note that ds(A) ∈ [nnz(A)/n, d]. Fast Matrix Multiplication: Let ω ≈ 2.3729 denote the current best exponent of fast ma- trix multiplication [Wil12, GU17]. Additionally, let ω(γ) denote the exponent such that it takes O(cid:0)dω(γ)(cid:1) time to multiply a d × d matrix by a d × dγ matrix for any γ ≤ 1. ω(γ) = 2 for γ < α where α > 0.31389 and ω(γ) = 2 + (ω − 2) γ−α Asymptotic Notation: We use O(·) notation to hide poly-logarithmic factors in the input pa- rameters, including dimension, failure probability, and error ǫ. We use 'with high probability' or 'w.h.p.' to refer to events happening with probability at least 1 − 1/dc for some constant c, where d is our smaller input dimension. 1−α for γ ≥ α [LG12, GU17]. For γ = 1, ω(γ) = ω. Other: We denote [d] def= {0, . . . , d}. For any y ∈ Rd and PSD N ∈ Rd×d, we denote kykN pyT Ny. def= 3 Approximate Spectral Windows via Ridge Regression In this section, we give state-of-the-art results for approximating spectral windows over A. As discussed, our algorithms will split A's spectrum into small slices using these window functions, performing trace estimation to estimate the number of singular values on each window and pro- ducing an approximate spectral histogram. In Section 3.1 we show how to efficiently apply smooth approximations to threshold functions of the spectrum provided we have access to an algorithm for solving regularized regression problems with the matrix. In Section 3.2 we then provide the fastest known algorithms for the regression problems in the given parameter regimes using both stochastic gradient methods and traditional solvers. Departing from our high level description in Section 1.3, we actually incorporate singular vector deflation directly into our system solvers to reduce condition number. This simplifies our final algorithms but has the same effect as the deflation techniques discussed in Section 1.3. Finally, in Section 3.3 we provide algorithms and runtime analysis for applying smooth approximations to window functions of the spectrum, which is the main export of this section. 3.1 Step Function Approximation To compute a window over A's spectrum, we will combine two threshold functions at the boundaries of the window. We begin by discussing how to compute these threshold functions. Let sλ : [0, 1] → [0, 1] be the threshold function at λ. sλ(x) = 1 for x ∈ [λ, 1] and 0 for x ∈ [0, λ). For some gap γ we define a soft step function by: 9 Definition 2 (Soft Step Function). sγ λ : [0, 1] → [0, 1] is a γ-soft step at λ > 0 if: sγ λ(x) =(0 for x ∈ [0, (1 − γ)λ] 1 for x ∈ [λ, 1] and sγ λ(x) ∈ [0, 1] for x ∈ [(1 − γ)λ, λ]. (3) We use the strategy from [FMMS16], which, for A with kAk2 ≤ 1 shows how to efficiently multiply a γ-soft step sγ λ(AT A) by any y ∈ Rd using ridge regression. The trick is to first ap- proximately compute AT A(AT A + λI)−1y = rλ(AT A)y where rλ(x) x+λ . Then, note that s1/2(rλ(x)) = sλ(x). Additionally, the symmetric step function s1/2 can be well approximated with a low degree polynomial. Specifically, there exists a polynomial of degree O(γ−1 log(1/(γǫ))) that is within additive ǫ of a true γ-soft step at 1/2 and can be applied stably such that any error in computing rλ(AT A) remains bounded. The upshot, following from Theorem 7.4 of [AZL16] is: Lemma 3 (Step Function via Ridge Regression). Let A(A, y, λ, ǫ) be an algorithm that on input probability. Then there is an algorithm B(A, y, λ, γ, ǫ) which on input A ∈ Rn×d with kAk2 ≤ 1, y ∈ Rd, λ ∈ (0, 1), and γ, ǫ > 0, returns x ∈ Rd with A ∈ Rn×d, y ∈ Rd, λ, ǫ > 0 returns x ∈ Rd such that (cid:13)(cid:13)x − (AT A + λI)−1y(cid:13)(cid:13)2 ≤ ǫkyk2 with high def = x (cid:13)(cid:13)x − sγ λ(AT A)y(cid:13)(cid:13)2 ≤ ǫkyk2 λ(AT A)y for sγ λ is a γ-soft step at λ (i.e. satisfies Definition 2). B(A, y, λ, γ, ǫ) requires O(γ−1 log(1/ǫγ)) where sγ calls to A(A, y, λ, ǫ′) along with O(nnz(A)) additional runtime, where ǫ′ = poly(1/(γǫ)). 3.2 Ridge Regression Given Lemma 3, to efficiently compute sγ λ(·) satisfying Definition 2, it suffices to quickly approximate (AT A+λI)−1y (i.e. to provide the algorithm A(A, y, λ, ǫ) used in the lemma). In this section we provide two theorems which give the state-of-the-art ridge regression running times achievable in our parameter regime, using sampling, acceleration, and singular value deflation. Naively, computing (AT A + λI)−1y using an iterative system solver involves a dependence on the condition number σ2 1(A)/λ. In our theorems, this condition number is replaced by a deflated condition number depending on σ2 k(A) for some input parameter k ∈ [d]. We achieve this improved dependence following the techniques presented in [GOSS16]. We first approximate the top k singular vectors of A and then construct a preconditioner based on this approximation, which significantly flattens the spectrum of the matrix. By using this preconditioner in conjunction with a stochastic gradient based linear system solver, we further enjoy an average condition number dependence. The following theorem summarizes the results. Theorem 4 (Ridge Regression -- Accelerated Preconditioned SVRG). For any A ∈ Rn×d and where k ∈ [d] is an input parameter. There λ > 0, let Mλ is an algorithm that builds a preconditioner for Mλ using precomputation time O(nnz(A)k +dkω−1) for sparse A or O(ndω(logd k)−1) time for dense A, and for any input y ∈ Rd, returns x such that λ y(cid:13)(cid:13)Mλ ≤ ǫkykM−1 O(cid:16)nnz(A) +pnnz(A)[d · ds(A) + dk]¯κ(cid:17) with high probability (cid:13)(cid:13)x − M−1 time for sparse A or O(cid:0)nd + n1/2d3/2√¯κ)(cid:1) time for dense A. Proof. We give a proof in Appendix A. Note that the ǫ dependence in the runtime is log(1/ǫ) and so is hidden by the O(·) notation. def= AT A+λI. Let ¯κ def= i=k+1 σ2 dλ kσ2 k(A)+Pd i (A) in λ 10 When A is dense, the runtime of Theorem 4 is essentially the best known. Due to its average condition number dependence, the method always outperforms traditional iterative methods, like conjugate gradient, up to log factors. However, in the sparse case, traditional approaches can give faster runtimes if the rows of A are not uniformly sparse and ds(A) is large. We have the following, also proved in Appendix A using the same deflation-based preconditioner as in Theorem 4: Theorem 5 (Ridge Regression -- Preconditioned Iterative Method). For any A ∈ Rn×d and λ > 0, let Mλ where k ∈ [d] is an input parameter. There is an algorithm that builds a preconditioner for Mλ using precomputation time O(nnz(A)k + dkω−1), and in for any input y ∈ Rd, returns x such that with high probability (cid:13)(cid:13)x − M−1 O(cid:16)(nnz(A) + dk)⌈√κ⌉(cid:17) time. λ y(cid:13)(cid:13)Mλ ≤ ǫkykM−1 def = AT A + λI and κ σ2 k+1(A) def = λ λ 3.3 Overall Runtimes For Spectral Windows Combined with Lemma 3, the ridge regression routines above let us efficiently compute soft step functions of A's spectrum. Composing step functions then gives our key computational primitive: the ability to approximate soft window functions that restrict A's spectrum to a specified range. We first define our notion of soft window functions and then discuss runtimes. The corresponding Theorem 7 is our main tool for spectrum approximation in the remainder of the paper. Definition 6 (Soft Window Function). Given a, b > 0 with a < b, and γ ∈ [0, 1], hγ [0, 1] is a γ-soft window for the range [a, b] if: [a,b] : [0, 1] → [a,b](x) =(1 for x ∈ [a, b] hγ 0 for x ∈ [0, (1 − γ)a] ∪ [(1 + γ)b, 1] and hγ [a,b](x) ∈ [0, 1] for x ∈ [(1 − γ)a, a] ∪ [b, (1 + γ)b]. Theorem 7 (Spectral Windowing). For any A ∈ Rn×d with kAk2 ≤ 1, y ∈ Rd, and a, b, γ, ǫ ∈ (0, 1], with a < b, there is an algorithm W(A, y, a, b, γ, ǫ) that returns x satisfying w.h.p.: (cid:13)(cid:13)(cid:13)x − hγ [a,b](AT A)y(cid:13)(cid:13)(cid:13)2 ≤ ǫkyk2 [a,b] is a soft window function satisfying Def. 6. Let ¯κ where hγ where k ∈ [d] is an input parameter. The algorithm uses precomputation time O(nnz(A)k + dkω−1) for sparse A or O(ndω(logd k)−1) for dense A after which given any y it returns x in time: and κ k(A)+Pd i=k+1 σ2 d·a σ2 k+1(A) i (A) def = def = kσ2 a O (nnz(A) + dk)⌈ γ √κ⌉ ! γ ! or O nnz(A) +pnnz(A)[d · ds(A) + dk]¯κ (cid:17) for dense A. for sparse A or O(cid:16) nd+n1/2d3/2√¯κ) Proof. If b ≥ 1/(1 + γ) then we can simply define hγ 2. Otherwise, given soft steps sγ a(x) · (1 − sγ/2 sγ for [a, b] (i.e. satisfy Definition 6). Further, we have for any y ∈ Rd: (1+γ)b(x)). Since γ [a,b](x) = sγ 2 ≤ γ γ a(x) for any sγ a satisfying Definition (1+γ)b satisfying Definition 2, we can define hγ a and sγ/2 [a,b](x) = 1+γ we can verify that this will be a valid soft window function hγ [a,b](AT A)y = sγ a(AT A)(I − sγ/2 (1+γ)b(AT A))y. (4) 11 We can compute sγ a(AT A)y and sγ/2 (1+γ)b(AT A)y each up to error ǫkyk2 via Lemma 3. This gives a(AT A)(cid:13)(cid:13)2 ≤ 1 and(cid:13)(cid:13)(cid:13)I − sγ/2 (1+γ)b(AT A)(cid:13)(cid:13)(cid:13)2 ≤ 1 the error bound in the theorem, since we have both(cid:13)(cid:13)sγ so the computation in (4) does not amplify error. Our runtime follows from combining Theorems 4 and 5 with λ = a, b with Lemma 3. The errors in these theorems are measured with respect . To obtain the error in k·k2 as used by Lemma 3, we simply apply the theorems with to k·kMλ ǫ′ = ǫκ(Mλ) which incurs an additional log(κ(Mλ)) cost. Since a < b the runtime is dominated by i (A) the computation of sγ a(AT A)y, which depends on the condition number ¯κ def= kσ2 k(A)+Pd i=k+1 σ2 d·a when using SVRG (Theorem 4) or κ def = σ2 k+1(A) a for a traditional iterative solver (Theorem 5). 4 Approximating Spectral Sums via Spectral Windows We now use the window functions discussed in Section 3 to compute an approximate spectral histogram of A. We give our main histogram algorithm and approximation guarantee in Section 4.1. In Section 4.2 we show how this guarantee translates to accurate spectral sum approximation for any smooth and sufficiently quickly growing function f (x). In Section 4.3 we apply this general result to approximating the Schatten p-norms for all real p > 0, bounded Orlicz norms, and the Ky Fan norms. 4.1 Approximate Spectral Histogram Our main histogram approximation method is given as Algorithm 1. The algorithm is reasonably simple. Assuming kAk2 ≤ 1 (this is w.l.o.g. as we can just scale the matrix), and given cutoff λ, below which we will not evaluate A′s spectrum, we split the range [λ, 1] into successive windows R0, ..., RT where Rt = [a1(1 − α)t, a1(1 − α)t−1]. Here α determines the width of our windows. In our final spectral approximation algorithms, we will set α = Θ(ǫ). a1 is a random shift, which insures that, in expectation, the boundaries of our soft windows do not overlap too many singular values. This argument requires that most of the range [λ, 1] is not covered by boundary regions. Thus, we set the steepness parameter γ = Θ(ǫ2α) where ǫ2 will control the error introduced by the boundaries. Finally, we iterate over each window, applying trace estimation to approximate the singular value count in each window. In our final algorithms, the number of windows and samples required for trace estimation will be O(poly(1/ǫ)). The dominant runtime cost will come from computing the window for the lowest range RT , which will incur a dependence on the condition number of AT A + aT I with aT = Θ(λ). Theorem 8 (Histogram Approximation). Let a1, b0, ..., bT be output by Algorithm 1. Let R0 = [a1, 1], Rt = [a1(1 − α)t, a1(1 − α)t−1] for t ≥ 1, and bt = (cid:12)(cid:12){i : σ2 squared singular values of A on the range Rt. Then, for sufficiently small constants c1, c2, c3, with probability 99/100, for all t ∈ {0, ...,⌈log(1−α) λ⌉}, bt output by Algorithm 1 satisfies: i (A) ∈ Rt}(cid:12)(cid:12) be the number of (1 − ǫ1)bt ≤ bt ≤ (1 + ǫ1)bt + ⌈log(1−α) λ⌉ · ǫ2(bt−1 + bt + bt+1). That is, bt approximates the number of singular values of the range Rt up to multiplicative (1±ǫ1) error and additive error ⌈log(1−α) λ⌉·ǫ2(bt−1+bt+bt+1). Note that by setting ǫ2 ≤ , ⌈log(1−α) λ⌉ the error on each bucket is just multiplicative on its size plus the size of the two adjacent buckets, which contain singular values in nearby ranges. For simplicity we assume A passed to the algorithm has kAk2 ≤ 1. This is without loss of generality: we can estimate kAk2 in O(nnz(A)) time via the power or Lanczos methods [KW92, MM15], and scale down the matrix appropriately. ǫ1 12 Algorithm 1 Approximate Spectral Histogram Input: A ∈ Rn×d with kAk2 ≤ 1, accuracy parameters ǫ1, ǫ2 ∈ (0, 1), width parameter α ∈ (0, 1), and minimum singular value parameter λ ∈ (0, 1). Output: Set of range boundaries aT +1 < aT < ... < a1 < a0 and counts {b0, ..., bT } where bt approximates the number of squared singular values of A on [at+1, at]. Set γ = c1ǫ2α, T = ⌈log(1−α) λ⌉, and S = log n Set a0 = 1 and choose a1 uniformly at random in [1 − α/4, 1]. Set at = a1(1 − α)t−1 for 2 ≤ t ≤ T + 1. for t = 0 : T do c2ǫ2 1 . Set bt = 0. for s = 1 : S do ⊲ Iterate over histogram buckets. ⊲ Initialize bucket size estimate. ⊲ Estimate bucket size via trace estimation. Choose y ∈ {−1, 1}d uniformly at random. Set bt = bt + 1 If bt ≤ 1/2 set bt = 0. S · yTW(AT A, y, at+1, at, γ, c3ǫ2 end for 1/n). ⊲ Apply soft window via Thm 7. ⊲ Round small estimates to ensure relative error. end for return a1 and bt for t = 0 : T . ⊲ Output histogram representation. Ignoring logarithmic and ǫ dependencies, the runtime of Algorithm 1 is dominated by the calls to W for the bucket corresponding to the smallest singular values, with aT = Θ(λ). This runtime is given by Theorem 7. Since balancing the deflation parameter k in that theorem with the minimum squared singular value λ considered can be complex, we wait to instantiate full runtimes until employing Algorithm 1 for specific spectral sum computations. Proof. We use the notation of Algorithm 1, where a0 = 1, a1 is chosen uniformly in [1− α/4, 1] and at = a1(1 − α)t−1. With this notation, we have Rt = [at+1, at]. Let hγ be a γ-soft window for Rt (Definition 6) and let ¯Rt = [(1 − γ)at+1, (1 + γ)at] be the interval on which hγ is nonzero. bt is an estimation of the trace of such a window applied to AT A. We first show that, if these traces are computed exactly, they accurately estimate the singular value counts in each range Rt. We have: Rt Rt tr(hγ Rt (AT A)) = Xσ2 i (A)∈Rt hγ Rt (σ2 i (A)) + Xσ2 i (A)∈ ¯Rt\Rt hγ Rt (σ2 i (A)) = bt + Xσ2 i (A)∈ ¯Rt\Rt hγ Rt (σ2 i (A)). (5) We can bound the second term using the random shift a1. Since γ = c1ǫ2α < α, each singular value falls within at most two extended ranges: ¯Rt and ¯Rt±1 for some t. Let I be the set of indices whose singular values fall within two ranges. We have i ∈ I only if a1(1 − α)t ∈ (1 ± γ)σ2 i (A) for (1−α)d(cid:17), which occurs with some t. Letting d = ⌈logσ2 probability at most 8γ α since a1 is chosen uniformly in the range [1−α/4, 1]. Thus we have P[i ∈ I] ≤ def= a1(1− α)t−1 is distributed uniformly in the range [(1− α/4)(1− α)t−1 , (1− α)t−1], 8γ α . Further, at so we know for certain that if the constant c1 on γ is set small enough: i (A)(1 − α)⌉, this holds only if a1 ∈ (1 ± γ)(cid:16) σ2 i (A) ¯Rt ⊂ [(1 − γ)(1 − α/4)(1 − α)t, (1 + γ)(1 − α)t−1] ⊂ [(1 − α/3)(1 − α)t, (1 + α/3)(1 − α)t−1] ⊂ [(1 − α)t+1, (1 − α/4)(1 − α)t−2]. 13 (6) def = [(1 − α)t+1, (1 − α/4)(1 − α)t−2]. Note that Mt is fixed (i.e. not a random variable). Let Mt Regardless of the random shift a1, by (6), we always have ¯Rt ⊂ Mt. We also have Mt ⊂ Rt−1 ∪ Rt ∪ Rt+1. Let I[i ∈ I] be 1 if i ∈ I and 0 otherwise. We can upper bound the second term of (5) by: Xσ2 i (A)∈ ¯Rt\Rt hγ Rt (σ2 I[i ∈ I] I[i ∈ I] i (A)∈ ¯Rt\Rt i (A)) ≤ Xσ2 ≤ Xσ2 ≤ Xσ2 i (A)∈Mt i (A)∈Mt\Rt I[i ∈ I]. (7) The first bound follows from the fact that for σi(A)2 ∈ ¯Rt \ Rt, we have σi(A)2 ∈ I and that hγ i (A)) ≤ 1. The second bound follows from (6), which shows that ¯Rt ⊂ Mt. Let mt = {i : (σ2 Rt σ2 i (A) ∈ Mt} be the number of squared singular values falling in Mt. Note that like Mt, mt is fixed (i.e., not a random variable.) Thus, by linearity of expectation, we have: Letting T = ⌈log(1−α) λ⌉ as in Algorithm 1, by a Markov bound, with probability 1 − 1 200(T +1) : i (A)∈Mt E Xσ2 Xσ2 i (A)∈Mt I[i ∈ I] = Xσ2 i (A)∈Mt P[i ∈ I] = 8γ α · mt. I[i ∈ I] ≤ 1600(T + 1)γ α · mt ≤ T ǫ2 · mt if c1 is set small enough. By a union bound this holds for all t ∈ {0, ..., T} simultaneously with probability ≥ 199/200. Plugging back into (7), we have, with probability ≥ 199/200, simultaneously for all t: Xσ2 i (A)∈ ¯Rt\Rt hγ Rt (σ2 i (A)) ≤ T ǫ2 · mt ≤ T ǫ2 · (bt−1 + bt + bt+1) (8) where the second bound follows from the fact that, regardless of the setting of the shift a1, Mt ⊂ Rt−1 ∪ Rt ∪ Rt+1 so mt ≤ (bt−1 + bt + bt+1). Plugging (8) into (5) we have: bt ≤ tr(hγ Rt (AT A)) ≤ bt + T ǫ2(bt−1 + bt + bt+1). (9) We conclude by showing that, before the final rounding step of Algorithm 1, bt ∈ (1±ǫ1) tr(hγ √c3ǫ1 with high probability. In the final rounding step, if tr(hγ (AT A)) ≤ 1/4 (which can only occur if bt = 0) and c1, c3 are sufficiently small, then we will have bt ≤ 1/2 and so will round down to bt = 0 = bt. Otherwise, the √c3ǫ1 term will be absorbed into the relative error on tr(hγ (AT A)). Rt Rt (AT A))+ Rt Overall, combined with (9) we will have, with probability ≥ 99/100 for all t: (1 − ǫ)bt ≤ bt ≤ (1 + 2ǫ1)bt + (1 + 2ǫ1)T ǫ2(bt−1 + bt + bt+1) which gives the theorem if we adjust ǫ1, ǫ2 by making c1, c2, c3 sufficiently small.Thus we conclude by showing that in fact bt ∈ (1±ǫ1) tr(hγ as in (AT A))+√c3ǫ1 with high probability. Setting S = log n c2ǫ2 1 Rt 14 Rt Algorithm 1, for y1, . . . , yS chosen from {−1, 1}d, with high probability 1 (1 ± ǫ1) tr(hγ (AT A)) by a standard trace estimation result [AT11]. Further, let xi = W(AT A, y, at+1, at, γ, c3ǫ2 (AT A)yi(cid:13)(cid:13)2 ≤ (AT A)yi ≤pc3/nǫ1 kyik2 = √c3ǫ1 since n2 kyik2 which by Cauchy-Schwarz gives yT kyik2 = √n. Thus, overall we have, before the rounding step in which bt is set to 0 if bt < 1/2: i xi − yT (AT A)yi ∈ SPS 1/n)yi. By Theorem 7: (cid:13)(cid:13)xi − hγ i hγ Rt i=1 yT i hγ Rt c3ǫ2 1 Rt bt = 1 S SXi=1 yT i W(AT A, y, at+1, at, γ, c3ǫ2 1/n)yi ∈ (1 ± ǫ1) tr(hγ Rt (AT A)) + √c3ǫ1. 4.2 Application to General Spectral Sums While Theorem 8 is useful in its own right, we now apply it to approximate a broad class of spectral sums. We need two assumptions on the sums that we approximate. First, for the histogram discretization to be relatively accurate, we need our function to be relatively smooth. Second, it is expensive to compute the histogram over very small singular values of A (i.e. with λ very small in Algorithm 1) as this makes the condition number in Theorem 7 large. So it is important that small singular values cannot contribute significantly to our sum. We start with the following definition: Definition 9 (Multiplicative Smoothness). f : R+ → R+ is δf -multiplicatively smooth if for some δf ≥ 1, for all x, f′(x) ≤ δf f (x) x . We have the following claim, proven in Appendix D. Claim 10. Let f : R+ → R+ be a δf -multiplicatively smooth function. For all x, y ∈ R+ and c ∈ (0, 1 3δf ) y ∈ [(1 − c)x, (1 + c)x] ⇒ f (y) ∈ [(1 − 3δf c)f (x), (1 + 3δf c)f (x)]. multiplicatively smooth. For the example of the Schatten p-norm, for f (x) = xp, f′(x) = p · xp−1 and so f (x) is p- We now give our general approximation theorem, showing that any spectral sum depending on sufficiently smooth and rapidly growing f can be computed using Algorithm 1: Theorem 11 (Spectral Sums Via Approximate Histogram). Consider any A ∈ Rn×d and any function f : R+ → R+ satisfying: • Multiplicative Smoothness: For some δf ≥ 1, f is δf -multiplicatively smooth (Defn. 9). • Small Tail: For any ǫ > 0 there exists λf (ǫ) such that for x ∈ [0, λf (ǫ)], f (x) ≤ ǫ nSf (A) Given error parameter ǫ ∈ (0, 1) and spectral norm estimate M ∈ [kAk2 , 2kAk2], for suf- ficiently small constant c, if we run Algorithm 1 on 1 M A with input parameters ǫ1, ǫ2 = cǫ, α = cǫ/δf and λ = λf (cǫ)2/M 2 then with probability 99/100, letting a1, b0, ..., bT be the outputs of the algorithm and g(x) = f (x1/2): (1 − ǫ)Sf (A) ≤ TXt=0 g(M 2 · a1(1 − α)t) · bt ≤ (1 + ǫ)Sf (A). 15 For parameter k ∈ [d], letting ¯κ def= kσ2 k(A)+Pd i=k+1 σ2 d·λ i (A) and κ def= σ2 k+1(A) λ , the algorithm runs in O nnz(A)k + dkω−1 + ! nnz(A) +pnnz(A)[d · ds(A) + dk]¯κ f log(1/λ)) ! √κ⌉ f log(1/λ)) (nnz(A) + dk)⌈ ǫ5/(δ2 ǫ5/(δ2 or O nnz(A)k + dkω−1 + time for sparse A or O(cid:18)ndω(logd k)−1 + nd+n1/2d3/2√¯κ) ǫ5/(δ2 f log(1/λ))(cid:19) for dense A. That is, we accurately approximate Sf (A) by discretizing over the histogram output by Algo- rithm 1. Note that we can boost our probability of success to 1 − δ by repeating the algorithm Θ(log(1/δ)) times and taking the median of the outputs. Proof. Let ¯A 1 and Theorem 8. Recall that we use the notation: R0 = [a1, 1], Rt = [a1(1 − α)t, a1(1 − α)t−1] for M A. Note that(cid:13)(cid:13) ¯A(cid:13)(cid:13)2 ≤ 1 and so it is a valid matrix on which to apply Algorithm def = 1 t ≥ 1, T = ⌈log(1−α) λ⌉, and bt =(cid:12)(cid:12){i : σ2 Since g(x) = f (x1/2), by chain rule: i ( ¯A) ∈ Rt}(cid:12)(cid:12). g′(x) = f′(x1/2) 2x1/2 ≤ δf f (x1/2) 2x = δf 2 g(x) x . So g is δf /2 multiplicatively smooth. By this smoothness, and Claim 10, for any i with σ2 i ( ¯A) ∈ Rt: g(M 2 · a1(1 − α)t) ∈(cid:18)1 ± 3δf α 2 (cid:19) g(σ2 i (A)) ∈ (1 ± ǫ/4) · f (σi(A)) if the constant c on α is set small enough. Small enough c also ensures g(M 2a1(1 − α)t−1) ∈ (1 ± ǫ/4)f (σi(A)) and g(M 2a1(1 − α)t+1) ∈ (1 ± ǫ/4)f (σi(A)). So, both the multiplicative and additive error terms in Theorem 8 do not hurt us significantly. For now, assume that ǫ2 = cǫ/T . We will first prove the result with this assumption and then show that it can be relaxed to ǫ2 = cǫ as i ( ¯A) ∈ Rt for some t ∈ {0, ..., T}. given in the theorem statement. Let I be the set of indices with σ2 That is, the set of singular values covered by our histogram. Let IT +1 be the set of indices with i ( ¯A) ∈ RT +1 -- that is, singular values which are not included in the histogram, but may be σ2 included in the additive error for the last bucket covering RT . Applying Theorem 8: TXt=0 g(M 2a1(1 − α)t) · bt ≤ TXt=0 g(M 2a1(1 − α)t) · [(1 + ǫ1)bt + ǫ2T (bt−1 + bt + bt+1)] f (σi(A)) + 3cǫ Xσ2 (1 + cǫ) Xσ2 i ( ¯A)∈Rt i ( ¯A)∈Rt f (σi(A)) f (σi(A)) ≤ (1 + ǫ/4) T +1Xt=0 ≤ (1 + ǫ) Xi∈I∪IT +1 ≤ (1 + ǫ)Sf (A) 16 (10) if we set c small enough. The second inequality arises because each σi(A) contributing to bt appears at most three times as an additive error term for bt−1, bt, and bt+1. In this inequality we include bucket RT +1 in the histogram, which only increases the right hand side. On the lower bound side, we use our small tail assumption, that for i with σi(A) < λf (cǫ), n Sf (A). Using the notation of Algorithm 1, we have aT +1 = a1(1 − α)T ≤ (1 − i ( ¯A) > aT +1 and thus falls in f (σi(A)) ≤ cǫ α)⌈log(1−α) λ⌉ ≤ λ def= λf (cǫ)2/M 2. So for any i with σi(A) ≥ λf (cǫ), σ2 some bucket of our histogram so i ∈ I. We thus have: Xi∈I f (σi(A)) ≥ Sf (A) − Xi:σi(A)<λf (cǫ) f (σi(A)) ≥ Sf (A) − n · cǫ n Sf (A) = (1 − cǫ)Sf (A). Applying Theorem 8 again, we have for sufficiently small c: TXt=0 g(a1(1 − α)t) · bt ≥ (1 − ǫ/4)(1 − cǫ) = (1 − ǫ/4)(1 − cǫ)Xi∈I TXt=0 Xσ2 i ( ¯A)∈Rt f (σi(A)) f (σi(A)) ≥ (1 − ǫ)Sf (A). We conclude the theorem by noting that we can actually set ǫ2 = cǫ instead of ǫ2 = cǫ/T as used above. The additive error term on each bucket was bounded using a Markov bound, and to union bound over T buckets, we lost a factor of T . However, in expectation, the total contribution of so by a Markov bound is ≤ ǫ/2Sf (A) with probability 99/100 if we set our constants small enough. It just remains to discuss runtime, i.e. to calculate the runtime of Algorithm 1 with inputs ǫ1, ǫ2 = cǫ, α = cǫ/δf and λ = λf (cǫ)2/M 2. The number of outer loops of the algorithm is f (σ1(A))(cid:17) = O (Sf (A)) and ǫ log(1/λ)(cid:17). The number of inner loops is S = O(1/ǫ2). And finally, additive error to our spectral sum estimation is just O(cid:16)ǫPi∈I∪IT +1 T = ⌈log(1−α) λ⌉ = Θ(cid:16) δf within each loop the most expensive operation is computing W(AT A, y, at+1, at, γ, c3ǫ2 1/n). Our final runtime follows from plugging this into Theorem 7 noting that γ = Θ(ǫα) = Θ(ǫ2/δf ) and at+1 = Ω(λ) for all t ∈ {0, ..., T}. Note that we perform the precomputation step to construct a preconditioner for AT A + λI just once, incurring cost O(nnz(A) + dkω−1) or O(ndω(logd k)−1). 4.3 Application to Schatten p, Orlicz, and Ky Fan Norms Theorem 11 is very general, allowing us to approximate any function satisfying a simple smoothness condition as long as the smaller singular values of A cannot contribute significantly to Sf (A). We now give some specific applications of the result. Schatten p-Norms Theorem 11 already gives the fastest known algorithms for Schatten p-norm estimation. We will not go into all runtime tradeoffs now as our best runtimes will be worked out in detail in Sections 6 and 7, but as an example: Corollary 12 (Schatten p-norms via Histogram Approximation). For any A ∈ Rn×n with uni- formly sparse rows (i.e. ds(A) = O(nnz(A)/n)), given error parameter ǫ ∈ (0, 1) and M ∈ 17 1 [kAk2 , 2kAk2], if we run Algorithm 1 on 1 M 2(cid:16) cǫ p(cid:17)2/p n kAkp be the outputs of the algorithm we have: M A with ǫ1, ǫ2 = cǫ, α = cǫ/ max{1, p} and λ = for sufficiently small constant c then with probability 99/100, letting a1, b0, ..., bT and p ≤ (1 − ǫ)kAkp Further the algorithm runs in time: · bt ≤ (1 + ǫ)kAkp p . O(cid:18) nnz(A)p2 ǫ5+1/p (cid:19) for p ≥ 2 TXt=0(cid:2)M 2a1(1 − α)t(cid:3)p/2 O nnz(A)n For dense inputs this can be sped up to O(cid:18) n p·ǫ5+1/p! without fast matrix multiplication. O n stant ǫ the second runtime gives O(nnz(A)n1/3+n3/2pds(A)) which is at worst O(nnz(A)n1/3+n2).  for p ≤ 2. p·ǫ5+1/p (cid:19) using fast matrix multiplication or For dense matrices, the nuclear norm estimation time is O(n2.18) using fast matrix multiplication. It is already O(n2.33) = o(nω), for the current ω, without using fast matrix multiplication. For constant ǫ, p > 2 the first runtime is O(nnz(A)), and for the nuclear norm (p = 1), for con- 2/p+1 pds(A) 1/p−1/2 1/p+1/2 + n p · ǫ5+1/p 2.3729−.1171p 3+p/2 1+p/2 1+.0346p 5/p−1/2 Note that we can compute the spectral norm approximation used to scale A via the Lanczos or power method in O(nnz(A)) time. λ depends on kAkp which we are estimating. However, as we will discuss in the proof, we can use a rough estimate for kAkp which suffices. As a more general strategy, λ can be identified via binary search. We can start with λ = σ1(A)2/M 2 and successively decrease λ running Algorithm 1 up to the stated runtime bounds. If it does not finish in the allotted time, we know that we have set λ too small. Thus, we can output the result with the smallest λ such that the algorithm completes within in the stated bounds. Proof. We invoke Theorem 11 with f (x) = xp. We have f′(x) = p f (x) x setting of α = cǫ/ max{1, p} suffices. Additionally, for any c, we can set λf (cǫ) =(cid:16) cǫ so δf = max{1, p} and our = n1/p kAkp and so our setting of λ suffices. Thus the accuracy bound follows from Theorem 11. We now consider runtime. For p ≥ 2: p(cid:17)1/p n kAkp c1/pǫ1/p ¯κ = kσ2 k(A) +Pn nλ i=k+1 σ2 i (A) n2/p−1 ǫ2/p ≤ F · kAk2 kAk2 p . We can bound kAkF ≤ n1/2−1/p kAkp and so have ¯κ ≤ 1 σ2−p k i=k+1 σ2 i (A) kσ2 ¯κ = n2/p−1 ǫ2/p · k(A) +Pn kAk2 k(A) ≤ 1 p k kAkp Using the fact that σp p we have the tradeoff between k and ¯κ: ǫ2/p . For p < 2 we have: n2/p−1 ǫ2/p · ≤ i=1 σp i (A) (A)Pn kAk2 p = n2/p−1 ǫ2/p · σ2−p (A) k kAk2−p p . ¯κ ≤ 1 ǫ2/p(cid:16) n k(cid:17)2/p−1 18 . (11) As mentioned, λ depends on the value of kAkp. We can simply lower bound kAkp k(A), which we estimate up to multiplicative error when performing deflation. We can use this lower bound to set λ. Our estimated λ will only be smaller than the true value, giving a better approxi- mation guarantee and the above condition number bound will still hold. p by kσp We now analyze our runtime. Recall that for f (x) = xp, δf = max{1, p}. Correspondingly, log(1/λ) = O(max{1, 1/p}) and so δ2 f log(1/λ) = max{p2, 1/p}. Plugging into the first runtime of Theorem 11, using the uniform sparsity assumption and the fact that √x + y ≤ √x + √y we have: O nnz(A)k + nkω−1 + nnz(A)√¯κ +pnnz(A)nk¯κ ǫ5/(max{p2, 1/p} ! . For p ≥ 2 we just set k = 0 and have O(nnz(A)p2/ǫ5+1/p) runtime by our bound ¯κ ≤ 1 p ≤ 2, not trying to optimize poly(1/ǫ) terms, we write the runtime as ǫ2/p . For O nds(A)k + nkω−1 + nds(A)√¯κ + npds(A)k¯κ ǫ5p ! 1/p−1/2 1/p+1/2 which gives √¯κ = n and balancing the first two coefficients on n, set k = n Finally, for dense A we apply the third runtime which gives and so nds(A)k = nds(A)√¯κ. We then have npds(A)k¯κ = npds(A)k3/2 = n Finally, the nkω−1 is dominated by the npds(A)k3/2 term so we drop it. k1/p−1/2 · ǫ5+1/p · p! O(cid:18)nω(logn k) + n2√¯κ n3/2+1/p ǫ5p (cid:19) = O nω(logn k) + = O nω(logn k) + 1/p−1/2 1/p+1/2 by (11) 5/p−1/2 2/p+1 pds(A). n3/2+1/p−(logn k)(1/p−1/2) ǫ5+1/p · p ! . We now balance the terms, again not optimizing ǫ dependence. Writing γ = logn k, ω(γ) = 2 for γ < α where α > 0.31389 and 2 + (ω − 2) γ−α 1−α for γ ≥ α [GU17]. Assuming γ > α we set: γ − α 1 − α 1 p − γ p γ 2 3 2 + = + 2 + (ω − 2) which gives γ ≈ 1/p−.3294 yields total runtime O(cid:16)n 1/p+.0435 > α for all p < 2 (so our assumption that γ ≥ α was valid.) This 1+.0435p (cid:17). Without using fast matrix multiplication, the first term in the runtime becomes n2k and so we balance costs by setting: n2+γ = n3/2+1/p−γ/p+γ/2 which gives γ = 1/p−1/2 2.3729−.0994p 3+p/2 1/p+1/2 and total runtime O(cid:18)n 1+p/2(cid:19). Bounded Orlicz Norms An Orlicz norm of a vector x ∈ Rn is given by G(x) :=Pn i=1 g(xi), where g(·) is convex, nonneg- ative, and has g(0) = 0. It is easy to see that applied to the vector of singular values, an Orlicz matrix norm is a special case of a spectral sum and can be approximated with Theorem 11 under sufficient conditions. A simple example shows that Orlicz norms for g(·) bounded by an envelope of xp1 and xp2 can be approximated in a similar time as kAkp2 in Corollary 12. p2 19 Corollary 13 (Bounded Orlicz norms via Histogram Approximation). For any convex function g(a) . a(cid:1)p1 ≥ g(b) g : R+ → R+, let p1 be the minimal real for which for all arguments a, b to g with a ≤ b,(cid:0) b Let p2 be the maximum positive real for which for all a ≤ b we have(cid:0) b Then for any A ∈ Rn×n with uniformly sparse rows (i.e. ds(A) = O(nnz(A)/n)), given error parameter ǫ ∈ (0, 1) and M ∈ [kAk2 , 2kAk2], if we run Algorithm 1 on 1 M A with ǫ1, ǫ2 = cǫ, α = cǫ/ max{1, p1} and λ = 1 for sufficiently small constant c then with probability 99/100, letting a1, b0, ..., bT be the outputs of the algorithm we have: a(cid:1)p2 ≤ g(b) M 2(cid:16) cǫ/2 n kAkp2 g(a) . (1 − ǫ)Sg(A) ≤ (1 − α)t/2(cid:17) · bt ≤ (1 + ǫ)Sg(A). 1 p2(cid:17)2/p2 g(cid:16)M a1/2 TXt=0 O (p1 + 1)2 · nnz(A)n Further the algorithm runs in time: and ǫ5+1/p2 (cid:19) for p2 ≥ 2 O(cid:18) nnz(A)(p1 + 1)2 For dense inputs this can be sped up to O (p1 + 1)2 · n Note that λ depends on kAkp2 binary search as described in the proof of Corollary 12. p2 5/p2−1/2 1/p2 −1/2 1/p2+1/2 + n p2 · ǫ5+1/p2 2/p2+1 pds(A)  for p2 ≤ 2. p2·ǫ5+1/p2 ! via fast matrix multiplication. 1+.0435p2 2.3729−.0994p2 which can be estimated for example using Corollary 12, or via Proof. We invoke Theorem 11 with f (x) = g(x). While we do not show that g(·) exactly satisfies the multiplicative smoothness condition, the upper bound on g(·) directly implies the result of Claim 10 with δf = p1. So our setting of α = cǫ/ max{1, p1} suffices as the bound in this Claim is the only smoothness condition used to prove Theorem 11. Additionally, by the lower bound on g(·), for any c, we can set λf (cǫ) =(cid:16) cǫ/2 n kAkp2 p2(cid:17)1/p2 . For any σi(A) ≥ λf (cǫ): λf (cǫ)(cid:19)p2 g(σi(A)) ≥(cid:18) σi(A) σp2 i (A) kAkp2 2n cǫ · ≥ g(λf (cǫ)) p2 · g(λf (cǫ)). which gives: Xσi(A)≥λf (cǫ) g(σi(A)) ≥ ≥ 2n · g(λf (cǫ)) cǫ · kAkp2 2n · g(λf (cǫ)) p2 cǫ σp2 i (A) · Xσi(A)≥λf (cǫ) · (1 − cǫ/2) where the last bound follows from the fact that by the setting of λf (cǫ), Pσi(A)≥λf (cǫ) σ kAkp2 1 − cǫ/2. Finally for any σi(A) ≤ λf (cǫ), g(σi(A)) ≤ g(λf (cǫ)). So overall we have: p2 p2 i (A) ≥ Xσi(A)<λf (cǫ) g(σi(A)) ≤ n · g(λf (cǫ)) ≤ cǫ/2 1 − cǫ/2 · Xσi(A)≥λf (cǫ) g(σi(A)) ≤ cǫ/2 1 − cǫ Sg(A) ≤ cǫSg(A). 20 Thus our setting of λ suffices and the accuracy bound follows from Theorem 11. It remains to discuss runtime. We have log(1/λ) = O (max{1, 1/p2}) and δ2 f = max{1, p2 (p1 + 1)2. The runtimes follow from Theorem 11 via the same arguments used in Corollary 12. 1} ≤ Ky Fan Norms i=1 σi(A) The Ky Fan w-norm of a matrix is the sum of its top w singular values: kAkKF (w) (note that these norms are typically called the 'Ky Fan k-norms', however we use w to avoid overloading notation on k). Such a norm is not strictly speaking a spectral sum. However it can still be approximated using our histogram method. We have the following corollary of Theorem 8: Corollary 14 (Ky Fan norms via Histogram Approximation). For any A ∈ Rn×n, given rank w, error parameter ǫ ∈ (0, 1) and M ∈ [kAk2 , 2kAk2], if we run Algorithm 1 on 1 M A with ǫ1 = cǫ, ǫ2 = c2ǫ2 for sufficiently small constants c, c2 then with probability 99/100, letting a1, b0, ..., bT be the outputs of the algorithm we have: log(1/λ) , α = cǫ and λ = (cid:16) cǫ def=Pw M w kAkKF (w)(cid:17)2 wXi=1 where t(i) is the smallest integer with Pt(i) (1 − ǫ)kAkKF (w) ≤ M a1/2 1 (and hence the ith term of the sum is just 0). Further the algorithm runs in time: t=0(1 + 2cǫ)bt ≥ i or t(i) = ∞ if no such integer exists (1 − α)t(i)/2 ≤ (1 + ǫ)kAkKF (w) O(cid:18)nnz(A)√w + nw ǫ7 (cid:19) . Note that to compute the top w singular values explicitly would require O(cid:0)nnz(A)w + nwω−1(cid:1) time using for example a block Krylov method [MM15]. Also note that λ depends on the norm we are attempting to compute. As discussed in Corollary 12, we can approximate λ via binary search, successively decreasing it until our call to Algorithm 1 exceeds the stated runtime. Proof. We can assume without loss of generality that kAk2 ≤ 1 and M = 1 since rescaling will not effect our approximation factor. By Theorem 8, since we set ǫ1 = cǫ, ǫ2 = c2ǫ2 log(1/λ) , and have T = ⌈log1−α λ⌉ = Θ(cid:16) log(1/λ) ǫ (cid:17): (1 − cǫ)bt ≤ bt ≤ bt + 2cǫ(bt−1 + bt + bt+1) (12) bt ≤ (1 + 2cǫ)bt if c is set small enough. if we set c2 small enough compared to c. This give bt ≤ 1 1−cǫ Thus, since these scaled bucket sizes strictly overestimate the true bucket sizes we have t(i) ≤ t(i), where t(i) is the smallest integer withPt(i) t=0 bt ≥ i. This gives, since α = cǫ and since by our setting wXi=1 of λ, at most an cǫ fraction of kAkKF (w) falls outside of the ranges R0, ..., RT : (1 − α)t(i)/2 ≤ (1 + 4cǫ) σi(A) ≤ (1 + 4cǫ) (1 − α)t(i)/2. kAkKF (w) = wXi=1 wXi=1 M a1/2 M a1/2 1 1 On the other side, let v be a vector that, for each t ∈ {0, ..., T} has (1 + 4cǫ)bt entries each set to M a1/2 (1 − α)t/2. Define the top-w norm of v to be the sum of its largest w entries, denoted by 1 21 kvkT (w). Our estimate of kAkKF (w) is equal to kvkT (w). Note that we can also add arbitrary zeros as padding entries to v and not change this norm. Similarly, let v′ be a vector with (1 + 10cǫ)bt values each set to (1 + 2cǫ) · a1/2 (1 − α)t/2 for t ∈ {0, ..., T} and 2ǫc · bT +1 entries set to (1 + 2cǫ) · a1/2 By (12), (1 + 2cǫ)bt ≤ (1 + 6cǫ)bt + 2cǫbt−1 + 2cǫbt+1. This fact combined with the fact that the entries in v′ are scaled up by a (1 + 2cǫ) factor ensure that the entries of v′ dominate those of v and so kv′kT (w) ≥ kvkT (w). Further, kv′kT (w) ≤ (1 + 13cǫ)kAkKF (w) since we have scaled up each entry by at most (1 + 2cǫ) factor and scaled up each bucket size bt by a (1 + 10cǫ) factor. This bound gives our final multiplicative approximation after adjusting the constant c on ǫ. It remains to discuss runtime. We invoke Theorem 7, setting k = w1/2. This gives: (1 − α)T /2 ≤ λ. 1 1 = λ w κ = σ2 k+1(A) σ2 k+1(A)w2 KF (w) (ǫc)2 ≤ kAk2 where we us the fact that for k = w1/2, σk(A) ≤ 1 w1/2 kAkKF (w). With our settings of λ, α and 1 · 1/α) = Θ(1/ǫ3) calls to W, each which requires Θ(1/γ) = ǫ1, ǫ2, Algorithm 1 performs Θ(1/ǫ2 Θ(ǫ2α) = Θ(1/ǫ3) regression calls due to our setting of α and ǫ2. Plugging κ into the second runtime of Theorem 7 gives the corollary. (cǫ)2 5 Lower Bounds In this section we give hardness results for high accuracy spectrum approximation. Specifically, we show how to detect if an undirected unweighted graph contains a triangle using accurate approxima- tion algorithms for various important spectral sums such as the Schatten p-norms, log-determinant, the SVD entropy, and the trace inverse. Our spectral sum bounds further imply hardness for the important primitives of computing effective resistances in a graph or leverage scores in a matrix. In the seminal work of [WW10] it was shown that any truly subcubic time algorithm for tri- angle detection yields a truly subcubic time algorithms for Boolean matrix multiplication (BMM). Consequently, these results show that computing any of these quantities too precisely is in a sense as difficult as BMM. Furthermore, as it is a longstanding open question whether or not there is any subcubic time combinatorial algorithm for BMM, i.e. an algorithm which avoids the powerful algebraic manipulations inherent in the fastest algorithms for BMM, these results can be viewed as showing that we do not expect simple iterative methods to yield precise algorithms for these problems without an immense breakthrough in linear algebra. In Section 5.1 we give a general result on reducing spectral sums to triangle detection. Then in Section 5.2 we use this to show hardness for computing various well studied spectral sums. In Section 5.3 we conclude by showing hardness for computing graph and numerical linear algebra primitives, i.e. effective resistances and leverage scores. 5.1 Reductions From Triangle Detection Here we provide our main technical tool for reducing spectral sum computation to triangle detec- tion. As discussed in Section 1.4, our reduction leverages the well known fact that the number of triangles in any unweighted graph G is equal to tr(A3)/6 where A is the adjacency matrix for G. Consequently, given any function f : R+ → R+ whose power series is reasonably behaved, we can show that for suitably small δ the quantity tr(f (I + δA)) is dominated by the contribution of tr(Ak) for k ∈ (0, 3). Therefore computing tr(f (I + δA)) approximately lets us distinguish between whether or not tr(A3) = 0 or tr(A3) ≥ 6. 22 We formalize this in the following theorem. As it simplifies the result, we focus on the case where f is defined on the interval (0, 2), however, this suffices for our purposes and can be generalized via shifting and scaling of x. Theorem 15 (Many Spectral Sums are as Hard as Triangle Detection). Let f : R+ → R+ be an arbitrary function, such that for x ∈ (0, 2) we can express it as (13) Then given the adjacency matrix A ∈ Rn×n of any simple graph G that has no self-loops and spectral sum estimate X ∈ (1 ± ǫ1/9)Pn i=1 f (σi(I − δA)) for scaling δ and accuracy ǫ satisfying f (x) = ∞Xk=0 δ = min(cid:26) 1 n , ck ck(x − 1)k where (cid:12)(cid:12)(cid:12)(cid:12) 10n4h(cid:27) and ǫ1 = min(cid:26)1 , c3(cid:12)(cid:12)(cid:12)(cid:12) ≤ hk−3 for all k > 3 c2n2(cid:12)(cid:12)(cid:12)(cid:12)(cid:27) c0n(cid:12)(cid:12)(cid:12)(cid:12) , (cid:12)(cid:12)(cid:12)(cid:12) c3δ3 (cid:12)(cid:12)(cid:12)(cid:12) c3δ 1 we can detect if G has a triangle in O(nnz(A)) time. Consequently, given an algorithm which on input B ∈ Rn×n outputs Y ∈ (1 ± ǫ)Pn in O(nγǫ−c) time we can produce an O(n2 + nγǫ−c 1 )) time triangle detection algorithm. i=1 f (σi(B)) Proof. Let A, G, δ, ǫ1, and X be as in the theorem statement and let B = I− δA. By Gershgorin's circle theorem, kAk2 ≤ n − 1 and since δ ≤ 1/n, kδAk2 < 1. Consequently B is symmetric PSD, σi(B) = λi(B) ∈ (0, 2) for all i ∈ [n], and therefore applying (13) yields: def ckδk tr(Ak) . 10n4h is enough to insure that the first three terms of this power series dominate. Specifically: ∞Xk=0 1 ck c3 f (σi(B)) = nXi=1 nXi=1 ck(δλi(A))k = =(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) f (1 − δλi(A)) = c3δ3 ∞Xk=4 δ ≤ 1 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ∞Xk=4 where the last inequality uses the fact that tr(Ak) ≤ kAkk−2 Further, since tr(A0) = n, tr(A) = 0, and tr(A2) = kAk2 ∞Xk=0 nXi=1 δk−3 tr(Ak)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ c3δ3 ∞Xk=4 ckδk tr(Ak)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) c3δ3(cid:12)(cid:12)(cid:12)(cid:12) +(cid:12)(cid:12)(cid:12)(cid:12) 0 ≤ c0 tr(A0) + c1δ tr(A) + c2δ2(tr(A2)) ≤ c3δ3 ·(cid:18)(cid:12)(cid:12)(cid:12)(cid:12) Now, clearly in O(nnz(A)) time we can compute tr(A2) = kAk2 9 (cid:18)c3δ3 3(cid:21) X − c0n − c2δ2 tr(A2) = c3δ3 tr(A3) ± c3δ3 9 ± = c3δ3(cid:20)tr(A3)(cid:18)1 ± 1 10k−3(cid:18) 1 kAk2 20(cid:19) ± c0n F ≤ n2 we have: ǫ1 1 2 tr(Ak) ≤ c3δ3 n4(cid:19)k−3 F ≤ nk ≤ n4(k−3) for all k > 3. 9 . ǫ1 c2n2 c3δ (cid:12)(cid:12)(cid:12)(cid:12)(cid:19) ≤ c3δ3 F in O(nnz(A)) as well as: ǫ1 (cid:19) + c3δ3 tr(A3) + c3δ3 9 So we can detect if tr(A3) = 0 or if tr(A3) ≥ 6 and hence whether or not G has a triangle. Note that in this reduction, so long as δ is small (i.e. ≤ 2n) then B = I − δA is a very well conditioned matrix (its condition number is at most a constant). Consequently, our lower bounds apply even when approximately applying for example B−1 or B1/2 to high precision is inexpensive. 23 The theorem (and the results in Section 5.3) suggests that the difficulty in computing spectral sums arises more from the need to measure the contribution from multiple terms precisely, than from the difficulty in manipulating B for the purposes of applying it to a single vector. Also, note that the matrix B in this reduction is symmetrically diagonally dominant (SDD). So, even for these highly structured matrices which admit near linear time application of B−1 [ST04] as well as approximate factorization [KS16], accurate spectral sums are difficult. We leverage this in Section 5.3. 5.2 Hardness for Computing Spectral Sums Here we use Theorem 15 to show hardness for various spectral sum problems. To simplify our pre- sentation, we focus on the case of dense matrices, showing bounds of the form Ω(nγǫ−c). However, note that Theorem 15 and the approach we use also yields lower bounds on the running time for sparse matrices and can be stated in terms of nnz(A). Schatten p-norm for all p 6= 2 For x ∈ (0, 2), using the Taylor Series about 1 we can write xp = ∞Xk=0 ck(1 − x)k where ck = Qk−1 k! i=0 (p − i) (14) This series converges since ck ≤ 1 for k > p and for x ∈ (0, 2), (1 − x) < 1. Note that when p is a non-negative integer, only the first p terms of the expansion are nonzero. When p is non-integral, the sum is infinite. We will apply Theorem 15 slightly differently for different values of p. We first give our strongest result: Corollary 16 (Schatten 3-Norm Hardness). Given an algorithm which on input B ∈ Rn×n returns X ∈ (1± ǫ)kBk3 3 in O(nγǫ−c) we can produce an algorithm that detects if an n-node graph contains a triangle in O(nγ+4c) time. Proof. For p = 3, ck = 0 for k > 3. So we apply Theorem 15 with h = 0 and hence δ = 1/n and ǫ1 = c3δ3 c0n = 1 n4 . Note that for p very close to 3 a similar bound holds as h ≈ 0. If p = 3 Theorem 31 gives an algorithm running in O(n2/ǫ3) time. Significant improvement to the ǫ dependence in this algorithm therefore either requires loss in the n dependence or would lead to o(nw) time triangle detection for the current value of ω. We next extend to all p 6= 1, 2. Corollary 17 (Schatten p-Norm Hardness, p 6= 1, 2). For any p > 0, p 6= 1, 2, given algorithm A which for any B ∈ Rn×n returns X ∈ (1 ± ǫ)kBkp p in O(nγǫ−c) time, we can detect if an n-node graph contains a triangle in O(cid:16)nγ+13c · p(p−1)(p−2)(cid:12)(cid:12)(cid:12) ≤ (cid:12)(cid:12)(cid:12) c3 ≤ pk−3 for all k > 3 as well as (cid:12)(cid:12)(cid:12) c0 and similarly (cid:12)(cid:12)(cid:12) c2 c3(cid:12)(cid:12)(cid:12) ≤ (cid:12)(cid:12)(cid:12) 2 min{p,(p−1)}(cid:12)(cid:12)(cid:12). We apply Theorem 15 with δ = Θ(cid:16) 1 Θ(cid:16)min{p,(p−1),(p−2)} (cid:17), which gives the result. min{p,(p−1),(p−2)}c(cid:17) time. c3(cid:12)(cid:12)(cid:12) = (cid:12)(cid:12)(cid:12) Proof. We have ck n13p3 1 2 min{p,(p−1),(p−2)}(cid:12)(cid:12)(cid:12) n4p(cid:17) and ǫ1 = c3δ3 c0n = p3c 1 1 24 In the typical case when p << n, the p3c term above is negligible. The min{p,(p−1),(p−2)}c term is meaningful however. Our bound becomes weak as p approaches 2 (and meaningless when p = 2). This is unsurprising, as for p very close to 2, kBkp F , which can be computed exactly in nnz(B) time. The bound also becomes weak for p ≈ 1, which is natural as our reduction only uses PSD B, for which kBk1 = tr(B) which can be computed in n time. However, we can remedy this issue by working with a (non-PSD) square root of B which is easy to compute: p ≈ kBk2 1 Note that for p ≈ 1, p3c/2 Corollary 18 (Schatten p-Norm Hardness, p ≈ 1). For any p, given an algorithm which for any p in O(cid:0)f (nnz(B), n) · 1 B ∈ Rp×n returns X ∈ (1± ǫ)kBkp with m edges contains a triangle in O(cid:16)f (m, n) · n13c · ǫc(cid:1) time, we can detect if an n-node graph min{p/2,(p/2−1),(p/2−2)}c + m(cid:17) time. p3c/2 min{p/2,(p/2−1),(p/2−2)}c is just a constant. Again, the bound is naturally weak when p ≈ 2 as (p/2 − 1) goes to 0 Proof. For B = I − δA as in Theorem 15. Let L = D − A be the Laplacian of G where D is the diagonal degree matrix. We can write B = δL + bD where bD = I − δD is PSD since δ ≤ 1/n. Letting M ∈ R(n 2)×n be the vertex edge incidence matrix of A, and N = [δ1/2MT ,bD1/2], we have NNT = B. Thus, kNkp = kBkp/2 p/2 and so approximating this norm gives triangle detection by Corollary 17. Note that nnz(N) = O(nnz(A)) and further N matrix can be formed in this amount of time, giving our final runtime claim. Note that for p = 1, since N has maximum row sparsity 2, we obtain a runtime via Theorem 33 of O(ǫ−3(cid:0)mn1/3 + n3/2(cid:1)) = o(nω) for the current value of ω, even when m = n2, implying that significantly improving this ǫ dependence would either improve matrix multiplication or come at a cost in the polynomials of the other parameters. SVD Entropy: Corollary 19 (SVD Entropy Hardness). Given algorithm A which for any B ∈ Rn×n returns X ∈ (1 ± ǫ)Pn i=1 f (σi(B)) for f (x) = x log x in O(nγǫ−c) time, we can detect if an n-node graph contains a triangle in O(nγ+6c) time. Proof. For x ∈ (0, 2), using the Taylor Series about 1 we can write x log x =P∞k=0 ck(x− 1)k where c0 = 1 log(1) = 0, c1 = log(1) + 1 = 1, and ck = (k−2)! 3 . Applying Theorem 15 with δ = 1 k! ≤ 1 for k ≥ 2. ck < c3 for all k > 3 and 10n4 and ǫ1 = δ 30n6 gives the result. = 0 while c2 c3 3n2 = 1 = 1 c0 c3 Log Determinant: Corollary 20 (Log Determinant Hardness). Given algorithm A which for any B ∈ Rn×n returns X ∈ (1 ± ǫ) log(det(B)) in O(nγǫ−c) time, we can detect if an n-node graph contains a triangle in O(nγ+6c) time. Proof. Using the Taylor Series about 1 we can write log x =P∞k=0 ck(x−1)k where c0 = 0, ci = 1/i for i ≥ 1. Therefore ck < c3 for all k > 3, c0 and ǫ1 = δ 2 . Applying Theorem 15 with δ = 1 10n4 = 0, and c2 c3 20n6 gives the result. 2n2 = 1 = 3 c3 In Appendix B, Lemma 52 we show that a similar result holds for computing det(B) = In [BS83] it is shown that, given an arithmetic circuit for computing det(B), one i=1 λi(B). can generate a circuit of the same size (up to a constant) that computes B−1. This also yields a Qn 25 circuit for matrix multiplication by a classic reduction.3 Our results, combined with the reduction of [WW10] of Boolean matrix multiplication to triangle detection, show that a sub-cubic time al- gorithm for the approximating log(det(B)) or det(B) up to sufficient accuracy, yields a sub-cubic time matrix multiplication algorithm, providing a reduction based connection between determinant and matrix multiplication analogous to the circuit based result of [BS83]. Trace of Exponential: Corollary 21 (Trace of Exponential Hardness). Given algorithm A which for any B ∈ Rn×n returns X ∈ (1 ± ǫ) tr(exp(B)) in O(nγǫ−c) time, we can detect if an n-node graph contains a triangle in O(nγ+13c) time. Proof. Using the Taylor Series about 1 we can write ex =P∞k=0 and for all k ≥ 3, ck < c3. Applying Theorem 15 with δ = 1 result. . We have c0 = 3, c3 1 6000n13 gives the 10n4 and ǫ1 = c3δ3 = 6, c2 c3 e(x−1)k c0n = k! 5.3 Leverage Score and Effective Resistance Hardness Here we show hardness for precisely computing all effective resistances and leverage scores of a graph. Our main tool is the following result (which in turn is an easy corollary of Theorem 15) for an algorithm that precisely computes the trace inverse of a strictly symmetric diagonally dominant (SDD) B, i.e. B = B⊤ and Bii >Pj6=i Bij. Corollary 22 (Trace of Inverse Hardness). Given an algorithm which for any strictly SDD B ∈ Rn×n with non-positive off-diagonal entries returns X ∈ (1±ǫ) tr(B−1) in O(nγǫ−c) time for γ ≥ 2, we can produce an algorithm which detects if an n-node graph contains a triangle in O(nγ+13c) time. x =P∞k=0(1 − x)k, and then apply Theorem 15 with δ = 1 Proof. For x ∈ (0, 2) we can write 1 and ǫ1 = δ3 off-diagonal entries yields the result. 10n4 1000n13 . Checking that the B in Theorem 15 is strictly SDD with non-positive n = 1 Using this we prove hardness for precisely computing effective resistances in a graph. Recall that for a weighted undirected graph G = (V, E, w) its Laplacian, L ∈ RV ×V is given by Lij = −wij if there is an edge between i and j and 0 otherwise and Lii = −Pi6=j Lij or equivalently L = D− A where D is the diagonal degree matrix and A is the weighted adjacency matrix associated with G. Note that this describes a clear bijection between a Laplacian and its associated graph and we therefore use them fairly interchangeably in the remainder of this section. The effective resistance between vertices i and j is given by (1i−1j)⊤L†(1i−1j) where † denotes the Moore-Penrose pseudoinverse. In the following lemma we prove that compute all the effective resistances between a vertex and its neighbors in the graph can be used to compute the trace of the inverse of any strictly SDD matrix with non-positive off-diagonals and therefore doing this precisely is as hard as triangle detection via Corollary 22. Our proof is based off a fairly standard reduction between solving strictly SDD matrices with negative off-diagonals and solving Laplacian systems. Lemma 23 (Effective Resistance Yields Trace). Suppose we have an algorithm which given Lapla- cian L ∈ Rn×n with m-non-zero entries, entry i ∈ [n], and error ǫ ∈ (0, 1) computes a 1 ± ǫ 3Matrix multiplication reduces to inversion by the fact that   0 0 I A 0 I B 0 I −1   =   I −A AB −B 0 I 0 0 I   . See [Isa08]. 26 approximation to the total effective resistance between i and the neighbors of i in the graph associ- ated with L, that is X ∈ (1 ± ǫ) Xj∈[n]:Lij6=0 (1i − 1j)⊤L†(1i − 1j) in time O(mγǫ−c). Then there is an algorithm that computes the trace of the inverse of n× n strict SDD matrix with m non-zero entries and non-positive off-diagonals in O(mγǫ−c) time. Proof. Let M ∈ Rn×n be an arbitrary strictly SDD matrix with non-positive off-diagonals, i.e. M = M⊤, Mii >Pj6=i Mij, and Mij ≤ 0 for all i 6= j. Let v def=(cid:18) M −v α (cid:19) . def = 1⊤M1, and def = M1, α −v⊤ L Now, clearly by our assumptions on M we have that v > 0 entrywise and therefore α > 0. Therefore, the off-diagonal entries of L are non-positive and by construction L1 = 0. Consequently, L is a (n + 1) × (n + 1) symmetric Laplacian matrix with nnz(M) + 2n + 1 non-zero entries. Now, consider any x ∈ Rn and y ∈ R that satisfy the following for some i ∈ [n] (cid:18) M −v −v⊤ α (cid:19)(cid:18) x y (cid:19) =(cid:18) 1i −1 (cid:19) . Since L is a symmetric Laplacian and the associated graph is connected by construction we know that ker(L) = span({1}) and there there must exist such x and y. Furthermore, since M is strictly SDD it is invertible and since M1 = v we have that x = M−1 (y · v + 1i) = y · 1 + M−11i and consequently (1i − 1n+1)⊤L†(1i − 1n+1) = 1⊤i x − y = 1⊤i M−11i . Consequently, if we used the algorithm to get a multiplicative approximation X as stated then X ∈ (1 ± ǫ) tr(M−1) and the result follows. Using this, we also show that computing leverage scores of matrix, a powerful and prevalent notion in convex analysis and numerical linear algebra, is also difficult to compute. This follows from the well known fact that effective resistances in graphs and leverage scores of matrices are the same up to scaling by known quantities. Corollary 24 (Leverage Score Hardness). Suppose we have an algorithm which given A ∈ Rn×d can compute eσ that is a 1 ± ǫ multiplicative approximation to the leverage scores of A, i.e. eσi ∈ (1 ± ǫ)1⊤i A(A⊤A)†A⊤1i for all i ∈ [n] in time O(nnz(A)γǫ−c). Then there is a O(n2γ+13c) time algorithm for detecting if an n-node graph contains a triangle. Proof. Let L ∈ Rn×n be a symmetric Laplacian. Let E = {{i, j} ⊆ [n] × [n] : Lij 6= 0}, i.e. the set of edges in the graph associated with L. Let m = E and B ∈ Rm×n be the incidence matrix associated with L, i.e. for all e = {i, j} ∈ E we have Be,i =p−Lij and Be,j = −p−Lij for some canonical choice of ordering of i and j and let all other entries of B = 0. Clearly nnz(B) = nnz(L) and we can form B in O(nnz(L)) time. 27 It is well known and easy to check that L = B⊤b. Consequently, for all e = {i, j} ∈ E we have 1⊤e B(B⊤B)†B⊤1e = (−Lij) · (1i − 1j)⊤L†(1i − 1j) Now if we computeeσ using the assumed algorithm in O(nnz(L)γǫ−c) = O(n2γǫ−c) time, then since −Lij is non-negative in an additional O(nnz(L) = O(n2) time this yields a 1 ± ǫ multiplicative approximation to the total effective resistance between any i and all its neighbors in the graph associated with L. Consequently, by Lemma 23 and Corollary 22 the result follows. 6 Improved Error Dependence via Polynomial Approximation For constant ǫ, Theorem 11 and the resulting Corollary 12 matches our fastest runtimes for the Schatten p-norms. However, it is possible to significantly improve the ǫ dependence by generalizing our approach. Instead of splitting our spectrum into many small spectral windows, we split into windows of constant multiplicative width and approximate xp via a low degree polynomial over each window. The degree of this polynomial only varies with log(1/ǫ). In Theorem 11, fixing δf to be constant for illustration, each window has width α = Θ(ǫ) and so there are T = ⌈log1−α λ⌉ = Θ(log λ/ǫ) windows. Additionally, we must set the steepness parameter to be γ = Θ(ǫα) = Θ(ǫ2). This loses us a total 1/ǫ2 factor in our runtime as compared to our improved algorithm which will set α = Θ(1) and so γ = Θ(ǫ). We begin by showing that if we well approximate f on each window, then we well approximate In the following theorems for simplicity we work with PSD matrices, as we will Sf (A) overall. eventually apply these lemmas to AT A. Lemma 25. Consider f : R → R+, parameters α, ǫ ∈ (0, 1), and gap parameter γ ∈ (0, α). Set a0 = 1, pick a1 uniformly at random from [1 − α, 1], and set at = a1(1 − α)t−1 for t ≥ 2. Let Rt = [at+1, at] for all t ≥ 0. Let hγ be a γ-soft window for Rt (Definition 6) and let ¯Rt = [(1 − γ)at+1, (1 + γ)at] be the interval on which hγ is nonzero. Furthermore, for t ≥ 0, let qt be a 'well-behaved' approximation to f on ¯Rt in the following sense: Rt Rt • Multiplicative Approximation: qt(x) − f (x) ≤ ǫf (x) for x ∈ ¯Rt. • Approximate Monotonicity: qt(y) ≤ c1qt(x) for all y ≤ x for some c1 ≥ 1. • Range Preserving: qt(0) = 0. 40c1γ 40c1γ (cid:18)1 − ǫ − Then, for any PSD A ∈ Rd×d with kAk2 ≤ 1, with probability 9/10: (A)A) ≤(cid:18)1 + ǫ + Proof. Note that the restriction that qt(0) = 0 along with the approximate monotonicity property implies that q(x) is nonnegative, so Sqt is a valid spectral sum and Sqt(hγ (A)A)), Rt so we will be able to estimate this sum via stochastic trace estimation. α (cid:19)Sf (A) ≤ α (cid:19)Sf (A). (A)A) = tr(qt(hγ Rt ∞Xt=0 Sqt(hγ Rt Let ti denote the unique index such that σi(A) ∈ Rti. Since γ < α, each σi(A) lies in the support of at most two overlapping soft windows (in at most two ranges ¯Rti and ¯Rti±1). Let T be the set of indices whose singular values fall in the support of exactly one soft window and ¯T be its 28 complement. We first bound the error introduced on singular values with indices in T . ∞Xt=0 Sqt(hγ Rt (A)A) = Rt dXi=1 =Xi∈T ∈ (1 ± ǫ)Xi∈T ∞Xt=0 qt(cid:0)σi(A) · hγ (σi(A))(cid:1) ∞Xt=0 qti(σi(A)) +Xi∈ ¯T qt(cid:0)σi(A) · hγ ∞Xt=0 f (σi(A)) +Xi∈ ¯T (σi(A))(cid:1) qt(cid:0)σi(A) · hγ Rt Rt (16) (17) (σi(A))(cid:1) . ǫf (x) for x ∈ ¯Rt. Let us now consider a particular i ∈ ¯T and boundP∞t=0 qt(cid:0)σi(A) · hγ The last inequality follows from the multiplicative approximation assumption on qt that qt(x) − f (x) ≤ Note that there are precisely two non-zero terms in this summation -- one corresponding to ti and the other, to ti ± 1, which we denote by t¯i. Using the above hypothesis on qt again, we see that (σi(A))(cid:1). (15) Rt qti(cid:16)σi(A) · hγ Rti (σi(A))(cid:17) = qti (σi(A)) ∈ (1 ± ǫ)f (σi(A)). For the term involving t¯i, we have σi(A) ∈ ¯R¯ti and by the approximate monotonicity requirement that y ≤ x ⇒ qt(y) ≤ c1qt(x) have: qt¯i(cid:16)σi(A) · hγ Rt¯i (σi(A))(cid:17) ≤ c1qt¯i(σi(A)) ∈ c1(1 ± ǫ)f (σi(A)). Due to the random positioning of the windows, in expectation, the total contribution of the singular values lying at the intersection of two windows is small. Specifically, E α1Xi∈ ¯T f (σi(A)) = dXi=1 P[i ∈ ¯T ] · f (σi(A)) ≤ 2γ α dXi=1 f (σi(A)) = 2γ α Sf (A) (18) σi(A) where the bound on P[i ∈ ¯T ] follows from the fact that i ∈ ¯T only if a1(1 − α)t ∈ (1 ± γ)σi(A) for some t. This holds only if a1 ∈ (1 ± γ)(cid:18) α since a1 is chosen uniformly in the range [1− α, 1]. By a Markov bound applied to (18), with probability 9/10 we have Pi∈ ¯T f (σi(A)) ≤ 20γ α Sf (A). Combining with (15), (16), and(17), we obtain, with probability 9/10: α (cid:19)Sf (A) ≤ ⌈logσi(A) 1−α⌉(cid:19), which occurs with probability 2γ (A)A) ≤(cid:18)1 + ǫ + α (cid:19)Sf (A). (cid:18)1 − ǫ − Sqt(hγ (1−α) 40c1γ 40c1γ Rt ∞Xt=0 We now show that, as long as the contribution of the smaller singular values of A to Sf (A) is not too large, we can truncate this sum and still obtain an accurate approximation. Specifically: Corollary 26. For any PSD A ∈ Rd×d with kAk2 ≤ 1, let f : R → R+ be a function such that, for any ǫ > 0 there exists λf (ǫ) such that for x ∈ [0, λf (ǫ)], f (x) ≤ ǫ nSf (A). Given parameters α, ǫ ∈ (0, 1), and gap parameter γ < α, for t ≥ 0 define Rt, hγ and, ¯Rt as in Lemma 25. Let qt be a well-behaved approximation to f on ¯Rt as in Lemma 25. With probability 9/10: (cid:18)1 − α − 5c1ǫ(cid:19)Sf (A) ≤ + 5c1ǫ(cid:19)Sf (A). (A)A) ≤(cid:18)1 + Sqt(hγ 40c1γ 40c1γ (19) Rt Rt α ⌈log1−α λf (ǫ)⌉Xt=0 29 Proof. This follows from Lemma 25 along with the small tail assumption. Specifically, by (17): ∞X⌈log1−α λf (ǫ)⌉+1 Sqt(hγ Rt (A)A) ≤ X{iσi(A)≤λf (ǫ)} 4c1f (σi(A)) ≤ 4c1n · ǫ nSf (A) = 4c1ǫSf (A). We now show that well behaved polynomial approximations exist for the function xp for general real p, whose spectral sums give the Schatten p-norms. Lemma 27 (Polynomial Approximation of Power Function). For all p ∈ [−1, 0) and k ≥ 0 let def = ak kYj=1(cid:18)1 − p + 1 j (cid:19) and qk(x) = kXj=0 aj(1 − x)j . Then for all x ∈ (0, 1] and k ≥ 0 we have 0 ≤ ak ≤ 1 and 0 ≤ xp − qk(x) ≤ exp(−kx) x . Proof. Induction shows that the k-th derivative of f (x) = xp at x ∈ R, is given by Furthermore, direct calculation reveals that for all x, t ∈ R and k ≥ 1 (p + 1 − j) xp−k . f (k)(x) = kYj=1 (x − t)k =  · tp−k · (t − x)k · (−1)k = aktp(cid:16)1 − kYj=1 p + 1 − j j f (k)(t) k! x t(cid:17)k . (20) In the last step we took the worst case of t = 1 in the integral and used that since p ∈ [−1, 0) it is the case that 1− (p + 1)/j ∈ (0, 1] and therefore 0 ≤ ak ≤ 1. Consequently, limi→∞ qk(x) = xp and 0 ≤ xp − qk(x) = (1 − x)j ≤ exp(−kx) x . 1 (x − t)kdt(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ∞Xj=k+1 = ak · p − k ·(cid:12)(cid:12)(cid:12)(cid:12)Z x aj(1 − x)j ≤ (1 − x)k+1 ∞Xj=0 Consequently, qk(x) is the degree k Taylor expansion of xp about 1 evaluated at x. Furthermore, since f (k+1)(t) = p−k · f (k)(t), the integral form of the remainder of a Taylor series expansion shows t f (k+1)(t) x tp−1(cid:16)1 − t(cid:17)k dt(cid:12)(cid:12)(cid:12)(cid:12) ≤ k − p x exp(−kx) . xp − qk(x) =(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Z x 1 k! Corollary 28. For any p, ǫ > 0, a, b ∈ (0, 1] with a < b, there is a polynomial q of degree aǫ(cid:1) · b a + p(cid:1) such that: O(cid:0)log(cid:0) b • Multiplicative Approximation: q(x) − xp ≤ ǫxp for x ∈ [a, b]. • Monotonicity: q(y) < q(x) for all y < x. 30 • Range Preserving: q(0) = 0. Proof. Set p′ = p − ⌈p⌉ and i = c1 log(cid:0) b a for large enough constant c1. Instantiate Lemma 27 with p′ and i to obtain qi(x). Set q(x) = bp · (x/b)⌈p⌉ · qi(x/b). It is clear that q(0) = 0. Further, aǫ(cid:1) · b xp − q(x) = bp(x/b)⌈p⌉ · (x/b)p′ − qi(x/b) aǫ(cid:19) b · exp(cid:18)−c1 log(cid:18) b For x ∈ [a, b], x/b ≥ a/b. Further, (b/x)1+p′ − qi(x) =P∞j=i+1 aj(1 − x)j. All aj xp − q(x) < ǫxp. We finally show monotonicity. We have xp′ are positive, so this difference is monotonically decreasing in x. We thus have, for y < x: ≤ b/a and so if we choose c1 large enough we have ≤ xp(b/x)1+p′ b(cid:19) a · x q(y) q(x) = (y/b)⌈p⌉qi(y/b) (x/b)⌈p⌉qi(x/b) ≤ y x · qi(y/b) qi(x/b) ≤ y x · (y/b)p′ (x/b)p′ ≤ 1 since p′ ∈ [0, 1]. This gives us monotonicity. We now combine the approximations of Corollary 28 with Corollary 26 to give our improved Schatten norm estimation algorithm. Lemma 29 (Schatten Norms via Polynomial Approximation). For any A ∈ Rn×d with kAk2 ≤ 1, d2/p (cid:19)kAk2 p > 0 and error parameter ǫ ∈ (0, 1), for sufficiently small c1, c2, let α = 1/2, λ =(cid:18) c2/p p, and γ = c2ǫ. For t ≥ 0 define Rt, hγ , and ¯Rt as in Lemma 25. Let qt(x) be as defined in Corollary 28 with p′ = p/2, ǫ′ = c3ǫ for sufficiently small c3 and [a, b] = Rt. With probability 9/10: ⌈log 1/λ⌉Xt=0 (AT A)AT A) ∈ (1 ± ǫ)kAkp p . Sqt(hγ (21) Proof. We apply Corollary 26 to AT A, with f (x) = xp/2, ǫ = c1ǫ, γ = c2ǫ and α = 1/2. qt ǫ2/p Rt Rt 1 Plugging in α = 1/2, γ = c2ǫ into (19) we have: satisfies the necessary conditions by Corollary 28. Further, we have λf (c1ǫ) =(cid:18) c2/p 1/2 ± c1ǫ(cid:19)Sf (AAT ) = kAkp (AT A)AT A) ∈(cid:18)1 ± c3ǫ ± Sqt(hγ 40c2ǫ Rt p 1 ⌈log 1/λ⌉Xt=0 ǫ2/p d2/p (cid:19)kAk2 p = λ. max{p, 1/p3} which gives (1 ± ǫ) approximation if we set c1, c2, c3 small enough. Theorem 30 (Schatten Norm Polynomial Approximation Algorithm). For any A ∈ Rn×d, p > 0 and k ∈ [d] there is an algorithm returning X ∈ (1 ± ǫ)kAkp O(cid:18)nnz(A)k + dkω−1 + ǫmax{3,1+1/p} ·hnnz(A) +pnnz(A)[d · ds(A) + dk] · (d/k)max{0,1/p−1/2}i(cid:19) ǫmax{3,1+1/p} ·h(nnz(A) + dk)(d/k)1/pi(cid:19) kmax{0,1/p−1/2}#! or O(cid:18)nnz(A)k + dkω−1 + ǫmax{3,1+1/p} ·"nd + max{p, 1/p3} O ndω(logd k)−1 + max{p, 1/p3} p that runs in time: time for sparse A or n1/2d1+1/p for dense A. 31 ¯κt = Similarly, κt = σ2 k+1(A) at ≤ 1 δ2/p t dat i (A) p for some δt ≥ ǫ, k=1 σ2 1 δ2/p d2/p · kAk2 k(A) +Pd kσ2 k(cid:1)2/p (cid:0) d (AT A)AT A)) up to multiplicative error 1 ± O(cid:16) k(cid:19)2/p−1 t (cid:18) d ≤ . . We can further optimize our ǫ dependence by noting that it suffices to approximate tr(qt(hγ Rt since even if there are d singular values below at−1, they will contribute at most a δt fraction of kAkp p. So our total cost of approximating the trace for each of our windows using the first runtime of Theorem 7 is: ǫ (AT A)AT A) = tr(qt(hγ Rt Proof. We apply Lemma 29, first scaling A so that kAk2 ≤ 1. We apply a trace estimator to approximate Sqt(hγ (AT A)AT A)) up to (1 ± ǫ) multiplicative error plus very small additive error for each of our O(log 1/λ) = O(max{1, 1/p}) windows. The trace estima- tion requires O(cid:16)⌈p⌉ǫ2(cid:17) applications of hγ (AT A)AT A, since the degree of qt as given in Corollary 28 is O(1) + p. Rt Rt (AT A)AT A to a vector is given by Theorem 7. Following the argument The cost to apply hγ Rt in Corollary 12, if we write at = δ2/p t min{1,δt} log(1/λ)(cid:17)   1 δ1/p t · t ǫ2 ⌈log 1/λ⌉Xt=0 min{1, δt}2 · ⌈p⌉(log 1/λ)2 nnz(A) +pnnz(A)[d · ds(A) + dk] · (d/k)1/p−1/2 O Factoring out the nnz(A) +pnnz(A)[d · ds(A) + dk] · (d/k)1/p−1/2 term, we have: O ⌈log 1/λ⌉Xt=0 = O(cid:18) max{p, 1/p2} min{1, δt}2 · max{p, 1/p2} ǫ1/p−2(cid:18)1 + + X{t:δt≥1} + ... + ǫ1/p−2(cid:19) + log(1/λ)(cid:21)(cid:19) .  = O max{p, 1/p2} · X{t:δt<1} ǫ · δ1/p δ1/p−2 t ·(cid:20) 41/p−2 21/p−2 ǫ3δ1/p ǫ3 ǫ3 + 1 1 1 1 t Note that if p > 2, 1/p − 2 < 0 the terms in the geometric sum are increasing so the largest term is ǫ1/p−2 and so the whole thing is dominated by O( p log(1/λ) ǫ3 ). If p < 2, then the largest term in the geometric sum is 1 as so similarly the whole thing is O( 1/p2 log(1/λ) ǫmax{3,1+1/p} ) = O( ǫmax{3,1+1/p} ). A similar argument gives the runtimes for standard iterative and dense methods. Adding in the cost for deflation-based preconditioning gives the final runtimes. Note that while λ depends on kAkp p which is unknown, it again suffices to lower bound the truncation point using σp k kAkp k(A) ≤ 1 p. This lower bound gives only a better approximation and our bounds on ¯κt and κt still hold. ) = O( p 1/p3 ǫ3 7 Optimized Runtime Results The runtimes given in Theorem 30 are quite complex, with many tradeoffs depending on the properties of A. In this section, we instantiate the theorem showing how to optimize k and achieve our final runtime bounds. For simplicity, we consider the case when n = d. 7.1 Schatten p-Norms We first tackle the relatively simply case when A is dense. 32 Theorem 31 (Schatten p-Norms for Dense Matrices). For any p ≥ 0 and A ∈ Rn×n there is an algorithm returning X ∈ (1 ± ǫ)kAkp O(cid:18) p which runs in O(p · n2/ǫ3) time for p ≥ 2 and p3 · ǫmax{3,1+1/p} · n 1+.0435p (cid:19) 2.3729−.0994p 1 time for p < 2. If we do not use fast matrix multiplication the runtime is O(cid:18) 1 p3·ǫmax{3,1+1/p} · n 3+p/2 1+p/2(cid:19). Note that for the important case of p = 1 our runtime is O(n2.18/ǫ3) or O(n2.33/ǫ3) if we do not use fast matrix multiplication. As p approaches 0, our runtime approaches O(nω) which is natural, as p = 0 gives the matrix rank, which seems difficult to determine. As p approaches 2 the runtime smoothly approaches O(n2/ǫ3), which is then required for all p ≥ 2. Proof. The bound for p ≥ 2 follows immediately from Theorem 30 with k set to 0. For p < 2 we have runtime: O nω(logn k) + p3 · ǫmax{3,1+1/p} ·" n3/2+1/p k1/p−1/2#! 1 We can partially optimize this term, ignoring p and ǫ factors for simplicity and setting k to equalize 1/p−1/2 1/p+1/2 the coefficients on n. Our optimization is identical to the argument in Corollary 12 (set k = n when not using fast matrix multiplication), giving the stated runtimes. We now tackle the more complex case when A is sparse. We first consider p ≥ 2. Theorem 32 (Schatten p-norms, p ≥ 2, for Sparse Matrices). For any p ≥ 2, and A ∈ Rn×n there is an algorithm returning X ∈ (1 ± ǫ)kAkp p with high probability in time: O(cid:16) p ǫ3 ·pnnz(A)nds(A)(cid:17) or O(cid:16) p ǫ3hnnz(A)n 1 1+p + n1+ 2 1+pi(cid:17) Note that if our matrix is uniformly sparse, ds(A) = O(nnz(A)/n) and so the first runtime becomes O(p · nnz(A)/ǫ3). The second runtime can be better when A is not uniformly sparse. Proof. The first runtime follows by setting k = 0 in Theorem 30. Note that nnz(A) ≤pnnz(A)nds(A). For the second, we use the second runtime of Theorem 30 which gives O(cid:16)nnz(A)k + nkω−1 + ǫ3 ·h(nnz(A) + nk)(n/k)1/pi(cid:17) k(cid:1)1/p to balance the coefficients on the nnz(A) terms gives k = n 1 1+p which yields the result. Note that the nkω−1 term is dominated by the cost of the regressions, even if we do not use fast matrix multiplication this term will be nk2. Setting k =(cid:0) n p Finally, we consider the most complex cost, p ≤ 2 for sparse matrices. We have: Theorem 33 (Schatten p-norms, p ≤ 2, for Sparse Matrices). For any p ∈ (0, 2], and A ∈ Rn×n there is an algorithm returning X ∈ (1 ± ǫ)kAkp p3 · ǫmax{3,1/p} ·(cid:20)nnz(A)n 1/p+1/2√γs +pnnz(A) · n p with high probability in time: O(cid:18) 1/p−1/2 1 or O(cid:18) 1 p3 · ǫmax{3,1/p}hnnz(A)n 1 1+p + n1+ 2 4/p−1 2/p+1(cid:21)(cid:19) 1+pi(cid:19) where γs = ds(A)n nnz(A) ≥ 1. 33 Note that in the special case of p = 1 the first runtime gives O(cid:16) 1 The second term here is at worst n2, and could be much smaller for sparse A. ǫ3hnnz(A)n1/3√γs +pnnz(A)ni(cid:17). Proof. For the second runtime, we use the second runtime of Theorem 30, balancing costs exactly 1 as in Theorem 32 (setting k = n 1+p ). For the first runtime, we consider the first runtime of Theorem 30 which gives: O(cid:18)nnz(A)k + nkω−1 + O nds(A)k γs 1 p3 · ǫmax{3,1/p} ·hnnz(A) +pnnz(A)[n · ds(A) + nk] · (n/k)1/p−1/2i(cid:19) k(cid:17)1/p−1/2! # ·(cid:16) n p3 · ǫmax{3,1/p} ·" nds(A) + npds(A)√k + nkω−1 + √γs 1 Ignoring ǫ, p, and γs dependence, one way we can balance the costs is by setting: nds(A)k = nds(A)(cid:16) n k(cid:17)1/p−1/2 1/p−1/2 1/p+1/2 and final runtime: which gives k = n 1 p3 · ǫmax{3,1/p} ·(cid:20)nnz(A)n O(cid:18) p3 · ǫmax{3,1/p} ·(cid:20)nnz(A)n O(cid:18) 1/p−1/2 1/p+1/2√γs + npds(A)/γs · k3/2(cid:21)(cid:19) = 2/p+1 (cid:21)(cid:19) . 1/p+1/2√γs + npds(A)/γs · n 3/p−3/2 1/p−1/2 1 Note that we drop the nkω−1 term as it is dominated by the last term with k3/2 in it. This gives our final result by noting that ds(A)/γs = nnz(A)/n, the average row sparsity. 1/p−1/2 p3(cid:20)nnz(A)n 7.2 Constant Factor Approximation without Row-Sparsity Dependence Theorem 34 (Removing the Uniform Sparsity Constraint). Let γ ∈ (0, 1), p ≥ 1, and A ∈ Rn×n. There is an algorithm returning X with kAkp ≤ X = O(1/γ)kAkp with high probability in time 2/p+1(cid:21)(cid:19) for p < 2. O(p nnz(A)nγ) for p ≥ 2, and in time O(cid:18) 1 1/p+1/2 +γ/2 +pnnz(A) · n Proof. For i ∈ {1, 2, . . . ,⌈ 1 γ⌉}, let Ai ∈ Rn×n be the matrix whose rows agree with that of A , nγ(i+1)· nnz(A) provided the number of non-zero entries in these rows are in the interval [nγi· nnz(A) ), while the remaining rows of Ai are set to 0n. Let A0 = A −P⌈ 1 γ ⌉ i=1 Ai. Since p ≥ 1 we can apply i kAikp. 1 γ ⌉ + 1) max the triangle inequality, kAikp ≤ (⌈ kAkp ≤ (22) ⌈ 1 4/p−1 n n γ ⌉Xi=0 For any matrix B obtained from a matrix A by replacing some rows of A with 0n and preserving the remaining rows, kBkp ≤ kAkp. This follows from the fact that kBxk2 ≤ kAxk2 for all vectors x, together with the min-max theorem for singular values. Hence, kAkp ≥ max i kAikp. 34 (23) Combining (22) and (23), an O(1)-approximation to maxi kAikp is an O( 1 γ )-approximation to kAkp. We remove the zero rows from the Ai, obtaining corresponding matrices Bi. By definition of Ai, the number of rows in Bi is at most n1−γi. For each Bi, which is an si × n matrix for si ≤ n1−γi, we can right-multiply it by an n × ti OSNAP matrix Ti, with ti = O(n1−γi log n) columns and O(log n) non-zero entries per column, so that kBiTikp = (1 ± 1/2)kBikp for all i with probability 1 − 1/ poly(n), see [Coh16] (the fact that kBiTikp = (1 ± 1/2)kBikp follows from the fact that Ti is a subspace embedding of the row space of Bi together with Lemma C.2 of [LNW14]). The time to compute Ci = BiTi is O(nnz(A)). Since Ti has O(log n) non-zero entries per row, each row of Ci has a number of non-zero entries within an O(log n) factor of the corresponding row of Bi. Let di s denote the parameter ds when run on Ci. Then di We compute O(1)-approximations to the kCikp for each i, and then take the maximum over i. To do so, for p ≥ 2 we run the algorithm of Theorem 32 on each Ci, while for p < 2 we run the algorithm of Theorem 33. log n). We can assume Ci is a square ti × ti matrix by padding with zeros, where ti = O(n1−γi log n). Hence, s = O(nnz(A)nγ log n). Also, nnz(Ci) = O(nnz(Bi) log n) = O(nnz(A) log n). tidi The total time to apply Theorem 32 for p ≥ 2 across all Ci is O(p nnz(A)nγ). The total time 2/p+1(cid:21)(cid:19), to apply Theorem 33 for p < 2 across all Ci is O(cid:18) 1 p3(cid:20)nnz(A)n 1/p+1/2 +γ/2 +pnnz(A) · n using that the γs of that theorem is O(nγ log n). s = O(nγi+γ nnz(A) 1/p−1/2 4/p−1 n 7.3 SVD Entropy In this section, we will show how to approximately estimate the SVD entropy of a matrix A def = σ1(A)/σn(A) to be bounded by nc1. Recall that the SVD assuming its condition number K is the matrix entropy of a matrix A is given by H(B) A scaled inversely by its Schatten 1-norm. Using the results in Section 7.1, we obtain a (1 + ǫ) def = A kAk1 def = −Pi σi(B) log σi(B), where B approximation Z to kAk1 i.e., kAk1 ≤ Z ≤ (1 + ǫ)kAk1. Define eB Z (cid:19)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) +(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)Xi kAk1(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)H(eB) − H(B)(cid:12)(cid:12)(cid:12) =(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)Xi (cid:18)σi(A) ≤(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)Xi σi(A)(cid:18) 1 1 + ǫ(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)Xi kAk1 − Z(cid:19) log kAk1(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) The following thoerem gives our main result for SVD entropy. + ǫ ≤ 2ǫ log n. kAk1 − σi(A) kAk1 kAk1 def= A σi(A) σi(A) σi(A) σi(A) σi(A) ≤ log log Z 1 log ǫ Z . This means that σi(A) Z log kAk1 Z (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Theorem 35. Given any PSD A ∈ Rn×n and error parameter ǫ ∈ (0, 1). Then, there exists an algorithm that computes the approximate SVD entropy of A and outputs S, such that, with probability 9/10 S ∈ (1 ± O(ǫ))H(B), (24) where B = A kAk1 . The runtime of the algorithm will be 2√ds 3 O nnz(A)n 1 3 + n ǫ6 log(1/ǫ)! , 35 Algorithm 2 SVD entropy estimation via multi-point interpolation. for i = 1 : k1 do Z , where Z is a (1 + ǫ) approximation to kAk1. Input: A ∈ Rn×n, ǫ ∈ (0, 1). Output: Approximate SVD entropy S. Compute eB = A Choose k1 points α1,··· , αk1 as in (25), and seteǫ = ǫ/(12c1(k1 + 1)3 log n). Compute Z1+αi, a (1 +eǫ) -approximation for Schatten norm(cid:13)(cid:13)(cid:13)eB(cid:13)(cid:13)(cid:13)1+αi 1+αi (eB). end for Return S an estimate of T (0) by interpolation using the points T SV D 1+αi (eB) = (1 − Z1+αi/Z 1+αi)/αi. Compute T SV D . where ds(A) = O(nnz(A)/n), and ǫ = O( ǫ log n ). The algorithm depends on the βth SVD Tsallis entropy T SV D The algorithm we consider to estimate the SVD entropy of eB follows the techniques of [HNO08]. (eB) of matrix eB, which is given by β β 1 −(cid:13)(cid:13)(cid:13)eB(cid:13)(cid:13)(cid:13) β − 1 β . T SV D β (eB) = We can describe the multi-point interpolation method for SVD entropy estimation with additive and multiplicative error approximations using [HNO08, Algorithm 1], see Algorithm 2. Here, given an error parameter ǫ, we compute an approximate SVD Tsallis entropy T SV D def = log 1 1+αi at k1 ǫ + log c1 + log log n. α1,··· , αk1 are defined different points {1 + α0, . . . , 1 + αk1}, where k1 as follows. Let ℓ def = 1/(2c1(k1 + 1) log n) and let g(·) be defined as: g(y) = k2 1ℓy − ℓ(k2 1 + 1 2k2 1 + 1) , then, αi def = g(cos(iπ/k1)). (25) 2c1(k1+1) log n . We have smallest power Schatten norm. We get the smallest power when αi = k1 = log(1/ǫ) such Schatten norms to be estimated. Thus, we obtain the runtime in Theorem 35 by Algorithm 2 gives the stepwise algorithm. The runtime of the algorithm is dominated by the , particularly the −1 Now define an error parametereǫ def= ǫ/(12c1(k1 + 1)3 log n). cost of computing Z1+αi, a (1 +eǫ) -approximation for Schatten norm (cid:13)(cid:13)(cid:13)eB(cid:13)(cid:13)(cid:13)1+αi using p = α = O(cid:16)1 − 1 and observing that n1/ log(n/ǫ) is between 1 and 2 (we set p ≈ 1). Additive approximation : Section 3.3.2 of [HNO08] tells us that if in Algorithm 2, the ap- proximate T SV D log(n/ǫ)(cid:17) in the runtime for Schatten norm estimation given in Corollary 12, 1+αi (eB) is an additive eǫ approximation to T SV D use these to compute an additive-ǫ approximation to H(eB). Since and since(cid:13)(cid:13)(cid:13)eB(cid:13)(cid:13)(cid:13)1 1 log n multiplicative approximation to(cid:13)(cid:13)(cid:13)eB(cid:13)(cid:13)(cid:13)1+αk1 approximation can be obtained using the results of Section 7.1. 1+αi (eB) for every i ∈ [k1], then we can −1 1 log n , 16c1k3 suffices. This 2c1k1 log n < αi < = 1, obtaining 1 16c1k3 −1 36 1+αi (B) at each αi. If the matrix has reasonable (large) SVD entropy (meaning the singular values are uniform and T SV D using results from section 7.1. This issue is equivalent to the 'heavy element' issue (one of the entries in the vector is very large) discussed in [HNO08]. Hence, to overcome the above issue, we can follow the workaround However, if the matrix has very small entropy, i.e., we have one singular value with very large mag- nitude and remaining singular values are very small, then achieving a multiplicative approximation will be difficult. This is because, we are approximating T SV D Multiplicative approximation : Article [HNO08] further extends the multi-point interpola- tion method to achieve multiplicative approximation for Shannon entropy (equivalently for SVD entropy) using the following modifications. We set the number of interpolation points k1 = max{5, log(1/ǫ)}. Then, section 3.4 in [HNO08] shows that if T SV D i ∈ [k1] computed are to be (1 +eǫ)-multiplicative approximation to T SV D above), then we can achieve multiplicative approximation for H(B) using the multi-point interpo- lation method with these T SV D the T SV D 1+αi (eB) (in Algorithm 2) for every 1+αi (B) (whereeǫ is as defined 1+αi (eB). So, we need to obtain (1 +eǫ)-relative error approximations to there is no one singular value that is very large), then we can obtain (1 ±eǫ) approximation to the 1+αi (B) by simply computing (1 ±eǫ) approximation to (cid:13)(cid:13)(cid:13)eB(cid:13)(cid:13)(cid:13)1+αi 1+αi of eB, which is matrix A scaled by 1+αi (eB) a (1 ± ǫ) approximation of its Schatten 1-norm. The (1 +eǫ) approximation obtained for T SV D proposed in [HNO08]. Specifically, Lemma 5.5 in [HNO08] shows that a (1 +eǫ)-approximation to 1 − σ1 together with a (1 +eǫ)-approximation to Pj>1 σ1+αi singular values of B withPi σi = 1, suffices to get a (1 +eǫ)-approximation to T SV D follows that we just need to obtain (1 +eǫ)-approximations for these latter two quantities for each spectrum) is preserved, see Appendix C for the proof. This means we can get (1+eǫ)-approximations to both kA−1k1 and (kA−1k1+αi)1+αi , where A−1 is matrix A with the top singular vector exactly deflated off, by running the algorithm presented in this paper. That is, get the Schatten 1 and Schatten (1 + αi) norms for the matrix A with the top singular vector deflated off. We can also approximate kAk1 up to (1 +eǫ) relative error using our algorithm. Then, the two quantities above (1− σ1 andPj>1 σ1+αi ) are exactly kA−1k1/kAk1 and (kA−1k1+αi)1+αi/kAk1, respectively. Since we have relative (1 +eǫ)-approximations to the numerators and denominators of both these quantities, we obtain then up to (1 +eǫ)-relative error the quantities 1 − σ1 and Pj>1 σ1+αi , as needed to achieve a multiplicative approximation to the SVD entropy. Note that we do not need to compute kAk1 exactly here even when the matrix has very low SVD entropy. A similar argument can be seen in section 6 of [HNO08]. It can be shown that when the Krylov method [MM15] (or power method) is used to deflate the top singular vector, we have that any unitarily invariant norm of the tail (remaining part of the j j might not be close to T SV D 1+αi (B) in this case. αi. j , where σ1 ≥ σ2 ≥ . . . ≥ σn are the 1+αi (B) at αi. It Acknowledgements We thank Vladimir Braverman for pointing out an error in our original proof of Theorem 8, which has been corrected. References [ABB00] Orly Alter, Patrick O Brown, and David Botstein. Singular value decomposition for genome-wide expression data processing and modeling. Proceedings of the National 37 Academy of Sciences, 97(18):10101 -- 10106, 2000. [AKR15] Alexandr Andoni, Robert Krauthgamer, and Ilya P. Razenshteyn. Sketching and em- bedding are equivalent for norms. In Proceedings of the 47th Annual ACM Symposium on Theory of Computing (STOC), pages 479 -- 488, 2015. [AT11] [AZ17] Haim Avron and Sivan Toledo. Randomized algorithms for estimating the trace of an implicit symmetric positive semi-definite matrix. Journal of the ACM, 58(2):8, 2011. Zeyuan Allen-Zhu. Katyusha: The first direct acceleration of stochastic gradient methods. Proceedings of the 49th Annual ACM Symposium on Theory of Computing (STOC), 2017. [AZL16] Zeyuan Allen-Zhu and Yuanzhi Li. Faster principal component regression via optimal polynomial approximation to sgn(x). arXiv:1608.04773, 2016. [BCF09] Constantine Bekas, Alessandro Curioni, and I Fedulova. Low cost high performance uncertainty quantification. In Proceedings of the 2nd Workshop on High Performance Computational Finance, page 8. ACM, 2009. [BCKY16] Vladimir Braverman, Stephen R Chestnut, Robert Krauthgamer, and Lin F Yang. Sketches for matrix norms: Faster, smaller and more general. arXiv:1609.05885, 2016. [BDKZ15] Christos Boutsidis, Petros Drineas, Prabhanjan Kambadur, and Anastasios Zouzias. A randomized algorithm for approximating the log determinant of a symmetric positive definite matrix. arXiv:1503.00374, 2015. [BP14] [BS83] [Car14] Monami Banerjee and Nikhil R Pal. Feature selection with SVD entropy: some modi- fication and extension. Information Sciences, 264:118 -- 134, 2014. Walter Baur and Volker Strassen. The complexity of partial derivatives. Theoretical computer science, 22(3):317 -- 330, 1983. Petre Caraiani. The predictive power of singular value decomposition entropy for stock market dynamics. Physica A: Statistical Mechanics and its Applications, 393:571 -- 578, 2014. [CLM+15] Michael B. Cohen, Yin Tat Lee, Cameron Musco, Christopher Musco, Richard Peng, and Aaron Sidford. Uniform sampling for matrix approximation. In Proceedings of the 6th Conference on Innovations in Theoretical Computer Science (ITCS), pages 181 -- 190, 2015. [Coh16] Michael B. Cohen. Nearly tight oblivious subspace embeddings by trace inequalities. In Proceedings of the 27th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 278 -- 287, 2016. [CR12] Emmanuel J. Cand`es and Benjamin Recht. Exact matrix completion via convex opti- mization. Communications of the ACM, 55(6):111 -- 119, 2012. [Dem13] James Demmel. An arithmetic complexity lower bound for computing rational func- tions, with applications to linear algebra. submitted to SIMAX, 2013. 38 [DHJZ15] Haishun Du, Qingpu Hu, Manman Jiang, and Fan Zhang. Two-dimensional principal component analysis based on Schatten p-norm for image feature extraction. Journal of Visual Communication and Image Representation, 32:55 -- 62, 2015. [DKJ+07] Jason V Davis, Brian Kulis, Prateek Jain, Suvrit Sra, and Inderjit S Dhillon. Information-theoretic metric learning. In Proceedings of the 24th International Confer- ence on Machine Learning (ICML), pages 209 -- 216, 2007. [DNPS16] Edoardo Di Napoli, Eric Polizzi, and Yousef Saad. Efficient estimation of eigenvalue counts in an interval. Numerical Linear Algebra with Applications, 2016. [DTV11] Amit Deshpande, Madhur Tulsiani, and Nisheeth K. Vishnoi. Algorithms and hardness for subspace approximation. In Proceedings of the 22nd Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 482 -- 496, 2011. [FGKS15] Roy Frostig, Rong Ge, Sham M Kakade, and Aaron Sidford. Un-regularizing: approxi- mate proximal point and faster stochastic algorithms for empirical risk minimization. In Proceedings of the 32nd International Conference on Machine Learning (ICML), 2015. [FHT08] Jerome Friedman, Trevor Hastie, and Robert Tibshirani. Sparse inverse covariance estimation with the graphical lasso. Biostatistics, 9(3):432 -- 441, 2008. [FMMS16] Roy Frostig, Cameron Musco, Christopher Musco, and Aaron Sidford. Principal com- ponent projection without principal component analysis. 2016. [FORF16] JK Fitzsimons, MA Osborne, SJ Roberts, and JF Fitzsimons. Improved stochastic trace estimation using mutually unbiased bases. arXiv:1608.00117, 2016. [GHJ+16] Dan Garber, Elad Hazan, Chi Jin, Sham M. Kakade, Cameron Musco, Praneeth Ne- trapalli, and Aaron Sidford. Faster eigenvector computation via shift-and-invert pre- conditioning. In Proceedings of the 33rd International Conference on Machine Learning (ICML), 2016. Full version at arXiv:1605.08754. [GOSS16] Alon Gonen, Francesco Orabona, and Shai Shalev-Shwartz. Solving ridge regression us- ing sketched preconditioned SVRG. In Proceedings of the 33rd International Conference on Machine Learning (ICML), 2016. [GU17] [Gut92] [Gut01] Fran¸cois Le Gall and Florent Urrutia. Improved rectangular matrix multiplication using powers of the Coppersmith-Winograd tensor. arXiv:1708.05622, 2017. Ivan Gutman. Total π-electron energy of benzenoid hydrocarbons. In Advances in the Theory of Benzenoid Hydrocarbons II, pages 29 -- 63. Springer, 1992. Ivan Gutman. The energy of a graph: old and new results. In Algebraic combinatorics and applications, pages 196 -- 211. Springer, 2001. [GVL12] Gene H. Golub and Charles F Van Loan. Matrix computations, volume 3. JHU Press, 2012. [GXL15] Rongbao Gu, Wei Xiong, and Xinjie Li. Does the singular value decomposition entropy have predictive power for stock market? evidence from the shenzhen stock market. Physica A: Statistical Mechanics and its Applications, 439:103 -- 113, 2015. 39 [Hig08] Nicholas J Higham. Functions of matrices: theory and computation. SIAM, 2008. [HLM12] Moritz Hardt, Katrina Ligett, and Frank McSherry. A simple and practical algorithm for differentially private data release. In Advances in Neural Information Processing Systems 25 (NIPS), pages 2348 -- 2356. 2012. [HMAS17] Insu Han, Dmitry Malioutov, Haim Avron, and Jinwoo Shin. Approximating the spec- tral sums of large-scale matrices using Chebyshev approximations. SIAM Journal on Scientific Computing, 39(4), 2017. [HNO08] Nicholas JA Harvey, Jelani Nelson, and Krzysztof Onak. Sketching and streaming entropy via approximation theory. In Proceedings of the 49th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 489 -- 498, 2008. [Hut90] [Isa08] [JNS13] Michael F Hutchinson. A stochastic estimator of the trace of the influence matrix for Laplacian smoothing splines. Communications in Statistics-Simulation and Computa- tion, 19(2):433 -- 450, 1990. Garth Isaak. http://www.lehigh.edu/~gi02/m242/08linstras.pdf, 2008. Fast matrix multiplication and inversion, math 242 notes. Prateek Jain, Praneeth Netrapalli, and Sujay Sanghavi. Low-rank matrix completion using alternating minimization. In Proceedings of the 45th Annual ACM Symposium on Theory of Computing (STOC), pages 665 -- 674, 2013. [Jol02] Ian Jolliffe. Principal component analysis. Wiley Online Library, 2002. [JZ13] [KKS65] [KM09] [KO17] [KS70] [KS16] Rie Johnson and Tong Zhang. Accelerating stochastic gradient descent using predictive variance reduction. In Advances in Neural Information Processing Systems 26 (NIPS), pages 315 -- 323, 2013. V. V. Klyuev and N. I. Kokovkin-Shcherbak. Minimization of the number of arithmetic operations in the solution of linear algebra systems of equations. 5(1):25-43, 1965. translated by H. F. Cleaves. Jonathan A. Kelner and Aleksander Madry. Faster generation of random spanning trees. In Proceedings of the 50th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 13 -- 21, 2009. Ashish Khetan and Sewoong Oh. arXiv:1703.06327, 2017. Spectrum estimation from a few entries. N. I. Kokovkin-Shcherbak. Minimization of numerical algorithms for solving arbitrary systems of linear equations. 22(4):494-502, 1970. Rasmus Kyng and Sushant Sachdeva. Approximate gaussian elimination for Laplacians: Fast, sparse, and simple. In Proceedings of the 57th Annual IEEE Symposium on Foundations of Computer Science (FOCS), 2016. [KV16] Weihao Kong and Gregory Valiant. arXiv:1602.00061, 2016. Spectrum estimation from samples. 40 [KW92] [LG12] J Kuczy´nski and H Wo´zniakowski. Estimating the largest eigenvalue by the power and Lanczos algorithms with a random start. SIAM Journal on Matrix nalysis and Applications, 13(4):1094 -- 1122, 1992. In Pro- Fran¸cois Le Gall. Faster algorithms for rectangular matrix multiplication. ceedings of the 53rd Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 514 -- 523, 2012. [LM12] Chao Li and Gerome Miklau. Measuring the achievable error of query sets under differential privacy. arXiv:1202.3399, 2012. [LMP13] Mu Li, Gary L. Miller, and Richard Peng. Iterative row sampling. In Proceedings of the 54th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 127 -- 136, 2013. [LN15] Yu Lu and Sahand N Negahban. Individualized rank aggregation using nuclear norm regularization. In Communication, Control, and Computing (Allerton), 2015 53rd An- nual Allerton Conference on, pages 1473 -- 1479. IEEE, 2015. [LNW14] Yi Li, Huy L. Nguyen, and David P. Woodruff. On sketching matrix norms and the top singular vector. In Proceedings of the 46th Annual ACM Symposium on Theory of Computing (STOC), pages 1562 -- 1581, 2014. [LS14] 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 Proceedings of the 55th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 424 -- 433, 2014. [LSW15] Yin Tat Lee, Aaron Sidford, and Sam Chiu-wai Wong. A faster cutting plane method and its implications for combinatorial and convex optimization. In Proceedings of the 56th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 1049 -- 1065, 2015. [LSY16] Lin Lin, Yousef Saad, and Chao Yang. Approximating spectral densities of large ma- trices. SIAM Review, 58(1):34 -- 65, 2016. [LW16a] [LW16b] Yi Li and David P. Woodruff. On approximating functions of the singular values in a stream. In Proceedings of the 48th Annual ACM Symposium on Theory of Computing (STOC), 2016. Yi Li and David P. Woodruff. Tight bounds for sketching the operator norm, Schatten norms, and subspace embeddings. In Proceedings of the 20th International Workshop on Randomization and Computation (RANDOM), 2016. [LW17] Yi Li and David P. Woodruff. Embeddings of Schatten norms with applications to data streams. arXiv:1702.05626, 2017. [LYCG14] Lei Luo, Jian Yang, Jinhui Chen, and Yicheng Gao. Schatten p-norm based matrix re- gression model for image classification. In Pattern Recognition, pages 140 -- 150. Springer, 2014. 41 [MM15] Cameron Musco and Christopher Musco. Randomized block krylov methods for stronger and faster approximate singular value decomposition. In Advances in Neu- ral Information Processing Systems 28 (NIPS), pages 1396 -- 1404, 2015. [Mor73] Jacques Morgenstern. Note on a lower bound on the linear complexity of the fast Fourier transform. Journal of the ACM (JACM), 20(2):305 -- 306, 1973. [MST15] Aleksander Madry, Damian Straszak, and Jakub Tarnawski. Fast generation of random spanning trees and the effective resistance metric. In Proceedings of the 26th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2019 -- 2036, 2015. [Nes13] Yurii Nesterov. Introductory lectures on convex optimization: A basic course, volume 87. Springer Science & Business Media, 2013. [NHD12] Feiping Nie, Heng Huang, and Chris Ding. Low-rank matrix recovery via efficient Schat- ten p-norm minimization. In Twenty-Sixth AAAI Conference on Artificial Intelligence, 2012. [NNS+14] Praneeth Netrapalli, UN Niranjan, Sujay Sanghavi, Animashree Anandkumar, and Prateek Jain. Non-convex robust PCA. In Advances in Neural Information Processing Systems 27 (NIPS), pages 1107 -- 1115, 2014. [NWC+12] Feiping Nie, Hua Wang, Xiao Cai, Heng Huang, and Chibiao Ding. Robust matrix com- pletion via joint Schatten p-norm and lp-norm minimization. In Data Mining (ICDM), 2012 IEEE 12th International Conference on, pages 566 -- 574. IEEE, 2012. [Par98] Beresford N Parlett. The symmetric eigenvalue problem. SIAM, 1998. [Ras04] [Raz03] [RKA15] Carl Edward Rasmussen. Gaussian processes in machine learning. In Advanced lectures on machine learning, pages 63 -- 71. Springer, 2004. Ran Raz. On the complexity of matrix product. SIAM Journal on Computing, 32(5):1356 -- 1369, 2003. Farbod Roosta-Khorasani and Uri Ascher. Improved bounds on sample size for implicit matrix trace estimators. Foundations of Computational Mathematics, 15(5):1187 -- 1212, 2015. [RS03] Ran Raz and Amir Shpilka. Lower bounds for matrix product in bounded depth circuits with arbitrary gates. SIAM Journal on Computing, 32(2):488 -- 513, 2003. [Saa03] Yousef Saad. Iterative methods for sparse linear systems. SIAM, 2003. [Saa11] [Shp03] [SLO13] Yousef Saad. Numerical Methods for Large Eigenvalue Problems: Revised Edition, volume 66. SIAM, 2011. Amir Shpilka. Lower bounds for matrix product. SIAM Journal on Computing, 32(5):1185 -- 1200, 2003. Andreas Stathopoulos, Jesse Laeuchli, and Kostas Orginos. Hierarchical probing for es- timating the trace of the matrix inverse on toroidal lattices. SIAM Journal on Scientific Computing, 35(5):S299 -- S322, 2013. 42 [SS08] [SSZ14] [ST04] Daniel A. Spielman and Nikhil Srivastava. Graph sparsification by effective resistances. In Proceedings of the 40th Annual ACM Symposium on Theory of Computing (STOC), pages 563 -- 568, 2008. Shai Shalev-Shwartz and Tong Zhang. Accelerated proximal stochastic dual coordi- nate ascent for regularized loss minimization. In Proceedings of the 31st International Conference on Machine Learning (ICML), pages 64 -- 72, 2014. 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 (STOC), pages 81 -- 90, 2004. [TB97] Lloyd N. Trefethen and David Bau. Numerical Linear Algebra. SIAM, 1997. [UCS17] Shashanka Ubaru, Jie Chen, and Yousef Saad. Fast estimation of tr(f(a)) via stochastic Lanczos quadrature. 2017. manuscript. [US16] Shashanka Ubaru and Yousef Saad. Fast methods for estimating the numerical rank of large matrices. In Proceedings of The 33rd International Conference on Machine Learning, pages 468 -- 477, 2016. [USS17] Shashanka Ubaru, Yousef Saad, and Abd-Krim Seghouane. Fast estimation of approx- imate matrix ranks using spectral densities. Neural Computation, 2017. [VGLH06] Roy Varshavsky, Assaf Gottlieb, Michal Linial, and David Horn. Novel unsupervised feature filtering of biological data. Bioinformatics, 22(14):e507 -- e513, 2006. [Wil12] [Wil15] Virginia Vassilevska Williams. Multiplying matrices faster than Coppersmith- Winograd. In Proceedings of the 44th Annual ACM Symposium on Theory of Computing (STOC), pages 887 -- 898, 2012. Virginia Vassilevska Williams. Hardness of easy problems: Basing hardness on popular conjectures such as the strong exponential time hypothesis (invited talk). In 10th Inter- national Symposium on Parameterized and Exact Computation, IPEC 2015, September 16-18, 2015, Patras, Greece, pages 17 -- 29, 2015. [Win70] Shmuel Winograd. On the number of multiplications necessary to computer certain functions. 23:165-179, 1970. [Win87] Shmuel Winograd. Arithmetic complexity of computations. 1987. [WLK+16] Lingfei Wu, Jesse Laeuchli, Vassilis Kalantzis, Andreas Stathopoulos, and Efstratios Gallopoulos. Estimating the trace of the matrix inverse by interpolating from the diagonal of an approximate inverse. Journal of Computational Physics, 326:828 -- 844, 2016. [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. [WW10] Virginia Vassilevska Williams and Ryan Williams. Subcubic equivalences between path, matrix and triangle problems. In Proceedings of the 51st Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 645 -- 654, 2010. 43 [WWZ14] Karl Wimmer, Yi Wu, and Peng Zhang. Optimal query complexity for estimating the trace of a matrix. In Proceedings of the 41st International Colloquium on Automata, Languages and Programming (ICALP), pages 1051 -- 1062, 2014. [XGL+16] Yuan Xie, Shuhang Gu, Yan Liu, Wangmeng Zuo, Wensheng Zhang, and Lei Zhang. Weighted Schatten p-norm minimization for image denoising and background subtrac- tion. IEEE transactions on image processing, 25(10):4842 -- 4857, 2016. [XQT+16] Y. Xie, Y. Qu, D. Tao, W. Wu, Q. Yuan, and W. Zhang. Hyperspectral image restora- tion via iteratively regularized weighted Schatten p-norm minimization. IEEE Trans- actions on Geoscience and Remote Sensing, PP(99):1 -- 18, 2016. [ZWJ15] Yuchen Zhang, Martin J Wainwright, and Michael I Jordan. Distributed estimation of generalized matrix rank: Efficient algorithms and lower bounds. In Proceedings of the 32nd International Conference on Machine Learning (ICML), 2015. 44 A Linear System Solvers In this section we give runtimes for solving ridge regression using both traditional iterative methods and stochastic gradient descent equipped with deflation-based preconditioning. We start with a few standard notions from convex optimization, which are necessary for our stochastic method bounds. Definition 36 (Strong convexity). A function f : Rd → R is µ-strongly convex if, for all x, y ∈ Rd, f (x) − f (y) ≥ ∇ f (y)T (x − y) + µ 2 kx − yk2 2 . Equivalently, if ∇2 f (cid:23) µI. Definition 37 (Smoothness). A function f : Rd → R is β-smooth if for all x, y ∈ Rd, f (x) − f (y) ≤ ∇ f (y)T (x − y) + β 2 kx − yk2 2 . Equivalently, if ∇2 f (cid:22) βI. The rate of convergence that iterative methods achieve on f typically depends on the ratio β/µ, which corresponds to the condition number of a linear system. We next show how ridge regression can be recast as minimizing a convex function f , and show that our error from the true ridge solution is proportional to error in minimizing f . Fact 38 (Ridge Regression as Convex Optimization). For any A ∈ Rn×d, b ∈ Rd, and λ > 0, let Mλ λ b. x∗ is the minimizer of the convex function: = AT A + λI and x∗ def def = M−1 f (x) = 1 2 xT (AT A + λI)x − bT x, (26) which has gradient ∇ f (x) = (AT A + λI)x − b. f is λ-strongly convex and (σ1(A)2 + λ)-smooth. Proof. To check that x∗ is the minimizer, notice that: ∇ f (x∗) = (AT A + λI)(AT A + λI)−1b − b = 0. Since the function is quadratic, x∗ is the unique minimizer. ∇2 f = Mλ, so by Definitions 36 and 37, f is λ-strongly convex and (σ1(A)2 + λ)-smooth. Fact 39 (Function Error Equals Norm Error). For any x ∈ Rd, letting Mλ, x∗ and f be defined as in Fact 38, kx − x∗k2 Mλ = 2[f (x) − f (x∗)]. (27) Proof. Since x∗ = M−1 λ b: kx − x∗k2 Mλ def= (x − x∗)T Mλ(x − x∗) = xT Mλx − 2xT Mλx∗ + x∗T Mλx∗ = xT Mλx − 2xT b + bT M−1 λ b = 2 [f (x) − f (x∗)] . We will focus on making multiplicative progress in [f (x) − f (x∗)] which will lead to multiplica- M and a close approximation in log(1/ǫ) iterations. tive progress in kx − x∗k2 45 A.1 Unaccelerated SVRG We first prove an unaccelerated and unpreconditioned runtime for the Stochastic Variance Reduced Gradient (SVRG) algorithm, introduced in [JZ13]. Theorem 40 (Standard SVRG Runtime). For any A ∈ Rn×d, b ∈ Rd, and λ > 0, let Mλ AT A + λI and x∗ def= M−1 in def= λ y. There is an algorithm that returns x with: Ekx − x∗kMλ ≤ ǫkx∗kMλ O "nnz(A) + ds(A)kAk2 F λ # · log(1/ǫ)! time. SVRG proceeds in epochs. In each epoch we will make one full gradient computation -- ∇ f (x0) = Mλx0 − b where x0 is the value of our iterate at the beginning of the epoch. We will then make a number of stochastic gradient updates each 'variance reduced' using ∇ f (x0) and show that we make constant factor progress on our function value in expectation. Stringing together log(1/ǫ) epochs yields Theorem 40. We write our function f (x) given by (26) as a sum: 1 2 = 1 2 i + f (x) = I! x − xT (AT A + λI)x − bT x xT aiaT nXi=1 λkaik2 kAk2 where ai ∈ Rd is the ith row of A and aiaT i ∈ Rd×d is the rank-1 matrix which is its contribution to AT A. We start with a well known lemma showing that it is possible to make constant progress on the value of f (x) in each epoch of SVRG: Lemma 41 (SVRG Epoch). Consider a set of convex functions {ψ1, ψ2, ..., ψn} mapping Rd → R. Let f (x) =Pn i=1 ψi(x) and x∗ = arg minx∈Rd f (x). Suppose we have a probability distribution p on [1, 2, ..., n] and that starting from some initial point x0 ∈ Rd in each iteration we select i ∈ [1, ..., n] with probability pi and set: bT x. (28) 1 n 2 F xk+1 := xk − η pi (∇ ψi(xk) − ∇ ψi(x0)) + η ∇ f (x0) for some step size η. If f is µ-strongly convex and if for all x ∈ Rd we have pi k∇ ψi(x) − ∇ ψi(x∗)k2 2 ≤ 2 ¯S [f (x) − f (x∗)] (29) (30) 1 nXi=1 f (xk) − f (x∗)# ≤ for some variance parameter ¯S then for all m ≥ 1 we have: 1 − 2η ¯S(cid:20) 1 E" 1 µηm m 1 mXk=1 + 2η ¯S(cid:21) · [f (x0) − f (x∗)] Consequently, if we pick η to be a small multiple of 1/ ¯S, then for m = O( ¯S/µ) we will decrease the error by a constant multiplicative factor in expectation. Proof. See for example Theorem 9 of [GHJ+16]. 46 n bT x and pi = kaik2 kAk2 F 2 I(cid:17) x − 1 2 F i + λkaik2 kAk2 2 xT(cid:16)aiaT 2 ≤ 2 ¯S [f (x) − f (x∗)] n b. Write x − x∗ = y for simplicity of notation. 2 aiaT + λkaik2 F !2 kAk2 nXi=1 kyk2 2 λ2 kaik2 kAk4 I y !# i y + F 2 To apply the above Lemma we need the variance bound: Lemma 42 (SVRG Variance Bound). If ψi(x) = 1 then letting ¯S = kAk2 F + 2λ we have: 1 nXi=1 2 2 F F 1 = i + nXi=1 i + λkaik2 kAk2 λkaik2 kAk2 pi k∇ ψi(x) − ∇ ψi(x∗)k2 Proof. We have ∇ ψi(x) =(cid:16)aiaT I(cid:17) x − 1 pi k∇ ψi(x) − ∇ ψi(x∗)k2 2 ·(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) I! y(cid:13)(cid:13)(cid:13)(cid:13)(cid:13) aiaT nXi=1 kAk2 kaik2 2 · yT(aiaT  1 nXi=1 λkaik2 = kAk2 kAk2 2 ! + 2 F ·" nXi=1 yT (aiaT nXi=1 λyT aiaT kaik2 kAk2 F F # F ·"yT AT Ay + + kyk2 2 λ2 kAk2 kAk2 F"kyk2 F # 2λkyk2 kAk2 F + 2λ)[f (x) − f (x∗)] ≤ kAk2 ≤ 2(kAk2 = kAk2 = kAk2 2λyT AAT y kaik2 i )2 + 2 i )2y Mλ Mλ + 2 2 2 F 2 F F F where the last step uses Fact 39. We can now plug this variance bound into Lemma 41 to prove Theorem 40 Proof of Theorem 40. Using Lemma 42 we can instantiate Lemma 41 with ¯S = kAk2 set F + 2λ. If we m = O(cid:18) ¯S µ(cid:19) = O kAk2 F + λ λ ! = O kAk2 λ ! F and η = O(cid:16) 1 kAk2 F +λ(cid:17) (which we can compute explicitly) then after an m step SVRG epoch: E" 1 m mXk=1 f (xk) − f (x∗)# ≤ 1 2 [f (x0) − f (x∗)] . If we choose k uniformly from [1, ..., m] this gives us E [f (xk) − f (x∗)] ≤ 1 2 [f (x0) − f (x∗)]. So stringing together log(1/ǫ) of these epochs and letting x0 = 0 in the first epoch gives the theorem. Each epoch requires m stochastic gradient steps given by (29), taking O(mds) = O(cid:16)kdsAk2 (cid:17) time plus nnz(A) time to compute ∇ f (x0), giving us the stated runtime. λ F 47 Note that, naively, to produce xk+1 we need O(d) time, not O(ds) time since our gradient step includes adding multiples of b and η ∇ f (x0) both of which might be dense vectors in Rd. However, in each epoch, we will just keep track of the coefficients of these two components in our iterate, allowing us to still compute (29) in O(ds) time. A.2 Unaccelerated SVRG with Deflation-Based Preconditioning i (A) 1 F λ i (A) i=1 σ2 nλ i=1 σ2 nλ If we assume that ds = O(cid:16) nnz(A) n (cid:17) (i.e. our rows are uniformly sparse) we see that the runtime of . ¯κ def= Pd = nnz(A) · Pd Theorem 40 is dominated by ds(A)kAk2 can be seen as an = σ2 def average condition number, which is always smaller than the condition number κ λ . This average condition number dependence means that SVRG can significantly outperform traditional iterative solvers that require a number of iterations depending on κ. However, this advantage is limited if kAk2 F is very concentrated in a few large singular values, and hence ¯κ ≈ κ. We can perform better in such situations by deflating off these large singular values and preconditioning with our deflated matrix, significantly 'flattening' the spectrum of A. This method was used in [GOSS16], and we follow their approach closely, giving our own proof for completeness and so that we can express runtimes in terms of the necessary parameters for our downstream results. In particular, we show that the preconditioning methods of [GOSS16] can be implemented efficiently for sparse systems. Theorem 43 (Preconditioned SVRG Runtime). For any A ∈ Rn×d, b ∈ Rd, and λ > 0, let where k ∈ [0, ..., d] is an input parameter. There Mλ is an algorithm that uses O(nnz(A)k log d + dkω−1) precomputation time for sparse matrices or O(ndω(1,1,logd k)−1 log d) for dense matrices after which, given any input y ∈ Rd, letting x∗ def= M−1 λ y the algorithm returns x with Ekx − x∗kMλ ≤ ǫkx∗kMλ def= AT A + λI. Let ¯κ def= i=k+1 σ2 dλ k(A)+Pd kσ2 i (A) in O (nnz(A) log(1/ǫ) + log(1/ǫ) [d · ds(A) + dk] ¯κ) time for sparse A or time for dense A. O(cid:0)log(1/ǫ)(nd + d2⌈¯κ⌉)(cid:1) Our ideal algorithm would compute the top k singular vectors of A and deflate these off our matrix to flatten the spectrum. However, for efficiency we will instead compute approximate singular vectors, using an iterative method, like simultaneous iteration or a block Krylov iteration. These algorithms give the following guarantee [MM15]: Lemma 44. There is an algorithm that, with high probability in O(nnz(A)k log d + dkω−1) time i AT Azi, k+1(A). For dense inputs the runtime can be sped up to O(ndω(1,1,logd k)−1 log d) 2 ≤ 2σk+1(A)2 and, for all i ≤ k, letting σ2 returns Z ∈ Rd×k such that(cid:13)(cid:13)A − ZZT A(cid:13)(cid:13)2 (cid:12)(cid:12)σi − σ2 i (A)(cid:12)(cid:12) ≤ 2σ2 by applying fast matrix multiplication at each iteration.4 def= zT [GOSS16] shows that we can build a good preconditioner from such a Z. Specifically: i 4Each iteration requires ndω(1,1,logd k)−1 ≥ dω(1,1,logd k) time since we assume n ≥ d, which dominates the O(dkω−1) time required to orthogonalize the approximate singular directions. 48 Lemma 45 (Theorem 5 of [GOSS16]). For any A ∈ Rn×d, b ∈ Rd, and λ > 0, given Z ∈ Rd×k satisfying the guarantees of Lemma 44, let P−1/2 = Z Σ−1/2ZT + Then we have: tr(P−1/2(AT A + λI)P−1/2) λd(P−1/2(AT A + λI)P−1/2) (I − ZZT ) qσ2 k + λ = O kσ2 where Σ−1/2 i,i = . 1 qσ2 i + λ k(A) +Pd i=k+1 σ2 λ i (A) + d! . Intuitively, after applying the preconditioner, all top singular values are capped at σ2 k(A), giving a much flatter spectrum and better performance when optimizing with SVRG. To make use of the above bound, we first define a preconditioned ridge regression problem. Definition 46 (Preconditioned Ridge Regression). For any A ∈ Rn×d, b ∈ Rd, and λ > 0, λ b. Letting P−1/2 be as described in Lemma 45, let Mλ = let Mλ P−1/2MλP−1/2 and define the preconditioned regression objective function by: = AT A + λI and x∗ def def = M−1 f (x) = 1 2 xT Mλx − bT P−1/2x. λ P−1/2b = P1/2(AT A + λI)−1b. f is minimized at x∗ = M−1 Fact 47 (Preconditioned Solution). For any x ∈ Rd, if kx − x∗k Mλ ≤ ǫkx∗k Mλ ǫkx∗kMλ Proof. We have x∗ = P1/2x∗ and so using the fact that kx − x∗k Mλ ≤ ǫkx∗k Mλ where x∗ is the minimizer of f (x). then(cid:13)(cid:13)P−1/2x − x∗(cid:13)(cid:13)Mλ ≤ can write: (cid:13)(cid:13)(cid:13)x − P1/2x∗(cid:13)(cid:13)(cid:13) Mλ ≤ ǫ(cid:13)(cid:13)(cid:13)P1/2x∗(cid:13)(cid:13)(cid:13) Mλ (cid:13)(cid:13)(cid:13)P−1/2x − x∗(cid:13)(cid:13)(cid:13)Mλ ≤ ǫkx∗kMλ . By Fact 47, we can find a near optimal solution to our preconditioned system and by multiplying by P−1/2 obtain a near optimal solution to the original ridge regression problem. We now show that our preconditioned problem can be solved quickly. We first give a variance bound as we did in Lemma 42 in the non-preconditioned case. Lemma 48 (Preconditioned Variance Bound). Let BT = [P−1/2AT ,√λP−1/2] so that BT B = P−1/2(AT A + λI)P−1/2 = Mλ. For i ∈ 1, ..., (n + d), let i(cid:1) x − 1 xT(cid:0)bibT bT P−1/2x ψi(x) = n + d 1 2 2 then letting ¯S = tr(P−1/2(AT A + λI)P−1/2: so that Pn+d i=1 ψi(x) = f (x). Set pi = kbik2 kBk2 F nXi=1 1 pi(cid:13)(cid:13)(cid:13)∇ ψi(x) − ∇ ψi(x∗)(cid:13)(cid:13)(cid:13) 49 2 2 ≤ 2 ¯S [f (x) − f (x∗)] . Proof. Write x − x∗ = y for simplicity of notation. Then we have: n+dXi=1 1 pi(cid:13)(cid:13)(cid:13)∇ ψi(x) − ∇ ψi(x∗)(cid:13)(cid:13)(cid:13) 2 2 = kBk2 F n+dXi=1 (cid:13)(cid:13)bibT i y(cid:13)(cid:13)2 kbik2 2 2 i y F yT bi(bT i bi)bT kbik2 n+dXi=1 = kBk2 = kBk2 F · yT BT By F · [ f (x) − f (x∗)] = 2kBk2 2 where the last step uses Fact 39. Finally we write: ¯S = kBk2 F = tr(BT B) = tr(P−1/2(AT A + λI)P−1/2). We can now combine this variance bound with Lemmas 41 and 45 to prove our preconditioned SVRG runtime. Proof of Theorem 43. Using Lemma 48 we can instantiate Lemma 41 with ¯S = kBk2 λI)P−1/2). Letting µ = λd(P−1/2(AT A + λI)P−1/2) be a lower bound on the strong convexity of f , by Lemma 45 we have: F = tr(P−1/2(AT A+ i (A) m = O(cid:18) ¯S i=k+1 σ2 λ λd(P−1/2(AT A + λI)P−1/2)! µ(cid:19) = O tr(P−1/2(AT A + λI)P−1/2) + d! . = O kσ2 k(A) +Pd ¯S(cid:1) = O(cid:16) 1 F(cid:17) which we will compute explicitly, then after an m 2 xT(cid:0)bibT and hence, E(cid:13)(cid:13)P−1/2x − x∗(cid:13)(cid:13)Mλ ≤ ǫkx∗kMλ n+d bT P−1/2x each selected , we make constant progress in expectation on f (x). After log(1/ǫ) i(cid:1) x − 1 step SVRG epoch running on the functions ψi(x) = 1 with probability pi = kbik2 kBk2 iterations we have x with Ekx − x∗k Mλ ≤ ǫkx∗k Mλ by Fact 47. It remains to bound the cost of each SVRG epoch applied to f (x). If we set the step size η = O(cid:0) 1 For dense inputs, the argument is relatively simple. We can compute the approximate top singular vector space Z ∈ Rd×k in O(ndω(1,1,logd k)−1 log d) time by Lemma 44. Using the factored structure of P−1/2, we can explicitly form AP−1/2 and P−1/2 also in (O(ndω(1,1,logd k)−1) time. This allows us to compute a full gradient in O(nd) time (which we do once per epoch) and perform each stochastic gradient step in O(d) time (which we do m times per epoch). This gives final runtime kBk2 F 2 O ((nd + md) log(1/ǫ)) = O(cid:0)log(1/ǫ)(nd + d2⌈¯κ⌉)(cid:1) i (A) where ¯κ def = kσ2 k(A)+Pd i=k+1 σ2 dλ . For sparse A we have to be much more careful to fully exploit sparsity when preconditioning. Computing Z takes time O(nnz(A)k log d+dkω−1) by Lemma 44. We will not explicitly form P−1/2 but will show how to apply it when needed. Recall that P−1/2 = Z Σ−1/2ZT + δ(I − ZZT ) where we denote δ def= 1/(σ2 i + λ). First, in order to determine our step size η we must compute kBk2 F . kBk2 2 2 F F =(cid:13)(cid:13)(cid:13)AP−1/2(cid:13)(cid:13)(cid:13) =(cid:13)(cid:13)(cid:13)AZ Σ−1/2ZT(cid:13)(cid:13)(cid:13) + λ(cid:13)(cid:13)(cid:13)P−1/2(cid:13)(cid:13)(cid:13) + δ(cid:13)(cid:13)A(I − ZZT )(cid:13)(cid:13)2 F F 2 50 F + λ(cid:13)(cid:13)(cid:13)Z Σ−1/2ZT(cid:13)(cid:13)(cid:13) 2 F + λδ(cid:13)(cid:13)I − ZZT(cid:13)(cid:13)2 F . which can be computed in O(nnz(A)k) time with just a single multiplication of A by Z. Applying Pythagorean theorem and submultiplicativity we have: kBk2 We can similarly compute our sampling probabilities pi = kbik2 B2 F 2 2 2 F + δ kAk2 F − δ kAZk2 F =(cid:13)(cid:13)(cid:13)AZ Σ−1/2(cid:13)(cid:13)(cid:13) i Z Σ−1/2(cid:13)(cid:13)(cid:13) 2 = (cid:13)(cid:13)(cid:13)aT 2)(cid:19). This again requires just O(nnz(A)k) time. F + λ(cid:13)(cid:13)(cid:13)Z Σ−1/2(cid:13)(cid:13)(cid:13) 2 − δ(cid:13)(cid:13)aT i Z(cid:13)(cid:13)2 + δ kaik2 + δ(1 − kzik2 F 2 2 In each SVRG epoch we must compute one full gradient of the form: i = 1, ..., n, kbik2 λ(cid:18)(cid:13)(cid:13)(cid:13)zT i 2 2 Σ−1/2(cid:13)(cid:13)(cid:13) + λδ(d − k) quickly by noting that for 2 and for i = n + 1, ..., n + d, kbik2 2 = ∇ f (x0) = BT Bx0 − P−1/2b = P−1/2AT AP−1/2x0 + λP−1x0 − P−1/2b which takes O(nnz(A) + dk) time as P−1/2 can be applied to a vector in O(dk) time. Naively, we then must make m stochastic gradient steps, each requiring O(dk) time. However we can do better. Instead of storing our iterate xk explicitly, we will store it as the sum: k (cid:17) + Zx (1) (0) xk =(cid:16)x k − Zx k ∈ Rk and x(3) 0 = ZT x0 and x(3) (2) (2) k + x(3) k · ∇ f (x0). k (0) (1) k ∈ Rd, x k , x 0 = ZT x0, x(2) Note that x x(0) 0 = x0, x(1) is a scalar. At the beginning of each epoch we will set 0 = 0. We can compute ZT x0 in O(dk) time. We will (2) k will give k − Zx the component of xk within this span. maintain the invariant that (cid:16)x For ease of notation let an+i denote √λei where ei ∈ Rd the ith standard basis vector. In this way we have bi = P−1/2ai for all i ∈ 1, ..., n + d. Each stochastic gradient step is of the form: k (cid:17) is perpendicular to the span of Z while x (1) (0) xk+1 = xk − = xk + = xk + η P−1/2(aiaT pi(cid:16)∇ ψi(xk) − ∇ ψi(x0)(cid:17) + η ∇ f (x0) (P−1/2ai)(cid:16)(aT i P−1/2)xk − aT i )P−1/2(xk − x0) + η ∇ f (x0) η pi η pi i (P−1/2x0)(cid:17) + η ∇ f (x0). We can precompute P−1/2x0 in O(dk) time per epoch and then can compute the dot product (1) k (cid:17) is always perpendic- aT ular to the span of Z, we can write the dot product (aT i (P−1/2x0) in nnz(ai) = O(ds(A)) time. Using the fact that(cid:16)x i (cid:16)Z Σ−1/2ZT + δ(I − ZZT )(cid:17)(cid:16)(cid:16)x k (cid:17) + Zx k − Zx k + x(3) aT (1) (0) (1) (2) (0) k ∇ f (x0)(cid:17) i P−1/2)xk as: (0) k − Zx i (cid:16)x k (cid:17) + aT (2) k aT = δaT k + x(3) k − Zx i Z Σ−1/2x i Z Σ−1/2ZT ∇ f (x0) + δx(3) i (I − ZZT )∇ f (x0). We can precompute AZ in O(nnz(A)k) time. We can also precompute Z Σ−1/2ZT ∇ f (x0) and (I − ZZT )∇ f (x0) in O(dk) time. With these values in hand, computing the above dot product takes just O(nnz(ai) + k) = O(ds(A) + k) time. Now, we can write P−1/2ai = Z( ΣZT ai) − δ(I − ZZT )ai. Since we have precomputed AZ, (2) k with the appropriate weight in O(k) time. We can then ΣZT ai can be computed and added to x k aT 51 compute for the appropriate weight w: (cid:16)x (0) k+1 − Zx (1) k+1(cid:17) =(cid:16)x =(cid:16)x (0) (1) k − Zx k (cid:17) + w · (I − ZZT )ai k + w · ZT ai(cid:17) k + wai(cid:17) − Z(cid:16)x (0) (1) which takes time O(ds(A) + k). Finally, we set x(3) O(nnz(A) + dk + m(ds(A) + k)) and so our total runtime is: k+1 = x(3) k + η. Overall, our runtime per epoch is O (nnz(A) log(1/ǫ) + log(1/ǫ) [d · ds(A) + dk] ¯κ) i (A) kσ2 k(A)+Pd i=k+1 σ2 dλ . where ¯κ def = A.3 Accelerated and Preconditioned SVRG We now combine the deflation-based preconditioning described above with accelerated gradient methods to give our strongest runtime bound for ridge regression using via stochastic solvers. Theorem 49 (Accelerated Preconditioned SVRG Runtime). For any A ∈ Rn×d, b ∈ Rd, and λ > 0, let Mλ where k ∈ [0, ..., d] is an input parameter. There is an algorithm that uses O(nnz(A)k log d + dkω−1) precomputation time for sparse matrices or O(ndω(1,1,logd k)−1 log d) for dense matrices after which, given any input y ∈ Rd, letting x∗ def = M−1 λ y the algorithm returns x with Ekx − x∗kMλ ≤ ǫkx∗kMλ def= AT A+λI and ¯κdef= i=k+1 σ2 dλ k(A)+Pd i (A) kσ2 in O(cid:16)nnz(A) log(1/ǫ) + log(1/ǫ) log(d¯κ) ·pnnz(A)[d · ds(A) + dk]¯κ(cid:17) time for sparse A or time for dense A. O(cid:16)log(1/ǫ)(nd + n1/2d3/2 log(¯κ)√¯κ)(cid:17) The above runtime will follow from applying a blackbox technique for accelerating the runtime of convex optimization methods. While there are a number of improvements over this method [AZ17], we at most lose logarithmic factors and gain significant simplicity in our proofs. Lemma 50 (Theorem 1.1 of [FGKS15]). Let f (x) be µ-strongly convex and let x∗def= arg minx∈Rd f (x). 2 kx − x0k2 2. Let x∗γ,x0 For any γ > 0 and any x0 ∈ Rd, let fγ,x0(x) = arg minx∈Rd fγ,x0(x). Suppose that, for all x0 ∈ Rd, c > 0, γ > 2µ, we can compute xc such that c(cid:2)fγ,x0 − fγ,x0(x∗γ,x0)(cid:3) E(cid:2)fγ,x0(xc) − fγ,x0(x∗γ,x0)(cid:3) ≤ def = f (x)+ γ def 1 in time Tc. Then we can compute x1 such that E [f (x1) − f (x∗)] ≤ 1 c [f (x0) − f (x∗)] in time O T4(cid:16) 2γ+µ µ (cid:17)3/2pγ/µ log c! . 52 Proof of Theorem 49. We focus again on optimizing the preconditioned function f in Definition 46 as by Fact 47 a near optimal minimizer for this function yields a near optimal solution for our original ridge regression problem. We split fγ,x0 = 1 2 as 2 xT Mλx − bT P−1/2x + γ 2 kx − x0k2 fγ,x0 =Pn+d i=1 ψi γ,x0(x) where ψi γ,x0(x) = 1 2 xT (bibT i )x − 1 n + d bT P−1/2x + B is as defined in Lemma 48 with BT = [P−1/2AT ,√λP−1/2]. We have ∇ ψi γ,x0(x) = (bibT n+d bP−1/2 + γkbik2 kBk2 F 2 (x − x0). Letting y = x − x∗γ,x0, we can follow a similar calculation to Lemma 42 to show: 2 γ kbik2 F(cid:13)(cid:13) kx − x0k2 2(cid:13)(cid:13)B2 2 . i )x − 1 nXi=1 1 2 2 pi(cid:13)(cid:13)(cid:13)∇ ψi γ,x0(x) − ∇ ψi n+dXi=1 = kBk2 ≤ 2(kBk2 F + 2γ)[f (x) − f (x∗γ,x0)]. γ,x0(x∗γ,x0 )(cid:13)(cid:13)(cid:13) I)y(cid:13)(cid:13)(cid:13) i + γkbik2 kBk2 kbik2 2 (cid:13)(cid:13)(cid:13)(bibT F F 2 2 2 F and µ = λd(P−1/2(AT A + λI)P−1/2) be an lower bound on the strong convexity µ = r. The strong convexity of fγ,x0 is lower bounded by µγ = λd(P−1/2(AT A + Let ¯S = kBk2 of f . Denote γ λI)P−1/2) + γ = Θ(r · λd(P−1/2(AT A + λI)P−1/2)) which gives: = O kσ2 tr(P−1/2(AT A + λI)P−1/2) + 2γ λd(P−1/2(AT A + λI)P−1/2) + γ ¯S µγ = k(A) +Pd rλ d r! + i=k+1 σ2 i (A) kσ2 def = i (A) k(A)+Pd def= r = dκ So, by Theorem 43, for dense inputs, ignoring the O(ndω(1,1,logd k)−1 log d) precomputation cost to compute Z, P−1/2 and AP−1/2, which we only pay once, letting κ , we have 43. Otherwise, setting γ µ Tc = O(cid:16)log c ·(cid:16)nd + d2κ O T4(cid:16) 2γ+µ n we can solve f up to ǫ accuracy in time: r (cid:17)(cid:17). If nd ≥ d2κ then we already have runtime O(nd log(1/ǫ)) by Theorem µ (cid:17)3/2pγ/µ log(1/ǫ)! = O(cid:16)log(1/ǫ)n1/2d3/2 log(¯κ)√¯κ(cid:17) . i=k+1 σ2 dλ to compute Z and AZ. We have: For sparse inputs, we again ignore the one time precomputation cost of O(cid:0)nnz(A)k log d + dkω−1(cid:1) Tc = O(cid:16)log c ·(cid:16)nnz(A) + [d · ds(A) + dk] If nnz(A) ≥ [d · ds(A) + dk] ¯κ) then we already have runtime O(nnz(A) log(1/ǫ)) by Theorem 43. Otherwise, nnz(A) ≤ [d · ds(A) + dk] ¯κ. So setting r = ¯κ[d·ds(A)+dk] √nnz(A) r(cid:17)(cid:17) . we have: ¯κ O T4(cid:16) 2γ+µ µ (cid:17)3/2pγ/µ log(1/ǫ)! = O(cid:16)log(1/ǫ) log(d¯κ) ·pnnz(A)[d · ds(A) + dk]¯κ(cid:17) . 53 A.4 Preconditioned Iterative Methods Finally, we describe how to combine deflation-based preconditioning with standard iterative meth- ods, which can give runtime advantages over Theorem 49 in some parameter regimes. Theorem 51 (Preconditioned Iterative Method). For any A ∈ Rn×d, b ∈ Rd, and λ > 0, let where k ∈ [0, ..., d] is an input parameter. There is an algorithm Mλ that uses O(nnz(A)k log d + dkω−1) precomputation time after which, given any input y ∈ Rd, letting x∗ def λ y the algorithm returns x such that with high probability kx − x∗kMλ ≤ ǫkx∗kMλ in time def= AT A + λI and κ = = M−1 σ2 k+1(A) λ O(cid:16)log(1/ǫ)(nnz(A) + dk)√κ(cid:17) . Proof. If we form the preconditioner P−1/2 as in Lemma 45, by Lemmas 2 and 4 of [GOSS16] we have the preconditioned condition number bound: def = κ λ1(P−1/2MλP−1/2) λd(P−1/2MλP−1/2) = O σ2 k+1(A) λ ! Note that the bound in [GOSS16] is actually in terms of σ2 k+1(A) so that our theorem holds in the case that k = 0. This can be achieved with no effect on the asymptotic runtime by setting k to k + 1. k(A), however we write σ2 We can now apply any accelerated linear system solver, such as Chebyshev iteration, Conjugate Gradient, or Accelerated Gradient Descent [Saa03, Nes13] to obtain x with kx − x∗kMλ ≤ ǫkx∗kMλ in O(cid:16)log(1/ǫ)√κ · matvec(P−1/2(AT A + λI)P−1/2(cid:17) where matvec(P−1/2(AT A + λI)P−1/2 is the time required to multiply a single vector by this matrix. matvec(P−1/2(AT A + λI)P−1/2) = O(nnz(A) + dk) since P−1/2 = Z Σ−1/2ZT + δ(I − ZZT ) can be applied in O(dk) time. This gives the result combined with the precomputation time for P−1/2 from Lemma 44. B Additional Proofs: Lower Bounds Lemma 52 (Determinant Hardness). Given algorithm A which given B ∈ Rn×n returns X ∈ (1± ǫ) det(B) in O(nγǫ−c) time, we can detect if an n-node graph contains a triangle in O(nγ+12c) time. Proof. Let A ∈ Rn×n be the adjacency matrix of an n-node graph G. Let λ1, ..., λn denote its eigenvalues. Let B = I + δA for some δ which we will set later. We can write: det(B) = λi(B) = nYi=1 δk · Xi1<i2<...<ik The k = 0 term in (31) is 1, and the next two are easy to compute. δPn δ2Pi<j λiλj = δ2 nYi=1 2 (cid:16)Pi,j λiλj −Pi λ2 i(cid:17) = δ2 2 Pi λi tr(A) − δ2 2 kAk2 nXk=0 (1 + δλi) = λi1λi2...λik . i=1 λi = δ tr(A) = 0, and F /2. For k = 3 we F = −δ2 kAk2 (31) 54 have: δ3 Xi<j<k λiλjλk = δ3 3 Xi<j λiλj tr(A) −Xi6=j δ3 3 kAk2 tr(A3). F · tr(A) + δ3 3 = 0 − δ3 = 3 λ2 i λj tr(A3) 1 ≤ (nδλ1)k ≤ (n2δ)k since λ1 ≤ n. However, in order to obtain a tighter result, we will use stronger bounds for k = 4, 5. These bounds are very tedious but straightforward. Specifically: 1 λ2 λ3 λ3 λ4 δ4 = δ4 δ4 λ2 i λ2 δ4 = λ2 i λ2 = = λiλjλk − λiλjλkλl(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) δ4 Xi<j<k<l λi1λi2...λik(cid:12)(cid:12)(cid:12) ≤(cid:0)n k(cid:1)δkλk i λjλk(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) 2 Xi6=j6=k i λj(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) j −Xi6=j i(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) i −Xi We will bound the k > 3 terms by: (cid:12)(cid:12)(cid:12)δk ·Pi1<i2<...<ik 4 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) tr(A) Xi<j<k 8 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) tr(A)Xi6=j i λj −Xi6=j 8 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) j + tr(A)Xi6=j Xi6=j 8 (cid:12)(cid:12)(cid:12)kAk2 F − 2 tr(A4)(cid:12)(cid:12)(cid:12) ≤ 30(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) i λjλkλl(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) λiλjλkλlλm(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xi6=j6=k6=l 30(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) i λjλk(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) j λk + Xi6=j6=k 2 Xi6=j6=k 30(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) i λj(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) 5Xi6=j j +Xi6=j 30(cid:12)(cid:12)(cid:12)5(X λ2 i(cid:12)(cid:12)(cid:12) i ) − 6X λ5 i )(X λ3 λ1X λ4 δ5 Xi<j<k<l<m tr(A3) + λ2 i λ2 δ5n2 6 δ5n2 δ5 5 δ5n5 i λ3 λ2 δ4n4 . 4 δ5 δ5 δ5 = (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) δ5 = λ3 λ4 i tr(A3) + . 5 λ2 λ2 And similarly: = = ≤ ≤ 6 55 Finally, if we set δ = 1 10n4 then we have: δk · Xi1<i2<...<ik (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) nXk=4 λi1λi2...λik(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) δ4n4 4 ≤ + δ5n5 5 + δ5n2 6 ≤ δ3(cid:18) 1 40 δ3 30 ≤ + 1 500 + 1 600 + δ3 600 tr(A3). (n2δ)k tr(A3) + ∞Xk=6 tr(A3) +(cid:18) 1 103 + 1 105 + ...(cid:19)(cid:19) We then write: det(B) = 1 − δ2 kAk2 F 2 + δ3 tr(A3) 3 δ3 30 ± δ3 600 ± tr(A3). Since 1 ≤ δ3 · 103n12 and δ2kAk2 ≤ δ3 · 5n6 if we compute X ∈ (1 ± c1/n12) det(B) for sufficiently small constant c1 and subtract off (cid:16)1 − δ2kAk2 (cid:17), we will be able to determine if tr(A3) > 0 and hence detect if G has a triangle. So any algorithm approximating det(B) to (1±ǫ) error in O(nγǫ−c) time yields a triangle detection algorithm running in O(nγ+12c) time. 2 2 F F C Krylov and Power Methods preserve Invariant Norms In this section, we show that when the Krylov method [MM15] or the power method is used to deflate the top singular vectors of the matrix, any unitarily invariant norm of the tail (remaining part of the spectrum) is preserved. Let P = ZZ⊤ be the projector obtained for the top k singular vectors of A using the Krylov method [MM15] or the power method. Then, for any invariant norm of the tail to be preserved, we just need to show the following: σi((I − P)A) ≤ (1 + ǫ)σi(A − Ak) + ǫ n σ1(A). (32) Since P is a (1 + ǫ) approximation obtained in terms of the spectral norm , we have by the spectral low rank approximation guarantee of [MM15] that σ1((I− P)A) ≤ (1 + ǫ)σ1(A− Ak), where Ak is the best rank k approximation of A. Consider first any i for which σi(A−Ak) ≥ (1−ǫ)σ1(A−Ak) = (1 − ǫ)σk+1(A). Then we have, σi((I − P)A) ≤ σ1((I − P)A) ≤ (1 + ǫ)σk+1(A) ≤ (1 + ǫ) (1 − ǫ) σi(A − Ak) ≤ (1 + 3ǫ)σi(A − Ak). For any i with σi(A − Ak) < (1 − ǫ)σk+1(A), i.e., with σi+k(A) ≤ (1 − ǫ)σk+1(A) there is a large (> ǫ) relative gap between this singular value and σk. We have by the min-max characterization of singular values: σi((I − P)A) = Yrank(Y)=n−i+1(cid:18) min If we just set Y = Z, then we have: σn−k+1((I − P)A) ≤ max y∈span(Y)kyk2=1(cid:13)(cid:13)yT (I − P)A(cid:13)(cid:13)2(cid:19) y∈span(Z)kyk2=1(cid:13)(cid:13)yT (I − P)A(cid:13)(cid:13)2 = 0. max 56 It follows that the bottom k singular values are all 0, and so equal to the bottom k singular values of σi(A − Ak). Now, for i < n − k + 1, let UU denote the top i + k − 1 singular vectors of A and UL denote the bottom n − (i + k − 1) singular vectors. We set Y = [Z, UL]. First, we note that Y has k + n− (i + k − 1) = n− i + 1 columns and also rank(Y) = n− i + 1. This is because, if we consider YT Y, the top left k × k blocks is ZT Z = I and the bottom right n − i − k + 1 block is UT LUL = I. The off-diagonal entries in the top right and bottom left blocks are all bounded by 1/ poly(n); the proof of this latter statement is given in the latter part of this section, where we bound kZT ULk2. By the Gershgorin circle theorem [GVL12], all eigenvalues of YT Y are in the range 1 ± 1/ poly(n) and so the matrix is full rank. So, we have: σi((I − P)A) ≤ max y∈span(Y)kyk2=1(cid:13)(cid:13)yT (I − P)A(cid:13)(cid:13)2 . (33) Next, we can write y = [Z, UL]w for some w. By our argument above, every singular value of [Z, UL] lies in 1± 1/ poly(n). Then, we have kwk2 ≤ 1 + 1/ poly(n). Splitting w = w1 + w2, where w1 contains the first k coordinates of the vector and w2 contains the rest, we have: (I − P)y = (I − P)Zw1 + (I − P)ULw2 = 0 + (I − P)ULw2 = ULw2 − ZZT ULw2. Then, we have (cid:13)(cid:13)ZZT ULw2(cid:13)(cid:13)2 ≤(cid:13)(cid:13)ZT UL(cid:13)(cid:13)2 · kw2k2 ≤ 1/ poly(n), where the inequality comes from bounding(cid:13)(cid:13)ZT UL(cid:13)(cid:13)2 using the fact that all its entries are at most 1/ poly(n) (see the latter part of this section), and bounding kw2k2 ≤ kwk2 ≤ 1+1/ poly(n). Thus, finally we obtain: (cid:13)(cid:13)yT (I − P)A(cid:13)(cid:13)2 ≤(cid:13)(cid:13)wT 2 UT 2 UT LA(cid:13)(cid:13)2 +(cid:13)(cid:13)wT ≤ (1 + 1/ poly(n)) ·(cid:13)(cid:13)UT LZZT A(cid:13)(cid:13)2 LA(cid:13)(cid:13)2 + 1/ poly(n) · kAk2 σ1(A). ≤ (1 + 1/ poly(n))σi(A − Ak) + poly(n) 1 Plugging into (33) gives the proof of (32). Note that we can assume ǫ = o(1/ poly(n)), we can just compute the SVD. 1 poly(n) ≤ ǫ n since if Bound for (cid:13)(cid:13)ZT UL(cid:13)(cid:13)2 To see this, we first write AqΩ = ZTWT in its SVD form. Then, we have kuT i ZTk2 ≥ kuT : Let Z be an orthonormal basis for AqΩ from the power method (or pq(A)Ω from block Krylov method). Then, for any singular vector ui with corresponding singular value σi(A) with σi(A) ≤ (1 − ǫ)σk(A), we have kuT i AqΩk2 = kuT i Zk2τk,k, where τk,k is the kth diagonal entry of T. On the other hand, we also have kuT is the right singular vector corresponding to ui of A. 2 = O(k log n) with probability 1 − 1/n2 for a fixed vi Since Ω is i.i.d. Gaussian, we have kvT (see proof of Lemma 2.12 in [Woo14]). So, we can union bound over all n right singular vectors and the relation holds for all right singular vectors v ∈ V. We condition on this event. σi(A)q poly(n), thenkuT i AqΩk2 = O(σi(A)q√k log n). It follows that, if we show τk,k ≥ This event implies that kuT i Ωk2, where vT i Ωk2 i AqΩk2 = σi(A)qkvT i Zk2 ≤ 1/ poly(n). i Zk2 ≤ 1/ poly(n). i 57 for q = Θ((log n)/ǫ) (for the block Krylov method, we need to use higher number of iterations than For this, we have τk,k = σk(UΣqVT Ω) ≥ σk(UkUT kVT Next, to show that τk,k ≥ σi(A)q poly(n), it suffices to show τk,k ≥ σk(A)q√k. Indeed, note that required, which is q = Θ((log n)/√ǫ) [MM15]), by definition of i, we have σk(Aq)/σi(Aq) ≥ poly(n). k UΣqVT Ω) since σi(PA) ≤ σi(A) for any projection matrix P and any matrix A. Then, we have σk(UkUT k Ω) = σk(Σq k Ω) by the definition of the SVD, and that the columns of Uk are orthonormal. So, we get τk,k ≥ σk(Σq k Ω is a k × k matrix with i.i.d. Gaussian distribution due to the rotational invariance of the Gaussian distribution. Since the k-th singular value is the smallest √k · C with probability singular value of H and Σk, we then have σk(Σq at least 9/10, for an arbitrary constant C > 0, using standard properties of minimum singular values of squared Gaussian matrices (see e.g., Fact 6 in section 4.3 of [Woo14]). Thus, we have k UΣqVT Ω) = σk(UkΣq k(A)σk(H) ≥ σq kH), where H = VT kH) ≥ σq kVT k τk,k ≥ C√kσq k(A), which completes the proof. D Additional Proofs Claim 10. Let f : R+ → R+ be a δf -multiplicatively smooth function on the range [a, b]. For any x, y ∈ [a, b] and c ∈ (0, 1 3δf ) y ∈ [(1 − c)x, (1 + c)x] ⇒ f (y) ∈ [(1 − 3δf c)f (x), (1 + 3δf c)f (x)]. Proof. Let R denote the range [min(x, y), max(x, y)]. For y ∈ [(1 − c)x, (1 + c)x] we have: f (x) − f (y) ≤ x − y · sup z∈R f′(z) ≤ cx · δf supz∈R f (z) min(x, y) ≤ cδf supz∈R f (z) 1 − c . (34) Similarly, letting Z = supz∈R f (z) we have: and hence Z ≤ δf Z cδf Z min(x, y) ≤ Z − f (x) ≤ x − y 1 − c ≤ 1−(δf +1)c f (x). So plugging into (34) we have: cδf 1−c cδf c δf 1 − 1/3 − 1/3 f (x) − f (y) ≤ 1 − (δf + 1)c · f (x) ≤ 1 − 1/3 − 1/3 f (x) = 3δf f (x) which gives the result. 58
1905.00566
1
1905
2019-05-02T03:55:51
Graph Coloring via Degeneracy in Streaming and Other Space-Conscious Models
[ "cs.DS" ]
We study the problem of coloring a given graph using a small number of colors in several well-established models of computation for big data. These include the data streaming model, the general graph query model, the massively parallel computation (MPC) model, and the CONGESTED-CLIQUE and the LOCAL models of distributed computation. On the one hand, we give algorithms with sublinear complexity, for the appropriate notion of complexity in each of these models. Our algorithms color a graph $G$ using about $\kappa(G)$ colors, where $\kappa(G)$ is the degeneracy of $G$: this parameter is closely related to the arboricity $\alpha(G)$. As a function of $\kappa(G)$ alone, our results are close to best possible, since the optimal number of colors is $\kappa(G)+1$. On the other hand, we establish certain lower bounds indicating that sublinear algorithms probably cannot go much further. In particular, we prove that any randomized coloring algorithm that uses $\kappa(G)+1$ many colors, would require $\Omega(n^2)$ storage in the one pass streaming model, and $\Omega(n^2)$ many queries in the general graph query model, where $n$ is the number of vertices in the graph. These lower bounds hold even when the value of $\kappa(G)$ is known in advance; at the same time, our upper bounds do not require $\kappa(G)$ to be given in advance.
cs.DS
cs
Graph Coloring via Degeneracy in Streaming and Other Space-Conscious Models Suman K. Bera∗ Amit Chakrabarti∗ Prantar Ghosh∗ May 3, 2019 Abstract We study the problem of coloring a given graph using a small number of colors in several well- established models of computation for big data. These include the data streaming model, the general graph query model, the massively parallel communication (MPC) model, and the CONGESTED-CLIQUE and the LOCAL models of distributed computation. On the one hand, we give algorithms with sublinear complexity, for the appropriate notion of complexity in each of these models. Our algorithms color a graph G using about κ(G) colors, where κ(G) is the degeneracy of G: this parameter is closely related to the arboricity α(G). As a function of κ(G) alone, our results are close to best possible, since the optimal number of colors is κ(G) + 1. On the other hand, we establish certain lower bounds indicating that sublinear algorithms probably cannot go much further. In particular, we prove that any randomized coloring algorithm that uses at most κ(G) + 1 colors would require Ω(n2) storage in the one pass streaming model, and Ω(n2) many queries in the general graph query model, where n is the number of vertices in the graph. These lower bounds hold even when the value of κ(G) is known in advance; at the same time, our upper bounds do not require κ(G) to be given in advance. 1 Introduction Graph coloring is a fundamental topic in combinatorics and the corresponding algorithmic problem of coloring an input graph with few colors is a basic and heavily studied problem in computer science. It has numerous applications including in scheduling [TZP18, LS86, Lei79], air traffic flow management [BB04], frequency assignment in wireless networks [BB06, PL96], register allocation [Cha82, CH90, CAC+81]. More recently, vertex coloring has been used to compute seed vertices in social networks that are then expanded to detect community structures in the network [MOT14]. Given an n-vertex graph G = (V, E), the task is to assign colors to the vertices in V so that no two adjacent vertices get the same color. Doing so with the minimum possible number of colors -- called the chromatic number, χ(G) -- is famously hard: it is NP-hard to even approximate χ(G) to a factor of n1−ε for any constant ε > 0 [FK96, Zuc06, KP06]. In the face of this hardness, it is algorithmically interesting to color G with a possibly suboptimal number of colors depending upon tractable parameters of G. One such simple parameter is ∆, the maximum degree: a trivial greedy algorithm colors G with ∆ + 1 colors. We study graph coloring in a number of space-constrained and data-access-constrained settings, including the data streaming model and certain distributed computing models. In such settings, finding a coloring with "about ∆" colors is a fairly nontrivial problem that has been studied from various angles in a flurry of research over the last decade [ACK19,BCHN18,HSS16,CLP18,PS18,Bar16]. In a recent breakthrough (awarded Best ∗Department of Computer Science, Dartmouth College. Supported in part by NSF under Award CCF-1650992. 1 Paper at SODA 2019), Assadi, Chen, and Khanna [ACK19] gave sublinear algorithms for (∆ + 1)-coloring an input graph in such models. In this work, we focus on colorings that use "about κ" colors, where κ = κ(G) is the degeneracy of G, a parameter that improves upon ∆. It is defined as follows: κ = min{k : every induced subgraph of G has a vertex of degree at most k}. Clearly, κ (cid:54) ∆. There is a simple greedy algorithm that runs in linear time and produces (κ + 1)-coloring; see Section 2. However, just as before, when processing a massive graph under the constraints of either the space-bounded streaming model or certain distributed computing models, the inherently sequential nature of the greedy algorithm makes it infeasible. 1.1 Our Results and Techniques We obtain a number of algorithmic results, as well as several lower bound results. Algorithms. We give new graph coloring algorithms, parametrized by κ, in the following models: (1) the data streaming model, where the input is a stream of edge insertions and deletions (i.e., a dynamic graph stream) resulting in the eventual graph to be colored and we are limited to a work space of (cid:101)O(n) bits1, the so-called semi-streaming setting [FKM+05]; (2) the general graph query model [Gol17], where we may access the graph using only neighbor queries (what is the ith neighbor of x?) and pair queries (are x and y adjacent?); (3) the massively parallel communication (MPC) model, where each of a large number of memory-limited processors holds a sublinear-sized portion of the input data and computation proceeds using rounds of communication; (4) the congested clique model of distributed computation, where there is one processor per vertex holding that vertex's neighborhood information and each round allows each processor to communicate O(log n) bits to a specific other processor; and (5) the LOCAL model of distributed computation, where there is one processor per vertex holding that vertex's neighborhood information and each round allows each processor to send an arbitrary amount of information to all its neighbors. Model Number of Colors Streaming (one pass) Query MPC Congested Clique LOCAL ∆ + 1 κ + o(κ) ∆ + 1 κ + o(κ) ∆ + 1 κ + o(κ) ∆ + 1 κ + o(κ)(cid:63) O(αn1/k) O(αn1/k log n) (cid:101)O(n) space, (cid:101)O(n) space, ∆) post-processing time Complexity Parameters √ (cid:101)O(n (cid:101)O(n) post-processing time (cid:101)O(n3/2) queries (cid:101)O(n3/2) queries O(1) rounds, O(n log3 n) bits per processor O(1) rounds, O(n log2 n) bits per processor O(1) rounds O(1) rounds (cid:112) for k ∈(cid:2)ω(log log n), O( log n), o(log n)(cid:3) for k ∈(cid:2)ω( (cid:112) log n)(cid:3) O(k) rounds, O(k) rounds, Source [ACK19] this paper [ACK19] this paper [ACK19] this paper [CFG+18] this paper [KP11] this paper Table 1: Summary of our algorithmic results and basic comparison with most related previous work. In the result marked ((cid:63)), we require that κ = ω(log2 n). In the first two results, the number of colors can be improved to min{∆ + 1, κ + o(κ)} by running our algorithm alongside that of [ACK19]; in the streaming setting, this would require knowing ∆ in advance. Table 1 summarizes our algorithmic results and provides, in each case, a basic comparison with the most related result from prior work; more details appear in Section 1.2. As we have noted, κ (cid:54) ∆ in every case; 1The (cid:101)O(·) notation hides factors polylogarithmic in n. 2 indeed, κ could be arbitrarily better than ∆ as shown by the example of a star graph, where κ = 1 whereas ∆ = n − 1. From a practical standpoint, it is notable that in many real-world large graphs drawn from various application domains -- such as social networks, web graphs, and biological networks -- the parameter κ is often significantly smaller than ∆. See Table 2 for some concrete numbers. That said, κ + o(κ) is mathematically incomparable with ∆ + 1. Graph Name soc-friendster fb-uci-uni soc-livejournal soc-orkut web-baidu-baike web-hudong web-wikipedia2009 web-google bio-mouse-gene bio-human-gene1 bio-human-gene2 bio-WormNet-v3 ∆ E 2B V κ 305 66M 5K 17 59M 92M 5K 4M 214 28M 3K 3M 106M 27K 231 18M 98K 2M 83 2M 15M 62K 529 67 3K 5M 2M 65 5M 916K 6K 1K 14M 8K 43K 22K 12M 8K 2K 2K 7K 9M 14K 16K 763K 1K 165 Table 2: Statistics of several large real-world graphs taken from the application domains of social networks, web graphs, and biological networks, showing that the degeneracy, κ, is often significantly smaller than the maximum degree, ∆. Source: http://networkrepository.com [RA15]. The parameter κ is also closely related to the arboricity α = α(G), defined as the minimum number of forests into which the edges of G can be partitioned. It is an easy exercise to show that α (cid:54) κ (cid:54) 2α − 1. Perhaps even more than these results, our key contribution is a conceptual idea and a corresponding technical lemma underlying all our algorithms. We show that every graph admits a "small" sized low degeneracy partition (LDP), which is a partition of its vertex set into "few" blocks such that the subgraph induced by each block has low degeneracy, roughly logarithmic in n. Moreover, such an LDP can be computed by a very simple and distributed randomized algorithm: for each vertex, choose a "color" independently and uniformly at random from a suitable-sized palette (this is not to be confused with the eventual graph coloring we seek; this random assignment is most probably not a proper coloring of the graph). The resulting color classes define the blocks of such a partition, with high probability. Theorem 3.1, the LDP Theorem, makes this precise. Given an LDP, a generic graph coloring algorithm is to run the aforementioned minimum-degree-based greedy algorithm on each block, using distinct palettes for the distinct blocks. We obtain algorithms achieving our claimed results by suitably implementing this generic algorithm in each computational model. Lower Bounds. Recall that a graph with degeneracy κ admits a proper (κ + 1)-coloring. As Table 1 makes clear, there are several space-conscious (∆ + 1)-coloring algorithms known; perhaps we could aim for improved algorithms that provide (κ + 1)-colorings? We prove that this is not possible in sublinear space in either the streaming or the query model. In fact, our lower bounds prove more. We show that distinguishing n-vertex graphs of degeneracy κ from those with chromatic number κ + 2 requires Ω(n2) space in the streaming model and Ω(n2) queries in the general graph query model. This shows that it is hard to produce a (κ + 1)-coloring and in fact even to determine the value of κ. These results generalize to the problems of producing a (κ + λ)-coloring or estimating the degeneracy up to ±λ; the corresponding lower bounds are Ω(n2/λ2). Furthermore, the streaming lower bounds hold even in the insertion-only model, where the input stream is simply a listing of the graph's edges in some order; compare this with our upper bound, which holds even for dynamic graph streams. 3 A possible criticism of the above lower bounds for coloring is that they seem to depend on it being hard to estimate the degeneracy κ. Perhaps the coloring problem could become easier if κ was given to the algorithm in advance? We prove two more lower bounds showing that this is not so: the same Ω(n2/λ2) bounds hold even with κ known a priori. Most of our streaming lower bounds use reductions from the index problem in communication complexity (a standard technique), via a novel gadget that we develop here; one bound uses a reduction from a variant of disjointness. Our query lower bounds use a related gadget and reductions from basic problems in Boolean decision tree complexity. We conclude the paper with a "combinatorial" lower bound that addresses a potential criticism of our main algorithmic technique: the LDP. Perhaps a more sophisticated graph-theoretic result, such as the Palette Sparsification Theorem of Assadi et al. (see below), could improve the quality of the colorings obtained? We prove that this is not so: there is no analogous theorem for colorings with "about κ" colors. 1.2 Related Work and Comparisons Streaming and Query Models. The work closest to ours in spirit is the recent breakthrough of Assadi, Chen, and Khanna [ACK19]: they give a one-pass streaming (∆ + 1)-coloring algorithm that uses (cid:101)O(n) space (i.e., is semi-streaming) and works on dynamic graph streams. Their algorithm exploits a key structural result that they establish: choosing a random O(log n)-sized palette from {1, . . . , ∆ + 1} for each vertex allows a stream update quickly, but then spends (cid:101)O(n √ with the stream updates and has a faster (cid:101)O(n)-time post-processing step. Further, our algorithm is "truly compatible list coloring. They call this the Palette Sparsification Theorem. Their algorithm processes each ∆) time in post-processing. Our algorithm is similarly quick (∆ + 1)-coloring algorithm that makes (cid:101)O(n3/2) queries, followed by a fairly elaborate computation that runs in (cid:101)O(n3/2) time and space. Our algorithm has the same complexity parameters and is arguably much simpler: one-pass" in that it does not require foreknowledge of κ or any other parameter of the input graph, whereas the Assadi et al. algorithm needs to know the precise value of ∆ before seeing the stream. In the same paper, Assadi et al. also consider the graph coloring problem in the query model. They give a its post-processing is just the straightforward greedy offline algorithm for (κ + 1)-coloring. Another recent work on coloring in the streaming model is Radhakrishnan et al. [RSV15], which studies the problem of 2-coloring an n-uniform hypergraph. In the query model, there are a number of works studying basic graph problems [GR08, PR07, CRT05] but, to the best of our knowledge, Assadi et al. were the first to study graph coloring in this sense. Also, to the best of our knowledge, there was no previously known algorithm for O(α)-coloring in a semi-streaming setting, whereas here we obtain (κ + o(κ))-colorings; recall the bound κ (cid:54) 2α − 1. MPC and Congested Clique Models. The MapReduce framework [DG04] is extensively used in distributed computing to analyze and process massive data sets. Beame, Koutris, and Suciu [BKS17] defined the Massively Parallel Communication (MPC) model to abstract out key theoretical features of MapReduce; it has since become a widely used setting for designing and analyzing big data algorithms, especially for graph problems. In this model, an input of size m is distributed among p ≈ m/S processors, each of which is computationally unbounded and restricted to S bits of space. The processors operate in synchronous rounds; in each round, a processor may communicate with all others, subject to the space constraint. The focus is on using a very small number of rounds. Another well-studied model for distributed graph algorithms is Congested Clique [LPPP05], where there are n nodes, each holding the local neighborhood information for one of the n vertices of the input graph. The nodes communicate in synchronous rounds; in a round, every pair of processors may communicate, but each message is restricted to O(log n) bits. Behnezhad et al. [BDH18] show that Congested Clique is equivalent to 4 the so-called "semi-MPC model," defined as MPC with O(n log n) bits of memory per machine: there are simulations in both directions preserving the round complexity. Graph coloring has been studied in these models before. Harvey et al. [HLL18] gave a (∆ + o(∆))-coloring algorithm in the MapReduce model; it can be simulated in MPC using O(1) rounds and O(n1+c) space per machine for some constant c > 0. Parter [Par18] gave a Congested Clique algorithm for (∆ + 1)-coloring using O(log log ∆ · log(cid:63) ∆) rounds; Parter and Su [PS18] improved this to O(log(cid:63) ∆). The aforementioned paper of Assadi et al. [ACK19] gives an MPC algorithm for (∆ + 1)-coloring using O(1)-round and O(n log3 n) bits of space per machine. Because this space usage is ω(n log n), the equivalence result of Behnezad et al. [BDH18] does not apply and this doesn't lead to an O(1)-round Congested Clique algorithm. In contrast, our MPC algorithm uses only O(n log n) bits of space per machine for graphs with degeneracy ω(log2 n), and therefore leads to such a Congested Clique algorithm. Chang et al. [CFG+18] have recently designed two (∆ + 1) list-coloring algorithms: an O(1)-round Congested Clique algorithm, and an O( log log n)-round MPC algorithm with o(n) space per machine and (cid:101)O(m) space in total. To the best of our knowledge, no (cid:112) O(α)-coloring algorithm was previously known, in either the MPC or the Congested Clique model. The LOCAL Model. The LOCAL model of distributed computing is "orthogonal" to Congested Clique: the input setup is similar but, during computation, each node may only communicate with its neighbors in the input graph, though it may send an arbitrarily long message. As before, the focus is on minimizing the number of rounds (a.k.a., time). There is a deep body of work on graph coloring in this model. Indeed, graph coloring is one of the most central "symmetry breaking" problems in distributed computing. We refer the reader to the monograph by Barenboim and Elkin [BE13] for an excellent overview of the state of the art. Here, we shall briefly discuss only a few results closely related to our contribution. There is a long line of work on fast (∆+1)-coloring in the LOCAL model, in the deterministic as well as the randomized setting [PS96,Bar16,FHK16,Lub86,Joh99,ABI86,SW10,BEPS16] culminating in sublogarithmic time solutions due to Harris [HSS16] and Chang et al. [CLP18]. Barenboim and Elkin [BE10, BE11] studied fast distributed coloring algorithms that may use far fewer than ∆ colors: in particular, they gave algorithms that use O(α) colors and run in O(αε log n) time on graphs with arboricity at most α. Recall again that κ (cid:54) 2α − 1, so that a 2α-coloring always exists. They also gave a faster O(log n)-time algorithm using O(α2) colors. Further, they gave a family of algorithms that produce an O(tα2)-coloring in O(logt n + log(cid:63) n), for every t such that 2 (cid:54) t (cid:54) O( √ n/α). Our algorithm for the LOCAL model builds on this latter result. They gave a randomized O(k)-round algorithm that uses O(αn1/k) colors for 2 log log n (cid:54) k (cid:54) (cid:112) O(α1+1/kn1/k+3/k22−2k) colors for k < 2 log log n. We extend their result to the range k ∈(cid:2)ω( Kothapalli and Pemmaraju [KP11] focused on arboricity-dependant coloring using very few rounds. log n and log n), o(log n)(cid:3), (cid:112) using O(αn1/k log n) colors. Ghaffari and Lymouri [GL17] gave a randomized O(α)-coloring algorithm that runs in time O(log n · min{log log n, log α}) as well as an O(log n)-time algorithm using min{(2+ε)α+O(log n log log n), O(α log α)} colors, for any constant ε > 0. However, their technique does not yield a sublogarithmic time algorithm, even at the cost of a larger palette. The LDP Technique. As mentioned earlier, our algorithmic results rely on the concept of a low degeneracy partition (LDP) that we introduce in this work. Some relatives of this idea have been considered before. Specifically, Barenboim and Elkin [BE13] define a d-defective (resp. b-arbdefective) c-coloring to be a vertex coloring using palette [c] such that every color class induces a subgraph with maximum degree at most d (resp. arboricity at most b). Obtaining such improper colorings is a useful first step towards obtaining proper colorings. They give deterministic algorithms to obtain good arbdefective colorings [BE11]. However, their algorithms are elaborate and are based on construction of low outdegree acyclic partial orientations of the graph's edges: an expensive step in our space-conscious models. Elsewhere (Theorem 10.5 of Barenboim and Elkin [BE13]), they note that a useful defective (not arbdefective) coloring is easily obtained by randomly picking a color for each vertex; this is then useful for 5 computing an O(∆)-coloring. Our LDP technique can be seen as a simple randomized method for producing an arbdefective coloring. Crucially, we parametrize our result using degeneracy instead of arboricity and we give sharp -- not just asymptotic -- bounds on the degeneracy of each color class. Other Related Work. Other work considers coloring in the setting of dynamic graph algorithms: edges are inserted and deleted over time and the goal is to maintain a valid vertex coloring of the graph that must be updated quickly after each modification. Unlike in the streaming setting, there is no space restriction. Bhattacharya et al. [BCHN18] gave a randomized algorithm that maintains a (∆ + 1)-coloring with O(log ∆) expected amortized update time and a deterministic algorithm that maintains a (∆ + o(∆))-coloring with O(polylog ∆) amortized update time. Barba et al. [BCK+17] gave tradeoffs between the number of colors used and update time. However, the techniques in these works do not seem to apply in the streaming setting due to fundamental differences in the models. al. [MTVV15] gave a one pass (1 + ε)-approximation algorithm to estimate the arboricity of graph using (cid:101)O(n) Estimating the arboricity of a graph in the streaming model is a well studied problem. McGregor et space. Bahmani et al. [BKV12] gave a matching lower bound. Our lower bounds for estimating degeneracy are quantitatively much larger but they call for much tighter estimates. 2 Preliminaries Throughout this paper, graphs are simple, undirected, and unweighted. In considering a graph coloring problem, the input graph will usually be called G and we will put n = V(G). The notation "log x" stands for log2 x. For an integer k, we denote the set {1, 2, . . . , k} by [k]. For a graph G, we define ∆(G) = max{deg(v) : v ∈ V(G)}. We say that G is k-degenerate if every induced subgraph of G has a vertex of degree at most k. For instance, every forest is 1-degenerate and an elementary theorem says that every planar graph is 5-degenerate. The degeneracy κ(G) is the smallest k such that G is k-degenerate. The arboricity α(G) is the smallest r such that the edge set E(G) can be partitioned into r forests. When the graph G is clear from the context, we simply write ∆, κ, and α, instead of ∆(G), κ(G), and α(G). We note two useful facts: the first is immediate from the definition, and the second is an easy exercise. Fact 2.1. If an n-vertex graph has degeneracy κ, then it has at most κn edges. Fact 2.2. In every graph, the degeneracy κ and arboricity α satisfy α (cid:54) κ (cid:54) 2α − 1. (cid:3) (cid:3) In analyzing our algorithms, it will be useful to consider certain vertex orderings of graphs and their connection with the notion of degeneracy, given by Lemma 2.5 below. Although the lemma is folklore, it is crucial to our analysis, so we include a proof for completeness. Definition 2.3. An ordering of G is a list consisting of all its vertices (equivalently, a total order on V(G)). Given an ordering (cid:67), for each v ∈ V(G), the ordered neighborhood NG,(cid:67)(v) := {w ∈ V(G) : {v, w} ∈ E(G), v (cid:67) w} , i.e., the set of neighbors of v that appear after v in the ordering. The ordered degree odegG,(cid:67)(v) := NG,(cid:67)(v). Definition 2.4. A degeneracy ordering of G is an ordering produced by the following algorithm: starting with an empty list, repeatedly pick a minimum degree vertex v (breaking ties arbitrarily), append v to the end of the list, and delete v from G; continue this until G becomes empty. 6 Lemma 2.5. A graph G is k-degenerate iff there exists an ordering (cid:67) such that odegG,(cid:67)(v) (cid:54) k for all v ∈ V(G). Proof. Suppose that G is k-degenerate. Let (cid:67) = (v1, . . . , vn) be a degeneracy ordering. Then, for each i, odegG,(cid:67)(vi) is the degree of vi in the induced subgraph G \{v1, . . . , vi−1}. By definition, this induced subgraph has a vertex of degree at most k, so vi, being a minimum degree vertex in the subgraph, must have degree at most k. On the other hand, suppose that G has an ordering (cid:67) such that odegG,(cid:67)(v) (cid:54) k for all v ∈ V(G). Let H be an induced subgraph of G. Let v be the leftmost (i.e., smallest) vertex in V(H) according to (cid:67). Then all (cid:3) neighbors of v in H in fact lie in NG,(cid:67)(v), so degH(v) (cid:54) odegG,(cid:67)(v) (cid:54) k. Therefore, G is k-degenerate. A c-coloring of a graph G is a mapping ψ: V(G) → [c]; it is said to be a proper coloring if it makes no edge monochromatic: ψ(u) (cid:44) ψ(v) for all {u, v} ∈ E(G). The smallest c such that G has a proper c-coloring is called the chromatic number χ(G). By considering the vertices of G one at a time and coloring greedily, we immediately obtain a proper (∆ + 1)-coloring. This idea easily extends to degeneracy-based coloring. Lemma 2.6. Given unrestricted ("offline") access to an input graph G, we can produce a proper (κ + 1)- coloring in linear time. Proof. Construct a degeneracy ordering (v1, . . . , vn) of G and then consider the vertices one by one in the order (vn, . . . , v1), coloring greedily. Given a palette of size κ + 1, by the "only if" direction of Lemma 2.5, (cid:3) there will always be a free color for a vertex when it is considered. Of course, the simple algorithm above is not implementable directly in "sublinear" settings, such as space-bounded streaming algorithms, query models, or distributed computing models. Nevertheless, we shall make use of the algorithm on suitably constructed subgraphs of our input graph. We shall use the following form of the Chernoff bound. such that EX (cid:54) µ and 0 (cid:54) δ (cid:54) 1. Then, Pr(cid:2)X (cid:62) (1 + δ)µ(cid:3) (cid:54) exp Fact 2.7. Let X be a sum of mutually independent indicator random variables. Let µ and δ be real numbers (cid:3) (cid:16)−µδ2/3 (cid:17) . 3 A Generic Framework for Coloring In this section, we give a generic framework for graph coloring that we later instantiate in various compu- tational models. As a reminder, our focus is on graphs G with a nontrivial upper bound on the degeneracy κ = κ(G). Each such graph admits a proper (κ + 1)-coloring; our focus will be on obtaining a proper (κ + o(κ))-coloring efficiently. As a broad outline, our framework calls for coloring G in two phases. The first phase produces a low degeneracy partition (LDP) of G: it partitions V(G) into a "small" number of parts, each of which induces a subgraph that has "low" degeneracy. This step can be thought of as preprocessing and it is essentially free (in terms of complexity) in each of our models. The second phase properly colors each part, using a small number of colors, which is possible because the degeneracy is low. In Section 4, we shall see that the low degeneracy allows this second phase to be efficient in each of the models we consider. 3.1 A Low Degeneracy Partition and its Application In this phase of our coloring framework, we assign each vertex a color chosen uniformly at random from [(cid:96)], these choices being mutually independent, where (cid:96) is a suitable parameter. For each i ∈ [(cid:96)], let Gi denote the subgraph of G induced by vertices colored i. We shall call each Gi a block of the vertex partition given by (G1, . . . , G(cid:96)). The next theorem, our main technical tool, provides certain guarantees on this partition given a suitable choice of (cid:96). 7 Theorem 3.1 (LDP Theorem). Let G be an n-vertex graph with degeneracy κ. Let k ∈ [1, n] be a "guess" for the value of κ and let s (cid:62) Cn log n be a sparsity parameter, where C is a sufficiently large universal constant. Put (1) and let ψ: V(G) → [(cid:96)] be a uniformly random coloring of G. For i ∈ [(cid:96)], let Gi be the subgraph induced by ψ−1(i). Then, the partition (G1, . . . , G(cid:96)) has the following properties. κ(cid:96) log n , λ = 3 (cid:96) = s , (cid:38)2nk (cid:39) (cid:112) (i) If k (cid:54) 2κ, then w.h.p., for each i, the degeneracy κ(Gi) (cid:54) (κ + λ)/(cid:96). (ii) W.h.p., for each i, the block size V(Gi) (cid:54) 2n/(cid:96). (iii) If κ (cid:54) k (cid:54) 2κ, then w.h.p., the number of monochromatic edges E(G1) ∪ ··· ∪ E(G(cid:96)) (cid:54) s. In each case, "w.h.p." means "with probability at least 1 − 1/ poly(n)." It will be convenient to encapsulate the guarantees of this theorem in a definition. Definition 3.2. Suppose graph G has degeneracy κ. A vertex partition (G1, . . . , G(cid:96)) simultaneously satisfying the degeneracy bound in item (i), the block size bound in item (ii), and the (monochromatic) edge sparsity bound in item (iii) in Theorem 3.1 is called an ((cid:96), s, λ)-LDP of G. It will turn out that an ((cid:96), s, λ)-LDP leads to a proper coloring of G using at most κ + λ + (cid:96) colors. An instructive setting of parameters is s = Θ((n log n)/ε2), where ε is either a small constant or a slowly vanishing made, Theorem 3.1 guarantees an LDP that has edge sparsity s = (cid:101)O(n) and that leads to an eventual proper function of n, such as 1/ log n. Then, a quick calculation shows that when an accurate guess k ∈ [κ, 2κ] is coloring using (1 + O(ε))κ colors. When ε = o(1), this number of colors is κ + o(κ). Recall that the second phase of our coloring framework involves coloring each Gi separately, exploiting its low degeneracy. Indeed, given an ((cid:96), s, λ)-LDP, each block Gi admits a proper (κ(Gi) + 1)-coloring. Suppose we use a distinct palette for each block; then the total number of colors used is (cid:96)(cid:88) i=1 (cid:19) (cid:18) κ + λ (cid:96) (κ(Gi) + 1) (cid:54) (cid:96) + 1 = κ + λ + (cid:96) , (2) as claimed above. Of course, even if our first phase random coloring ψ yields a suitable LDP, we still have to collect each block Gi or at least enough information about each block so as to produce a proper (κ(Gi) + 1)-coloring. How we do this depends on the precise model of computation. We take this up in Section 4. 3.2 Proof of the LDP Theorem We now turn to proving the LDP Theorem from Section 3.1. Notice that when k (cid:54) (C/2) log n, the condition s (cid:62) Cn log n results in (cid:96) = 1, so the vertex partition is the trivial one-block partition, which obviously satisfies all the properties in the theorem. Thus, in our proof, we may assume that k > (C/2) log n. Proof of Theorem 3.1. We start with item (ii), which is the most straightforward. From eq. (1), we have (cid:96) (cid:54) 4nk/s, so Each block size V(Gi) has binomial distribution Bin(n, 1/(cid:96)), so a Chernoff bound gives (cid:34) V(Gi) > Pr n (cid:96) (cid:62) s 4k (cid:35) 2n (cid:96) (cid:62) Cn log n (cid:62) C log n . 4 (cid:32) (cid:33) (cid:54) exp (cid:54) exp −C log n 12 (cid:54) 1 n2 , (cid:19) 4k (cid:18)− n 3(cid:96) 8 for sufficiently large C. By a union bound over the at most n blocks, item (ii) fails with probability at most 1/n. Items (i) and (iii) include the condition k (cid:54) 2κ, which we shall assume for the rest of the proof. By eq. (1) and the bounds s (cid:62) Cn log n and k > (C/2) log n, (cid:38) (cid:39) (cid:115) κ · (cid:96) (cid:54) whence, for sufficiently large C, 2k C log n (cid:54) 4k C log n (cid:54) 8κ C log n , 8κ · log n (cid:54) κ . λ (cid:54) 3 (3) We now turn to establishing item (i). Let (cid:67) be a degeneracy ordering for G. For each i ∈ [(cid:96)], let (cid:67)i be the restriction of (cid:67) to V(Gi). Consider a particular vertex v ∈ V(G) and let j = ψ(v) be its color. We shall prove that, w.h.p., odegG,(cid:67) j(v) (cid:54) (κ + λ)/(cid:96). By the "only if" direction of Lemma 2.5, we have odegG,(cid:67)(v) = NG,(cid:67)(v) (cid:54) κ. Now note that C log n (cid:88) u∈NG,(cid:67)(v) odegG j,(cid:67) j(v) = 1{ψ(u)=ψ(v)} is a sum of mutually independent indicator random variables, each of which has expectation 1/(cid:96). Therefore, E odegG j,(cid:67) j(v) = odegG,(cid:67)(v)/(cid:96) (cid:54) κ/(cid:96). Since λ (cid:54) κ by eq. (3), we may use the form of the Chernoff bound in Fact 2.7, which gives us (cid:20) (cid:21) (cid:32) (cid:33) (cid:32) (cid:33) Pr odegG j,(cid:67) j(v) > κ + λ (cid:96) (cid:54) exp − κ (cid:96) λ2 3κ2 = exp −9κ(cid:96) log n 3κ(cid:96) (cid:54) 1 n3 , where the equality follows from eq. (1). In words, with probability at least 1 − 1/n3, the vertex v has ordered degree at most (κ + λ)/(cid:96) within its own block. By a union bound, with probability at least 1 − 1/n2, all n vertices of G satisfy this property. When this happens, by the "if" direction of Lemma 2.5, it follows that κ(Gi) (cid:54) (κ + λ)/(cid:96) for every i. Finally, we take up item (iii), which is now straightforward. Assume that the high probability event in item (i) occurs. Then, by Fact 2.1, E(G1) ∪ ··· ∪ E(G(cid:96)) (cid:54) (cid:96)(cid:88) i=1 (cid:96)(cid:88) i=1 κ(Gi)V(Gi) (cid:54) κ + λ (cid:96) V(Gi) = n(κ + λ) (cid:96) (cid:54) 2nκ (cid:96) (cid:54) s , where the final inequality uses the condition κ (cid:54) k and eq. (1). (cid:3) 4 Specific Sublinear Algorithms for Coloring We now turn to designing graph coloring algorithms in specific models of computation for big data, where the focus is on utilizing space sublinear in the size of the massive input graph. Such models are sometimes termed space-conscious. In each case, our algorithm ultimately relies on the framework developed in Section 3. 9 4.1 Data Streaming We begin with the most intensely studied space-conscious model: the data streaming model. For graph problems, in the basic model, the input is a stream of non-repeated edges that define the input graph G: this is called the insertion-only model, since it can be thought of as building up G through a sequence of edge insertions. In the more general dynamic graph model or turnstile model, the stream is a sequence of edge updates, each update being either an insertion or a deletion: the net effect is to build up G. Our algorithm will work in this more general model. Later, we shall give a corresponding lower bound that will hold even in the insertion-only model (for a lower bound, this is a strength). (cid:16)n (cid:17) We assume that the vertex set V(G) = [n] and the input is a stream σ of at most m = poly(n) updates to an initially empty graph. An update is a triple (u, v, c), where u, v ∈ V(G) and c ∈ {−1, 1}: when c = 1, this token represents an insertion of edge {u, v} and when c = −1, it represents a deletion. Let N = and [[m]] = Z ∩ [−m, m]. It is convenient to imagine a vector x ∈ [[m]]N of edge multiplicities that starts at zero and is updated entrywise with each token. The input graph G described by the stream will be the underlying simple graph, i.e., E(G) will be the set of all edges {u, v} such that xu,v (cid:44) 0 at the end. We shall say that σ builds up x and G. 2 Our algorithm makes use of two data streaming primitives, each a linear sketch. (We can do away with these sketches in the insertion-only setting; see the end of this section.) The first is a sketch for sparse recovery given by a matrix A (say): given a vector x ∈ [[m]]N with sparsity (cid:107)x(cid:107)0 (cid:54) t, there is an efficient algorithm to reconstruct x from Ax. The second is a sketch for (cid:96)0 estimation given by a random matrix B (say): given a vector x ∈ [[m]]N, there is an efficient algorithm that takes Bx and computes from it an estimate of (cid:107)x(cid:107)0 that, with probability at least 1 − δ, is a (1 + γ)-multiplicative approximation. It is known that there exists a suitable A ∈ {0, 1}d×N, where d = O(t log(N/t)), where A has column sparsity O(log(N/t)); see, e.g., Theorem 9 of Gilbert and Indyk [GI10]. It is also known that there exists a suitable distribution over matrices giving B ∈ {0, 1}d(cid:48)×N with d(cid:48) = O(γ−2 log δ−1 log N(log γ−1 + log log m)). Further, given an update to the ith entry of x, the resulting updates in Ax and Bx can be effected quickly by generating the required portion of the ith columns of A and B. (cid:46) σ builds up x and G; k ∈ [1, n] is a guess for κ(G) Algorithm 1 One-Pass Streaming Algorithm for Graph Coloring via Degeneracy 1: procedure Color(stream σ, integer k) choose s, (cid:96) as in eq. (1) and t, d, d(cid:48), A, B as in the above discussion 2: initialize y ∈ [[m]]d and z ∈ [[m]]d(cid:48) 3: foreach u ∈ [n] do ψ(u) ← uniform random color in [(cid:96)] 4: foreach token (u, v, c) in σ do 5: if ψ(u) = ψ(v) then y ← y + cAu,v; z ← z + cBu,v 6: if estimate of (cid:107)w(cid:107)0 obtained from z is > 5s/4 then abort w(cid:48) ← result of t-sparse recovery from y foreach i ∈ [(cid:96)] do to zero 7: 8: 9: 10: 11: Gi ← simple graph induced by {{u, v} : w(cid:48) color Gi using palette {(i, j) : 1 (cid:54) j (cid:54) κ(Gi) + 1}; cf. Lemma 2.6 u,v (cid:44) 0 and ψ(u) = ψ(v) = i} (cid:46) we expect that w(cid:48) = w (cid:46) net effect is to color G In our description of Algorithm 1, we use Au,v (resp. Bu,v) to denote the column of A (resp. B) indexed by {u, v}. The algorithm's logic results in sketches y = Aw and z = Bw, where w corresponds to the subgraph of G consisting of ψ-monochromatic edges only (cf. Theorem 3.1), i.e., w is obtained from x by zeroing out all entries except those indexed by {u, v} with ψ(u) = ψ(v). We choose the parameter t = 2s, where s (cid:62) Cn log n is the sparsity parameter from Theorem 3.1, which gives d = O(s log n); we choose γ = 1/4 and δ = 1/n, giving d(cid:48) = O(log3 n). 10 Notice that Algorithm 1 requires a guess for κ := κ(G), which is not known in advance. Our final one-pass algorithm runs O(log n) parallel instances of Color(σ, k), using geometrically spaced guesses k = 2, 4, 8 . . . . It outputs the coloring produced by the non-aborting run that uses the smallest guess. Theorem 4.1. Set s = (cid:100)ε−2n log n(cid:101), where ε > 0 is a parameter. The above one-pass algorithm processes a dynamic (i.e., turnstile) graph stream using O(ε−2n log4 n) bits of space and, with high probability, produces coloring using (cid:101)O(n) space. Each edge update is processed in (cid:101)O(1) time and post-processing at the end of the stream takes (cid:101)O(n) time. a proper coloring using at most (1 + O(ε))κ colors. In particular, taking ε = 1/ log n, it produces a κ + o(κ) Proof. The coloring produced is obviously proper. Let us bound the number of colors used. One of the parallel runs of Color(σ, k) in 1 will use a value k = k(cid:63) ∈ (κ, 2κ]. We shall prove that, w.h.p., (a) every non-aborting run with k (cid:54) k(cid:63) will use at most (1 + O(ε))κ colors, and (b) the run with k = k(cid:63) will not abort. We start with (a). Consider a particular run using k (cid:54) k(cid:63). By item (i) of Theorem 3.1, each Gi has degeneracy at most (κ + λ)/(cid:96); so if w is correctly recovered by the sparse recovery sketch (i.e., w(cid:48) = w in Algorithm 1), then each Gi is correctly recovered and the run uses at most κ + λ + (cid:96) colors, as in eq. (2). Using the values from eq. (1), this number is at most (1 + O(ε))κ. Now, if the run does not abort, then the estimate of the sparsity (cid:107)w(cid:107)0 is at most 5s/4. By the guarantees of the (cid:96)0-estimation sketch, the true sparsity is at most (5/4)(5s/4) < 2s = t, so, w.h.p., w is indeed t-sparse and, by the guarantees of the sparse recovery sketch, w(cid:48) = w. Taking a union bound over all O(log n) runs, the bound on the number of colors holds for all required runs simultaneously, w.h.p. We now take up (b). Note that (cid:107)w(cid:107)0 is precisely the number of ψ-monochromatic edges in G. By item (iii) of Theorem 3.1, we have (cid:107)w0(cid:107) (cid:54) s w.h.p. By the accuracy guarantee of the (cid:96)0-estimation sketch, in this run the estimate of (cid:107)w(cid:107)0 is at most 5s/4 w.h.p., so the run does not abort. The space usage of each parallel run is dominated by the computation of y, so it is O(d log m) = O(s log n log m) = O(ε−2n log3 n), using our setting of s and the assumption m = poly(n). The claims about the update time and post-processing time follow directly from the properties of a state-of-the-art sparse recovery scheme, e.g., the scheme based on expander matching pursuit given in Theorem 9 of Gilbert and (cid:3) Indyk [GI10]. Simplification for Insertion-Only Streams. Algorithm 1 can be simplified considerably if the input stream is insertion-only. We can then initialize each Gi to an empty graph and, upon seeing an edge {u, v} in the stream, insert it into Gi iff ψ(u) = ψ(v) = i. We abort if we collect more than s edges; w.h.p., this will not happen, thanks to Theorem 3.1. Finally, we color the collected graphs Gi greedily, just as in Algorithm 1. With this simplification, the overall space usage drops to O(s log n) = O(ε−2n log2 n) bits. The reason this does not work for dynamic graph streams is that the number of monochromatic edges could exceed s by an arbitrary amount mid-stream. 4.2 Query Model We now turn to the general graph query model, a standard model of space-conscious algorithms for big graphs where the input graph is random-accessible but the emphasis is on the examining only a tiny (ideally, sublinear) portion of it; for general background see Chapter 10 of Goldreich's book [Gol17]. In this model, the algorithm starts out knowing the vertex set [n] of the input graph G and can access G only through the following types of queries. • A pair query Pair({u, v}), where u, v ∈ [n]. The query returns 1 if {u, v} ∈ E(G) and 0 otherwise. For better readability, we shall write this query as Pair(u, v). 11 • A neighbor query Neighbor(u, j), where u ∈ [n] and j ∈ [n − 1]. The query returns v ∈ [n] where v is the jth neighbor of u in some underlying fixed ordering of vertex adjacency lists; if deg(v) < j, so that there does not exist a jth neighbor, the query returns ⊥. Naturally, when solving a problem in this model, the goal is to do so while minimizing the number of queries. By adapting the combinatorial machinery from their semi streaming algorithm, Assadi et al. [ACK19] gave an (cid:101)O(n3/2)-query algorithm for finding a (∆ + 1)-coloring. Our LDP framework gives a considerably simpler algorithm using κ + o(κ) colors, where κ := κ(G). We remark here that (cid:101)O(n3/2) query complexity is essentially optimal, as Assadi et al. [ACK19] proved a matching lower bound for any (c · ∆)-coloring algorithm, for any constant c > 1. Theorem 4.2. Given query access to a graph G, there is a randomized algorithm that, with high probability, produces a proper coloring of G using κ + o(κ) colors. The algorithm's worst-case query complexity, running time, and space usage are all (cid:101)O(n3/2). Proof. The algorithm proceeds in two stages. In the first stage, it attempts to extract all edges in G through neighbor queries alone, aborting when "too many" queries have been made. More precisely, it loops over all vertices v and, for each v, issues queries Neighbor(v, 1), Neighbor(v, 2), . . . until a query returns ⊥. If √ this stage ends up making 3n3/2 queries (say) without having processed every vertex, then it aborts and the algorithm moves on to the second stage. By Fact 2.1, if κ (cid:54) n, then this stage will not abort and the algorithm will have obtained G completely; it can then (κ + 1)-color G (as in Lemma 2.6) and terminate, skipping the second stage. √ √ n. The algorithm now uses a random coloring ψ to construct n, with s = Θ(ε−2n log n) and (cid:96), λ given by Equation (1). an ((cid:96), s, λ)-LDP of G using the "guess" k = To produce each subgraph Gi in the LDP, the algorithm simply makes all possible queries Pair(u, v) where ψ(u) = ψ(v). W.h.p., the number of queries made is at most In the second stage, we know that κ > (cid:88) i∈[(cid:96)] 1 2 (cid:32)2n (cid:33)2 (cid:96) V(Gi)2 (cid:54) (cid:96) 2 (cid:54) 2n2s 4nk = Θ (cid:32)n3/2 log n (cid:33) , ε2 where the first inequality uses Item (ii) of Theorem 3.1. We can enforce this bound in the worst case by aborting if it is violated. Clearly, k (cid:54) 2κ, so Item (i) of Theorem 3.1 applies and by the discussion after Definition 3.2, the algorithm uses (1 + O(ε))κ colors. Setting ε = 1/ log n, this number is at most κ + o(κ) and the overall number (cid:3) of queries remains (cid:101)O(n3/2), as required. 4.3 MPC and Congested Clique Models In the Massively Parallel Communication (MPC) model of Beame et al. [BKS17], an input of size m is distributed adversarially among p processors, each of which has S bits of working memory: here, p and S are o(m) and, ideally, p ≈ m/S . Computation proceeds in synchronous rounds: in each round, a processor carries out some local computation (of arbitrary time complexity) and then communicates with as many of the other When the input is an n-vertex graph, the most natural and widely studied setting of MPC is S = (cid:101)O(n), processors as desired, provided that each processor sends and receives no more than S bits per round. The primary goal in solving a problem is to minimize the number of rounds. which enables each processor to hold some information about every vertex; this makes many graph problems tractable. Since the input size m is potentially Ω(n2), it is reasonable to allow p = n many processors. Note that the input is just a collection of edges, distributed adversarially among these processors, subject to the memory constraint. 12 Theorem 4.3. There is a randomized O(1)-round MPC algorithm that, given an n-vertex graph G, outputs a (κ + o(κ))-coloring of G with high probability. The algorithm uses n processors, each with O(n log2 n) bits of memory. Proof. Our algorithm will use n processors, each assigned to one vertex. If E(G) = O(n log n), then all of G can be collected at one processor in a single round using E(G)· 2(cid:100)log n(cid:101) = O(n log2 n) bits of communication and the problem is solved trivially. Therefore, we may as well assume that E(G) = ω(n log n), which implies κ = ω(log n), by Fact 2.1. We shall first give an algorithm assuming that κ is known a priori. Our final algorithm will be a refinement of this preliminary one. Preliminary algorithm. Take k = κ. Each processor chooses a random color for its vertex, implicitly producing a partition (G1, . . . , G(cid:96)) that is, w.h.p., an ((cid:96), s, λ)-LDP; we take (cid:96), λ as in eq. (1), s = Θ(ε−2n log n), and ε = (k−1 log n)1/4. Note that ε = o(1). In Round 1, each processor sends its chosen color to all others -- this is O(n log n) bits of communication per machine -- and as a result every processor learns which of its vertex's incident edges are monochromatic. Now each color i ∈ [(cid:96)] is assigned a unique machine Mi and, in Round 2, all edges in Gi are sent to Mi. Each Mi then locally computes a (κ(Gi) + 1)-coloring of Gi using a palette disjoint from those of other Mis; by the discussion following Definition 3.2, this colors G using at most (1 + O(ε))κ = κ + o(κ) colors. The communication in Round 2 is bounded by maxi E(Gi) · 2(cid:100)log n(cid:101). By Fact 2.1, items (i) and (ii) of Theorem 3.1, and eq. (1), the following holds w.h.p. for each i ∈ [(cid:96)]: E(Gi) (cid:54) κ(Gi)V(Gi) (cid:54) κ + λ (cid:96) 2n (cid:96) (cid:54) 4nκ (cid:96)2 (cid:54) 4nk (2nk/s)2 = O(ε−2n log n)2 nk = O ε4k (cid:32)n log2 n (cid:33) = O(n log n) . (4) Thus, the communication per processor in Round 2 is O(n log2 n) bits. Final algorithm. When we don't know κ in advance, we can make geometrically spaced guesses k, as in Section 4.1. In Round 1, we choose a random coloring for each such k. In Round 2, we determine the quantities E(Gi) for each k and each subgraph Gi and thereby determine the smallest k such that eq. (4) holds for every Gi corresponding to this k. We then run Round 3 for only this one k, replicating the logic of Round 2 of the preliminary algorithm. Correctness is immediate. We turn to bounding the communication cost. For Round 3, the previous analysis shows that the communication per processor is O(n log2 n) bits. For Rounds 1 and 2, let us consider the communication involved for each guess k: since each randomly-chosen color and each cardinality E(Gi) can be described in O(log n) bits, each processor sends and receives at most O(n log n) bits per guess. This is (cid:3) a total of O(n log2 n) bits, as claimed. The CONGESTED-CLIQUE model [LPPP05] is a well established model of distributed computing for graph problems. In this model, there are n nodes, each of which holds the local neighborhood information (i.e., the incident edges) of one vertex of the input graph G. In each round, every pair of nodes may communicate, whether or not they are adjacent in G, but the communication is restricted to O(log n) bits. There is no constraint on a node's local memory. The goal is to minimize the number of rounds. Behnezhad et al. [BDH18] built on results of Lenzen [Len13] to show that any algorithm in the semi-MPC model -- defined as MPC with space per machine being O(n log n) bits -- can be simulated in the Congested Clique model, preserving the round complexity up to a constant factor. Based on this, we obtain the following result. Theorem 4.4. There is a randomized O(1)-round algorithm in the Congested Clique model that, given a graph G, w.h.p. finds a (κ + O(κ3/4 log1/2 n))-coloring. For κ = ω(log2 n), this gives a (κ + o(κ))-coloring. (cid:3) 13 Proof. We cannot directly use our algorithm in Theorem 4.3 because it is not a semi-MPC algorithm: it uses O(n log2 n) bits of space per processor, rather than O(n log n). However, with a more efficient implementation of Round 1, a more careful analysis of Round 2, and a slight tweak of parameters for Round 3, we can improve the communication (hence, space) bounds to O(n log n), whereupon the theorem of Behnezhad et al. [BDH18] completes the proof. For Round 3, the tweak is to set ε = (k−1 log2 n)1/4 but otherwise replicate the logic of the final algorithm from Theorem 4.3. With this higher value of ε, the bound from eq. (4) improves to E(Gi) = O(n). Therefore the per-processor communication in Round 3 is only O(n log n) bits. The number of colors used is, w.h.p., at most (1 + O(ε))κ = κ + O(κ3/4 log1/2 n). For a tighter analysis of the communication cost of Round 2, note that, for a particular guess k, there is a corresponding (cid:96) given by eq. (1) such that each processor need only send/receive (cid:96) cardinalities E(Gi), each of which can be described in O(log n) bits. Consulting eq. (1), we see that (cid:96) = O(n2/s) = O(n/ log n). Therefore, summing over all O(log n) choices of k, each processor communicates at most O(n/ log n) · O(log n) · O(log n) = O(n log n) bits. Round 1 appears problematic at first, since there are O(log n) many random colorings to be chosen, one for each guess k. However, note that these colorings need not be independent. Therefore, we can choose just one random (cid:100)log n(cid:101)-bit "master color" φ(v) for each vertex v and derive the random colorings for the various guesses k by using only appropriate length prefixes of φ(v). This ensures that each processor only (cid:3) communicates O(n log n) bits in Round 1. 4.4 Distributed Coloring in the LOCAL Model In the LOCAL model, each node of the input graph G hosts a processor that knows only its own neighborhood. The processors operate in synchronous rounds, during which they can send and receive messages of arbitrary length to and from their neighbors. The processors are allowed unbounded local computation in each round. The key complexity measure is time, defined as the number of rounds used by an algorithm (expected number, for a randomized algorithm) on a worst-case input. Graph coloring in the LOCAL model is very heavily studied and is one of the central problems in distributed algorithms. Here, our focus is on algorithms that properly color the input graph G using a number of colors that depends on α := α(G), the arboricity of G. Recall that α (cid:54) κ (cid:54) 2α − 1 (Fact 2.2). Unlike in previous sections, our results will give big-O bounds on the number of colors, so we may as well state them in terms of α (following established tradition in this line of work) rather than κ. Our focus will be on algorithms that run in sublogarithmic time, while using not too many colors. See Section 1.2 for a quick summary of other interesting parameter regimes and Barenboim and Elkin [BE13] for a thorough treatment of graph coloring in the LOCAL model. 2 log log n (cid:54) k (cid:54) (cid:112) such a time/quality tradeoff applies: for k ∈(cid:2)ω( Kothapalli and Pemmaraju [KP11] gave an O(k)-round algorithm that uses O(αn1/k) colors, for all k with log n. We give a new coloring algorithm that, in particular, extends the range of k to which log n), o(log n)(cid:3), we can compute an O(αn1/k log n)-coloring (cid:112) in O(k) rounds. Our algorithm uses our LDP framework to split the input graph into parts with logarithmic degeneracy (hence, arboricity) and then invokes an algorithm of Barenboim and Elkin. The following theorem records the key properties of their algorithm. Lemma 4.5 (Thm 5.6 of Barenboim and Elkin [BE10]). There is a deterministic distributed algorithm in the LOCAL model that, given an n-vertex graph G, an upper bound b on α(G), and a parameter t with (cid:3) 2 < t (cid:54) O( √ n/b), produces an O(tb2)-coloring of G in time O (cid:16) (cid:17) . logt n + log(cid:63) n Here is the main result of this section. 14 Theorem 4.6. There is a randomized distributed algorithm in the LOCAL model that, given an n-vertex graph G, an estimate of its arboricity α up to a constant factor, and a parameter t such that 2 < t (cid:54) O( n/ log n), produces an O(tα log n)-coloring of G in time O . logt n + log(cid:63) n (cid:16) (cid:17) (cid:112) Proof. To simplify the presentation, we assume that α = α(G). We assume that every node (vertex) knows n and α. Consider a ((cid:96), s, λ)-LDP of G, where we put s = Cn log n, for some large constant C, as in Theorem 3.1. This setting of s gives (cid:96) = O(α/ log n). First, each vertex v chooses a color ψ(v) uniformly at random from [(cid:96)]. Next, we need to effectively "construct" the blocks Gi, for each i ∈ [(cid:96)]. This is straightforwardly done in a single round: each vertex v sends ψ(v) to all its neighbors. At this point, each vertex v knows its neighbors in the block Gψ(v). So it's now possible to run a distributed algorithm on each Gi. We invoke the algorithm in Lemma 4.5. The algorithm needs each vertex v to know an upper bound bi on α(Gi), where i = ψ(v). A useful upper bound of bi = O(log n), which holds w.h.p., is given by item (i) of Theorem 3.1. By Lemma 4.5, each Gi can be colored using O(t log2 n) colors, within another O since 2 < t (cid:54) O( G is at most (cid:96) · O(t log2 n) = O(tα log n), as required. rounds, n/ log n). Using disjoint palettes for the distinct blocks, the total number of colors used for (cid:3) logt n + log(cid:63) n (cid:112) (cid:16) (cid:17) The particular form of the tradeoff stated in Table 1 is obtained by setting t = n1/k (for some k (cid:62) 3) in the above theorem. Corollary 4.7. There is a randomized LOCAL algorithm that, given graph G, estimate α ≈ α(G), and a parameter k with 2 < n1/k (cid:54) O( . (cid:3) n/ log n), finds an O(αn1/k log n)-coloring of G in time O k + log(cid:63) n (cid:112) (cid:17) (cid:16) 5 Lower Bounds Can we improve the guarantees of our algorithms so that they use at most κ + 1 colors, rather than κ + o(κ)? After all, every graph G does have a proper (κ(G) + 1)-coloring. The main message of this section is that answer is a strong "No," at least in the data streaming and query models. If we insist on a coloring that good, we would incur the worst possible space or query complexity: Ω(n2). In fact, this holds even if κ is known to the algorithm in advance. Moreover, all our streaming lower bounds hold even if the input stream consists of edge insertions alone. Our lower bounds generalize to the problem of producing a (κ + λ)-coloring. We show that this requires Ω(n2/λ2) space or query complexity. Such generalizations are based on the following Blow-Up Lemma. Definition 5.1. Let G be a graph and λ a positive integer. The blow-up graph Gλ is obtained by replacing each vertex of G with a copy of the complete graph Kλ and replacing each edge of G with a complete bipartite graph between the copies of Kλ at its endpoints. More succinctly, Gλ is the lexicographical product G[Kλ]. Lemma 5.2 (Blow-Up Lemma). For all graphs G and positive integers λ, c, if G has a c-clique, then Gλ has a (cλ)-clique. Also, κ(Gλ) (cid:54) (κ(G) + 1)λ − 1. Proof. The claim about cliques is immediate. The bound on κ(Gλ) follows by taking a degeneracy ordering of G and replacing each vertex v by a list of vertices of the clique that replaces v in Gλ, ordering vertices (cid:3) within the clique arbitrarily. Our lower bounds come in two flavors. The first address the hardness of distinguishing low-degeneracy graphs from high-chromatic-number graphs. This is encapsulated in the following abstract problem. 15 (a) (b) (c) Figure 1: Gadget graphs used in (a) Lemma 5.5; (b) Theorem 5.7; (c) Lemma 5.12 and Theorem 5.14. Definition 5.3 (graph-dist problem). Consider two graph families: G1 := G1(n, q, λ), consisting of n-vertex graphs with chromatic number χ (cid:62) (q + 1)λ, and G2 := G2(n, q, λ), consisting of n-vertex graphs with κ (cid:54) qλ − 1. Then graph-dist(n, q, λ) is the problem of distinguishing G1 from G2; note that G1 ∩ G2 = ∅. More precisely, given an input graph G on n vertices, the problem is to decide whether G ∈ G1 or G ∈ G2, with success probability at least 2/3. We shall prove that graph-dist is "hard" in the insertion-only streaming setting and in the query setting, thereby establishing that in these models it is hard to produce a (κ + λ)-coloring. In fact, our proofs will show that it is just as hard to estimate the parameter κ; this goes to show that the hardness of the coloring problem is not just because of the large output size. Lower bounds of the above flavor raise the following question: since estimating κ itself is hard, does the coloring problem become easier if the value of κ(G) is given in advance, before the algorithm starts to read G? In fact, the (∆ + 1)-coloring algorithms by Assadi et al. [ACK19] assume that ∆ is known in advance. However, perhaps surprisingly, we prove a second flavor of lower bounds, showing that a priori knowledge of κ does not help and (κ + 1)-coloring (more generally, (κ + λ)-coloring) remains a hard problem even under the strong assumption that κ is known in advance. 5.1 Streaming Lower Bounds In this section, we prove both flavors of lower bounds in the one-pass streaming setting. The next section takes up the query model. Our streaming lower bounds use reductions from the index and int-find (intersection finding, a variant of disjointness) problems in communication complexity. In the indexN problem, Alice is given a vector x = (x1, . . . , xN) ∈ {0, 1}N and Bob is given an index k ∈ [N]. The goal is for Alice to send Bob a (possibly random) c-bit message that enables Bob to output xk with probability at least 2/3. The smallest c for which such a protocol exists is called the one-way randomized communication complexity, R→(indexN). In int-findN, Alice and Bob hold vectors x, y ∈ {0, 1}N, interpreted as subsets of [N], satisfying the promise that x∩y = 1. They must find the unique index i where xi = yi = 1, using at most c bits of randomized interactive communication, succeeding with probability at least 2/3. The smallest c for which such a protocol exists is the randomized communication complexity, R(int-findN). As is well known, R→(indexN) = Ω(N) [Abl96] and R(int-findN) = Ω(N); the latter is a simple extension of the disjointness lower bound [Raz92]. 16 LRlrCyzlLRLRCrlraiajbbjiAB We shall in fact consider instances of indexN where N = p2, for an integer p. Using a canonical bijection between [N] and [p] × [p], we reinterpret x as a matrix with entries (xi j)i, j∈[p], and Bob's input as (y, z) ∈ [p]× [p]. We further interpret this matrix x as the bipartite adjacency matrix of a (2p)-vertex balanced bipartite graph Hx. Such graphs Hx will be key gadgets in the reductions to follow. Definition 5.4. For x ∈ {0, 1}p×p, a realization of Hx on a list ((cid:96)1, . . . , (cid:96)p, r1, . . . , rp) of distinct vertices is a graph on these vertices whose edge set is {{(cid:96)i, r j} : xi j = 1}. First Flavor: Degeneracy Not Known in Advance. To prove lower bounds of the first flavor, we start by demonstrating the hardness of the abstract problem graph-dist, from Definition 5.3. Lemma 5.5. Solving graph-dist(n, q, λ) in one randomized streaming pass requires Ω(n2/λ2) space. More precisely, there is a constant c > 0 such that for every integer λ (cid:62) 1 and every sufficiently large integer q, there is a setting n = n(q, λ) for which every randomized one-pass streaming algorithm for graph-dist(n, q, λ) requires at least cn2/λ2 bits of space. Proof. Put p = q − 1. We reduce from indexN, where N = p2, using the following plan. Starting with an empty graph on n = 3λp vertices, Alice adds certain edges based on her input x ∈ {0, 1}p×p and then Bob adds certain other edges based on his input (y, z) ∈ [p] × [p]. By design, solving graph-dist(n, q, λ) on the resulting final graph reveals the bit xyz, implying that a one-pass streaming algorithm for graph-dist requires at least R→(indexN) = Ω(N) = Ω(p2) = Ω(n2/λ2) bits of memory. The details follow. We first consider λ = 1. We use the vertex set L (cid:93) R (cid:93) C (the notation "(cid:93)" denotes a disjoint union), where L = {(cid:96)1, . . . , (cid:96)p}, R = {r1, . . . , rp}, and C = p. Alice introduces the edges of the gadget graph Hx (from Definition 5.4), realized on the vertices ((cid:96)1, . . . , (cid:96)p, r1, . . . , rp). Bob introduces all possible edges within C ∪ {(cid:96)y, rz}, except for {(cid:96)y, rz}. Let G be the resulting graph. If xyz = 1, then G contains a clique on C ∪ {(cid:96)y, rz}, whence χ(G) (cid:62) p + 2. If, on the other hand, xyz = 0, then we claim that κ(G) (cid:54) p. By Lemma 2.5, the claim will follow if we exhibit a vertex ordering (cid:67) such that odegG,(cid:67)(v) (cid:54) p for all v ∈ V(G). We use an ordering where L ∪ R \ {(cid:96)y, rz} (cid:67) (cid:96)y (cid:67) {rz} ∪ C and the ordering within each set is arbitrary. By construction of Hx, each vertex in L ∪ R \ {(cid:96)y, rz} has total degree at most p. For each vertex v ∈ {rz} ∪ C, we trivially have odegG,(cid:67)(v) (cid:54) p because C = p. Finally, since xyz = 0, the vertex rz is not a neighbor of (cid:96)y; so odegG,(cid:67)((cid:96)y) = C = p. This proves the claim. When λ (cid:62) 1, Alice and Bob introduce edges so as to create the blow-up graph Gλ, as in Definition 5.1. By Lemma 5.2, if xyz = 1, then Gλ has a (p + 2)λ-clique, whereas if xyz = 0, then κ(Gλ) (cid:54) (p + 1)λ − 1. In the former case, χ(Gλ) (cid:62) (p + 2)λ = (q + 1)λ, so that Gλ ∈ G1(n, q, λ); cf. Definition 5.3. In the latter case, κ(Gλ) (cid:54) qλ − 1, so that Gλ ∈ G2(n, q, λ). Thus, solving graph-dist(n, q, λ) on Gλ reveals xyz. (cid:3) Our coloring lower bounds are straightforward consequences of the above lemma. Theorem 5.6. Given a single randomized pass over a stream of edges of an n-vertex graph G, succeeding with probability at least 2/3 at either of the following tasks requires Ω(n2/λ2) space, where λ (cid:62) 1 is an integer parameter: (i) produce a proper (κ + λ)-coloring of G; (ii) produce an estimate κ such that κ − κ (cid:54) λ. Furthermore, if we require λ = O(cid:0)κ 2−γ(cid:1), where γ > 0, then neither task admits a semi-streaming algorithm. 1 17 Proof. An algorithm for either task (i) and or task (ii) immediately solves graph-dist with appropriate parameters, implying the Ω(n2/λ2) bounds, thanks to Lemma 5.5. For the "furthermore" statement, note that with the stated guarantee on λ would require Ω(n1+2γ) space, which is not in (cid:101)O(n). the graphs in the family G2 constructed in the proof of Lemma 5.5 have κ = Θ(n), so performing either task (cid:3) coloring is possible in semi-streaming space whereas producing a (κ + O(cid:0)κ 2−γ(cid:1))-coloring is not. We leave Combining the above result with the algorithmic result in Theorem 4.1, we see that producing a (κ + o(κ))- 1 open the question of whether this gap can be tightened. Second Flavor: Degeneracy Known in Advance. We now show that the coloring problem remains just as hard even if the algorithm knows the degeneracy of the graph before seeing the edge stream. Theorem 5.7. Given as input an integer κ, followed by a stream of edges of an n-vertex graph G with degeneracy κ, a randomized one-pass algorithm that produces a proper (κ + λ)-coloring of G requires Ω(n2/λ2) bits of space. Furthermore, if we require λ = O(cid:0)κ 2−γ(cid:1), where γ > 0, then the task does not admit a 1 semi-streaming algorithm. Proof. We reduce from indexN, where N = p2, using a plan analogous to the one used in proving Lemma 5.5. Alice and Bob will construct a graph on n = 5λp vertices, using their respective inputs x ∈ {0, 1}p×p and (y, z) ∈ [p] × [p]. First, we consider the case λ = 1. We use the vertex set L (cid:93) R (cid:93) L (cid:93) R (cid:93) C, where L = {(cid:96)1, . . . (cid:96)p}, R = {r1, . . . , rp}, L = {(cid:96)1, . . . , (cid:96)p}, R = {r1, . . . , rp}, and C = p. Let x be the bitwise complement of x. Alice introduces the edges of the gadget graph Hx (from Definition 5.4), realized on L ∪ R, and the edges of Hx realized on L ∪ R. For ease of notation, put (cid:96) := (cid:96)y, r := rz, (cid:96) := (cid:96)y, r := rz, and S := C ∪ {(cid:96), r, (cid:96), r}. Bob introduces all possible edges within S , except for {(cid:96), r} and {(cid:96), r}. Let G be the resulting graph. We claim that the degeneracy κ(G) = p + 2. To prove this, we consider the case xyz = 1 (the other case, xyz = 0, is symmetric). By construction, G contains a clique on the p + 3 vertices in C ∪ {(cid:96), r, (cid:96)}; therefore, by definition of degeneracy, κ(G) (cid:62) p + 2. To show that κ(G) (cid:54) p + 2, it will suffice to exhibit a vertex ordering (cid:67) such that odegG,(cid:67)(v) (cid:54) p + 2 for all v ∈ V(G). To this end, consider an ordering where V(G) \ S (cid:67) (cid:96) (cid:67) S \ {(cid:96)} and the ordering within each set is arbitrary. Each vertex v ∈ V(G) \ S has odegG,(cid:67)(v) (cid:54) deg(v) (cid:54) p and each vertex v ∈ S \ {(cid:96)} has odegG,(cid:67)(v) (cid:54)(cid:12)(cid:12)(cid:12)S \ {(cid:96)}(cid:12)(cid:12)(cid:12) − 1 = p + 2. As for the vertex (cid:96), since xyz = 1 − xyz = 0, by the construction in Definition 5.4, r is not a neighbor of (cid:96); therefore, odegG,(cid:67)((cid:96)) (cid:54)(cid:12)(cid:12)(cid:12)S \ {(cid:96), r}(cid:12)(cid:12)(cid:12) = p + 2. Let A be a streaming algorithm that behaves as in the theorem statement. Recall that we are considering λ = 1. Since κ(G) = p + 2 for every instance of indexN, Alice and Bob can simulate A on their constructed graph G by first feeding it the number p + 2, then Alice's edges, and then Bob's. When A succeeds, the coloring it outputs is a proper (p + 3)-coloring; therefore it must repeat a color inside S , as S = p + 4. But S has exactly one pair of non-adjacent vertices: the pair {(cid:96), r} if xyz = 0, and the pair {(cid:96), r} if xyz = 1. Thus, an examination of which two vertices in S receive the same color reveals xyz, solving the indexN instance. It follows that A must use at least R→(indexN) = Ω(N) = Ω(p2) bits of space. Now consider an arbitrary λ. Alice and Bob proceed as above, except that they simulate A on the blow-up graph Gλ. Since G always has a (p + 3)-clique and κ(G) = p + 2, the two halves of Lemma 5.2 together imply κ(Gλ) = (p + 3)λ − 1. So, when A succeeds, it properly colors Gλ using at most (p + 4)λ − 1 colors. For each A ⊆ V(G), abusing notation, let Aλ denote its corresponding set of vertices in Gλ (cf. Definition 5.1). Since S λ = (p + 4)λ, there must be a color repetition within S λ. Reasoning as above, this repetition must occur within {(cid:96), r}λ when xyz = 0 and within {(cid:96), r}λ when xyz = 1. Therefore, Bob can examine the coloring to solve indexN, showing that A must use Ω(N) = Ω(p2) = Ω(n2/λ2) space. The "furthermore" part follows by observing that κ(Gλ) = Θ(cid:0)V(Gλ)(cid:1). (cid:3) 18 Multiple Passes. The streaming algorithm from Section 4.1 is one-pass, as are the lower bounds proved above. Is the coloring problem any easier if we are allowed multiple passes over the edge stream? We now give a simple argument showing that, if we slightly generalize the problem, it stays just as hard using multiple (O(1) many) passes. The generalization is to allow some edges to be repeated in the stream. In other words, the input is a multigraph G. Clearly, a coloring is proper for G iff it is proper for the underlying simple graph G, so the relevant algorithmic problem is to properly (κ + λ)-color G, where κ := κ(G). Note that our algorithm in Section 4.1 does, in fact, solve this more general problem. Theorem 5.8. Given as input an integer κ, followed by a stream of edges of an n-vertex multigraph G whose underlying simple graph has degeneracy κ, a randomized p-pass algorithm that produces a proper (κ + λ)-coloring of G requires Ω(n2/(λ2 p)) bits of space. This holds even if the stream is insertion-only, with each edge appearing at most twice. Proof. As usual, we prove this for λ = 1 and appeal to the Blow-Up Lemma (Lemma 5.2) to generalize. We reduce from int-findN, with N = . Let Alice and Bob treat their inputs as (xi j)1(cid:54)i< j(cid:54)n and (yi j)1(cid:54)i< j(cid:54)n in some canonical way. Alice (resp. Bob) converts their input into an edge stream consisting of pairs (i, j) such that i < j and xi j = 0 (resp. yi j = 0). The concatenation of these streams defines the multigraph G given to the coloring algorithm. Let (h, k) be the unique pair such that xhk = yhk = 1. Note that the underlying simple graph G is Kn minus the edge {h, k}. Therefore, κ = n − 2 and so, in a proper (n − 1)-coloring of G, there must be a repeated color and this can only happen at vertices h and k. (2p − 1)s bits of communication. Therefore, s = Ω(N/p) = Ω(n2/p). Thus, a p-pass (κ + 1)-coloring algorithm using s bits of space leads to a protocol for int-findN using (cid:3) (cid:17) (cid:16)n 2 5.2 Query Complexity Lower Bounds We now turn to the general graph query model [Gol17]. Recall that our algorithm from Section 4.2 produces a (κ + o(κ))-coloring while making at most (cid:101)O(n3/2) queries, without needing to know κ in advance. Here, we shall prove that the number of colors cannot be improved to κ + 1: that would preclude sublinear complexity. In fact, we prove more general results, similar in spirit to the streaming lower bounds from the previous section. For these lower bounds, we use another family of gadget graphs. Definition 5.9. Given a large integer p (a size parameter), the gadgets for that size are (2p + 1)-vertex graphs on vertex set A (cid:93) B, where A = {a1, . . . , ap+1} and B = {b1, . . . , bp}. Let H be the graph consisting of a clique on A and a clique on B, with no edges between A and B. For 1 (cid:54) i < j (cid:54) p, let Hi j be a graph on the same vertex set obtained by slightly modifying H as follows (see Figure 1c): E(Hi j) = E(H) \(cid:8){ai, a j},{bi, b j}(cid:9) ∪(cid:8){ai, b j},{a j, bi}(cid:9) . (5) Notice that the vertex ap+1 is not touched by any of these modifications. The relevant properties of these gadget graphs are as follows. Lemma 5.10. For all 1 (cid:54) i < j (cid:54) p, κ(Hi j) = p − 1, whereas the chromatic number χ(H) = p + 1. Proof. The claim about χ(H) is immediate. Consider a particular graph Hi j. The subgraph induced by A \ {ai} is a p-clique, so κ(Hi j) (cid:62) p − 1. Now consider the following ordering (cid:67) for Hi j: B (cid:67) ai (cid:67) A \ {ai}, where the order within each set is arbitrary. For each v ∈ B, odegHi j,(cid:67)(v) (cid:54) deg(v) = p−1. For each v ∈ A\{ai}, odegHi j,(cid:67)(v) (cid:54) A\{ai}−1 = p−1. Finally, ai has exactly p−1 neighbors in A\{ai} (by construction, a j is not a neighbor), so odegHi j,(cid:67)(ai) = p−1. By Lemma 2.5, it follows that κ(Hi j) (cid:54) p − 1. (cid:3) 19 Our proofs will use these gadget graphs in reductions from a pair of basic problems in decision tree complexity. Consider inputs that are vectors in {0, 1}N: let 0 denote the all-zero vector and, for i ∈ [N], let ei denote the vector whose ith entry is 1 while all other entries are 0. Let unique-orN and unique-findN denote the following partial functions on {0, 1}N: unique-orN(x) = if x = 0 , if x = ei , for i ∈ [N] , 1 , (cid:63) , otherwise; unique-findN(x) = if x = ei , for i ∈ [N] , (cid:63) , otherwise. 0 , i , Informally, these problems capture, respectively, the tasks of (a) determining whether there is a needle in a haystack under the promise that there is at most one needle, and (b) finding a needle in a haystack under the promise that there is exactly one needle. Intuitively, solving either of these problems with high accuracy should require searching almost the entire haystack. Formally, let Rdt δ ( f ) denote the δ-error randomized query complexity (a.k.a. decision tree complexity) of f . Elementary considerations of decision tree complexity lead to the bounds below (for a thorough discussion, including formal definitions, we refer the reader to the survey by Buhrman and de Wolf [BdW02]). Fact 5.11. For all δ ∈ (0, 1 δ (unique-findN) (cid:62) (1− δ)N−1. (cid:3) δ (unique-orN) (cid:62) (1−2δ)N and Rdt 2), we have Rdt With this setup, we turn to lower bounds of the first flavor. Lemma 5.12. Solving graph-dist(n, p, λ) in the general graph query model requires Ω(n2/λ2) queries. More precisely, there is a constant c > 0 such that for every integer λ (cid:62) 1 and every sufficiently large integer p, there is a setting n = n(p, λ) for which every randomized query algorithm for graph-dist(n, p, λ) requires at least cn2/λ2 queries in the worst case. 2 Proof. We reduce from unique-orN, where N = , using the following plan. Put n = (2p + 1)λ. Let C be a query algorithm for graph-dist(n, p, λ). Based on C, we shall design a 1 3-error algorithm A for unique-orN that makes at most as many queries as C. By Fact 5.11, this number of queries must be at least N/3 = Ω(p2) = Ω(n2/λ2). As usual, we detail our reduction for λ = 1; the Blow-up Lemma (Lemma 5.2) then handles general λ. By Lemma 5.10, H ∈ G1 whereas each Hi j ∈ G2 (cf. Definition 5.3, taking q = p). We now design A. Let x ∈ {0, 1}N be the input to A. Using a canonical bijection, let us index the bits of x as xi j, where 1 (cid:54) i < j (cid:54) p. Algorithm A simulates C and outputs 1 iff C decides that its input lies in G2. Since C makes queries to a graph, we shall design an oracle for C whose answers, based on query answers for input x to A, will implicitly define a graph on vertex set V := A (cid:93) B, as in Definition 5.9. The oracle answers queries as follows. • For i, j ∈ [p], it answers Pair(ai, a j) and Pair(bi, b j) with 1 − xi j. • For i, j ∈ [p], it answers Pair(ai, b j) and Pair(a j, bi) with xi j. • For i ∈ [p], it answers Pair(ap+1, ai) with 1 and Pair(ap+1, bi) with 0. • For i ∈ [p] and d ∈ [p − 1], it answers Neighbor(ai, d) with a j if xi j = 0 and b j if xi j = 1, where j = d if d < i, and j = d + 1 otherwise. • For i, d ∈ [p], it answers Neighbor(ai, p) with ap+1 and Neighbor(ap+1, d) with ad. • For i ∈ [p] and d ∈ [p − 1], it answers Neighbor(bi, d) with b j if xi j = 0 and a j if xi j = 1, where j = d if d < i, and j = d + 1 otherwise. • For all other combinations of v ∈ V and d ∈ N, it answers Neighbor(v, d) = ⊥. (cid:17) (cid:16)p 20 By inspection, we see that the graph defined by this oracle is H if x = 0 and is Hi j if x = ei j. Furthermore, the oracle answers each query by making at most one query to the input x. It follows that A makes at most as many queries as C and decides unique-orN with error at most 1 3. This completes the proof for λ = 1. To handle λ > 1, we modify the oracle in the natural way so that the implicitly defined graph is Hλ when (cid:3) i j when x = ei j. We omit the details, which are routine. x = 0 and Hλ As an immediate consequence of Lemma 5.12, we get the following query lower bounds. Theorem 5.13. Given query access to an n-vertex graph G, succeeding with probability at least 2/3 at either of the following tasks requires Ω(n2/λ2) queries, where λ (cid:62) 1 is an integer parameter: (i) produce a proper (κ + λ)-coloring of G; (ii) produce an estimate κ such that κ − κ (cid:54) λ. We now prove a lower bound of the second flavor, where the algorithm knows κ in advance. (cid:3) 2 Theorem 5.14. Given an integer κ and query access to an n-vertex graph G with κ(G) = κ, an algorithm that, with probability 2 3, produces a proper (κ + λ)-coloring of G must make Ω(n2/λ2) queries. Proof. We focus on the case λ = 1; the general case is handled by the Blow-up Lemma, as usual. (cid:16)p (cid:17) Let C be an algorithm for the coloring problem. We design an algorithm A for unique-findN, where , using the same reduction as in Lemma 5.12, changing the post-processing logic as follows: A N = outputs (i, j) as its answer to unique-findN(x), where 1 (cid:54) i < j (cid:54) p is such that ai and a j are colored the same by C. To prove the correctness of this reduction, note that when x = ei j, the graph defined by the simulated oracle is Hi j and κ(Hi j) = p − 1 (Lemma 5.10). Suppose that C is successful, which happens with probability 3. Then C properly p-colors Hi j. Recall that V(Hi j) = A (cid:93) B, where A = p + 1; there must therefore at least 2 be a color repetition within A. The only two non-adjacent vertices inside A are ai and a j, so A correctly answers (i, j). By Fact 5.11, A must make Ω(N) = Ω(p2) queries. (cid:3) 5.3 A Combinatorial Lower Bound Finally, we explore a connection between degeneracy based coloring and the list coloring problem. In the latter problem, each vertex has a list of colors and the goal is to find a corresponding list coloring -- i.e., a proper coloring of the graph where each vertex receives a color from its list -- or to report that none exists. Assadi et al. [ACK19] proved a beautiful Palette Sparsification Theorem, a purely graph-theoretic result that connects the (∆ + 1)-coloring problem to the list coloring problem. Define a graph G to be [(cid:96), r]δ-randomly list colorable (briefly, [(cid:96), r]δ-RLC) if choosing r random colors per vertex, independently and uniformly without replacement from the palette [(cid:96)], permits a list coloring with probability at least 1 − δ using these chosen lists.2 Their theorem can be paraphrased as follows. Fact 5.15 (Assadi et al. [ACK19], Theorem 1). There exists a constant c such that every n-vertex graph G is (cid:3) [∆(G) + 1, c log n]1/n-RLC. Indeed, this theorem is the basis of the various coloring results in their work. Let us outline how things work in the streaming model, focusing on the space usage. Given an input graph G that is promised to be [(cid:96), r]1/3-RLC, for some parameters (cid:96), r that may depend on G, we sample r random colors from [(cid:96)] for each vertex before reading the input. Chernoff bounds imply that the conflict graph -- the subgraph of G consisting only of edges between vertices whose color lists intersect -- is of size O(E(G)r2/(cid:96)), w.h.p.. Using 2When r (cid:62) l, this procedure simply produces the list [(cid:96)] for every vertex. 21 E(G) (cid:54) n∆/2, taking (cid:96) = ∆ + 1 and r = O(log n) bounds this size by (cid:101)O(n), so a semi-streaming space bound suffices to collect the entire conflict graph. (For full details, see Lemma 4.1 in [ACK19].) Finding a list space usage to be (cid:101)O(n), we need r = O(polylog n). This raises the following combinatorial question: what is coloring of the conflict graph (which exists with probability at least 2/3) yields an (cid:96)-coloring of G. For a similar technique to work in our setting, we would want (cid:96) ≈ κ. Recalling that E(G) (cid:54) nκ, for the the smallest λ for which we can guarantee that every graph is [κ + λ, O(polylog n)]1/3-RLC? not possible with λ = O(κ By the discussion above, our streaming lower bound in Theorem 5.7 already tells us that such a result is 2−γ). Our final result (Theorem 5.17 below) proves that we can say much more. Let Jn,t denote the graph Kt + Kn−t, i.e., the graph join of a t-clique and an (n − t)-sized independent set. 1 More explicitly, Jn,t = (A (cid:93) B, E) , where A = t, B = n − t, E = {{u, v} : u ∈ A, v ∈ A ∪ B, u (cid:44) v} . Lemma 5.16. For integers 0 < r (cid:54) t < n, if Jn,t is [κ + κ/r, r]δ-RLC, then δ (cid:62) 1 − rn/(r + 1)n−t. Proof. Take a graph Jn,t with vertices partitioned into A and B as in eq. (6). An ordering with B (cid:67) A shows that κ = κ(Jn,t) = t. We claim that for every choice of colors lists for vertices in A, taken from the palette [t + t/r], the probability that the chosen lists for B permit a proper list coloring is at most p := rn/(r + 1)n−t. This will prove that δ (cid:62) 1 − p. (6) To prove the claim, consider a particular choice of lists for A. Fix a partial coloring ψ of A consistent with these lists. If ψ is not proper, there is nothing to prove. Otherwise, since A induces a clique, ψ must assign t distinct colors to A. In order for a choice of lists for B to permit a proper extension of ψ to the entire graph, every vertex of B must sample a color from the remaining t/r colors in the palette. Since r colors are chosen per vertex, this event has probability at most (cid:32) r · (cid:33)B (cid:18) t/r t + t/r = r r + 1 (cid:19)n−t . The claimed upper bound on p now follows by a union bound over the rt possible partial colorings ψ. (cid:3) This easily leads to our combinatorial lower bound, given below. In reading the theorem statement, note that the restriction on edge density strengthens the theorem. Theorem 5.17. Let n be sufficiently large and let m be such that n (cid:54) m (cid:54) n2/ log2 n. If every n-vertex graph G with Θ(m) edges is [κ(G) + λ, c log n]1/3-RLC for some parameter λ and some constant c, then we must have λ > κ(G)/(c log n). Proof. Suppose not. Put t = (cid:100)m/n(cid:101), r = c log n, and consider the graph Jn,t defined in eq. (6). By the bounds on m, E(Jn,t) = t(t − 1)/2 + t(n− t) = Θ(nt) = Θ(m). Put κ := κ(Jn,t). By assumption, Jn,t is [κ + κ/r, r]-RLC, so Lemma 5.16 implies that (cid:33)n (cid:32) 1 − 1 r + 1 (cid:54) 2 3 rn (r + 1)n−t = (cid:18)− n r + 1 (cid:19) (r + 1)t (cid:54) exp + t ln(r + 1) . Since t = O(n/ log2 n) and r = c log n, this is a contradiction for sufficiently large n. (cid:3) We remark that the above result rules out the possibility of using a palette sparsification theorem along the lines of Assadi et al. [ACK19] to obtain a semi-streaming coloring algorithm that uses fewer colors than Algorithm 1 (with the setting ε = 1/ log n). More generally, suppose we were willing to tolerate a weaker notion of palette sparsification by sampling O(logd n) colors per vertex, for some d (cid:62) 1: this would increase the space complexity of an algorithm based 22 on such sparsification by a polylog n factor. By Lemma 5.16, arguing as in Theorem 5.17, we would need to spend at least κ + κ/Θ(logd n) colors. This is no better than the number of colors obtained using Algorithm 1 with the setting ε = 1/ logd n, which still maintains semi-streaming space. In fact, palette sparsification does not immediately guarantee a post-processing runtime that is better than exponential, because we need to color the conflict graph in post-processing. Meanwhile, recall that Algorithm 1 has (cid:101)O(n) post-processing time via a straightforward greedy algorithm. Furthermore, since there exist "hard" graphs Jn,t at all edge densities from Θ(n) to Θ(n2/ log2 n), we cannot even hope for a semi-streaming palette-sparsification-based algorithm that might work only for sparse graphs or only for dense graphs. Acknowledgement We gratefully acknowledge several helpful discussions we have had with Sepehr Assadi (especially those that called to our attention a nuance with the Congested Clique algorithm) and Deeparnab Chakrabarty. References [ABI86] [Abl96] Noga Alon, L´aszl´o 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. Farid Ablayev. Lower bounds for one-way probabilistic communication complexity and their application to space complexity. Theor. Comput. Sci., 175(2):139 -- 159, 1996. [ACK19] Sepehr Assadi, Yu Chen, and Sanjeev Khanna. Sublinear algorithms for (∆+ 1) vertex coloring. In Proc. 30th Annual ACM-SIAM Symposium on Discrete Algorithms, page To Appear, 2019. [Bar16] [BB04] [BB06] Leonid Barenboim. Deterministic (∆+ 1)-coloring in sublinear (in ∆) time in static, dynamic, and faulty networks. Journal of the ACM (JACM), 63(5):47, 2016. Nicolas Barnier and Pascal Brisset. Graph coloring for air traffic flow management. Annals of operations research, 130(1-4):163 -- 178, 2004. Balabhaskar Balasundaram and Sergiy Butenko. Graph domination, coloring and cliques in telecommunications. In Handbook of Optimization in Telecommunications, pages 865 -- 890. Springer, 2006. [BCHN18] Sayan Bhattacharya, Deeparnab Chakrabarty, Monika Henzinger, and Danupon Nanongkai. In Proc. 39th Annual ACM-SIAM Symposium on Dynamic algorithms for graph coloring. Discrete Algorithms, pages 1 -- 20, 2018. [BCK+17] Luis Barba, Jean Cardinal, Matias Korman, Stefan Langerman, Andr´e van Renssen, Marcel Roeloffzen, and Sander Verdonschot. Dynamic graph coloring. In Workshop on Algorithms and Data Structures, pages 97 -- 108, 2017. [BDH18] Soheil Behnezhad, Mahsa Derakhshan, and Mohammad Taghi Hajiaghayi. Brief announcement: Semi-mapreduce meets congested clique. CoRR, abs/1802.10297, 2018. [BdW02] Harry Buhrman and Ronald de Wolf. Complexity measures and decision tree complexity: a survey. Theor. Comput. Sci., 288(1):21 -- 43, 2002. [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. 23 [BE11] [BE13] Leonid Barenboim and Michael Elkin. Deterministic distributed vertex coloring in polylogarith- mic time. Journal of the ACM (JACM), 58(5):23, 2011. Leonid Barenboim and Michael Elkin. Distributed Graph Coloring: Fundamentals and Recent Developments. Synthesis Lectures on Distributed Computing Theory. Morgan & Claypool Publishers, 2013. [BEPS16] Leonid Barenboim, Michael Elkin, Seth Pettie, and Johannes Schneider. The locality of distributed symmetry breaking. Journal of the ACM (JACM), 63(3):20, 2016. [BKS17] Paul Beame, Paraschos Koutris, and Dan Suciu. Communication steps for parallel query processing. Journal of the ACM (JACM), 64(6):40, 2017. [BKV12] Bahman Bahmani, Ravi Kumar, and Sergei Vassilvitskii. Densest subgraph in streaming and mapreduce. International Conference on Very Large Data Bases, 5(5):454 -- 465, 2012. [CAC+81] Gregory J Chaitin, Marc A Auslander, Ashok K Chandra, John Cocke, Martin E Hopkins, and Peter W Markstein. Register allocation via coloring. Computer languages, 6(1):47 -- 57, 1981. [CFG+18] Yi-Jun Chang, Manuela Fischer, Mohsen Ghaffari, Jara Uitto, and Yufan Zheng. Simple graph coloring algorithms for congested clique and massively parallel computation. CoRR, abs/1808.08419, 2018. [CH90] [Cha82] [CLP18] [CRT05] [DG04] Fred C Chow and John L Hennessy. The priority-based coloring approach to register allocation. ACM Transactions on Programming Languages and Systems (TOPLAS), 12(4):501 -- 536, 1990. Gregory J Chaitin. Register allocation & spilling via graph coloring. In ACM Sigplan Notices, volume 17, pages 98 -- 105, 1982. Yi-Jun Chang, Wenzheng Li, and Seth Pettie. An optimal distributed (∆+ 1)-coloring algorithm. In Proc. 50th Annual ACM Symposium on the Theory of Computing, pages 445 -- 456, 2018. Bernard Chazelle, Ronitt Rubinfeld, and Luca Trevisan. Approximating the minimum spanning tree weight in sublinear time. SIAM Journal on computing, 34(6):1370 -- 1379, 2005. Jeffrey Dean and Sanjay Ghemawat. Mapreduce: Simplified data processing on large clusters. In 6th Symposium on Operating System Design and Implementation (OSDI 2004), San Francisco, California, USA, December 6-8, 2004, pages 137 -- 150, 2004. [FHK16] Pierre Fraigniaud, Marc Heinrich, and Adrian Kosowski. Local conflict coloring. In Proc. 57th Annual IEEE Symposium on Foundations of Computer Science, pages 625 -- 634, 2016. [FK96] Uriel Feige and Joe Kilian. Zero knowledge and the chromatic number. Conference on Computational Complexity, page 278, 1996. In Annual IEEE [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. Preliminary version in Proc. 31st International Colloquium on Automata, Languages and Programming, pages 531 -- 543, 2004. [GI10] Anna C. Gilbert and Piotr Indyk. Sparse recovery using sparse matrices. Proceedings of the IEEE, 98(6):937 -- 947, 2010. 24 [GL17] Mohsen Ghaffari and Christiana Lymouri. Simple and near-optimal distributed coloring for sparse graphs. In 31st International Symposium on Distributed Computing (DISC 2017), page 20, 2017. [Gol17] Oded Goldreich. Introduction to Property Testing. Cambridge University Press, 2017. [GR08] [HLL18] [HSS16] [Joh99] [KP06] [KP11] [Lei79] [Len13] Oded Goldreich and Dana Ron. Approximating average parameters of graphs. Random Structures & Algorithms, 32(4):473 -- 493, 2008. Nicholas J. A. Harvey, Christopher Liaw, and Paul Liu. Greedy and local ratio algorithms in the mapreduce model. In Proceedings of the 30th on Symposium on Parallelism in Algorithms and Architectures, SPAA 2018, Vienna, Austria, July 16-18, 2018, pages 43 -- 52, 2018. David G Harris, Johannes Schneider, and Hsin-Hao Su. Distributed (∆+ 1)-coloring in sublog- arithmic rounds. In Proc. 48th Annual ACM Symposium on the Theory of Computing, pages 465 -- 478, 2016. Ojvind Johansson. Simple distributed ∆+ 1-coloring of graphs. Information Processing Letters, 70(5):229 -- 232, 1999. Subhash Khot and Ashok Kumar Ponnuswami. Better inapproximability results for maxclique, chromatic number and min-3lin-deletion. In International Colloquium on Automata, Languages and Programming, pages 226 -- 237, 2006. Kishore Kothapalli and Sriram Pemmaraju. Distributed graph coloring in a few rounds. In Proc. 30th ACM Symposium on Principles of Distributed Computing, pages 31 -- 40, 2011. Frank Thomson Leighton. A graph coloring algorithm for large scheduling problems. Journal of research of the national bureau of standards, 84(6):489 -- 506, 1979. Christoph Lenzen. Optimal deterministic routing and sorting on the congested clique. In Proc. 32nd ACM Symposium on Principles of Distributed Computing, pages 42 -- 50, 2013. [LPPP05] Zvi Lotker, Boaz Patt-Shamir, Elan Pavlov, and David Peleg. Minimum-weight spanning tree construction in O(log log n) communication rounds. SIAM J. Comput., 35(1):120 -- 131, 2005. [LS86] [Lub86] [MOT14] Vahid Lotfi and Sanjiv Sarin. A graph coloring algorithm for large scale scheduling problems. Computers & operations research, 13(1):27 -- 32, 1986. Michael Luby. A simple parallel algorithm for the maximal independent set problem. SIAM J. Comput., 15(4):1036 -- 1053, 1986. Farnaz Moradi, Tomas Olovsson, and Philippas Tsigas. A local seed selection algorithm for overlapping community detection. In 2014 IEEE/ACM International Conference on Advances in Social Networks Analysis and Mining (ASONAM 2014), pages 1 -- 8, 2014. [MTVV15] Andrew McGregor, David Tench, Sofya Vorotnikova, and Hoa T Vu. Densest subgraph in dynamic graph streams. In International Symposium on Mathematical Foundations of Computer Science, pages 472 -- 482, 2015. [Par18] Merav Parter. Colloquium on Automata, Languages and Programming, pages 160:1 -- 160:14, 2018. (∆+1) coloring in the congested clique model. In Proc. 45th International 25 [PL96] [PR07] [PS96] [PS18] [RA15] [Raz92] Taehoon Park and Chae Y Lee. Application of the graph coloring algorithm to the frequency assignment problem. Journal of the Operations Research society of Japan, 39(2):258 -- 265, 1996. Michal Parnas and Dana Ron. Approximating the minimum vertex cover in sublinear time and a connection to distributed algorithms. Theoretical Computer Science, 381(1-3):183 -- 196, 2007. Alessandro Panconesi and Aravind Srinivasan. On the complexity of distributed network decomposition. Journal of Algorithms, 20(2):356 -- 374, 1996. Merav Parter and Hsin-Hao Su. Randomized (Delta+1)-Coloring in O(log* Delta) Congested Clique Rounds. In Proc. 32nd International Symposium on Distributed Computing, pages 39:1 -- 39:18, 2018. Ryan A. Rossi and Nesreen K. Ahmed. The network data repository with interactive graph analytics and visualization. In Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, 2015. Alexander Razborov. On the distributional complexity of disjointness. Theor. Comput. Sci., 106(2):385 -- 390, 1992. Preliminary version in Proc. 17th International Colloquium on Automata, Languages and Programming, pages 249 -- 253, 1990. [RSV15] Jaikumar Radhakrishnan, Saswata Shannigrahi, and Rakesh Venkat. Hypergraph two-coloring in the streaming model. arXiv preprint arXiv:1512.04188, 2015. [SW10] [TZP18] [Zuc06] Johannes Schneider and Roger Wattenhofer. A new technique for distributed symmetry breaking. In Proc. 29th ACM Symposium on Principles of Distributed Computing, pages 257 -- 266, 2010. Simon Thevenin, Nicolas Zufferey, and Jean-Yves Potvin. Graph multi-coloring for a job scheduling application. Discrete Applied Mathematics, 234:218 -- 235, 2018. David Zuckerman. Linear degree extractors and the inapproximability of max clique and chromatic number. In Proc. 38th Annual ACM Symposium on the Theory of Computing, pages 681 -- 690, 2006. 26
1506.08392
1
1506
2015-06-28T12:56:32
A Linear-Size Logarithmic Stretch Path-Reporting Distance Oracle for General Graphs
[ "cs.DS" ]
In 2001 Thorup and Zwick devised a distance oracle, which given an $n$-vertex undirected graph and a parameter $k$, has size $O(k n^{1+1/k})$. Upon a query $(u,v)$ their oracle constructs a $(2k-1)$-approximate path $\Pi$ between $u$ and $v$. The query time of the Thorup-Zwick's oracle is $O(k)$, and it was subsequently improved to $O(1)$ by Chechik. A major drawback of the oracle of Thorup and Zwick is that its space is $\Omega(n \cdot \log n)$. Mendel and Naor devised an oracle with space $O(n^{1+1/k})$ and stretch $O(k)$, but their oracle can only report distance estimates and not actual paths. In this paper we devise a path-reporting distance oracle with size $O(n^{1+1/k})$, stretch $O(k)$ and query time $O(n^\epsilon)$, for an arbitrarily small $\epsilon > 0$. In particular, our oracle can provide logarithmic stretch using linear size. Another variant of our oracle has size $O(n \log\log n)$, polylogarithmic stretch, and query time $O(\log\log n)$. For unweighted graphs we devise a distance oracle with multiplicative stretch $O(1)$, additive stretch $O(\beta(k))$, for a function $\beta(\cdot)$, space $O(n^{1+1/k} \cdot \beta)$, and query time $O(n^\epsilon)$, for an arbitrarily small constant $\epsilon >0$. The tradeoff between multiplicative stretch and size in these oracles is far below girth conjecture threshold (which is stretch $2k-1$ and size $O(n^{1+1/k})$). Breaking the girth conjecture tradeoff is achieved by exhibiting a tradeoff of different nature between additive stretch $\beta(k)$ and size $O(n^{1+1/k})$. A similar type of tradeoff was exhibited by a construction of $(1+\epsilon,\beta)$-spanners due to Elkin and Peleg. However, so far $(1+\epsilon,\beta)$-spanners had no counterpart in the distance oracles' world. An important novel tool that we develop on the way to these results is a {distance-preserving path-reporting oracle}.
cs.DS
cs
A Linear-Size Logarithmic Stretch Path-Reporting Distance Oracle for General Graphs∗ Michael Elkin † Seth Pettie ‡ July 22, 2018 Abstract In [33] Thorup and Zwick came up with a landmark distance oracle. Given an n-vertex undirected graph G = (V, E) and a parameter k = 1, 2, . . ., their oracle has size O(kn1+1/k), and upon a query (u, v) it constructs a path Π between u and v of length δ(u, v) such that dG(u, v) ≤ δ(u, v) ≤ (2k − 1)dG(u, v). The query time of the oracle from [33] is O(k) (in addition to the length of the returned path), and it was subsequently improved to O(1) [36, 13]. A major drawback of the oracle of [33] is that its space is Ω(n · log n). Mendel and Naor [23] devised an oracle with space O(n1+1/k) and stretch O(k), but their oracle can only report distance estimates and not actual paths. In this paper we devise a path-reporting distance oracle with size O(n1+1/k), stretch O(k) and query time O(nǫ), for an arbitrarily small ǫ > 0. In particular, for k = log n our oracle provides logarithmic stretch using linear size. Another variant of our oracle has size O(n log log n), polylogarithmic stretch, and query time O(log log n). For unweighted graphs we devise a distance oracle with multiplicative stretch O(1), ad- ditive stretch O(β(k)), for a function β(·), space O(n1+1/k · β), and query time O(nǫ), for an arbitrarily small constant ǫ > 0. The tradeoff between multiplicative stretch and size in these oracles is far below Erdos's girth conjecture threshold (which is stretch 2k − 1 and size O(n1+1/k)). Breaking the girth conjecture tradeoff is achieved by exhibiting a tradeoff of different nature between additive stretch β(k) and size O(n1+1/k). A similar type of tradeoff was exhibited by a construction of (1 + ǫ, β)-spanners due to Elkin and Peleg [18]. However, so far (1 + ǫ, β)-spanners had no counterpart in the distance oracles' world. An important novel tool that we develop on the way to these results is a distance- preserving path-reporting oracle. We believe that this oracle is of independent interest. ∗A preliminary version of this paper was published in SODA'15 [19]. †Department of Computer Science, Ben-Gurion University of the Negev, Beer-Sheva, 84105, Israel, [email protected] This research has been supported by the Israeli Academy of Science, grant 593/11, and by the Binational Science Foundation, grant 2008390. In addition, this research has been supported by the Lynn and William Frankel Center for Computer Science. A part of this research was performed while visiting the the Center for Massive Algorithms (MADALGO), which is supported by Danish National Research Foundation grant DNRF84. ‡Department of Computer Science, University of Michigan, Ann Arbor. This research has been supported by the Binational Science Foundation, grant 2008390. A part of this research was performed while visiting the Center for Massive Algorithms (MADALGO), which is supported by Danish National Research Foundation grant DNRF84. 1 1 Introduction 1.1 Distance Oracles for General Graphs In the distance oracle problem we wish to preprocess a weighted undirected n-vertex graph G = (V, E). As a result of this preprocessing we construct a compact data structure (which is called distance oracle) D(G), which given a query pair (u, v) of vertices will efficiently return a distance estimate δ(u, v) of the distance dG(u, v) between u and v in G. Moreover, the distance oracle should also compute an actual path Π(u, v) of length δ(u, v) between these vertices in G. We say that a distance oracle is path-reporting if it does produce the paths Π(u, v) as above; otherwise we say that it is not path-reporting. The most important parameters of a distance oracle are its stretch, its size, and its worst-case query time.1 The stretch α of a distance oracle D(G) is the smallest (in fact, infimum) value such that for every u, v ∈ V , dG(u, v) ≤ δ(u, v) ≤ α · dG(u, v). The term distance oracle was coined by Thorup and Zwick [33]. See their paper also for a very persuasive motivation of this natural notion. In their seminal paper Thorup and Zwick [33] devised a path-reporting distance oracle (henceforth, TZ oracle). The TZ oracle with a parameter k = 1, 2, . . . has size O(k · n1+1/k), stretch 2k − 1 and query time O(k). As argued in [33], this tradeoff between size and stretch is essentially optimal for k ≤ log n log log n , as Erdos' girth conjecture implies that Ω(n1+1/k) space is required for any k. Note, however, that k · n1+1/k = Ω(n · log n), and Thorup and Zwick [33] left it open if one can obtain meaningful distance oracles of linear size (or, more generally, size o(n log n)). A partial answer to this question was provided by Mendel and Naor [23], who devised a distance oracle with size O(n1+1/k), stretch O(k) and query time O(1). Alas, their distance oracle is inherently not path-reporting. Specifically, the oracle of [23] stores a collection of O(k · n1/k) hierarchically-separated trees (henceforth, HSTs; see [8] for its definition), whose sizes sum up to O(n1+1/k). The query algorithm for this oracle can return paths from these HSTs, i.e., paths which at best can belong to the metric closure of the original graph. These paths will typically not belong to the graph itself. One can try to convert this collection into a collection of low-stretch spanning trees of the input graph G using star-decomposition or petal-decomposition techniques (see [16, 3]). However, each of this spanning trees is doomed to have n − 1 edges, making the size of the entire structure as large as Ω(k · n1+1/k). (In addition, with the current state-of-the-art techniques with low-stretch spanning trees one can only achieve bounds which are somewhat worse than the optimal ones achievable with HSTs. Hence the approach that we have just outlined will probably produce an oracle with stretch ω(k), while using space O(k · n1+1/k).) For a parameter t ≥ 1 their oracle uses space O(n·t) and provides stretch O(√t·n2/√t) for weighted graphs. The query time of their oracle is O(log t · logn wmax), where wmax is the aspect ratio of the graph, i.e., the ratio between the heaviest and the lightest edge. For unweighted graphs their oracle exhibits roughly the same behavior. For a parameter ǫ > 0 it uses space O(n · t/ǫ) and provides stretch O(t · n1/t(t + nǫ/t)). Another result in this direction was recently obtained by Elkin, Neiman and Wulff-Nilsen [17]. 1The query time of all path-reporting distance oracles that we will discuss is of the form O(q + Π), where Π is the path returned by the query algorithm. To simplify the notation we will often omit the additive term of O(Π). 2 log n The distance oracles of [17] are the first path-reporting oracles that use o(n log n) space and provide non-trivial stretch. However, their stretch is by far larger than that of the oracles of [33, 23]. Therefore the tantalizing problem of whether one can have a linear-size path-reporting distance oracle with logarithmic stretch remained wide open. In the current paper we answer this log log n ≤ k ≤ log n, and any arbitrarily small constant question in the affirmative. For any k, ǫ > 0, our path-reporting distance oracle has stretch O(k), size O(n1+1/k) and query time O(nǫ). (When ǫ > 0 is subconstant the stretch becomes O(k) · (1/ǫ)O(1).) Hence our oracle achieves an optimal up to constant factors tradeoff between size and stretch in the range log log n ≤ k ≤ log n, i.e., in the range "missing" in the Thorup-Zwick's result. Though our query time is nǫ for an arbitrarily small constant ǫ > 0 is much larger than Thorup-Zwick's query time, we stress that all existing path-reporting distance oracles either use space Ω(n · log n) [33, 36, 13] or have stretch nΩ(1) [17]. (The query time of the TZ oracle was recently improved to O(1) in [36, 13].) The only previously existing path-reporting distance oracle that achieves the optimal tradeoff in this range of parameters can be obtained by constructing a (2k − 1)-spanner2 with O(n1+1/k) edges and answering queries by conducting Dijkstra explorations in the spanner. However, with this approach the query time is O(n1+1/k). Our result is a drastic improvement of this trivial bound from O(n1+1/k) to O(nǫ), for an arbitrarily small constant ǫ > 0. log n We also can trade between the stretch and the query time. Specifically, a variant of our oracle uses O(n log log n) space, has stretch O(loglog4/3 7 n) ≈ O(log6.76 n) and query time O(log log n). For log n a comparison, the path-reporting distance oracle of [17] with this stretch uses space Ω(n · log log n ) and has query time O(log log n · logn wmax). We also remark that using a super-constant (but not trivial) query time is a common place by now in the distance oracles literature. In particular, this is the case in the oracles of Porat and Roditty [30], Agarwal and Godfrey [5] and of Agarwal et al. [6]. 1.2 Distance Oracles with Stretch (α, β) for Unweighted Graphs We say that a distance oracle D(G) provides stretch (α, β) for a pair of parameters α ≥ 1, β ≥ 0 if for any query (u, v) it constructs a path Π(u, v) of length δ(u, v) which satisfies dG(u, v) ≤ δ(u, v) ≤ α· dG(u, v) + β. The notion of (α, β)-stretch is originated from the closely related area of spanners. A subgraph G′ = (V, H) is said to be an (α, β)-spanner of a graph G = (V, E) , H ⊆ E, if for every pair u, v ∈ V , it holds that dH(u, v) ≤ α · dG(u, v) + β. This notion was introduced in [18], where it was shown that for any ǫ > 0 and k = 1, 2, . . ., for any n-vertex unweighted graph G = (V, E) there exists a (1 + ǫ, β)-spanner with O(β · n1+1/k) edges, where β = β(ǫ, k) is independent of n. Later a number of additional constructions of (1 + ǫ, β)-spanners with similar properties were devised in [15, 35, 29]. It is natural to attempt converting these constructions of spanners into distance oracles with a similar tradeoff between stretch and size. However, generally so far such attempts were not successful. See, e.g., the discussion titled "Additive Guarantees in Distance Oracles" in the intro- duction of [25]. Patra¸scu and Roditty [25] devised a distance oracle with stretch (2, 1) and size O(n5/3), and query time O(1). Abraham and Gavoille [1] generalized the result of [25] to devise a distance oracle with stretch (2k − 2, 1) and space O(n1+(2/(2k−1))). (The query time in [1] is unspecified.) 2For a parameter t ≥ 1, G′ = (V, H) is a t-spanner of a graph G = (V, E), H ⊆ E, if dH (u, v) ≤ t · dG(u, v). 3 Note, however, that neither of these previous results achieves multiplicative stretch o(k) with size O(n1+1/k), at the expense of an additive stretch. (This is the case with the result of [18] in the context of spanners, where the multiplicative stretch becomes as small as 1 + ǫ, for an arbitrarily small ǫ > 0.) In this paper we devise the first distance oracles that do achieve such a tradeoff. Specifically, our path-reporting distance oracle has stretch (O(1), β(k)), space O(β(k) · n1+1/k), β(k) = kO(log log k), and query time O(nǫ), for an arbitrarily small ǫ > 0. The multiplicative stretch O(1) here is a polynomial function of 1/ǫ, but it can be made much smaller than k. (Think, e.g., of ǫ > 0 being a constant and k being a slowly growing function of n.) We can also have stretch (o(k), β(k)), space O(β(k) · n1+1/k) and query time nO(k−γ ), where γ > 0 is a universal constant. (Specifically, the theorem holds, e.g., for γ = 1/7.) In both these results the tradeoff between multiplicative stretch and size of the oracle is below Erdos' girth conjecture barrier (which is stretch 2k − 1 and space O(n1+1/k)). In fact, it is known that when the additive stretch is 0, distance oracles for general n-vertex graphs that have size O(n1+1/k) must have multiplicative stretch Ω(k) [33, 22, 21]. Our results, like the results of [18] for spanners, break this barrier by introducing an additive stretch β(k). To the best of our knowledge, our distance oracles are the first distance oracles that exhibit this behavior. Using known lower bounds we also show that there exist no distance labeling schemes with stretch (O(1), β(k)) and maximum label size O(β(k)· n1/k). (Rather one needs labels of size nΩ(1) for this.) This is also the case for routing schemes. (See Section 2 for relevant definitions.) We also show that in the cell-probe model of computation any distance oracle for unweighted undirected n-vertex graphs with stretch (O(1), β(k)) and space O(β(k) · n1+1/k) has query time Ω(k). This is in contrast to distance oracles with multiplicative stretch, which can have constant query time [23, 13]. 1.3 Distance Oracles for Sparse Graphs A central ingredient in all our distance oracles is a new path-reporting distance oracle for graphs with O(n) edges. The most relevant result in this context is the paper by Agarwal et al. [6]. In this paper the authors devised a (not path-reporting)3 linear-size distance oracle which given a parameter k = 1, 2, . . . provides distance estimates with stretch 4k − 1, uses linear space and has time O(n1/(k+1)). (Their result is, in fact, more general than this. We provide this form of their result to facilitate the comparison.) In this paper we present the first path-reporting linear-size distance oracle for this range of parameters. Specifically, our linear-size oracle (see Corollary 6.4) has stretch O(klog4/3 7) and query time O(n1/k), for any constant parameter k of the form k = (4/3)h, h = 1, 2, . . .. 1.4 A Distance-Preserving Path-Reporting Distance Oracle In [14] the authors showed that for any n-vertex graph G = (V, E) and a collection P of P pairs of vertices there exists a subgraph G′ = (V, H) of size O(max{n + √n · P,√P · n}) so that for every (u, v) ∈ P, dH(u, v) = dG(u, v). In this paper we devise the first distance-oracle counterpart of this result. Specifically, our distance oracle uses O(n + P 2) space, and for any query (u, v) ∈ P 3It was erroneously claimed in [6] that all their distance oracles are path-reporting. While their distance oracles with stretch smaller than 3 are path-reporting (albeit their space requirement is superlinear), this is not the case for their oracles with stretch 4k − 1, k ≥ 1 [4]. 4 it produces the exact shortest path Π between u and v in O(Π) time, where Π is the number of edges in Π. We employ this distance oracle very heavily in all our other constructions. Remark: The construction time of our distance-preserving oracle is O(n·P 2)+ O(m·min{n, P}). The construction time of our path-reporting oracle for sparse graphs is O(m · n) = O(n2λ), where λ = m/n. The construction time of our oracles with nearly-linear space for general graphs is O(n2+1/k). Finally, the construction time of our oracle for unweighted graphs with a hybrid multiplicative-additive stretch is O(β(k)n2+1/k) = kO(log log k) O(n2+1/k). (In both cases k is the stretch parameter of the respective oracle.) 1.5 Related Work There is a huge body of literature about distance oracles by now. In addition to what we have already surveyed there are probe-complexity lower bounds by Sommer et al. [32]. There is an important line of work by Patra¸scu et al. [26, 25] on oracles with rational stretch. Finally, Baswana and Sen [11], Baswana and Kavitha [10] and Baswana et al. [9] improved the preprocessing time of the TZ oracle. 1.6 Structure of the Paper We start with describing our distance preserving oracle (Section 3). We then proceed with devis- ing our basic path-reporting oracle for sparse graphs (Section 4). This oracle can be viewed as a composition of an oracle from Agarwal et al. [6] with our distance-preserving oracle from Section 3. The oracle is described for graphs with small arboricity. Its extension to general sparse graphs (based on a reduction from [6]) is described in Section 5. Then we devise a much more elaborate multi-level path-reporting oracle for sparse graphs. The oracle of [6] and our basic oracle from Sec- tion 4 both use just one set of sampled vertices. Our multi-level oracle uses a carefully constructed hierarchy of sampled sets which enables us to get the query time down from n1/2+ǫ to nǫ. Next we proceed (Section 6) to using this multi-level oracle for a number of applications. Specifically, we use it to construct a linear-size logarithmic stretch path-reporting oracle with query time nǫ, linear-size polylogarithmic stretch path-reporting oracle with query time O(log log n), and finally, oracles that break the girth barrier for unweighted graphs. Our lower bounds can be found in Section 7. 2 Preliminaries For a pair of integers a ≤ b, we denote [a, b] = {a, a + 1, . . . , b}, and [b] = [1, b]. The arboricity of a graph G is given by λ(G) = maxU⊆V,U≥2 E(U ) U−1 , where E(U) is the set of edges induced by the vertex set U. We denote by degG(u) the degree of a vertex u in G; we omit G from this notation whenever G can be understood from the context. We use the notation O(f (n)) = O(f (n)polylog(f (n))) and Ω(f (n) = Ω(f (n)/polylog(f (n))). We say that a function f () is quasi- polynomial if f (n) ≤ nlogO(1) n. A distance-labeling scheme for a graph G = (V, E) assigns every vertex v ∈ V a short label ϕ(v). Given a pair of labels ϕ(u), ϕ(v) of a pair of vertices u, v ∈ V , the scheme computes an 5 estimate δ(ϕ(u), ϕ(v)). This estimate has to be within a factor α, for some α ≥ 1, from the actual distance dG(u, v) between u and v in G. The parameter α is called the stretch of the labeling scheme, and the maximum number of bits employed by one of the labels is called the (maximum) label size of the scheme. A closely related notion is that of compact routing scheme. Here each vertex v is assigned a label ϕ(v) and a routing table ψ(v). Given a label ϕ(u) of routing destination u and its own routing table ψ(v), the vertex v = v0 needs to be able to compute the next hop v1. Given the table ψ(v1) of v1 and the destination's label ϕ(u), the vertex v1 computes the next hop v2, etc. The resulting path v = v0, v1, v2, . . . has to end up eventually in u, and its length needs to be at most α times longer than the length of the shortest u − v path in G, for a stretch parameter α ≥ 1. In addition to stretch, another important parameter in this context is the maximum number of bits used by the label and the routing table (together) of any individual vertex. This parameter will be referred to as maximum memory requirement of a routing scheme. 3 A Distance-Preserving Path-Reporting Oracle Consider a directed weighted n-vertex graph G = (V, E, ω). (The result given in this section applies to both directed and undirected graphs. However, our other distance oracles apply only to undirected graphs.) Let Pairs ⊆ (cid:0)V 2(cid:1) be a subset of ordered pairs of vertices. We denote its cardinality by P = Pairs. In this section we describe a distance oracle which given a pair (u, v) ∈ Pairs returns a shortest path Πu,v from u to v in G. The query time of the oracle is proportional to the number of edges (hops) Πu,v in Πu,v. The oracle uses O(n + P 2) space. The construction of the oracle starts with computing a set Paths = {Πu,v (u, v) ∈ Pairs} of shortest paths between pairs of vertices from Pairs. This collection of shortest paths is required to satisfy the property that if two distinct paths Π, Π′ ∈ Paths traverse two common vertices x and y in the same order (i.e., e.g., both traverse first x and then y), then they necessarily share the entire subpath between x and y. It is argued in [14] that this property can be easily achieved. We will need the following definitions from [14]. For a path Π = (u0, u1, . . . , uh) and a vertex ui ∈ V (Π), the predecessor of ui in Π, denoted predΠ(ui), is the vertex ui−1 (assuming that i ≥ 1; otherwise it is defined as NULL), and the successor of ui in Π, denoted succΠ(ui), is the vertex ui+1 (again, assuming that i ≤ h − 1; otherwise it is NULL). Definition 3.1 [14] A branching event (Π, Π′, x) is a triple with Π, Π′ ∈ Paths being two distinct paths and x ∈ V (Π)∩V (Π′) be a vertex that belongs to both paths and such that {predΠ(x), succΠ(x)} 6= {predΠ′(x), succΠ′(x)}. We will also say that the two paths Π, Π′ branch at the vertex x. Note that under this definition if Π traverses edges (ui−1, ui), (ui, ui+1) and Π′ traverses edges (ui+1, ui), (ui, ui−1) then (Π, Π′, ui) is not a branching event. It follows directly from the above property of the collection Paths (see also [14], Lemma 7.5, for a more elaborate discussion) that for every pair of distinct paths Π, Π′ ∈ Paths, there are at most two branching events that involve that pair of paths. Let B denote the set of branching events. The overall number of branching events for the set Paths is B ≤ P aths2 = P 2. Our oracle will keep O(1) data for each vertex, O(1) data for each branching event, and O(1) data for each path. Hence the oracle stores O(n + B + P ) data in total. 6 Specifically, in our oracle for every vertex v ∈ V we keep an identity of some path Π ∈ Paths (If there is no path that contains v as an internal point, and two edges of Π incident on v. Π ∈ Paths that contains v as an internal point, then our oracle stores nothing for v in this data structure.) The path Π stored for v will be referred to as the home path of v. In addition, for every branching event (Π, Π′, v) we keep the (at most four) edges of Π and Π′ incident on v. Finally, for every pair (x, y) ∈ Pairs we also store the first and the last edges of the path Πx,y. Observe that the resulting space requirement is at most O(n+B+P ) = O(n+P 2). We assume that the branching events are stored in a hash table of linear size, which allows membership queries in O(1) time per query. The query algorithm proceeds as follows. Given a pair (x, y) ∈ Pairs, we find the first edge (x, x′) of the path Πx,y, and "move" to x′. Then we check if (x′, y) is the last edge of Πx,y. If it is then we are done. Otherwise let Π(x′) denote the home path of x′. (Observe that since the vertex x′ is an internal vertex in Πx,y, it follows that there exists a home path Π(x′) for x′.) Next, we check if Π(x′) = Πx,y. (This test is performed by comparing the identities of the two paths.) If it is the case then we fetch the next edge (x′, x′′) of Π(x′), and move to x′′. Otherwise (if Π(x′) 6= Π(x, y)) then we check if the triple (Π(x′), Πx,y, x′) is a branching event. This check is performed by querying the branching events' hash table. If there is no branching event (Π(x′), Πx,y, x′) then we again fetch the next edge (x′, x′′) of Π(x′), and move to x′′. (In fact, the algorithm does not need to separate between this case and the case that Π(x′) = Πx,y. We distinguished between these cases here for clarity of presentation.) Finally, if there is a branching event (Π(x′), Πx,y, x′) then we fetch from our data structure all the information associated with this event. In particular, we fetch the next edge (x′, x′′) of Πx,y, and move to x′′. In all cases the procedure then recurses with x′′. It is easy to verify that using appropriate hash tables all queries can be implemented in O(1) time per vertex, and in total O(Πx,y) time. We summarize this section with the following theorem. Theorem 3.2 Given a directed weighted graph G = (V, E, ω) and a collection Pairs ⊆(cid:0)V 2(cid:1) of pairs of vertices, our distance-preserving path-reporting oracle (shortly, DPPRO) reports shortest paths Πx,y for query pairs (x, y) ∈ Pairs in O(Πx,y) time. The oracle employs O(n+B+P ) = O(n+P 2) space, where B is the set of branching events for a fixed set of shortest paths between pairs of vertices from Pairs, and P = Pairs. One can construct the shortest paths in O(m · min{P, n}) time. Then for each vertex v one keeps the list of paths that traverse v. For every such path one keeps the two edges of this path which are incident on v. In overall O(n · P 2) additional time one can use these lists to create the list of branching events. A hash table with them can be constructed in additional O(P 2) time. Hence the overall construction time of this oracle is O(m · min{P, n}) + O(n · P 2). Observe that if one is given a set S, S = O(n1/4), of terminals, then Theorem 3.2 provides a linear-size DPPRO (i.e., O(1) words per vertex on average) which can report shortest paths between all pairs of terminals. It is well-known that any distance labeling scheme which is guar- anteed to return exact distances between all pairs of n1/4 terminals must use maximum label size Ω(n1/4) [33]. This is also the case for compact routing schemes [34]. (In the latter case the lower bound of Ω(n1/4) is on the maximum memory requirement of any individual vertex.) 7 We remark that our DPPRO here employs O(n + B + P ) space, whereas the underlying distance preserver has O(n +pn · B) edges [14]. It is plausible that there exists a DPPRO of size O(n +pn · B). We leave this question open. 4 A Basic Distance Oracle for Graphs with Bounded Arboricity In this section we describe a basic variant of our path-reporting distance oracle for weighted undirected graphs G = (V, E, ω) of arboricity λ(G) ≤ λ, for some parameter λ. (We will mostly use this oracle for constant or small values of λ. On the other hand, the result is meaningful for higher values of λ as well.) Our oracle reports paths of stretch O(k), for some positive integer parameter k. Unlike the partial oracle from Section 3, the oracle in this section is a full one, i.e., it reports paths for all possible queries (u, v) ∈ (cid:0)V 2k+2 · λ). (Whp4, the query time is O(n1/2+ 1 2(cid:1). This is the case also for all our other oracles, which will be described in consequent sections. The expected query time of our oracle is O(n1/2+ 1 2k+2 · log n· λ).) The oracle requires O(n) space, in addition to the space required to store the graph G itself. Observe that for λ = O(1) the query time is O(n1/2+ǫ), for an arbitrarily small constant ǫ > 0, while the stretch is O( 1 ǫ ) = O(1). In Section 5 we extend this oracle to general m-edge n-vertex graphs with λ = m n . Our basic oracle employs just one level of sampled vertices, which we (following the terminology of [6]) call landmarks. Each v ∈ V is sampled independently at random with probability ρ n , where ρ is a parameter which will be determined in the sequel. Denote by L the set of sampled vertices (landmarks). Note that IE(L) = ρ. For every vertex v ∈ V we keep the path Π(v) to its closest landmark vertex ℓ(v), breaking ties arbitrarily. Denote by D(v) the length w(Π(v)) of this path. This is a collection of vertex-disjoint shortest paths trees (shortly, SPTs) {T (u) u ∈ L}, where each T (u) is an SPT rooted at u for the subset {v dG(u, v) ≤ dG(u′, v),∀u′ 6= u, u, u′ ∈ L}. (Ties are broken arbitrarily.) This collection is a forest, and storing it requires O(n) space. The oracle also stores the original graph G. For the set of landmarks we compute the complete graph L = (L,(cid:0)L 2(cid:1), dGL). Here dGL stands for the metric of G restricted to the point set L. (In other words, in the landmarks graph L, for every pair u, u′ ∈ L of distinct landmarks the weight ωL(u, u′) of the edge (u, u′) connecting them is defined by ωL(u, u′) = dG(u, u′).) Next we invoke Thorup-Zwick's distance oracle [33] with a parameter k. (Henceforth we will call it the TZ oracle.) One can also use here Mendel-Naor's oracle [23], but the resulting tradeoff will be somewhat inferior to the one that is obtained via the TZ oracle. Denote by H the TZ distance oracle for the landmarks graph L. The oracle requires O(k·L1+1/k) space, and it provides (2k − 1)-approximate paths Πu,u′ in L for pairs of landmarks u, u′ ∈ L. The query time is O(k) (plus O(Πu,u′)). Observe that some edges of Πu,u′ may not belong to the original graph G. We note also that by using more recent oracles [13, 36] one can have here query time O(1), but this improvement is immaterial for our purposes. The TZ oracle H has a useful property that the union H =S{Πu,u′ (u, u′) ∈(cid:0)L 2(cid:1)} of all paths that the oracle returns forms a sparse (2k − 1)-spanner. Specifically, IE(H) = O(k · L1+1/k). 4Here and thereafter we use the shortcut "whp" for "with high probability". The meaning is that the probability is at least 1 − n−c, for some constant c ≥ 2. 8 (This property holds for Mendel-Naor's oracle as well, but there the stretch of the spanner is O(k), where the constant hidden by the O-notation is greater than 2. On the other hand, their space requirement is O(L1+1/k), rather than O(k · L1+1/k).) Fix an oracle H as above for H = O(k · L1+1/k). Whp such an H will be computed by running the procedure that computes the TZ oracle for O(log n) times. We will view the spanner H as a collection of pairs of vertices of our original graph G. Finally, we invoke our distance preserving oracle (shortly, DPPRO) from Section 3 on the graph G and set Pairs = H. We will refer to this oracle as D(G, H). Its size is, with high probability, O(n + H2) = O(n + k2 · L2+2/k). Upon a query (y, y′) ∈ H, this oracle returns a shortest path Πy,y′ between y and y′ in G in time O(Πy,y′). Observe that L is the sum of identical independent indicator random variables L =Pv∈V Iv, where Iv is the indicator random variable of the event {v ∈ L}. Hence, by Chernoff's inequality, for any constant ǫ > 0, IP(L > (1 + ǫ)IE(L)) = IP(L > (1 + ǫ) · ρ) < exp(−Ω(ρ)) . We will set the parameter ρ to be at least c log n, for a sufficiently large constant c. This will ensure that whp L = O(ρ), and so L2+2/k = O(ρ2+2/k). Set ρ so that k2 · ρ2+2/k = Θ(n), i.e., ρ = n k . This guarantees that aside from the storage needed for the original graph, the total space used by our oracle is O(n). 2k+2 · 1 k This completes the construction algorithm of our oracle. Next we describe its query algorithm. We need the following definition. For a vertex v ∈ V , let Ball(v) = {x dG(v, x) < dG(v, ℓ(v))} denote the set of all vertices x which are closer to v than the closest landmark vertex ℓ(v) to v. Given a pair u, v of vertices of G, our oracle starts with testing if u ∈ Ball(v) and if v ∈ Ball(u). To test if u ∈ Ball(v) we just conduct a Dijkstra exploration rooted at v in the graph G, until we discover either u or ℓ(v). (Recall that G is stored in our oracle.) If u is discovered before ℓ(v) we conclude that u ∈ Ball(v), and return the (exact) shortest path between them. Otherwise we conclude that u 6∈ Ball(v). Analogously, the algorithm tests if v ∈ Ball(u). Henceforth we assume that u 6∈ Ball(v) and v 6∈ Ball(u), and therefore the two searches returned u′ = ℓ(u), v′ = ℓ(v), and the shortest paths Π(u) and Π(v) between u and u′ and between v and v′, respectively. (In fact, using the forest of SPTs rooted at landmarks that our oracle stores, the query algorithm can compute shortest paths between u and u′ and between v and v′ in time proportional to the lengths of these paths.) Observe that dG(u′, v′) ≤ dG(u′, u)+dG(u, v)+dG(v, v′), and dG(u′, u), dG(v, v′) ≤ dG(u, v). Hence dG(u′, v′) ≤ 3 · dG(u, v). Then the query algorithm invokes the query algorithm of the oracle H for the landmarks graph L. The latter algorithm returns a path Π′ = (u′ = z0, z1, . . . , zh = v′) in L between u′ and v′. The length ωL(Π′) of this path is at most (2k− 1)· dG(u′, v′) ≤ (6k− 3)· dG(u, v). The time required for this computation is O(k + h), where Π′ = h. For each edge (zi, zi+1) ∈ Π′, i ∈ [0, h− 1], we invoke the query algorithm of the DPPRO D(G, H). (The edges (zi, zi+1) of the path Π′ are typically not edges of the original graph. H is a (2k − 1)-spanner of L produced by the oracle H. Observe that Π′ ⊆ H, and so (zi, zi+1) ∈ H, for every index i ∈ [0, h − 1].) The oracle D(G, H) returns a path Πi between zi and zi+1 in G of length ωL(zi, zi+1) = dG(zi, zi+1). Let Π = Π0 · Π1 · . . .· Πh−1 be the concatenation of these paths. Observe that Π is a path in G between z0 = u′ and zh = v′, and ω( Π) = ω( Πi) = h−1 Xi=0 h−1 Xi=0 dG(zi, zi+1) = h−1 Xi=0 9 ωL(zi, zi+1) = ωL(Π′) ≤ (6k − 3) · dG(u, v) . Finally, the query algorithm returns the concatenated path Π = Π(u)· Π· Π(v) as the approximate path for the pair u, v. This completes the description of the query algorithm of our basic oracle. Observe that ω( Π) = ω(Π(u)) + ω( Π) + ω(Π(v)) ≤ dG(u, v) + (6k − 3) · dG(u, v) + dG(u, v) = (6k − 1) · dG(u, v) . Next, we analyze the running time of the query algorithm. First, consider the step that tests if v ∈ Ball(u) and if u ∈ Ball(v). Denote by X the random variable that counts the number of vertices discovered by some fixed Dijkstra exploration originated at u before the landmark ℓ(u) is discovered. We order all graph vertices by their distance from u in a non-decreasing order, i.e., u = u0, u1, . . . , un−1, such that dG(u, ui) ≤ dG(u, uj) for i ≤ j. (This is the order in which the aforementioned Dijkstra exploration originated at u discovers them.) For an integer value 1 ≤ t ≤ n−1, the probability that X = t is equal to the probability that the vertices u0, u1, . . . , ut−1 are all not sampled and the vertex ut is sampled. Hence X is distributed geometrically with the parameter p = ρ/n. Hence IE(X) = n−1 Xt=1 (1 − p)t · p · t ≤ 1 p = n ρ . (1) ρ log n). ρ λ) edges, and whp O( n ρ (λ + log n)) in expectation, and O( n Also, obviously for any positive constant c, IP(X > n X = O( n ρ c ln n) ≤ (1 − ρ/n)(n/ρ)c ln n ≤ n−c, i.e., whp Recall that the graph G has arboricity at most λ, and thus any set of n′ ≤ n vertices induces O(n′ · λ) edges. Hence Dijkstra algorithm traverses expected O( n ρ λ log n) edges. In an unweighted graph such exploration requires time linear in the number of edges, and in weighted5 graphs the required time is O( n ρ λ · log n) whp. (Recall that Dijkstra algorithm that scans a subgraph (V ′, E′) requires time O(E′+V ′ log V ′).) The second step of our query algorithm queries the distance oracle H for the landmarks graph L. (The query is (u′, v′), u′ = ℓ(u), v′ = ℓ(v).) This query returns a path Π′ between u′ and v′ in L in time O(Π′ + k). Finally, for each of the h = Π′ edges (zi, zi+1), i = 0, 1, . . . , h − 1 of the path Π′, the query algorithm invokes our DPPRO D(G, H) with the query (zi, zi+1). This oracle returns the shortest path Πi between zi and zi+1 in G within time O( Πi). Finally, the algorithm returns the concatenated path Π = Π(u) · Π0 · Π1 · . . . · Πh−1 · Π(v). The running time i=0 Πi) = O( Π), and Π′ ≤ Π. Hence required for producing the path Π0 · . . . · Πh−1 is O(Ph−1 ρ · λ + Π) for unweighted graphs, and the overall expected running time of the algorithm is O( n ρ · (λ + log n) + Π) for weighted. (Observe that the additive term of O(k) is dominated by is O( n O( n ρ · λ). Specifically, we will be using ρ ≤ n/ log n, and k ≤ O(log n).) For the high-probability bounds one needs to multiply the first term of the running time by an additional O(log n) factor in both the unweighted and the weighted cases. 1 2 + 1 2k+2 · Now we substitute ρ = 1 2k+2 . The resulting expected query time becomes O(k · n λ) + O( Π). We summarize the properties of our basic oracle in the following theorem. k · n k 5One subtlety: we have to avoid scanning too many edges with just one endpoint in Ball(u). We store the edges incident to each vertex x in increasing order of their weights, and relax them in that order when x is scanned. As soon as an edge (x, y) is relaxed such that the tentative distance to y is greater than dG(u, ℓ(u)) we can dispense with relaxing the remaining edges. Alternatively, a modification of the sampling rule which we describe in Section 5 also resolves this issue. 10 Theorem 4.1 For an undirected n-vertex graph G of arboricity λ and a positive integer parameter k = 1, 2, . . ., there exists a path-reporting distance oracle of size (whp) O(n) (in addition to the size required to store the input graph G) that returns (6k − 1)-approximate shortest paths Π. The expected query time is O(n 2k+2 · k · (λ + log n)) in weighted ones. (The same bounds on the query time apply whp if one multiplies them by O(log n). In addition, in all cases the query time contains the additive term O( Π).) 2k+2 · k · λ) in unweighted graphs and O(n 2 + 1 2 + 1 1 1 In particular, Theorem 4.1 implies that for any constant ǫ > 0 one can have a path-reporting oracle with query time O(n1/2+ǫλ), which provides O(1)-approximate shortest paths for weighted undirected graphs. Observe also that for k = 1 we obtain a 5-approximate path-reporting oracle with query time O(n3/4λ). We remark that to get the latter oracle one does not need to use the TZ oracle for the landmarks graph L. Rather one can build a DPPRO H for all pairs of landmarks. 2(cid:1) = O(ρ2) = O(√n), and so the size of the oracle (In this case ρ = n1/4, L = O(ρ), Pairs = (cid:0)L H is O(Pairs2 + n) = O(n).) One can build the forest of SPTs rooted at the landmarks in O(m) time. In additional O(m·ρ) = O(k · m · n1/2− 1 2k+2 ) time one can construct the metric closure of L, i.e., the graph L. This graph has n′ = ρ vertices and m′ ≤ ρ2 edges. In O(km′ · n′1/k) = O(kρ2+1/k) = O(k · n 2k+2 ) time one can construct the TZ oracle for it. To construct the DPPRO with P = O(k · ρ1+1/k) = O(k · n1/2) pairs one needs O(n· P 2) + O(k · m · n1/2− 1 2k+2 ) time. Hence the overall construction time of this oracle is O(k2 · n2) + O(k · m · n1/2− 1 m = λ · n edges. In Section 5 we show (see Corollary 5.1) that Theorem 4.1 extends to general graphs with 2k+2 ) = O(k2 · n2) + O(k · m· n1/2− 1 2k+2 ). 2k+1 5 An Extension to General Graphs In this section we argue that Theorem 4.1 can be extended to general n-vertex graphs G = (V, E, ω) with m = λn edges. In its current form the theorem only applies to graphs of arboricity at most λ. While this is sufficient for our main application, i.e., for Theorem 6.7, our another application (Theorem 6.8) requires a more general result. Our extension is based on the reduction of Agarwal et al. [6] of the distance oracle problem in general graphs to the same problem in bounded-degree graphs. Our argument is somewhat more general than the one from [6], as it also applies to path-reporting distance oracles. We provide our extension for the sake of completeness. Given an m-edge n-vertex graph G with λ = m/n, we split each vertex ui into d(u) = ⌈ deg(u) ⌉ copies u(1), u(2), . . . , u(d(u)). Each copy is now selected independently at random with probability ρ/n, for a parameter ρ determined in the same way as in Section 4. The original vertex u is selected to the landmarks' set if and only if at least one of its copies (which will also be called virtual nodes) is selected. Observe that the rule that we have described is equivalent to selecting u with probability d(u) · ρ n = ⌈ deg(u) ⌉ · ρ n . The expected number of selected virtual nodes is λ λ d(v) · ρ n = Xv∈V ρ n ·Xv∈V ⌈ deg(u) λ ⌉ ≤ deg(v) λ ( ρ nXv∈V + 1) = ρ + ρ λnXv∈V deg(v) = 3ρ . The number L of landmarks is at most the number of selected virtual nodes, and so IE(L) ≤ 3ρ. 11 By Chernoff's bound, the number of selected virtual nodes is whp O(ρ), and so, whp, L2+2/k = O(ρ2+2/k) as well. Hence the size of our oracle remains O(n). The rest of the construction algorithm for our distance oracle is identical to that of Section 4. (The only change is the distribution of selecting landmarks.) The query algorithm is identical to the query algorithm from Section 4. In particular, note that the virtual nodes have no effect on the computation, i.e., the returned paths contain only original vertices. Next we argue that the expected query time of the modified oracle is still at most O( n ρ · λ) in unweighted graphs, and O( n ρ · λ log n) in weighted ones. (As usual, we omit the additive term of the number of edges of the returned path.) Specifically, we argue that the tests if v ∈ Ball(u) and if u ∈ Ball(v) can be carried out within the above expected time. Let u = u0, u1, . . . , un−1 be all graph vertices ordered by a Dijkstra exploration originated , . . . , u(d(ui)) from u, and replace each vertex ui by its d(ui) copies u(1) . The copies appear in an i arbitrary order. Since each virtual node has probability ρ n to be selected independently of other vertices, it follows by a previous argument that the number N of virtual nodes that the algorithm encounters before seeing a selected virtual node is O( n ρ ). (The algorithm actually explores only original vertices. For the sake of this argument we imagine that when the algorithm reaches a vertex y it reaches its first copy y(1). Right after that it reaches the next copy y(2), etc., and then reaches y(d(y)). After "reaching" all these copies the algorithm continues to the next original vertex.) i i be a selected copy of ui. (We assume that all copies of uj, for j < i, are not selected, and all copies uh′ Denote the original vertices explored by the algorithm u1, u2, . . . , ui−1, ui, and let uh i , h′ < h, are also not selected.) It follows that N =Pi−1 j=1 d(uj) + h. Hence Hence as well. Thus d(uj)! ≤ IE(N) = O(cid:18)n ρ(cid:19) . ⌉! = O(cid:18)n ρ(cid:19) IE i−1 Xj=1 IE i−1 Xj=1 deg(uj)! = O(cid:18)λn ρ (cid:19) = O(cid:18) m ρ(cid:19) . deg(uj) ⌈ λ IE i−1 Xj=1 Observe that the number of edges explored by the algorithm before reaching ui is at most Pi−1 j=1 deg(uj). (The only edges incident on ui explored by the algorithm are edges (uj, ui), for j < i. These edges are accounted for in the above sum of degrees.) Hence the expected number of edges explored by the algorithm is O( m ρ ) (respectively, O( m ρ · log n)) in unweighted (resp., weighted) graphs. The bounds that hold with high probability are higher by a factor of O(log n). ρ ). Hence its expected running time is O( m Corollary 5.1 Up to constant factors, the result of Theorem 4.1 holds for general undirected unweighted m-edge n-vertex graphs with m = λn. For undirected weighted graphs the expected query time becomes O(n1/2+ 1 n · log n), and the same bound applies whp if one multiplies it by another log n factor. 2k+2 · k · λ · log n) = O(n1/2+ 1 2k+2 · k · m 12 Since IE(L) = O(ρ), the construction time of the oracle is, up to constant factors, the same as in Section 4. This result provides a path-reporting analogue of the result of Agarwal et al. [6], which provides stretch O(k) and query time (nλ)O(1/k). Their oracle is not path-reporting. Our oracle is path- reporting, but its query time is significantly higher, specifically it is n1/2+O(1/k) · k · λ. 6 Oracles with Smaller Query Time In this section we devise two path-reporting oracles with improved query time. The first oracle has size O(m + n) (it stores the original graph), and query time λ · nǫ, for an arbitrarily small ǫ > 0. The stretch parameter of this oracle grows polynomially with ǫ−1. For the time being we will focus on graphs of arboricity at most λ. The argument extends to general graphs with m = λn in the same way as was described in Section 5. Our second oracle has size O(n log log n) (independent of the size of the original graph) and reports stretch-O(loglog4/3 7 n) paths in O(log log n) time. Both draw on techniques used in sublinear additive spanner constructions of [29]. We will later build upon the first oracle to construct additional oracles that work for dense graphs as well. Like the second oracle, these later oracles will not have to store the input graph. 6.1 Construction of an Oracle with time O(λ · nǫ) It will use a hierarchy of In this section we describe the construction algorithm of our oracle. landmarks' sets L1, L2, . . . , Lh, for a positive integer parameter h that will be determined later. For each index i ∈ [h], every vertex v is selected into Li independently at random with probability pi = ρi n , ρ1 > ρ2 > . . . > ρh. The sequence ρ1, ρ2, . . . , ρh will be determined in the sequel. The vertices of Li will be called the i-level landmarks, or shortly, the i-landmarks. For convenience of notation we also denote L0 = V . i (v) denote the one-third-ball of v, and Balli(v) = B1 For each vertex v ∈ V and index i ∈ [h], let ℓi(v) denote the closest i-landmark to v, where ties are broken in an arbitrary consistent way. Denote ri(v) = dG(v, ℓi(v)) the distance between v and its closest i-landmark ℓi(v). Following [29], for a real number 0 < c ≤ 1, let Bc i = {u dG(v, u) < c·ri(v)} denote the ith c-fraction-ball of v. In our analysis c will be set to either 1/3 or 1. Specifically, let B1/3 i (v) = {u dG(v, u) < ri(v)} denote the ith ball of v. For each vertex v ∈ V we keep a shortest path between v and ℓ1(v). (This is a forest of vertex- disjoint SPTs rooted at 1-landmarks. For each 1-landmark u′, its SPT spans all vertices v ∈ V which are closer to u′ than to any other 1-landmark.) Similarly, for each i ∈ [h − 1] and every i-landmark u we keep a shortest path between u and its closest (i + 1)st landmark ℓi+1(u) = u(i+1). Again, this entails storing a forest of vertex-disjoint SPTs rooted at (i + 1)-landmarks, for each each index i ∈ [h − 1]. Overall this part of the oracle requires O(n · h) space. For the hth-level landmarks' set Lh we build a DPPRO Lh described in Section 3. Given a pair u, v of h-landmarks this oracle returns a shortest path Π(u, v) between them in time proportional to the number of edges in this path, i.e., O(Π(u, v)). The space requirement of the oracle Lh is O(n + Lh4), and thus we will select ρh to ensure that Lh4 = O(n), i.e., ρh will be roughly n1/4. Denote also Ph =(cid:0)Lh 2(cid:1) be the set of all pairs of h-landmarks. 13 For each index i ∈ [h − 1], we also build a DPPRO Di for the following set Pi of pairs of i+1(v) is inserted i-landmarks. Each pair of i-landmarks u, v such that either v ∈ B1/3 into Pi. Similarly to the DPPRO Lh, given a pair (u, v) ∈ Pi for some i ∈ [h− 1], the oracle Di returns a shortest path Π(u, v) between u and v in time O(Π(u, v)). Our oracle also stores the graph G itself. We will later show a variant of this oracle that does not store G (Theorem 6.6). The size of the oracle is O(n + Branchi), where Branchi is the set of branching events for the set Pi. Since we aim at a linear size bound, we will ensure that Branchi = O(n), for every i ∈ [h − 1]. We will also construct a hash table Hi for Pi of size O(Pi) that supports membership queries to Pi in O(1) time per query. The resulting h-level oracle will be denoted Λh. i+1(u) or u ∈ B1/3 6.2 The Query Algorithm Next, we describe the query algorithm of our oracle Λh. The query algorithm is given a pair u = u(0), v = v(0) of vertices. The algorithm starts with testing if u ∈ Ball1(v) and if v ∈ Ball1(u). For this test the algorithm just conducts a Dijkstra search from v until it discovers either v(1) or u (and, symmetrically, also conducts a search from u). Observe that by Equation (1), the expected size of Ball1(v) and of Ball1(u) is O( n ρ1 ), and whp both these sets have size O( n ρ1 · λ). (Specifically, it is O( n ρ1 · log n · (λ + log n)) in weighted ones. The expected running time of this step is smaller by a factor of log n than the above bound.) If the algorithm discovers that v ∈ Ball1(u) or that u ∈ Ball1(v) then it has found the shortest In this case the algorithm returns this path. Otherwise it has found ρ1 · log n). Hence the running time of this step is, whp, O( n ρ1 · λ · log n) in unweighted graphs, and O( n path between u and v. u(1) = ℓ1(u(0)) and v(1) = ℓ1(v(0)). In general consider a situation when for some index j, 1 ≤ j ≤ h, the algorithm has already computed u(j) and v(j). In this case, inductively, the algorithm has already computed shortest paths Π(u(0), u(1)), Π(u(1), u(2)), . . . , Π(u(j−1), u(j)) and Π(v(0), v(1)), Π(v(1), v(2)), . . . , Π(v(j−1), v(j)) between u(0) and u(1), u(1) and u(2), . . ., u(j−1) and u(j), v(0) and v(1), v(1) and v(2), . . ., v(j−1) and v(j), respectively. (Note that the base case j = 1 has been just argued.) For j < h, the query algorithm of our oracle Λh then queries the hash table Hj whether the pair (u(j), v(j)) ∈ Pj. If it is the case then the algorithm queries the oracle Dj, which, in turn, returns the shortest path Π(u(j), v(j)) between u(j) and v(j) in time O(Π(u(j), v(j))). The algorithm then reports the concatenated path Π(u, v) = Π(u(0), u(1)) · Π(u(1), u(2)) · . . . Π(u(j−1), u(j)) · Π(u(j), v(j)) · Π(v(j), v(j−1)) · . . . · Π(v(2), v(1)) · Π(v(1), v(0)) . Computing this concatenation requires O(j) ≤ O(Π(u, v)) time. In the complementary case when (u(j), v(j)) 6∈ Pj, the algorithm fetches the prerecorded paths Π(u(j), u(j+1)) and Π(v(j), v(j+1)), and invokes itself recursively on the pair (u(j+1), v(j+1)). (Recall that for each index j, 1 ≤ j ≤ h− 1, the algorithm stores a forest of vertex-disjoint SPTs rooted at (j + 1)-landmarks Lj+1. These SPTs enable us to compute the paths Π(u(j), u(j+1)), Π(v(j), v(j+1)) for all j ∈ [h − 1], in time proportional to the number of edges in these paths.) Finally, if j = h then we query the DPPRO Lh of the graph Lh with the query (u(h), v(h)). (Note that it is not necessary to query if (u(h), v(h)) is in the DPPRO Lh, since, by construction, all 14 such pairs are there.) The query returns the shortest path between them in time O(Π(u(h), v(h))). It follows that the overall running time of the query algorithm is dominated by the time required to compute Π(u(0), u(1)) and Π(v(0), v(1)). Specifically, it is j−1 O( n ρ1 · λ) + Remark: Xi=0 (cid:0)Π(u(i), u(i+1)) + Π(v(i), v(i+1))(cid:1) + Π(u(j), v(j)), where 1 ≤ j ≤ h is the smallest index such that (u(j), v(j)) ∈ Pj. (Recall that for j = h, Ph =(cid:0)Lh 2(cid:1), i.e., all pairs of h-landmarks belong to Ph.) Hence the overall query time is O( n ρ1 ·λ)+O(Π(u, v)+ h), where Π(u, v) is the path that the algorithm ultimately returns. If for each index 0 ≤ j ≤ h−1 at least one of the subpaths Π(u(j), u(j+1)), Π(v(j), v(j+1)) is not empty then h ≤ Π(u, v), and the resulting query time is O( n λ) + O(Π(u, v)). One can artificially guarantee that all these subpaths will not be empty, i.e., that u(j) 6= u(j+1) and v(j) 6= v(j+1), for every j. To do this one can modify the construction slightly so that the set of i-landmarks and the set of j-landmarks will be disjoint for all i 6= j. Under this modification of the algorithm the query time is O( n ρ1 · λ) + O(Π(u, v)), while the stretch guarantee of the oracle (which will be analyzed in Section 6.3) stays the same. This modification can make oracle's performance only worse than it is without this modification, but the bounds on the query time of the modified oracle in terms of the number of edges in the returned path become somewhat nicer. (See Theorem 6.6.) ρ1 6.3 The Stretch Analysis Recall that in the case that v ∈ Ball1(u) or u ∈ Ball1(v) our algorithm returns the exact shortest path between u = u(0) and v = v(0). Hence we next consider the situation when v 6∈ Ball1(u) and u 6∈ Ball1(v). For brevity let d = d(0) = dG(u, v). At this point the algorithm also has already computed u(1) and v(1), along with the shortest paths Π(u(0), u(1)) and Π(v(0), v(1)) be- tween u(0) and u(1) and between v(0) and v(1), respectively. Observe that in this scenario we have dG(u(0), u(1)), dG(v(0), v(1)) ≤ d, and so dG(u(1), v(1)) ≤ dG(u(1), u(0)) + dG(u(0), v(0)) + dG(v(0), v(1)) ≤ 3 · d. Hence if (u(1), v(1)) ∈ P1 then the path Π(u(0), u(1)) · Π(u(1), v(1)) · Π(v(1), v(0)) returned by the algorithm is a 5-approximate path between u and v. Indeed, its length is at most dG(u(0), u(1)) + dG(u(1), v(1)) + dG(v(1), v(0)) ≤ d + 3 · d + d = 5 · d. More generally, suppose the query algorithm reached the j-level landmarks u(j), v(j), for some j, 1 ≤ j ≤ h − 1, and suppose that (u(j), v(j)) 6∈ Pj. This means that v(j) 6∈ B1/3 j+1(u(j)) and u(j) 6∈ B1/3 j+1(v(j)). By definition of the one-third-ball it follows that and dG(u(j), v(j)) ≥ 1 3 · dG(u(j), u(j+1)) = 1 3 · rj+1(u(j)) , dG(u(j), v(j)) ≥ 1 3 · dG(v(j), v(j+1)) = 1 3 · rj+1(v(j)) , 15 where u(j+1) (respectively, v(j+1)) is the (j + 1)-landmark closest to u(j) (resp., v(j)). Hence dG(u(j+1), v(j+1)) ≤ dG(u(j+1), u(j)) + dG(u(j), v(j)) + dG(v(j), v(j+1)) ≤ 7 · dG(u(j), v(j)) . Denote by p, 1 ≤ p ≤ h, the index for which the algorithm discovers that (u(p), v(p)) ∈ Pp. (Since (u(h), v(h)) ∈ Ph for every pair (u(h), v(h)) of h-landmarks, it follows that the index p is well-defined.) We have seen that dG(u(1), v(1)) ≤ 3d, and for every index j, 1 ≤ j ≤ p− 1, dG(u(j+1), v(j+1)) ≤ 7 · dG(u(j), v(j)). Hence for every j, 1 ≤ j ≤ p, it holds that dG(u(j), v(j)) ≤ 3 · 7j−1 · d. Denote d(j) = 3 · 7j−1 · d, for 0 ≤ j ≤ p. Also, dG(u(0), u(1)), dG(v(0), v(1)) ≤ d = d(0), and for every index j, 1 ≤ j ≤ p − 1, dG(u(j), u(j+1)) ≤ 3 · dG(u(j), v(j)) ≤ 3 · d(j) = 32 · 7j−1 · d . Hence the length of the path Π(u(0), u(1)) · . . . · Π(u(p−1), u(p)) · Π(u(p), v(p)) · Π(v(p), v(p−1)) · . . . Π(v(1), v(0)) returned by the algorithm is at most d(0) + 3 · p−1 d(j)! + d(p) + 3 · p−1 Xj=1 Xj=1 d · 2 · 1 + 3 · p−1 Xj=1 d(j)! + d(0) = 3 · 7j−1!! + 3 · 7p−1! = d · (6 · 7p−1 − 1) . Since p ≤ h we conclude that the oracle has stretch at most 6 · 7h−1 − 1. 6.4 The Size of the Oracle We next set the values ρ1 > ρ2 > . . . > ρh so that each of the auxiliary oracles D1,D2, . . . ,Dh−1,Lh For each index i ∈ [h], our oracle stores a forest of (vertex-disjoint) SPTs rooted at i-landmarks. Each of these forests requires O(n) space, i.e., together these h forests require O(n · h) space. requires O(n) space. Each of the hash tables H1,H2, . . . ,Hh associated with these oracles requires less space than its respective oracle. Recall that the parameter ρ1 also determines the query time. (It is O( n λ) + O(Π), where Π the path returned by the algorithm. In the sequel we will often ρ1 skip the additive term of O(Π) when stating the query time.) For each i ∈ [h] we write ρi = nαi, where αi = 1 − (3/4)h−i+1. Observe that αh = 1/4, i.e., ρh = n1/4. Hence IE(Lh) = ρh = n1/4, and by Chernoff's bound, whp, Lh = O(n1/4). (Recall that Lh is a Binomial random variable.) Hence the DPPRO Lh for Ph =(cid:0)Lh 2(cid:1) requires space O(Lh4 + n) = Next we analyze the space requirements of the oracles D1,D2, . . . ,Dh−1. Fix an index i ∈ [h−1], and recall that the space requirement of the DPPRO Di is O(n +Branchi +Pi), where Branchi is the set of branching events for the set Pi of pairs of vertices. Next we argue that (whp) Branchi = O(n). Recall that the set Pi contains all pairs of i-landmarks (u(i), v(i)) such that either v(i) ∈ B1/3 O(n), whp. i+1(u(i)) or u(i) ∈ B1/3 i+1(v(i)). 16 The following two lemmas from [29] are the key to the analysis of the oracle's size. The first says that with our definition of Pi+1 all branching events are confined to (i + 1)st level balls. The second bounds the expected number of branching events in terms of the sampling probabilities. For completeness, the proofs of these lemmas are provided in Appendix A. Lemma 6.1 Suppose that v ∈ B1/3 i+1(u). Then if (x, y) ∈ Pi+1 and there is a branching event between the pairs (u, v) and (x, y) then necessarily x, y ∈ Balli+1(u). i+1(cid:17). Moreover, whp i+1 · log3 n(cid:17), and IE(Branchi) = O(cid:16) ρ4 Lemma 6.2 Whp, Branchi = O(cid:16) ρ4 Pi = O(cid:16) ρ2 Observe that with our choice of ρi (ρi = nαi, αi = 1 − (3/4)h−i+1, for every i ∈ [h]), it holds ρi+1(cid:17) = O(n2αi−αi+1) = for every i ∈ [h − 1] that O(cid:16) ρ4 2 ( 3 O(n1− 1 4 )h−i). Hence by Lemma 6.2, for each i ∈ [h − 1], the oracle Di requires expected space O(n + Branchi + Pi) = O(n). Thus the overall expected space required by our h-level oracle oracle Λh (in addition to the space required to store the original graph G) is O(n · h). Recall that the query time is (whp) O((n/ρ1)λ) = O(n(3/4)h · λ). The argument described in Section 5 enables us to extend these results to general m-edge n-vertex graphs. i+1(cid:17) = O(n4αi−3αi+1) = O(n), and O(cid:16) ρ2 ρ3 ρ3 i ρi+1(cid:17). ρi+1 · log n(cid:17), and IE(Pi) = O(cid:16) ρ2 i i i i ρ3 i Theorem 6.3 For any parameter h = 1, 2, . . . and any n-vertex undirected possibly weighted graph G with arboricity λ, the path-reporting distance oracle Λh uses expected space O(n· h), in addition to the space required to store G. Its stretch is (6·7h−1−1), and its query time is (whp) O(n(3/4)hλ). The same result applies for any m-edge n-vertex graph with λ = m/n. n · log2 n). Specifically, in unweighted graphs with arboricity λ the query time is O((n/ρ1) · λ · log n) = O(n(3/4)h · λ · log n), while in weighted graphs it is O(n(3/4)h · (λ + log n) log n). In unweighted m-edge n-vertex graphs the query time is O(n(3/4)h · m n · log n), while in m-edge n-vertex weighted graphs it is O(n(3/4)h · m By introducing a parameter t = (4/3)h we get query time O(n1/tλ), space O(n · log t), and stretch at most tlog4/3 7. (The exponent is ≈ 6.76.) Corollary 6.4 For any constant t of the form t = (4/3)h (for a positive integer h) and an n- vertex graph G with arboricity λ, our path-reporting distance oracle Λh uses expected space O(n) (in addition to the space needed to store G). It provides stretch at most tlog4/3 7, and its query time is (whp) O(n1/tλ). (For a non-constant t the space requirement becomes O(n · log t).) The same result applies for any m-edge n-vertex graph with λ = m/n. Yet better bounds can be obtained if one is interested in small expected query time. The expected query time is dominated by the time required to test if v ∈ Ball1(u) and if u ∈ Ball1(v). For unweighted graphs these tests require O( n ρ1 λ) = O(n(3/4)hλ) expected time. Corollary 6.5 For any t of the form t = (4/3)h, for a positive integer h, and an n-vertex m-edge graph G, our path-reporting oracle Λh uses expected O(n·h) space in addition to the space required to store G. It provides stretch at most tlog4/3 7, and its expected query time is O(n1/t·(m/n)+log t) for unweighted graphs. In the case of weighted graphs the expected query time is O(n1/t(m/n) · log n). 17 Consider now the oracle Λh for a superconstant number of levels h = log4/3(log n + 1). Then ρ1 = (2n)α1 = n. In other words, all vertices V of G are now defined as the first level landmarks (1-landmarks), i.e., L1 = V . (For levels i = 2, 3, . . . , h, landmarks Li are still selected at random from V with probability ρi/n < 1, independently. For level 1 this probability is 1.) Recall that our oracle starts with testing if v ∈ Ball1(u) and if u ∈ Ball1(v). Now both these balls are empty sets, because all vertices belong to L1. Thus with this setting of parameters the oracle Λh no longer needs to conduct this time-consuming test. Rather it proceeds directly to querying the oracle D1. Remarkably, this variant of our oracle does not require storing the graph G. (Recall that the graph was only used by the query algorithm for testing if v ∈ Ball1(u) and if u ∈ Ball1(v).) The query time of the new oracle is now dominated by the h queries to the oracles D1,D2, . . . ,Dh−1,Lh, i.e., O(h) = O(log log n). Recall that, by the remark at the end of Section 6.2, one can always make our oracle to return paths with at least h edges, and thus the O(h) = O(log log n) additive term in the query time can be swallowed by O(Π), where Π is the path that our oracle returns. 6 · 7h−1 − 1 = O(loglog4/3 7 n). Theorem 6.6 The oracle Λ is a path-reporting oracle with expected space O(n log log n), where n is the number of vertices of its input undirected weighted graph G. Its stretch is O(loglog4/3 7 n) and its query time is O(log log n). (It can be made O(1), but the paths returned by the oracle will then contain Ω(log log n) edges.) Denote by Λ the oracle which was just described. The stretch of Λ is (by Theorem 6.3) Note that by Markov's inequality, Theorem 6.6 implies that one can produce a path-reporting oracle with space O(n log log n), query time O(log log n) and polylogarithmic stretch by just re- peating the above oracle-constructing algorithm for O(log n) times. Whp, in one of the executions the oracle's space will be O(n log log n). Similarly, by the same Markov's argument, Corollary 6.4 implies that whp one can have the space of the oracle Λh bounded by O(n) (in addition to the space required to store the input graph). i i Next we analyze the construction time of our oracle. The h forests rooted at landmarks can be constructed in O(m · h) time. We also spend O(m · n) = O(n2λ) time to compute all-pairs- shortest-paths (henceforth, APSP). Then for each ball Bi+1(u), u ∈ Li, we store all i-landmarks that belong to it. They can be fetched from the APSP structure in O(1) time per i-landmark. The expected size of this data structure is O(Pi) = O( ρ2 ) = O(n). Then we produce all possible quadruples u, v, x, y with v, x, y ∈ Balli+1(u) ∩ Li, u ∈ Li. By the proof of Lemma 6.2, there are expected O( ρ4 ) = O(n) such quadruples. For each of these quadruples we check if ρ3 i+1 the involved shortest paths intersect, and compute the corresponding branching events. Since the length of each such path is whp O( n ρi+1 · log n), it follows that the entire computation can be ) expected time. Recall that ρi+1 = Ω(n1/4), and thus this running time is carried out in O( n2 ρi+1 O(n7/4). In O(n · P 2) = O(n2) additional time we construct the DPPRO Lh for the set of all pairs of h-landmarks. The total expected construction time is therefore dominated by the APSP computation, i.e., it is O(m · n). ρi+1 6.5 Spanner-Based Oracles While the query time of our oracle Λ is close to optimal (there is an additive slack of O(log log n)), its space requirement O(n log log n) is slightly suboptimal, and also its stretch requirement is 18 O(loglog4/3 7 n), instead of the desired O(log n). Next we argue that one can get an optimal space O(n) and optimal stretch O(log n), at the expense of increasing the query time to O(nǫ), for an arbitrarily small constant ǫ > 0. Given an n-vertex weighted graph G = (V, E, ω) we start with constructing an O(log n)- spanner G′ = (V, H, ω) of G with O(n) edges. (See [7]; a faster algorithm was given in [31]. For unweighted graphs a linear-time construction can be found in [27], and a linear-time construction with optimal stretch-space tradeoff can be found in [20].) Then we build the oracle Λh for the spanner G′. The space required by the oracle is (by Corollary 6.4) O(n), plus the space required to store the spanner G′, i.e., also O(n). Hence the total space required for this spanner-based oracle is O(n). Its stretch is the product of the stretch of the oracle, i.e., at most tlog4/3 7, with t = (4/3)h for an integer h, and the stretch of the spanner, i.e., O(log n). Hence the oracle's stretch is O(tlog4/3 7 · log n). The oracle reports paths in G′ = (V, H), but since H ⊆ E, these paths belong to G as well. Observe also that the query time of the spanner-based oracle is O(n1/t · m′ n ), where m′ = H is the number of edges in the spanner. Since m′ = O(n), it follows that the query time is, whp, O(n1/t). We remark also that the spanners produced by [7, 31] have constant arboricity, and thus one does not really need the reduction described in Section 5 for this result. Theorem 6.7 For any constant ǫ > 0, the oracle obtained by invoking the oracle Λh with h = ⌈log4/3 ǫ−1⌉ from Corollary 6.4 on a linear-size O(log n)-spanner is a path-reporting oracle with space O(n), stretch O(log n), and query time O(nǫ). log n log log n ≤ k ≤ log n with O(n1+1/k) edges. As a result we obtain a path-reporting distance oracle with space O(n1+1/k), stretch O(k) and query time O(nǫ+1/k) = O(nǫ+o(1)). Generally, we can use an O(k)-spanner, Observe that Theorem 6.7 exhibits an optimal (up to constant factors) tradeoff between the stretch and the oracle size in the range log log n ≤ k ≤ log n. The only known oracle that exhibits this tradeoff is due to Mendel and Naor [23]. However, the oracle of [23] is not path-reporting, while our oracle is. log n The construction time of this oracle consists of the time required to build the O(log n)-spanner (which is O(n2) [31]) and the construction time of the oracle Λh in G′ (which is also O(n2), because G′ has O(n) edges). Hence its overall construction time is O(n2). In the context of unweighted graphs the same idea of invoking our oracle from Corollary 6.4 on a spanner can be used in conjunction with (1 + ǫ, β)-spanners. Given an unweighted n-vertex graph G = (V, E), let G′ = (V, H) be its (1 + δ, β)-spanner, β = β(δ, k) = (cid:0) log k , with H = O(β · n1+1/k) edges, for a pair of parameters δ > 0, k = 1, 2, . . .. (Such a construction was devised in [18].) For the sake of the following application one can set δ = 1. Invoke the distance oracle from Corollary 6.4 with a parameter t on top of this spanner. We obtain a path- Its stretch is (O(tlog4/3 7), β = β(t, k)), reporting distance oracle with space O(βn1+1/k) (whp). β(t, k) = O(tlog4/3 7 · β(1, k)) = tlog4/3 7 · kO(log log k), and its query time is O(n1/t+1/k), whp. As long log4/3 7 ), the multiplicative stretch is o(k), the additive stretch is still β(k) = kO(log log k), as t = o(k log4/3 7+η!, for an while the space is O(βn1+1/k). arbitrarily small constant η > 0, stretch (o(k), kO(log log k)), and space O(kO(log log k)n1+1/k). In particular, one can have query time n δ (cid:1)O(log k) 1 1 − O k Another variant of this construction has a higher query time O(nǫ), for some arbitrarily small constant ǫ > 0, but its multiplicative stretch is O(1). We just set t to be a large fixed constant 19 and consider k ≫ tlog4/3 7. Then the query time is O(nǫ) whp (ǫ = t−1), stretch is (O(1), poly(1/ǫ)· kO(log log k)), and space O(β · n1+1/k). Theorem 6.8 For any unweighted undirected n-vertex graph G, any arbitrarily small constant ǫ > 0 and any parameter k = 1, 2, . . ., our path-reporting distance oracle has query time O(nǫ) (whp), stretch (O(1), β(k))) and space O(β(k) · n1+1/k) (whp), where β(k) = kO(log log k). Another log4/3 7+η! whp, for an arbitrarily small constant η > 0, variant of this oracle has query time n stretch (o(k), kO(log log k)), and space O(kO(log log k) · n1+1/k) whp. O k 1 − To our knowledge these are the first distance oracles whose tradeoff between multiplicative stretch and space is better than the classical tradeoff, i.e., 2k − 1 versus O(n1+1/k). Naturally, we pay by having an additive stretch. By lower bounds from [33], an additive stretch of Ω(k) is inevitable for such distance oracles. One can also use a (5 + ǫ, kO(1))-spanner with O(n1+1/k) edges from [29] instead of (1 + ǫ )O(log k))-spanner with ( log k ǫ, ( log k ǫ )O(log k)n1+1/k edges from [18] for our distance oracle. As a result the oracle's space bound decreases to O(n1+1/k), its additive stretch becomes polynomial in k, but the multiplicative stretch grows by a factor of 5 + ǫ. In general, any construction of (α, β)- spanners with size O(S · n) can be plugged in our oracle. The resulting oracle will have stretch (tlog4/3 7 · α, tlog4/3 7 · β), size O(Sn + n · log t), and query time O(S · n1/t). The construction time of this oracle is the time needed to construct the (1 + ǫ, β)-spanner G′, plus the construction of Λh on G′. The construction time of [18] is O(n2+1/k). The construction time of the oracle Λh on G′ is O(m′ · n′), where m′ = O(β · n1+1/k) is the number of edges in G′, and n′ = n is the number of vertices in G′. Hence the overall construction time in this case is O(β(k) · n2+1/k) = kO(log log k)n2+1/k. 7 Lower Bounds In this section we argue that one cannot expect to obtain distance labeling or routing schemes (see Section 2 for their definitions) with properties analogous to those of our distance oracles (given by Theorem 6.8 and Corollary 6.5). We also employ lower bounds of Sommer et al. [32] to show that a distance oracle with stretch (O(1), β(k)) and space O(β(k)· n1+1/k) for unweighted n-vertex graphs (like the distance oracle given by Theorem 6.8) must have query time Ω(k). 7.1 Distance Labeling and Routing We start with discussing distance labeling schemes. Suppose for contradiction that there were a t+4 ) and distance labeling scheme D for unweighted n-vertex graphs with maximum label size O(n stretch (t, t · β(k)), for some fixed function β(·), and any parameter k. Consider an infinite family of n-vertex unweighted graphs Gn = (V, En) with girth at least t + 2 and En = Θ(n1+ 1 t+2 ). (Such a family can be easily constructed by probabilistic method; see, e.g., [12], Theorem 3.7(a). Denser t+2 ) different subgraphs of each Gn. extremal graphs can be found in [22, 21].) There are 2Θ(n To achieve stretch t, one would need 2Θ(n1+ 1 t+2 ) distinct encodings for these graphs, i.e., the total 1+ 1 1 20 label size for this task is Ω(n1+ 1 [33], Chapter 5, for this lower bound.) t+2 ), and the maximum individual label size is Ω(n 1 t+2 ). (See. e.g., Replace every edge of G = Gn by a path of length 10t · β(k), consisting of new vertices. The new graph G′n has N = O(n1+ 1 t+2 · t · β(k)) vertices. Invoke the distance labeling scheme D on G′n. For a pair of original vertices u, v (vertices of Gn), the distance between them in G′n is d′(u, v) = 10tβ(k) · dG(u, v). Given their labels ϕ(u) and ϕ(v), the labeling scheme D provides us with an estimate δ(ϕ(u), ϕ(v)) of the distance between them in G′n which satisfies: δ(ϕ(u), ϕ(v)) ≤ t · d′(u, v) + t · β(k) = (10tβ(k) · dG(u, v)) · t + t · β(k) . On the other hand, a path of length dG(u, v) · t + 1 in G between u and v translates into a path of length at most 10t · β(k)(dG(u, v) · t + 1) = 10t2β(k)dG(u, v) + 10tβ(k) between them in G′n. Hence the estimate provided by D corresponds to a path between u and v of length at most dG(u, v)· t in Gn, i.e., via D we obtain a t-approximate distance labeling scheme for Gn. The maximum label size used by D is O(N 1 t+4 ) = O((n t+3 t+2 · t · β(k)) 1 t+4 ) = O(n t+3 (t+2)(t+4) · (β(k)) 1 t+4 ) . However, by the above argument, this label size must be Ω(n 1 t+2 ). Note that t+3 (t+2)(t+4) (β(k)) n 1 t+4 < n 1 t+2 , as long as β(k) < n. This condition holds for any constant k and fixed function β(·), and also for any k = O(log n) and quasi-polynomial function β(·). (Recall that in all relevant upper bounds for spanners/distance oracles/distance labeling schemes, it is always the case that k = O(log n) and β(·) is at most a quasi-polynomial function of k.) Hence this is a contradiction, and there can be t+4 ) and stretch (t, t· β(k)), no distance labeling scheme for unweighted graphs with label size O(n for any parameter k. The same argument clearly applies to routing schemes as well. The only difference is that one needs to use lower bounds on the tradeoff between space and multiplicative stretch for routing due to [28, 34, 2], instead of analogous lower bounds of [33] for distance labeling. 1 To summarize, while Theorem 6.8 provides a distance oracle with stretch (t, t·β(k)) and average space per vertex of O(β(k) · n1/k) for k ≫ tlog4/3 7, for distance labeling or routing one needs at least nΩ(1/t) space per vertex to achieve the same stretch guarantee. Similarly, one cannot have a distance labeling scheme for sparse graphs (graphs G = (V, E) with O(n1+1/k) edges, for some k ≥ 1) with maximum label size O(n1/k) and stretch O(t), for a parameter t ≪ k. 6 A distance labeling scheme as above requires maximum label size of nΩ(1/t), as otherwise one would get a distance labeling with stretch (t, t · poly(k)) for general graphs with maximum label size no(1/t), contradiction. 6Recall that by Corollary 6.5, a path-reporting distance oracle of total size O(n1+1/k) with stretch O(t) and query time O(n 1 tc + 1 k + Π(u, v)) (for a query u, v; the constant c is given by c = log7 4/3) does exist. 21 7.2 Distance Oracles Next we argue that in the cell-probe model of computation (cf., [24]), any distance oracle with size and stretch like in Theorem 6.8 (i.e., size O(n1+1/k) and stretch (O(1), β(k)), for a fixed function β(·)) must have query time Ω(k). We rely on the following lower bound of [32]. Theorem 7.1 [32] A distance oracle with stretch t using query time q requires space S ≥ n1+ c in the cell-probe model with w-bit cells, even on unweighted undirected graphs with maximum degree at most (t · q · w)O(1), where t = o( log w+log log n ), and c is a positive constant. log n t·q / log n Suppose for a contradiction that there exists a distance oracle with stretch (t, t · β(k)), for a t·q / log n (and query pair of parameters t ≪ k and a fixed function β(·), with space at most n1+ c/2 time q) for general unweighted graphs. Let G = (V, E) be an n-vertex unweighted graph with maximum degree at most (t · q · w)O(1), and let G′ be the graph obtained from G by replacing each edge of G by a path of length 10t· β(k). The graph G′ has N ≤ (t · q · w)O(1) · β(k)· n vertices, and an oracle with stretch (t, t · β(k)) for G′ can be used also as a stretch-t oracle for G. The size of this oracle is, by our assumption, at most (n · (t · q · w)O(1) · β(k))1+ c/2 t·q log N < t·q n1+ c/2 log n · ((t · q · w)O(1)β(k))1+ c/2 t·q . As long as ((t · q · w)O(1) · β(k))1+ c/2 c/2 t·q , i.e., as long as t·q < n ((t · q · w)O(1) · β(k)) 2 c t·q+1 < n , (2) we have a contradiction to Theorem 7.1. (As the oracle uses less than n1+ c stretch t and query time q.) t·q / log n space and has For k being at most a mildly growing function of n (specifically, k ≤ logζ n, ζ < 1/2), t = o(k), q ≤ k, w = O(log n), and β(·) being a polynomial (or even a quasi-polynomial) function, the condition (2) holds. Hence in this range of parameters, any distance oracle for unweighted graphs with stretch (t, t · β(k)) and query time q requires space S ≥ n1+ c/2 t·q / log n in the cell-probe model log n with w-bit cells, assuming t = o( log w+log log n ). So if this oracle uses S = O(n1+1/k · β(k)) space, then it holds that n1+1/k · log n· β(k) ≥ n1+ c/2 t·q , i.e., and so q = Ω(k/t). 1 + 1/k + log log n + log β(k) log n ≥ 1 + , c/2 t · q We summarize this lower bound in the next theorem. Theorem 7.2 Let k ≤ logζ n, for any constant ζ < 1/2, t = o(k), w = O(log n), and β(·) being a polynomial or a quasi-polynomial function. In the cell-probe model with w-bit cells any distance oracle for general unweighted undirected n-vertex graphs with space O(β(k) · n1+1/k) and stretch (t, t · β(k)) has query time q = Ω(k/t) = Ω(k). Theorem 7.2 states that in contrast to distance oracles with multiplicative stretch which can have constant query time (see [23, 13]), a distance oracle with stretch (O(1), β(k)) (like the one given by our Theorem 6.8) must have query time Ω(k). 22 Acknowledgements The first-named author wishes to thank Ofer Neiman and Christian Wulff-Nilsen for helpful dis- cussions, and Elad Verbin for explaining him the lower bounds from [32]. References [1] I. Abraham and C. Gavoille. On approximate distance labels and routing schemes with affine stretch. In DISC, pages 404 -- 415, 2011. [2] I. Abraham, C. Gavoille, and D. Malkhi. On space-stretch trade-offs: lower bounds. In SPAA 2006: Proceedings of the 18th Annual ACM Symposium on Parallelism in Algorithms and Architectures, Cambridge, Massachusetts, USA, July 30 - August 2, 2006, pages 207 -- 216, 2006. [3] I. Abraham and O. Neiman. Using petal-decompositions to build a low stretch spanning tree. In STOC, pages 395 -- 406, 2012. [4] R. Agarwal. Personal communication, 2014. [5] R. Agarwal and P. B. Godfrey. Distance oracles for stretch less than 2. In Proceedings of the Twenty-Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2013, New Orleans, Louisiana, USA, January 6-8, 2013, pages 526 -- 538, 2013. [6] R. Agarwal, P. B. Godfrey, and S. Har-Peled. Approximate distance queries and compact routing in sparse graphs. In INFOCOM, pages 1754 -- 1762, 2011. [7] I. Althofer, G. Das, D. P. Dobkin, and D. Joseph. Generating sparse spanners for weighted graphs. In SWAT, pages 26 -- 37, 1990. [8] Y. Bartal. Probabilistic approximations of metric spaces and its algorithmic applications. In FOCS, pages 184 -- 193, 1996. [9] S. Baswana, A. Gaur, S. Sen, and J. Upadhyay. Distance oracles for unweighted graphs: Breaking the quadratic barrier with constant additive error. In ICALP (1), pages 609 -- 621, 2008. [10] S. Baswana and T. Kavitha. Faster algorithms for approximate distance oracles and all-pairs small stretch paths. In FOCS, pages 591 -- 602, 2006. [11] S. Baswana and S. Sen. Approximate distance oracles for unweighted graphs in expected o(n2) time. ACM Transactions on Algorithms, 2(4):557 -- 577, 2006. [12] B. Bollobas. Extremal Graph Theory. Springer-Verlag, 1998. [13] S. Chechik. Approximate distance oracles with constant query time. In Symposium on Theory of Computing, STOC 2014, New York, NY, USA, May 31 - June 03, 2014, pages 654 -- 663, 2014. 23 [14] D. Coppersmith and M. Elkin. Sparse source-wise and pair-wise distance preservers. In SODA: ACM-SIAM Symposium on Discrete Algorithms, pages 660 -- 669, 2005. [15] M. Elkin. Computing almost shortest paths. In Proc. 20th ACM Symp. on Principles of Distributed Computing, pages 53 -- 62, 2001. [16] M. Elkin, Y. Emek, D. A. Spielman, and S.-H. Teng. Lower-stretch spanning trees. In STOC, pages 494 -- 503, 2005. [17] M. Elkin, O. Neiman, and C. Wulff-Nilsen. Space-efficient path-reporting distance oracles. CoRR, abs/1410.0768, 2014. [18] M. Elkin and D. Peleg. Spanner constructions for general graphs. In Proc. of the 33th ACM Symp. on Theory of Computing, pages 173 -- 182, 2001. [19] M. Elkin and S. Pettie. A linear-size logarithmic stretch path-reporting distance oracle for general graphs. In Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Dis- crete Algorithms, SODA 2015, San Diego, CA, USA, January 4-6, 2015, pages 805 -- 821, 2015. [20] S. Halperin and U. Zwick. Inpublished manuscript, 2000. [21] F. Lazebnik and V. A. Ustimenko. Explicit construction of graphs with an arbitrary large girth and of large size. Discrete Applied Mathematics, 60(1-3):275 -- 284, 1995. [22] A. Lubotsky, R. Phillips, and P. Sarnak. Ramanujan graphs. Combinatorica, 8:261 -- 277, 1988. [23] M. Mendel and A. Naor. Ramsey partitions and proximity data structures. In FOCS, pages 109 -- 118, 2006. [24] P. B. Milterson. Cell probe complexity - a survey. In Invited talk and paper in Advances in Data Structures (Preconference workshop of FSTTCS), 1999. [25] M. Patra¸scu and L. Roditty. Distance oracles beyond the Thorup-Zwick bound. In FOCS, pages 815 -- 823, 2010. [26] M. Patra¸scu , L. Roditty, and M. Thorup. A new infinity of distance oracles for sparse graphs. In FOCS, pages 738 -- 747, 2012. [27] D. Peleg and A. Schaffer. Graph spanners. J. Graph Theory, 13:99 -- 116, 1989. [28] D. Peleg and E. Upfal. A tradeoff between size and efficiency for routing tables. J. of the ACM, 36:510 -- 530, 1989. [29] S. Pettie. Low distortion spanners. ACM Transactions on Algorithms, 6(1), 2009. [30] E. Porat and L. Roditty. Preprocess, set, query! Algorithmica, 67(4):516 -- 528, 2013. [31] L. Roditty, M. Thorup, and U. Zwick. Deterministic constructions of approximate distance oracles and spanners. In ICALP, pages 261 -- 272, 2005. 24 [32] C. Sommer, E. Verbin, and W. Yu. Distance oracles for sparse graphs. In FOCS, pages 703 -- 712, 2009. [33] M. Thorup and U. Zwick. Approximate distance oracles. In Proc. of the 33rd ACM Symp. on Theory of Computing, pages 183 -- 192, 2001. [34] M. Thorup and U. Zwick. Compact routing schemes. In Proc. of the 13th Symp. on Parallelism in Algorithms and Architectures, pages 1 -- 10, 2001. [35] M. Thorup and U. Zwick. Spanners and emulators with sublinear distance errors. In Proc. of Symp. on Discr. Algorithms, pages 802 -- 809, 2006. [36] C. Wulff-Nilsen. Approximate distance oracles with improved preprocessing time. In SODA, pages 202 -- 208, 2012. 25 Appendix A Missing proofs In this section we provide proofs of Lemmas 6.1 and 6.2. Proof of Lemma 6.1: Suppose for contradiction that there exists a pair (x, y) ∈ Pi+1 such that the pairs (u, v), (x, y) participate in a branching event β, and such that either x 6∈ Balli+1(u) or y 6∈ Balli+1(u). Then β = (Π(u, v), Π(x, y), z), where Π(u, v) (respectively, Π(x, y)) is a shortest path between u and v (respectively, between x and y), and z is a node at which these two paths branch. Since (x, y) ∈ Pi+1 it follows that either y ∈ B1/3 i+1(y). Without loss of generality suppose that y ∈ B1/3 The proof splits into two cases. In the first case we assume that x 6∈ Balli+1(u), and in the second we assume that y 6∈ Balli+1(u). (Note that roles of x and y are not symmetric.) In both cases we reach a contradiction. 3 · ri+1(x) and dG(u, z) ≤ dG(u, v) < 1 3 · ri+1(u). Denote δ = dG(u, u(i+1)) = ri+1(u), where u(i+1) = ℓi+1(u). Denote also δ′ = dG(u, x). Observe that ri+1(x) ≤ dG(x, u(i+1)) ≤ δ + δ′, and also (since x 6∈ Balli+1(u)) δ′ = dG(u, x) ≥ δ = ri+1(u). Then We start with the case x 6∈ Balli+1(u). Observe that dG(x, z) ≤ dG(x, y) < 1 i+1(x) or x ∈ B1/3 i+1(x). dG(u, z) + dG(z, x) < 1 3 · ri+1(u) + 1 3 · ri+1(x) ≤ δ 3 + 1 3 · (δ + δ′) ≤ δ′ = dG(u, x) . Hence dG(u, z) + dG(z, x) < dG(u, x), contradicting the triangle inequality. We are now left with the case that x ∈ Balli+1(u), but y 6∈ Balli+1(u). Then dG(y, z) ≤ 3 · ri+1(u). In addition, ri+1(x) ≤ dG(x, u(i+1)) ≤ dG(x, y) < 1 dG(x, u) + ri+1(u) ≤ 2δ. (Note that dG(x, u) ≤ δ = ri+1(u), because x ∈ Balli+1(u).) Hence 3 · ri+1(x). Also, dG(u, z) ≤ dG(u, v) < 1 dG(u, z) + dG(z, y) < 1 3 · (ri+1(u) + ri+1(x)) ≤ 1 3 · (δ + 2δ) = δ ≤ dG(u, y) . (The last inequality is because, by an assumption, y 6∈ Balli+1(u).) This is, however, again a contradiction to the triangle inequality. Proof of Lemma 6.2: Recall that (see [14], Lemma 7.5) each pair (u, v), (x, y) may produce at most two branching events. Hence next we focus on providing an upper bound on the number of intersecting pairs of paths Π(u, v), Π(x, y) for (u, v), (x, y) ∈ Pi. By the previous lemma, for a pair (u, v), (x, y) to create a branching event there must be one of these four vertices (without loss of generality we call it u) such that the three other vertices belong to Balli+1(u). Hence the number of intersecting pairs as above is at most (a constant factor multiplied by) the number of quadruples (u, v, x, y) with v, x, y ∈ Balli+1(u). For a fixed ρi+1 · log n(cid:17). (This i-landmark u, the number of vertices in its (i+1)st ball Balli+1(u(i)) is, whp, O(cid:16) n ρi+1 · log n(cid:17) i-landmarks in Balli+1(u). (We select random variable is distributed geometrically with the parameter p = ρi+1 Balli+1(u) has probability ρi bound, whp, there are ρi n .) Each of the vertices in n to belong to Li, independently of other vertices. Hence, by Chernoff's ρi+1 · log n(cid:17) = O(cid:16) ρi n · O(cid:16) n i the constant c hidden by the O-notation in O(cid:16) n expectation is c· ρi Hence the number of triples v, x, y of i-landmarks in Balli+1(u) is, whp, O(cid:16) ρ3 ρi+1 · log n(cid:17) to be sufficiently large. Then the ρi+1 · log n ≥ c· log n. Hence the Chernoff's bound applies with high probability.) i+1 · log3 n(cid:17). The number of i-landmarks u is, by the Chernoff's bound, whp, O(ρi). Hence the number of quadruples as above is, whp, at most ρ3 i O(ρi) · O(cid:18) ρ3 i+1 · log3 n(cid:19) = O(cid:18) ρ4 i+1 · log3 n(cid:19) . ρ3 ρ3 i i i Next we argue that the expected number of quadruples (u, v, x, y) of i-landmarks such that Also, the number of pairs Pi is at most the number of i-landmarks (whp, it is O(ρi)) multiplied by the maximum number of i-landmarks in an (i+ 1)-level ball Balli+1(u) (whp, it is O(cid:16) ρi ρi+1 · log n(cid:17)), ρi+1 · log n(cid:17). i.e., Pi = O(cid:16) ρ2 v, x, y ∈ Balli+1(u) is O(cid:16) ρ4 For a fixed vertex u, write X(u) = I({u ∈ Li}) · Y (u), where Y (u) is the number of triples of distinct i-landmarks different from u which belong to Balli+1(u), and I({u ∈ Li}) is the indicator random variable of the event {u ∈ Li}. (Note that the ball is defined even if u 6∈ Li.) Observe that the random variables I({u ∈ Li}) and Y (u) are independent, and thus ρi+1(cid:17). i+1(cid:17) and that IE(Pi) = O(cid:16) ρ2 ρ3 i i IE(X(u)) = IE(I({u ∈ Li})) · IE(Y (u)) = ρi n · IE(Y (u)) . Let σ = (v1, v2, . . . , vn−1) be the sequence of vertices ordered by the non-decreasing distance from u. (They appear in the order in which the Dijkstra algorithm initiated at u discovers them.) For k = 3, 4, . . . , n − 1, denote by Jk the random variable which is equal to 0 if vk+1 is not the first vertex in σ which belongs to Li+1. If vk+1 is the first vertex as above then Jk is equal to the number of triples vj1, vj2, vj3, 1 ≤ j1 < j2 < j3 ≤ k such that vj1, vj2, vj3 ∈ Li. Also, for each quadruple 1 ≤ j1 < j2 < j3 < j4 ≤ n − 1 of indices, define J(j1, j2, j3, j4) to be the indicator random variable of the event that vj1, vj2, vj3 ∈ Li, vj4 ∈ Li+1, and for each j, 1 ≤ j < j4, the vertex vj is not an (i + 1)-landmark. Observe that IE(J(j1, j2, j3, j4)) =(cid:16) ρi n(cid:17)3 ·(cid:16)1 − ρi+1 n (cid:17)j4−1 ρi+1 n · . Also, IE(Jk) = X1≤j1<j2<j3≤k IE(J(j1, j2, j3, k + 1)) = (cid:18)k 3(cid:19)(cid:16) ρi n(cid:17)3 ·(cid:16)1 − ρi+1 n (cid:17)k ρi+1 n · . Note that Y (u) =Pn−2 k=3 Jk, and so IE(Y (u)) ≤ ∞ Xk=3(cid:18)k 3(cid:19)(cid:16)ρi n(cid:17)3 ·(cid:16)1 − ρi+1 n (cid:17)k ρi+1 n · . ii Denote A = 10 n ρi+1 . For k ≤ A, since (1 − ρi+1 3(cid:19)(cid:16) ρi ρi+1 n(cid:17)3 n ·(cid:16)1 − n (cid:17)k ρi+1 · A Xk=3(cid:18)k n )k = O(1), it follows that = O(cid:18) ρ3 n4 (cid:19) A i · ρi+1 Xk=3 k3 = O(cid:18) ρ3 i+1(cid:19) . ρ3 i Also, ∞ Xk=A+1(cid:18)k ·(cid:16)1 − Denote γ = 1 − ρi+1/n. Then 3(cid:19)(cid:16) ρi n(cid:17)3 ρi+1 n (cid:17)k · ρi+1 n ≤ O(cid:18)ρ3 n4 (cid:19) · i · ρi+1 ∞ Xk=A+1 k3 ·(cid:16)1 − ρi+1 n (cid:17)k . ∞ Xk=A+1 k3γk ≤ d3 dγ3 ∞ Xk=A+1 γk+3 ≤ d3 dγ3 1 1 − γ = Hence 6 (1 − γ)4 = O (cid:18) n ρi+1(cid:19)4! . i i i ∞ · ρ3 ρ3 ρi+1 ρi+1 n n (cid:17)k ·(cid:16)1 − i+1(cid:19) , ). Hence IE(X(u)) = ρi = O(cid:18)ρ3 3(cid:19)(cid:16) ρi n(cid:17)3 Xk=A+1(cid:18)k and so IE(Y (u)) = O( ρ3 ρ3 i+1 n4 (cid:19) · O (cid:18) n ρi+1(cid:19)4! = O(cid:18) ρ3 i · ρi+1 n · IE(Y (u)) = O( ρ4 i+1 · 1 n ). Finally, the overall expected number of quadruples (u, v, x, y) of i-landmarks such that v, x, y ∈ Balli+1(u) is, by linearity of expectation, at most Pv∈V IE(X(u)) = O( ρ4 A similar argument provides an upper bound of O(cid:16) ρ2 ρi+1(cid:17) on the expected number of pairs Pi. For a vertex u, let X′(u) = I({u ∈ Li})·Y ′(u), where Y ′(u) is the number of i-landmarks which belong to Balli+1(u). Clearly, IE(I({u ∈ Li})) = ρi/n, and the two random variables (I({u ∈ Li}) and Y ′(u)) are independent. For every integer k ≥ 1, let J ′k be a random variable which is equal to 0 if vk+1 is not the first vertex in σ which belongs to Li+1. Otherwise it is the number of i-landmarks among v1, v2, . . . , vk. For integer j1, j2, 1 ≤ j1 < j2 ≤ n − 1, let J′(j1, j2) be the indicator random variable of the event that vj1 ∈ Li, vj2 ∈ Li+1, and for every j < j2, it holds that vj 6∈ Li+1. Then We shortly sketch it below. ρ3 i+1 ). i i IE(J′(j1, j2)) = ρi n ·(cid:16)1 − ρi+1 n (cid:17)j2−1 ρi · ρi+1 n2 IE(J′(j1, k + 1)) = IE(J ′k) = ρi · ρi+1 n2 · ∞ Xk=1 . ρi+1 n · · k ·(cid:16)1 − k ·(cid:16)1 − , ρi+1 n (cid:17)k n (cid:17)k . ρi+1 Hence and Write A = 10 n ρi+1 IE(J ′k) = X1≤j1≤k Xk=1 IE(Y ′(u)) ≤ , and ∞ ∞ Xk=1 k(cid:16)1 − ρi+1 n (cid:17)k = A Xk=1 k(cid:16)1 − ρi+1 n (cid:17)k +Xk>A k(cid:16)1 − ρi+1 n (cid:17)k . iii Each term of the first sum is O(1), and thus the first sum is at most O(A2) = O(n2/ρ2 second sum is at most d i+1) as well. Hence 1 i+1). The dγ Pk>A γk+1 ≤ d dγ IE(Y ′(u)) = 1−γ = O(n2/ρ2 · O(cid:18) n2 ρ2 ρi · ρi+1 n2 i+1(cid:19) = O(cid:18) ρi ρi+1(cid:19) . Hence IE(X′(u)) = O(ρ2 Pu∈V IE(X′(u)) = O(ρ2 i /(ρi+1n)), and by linearity of expectation we conclude that IE(Pi) ≤ i /ρi+1). iv
1009.3594
2
1009
2011-08-11T17:52:44
Center-based Clustering under Perturbation Stability
[ "cs.DS" ]
Clustering under most popular objective functions is NP-hard, even to approximate well, and so unlikely to be efficiently solvable in the worst case. Recently, Bilu and Linial \cite{Bilu09} suggested an approach aimed at bypassing this computational barrier by using properties of instances one might hope to hold in practice. In particular, they argue that instances in practice should be stable to small perturbations in the metric space and give an efficient algorithm for clustering instances of the Max-Cut problem that are stable to perturbations of size $O(n^{1/2})$. In addition, they conjecture that instances stable to as little as O(1) perturbations should be solvable in polynomial time. In this paper we prove that this conjecture is true for any center-based clustering objective (such as $k$-median, $k$-means, and $k$-center). Specifically, we show we can efficiently find the optimal clustering assuming only stability to factor-3 perturbations of the underlying metric in spaces without Steiner points, and stability to factor $2+\sqrt{3}$ perturbations for general metrics. In particular, we show for such instances that the popular Single-Linkage algorithm combined with dynamic programming will find the optimal clustering. We also present NP-hardness results under a weaker but related condition.
cs.DS
cs
Center-based Clustering under Perturbation Stability$ Pranjal Awasthi Carnegie Mellon University, Pittsburgh, PA 15213-3891 Avrim Blum Carnegie Mellon University, Pittsburgh, PA 15213-3891 Or Sheffet Carnegie Mellon University, Pittsburgh, PA 15213-3891 1 1 0 2 g u A 1 1 ] S D . s c [ 2 v 4 9 5 3 . 9 0 0 1 : v i X r a Abstract Clustering under most popular objective functions is NP-hard, even to approximate well, and so unlikely to be efficiently solvable in the worst case. Recently, Bilu and Linial [11] suggested an approach aimed at bypassing this computational barrier by using properties of instances one might hope to hold in practice. In particular, they argue that instances in practice should be stable to small perturbations in the metric space and give an efficient algorithm for clustering instances of the Max-Cut problem that are stable to perturbations of size O(n1/2). In addition, they conjecture that instances stable to as little as O(1) perturbations should be solvable in polynomial time. In this paper we prove that this conjecture is true for any center-based clustering objective (such as k-median, k-means, and k-center). Specifically, we show we can efficiently find the optimal clustering assuming only stability to factor-3 perturbations of the underlying 3 perturbations for general metrics. In particular, metric in spaces without Steiner points, and stability to factor 2 + we show for such instances that the popular Single-Linkage algorithm combined with dynamic programming will find the optimal clustering. We also present NP-hardness results under a weaker but related condition. √ Keywords: Clustering, k-median, k-means, Stability Conditions 1. Introduction Problems of clustering data arise in a wide range of different areas -- clustering proteins by function, cluster- ing documents by topic, and clustering images by who or what is in them, just to name a few. In this paper we focus on the popular class of center based clustering objectives, such as k-median, k-center and k-means. Under these ob- jectives we not only partition the data into k subsets, but we also assign k special points, called the centers, one in each cluster. The quality of a solution is then measured as a function of the distances between the data points and their centers. For example, in the k-median objective, the goal is to minimize the sum of distances of all points from their nearest center, and in the k-means objective, we min- imize the sum of the same distances squared. As these are NP-hard problems [17, 18, 13], there has been substantial $This work was supported in part by the National Science Founda- tion under grant CCF-0830540, as well as by CyLab at Carnegie Mel- lon under grants DAAD19-02-1-0389 and W911NF-09-1-0273 from the Army Research Office. Email addresses: [email protected] (Pranjal Awasthi), [email protected] (Avrim Blum), [email protected] (Or Sheffet) work on approximation algorithms [2, 3, 8, 12, 19, 14] with both upper and lower bounds on approximability of these and other objective functions. Note that we are especially interested in the case that k is part of the input and not a constant. Recently, Bilu and Linial [11], focusing on the Max- Cut problem [16], proposed considering instances where the optimal clustering is optimal not only under the given metric, but also under any bounded multiplicative pertur- bation of the given metric. This is motivated by the fact that in practice, distances between data points are typi- cally just the result of some heuristic measure (e.g., edit- distance between strings or Euclidean distance in some feature space) rather than true "semantic distance" be- tween objects. Thus, unless the optimal solution on the given distances is correct by pure luck, it likely is correct on small perturbations of the given distances as well. Bilu and Linial [11] analyze Max-Cut instances of this type and show that for instances that are stable to perturbations of multiplicative factor roughly O(n1/2), one can retrieve the optimal Max-Cut in polynomial time. However, they conjecture that stability up to only constant magnitude perturbations should be enough to solve the problem in polynomial time. In this paper we show that this conjec- Preprint submitted to Elsevier October 23, 2018 ture is indeed true for k-median and k-means objectives and in fact for any well-behaved center-based objective function (see Definition 1.3). 1.1. Main Result First, let us formally define the notion due to [11] of stability under multiplicative perturbations, stated in this context. Definition 1.1. Given a metric (S, d), and α > 1, we say a function d(cid:48) : S × S → R≥0 is an α-perturbation of d, if for any x, y ∈ S it holds that d(x, y) ≤ d(cid:48)(x, y) ≤ αd(x, y) Note that d(cid:48) may be any non-negative function, and need not be a metric. Definition 1.2. Suppose we have a clustering instance composed of n points residing in a metric (S, d) and an objective function Φ we wish to optimize. We call the clus- tering instance α-perturbation resilient for Φ if for any d(cid:48) which is an α-perturbation of d, the (only) optimal cluster- ing of (S, d(cid:48)) under Φ is identical, as a partition of points into subsets, to the optimal clustering of (S, d) under Φ. We will in particular be concerned with separable, center- based clustering objectives Φ (which include k-median, k- means, and k-center among others). Definition 1.3. A clustering objective is center-based if the optimal solution can be defined by k points c∗ k in the metric space called centers such that every data point is assigned to its nearest center. Such a clustering objective is separable if it furthermore satisfies the following two conditions: 1, . . . , c∗ • The objective function value of a given clustering is either a (weighted) sum or the maximum of the in- dividual cluster scores. • Given a proposed single cluster, its score can be com- puted in polynomial time. √ Our main result is that we can efficiently find the opti- mal clustering for perturbation-resilient instances of sepa- rable center-based clustering objectives. In particular, we get an efficient algorithm for 3-perturbation-resilient in- stances when the metric S is defined only over data points, 3)-perturbation-resiliant instances for gen- and for (2 + eral metrics. Theorem 1.4. For α ≥ 3 (in the case of finite metrics defined only over the data) or α ≥ 2 + 3 (for general metrics), there is a polynomial-time algorithm that finds the optimal clustering of α-perturbation resilient instances for any given separable center-based clustering objective. √ 2 The algorithm, described in Section 2.2, turns out to be quite simple. As a first step, it runs the classic single- linkage algorithm, but unlike the standard approach of halting when k clusters remain, it runs the algorithm un- til all points have been merged into a single cluster and keeps track of the entire tree-on-clusters produced.1 Then, the algorithm's second step is to apply dynamic program- ming to this hierarchical clustering to identify the best k-clustering that is present within the tree. Using a result of Balcan et al. [6] we show that the resulting clustering obtained is indeed the optimal one. Albeit being very dif- ferent, our approach resembles, in spirit, the work of Bar- tal [7], Abraham et al [1] and Racke [22] in the sense that we reduce the problem of retrieving an optimal solution from a general instance to a tree-like instance (where it is poly-time solvable). Our algorithms use only a weaker property, which we call center-proximity (see Section 2.1), that is implied by perturbation-resilience. We then complement these results with a lower bound showing that for the problem of k- median on general metrics, for any  > 0, there exist NP- hard instances that satisfy (3 − )-center proximity.2 1.2. Related work There have been a number of investigations of differ- ent notions of stability for the problem of clustering. For example, Ostrovsky et al. [21] consider a k-means instance to be stable if the optimal k-clustering is substantially cheaper than the optimal (k − 1)-clustering under this ob- jective. They present an efficient algorithm for finding near-optimal k-means clusterings when this gap is large, and these results were subsequently strengthened to apply to smaller gaps in [4]. Balcan et al. [5] consider instead a clustering instance to be stable if good approximations to the given objective are guaranteed to be close, as clus- terings, to a desired ground-truth partitioning. This is motivated by the fact that when the true goal is to match some unknown correct answer (e.g., to correctly cluster proteins by their function), this is an implicit assumption already being made when viewing approximation ratio as a good performance measure. Balcan et al. [5] show that in fact this condition can be used to bypass approximation hardness results for a number of clustering objectives in- cluding k-median and k-means. Here they show that if all (1 + α)-approximations to the objective are δ-close to the desired clustering in terms of how points are partitioned, then one can efficiently get O(δ/α)-close to the desired clustering. Ben-David et al. [10, 9] consider a notion of 1The example depicted in Figure 3 proves that indeed, halting the Single-Linkage algorithm once k clusters are formed may fail on certain α-perturbation resilient instances. 2We note that while our belief was that allowing Steiner points in the lower bound was primarily a technicality, Balcan et al. (M.F. Balcan, personal communication) have recently shown this is not the case, giving a clever algorithm that finds the optimal clustering for k-median instances in finite metrics when α = 1 + √ 2. stability of a clustering algorithm, which is called stable if it outputs similar clusters for different sets of n input points drawn from the same distribution. For k-means, the work of Meila [20] discusses the opposite direction -- classifying instances where an approximated solution for k-means is close to the target clustering. 2. Proof of Main Theorem 2.1. Properties of Perturbation Resilient Instances We begin by deriving other properties which every α- perturbation resilient clustering instance must satisfy. Definition 2.1. Let p ∈ S be an arbitrary point, let c∗ i be the center p is assigned to in the optimal clustering, and let j (cid:54)= c∗ c∗ i be any other center in the optimal clustering. We say a clustering instance satisfies the α-center proximity property if for any p it holds that d(p, c∗ j ) > αd(p, c∗ i ) i and C∗ Fact 2.2. If a clustering instance satisfies the α-perturbation resilience property, then it also satisfies the α-center prox- imity property. Proof. Let C∗ j be any two clusters in the opti- mal clustering and pick any p ∈ C∗ i . Assume we blow up all the pairwise distances within cluster C∗ i by a factor of α. As this is a legitimate perturbation of the metric, it still holds that the optimal clustering under this per- turbation is the same as the original optimum. Hence, p is still assigned to the same cluster. Furthermore, since the distances within C∗ i were all changed by the same constant factor, c∗ i will still remain an optimal center of cluster i. The same holds for cluster C∗ j . It follows that even in this perturbed metric, p prefers c∗ j . Hence αd(p, c∗ j ) = d(p, c∗ j ). Corollary 2.3. For every point p and its center c∗ i , and for every point p(cid:48) from a different cluster, it follows that d(p, p(cid:48)) > (α − 1)d(p, c∗ i ). Proof. Denote by c∗ longs to. Now, consider two cases. Case (a): d(p(cid:48), c∗ d(p, c∗ i ). d(p, p(cid:48)) ≥ d(p(cid:48), c∗ stable to α-perturbations, Fact 2.2 gives us that d(p(cid:48), c∗ αd(p(cid:48), c∗ ≥ (α − 1)d(p, c∗ by traingle inequality we get that d(p, p(cid:48)) ≥ d(p, c∗ d(p(cid:48), c∗ j ) > αd(p, c∗ j the center of the cluster that p(cid:48) be- j ) ≥ In this case, by traingle inequality we get that i ). Since the data instance is i ) > j )−d(p, c∗ i ) i ). Again j ) − j ). Hence we get that d(p, p(cid:48)) > αd(p(cid:48), c∗ j ) < d(p, c∗ j ) > (α − 1)d(p, c∗ i ). i ). Case (b): d(p(cid:48), c∗ i ) − d(p(cid:48), c∗ i ) − d(p, c∗ i ) = d(cid:48)(p, c∗ i ) < d(cid:48)(p, c∗ i to c∗ A key ingredient in the proof of Theorem 1.4 is the tree- clustering formulation of Balcan et. al [6]. In particular, we prove that if an instance satisfies α-center proximity for α ≥ 3 (in the case of finite metrics without Steiner points) or for α ≥ 2 + 3 (for general metrics) then it also sat- isfies the "min-stability property" (defined below). The √ 3 min-stability property, as shown in [6], is sufficient (and necessary) for the Single-Linkage algorithm to produce a tree such that the optimal clustering is some pruning of this tree. In order to define the "min-stability" property, we first introduce the following notation. For any two sub- sets A, B ⊂ S, we denote the minimum distance between A and B as dmin(A, B) = min{d(a, b) a ∈ A, b ∈ B}. Definition 2.4. A clustering instance satisfies the min- stability property if for any two clusters C and C(cid:48) in the optimal clustering, and any subset A (cid:40) C, it holds that dmin(A, C \ A) ≤ dmin(A, C(cid:48)). In words, the min-stability property means that for any set A that is a strict subset of some cluster C in the optimal clustering, the closest point to A is a point from C \ A, and not from some other cluster. The next two lemmas lie at the heart of our algorithm. i , C∗ i and C∗ j respectively. Lemma 2.5. A clustering instance in which centers must be data points that satisfies α-center proximity for α ≥ 3 (for a center-based clustering objective), also satisfies the min-stability property. Proof. Let C∗ tering. Let A and A(cid:48) be any two subsets s.t. A (cid:40) C∗ A(cid:48) ⊆ C∗ obtain the minimum distance dmin(A, A(cid:48)). Let q ∈ C∗ be the nearest point to p. Also, denote by c∗ i and c∗ centers of clusters C∗ A) ≥ dmin(A, A(cid:48)). Suppose c∗ d(p, p(cid:48)) = dmin(A, A(cid:48)) ≤ dmin(A, C∗ α ≥ 3, this contradicts Corollary 2.3. d(p, p(cid:48)) > (3−1)d(p, c∗ i ) = 2d(p, c∗ We therefore have that d(p(cid:48), c∗ 3d(q, c∗ d(q, c∗ d(p(cid:48), c∗ j be any two clusters in the target clus- i and j . Let p ∈ A and p(cid:48) ∈ A(cid:48) be the two points which i \ A j the i \ For the sake of contradiction, assume that dmin(A, C∗ i /∈ A. This means that i ). As i ) ≥ i )/2. i ) ≤ i )/α < i , p)+d(p, p(cid:48))+ i ). This contradicts Fact 2.2. i )/2. This implies that d(p(cid:48), c∗ i )/2, and thus d(q, c∗ j ) < 3d(q, c∗ i ∈ A. It follows that d(q, c∗ i ), so d(p, c∗ i ) < d(q, c∗ i ) ≤ d(p, p(cid:48)) + d(p, c∗ Thus we may assume c∗ i \ A) ≤ d(p, c∗ i ) ≤ αd(q, c∗ j ) < d(p(cid:48), c∗ j ) ≤ d(q, c∗ i )+d(c∗ √ Lemma 2.6. A clustering instance in which centers need not be data points that satisfies α-center proximity for α ≥ 2 + 3 (for a center-based clustering objective), also satisfies the min-stability property. Proof. As in the proof of Lemma 2.5, let C∗ i , C∗ j be any two clusters in the target clustering and let A and A(cid:48) be j . Let p ∈ A i and A(cid:48) ⊆ C∗ any two subsets s.t. A (cid:40) C∗ and p(cid:48) ∈ A(cid:48) be the two points which obtain the minimum distance dmin(A, A(cid:48)) and let q ∈ C∗ i \ A be the nearest point to p. Also, as in the proof of Lemma 2.5, let c∗ i and i and C∗ c∗ j denote the centers of clusters C∗ j respectively (though these need not be datapoints). By definition of center-proximity, we have the following inequalities: d(p, p(cid:48)) + d(p(cid:48), c∗ d(p, p(cid:48)) + d(p, c∗ d(p, p(cid:48)) + d(p(cid:48), c∗ j ) > αd(p, c∗ i ) [c.p. applied to p] i ) > αd(p(cid:48), c∗ j ) [c.p. applied to p(cid:48)] j ) + d(p, q) > α(d(q, p) − d(p, c∗ i )) [center proximity applied to q and triangle ineq.] finite metrics that are (3−)-perturbation resilient. For ex- ample, consider the instance shown in Figure 2. In this in- stance, the clustering tree produced by single-linkage is not laminar with the optimal k-median clustering. It is easy to check that this instance is resilient to α-perturbations for any α < 3. Multiplying the first inequality by 1− 1 ond by 1 we get α+1 , the third by 1 α−1 , the sec- α−1 , and summing them together α+1 − 1 d(p, p(cid:48)) > α2−4α+1 d(p, c∗ α−1 i ) + d(q, p), which for α = 2 + 3 implies d(p, p(cid:48)) > d(q, p) as desired. √ 2.2. The Algorithm As mentioned, Balcan et al [6] proved (Theorem 2) that if an instance satisfies min-stability, then the tree on clusters produced by the single-linkage algorithm contains the optimal clustering as some k-pruning of it. I.e., the tree produced by starting with n clusters of size 1 (viewed as leaves), and at each step merging the two clusters C,C(cid:48) minimizing dmin(C, C(cid:48)) (viewing the merged cluster as their parent) until only one cluster remains. Given the struc- tural results proven above, our algorithm (see Figure 1) simply uses this clustering tree and finds the best k-pruning using dynamic programming. Proof of Theorem 1.4. By Lemmas 2.5 and 2.6, the data satisfies the min-stability property, which as shown in [6] is sufficient to guarantee that some pruning of the single- linkage hierarchy is the target clustering. We then find the optimal clustering using dynamic programming by exam- ining k-partitions laminar with the single-linkage cluster- ing tree. The optimal k-clustering of a tree-node is either the entire subtree as one cluster (if k = 1), or the mini- mum over all choices of k1-clusters over its left subtree and k2-clusters over its right subtree (if k > 1). Here k1, k2 are positive integers, such that k1 + k2 = k. Therefore, we just traverse the tree bottom-up, recursively solving the clus- tering problem for each tree-node. By assumption that the clustering objective is separable, so each step including the base-case can be performed in polynomial time. For the case of k-median in a finite metric, for example, one can maintain a n × O(n) table for all possible centers and all possible clusters in the tree, yielding a running time of O(n2 + nk2). For the case of k-means in Euclidean space, one can compute the cost of a single cluster by computing the center as just the average of all its points. In general, the overall running time is O(n(k2 + T (n))), where T (n) denotes the time it takes to compute the cost of a single cluster. 2.3. Some Natural Barriers We complete this section with a discussion of barriers of our approach. First, our algorithm indeed fails on some 4 Figure 2: A finite metric k-median instance with 2 < α < 3 where our algorithm fails. The optimal 2-median clustering is {c, p, q},{c(cid:48), p(cid:48)}. In contrast, when we run our algorithm over on this instance, single linkage first connects {c, p} with {c(cid:48), p(cid:48)}, and only then merges these 4 points with q. Second, observe that our analysis, though emanating from perturbation resilience, only uses center proximity. We next show that for general metrics, one cannot hope to solve (in poly-time) k-median instances satisfying α- center proximity for α < 3. This is close to our upper bound of 2 + 3 for general metrics. √ Theorem 2.7. For any α < 3, the problem of solving k- median instances over general metrics that satisfy α-center proximity is NP-hard. Proof. The proof of Theorem 2.7 follows from the classical reduction of Max-k-Coverage to k-median. In this reduc- tion, we create a bipartite graph where the right-hand side vertices represent the elements in the ground set; the left- hand side vertices represent the given subsets; and the distance between the set-vertex and each element-vertex is 1, if the set contains that element. Using shortest-path distances, it follows that the distance from any element- vertex to a set-vertex to which it does not belong to is at least 3. Using the fact that the NP-hardness results for Max-k-Coverage holds for disjoint sets (i.e. the optimal solution of Yes-instances is composed of k disjoint sets, see [15]), the α-center proximity property follows. Lastly, we comment that using Single-Linkage in the usual way (namely, stopping when there are k clusters re- maining) is not sufficient to produce a good clustering. We demonstrate this using the example shown in Figure 3. Observe, in this instance, since C contains significantly less points than A,B, or D, this instance is stable -- even if we perturb distances by a factor of 3, the cost of any al- ternative clustering is higher than the cost of the optimal solution. However, because d(A, C) > d(B, D), it follows that the usual version of Single-Linkage will unite B and D, and only then A and C. Hence, if we stop the Single- Linkage algorithm at k = 3 clusters, we will not get the desired clustering. '' 1. Run Single-Linkage until only one cluster remains, producing the entire tree on clusters. 2. Find the best k-pruning of the tree by dynamic programming using the equality best-k-pruning(T ) = min 0<k(cid:48)<k {best-k(cid:48)-pruning(T 's left child) + best-(k − k(cid:48))-pruning(T 's right child)} Figure 1: Algorithm to find the optimal k-clustering of instances satisfying α-center proximity. The algorithm is described for the case (as in k-median or k-means) that Φ defines the overall score to be a sum over individual cluster scores. If it is a maximum (as in k-center) then replace "+" with "max" above. suitable distribution. Can this weaker notion be used to still achieve positive guarantees? References [1] Ittai Abraham, Yair Bartal, T-H. Hubert Chan, Kedar Dhamd- here Dhamdhere, Anupam Gupta, Jon Kleinberg, Ofer Neiman, and Aleksandrs Slivkins. Metric embeddings with relaxed guar- antees. In Proc. 46th Annual IEEE Symp. Foundations of Com- puter Science (FOCS), 2005. [2] Sanjeev Arora, Prabhakar Raghavan, and Satish Rao. Ap- proximation schemes for euclidean k-medians and related prob- lems. In Proc. 30th Annual ACM Symp. Theory of Computing (STOC), 1998. [3] Vijay Arya, Naveen Garg, Rohit Khandekar, Adam Meyerson, Kamesh Munagala, and Vinayaka Pandit. Local search heuristic for k-median and facility location problems. In Proc. 33rd ACM Symp. Theory of Computing (STOC), 2001. [4] Pranjal Awasthi, Avrim Blum, and Or Sheffet. Stability yields a ptas for k-median and k-means clustering. In Proc. 51st Annual IEEE Symp. Foundations of Computer Science (FOCS), 2010. [5] Maria-Florina Balcan, Avrim Blum, and Anupam Gupta. Ap- proximate clustering without the approximation. In Proc. 19th Annual ACM-SIAM Symp. Discrete Algorithms (SODA), 2009. [6] Maria-Florina Balcan, Avrim Blum, and Santosh Vempala. A discriminative framework for clustering via similarity func- tions. In Proc. 40th Annual ACM Symp. Theory of Computing (STOC), 2008. [7] Yair Bartal. On approximating arbitrary metrices by tree met- rics. In Proc. 30th Annual ACM Symp. Theory of Computing (STOC), 1998. [8] Yair Bartal, Moses Charikar, and Danny Raz. Approximating min-sum k-clustering in metric spaces. In Proc. 33rd Annual ACM Symp. Theory of Computing (STOC), 2001. [9] Shai Ben-David, D´avid P´al, and Hans-Ulrich Simon. Stability of k-means clustering. In COLT, pages 20 -- 34, 2007. [10] Shai Ben-David, Ulrike von Luxburg, and D´avid P´al. A sober look at clustering stability. In G´abor Lugosi and Hans-Ulrich Simon, editors, COLT, volume 4005 of Lecture Notes in Com- puter Science, pages 5 -- 19. Springer, 2006. [11] Yonatan Bilu and Nati Linial. Are stable instances easy? 1st Symp. Innovations in Computer Science (ICS), 2010. [12] Moses Charikar, Sudipto Guha, ´Eva Tardos, and David B. Shmoys. A constant-factor approximation algorithm for the k-median problem. In Proc. 31st Annual ACM Symp. Theory of Computing (STOC), 1999. [13] Sanjoy Dasgupta. The hardness of k-means clustering. Techni- cal report, University of California at San Diego, 2008. [14] W. Fernandez de la Vega, Marek Karpinski, Claire Kenyon, and Yuval Rabani. Approximation schemes for clustering prob- lems. In Proc. 35th Annual ACM Symp. Theory of Computing (STOC), 2003. [15] Uriel Feige. A threshold of ln n for approximating set cover. JACM, 45:314 -- 318, 1998. [16] Michael R. Garey and David S. Johnson. Computers and In- tractability; A Guide to the Theory of NP-Completeness. W. H. Freeman & Co., New York, NY, USA, 1990. Figure 3: An example showing failure of the usual version of Single-Linkage. The instance is composed of 4 components, each with inner-distance  and outer-distance as described in the figure. However, components A, B and D each contain 100 points, whereas component C has only 10 points. The optimal 3-median clustering consists of 3 clusters: {A, C},{B},{D} and has cost OPT = 200 + 300. 3. Open Problems There are several natural open questions left by this work. First, can one reduce the perturbation factor α needed for efficient clustering? As mentioned earlier, re- cently Balcan et al. (M.F. Balcan, personal communica- tion) have given a very interesting algorithm that reduces the α = 3 factor needed by our algorithm for finite met- rics to 1 + 2. Can one go farther, perhaps by using fur- ther implications of perturbation-resilience beyond center- proximity? Alternatively, if one cannot find the optimal clustering for small values of α, can one still find a near- optimal clustering, of approximation ratio better than what is possible on worst-case instances? √ In a different direction, one can also consider relax- ations of the perturbation-resilience condition. For exam- ple, Balcan et al. (personal communication) also consider instances that are "mostly resilient" to α-perturbations: under any α-perturbation of the underlying metric, no more than a δ-fraction of the points get mislabeled un- der the optimal solution. For sufficiently large constant α and sufficiently small constant δ, they present algorithms that get good approximations to the objective under this condition. A different kind of relaxation would be to con- sider a notion of resilience to perturbations on average: a clustering instance whose optimal clustering is likely not to change, assuming the perturbation is random from some 5 ACDB1020100 [17] Sudipto Guha and Samir Khuller. Greedy strikes back: Im- proved facility location algorithms. In Journal of Algorithms, pages 649 -- 657, 1998. [18] Kamal Jain, Mohammad Mahdian, and Amin Saberi. A new greedy approach for facility location problems (extended ab- stract). In Proc. 34th Annual ACM Symp. Theory of Comput- ing (STOC), pages 731 -- 740, 2002. [19] Amit Kumar, Yogish Sabharwal, and Sandeep Sen. A simple lin- ear time (1+ ) -approximation algorithm for k-means clustering in any dimensions. In Proc. 45th Annual IEEE Symp. Founda- tions of Computer Science (FOCS), 2004. [20] Marina Meila. The uniqueness of a good optimum for k-means. In Proc. 23rd International Conference on Machine Learning (ICML), pages 625 -- 632, 2006. [21] Rafail Ostrovsky, Yuval Rabani, Leonard J. Schulman, and Chaitanya Swamy. The effectiveness of Lloyd-type methods for the k-means problem. In Proc. 47th Annual IEEE Symp. Foun- dations of Computer Science (FOCS), pages 165 -- 176, 2006. [22] Harald Racke. Optimal hierarchical decompositions for con- gestion minimization in networks. In Proc. 40th Annual ACM Symp. Theory of Computing (STOC), 2008. 6
1604.04471
1
1604
2016-04-15T12:54:09
On Dynamic Job Ordering and Slot Configurations for Minimizing the Makespan Of Multiple MapReduce Jobs
[ "cs.DS", "cs.DC" ]
MapReduce is a popular parallel computing paradigm for Big Data processing in clusters and data centers. It is observed that different job execution orders and MapReduce slot configurations for a MapReduce workload have significantly different performance with regarding to the makespan, total completion time, system utilization and other performance metrics. There are quite a few algorithms on minimizing makespan of multiple MapReduce jobs. However, these algorithms are heuristic or suboptimal. The best known algorithm for minimizing the makespan is 3-approximation by applying Johnson rule. In this paper, we propose an approach called UAAS algorithm to meet the conditions of classical Johnson model. Then we can still use Johnson model for an optimal solution. We explain how to adapt to Johnson model and provide a few key features of our proposed method.
cs.DS
cs
IEEE TRANSACTIONS ON SERVICE COMPUTING , VOL. , NO. , 2016 On Dynamic Job Ordering and Slot Configurations for Minimizing the Makespan 1 Of Multiple MapReduce Jobs 6 1 0 2 r p A 5 1 ] S D . s c [ 1 v 1 7 4 4 0 . 4 0 6 1 : v i X r a Wenhong Tian, Guangchun Luo, Ling Tian, and Aiguo Chen Abstract-MapReduce is a popular parallel computing paradigm for Big Data processing in clusters and data centers. It is observed that different job execution orders and MapReduce slot configurations for a MapReduce workload have significantly different performance with regarding to the makespan, total completion time, system utilization and other performance metrics. There are quite a few algorithms on minimizing makespan of multiple MapReduce jobs. However, these algorithms are heuristic or suboptimal. The best known algorithm for minimizing the makespan is 3-approximation by applying Johnson rule. In this paper, we propose an approach called UAAS algorithm to meet the conditions of classical Johnson model. Then we can still use Johnson model for an optimal solution. We explain how to adapt to Johnson model and provide a few key features of our proposed method. Index Terms-MapReduce; Hadoop; Batch Workload; Optimized Schedule; Minimized Makespan. ! Job scheduling 1 INTRODUCTION With the rapid increase in size and number of jobs that are being processed in the MapReduce framework, efficiently scheduling multiple jobs under this framework is becoming increasingly important. in MapReduce framework brings a new challenge to Cloud computing [1] such as minimizing the makespan, load balancing and reduce data skew etc., it has already received much attention. Originally, MapReduce was designed for periodically running large batch workloads with a FIFO (First-In-First- Out) scheduler. As the number of users sharing the same MapReduce cluster there are Capacity scheduler [11] and Hadoop Fair Scheduler (HFS) [7] which intend to support more efficient cluster sharing. There are also a few research prototypes of Hadoop schedulers that aim to optimize explicitly some given scheduling metrics, e.g., FLEX [8], ARIA [4]. A MapReduce simulator called SimMR [5] is also developed to increased, • Prof. Tian is in the School of Information and Software Engineering, University of Electronic Science and Technology of China. E-mail: tian [email protected];This research is sponsored by the Na- tional Science Foundation of China with project ID 61450110440; • G.Luo and L. Tian and A. Chen are with the same University. service simulate different workload and performance of MapReduce. Yao et al. [15] proposed a scheme which uses slot ratio between Map and Reduce tasks as a tunable knob for dynamically allocating slots. However, as pointed out in [1], the existing schedulers do not provide a support for minimizing the makespan for a set of jobs. Starfish project [9] proposes a workflow-aware scheduler that correlate data (block) placement with task scheduling to optimize the workflow completion time. Zhao et al. [16] propose a integrating reference for framework into scientific workflow management systems various cloud platforms. Moseley et al. [10] formulate MapReduce scheduling as a generalized version of the classical two-stage flexible flow-shop problem with identical machines; they provide a 12-approximation algorithm for the offline problem of minimizing the total flow-time, which is the sum of the time between the arrival and the completion of each job. Zhu et al. [15] consider nonpreemptive case to propose 3 2-approximation for offline scheduling regarding the makespan where they did not considering job ordering or applying Johnson model. In [1] and [2], the authors propose heuristics to minimize the makespan, the proposed algorithm called BalancedPools by considering two pools for a Hadoop cluster. Tang et al. [17] proposed a new algorithm called MK JR for minimizing the makespan. The works of [1] and [17] are closely related to our research in minimizing the makespan. However, our present work meets all the requirements of Johnson model and provide optimal solution to offline scheduling while Verma et al. [1] did not modify Johnson's model and provided separating pools (called for minimizing the makespan, BalancedPools) and BalancedPools is a heuristic approach but not optimal in many cases. MK JR is a 3-approximation algorithm for minimizing the makespan. There is still room for improving the performance of MapReduce regarding minimize the makespan. In summary, there is only a small number of scheduling algorithms with regarding to minimize the makespan of a set of MapReduce jobs in open literature and still much room for improving the performance of MapReduce regarding minimizing the makespan. Therefore, we propose new model- ing and scheduling approaches for offline jobs in the following sections. The major contributions of this paper include: 1) provided a new modeling and scheduling ap- proach for multiple MapReduce jobs; 2) proposed an optimal algorithm for offline scheduling considering Map and Reduce stages by adapting to classical Johnson's model; 3) introduced a few key features (theorems) of our proposed algorithm (UAAS). 2 PROBLEM FORMULATION We consider the following problem as in [1] [17]. Let J= {J1, J2, . . . , Jn} be a set of n MapReduce jobs with no data dependencies between them. These jobs can be executed in any order. A MapReduce job Ji consists of two stages, a map stage M and reduce stage R. Each stage consists of a number of tasks. The workload is executed on a MapReduce cluster under FIFO scheduling by default, consist- ing of a set of (map and reduce) slots. Let SM and SR denote the set of map slots and reduce slots configured by MapReduce administrator (i.e., S=SM U SR), so that the number of map slots and reduce slots are SM and SR, correspondingly. Let φ denote the job submission order for a MapReduce workload. We consider the offline case in which all the jobs are available at time 0. Let ci denote the completion time of Ji (i.e., the time when Ji's 2 i and T R i , T R i i,j and tR and J R We denote J M reduce tasks all finish). The makespan for the work- load {J1, J2, . . . , Jn} is defined as Cmax =maxi∈[n]ci. i as the number of tasks in Ji's map stage and reduce stage, respectively. Let tM i,j denote the execution time of Ji's jth map task and jth reduce task, respectively. Let T M i denote the execution time of Ji's map and reduce stage respectively. Ji requests i × SR i MapReduce slots and has Map and Re- SM duce stage durations (T M i ) respectively. The system scheduler can change a job's MapReduce slots allocation depending on available resources. We aim to determine an order (a schedule) of execution of jobs Ji ∈ J such that the makespan of all jobs is minimized. Let us set the actually allocated MapReduce slots for job Ji as AM ×AR i , the max available MapReduce slots in the Hadoop cluster is SM i . The original Johnson Rule [3] considers that There are n items which must go through one production stage or machine and then a second one. There is only one machine for each stage. At most one item can be on a machine at a given time. We consider MapReduce as two non-overlapped stages, i.e., map and reduce stage respectively, the same as in [1][17]. Also we classify all jobs into Map type and Reduce type. For Map type jobs, their map durations should be smaller than reduce durations while Reduce type jobs have longer reduce durations than map durations. Based on these assumptions and Johnson algorithm [1], we can obtain the optimal makespan of a set of jobs as follows: × SR i i n(cid:88) u(cid:88) i=1 where Cmax = Ku = T R i + maxn u=1Ku i − u−1(cid:88) T M T R i . (1) (2) i=1 i=1 the classic Johnson algorithm for Observation 1. If each job utilizes either all map or all reduce slots during its processing, there is a perfect match between the assumptions of two- stage production system and MapReduce job processing, then Johnson's algorithm can be applied to find optimal solution for minimizing the makespan of a set of MapReduce jobs. Based on our observations and intensive real test experiences, we propose a new method called UAAS (Utilizing All Available Slots) algorithm, with the pesudocode given in Algorithm 2.1. The following theorem is the key strategy for our results. Theorem 1. Based on available MapReduce slots in the system, the scheduler can increase or decrease the number of MapReduce slots to the job to meet the requirements of JohnSon Rule, the result obtained by UAAS algorithm following Johnson rule is optimal regarding to minimize the makespan. Proof: The original Johnson Rule [3] considers that "there are n items which must go through one production stage or machine and then a second one. There is only one machine for each stage. At most one item can be on a machine at a given time". To adapt the MapReduce model, we treat the Map and Reduce stage resources as a whole (like a single ma- chine), i.e., to represent the resources as MapReduce slots in the whole in our algorithm UAAS. USSA algorithm allocates all available MapReduce slots to each job at each stage, so that UAAS meets all requirements of Johnson Rule. Since Johnson Rule obtains optimal results with regarding to minimize the makespan (the proof is provided in [3]), and our UAAS algorithm meets all requirements of Johnson Rule, therefore UAAS obtains the optimal result with regard to minimizing the makespan. (cid:4) input : the total number of MapReduce slots (SM,SR) for a Hadoop cluster, estimated all Jobs' Map and Reduce durations (T M available Map and Reduce slots for each job in the cluster i ) [1] by utilizing all , T R i output: the scheduled jobs, the makespan Cmax 1 List the Map and Reduce's durations in two vertical columns (implemented in a list) ; 2 for all Ji ∈ J do 3 4 5 6 7 8 9 10 i i )); , T R Find the shortest one among all durations (min (T M In case of ties, for the sake of simplicity, order the item with the smallest subscript first. In case of a tie between Map and Reduce, order the item according to the Map ; IF it is the first job of Map type, place the corresponding item at the first place ; ELSE it is the first job of Reduce type, place the corresponding item at the last place ; IF it is Map type job (and not the first job), place the corresponding item right next to the previous job (i.e., in non-decreasing order of Map durations) ; ELSE it is Reduce type job (and not the first job), place the corresponding item left next to the previous job (i.e., in non-increasing order of Reduce durations) ; Remove both durations for that job ; Repeat these steps on the remaining set of jobs 11 end 12 Compute the makespan (Cmax) Algorithm 2.1: Utilizing All Available Slots (UAAS) algorithm BalancedPools Algorithm [1]: is way to minimize the makespan for offline scheduling proposed in [1], it partitions the Hadoop cluster into two balanced pools and then allocated each job to a suitable pool to minimize the makespan. Observation 2. BalancedPool Algorithm does not meet the requirement of Johnson model but just order the job by Johnson rule and is a heuristic algorithm with computational complexity of O(n2lognlogP ) where n is the number of jobs and P is the number of MapReduce slots. MK JR algorithm [17]: Divide the jobs set J into Fig. 1. Five MapReduce Jobs Execution in One Cluster by MK JR 3 THREE ALGORITHMS COMPARED In this section, we compare UAAS algorithm with two best known algorithms (BalancedPools and MK JR) regarding to minimize the makespan of a set of offline MapReduce Jobs. 3 4 23 4 5 6 30 4 510 15 20 25 30 35 1 J2 J5 J1 J4 J3 30 40 45 20X20 20X20 10X10 30X30 Time (in units) map reduce MapReduce slots. There are five jobs, among them, require 30×30 MapReduce slots J1,J2 and J5 while J3 and J4 require 20×20 MapReduce slots. The total makespan by MK JR algorithm is 47 units, visualized in Fig.1. However, if we allow that any job can use all available MapReduce slots in the system when execution (this can be implemented easily in Hadoop, for example by splitting the input files based on available number MapReduce slots), the result is very different from both MK JR and BalancedPools algorithms. For the same example, in UAAS algorithm job J3 and J4 can use all available 30 × 30 MapReduce slots, then J3 will have Map and Reduce durations (20, 8 3), J4 will have Map and Reduce durations (4, 20) respectively. Therefore the total makespan will be 35 2 3 as shown in Fig. 2, where X1=1. This result is smaller (about 31.76%) than the result (47 units) obtained by MK JR in [1]. The makespan of Pool1 and Pool2 is 39 and 40 time units respectively by applying BalancedPools algorithm, where Pool1 has configuration of 10×10 MapReduce slots and Pool2 has configuration of 20×20 MapReduce slots, and J1,J2 and J5 (short jobs) are with Pool1 while J2 and J3 (longer jobs) are with Pool2. Therefore, the UAAS result is about 12.14% smaller than the result (40 time units) obtained by BalancedPools algorithm. Theorem 2. MK JR is an 3-approximation algo- rithm for the makespan optimization in general case. Proof: Applying the intermediate results from [17] (Equ. (8) in supplementary material for proof of THOREM 1 in [17]), we have Cmax ≤ ( Cmax + maxn k=1 k(cid:88) k(cid:88) tR i ) tM i + maxn k=1 i=1 i=1 k=1 i=1 (cid:80)k tR i i i k=1 i=1 k=1 i=1 tM i +maxn Cmax (3) where tM and tR is the estimated map and re- (cid:80)k duce duration for job Ji, respectively. Let us define σ= maxn , the same as in [17], Cmax is the theoretical optimal makespan where given by Equ. (1)-(2). Considering the worst case 2 =C0, that there are two jobs J1 and J2, T M (cid:80)k 2 =1; In this case, the optimal order and T R tR is J1-J2 and maxn i =C0. i=1 tM And Cmax=C opt i =C0+2 by C0+2 ≤ 2. Therefore UAAS algorithm, we have σ= 2C0+1 tM i =maxn max= maxn 1 =C0, T R 1 =1, T M (cid:80)k (cid:80)k max, C opt k=1 i=1 k=1 Fig. 2. New Result of Five MapReduce Jobs Execu- tion by UAAS TABLE 1 The example of 5 jobs Job ID SM r 30 J1 30 J2 20 J3 20 J4 30 J5 SR r 30 30 20 20 30 i T M 4 1 30 6 2 T R i 5 4 4 30 3 i < T R two disjoint sub-sets JA and JB. Set JA consists of those jobs Ji for which T M i . Set JB contains the remaining jobs. Sequence jobs in JA in non-decreasing order of T M and those in JB i in non-increasing order of T R i . The job order is obtained by appending the sorted set JB to the end of sorted set JA. Observation 3. MK JR algorithm does not meet the requirement of Johnson model but just order the job by Johnson rule after estimating the map and reduce durations of each job. The reason that BalancedPools and MK JR algorithms do not meet the requirement of Johnson model lies that they do not utilize all available MapReduce slots each job in general case, though they estimate the job ordering by Johnson rule. Therefore, unlike UAAS algorithm, BalancedPools and MK JR algorithms are suboptimal. for Table 1 shows an example from [2], where SM r and SR is the requested number of slots for map r and reduce stage respectively for job Ji. Example 1. Consider a scenario shown in Table 1 from [1], where the cluster has a configuration of 30×30 4 4 2 3 4 5 4 20 20 8/3 510 15 20 25 30 35 1m2 m5 m1 m4 m3 r2 r5 r1 r4 r3 X1 Map Reduce 5me (in units) map reduce ≈ 3 (4) the approximation ratio of MK JR is Cmax(M K JR) C opt max = C0 + 2 + σ C0 + 2 = C0 + 2 + 2C0+1 C0+2 C0 + 2 approximation ratio. (cid:4) It worths notice that the worst case is applied for (1+σ)-appromixation algorithm where σ ∈ [0, 2], should be called 3- approximation algorithm since σ is 3 in the worst case. Based on previous results, we have the following observation. and MK JR Observation 4. BalancedPools algorithms to regarding minimizing the makespan, they may not have the minimum makespan for a set of jobs; applying Theorem 1 to single Hadoop cluster always has optimal total makespan for a set of jobs. suboptimal are Theorem 3. Given a homogeneous environment where the Hadoop configurations of slave nodes are identical, the job order φ1 produced by UAAS for a batch of jobs are independent of the number of slave nodes (N) but depends on the total number of available MapReduce slots (SM, SR), and is stable with regarding to the change of the total number of slave nodes. Proof: Let us set the execution durations of map and reduce stages for a given job Ji under a given configuration of Hadoop cluster with SM × SR MapReduce slots, as T M i , respectively. If the MapReduce slots configuration of Hadoop cluster SM is changed to SM x ×SR x . Applying SM UAAS algorithm, the execution duration of map and reduce stage for a given job Ji will change to T M(cid:48) i and T R x and set ρ0= and T R(cid:48) i i T M(cid:48) i = T M i . And we have SM x = T M SM SR x = T R SR i ρ0 T R(cid:48) i = T R i i ρ0 (5) (6) Observation 5. The the job ordering of MK JR and BalancedPools is not stable when the total number of slave nodes changes. Let us consider the example given in [17]. There is a Hadoop cluster with 5 nodes, each configured with 2 map and 2 reduce slots. Let J1 be defined as follows: Map stage duration is 9 and requires 10 map slots. Reduce stage duration is 10 and requires 1 reduce slot. Let J2 be defined as follows: Map stage duration is 11 and requires 8 map slots and reduce stage duration is 15 and requires 1 reduce slot. In this case, the optimal job scheduling order by UAAS is J2-J1, and their corresponding map and reduce duration is (8.8,1.5) and (9,1) respectively by utilizing all 10 MapReduce slots in each stage, with the makespan of 18.8. The job order produced by MK JR is J1-J2 with the makespan of 35, which is about 86.17% larger than optimal result. Now, if one node fails, then there are only 4 nodes left with 8 map and 8 reduce tasks available in the cluster. In this case, the optimal job scheduling by UAAS is still J2-J1, however, their corresponding map and reduce duration is (11.25,1.25) and (11, 1.875) respectively by utilizing all 8 MapReduce slots in each stage, with makespan of 23.5. The job order generated by MK JR keeps the same, i.e., J1-J2, with makespan of 43, about 82.97% larger than the optimal. Notice that BalancedPools algorithm has following results. When there are 5 nodes, J1 with duration (9,10) will be put into Pool1 with 2 nodes of 4 MapReduce slots and J2 will be allocated to Pool2 with 3 nodes of 6 MapReduce slots. Then J1 will have duration (22.5, 10) and J2 will have duration (14.67,15). If one node fail, J1 still with Pool1 and J2 with Pool2; J1 and J2 will have duration (32.5, 10) and (37, 10) respectively. In either case, BalancedPools is far from optimal results. This means execution duration of map and reduce stage for each job will change proportional to ρ0 but their relative relationship (ordering by their durations) will not change. Therefore the job order of UAAS is stable with regarding to the change of the total number of slave nodes. (cid:4) Theorem 4. Let ρ be the ratio of map slots to reduce slots, i.e., ρ=SM SR . The optimal configu- ration of ρ for makespan Cmax depends on the total number of slots (SM, SR), MapReduce workload as well as its job submission order φ. Proof: 5 [4] A. Verma, L. Cherkasova, and R. H. Campbell, ARIA: Au- tomatic Resource Inference and Allocation for MapReduce Environments,in Proc. of ICAC,pp.235-244, 2011,Germany. [5] A. Verma, L. Cherkasova, and R. H. Campbell, Play It Again, SimMR! in Proc. of Intl. IEEE Cluster'2011, pp. 253- 261, IEEE Computer Society Washington, DC, USA, 2011. [6] M. Garey and D. Johnson, Computers and Intractability: A Guide to the Theory of NP-completeness. WH Freeman & Co., 1979. [7] M. Zaharia, D. Borthakur, J. Sen Sarma, K. Elmeleegy, S. Shenker, and I. Stoica, "Delay scheduling: A simple tech- nique for achieving locality and fairness in cluster schedul- ing,in Proc. of EuroSys. ACM, 2010, pp. 265-278. J. Wolf and et al, FLEX: A Slot Allocation Scheduling Op- timizer for MapReduce Workloads, ACM/IFIP/USENIX Intl. Middleware Conference, Lecture Notes in Computer Science Volume 6452, pp.1-20, 2010. [9] H. Herodotou and S. Babu, Profiling, What-if Analysis, and Costbased Optimization of MapReduce Programs. in Proc. of the VLDB Endowment, pp.1111-1122, Vol. 4, No. 11, 2011. [10] B. Moseley, A. Dasgupta, R. Kumar, and T.Sarl's, On in Proc. of scheduling in map-reduce and flow-shops, SPAA, pp.289-298, ACM New York, NY, USA, 2011. [8] [11] Capacity Scheduler Guide. [Online]. Available: http://hadoop.apache.org/common/docs/r0.20.1/ capacity scheduler.html [12] Y. Zheng, N. B. Shroff, P. Sinha, A New Analytical Tech- nique for Designing Provably Efficient MapReduce Sched- ulers, In the Proceedings of INFOCOM 2013, pp.1600-1608, 14-19 April 2013,Turin. [13] Wordcount, http://www.cs.cornell.edu/home/llee/data/simple/ [14] http://sortbenchmark.org/YahooHadoop.pdf. [15] Y. Zhu, Y. Jiang, W. Wu, L. Ding, A. Teredesai, D. Li, W. Lee, Minimizing makespan and total completion time in MapReduce-like systems, In Proceedings of INFOCOM 2014, pp.2166-2174, April 27 2014-May 2 2014, Toronto, ON. [16] Yong Zhao ;Youfu Li ; I. Raicu ; Shiyong Lu ; Cui Lin ; Yanzhe Zhang ; Wenhong Tian ; Ruini Xue, A Ser- vice Framework for Scientific Workflow Management in the Cloud, IEEE Trans. Services Computing 8(6): 930-944 (2015). [17] Shanjiang Tang, Bu-Sung Lee, Bingsheng He, Dynamic Job Ordering and Slot Configurations for mapreduce Work- loads, IEEE Trans. Services Computing 9(1): 4-17 (2016). T M i + T R i f rom[17] Cmax = n max k=1 k(cid:88) i=1 = = n max ( k=1 1 SM 1 SR n max ( k=1 1 ρ n(cid:88) i=k tM i,j + n i max i=k J M (cid:88) k(cid:88) k(cid:88) (cid:88) j=1 J M i=1 i n(cid:88) i (cid:88) i=k J R i (cid:88) J R tR i,j) j=1 tR i,j) (7) 1 SR n(cid:88) tM i,j + i=1 j=1 i=k j=1 This means the optimal configuration of ρ for makespan Cmax depends on the total number of slots (SM,SR) MapReduce workload (tM i,j ) i,j, tR as well as its job submission order φ(={1,..n}). (cid:4) When the workload and job order are fixed, it is obvious that larger number of total number of MapReduce slots will lead to smaller value of Cmax. This is consistent with Theorem 1 and UAAS algorithm to utilize all available MapReduce slots (SM, SR). 4 CONCLUSION Observing that there are quite a few algorithms on minimizing makespan of multiple MapReduce jobs and these algorithms are heuristic or suboptimal. In this paper, we proposed an optimal approach called UAAS algorithm to minimize the makespan of a set of MapReduce jobs. The proposed algo- rithm meets the requirements of classical Johnson algorithm and therefore is optimal with regarding to the makespan. We also conducted extensive tests in real Hadoop environment to validate our theo- retical results by benchmarks provided in [13][14]. Because this is a short paper, we do not provide the test results yet. There are future research directions such as considering minimizing the makespan of online MapReduce jobs and minimizing the total completion time and total flow time of a set of Mapreduce jobs. REFERENCES [1] A. Verma, L. Cherkasova, R. H. Campbell, Orchestrating an Ensemble of MapReduce Jobs for Minimizing Their Makespan, IEEE Transactions on Dependable and Secure Computing, April 2013 (online version). [2] A. Verma, L. Cherkasova, and R. H. Campbell, Two Sides of a Coin: Optimizing the Schedule of MapReduce Jobs to Minimize Their Makespan and Improve Cluster Per- formance. MASCOTS, page 11-18. IEEE Computer Society, (2012) S. Johnson, Optimal Two-and Three-Stage Production Schedules with Setup Times Included,Naval Res. Log. Quart., 1954. [3] 6
1205.1924
2
1205
2012-10-05T11:44:14
Distributed Algorithms for Scheduling on Line and Tree Networks
[ "cs.DS", "cs.DC" ]
We have a set of processors (or agents) and a set of graph networks defined over some vertex set. Each processor can access a subset of the graph networks. Each processor has a demand specified as a pair of vertices $<u, v>$, along with a profit; the processor wishes to send data between $u$ and $v$. Towards that goal, the processor needs to select a graph network accessible to it and a path connecting $u$ and $v$ within the selected network. The processor requires exclusive access to the chosen path, in order to route the data. Thus, the processors are competing for routes/channels. A feasible solution selects a subset of demands and schedules each selected demand on a graph network accessible to the processor owning the demand; the solution also specifies the paths to use for this purpose. The requirement is that for any two demands scheduled on the same graph network, their chosen paths must be edge disjoint. The goal is to output a solution having the maximum aggregate profit. Prior work has addressed the above problem in a distibuted setting for the special case where all the graph networks are simply paths (i.e, line-networks). Distributed constant factor approximation algorithms are known for this case. The main contributions of this paper are twofold. First we design a distributed constant factor approximation algorithm for the more general case of tree-networks. The core component of our algorithm is a tree-decomposition technique, which may be of independent interest. Secondly, for the case of line-networks, we improve the known approximation guarantees by a factor of 5. Our algorithms can also handle the capacitated scenario, wherein the demands and edges have bandwidth requirements and capacities, respectively.
cs.DS
cs
Distributed Algorithms for Scheduling on Line and Tree Networks Venkatesan T. Chakaravarthy Sambuddha Roy Yogish Sabharwal IBM Research Lab, New Delhi, India {vechakra,sambuddha,ysabharwal}@in.ibm.com Abstract We have a set of processors (or agents) and a set of graph networks defined over some vertex set. Each processor can access a subset of the graph networks. Each processor has a demand specified as a pair of vertices hu, vi, along with a profit; the processor wishes to send data between u and v. Towards that goal, the processor needs to select a graph network accessible to it and a path connecting u and v within the selected network. The processor requires exclusive access to the chosen path, in order to route the data. Thus, the processors are competing for routes/channels. A feasible solution selects a subset of demands and schedules each selected demand on a graph network accessible to the processor owning the demand; the solution also specifies the paths to use for this purpose. The requirement is that for any two demands scheduled on the same graph network, their chosen paths must be edge disjoint. The goal is to output a solution having the maximum aggregate profit. Prior work has addressed the above problem in a distibuted setting for the special case where all the graph networks are simply paths (i.e, line-networks). Distributed constant factor approximation algorithms are known for this case. The main contributions of this paper are twofold. First we design a distributed constant factor approximation algorithm for the more general case of tree-networks. The core compo- nent of our algorithm is a tree-decomposition technique, which may be of independent interest. Secondly, for the case of line-networks, we improve the known approximation guarantees by a factor of 5. Our algorithms can also handle the capacitated scenario, wherein the demands and edges have bandwidth requirements and capacities, respectively. 1 Introduction Consider the following fundamental scheduling/routing problem. We have a set V consisting of n points or vertices. A set of r undirected graphs provide communication networks over these vertices. All the edges in the graphs provide a uniform bandwidth, say 1 unit. There are m processors (or agents) each having access to a subset of the communication networks. Each processor P has a demand/job a specified as a pair of vertices u and v, and a bandwidth requirement (or height) h(a) ≤ 1. The processor P wishes to send data between u and v, and for this purpose, the processor can use any of the networks G accessible to it. To send data over a network G, the processor P requires a bandwidth of h(a) along some path (or route) connecting the pair of vertices u and v in G. The input specifies a profit for each demand. A feasible solution is to select a subset of demands and schedule each selected demand on some graph-network. For each selected demand hu, vi scheduled on a graph-network G, the feasible solution must also specify which path connecting u and v must be used for transmission. The following conditions must be satisfied: (i) Accessibility 1 requirement: If a demand hu, vi owned by a processor P is scheduled on a graph-network G, then P should be able to access G; (ii) Bandwidth requirement: For any network G and for any edge e in G, the sum of bandwidth requirements of selected demands that use the edge e must not exceed 1 unit (the bandwidth offered by the edge). We call this the throughput maximization problem1. We shall refer to the special case of the problem wherein the heights of all demands is 1 unit as the unit height case. In this case, we see that the paths of any two demands scheduled on the same network should be edge disjoint. The general case wherein the heights can be arbitrary will be referred to as the arbitrary height case. It is known that the throughput maximization problem is NP-hard to approximate within a factor of Ω(log1/2−ǫ n), even for the unit height case of a single graph-network [1]. Constant factor approximations are known for special cases of the throughput maximization problem (c.f. [10]). Our goal in this paper is to study the problem in a distributed setting. Prior work has addressed the problem in a distributed setting for the special case of line networks. In our paper, we present distributed algorithms for the more general case of tree networks and also improve the known ap- proximation ratios for the case of line networks. We first discuss the concept of line networks and summarize the known sequential and distributed algorithms for this case. Line-Networks: A line-network refers to a graph which is simply a path. Consider the special case of the throughput maximization problem wherein all the graph-networks are identical paths; say the path is 1, 2, . . . , n. We can reformulate this special case by viewing the path as a timeline. We visualize each edge (i, i + 1) as a timeslot so that the number of timeslots is n − 1, say numbered 1, 2, . . . , n − 1; then the timeline consisting of these timeslots becomes a range [1, n − 1]. Each demand pair hu, vi can be represented by the timeslots u, u + 1, . . . , v − 1 and can be viewed as a interval [u, v − 1]. Thus, each demand can be assumed to be specified as an interval [s, e], where s and e are the starting and ending timeslots. Each graph network can be viewed as a resource offering a uniform bandwidth of 1 unit throughout the timeline. We see that a feasible solution selects a set of demands and schedules each demand on a resource accessible to the processor owning the demand such that for any resource and any timeslot, the sum of heights of the demands scheduled on the resource and active at the timeslot does not exceed 1 unit. The goal is to choose a subset of demands with the maximum throughput. See Figure 1 for an illustration. In natural applications, a demand may specify a window [rt, dl] (release time and deadline) where it can be executed and a processing time ρ. The job can be executed on any time segment of length ρ contained within the window. The rest of the problem description remains the same as above. In the new setup, apart from selecting a set of demands and determining the resources where they must be executed, a feasible solution must also choose a execution segment for each selected demand. As before, the accessibility and the bandwidth constraints must be satisfied. The goal is to find a feasible solution having maximum profit. The throughput maximization problem on line-networks has been well-studied in the realm of classical, sequential computation. For the arbitrary height case, Bar-Noy et al. [4] presented a 5- approximation algorithm. For the unit height case, Bar-Noy et al. [4], and independently Berman and Dasgupta [5] presented 2-approximation algorithms; both these algorithms can also handle the 1The generalization in which the bandwidths offered by edges can vary has also been studied. For the case where there is only one graph, this is known as the unsplittable flow problem (UFP), which has been well-studied (see survey [12]). In this paper, we shall only consider the case where the bandwidth offered by all the edges are uniform, say 1 unit 2 0.7 A C 0.5 B 0.4 Figure 1: Illustration for the problem on line-networks. The bandwidth/capacity offered by the resource is 1 unit throughout the timeline. The sets of demands {A, C} and {B, C} can be scheduled on the resource, but both A and B cannot be scheduled on the same resource. notion of windows. Generalizations and special cases of the problem have also been studied2. Panconesi and Sozio [15, 16] studied the throughput maximization problem on line-networks in a distributed setting. In this setup, two processors can communicate with each other, if they have access to some common resource. We shall assume the standard synchronous, message passing model of computation: in a given network of processors, each processor can communicate in one step with all other processors it is directly connected to. The running time of the algorithm is given by the number of communication rounds. This model is universally used in the context of distributed graph algorithms. We require that the local computation at any processor takes only polynomial time. To be efficient, we require the communication rounds to be polylogarithmic in the input size. We can construct a communication graph taking the processors to be the vertices and drawing an edge between two processors, if they can communicate (i.e., they share a common resource). Notice that the diameter of the communication graph can be as large as the number of processors m. So, there may be a pair of processors such that the path connecting them has a large number of hops (or edges). Hence, within the stipulated polylogarithmic number of rounds, it would be infeasible to send information between such a pair of processors. The above fact makes it challenging to design distributed algorithms with polylogarithmic number of rounds. Under the above model, Panconesi and Sozio [16] designed distributed approximation algorithms for the throughput maximization problem on line networks. For the case of unit height demands, they presented an algorithm with an approximation ratio of (20+ ǫ) (throughout the paper, ǫ > 0 is a constant fixed arbitrarily). For the general arbitrary height case, they devised an algorithm with an approximation ratio of (55 + ǫ). Both the above algorithms can also handle the notion of win- 2 For the case where there is only one line-network and there are no windows, improved approximations are known [4, 7]. The UFP problem on line-networks (where the bandwidth offered varies over the timeline) has also been well studied (see [3, 2, 8, 10, 11]) and a constant factor approximation algorithm is known [6]. 3 dows. The number of communication rounds of these algorithms is: O(cid:16) Time(MIS) Here, Lmax and Lmin are the maximum and minimum length of any demand, and pmax and pmin are the maximum and minimum profit of any demand. The value hmin is the minimum height of any demand (recall that all demand heights are at most 1 unit); in the case of unit height de- mands, hmin = 1. The value Time(MIS) is the number of rounds needed for computing a maximal independent set (MIS) in general graphs. The randomized algorithm of Luby [14] can compute MIS in O(log N ) rounds, where N = nmr (n, m and r are the number of timeslots, demands and resources, respectively); if this algorithm is used, then the overall distributed algorithm would also be randomized. Alternatively, via network-decompositions, [17] present a deterministic algorithm with Time(MIS) = O(2√log N ). pmin(cid:17). log Lmax Lmin log pmax ǫ·hmin Our Contributions: In this paper, we make two important contributions. The first is that we provide improved approximation ratios for the throughput maximization problems on line-networks addressed by Panconesi and Sozio [16]. Secondly, we present distributed approximation algorithms for the more general case of tree-networks. A tree-network refers to a graph which is a tree. Notice that in a tree, the path between a pair of vertices u and v is unique and so, it suffices if the feasible solution schedules each selected demand on a tree-network and the paths will be determined uniquely (see Figure 2). Prior work has addressed the throughput maximization problem for the scenario where the input consists of a single tree-network (and all processors have access to the sole tree-network). Under this setup, Tarjan showed that the unit height case can be solved in polynomial time [18]. Lewin-Eytan et al. [13] presented a 5-approximation algorithm for the arbitrary height case. In the setting of multiple tree-networks, the problem is NP-hard even for the unit height case. By extending the algorithm of Lewin-Eytan et al., we can show that the problem can be approximated within a factor of 3 and 8, for the unit height and arbitrary height cases, respectively. One of the main goals of the current paper is to design distributed algorithms for the throughput maximization problems on tree-networks. Our main result is: Main result: We present a distributed (7 + ǫ)-approximation algorithm for the unit height case of the throughput maximization problem on tree-networks. The number of communication rounds is polylogarithmic in the input size: O(Time(MIS) · (1/ǫ) · log n · log(pmax/pmin)). Here, n is the number of vertices; pmax and pmin are the maximum and minimum profits. Time(MIS) is the number of rounds taken for computing MIS in arbitrary graphs with N vertices, where N = mr (m is the number of processors/demands and r is the number of input tree-networks). As in the work of Panconesi and Sozio [16], the size of each message is O(M ) where M is the number of bits needed for encoding the information about a demand (such as its profit, end-points and height). Recall that Panconesi and Sozio [16] presented a distributed (20 + ǫ)-approximation algorithm for the unit height case of the line-networks problem. The main result provides improvements over the above work along two dimensions: the new algorithm can handle the more general concept of tree-networks and simultaneously, it offers an improved approximation ratio. Extending the main result, we design a distributed (80 + ǫ)-approximation algorithm for the arbitrary height case of the tree-networks problem The number of communication rounds taken by this algorithm is O(Time(MIS) · (1/ǫ) · (1/hmin) · log n · log(pmax/pmin)). This algorithm assumes that the value hmin is known to all the processors. Alternatively, we assume that a value hmin is 4 Figure 2: Tree-Networks: There are three demands h1, 10i, h2, 3i and h12, 13i. In the unit height case, only one of the three demands can be scheduled on the given tree-network (because they all share the edge h4, 5i). To illustrate the arbitrary height case, suppose their heights are 0.4, 0.7 and 0.3, respectively. Then, the first and third demand can be scheduled together. fixed a priori and all the demands are required to have height at least hmin. Next, we provide a improved approximation ratios for the case of line-networks with windows. We design distributed algorithms with approximation ratios (4 + ǫ) and (23 + ǫ), for the unit height case and arbitrary height case, respectively 3. The number of communication rounds taken by these algorithms is the same as that of Panconesi and Sozio [16]. Proof Techniques and Discussion: At a technical level, our paper makes two main contribu- tions. The algorithms of Panconesi and Sozio [16], as well as our algorithms, go via the primal-dual method (see [19]). The sequential algorithms of Bar-Noy et al. [4] and Lewin-Eytan et al. [13] use the local ratio technique, but they can also be reformulated as primal-dual algorithms. Given a de- mand/job, there are multiple tree-networks (or line-networks) where the demand can be scheduled and we call each such possibility as a demand instance. All of the above algorithms work in two phases: in the first phase, a subset of candidate demand instances are identified and an assignment to dual variables is computed. In the second phase, the candidate set is pruned and a feasible solution is constructed. The dual assignment is used as a lowerbound for the optimal solution, by 3The conference version of the paper [9] claimed approximation ratios of (20 + ǫ) and (11 + ǫ) for the arbitrary height case of tree and line networks, respectively. However, there was a minor error in analyzing the approximation guarantee of the algorithm. The error is fixed in the current paper with an increase in the ratios 5 appealing to the weak-duality theorem. In fact, approximation algorithms for many other packing problems utilize the above two-phase strategy. We first formulate the above two-phase method as a framework. An important feature of the framework is that any algorithm following the framework must produce an ordering of the demand instances and also for each demand instance, it must determine the edges along the path whose dual variables will be increased (or raised). The ordering and the chosen edges should satisfy a certain property called the "interference property". The number of edges chosen, denoted ∆, is a factor in determining the approximation ratio. In the case of line-networks, Panconesi and Sozio [16] classify the demand instances into logarithmic many groups based on their lengths and obtain an ordering with ∆ = 3. In the case of tree-networks, it is more challenging to design an ordering satisfying the interference property. Towards that goal, we introduce the notion of "tree-decompositions". The efficacy of a tree-decomposition is measured by its depth and "pivot size" θ. As it turns out, the pivot size θ determines the parameter ∆ and the depth determines the number of rounds taken by the algorithm. Our first main technical contribution is a tree-decomposition with depth O(log n) and pivot size θ = 2. Using this tree-decomposition, we show how to get an ordering with ∆ = 6. Our tree-decompositions may be of independent interest. Another feature of the framework is that an algorithm following the framework should produce an assignment for the dual variables in the first phase. This assignment need not form a dual feasible solution, but it should be approximately feasible: the dual assignment divided by a parameter λ (0 < λ ≤ 1) should yield a feasible solution. The approximation ratio is inversely related to the parameter λ. The algorithm of Panconesi and Sozio [16] produces a dual assignment with parameter λ = 1/(5 + ǫ). Our second main technical contribution is a method for constructing a dual assignment with parameter λ = (1 − ǫ). Thus, we get a improved approximation ratios for the case of line-networks. 2 Unit Height Case of Tree Networks: Problem Definition The input consists of a vertex set V containing n vertices, a set of m processors P, a set of m demands A and a set of r tree-networks T (each defined over the vertex-set V ). A demand a ∈ A is specified as a pair of vertices a = (u, v) and it is associated with a profit p(a); u and v are called the end-points of a. Each processor P ∈ P owns a unique demand a ∈ A. For each processor P ∈ P, the input also provides a set Acc(P ) ⊆ T that specifies the set of tree-networks accessible to P . Let pmax and pmin be the maximum and minimum profits. We will assume that all the tree-networks are connected. Note that the tree-networks can have different sets of edges and so, they are allowed to define different trees. A feasible solution S selects a set of demands S ⊆ A and schedules each a ∈ S on some tree- network T ∈ T . The feasible solution must satisfy the following properties: (i) for any a ∈ S, if a is owned by a processor P and a is scheduled on a tree-network T , then P must be able to access T (i.e., T ∈ Acc(P )); (ii) for any two selected demands a1 = (u1, v1) and a2 = (u2, v2), if both a1 and a2 are scheduled on the same tree-network T , then the path between u1 and v1, and the path between u2 and v2 in the tree-network T must be edge-disjoint (meaning, the two paths must not share any edge). The profit of solution S is defined to be the sum of profits of the selected demands; this is denoted p(S). The problem is to find the maximum profit feasible solution. We next present a reformulation of the problem, which will be more convenient for our discus- sion. Consider each demand a ∈ A and let P be the processor which owns a. For each tree-network 6 T ∈ Acc(P ), create a copy of a with the same end-points and profit; we call this the demand instance of a belonging to the tree-network T . Let D denote the set of all demand instances over all the demands; each demand instance d ∈ D can represented by its two end-points and the tree- network to which it belongs. For a demand a owned by a processor P , let Inst(a) denote the set of all instances of a (we have Inst(a) = Acc(P )). The profit of a demand instance d ∈ D is defined to be the same as that of the demand to which it belongs; we denote this as p(d). A feasible solution selects a subset of demand instances S ⊆ D such that: (i) for any two demand instances d1, d2 ∈ S, if d1 and d2 belong to the same tree-network T , then their paths (in the tree-network T ) do not share any edge; (ii) for any demand a ∈ A, at most one demand instance of a is selected. The profit of the solution is the sum of profits of the demand instance contained in it. The goal is to find a feasible solution of maximum profit. The communication among the processors is governed by the following rule: two processors P1 and P2 are allowed to communicate, if they have access to some common resource (Acc(P1) ∩ Acc(P2) 6= ∅). Notation: The following notation will be useful in our discussion. Let E denote the set of all edges over all the tree-networks; any edge e ∈ E is represented by a triple hu, v, T i, where u and v are vertices of e and T is the tree-network to which e belongs. For a tree-network T , let D(T ) denote the set of all demand instances belonging to T . Any demand instance d ∈ D(T ) can be viewed as a path in T and we denote this as path(d). For a demand instance d ∈ D(T ) and an edge e in T , we say that d is active on the edge e, if the path(d) includes e; this is denoted d ∼ e. We say that two demand instances d1 and d2 are overlapping, if d1 and d2 belong to the same tree-network, and path(d1) and path(d2) share some edge; the demands are said to non-overlapping, otherwise. Two demand instances d1 and d2 are said to be conflicting, if both d1 and d2 belong to the same demand or they overlap; otherwise, the demands are said to be non-conflicting. We shall alternatively use the term independent to mean a pair of non-conflicting demands. A set of demand instances D is said to be independent set, if every pair of demand instances in D is independent. Notice that a feasible solution is nothing but an independent set of demand instances. 3 LP and the Two-phase Framework Our algorithm uses the well-known primal-dual scheme and goes via a two-phase framework. We first present the primal and the dual LPs and then discuss the framework. 3.1 LP Formulation The LP and its dual are presented below. For each demand instance d ∈ D, we introduce a primal variable x(d). The first set of primal constraints capture the fact that a feasible solution cannot select two demand instances active on the same edge. Similarly, the second set of primal constraints capture the fact that a feasible solution can select at most one demand instance belonging to any demand. For each demand a ∈ A and each edge e ∈ E, the dual includes a variable α(a) and β(e), respectively. Similarly, for each demand instance d ∈ D, the dual includes a constraint; we call this the dual constraint of d. Let ad denote the demand to which a demand instance d belongs. 7 max x(d) · p(d) Xd∈D Xd∈D : d∼e Xd∈Inst(a) x(d) ≤ 1 (∀e ∈ E) x(d) ≤ 1 (∀a ∈ A) x(d) ≥ 0 (∀d ∈ D) min Xa∈A α(ad) + Xe : d∼e α(a) + Xe∈E β(e) β(e) ≥ p(d) (∀d ∈ D) α(a) ≥ 0 β(e) ≥ 0 (∀a ∈ A) (∀e ∈ E) 3.2 Two-phase framework We formulate the ideas implicit in [16, 4, 13] in the form of a two-phase framework, described next. Our algorithm would follow this framework. First Phase: The procedure initializes all the dual variables α(·) and β(·) to 0 and constructs an empty stack, and then it proceeds iteratively. Consider an iteration. Let U be the set of all demand instances whose dual constraints are still unsatisfied. We select a suitable independent set I ⊆ U (how to select I is clarified below). For each d ∈ I, we wish to increase (or raise) the value of the dual variables suitably so that the dual constraint of d is satisfied tightly (i.e., the LHS becomes equal to the RHS). For this purpose, we adopt the following strategy. Consider each demand instance d ∈ I. We first determine the slackness s of the constraint, which is the difference between the LHS and RHS of the constraint: s = p(d) − (α(ad) +Pe : d∼e β(e)). We next select a suitable subset π(d) consisting of edges on which d is active (how to select π(d) is clarified below). Next we compute the quantity δ(d) = s/(π(d) + 1). We then raise the value of α(ad) by the amount δ(d); and for each e ∈ π(d), we raise dual variable β(e) by the amount δ(d). We see that the dual constraint is satisfied tightly in the process. The edges π(d) are called the critical edges of d. We say that the demand instance d is raised by the amount δ(d). Finally, the independent set I is pushed on to the stack (as a single object). This completes an iteration. In the above framework, in each iteration, we need to select an independent set I and the critical set of edges π(d) for each d ∈ I. These are left as choices that must be made by the specific algorithm constructed via this framework. Similarly, the algorithm must also decide the termination condition for the first phase. Second Phase: We consider the independent sets in the reverse order and construct a solution S, as follows. We initialize a set D = ∅ and proceed iteratively. In each iteration, the independent set I on the top of the stack is popped. For each d ∈ I, we add d to D, if doing so does not violate feasibility (namely, D ∪ {d} is an independent set). The second phase continues until the stack becomes empty. Let S = D be the feasible solution produced by the second phase. This completes the description of the framework. An important aspect of the above framework is that is parallelizable. The set I chosen in each iteration of the first phase is an independent set. Hence, for any two demand instances d1, d2 ∈ I, the LHS of the constraints of d1 and d2 do not share any dual variable. Consequently, all the demand instances d ∈ I can be raised simultaneously. As we shall see, we can derive an approximation ratio for any algorithm built on the above framework, provided it satisfies the following condition, which we call the interference property: for any pair of overlapping demand instances d1 and d2 raised in the first phase, if d1 is raised before 8 d2, then path(d2) must include at least one of the critical edges contained in π(d1). The following notation is useful in determining the approximation ratio. Let ξ ∈ [0, 1] be any real number. At any stage of the algorithm, we say that a demand instance d ∈ D is ξ-satisfied, if in the dual constraint of d, the LHS is at least ξ times the RHS: α(ad) +Pe : d∼e β(e) ≥ ξ · p(d). If the above condition is not true, then we say that d is ξ-unsatisfied. We shall measure the efficacy of an algorithm following the above framework using three param- eters. (1) Critical set size ∆: Let ∆ be the maximum cardinality of π(d), over all demand instances d raised by the algorithm. (2) Slackness parameter λ: Let λ ∈ [0, 1] be the largest number such that at the end of the first phase, all the demand instances d ∈ D are λ-satisfied. (3) Round complexity: The number of iterations taken by the first phase. The parameters ∆ and λ will determine the approximation ratio of the algorithm; we would like to have ∆ to be small and λ to be close to 1. The round complexity determines the number of rounds taken by the algorithm when implemented in a distributed setting. We say that the algorithm is governed by the parameters ∆ and λ. The following lemma provides an approximation guarantee for any algorithm satisfying the interference property. The lemma is similar to Lemma 1 in the work of Panconesi and Sozio [15]. Let Opt denote the optimal solution to the input problem instance. Lemma 3.1 Consider any algorithm satisfying the interference property and governed by parame- ters ∆ and λ. Then the feasible solution S produced by the algorithm satisfies p(S) ≥(cid:16) λ ∆+1(cid:17)·p(Opt). Proof: At the end of the first phase, the algorithm produces dual variable assignments α(·) and β(·). Even though this assignment may not form a dual feasible solution, it ensures that all the demand instances are λ-satisfied; (intuitively, all the dual constraints are approximately satisfied). It is easy to convert the assignment hα, βi into a dual feasible solution by scaling the values by an amount 1/λ: for each demand instance d, setbα(d) = α(d)/λ and for each edge e, set bβ(e) = β(e)/λ. Notice that the hbα,bβi forms a feasible dual solution. Let val(α, β) and val(bα,bβ) be the objective value of the dual assignment hα, βi and the dual feasible solution hbα,bβi, respectively. By the weak duality theorem, val(bα,bβ) ≥ p(Opt). The scaling process implies that val(bα,bβ) = val(α, β)/λ. We now establish a relationship between val(α, β) and Let R denote the set of all demand instances that are raised in the first phase. The value val(α, β) can be computed as follows. For any d ∈ R, at most ∆ + 1 dual variables are raised by an amount δ(d) (because π(d) ≤ ∆). So, whenever a demand instance d ∈ R is raised, the objective value raises at most (∆ + 1)δ(d). Therefore, p(S). val(α, β) = Xa∈A α(a) +Xe∈E ≤ (∆ + 1)Xd∈R β(e) δ(d). (1) We next compute the profit of the solution p(S). For a pair of demand instances d1, d2 ∈ R, we say that d1 is a predecessor of d2, if the pair is conflicting and d1 is raised before d2; in this case d2 is said to be a successor of d1. For a demand instance d ∈ R, let pred(d) and succ(d) denote the set of predecessors and successors of d, respectively; we include d in both the sets. Consider an element d ∈ S. We claim that p(d) ≥ Xd′∈pred(d) 9 δ(d′). (2) To see this claim, consider the iteration in which d is raised. At the beginning of this iteration the constraint of d is unsatisfied and d is raised to make the constraint tightly satisfied. The interference property ensures the following condition: any demand instance d′ ∈ pred(d) with d′ 6= d would have contributed a value of at least δ(d′) to the LHS of the constraint (because the property enforces that the LHS includes at least one of raising dual variables of d′). Thus, at the beginning of the iteration, the value of the LHS satisfies: p(d) ≥ LHS ≥ X d′ : d′∈pred(d) and d′6=d δ(d′). When d is raised, LHS increases at least by δ(d) and the constraint becomes tight. This proves the claim. We can now compute a lowerbound on the profit of S: p(S) = Xd∈S p(d) δ(d′) δ(d′) ≥ Xd∈S Xd′∈pred(d) = Xd′∈R Xd∈succ(d′)∩S = Xd′∈R ≥ Xd′∈R δ(d′). δ(d′) · succ(d′) ∩ S. (3) The second statement follows from (2) and the last statement follows from the fact that for any d′ ∈ R, either d′ belongs to S or a successor of d′ belongs to S (this is by the construction of the second phase). observations made at the beginning of the proof. Comparing (1) and (3), we see that val(α, β) ≤ (∆ + 1)p(S). The lemma follows from the (cid:3) A local-ratio based sequential 3-approximation algorithm for the unit height case of tree- networks is implicit in the work of Lewin-Eytan [13]. This algorithm can be reformulated in the two-phase framework with parameters critical set size ∆ = 2 and slackness λ = 1 (however, the round complexity can be as high as n). We present the above algorithm in Appendix A; the purpose is to provide a concrete exposition of the two-phase framework. Panconesi and Sozio [16] designed a distributed algorithm for the throughput maximization problem restricted to line-networks. In terms of the two-phase framework, their algorithm satisfies the interference property with critical set size ∆ = 3 and slackness λ = 1/(5 + ǫ). To this end, they partition the demand instances in to logarithmic number of groups based on their lengths, wherein the lengths of any pair of demand instances found within the same group differ at most by a factor of 2. Then they exploit the property that if d1 and d2 are overlapping demand instances found within the same group , then d2 is active either at the left end-point, the right end-point or the mid-point of d1. This way, they satisfy the interference property with ∆ = 3. We do not know how to extend such a length-based ordering to our setting of tree-networks. Consequently, designing an ordering satisfying the interference property with a constant ∆ turns out to be more 10 challenging. Nevertheless, we show an ordering for which ∆ = 6. Furthermore, we shall present a method for improving the slackness parameter λ to (1 − ǫ). The notion of tree-decompositions and layered decompositions form the core components of our algorithms. 4 Tree-Decompositions and Layered Decompositions We first define the notion of tree-decompositions and show how to construct tree decompositions with good parameters. Then, we show how to transform tree decompositions into layered decom- positions. Let H be a rooted tree defined over the vertex-set V with g as the root. For a node x, define its depth to be the number of nodes along the path from g to x; the root g itself is defined to have to depth 1. With respect to H, a node y is said to be an ancestor of x, if y appears along the path from g to x; in this case, x is said to be a descendent of y. By convention, we do not consider x to be an ancestor or descendent of itself. For a node z in H, let C(z) be the set consisting of z and its descendents in H. 4.1 Tree-decomposition: Definition Let T ∈ T be a tree-network defined over the input vertex-set V consisting of n vertices. A subset of nodes C ⊆ V is called a component, if C induces a (connected) subtree in T . We say that a node x ∈ V − C is a neighbor of C, if x is adjacent to some node in C. Let Γ[C] denote the set of neighbors (or neighborhood) of C. Notice that for any two nodes x ∈ C and y 6∈ C, the path between x and y must pass through some node in the neighborhood Γ[C]. Let T be a tree-network and H be a rooted-tree defined over V with g as the root. We say that H is a tree decomposition for T , if the following conditions are satisfied: (i) for any demand instance d ∈ D(T ), if d passes through nodes x and y then d also passes through LCA(x, y), which is the least common ancestor of x and y in H; (ii) for any node z in H, C(z) forms a component in T . For a node z ∈ H, let χ(z) denote the set of neighbors of the component C(z), i.e., Γ[C(z)]. We call χ(z) the pivot set of z. Clearly, for any nodes x ∈ C(z) and y 6∈ C(z), the path between x and y in T must pass through one of the nodes in χ(z). We shall measure the efficacy of a tree decomposition H using two parameters: (i) pivot size θ: this is the maximum cardinality of χ(z) over all z ∈ V ; (ii) the depth of the tree. See Figure 3 for an illustration. This figure shows an example tree-decomposition for the tree- network shown in Figure 6. The demand instance h4, 13i passes through nodes 2 and 8; it also passes through LCA(2, 8) = 5. For the node 2, the component C(2) = {2, 4}; its pivot set is χ(2) = {1, 5}. On the other hand, C(5) = {5, 9, 8, 2, 12, 13, 4} and its pivot set is χ(5) = {1}. This tree-decomposition has depth 4 and pivot set size θ = 2. We note that it is not difficult to design tree-decompositions with parameters hdepth = n, θ = 1i or hdepth = log n, θ = log ni. As it turns out the depth of the tree-decomposition will determine the number of rounds, whereas the pivot size θ will determine the approximation ratio. Thus, neither of these two tree-decompositions would yield an algorithm that runs in polylogarithmic number of rounds, while achieving a constant factor approximation ratio. Our main contribution is a tree- decomposition with parameters hdepth = 2 log n, θ = 2i (we call this the ideal tree-decomposition). Interestingly, the ideal tree-decomposition builds on the two simpler tree-decompositions mentioned 11 1 5 8 9 2 11 12 13 4 7 3 6 10 14 Figure 3: Tree-decompositions: Illustration. above. For the sake of completeness, the two simpler tree-decompositions are discussed next. 4.2 Two Simple Tree-decompositions Here, we present two tree decompositions called root-fixing tree decomposition and balancing tree decomposition. The first decomposition has pivot size θ = 1, but its depth can be as high as n. The second decomposition has depth log n, but its pivot size θ can be as high as log n. Root-fixing Decomposition: Let T ∈ T be any input tree-network. Convert T into a rooted- tree by arbitrarily picking a node g ∈ V as the root; let the resulting rooted-tree be H. It is easy to see that H is a tree decomposition for T . Consider any node z and let z′ be its parent in H; let C(z) be the descendants of z including z itself. Notice that for any x ∈ C(z) and y 6∈ C(z), the path between x and z must pass through the parent z′. Thus the component C(z) has only one neighbor. We see that H has pivot size θ = 1; however, the depth of H can be as high as n. Figure 6 shows a root-fixing decomposition; the chosen root is node 1. The sequential algorithm given in Section A implicitly uses the root-fixing tree decomposition. Balancing tree decomposition: Let T ∈ T be a tree-network. Consider a component C ⊆ V and let T (C) be the (connected) subtree induced by C. Let z be a node in C. If we delete the node z from T (C), the tree T (C) splits into subtrees T1, T2, . . . , Ts (for some s). Let C1, C2, . . . , Cs be the vertex-set of these subtrees. Every node in C − {z} is found in some component Ci. We say that the node z splits C into components C1, C2, . . . Cs. The node z is said to be a balancer for C, if for all 1 ≤ i ≤ s, Ci ≤ ⌊C/2⌋. The following observation is easy to prove: any component C ⊆ V contains a balancer z. Our procedure for constructing the tree decomposition for T works recursively by calling a pro- cedure BuildBalTD (build balanced tree decomposition). The procedure takes as input a component C ⊆ V and outputs a rooted-tree having C as the vertex-set. It works as follows. Given a compo- 12 nent C, find a balancer z for C. Then split C by z and obtain components C1, C2, . . . , Cs (for some s). Each component Ci has size at most ⌊C/2⌋. For 1 ≤ i ≤ s, call the procedure BuildBalTD recursively on the component Ci and obtain a tree Hi with gi as the root. Construct a tree H by making z as the root and g1, g2, . . . , gs as its children. Return the tree H. Given a tree-network T , we obtain a rooted-tree H by calling BuildBalTD with the whole vertex-set V as the input. It is easy to see that for any node z, C(z) forms a component in T . For any node z in H with children z1, z2, . . . , zs (for some s), C(z1), C(z2), . . . , C(zs) are nothing but the components obtained by splitting C(z) by z. This implies that H satisfies the first property of tree decompositions. Since the size of the input component drops by a factor of two in each iteration, the depth of H is at most ⌈log n⌉. Consider any node z in H and let C(z) be the set consisting of descendants of z and z itself. Observe that for any node x ∈ C(z) and y 6∈ C(z), the path between x and y must pass through one of the ancestors of z in H (because of the first property of tree decompositions). In other words, the neighborhood of C(z) is contained within the set of ancestors of z. The number of ancestors is at most ⌈log n⌉ and hence, the pivot size of H is at most O(log n). Figure 3 shows an example balancing tree-decomposition for the tree given in Figure 6. 4.3 Ideal Tree-decomposition In this section, we present the ideal tree-decomposition with parameters hdepth = 2 log n, θ = 2i. The ideal tree-decomposition also goes via the notion of balancers. Recall that any component C ⊆ V contains a balancer z. Fix a tree-network T and we shall construct an ideal tree decomposition H for T with pivot set size θ = 2 and depth O(log n). Intuitively, the tree H will be constructed recursively. In each level of the recursion, we will add two nodes to the tree: a balancer and a node that we call a junction. The output tree-decomposition will have depth at most 2⌈log n⌉. The construction works via a recursive procedure BuildIdealTD (build ideal tree decomposition). The procedure BuildIdealTD takes as input a set C ⊆ V forming a component in T . As a precondition, it requires the component C to satisfy the important property that C has at most two neighbors in T . It outputs a rooted-tree H with C as the vertex set having depth at most 2⌈log C⌉ such that for any node x ∈ C, the number of neighbors of C(x) is at most 2, where C(x) is the set consisting of x and its descendants in H. The procedure BuildIdealTD works as follows. We first find a balancer z for the component C. The node z splits C into components C1, C2, . . . , Cs. We shall consider two cases based on whether C has a single neighbor or two neighbors. Case 1: This is the easier case where C has only one neighbor, say u1. See Figure 4. For this case, ignore the nodes u2 and u′2. Let u′1 be the node in C which is adjacent to u1 and without loss of generality, assume that C1 is the component to which u′1 belongs. Observe that Γ(C1) = {u1, z} and for all i ≥ 2, Γ(Ci) = {z}. In other words, all the components Ci have at most two neighbors. That is, they all satisfy the precondition set by the procedure. For each 1 ≤ i ≤ s, we recursively call the procedure BuildIdealTD on the component Ci and obtain a tree Hi with gi as the root. We construct a tree H by making z as the root and g1, g2, . . . , gs as its children. Then, the rooted-tree H is returned. Case 2: Now consider the case where C has two neighbors, say u1 and u2. Let u′1 and u′2 be the nodes in C which are neighbors of u1 and u2, respectively. We consider two subcases. 13 Figure 4: Illustration for ideal tree-decomposition. Case 2(a): The first subcase is when u′1 and u′2 lie in two different components, say C1 and C2, respectively. See Figure 4. Observe that Γ(C1) = {u1, z}, Γ(C2) = {u2, z} and for all i ≥ 3, Γ(Ci) = {z}. Hence all the components Ci satisfy the precondition set by the procedure. For each 1 ≤ i ≤ s, we call the procedure BuildIdealTD with Ci as input and obtain a tree Hi. We construct a tree H by making the balancer z as the root and g1, g2, . . . , gs as its children. Then, the rooted-tree H is returned. Case 2(b): Now consider the second and comparatively more involved subcase wherein u′1 and u′2 belong to the same component, say C1. See Figure 5. Observe that there exists a unique node j ∈ C1 such that all the three paths u1 u2, u1 z, and u2 z pass through j. We call j as the junction. Spilt the component C1 by the node j to obtain components C′1, C′2, . . . , C′s′ (for some s′). Observe that among C′1, C′2, . . . , C′s′, there exists three distinct components such that z is a neighbor of the first component, and u′1 and u′2 belong to the other two components; without loss of generality, let these components be C′1, C′2 and C′3, respectively. We see that for 2 ≤ i ≤ s, Γ(Ci) = {z}; moreover, Γ(C′1) = {j, z}, Γ(C′2) = {u1, j}, Γ(C′3) = {u2, j} and for 4 ≤ i ≤ s′, Γ(C′i) = {j}. Thus, all the components C2, C3, . . . , Cs and C′1, C′2, . . . , C′s′ satisfy the precondition set by the procedure. For each 2 ≤ i ≤ s, we call the procedure BuildIdealTD recursively with Ci as input and obtain a tree Hi with gi as the root. For each 1 ≤ i ≤ s′, we call the procedure BuildIdealTD recursively with C′i as input and obtain a tree H′i with g′i as the root. Construct a tree H as follows. Make the junction j as the root; make g′2, g′3, . . . , g′s′ as the children of j; make z as a child of j; make g′1 and g2, g3, . . . , gs as the children of z. Return the rooted-tree H. This completes the description of the procedure BuildIdealTD. By induction, we can argue that BuildIdealTD satisfies the intended property: for any node x ∈ C, the number of neighbors of C(x) is at most 2. As an example, consider the subcase in which u′1 and u′2 belong to the same component (the case where a junction j is created). The procedure creates only two nodes j and z on its own and the rest of the nodes in H are created by the recursive calls. Consider the node j. It is guaranteed that the input component C has at most two neighbors (this is the precondition set by the procedure). Since C(j) = C, we see that j satisfies the property. Now, consider the node z. The component C(z) is the union of C2, C3, . . . , Cs and C′1. We have that Γ[C(z)] = {j}. Thus, z also satisfies the property. The rest of the nodes satisfy the property 14 Figure 5: Illustration for Case 2(b) of ideal tree-decomposition by induction. Let us now analyze the depth of the tree H output by the procedure. Since z is a balancer for C, the components C1, C2, . . . , Cs have size at most ⌊C/2⌋. Moreover, since C′1, C′2, . . . , C′s′ are subsets of C1, these components also have size at most ⌊C/2⌋. Thus, all the components input to the recursive calls have size at most ⌊C/2⌋. Thus, by induction, H has depth at most 2⌈log C⌉. We next show how to construct a tree decomposition H for the tree-network T . First, find a balancer g for the entire vertex-set V and split V into components C1, C2, . . . , Cs. For each component Ci, Γ[Ci] = {g}. For each 1 ≤ i ≤ s, call the procedure BuildIdealTD with Ci as input and obtain a tree Hi with gi as the root. Construct a tree H by making g as the root and each gi as its children. Return H. We can argue that for any node z in H, C(z) forms a component in T . Furthermore, for any node z in H with children z1, z2, . . . , zs (for some s), C(z1), C(z2), . . . , C(zs) are nothing but the components obtained by splitting C(z) by z. This implies that H satisfies the first property of tree decompositions. It follows that H is indeed a tree decomposition. The depth of H is at most 2⌈log n⌉. The properties of the BuildIdealTD procedure ensure that the pivot size of H is at most 2. We have the following result Lemma 4.1 For any tree-network T ∈ T , there exists a tree decomposition H (called the ideal tree decomposition) with depth O(log n) and pivot size θ = 2. 15 4.4 Layered Decompositions In this section, we define the notion of layered decompositions and show how to transform tree decompositions into layered decompositions. Let T ∈ T be a tree-network. A layered decomposition of T is a pair σ and π, where σ is a partitioning of D(T ) into a sequence of groups G1, G2, . . . , Gℓ and π maps each demand instance d ∈ D(T ) to a subset of edges in path(d). The following property should be satisfied: for any 1 ≤ i ≤ j ≤ ℓ and for any pair of demand instances d1 ∈ Gi and d2 ∈ Gj, if d1 and d2 are overlapping, then path(d2) should include at least one of the edges in π(d1). The edges in π(d) are called the critical edges of d. The value ℓ is called the length (or depth) of the decomposition. Notice that similarity between the inference property and the notion of layered decompositions. We shall measure the efficacy of a layered decomposition by two parameters: (i) Critical set size ∆ - this is the maximum cardinality of π(d) over all demand instances d ∈ D(T ); (ii) the length ℓ of the sequence. Our goal is to construct a layered decomposition with length O(log n) and critical set size ∆ = 6. Towards that goal we shall show how to transform tree-decompositions into layered decompositions. The following notations are useful for this purpose. Let T ∈ T be tree-network and H be a tree-decomposition for T with pivot size θ and depth ℓ. For a demand instance d, let µ(d) be the node with the least depth in H among all the nodes that path(d) passes through. The first property of tree decompositions ensure that µ(d) is unique. We say that d is captured at µ(d). See Figure 3. In this figure, the demand h4, 13i is captured at node 5. Let d ∈ D(T ) be a demand instance and u be a node in T . Observe that there exists a unique node y belonging to path(d) such that the path from u to y does not pass through any other node in path(d). We call y as the bending point of d with respect to u. For a node y in path(d), we call the edges on path(d) adjacent to y as the wings of y on path(d). If y is an end-point of d, there will be only one wing; otherwise, there will be two wings. See Figure 6. In this figure, with respect to nodes 3 and 9, the bending points of the demand d = h4, 13i are 2 and 5, respectively. With respect to path(d), node 4 has only one wing h4, 2i, while node 8 has two wings h5, 8i and h8, 13i. Lemma 4.2 shows how to transform a tree-decomposition into a layered decomposition. The lemma is proved by categorizing the demand instances into groups G1, G2, . . . , Gℓ, where Gi consists of all demand instances captured at a node with depth ℓ − i + 1. For a demand instance d ∈ D(T ), let z = µ(d). The set π(d) is constructed as follows: (i) we include the wings of z on path(d); (ii) for each neighbor u of C(z), taking y to be the bending point of path(d) with respect to u, we include the wings of y on path(d). Lemma 4.2 Let T ∈ T be a tree-network and H be a tree decomposition for T with pivot size θ and depth ℓ. Then H can be transformed into a layered decomposition hσ, πi with critical set size ∆ = 2(θ + 1) and length ℓ. Proof: For 1 ≤ i ≤ ℓ, let eGi to be the set consisting of all demand instances d such that depth of µ(d) is i. We define σ to be the reverse of eG1, eG2, . . . , eGℓ; namely, let σ = G1, G2, . . . , Gℓ, where Gi = eGℓ−i+1, for 1 ≤ i ≤ ℓ. Thus, in σ, the demand instances captured at the nodes having the highest depth are placed in G1 and the demand instances captured at the root are placed in Gℓ. We now show how to construct the critical set π(d) for each demand instance d ∈ D(T ). Let z = µ(d) be the node in H where d is captured. Add the wing(s) of z on path(d) to π(d). Then, consider the component C(z) consisting of z and its descendents in H. Let U = {u1, u2, . . . , us} be the neighbors of C(z), where s ≤ θ. For 1 ≤ i ≤ s, let yi be the bending point of d with respect to 16 Figure 6: An example tree-network. ui; add the wing(s) of yi on path(d) to π(d). Notice that π(d) has at most 2(θ + 1) edges. This completes the construction of σ and π(·). We now argue that the construction satisfies the properties of layered decompositions. Consider any two groups Gi and Gj such that i ≤ j. Consider two overlapping demand instances d1 ∈ Gi and d2 ∈ Gj. Let z1 = µ(d1) and z2 = µ(d2) be the nodes in H where d1 and d2 are captured, respectively. We consider two cases: (1) z2 ∈ C(z1); (2) z2 6∈ C(z1). Case 1: In this case, z2 must be the same as z1 (otherwise, we have depth(z2) > depth(z1); this would contradict i ≤ j). Therefore, path(d2) should include at least one of the wings of z1 on path(d1). Recall that the wing(s) of z1 on path(d1) are included in π(d1). Case 2: By the LCA property of tree-decompositions, path(d1) will be constained within the component C(z1). We have that path(d2) goes through the node z2 found outside of C(z1); moreover, it also goes through some node found within C(z1) (since d1 and d2 overlap). By the second property of tree decompositions, such a path must also pass through one of the neighbors of C(z1); let u be such a neighbor. Let the bending point of path(d1) with respect to u be y. Since path(d2) passes through u and overlaps with path(d1), the path(d2) must also pass through the bending point y. It follows that path(d2) must include one of the wings of y on path(d1). Recall that the wing(s) of y on path(d1) are included in π(d1). (cid:3) By applying Lemma 4.2 for the ideal tree decomposition (given by Lemma 4.1), we establish the following result. Lemma 4.3 For any tree-network T ∈ T , we can construct a layered decomposition with critical set size ∆ = 6 and length at most O(log n). 17 Begin // Initialize For all a ∈ A, set α(a) = 0; for all e ∈ E, set β(e) = 0. Initialize an empty stack. Let the input set of tree-networks be T = {T1, T2, . . . , Tr}. For each tree-network Tq Invoke Lemma 4.3 on Tq and obtain a layered decomposition σq = G(q) 1 , G(q) 2 , . . . , G(q) and a mapping πq. ℓq Let ℓmax = maxq ℓq. For each d ∈ D(Tq), define π(d) = πq(d). For each k = 1 to ℓmax, q=1G(q) k . Define Gk = ∪r // First phase For k = 1 to ℓmax //Epochs Let b be the smallest integer such that (14/15)b ≤ ǫ For j = 1 to b //Stages While // Steps or iterations. Let U = {d ∈ Gk : d is (1 − (14/15)j )-unsatisfied} If U = ∅, exit the loop. Find a maximal independent set I contained within U For each d ∈ I Compute slackness: s = p(d) − α(ad) −Pe:d∼e β(e). Compute: δ(d) = s/(π(d) + 1). Raise the variables: α(ad) ← α(ad) + δ(d); for all e ∈ π(d), β(e) ← β(e) + δ(d). Push I into the stack (as a single object). // Second Phase S = ∅. While(stack not empty) Pop the top element I of the stack For each d ∈ I If S ∪ {d} is an independent set, then add d to S. Output S. End Figure 7: Pseudocode of the overall algorithm 5 Distributed Algorithm In this section, we prove the main result of the paper by exhibiting a two-phase procedure with critical set size ∆ = 6 and slackness parameter λ = (1 − ǫ), for any constant ǫ > 0. Let the input tree networks be T = {T1, T2, . . . , Tr}. For each tree-network Tq, invoke Lemma 18 4.3 and obtain a layered decomposition σq = G(q) of length ℓq and a mapping πq. Let ℓmax = maxq ℓq. The lemma guarantees that ℓmax is O(log n) and all the critical set sizes are at most ∆ = 6. Let ∆′ = ∆ + 1 and ξ = (2∆′)/(2∆′ + 1) = 14/15. For the ease of exposition, we combine all the mapping functions into single mapping function π, as follows. For each tree-network Tq and demand instance d ∈ D(Tq), define π(d) = πq(d). 2 , . . . , G(q) 1 , G(q) ℓq q=1G(q) For each 1 ≤ k ≤ ℓmax, let Gk be union of the kth components of all the layered decompositions: Gk = ∪r k . The algorithm would follow the two-phase framework. All the dual variables are initialized to zero and an empty stack is created. The first phase is split into ℓmax epochs. Epoch k will process the group Gk. Our goal is to ensure that at the end of the epoch, all the demand instances in Gk are (1 − ǫ)-satisfied. Each epoch is divided into multiple stages, with each stage making a gradual progress towards the goal. We will ensure that at the end of stage j, all the demand instances in Gk are (1 − ξj)-satisfied. Each stage is split into multiple steps (each step corresponds to an iteration of the two-phase framework). A typical step is explained next. Let U be the set of all demand instances in Gk that are (1 − ξj)-unsatisfied. Find a maximal independent set I contained within U . For all demand instances d ∈ I, raise the demand instance d as prescribed by the framework, taking π(d) to be the critical edges. Namely, for all demand instances d ∈ I, perform the raising as follows. Compute the slackness s = p(d)−α(ad)−Pe : d∼e β(e) and δ(d) = s/(π(d)+1). Raise the dual variable α(ad) by the amount δ(d) and for all e ∈ π(d), raise the dual variable β(e) by δ(d). The stage is completed when all the demand instances in Gk are (1 − ξj)-satisfied and we proceed to the next stage. The epoch is completed when all the demand instances in Gk are (1−ǫ)-satisfied. The second phase is the same as that of the two-phase framework. The pseudocode is provided in Figure 7. Let us analyze the number of steps (or iterations) taken by the above algorithm. The number of epochs is ℓmax, which is O(log n). Each epoch has at most logξ ǫ = O(log(1/ǫ)) stages. The lemma below provides a bound on the number of steps taken by each stage. It follows that the total number of communication rounds is at most O(Time(MIS) log n log(1/ǫ) log(pmax/pmin)), where Time(MIS) is the number of (communication) rounds needed to find a maximal independent set (see Introduction). Lemma 5.1 Consider any epoch k and stage j within the epoch. The number of steps taken by the stage is at most O(log(pmax/pmin)). Proof: Let the number of steps taken by the stage be L. For 1 ≤ i ≤ L, let Ui be the demand instances in Gk that are (1 − ξj)-unsatisfied at the beginning of step i. Let I1, I2, . . . , IL be the sequence of maximal independent sets computed in these steps. For two demand instances d1, d2 ∈ Gk, we say that d1 kills d2 in step i, if d1 ∈ Ii, d2 ∈ Ui+1, and d1 and d2 are conflicting. Intuitively, both d1 and d2 are present in Ui, and both are contenders for the maximal independent Ii. Of the two, d1 got selected in Ii and d2 was omitted; even after the demand instances in Ii were raised, d2 was still (1 − ξj)-unsatisfied. Since d1 and d2 are conflicting, only one of them can be included in the independent set. We imagine that d1 "kills" d2. Claim 5.2 Suppose d1 kills d2 in step i. Then, their profits satisfy p(d2) ≥ 2p(d1) We now prove the claim. Since d1 ∈ Ii, the demand instance is (1 − ξj)-unsatisfied at the beginning of step i. Hence, the difference between the LHS and RHS of the constraint is at least 19 ξj · p(d1). The number dual variables raised for d1 is at most ∆ + 1. Hence, δ(d1) ≥ ξj · p(d1) (∆ + 1) Since d1 and d2 are conflicting, either it is the case that d1 and d2 belong to the same demand a or they belong to the same tree-network Tq (for some q) and overlap. In the former case, the dual constraints of d1 and d2 share the dual variable α(ad). In the latter case, both d1 and d2 belong to the same group G(q) k . Hence, the properties of layered decompositions imply that one of the critical edges in π(d1) also appears in the path(d2). Thus, in either case, when d1 is raised, the LHS of d2 is also raised by an amount δ(d1). On the other hand, d2 ∈ Ui+1 and so, even after the above raise in the LHS value, d2 is still (1 − ξj)-unsatisfied. As we are considering stage j, all the demand instances in Gk are (1 − (ξ)j−1)-satisfied. The gap between (1 − ξj−1)p(d2) and (1 − ξj)p(d2) is (ξj−1 − ξj)p(d2). We see that even after the value of the LHS of the dual constraint of d2 is raised by an amount δ(d1), the above gap is not bridged. It follows that This implies that (ξj−1 − ξj)p(d2) ≥ δ(d1) ≥ ξj · p(d1) (∆ + 1) p(d2) p(d1) ≥ ξ (1 − ξ)(∆ + 1) . We derive the claim by substituting ξ = 14/15 and ∆ = 6. Consider any demand instance dL ∈ UL. There must exist a demand instance dL−1 in UL−1 such that dL−1 kills dL. In general, we can find a sequence of demand instances dL, dL−1, . . . , d1 such that for 1 ≤ i ≤ L − 1, di kills di+1. By the above claim, for 1 ≤ i ≤ L − 1, p(di+1) ≥ 2p(di). It follows that p(dL) ≥ 2L−1p(d1). Hence, L ≤ 1 + log(p(dL)/p(d1)) = O(log(pmax/pmin)). (cid:3) The properties of layered decomposition imply that the above two-phase algorithm satisfies the interference property, governed by parameters ∆ = 6 and λ = (1 − ǫ). Therefore, by Lemma 3.1, it follows that the algorithm has an approximation ratio of 7/(1 − ǫ). For ǫ′ > 0, we can choose ǫ suitably and obtain an approximation ratio of (7 + ǫ′). We have proved the main result of the paper. Theorem 5.3 There exists a distributed algorithm for the unit height case of the throughput maxi- mization problem on tree-networks with approximation ratio (7+ǫ) and number of (communication) rounds is at most O(Time(MIS) log n log(1/ǫ) log(pmax/pmin)), where ǫ > 0 is any constant. Remark: Recall that Panconesi and Sozio [15] presented an algorithm for the unit height case of line-networks. Their algorithm follows the two-phase framework with the slackness parameter λ = 1/(5+ǫ). On the other hand, our algorithm has λ = (1−ǫ). A comparison of the two algorithms is in order. We reformulate their algorithm to suit our framework. Their algorithm also classifies the demand instances into groups (based on length) and processes the groups in epochs. However, each epoch consists of only a single stage. They split the stage into multiple iterations/steps. In any iteration, a demand instance d which is (1/(5 + ǫ))-satisfied is ignored for the rest of the first phase. In contrast, our algorithm works in multiple stages, where in each stage, we make gradual progress towards making the demand instances within the group to be (1 − ǫ)-satisfied. In particular, in stage j, a demand instance which is (1 − ξj)-satisfied is not ignored; it exits the current stage, but 20 it is included in the MIS computations in the next stage. Distributed Implementation: Here, we sketch certain aspects of implementing the algorithm in a distributed manner. Let Mmax be the number of bits needed to encode the information about any demand (such as its end-points and profit). For now, assume that the values pmax and pmin are known to all the processors. Under this as- sumption, we can count the number of epochs, stages and iterations exactly. The number of epochs is 2⌈log n⌉ (the maximum depth of ideal tree decompositions); the number of stages within each epoch is ⌈logξ ǫ⌉, where ξ = 14/15; the number of iterations within each stage is c log(pmax/pmin), where c is a suitable constant. Each processor P computes the ideal tree-decomposition and the corresponding layered decom- position for each tree-network T accessible to it. Each processor maintains the values of the dual variables correspoding to its demand instances. The algorithm proceeds in a synchronous fashion consisting of multiple communication rounds, where each round corresponds to a tuple hf1, f2, f3i, where f1, f2 and f3 are the epoch, stage and iteration number of the pseudocode. Given a tuple hf1, f2, f3i, a processor P can determine which demand instances can participate in the MIS cal- culation of this communication round. The MIS calculation is performed considering the conflict graph: the demand instances participating in the MIS computation form the vertices and an edge is drawn between a pair of vertices, if they are conflicting. The number of vertices is at most N = mr, where m is the number of demands and r is the number of tree-networks. The MIS can computed using either the randomized algorithm of Luby [14] or using the deterministic procedure of network decompositions [17]. In the former case, the number of (communication) rounds needed in O(log N ), whereas in the latter case, it is O(2√log N ). Each processor P contains at most one demand instance d belonging to the MIS. The processor P raises the dual variables corresponding to d as given in the pseudocode. The new dual variables are transmitted to the processors sharing a common resource with P . Upon receiving the new dual variables, each processor updates the dual variables of its demand instances suitably. Each processor P raises at most a constant num- ber of dual variables in each iteration (because the critical set size ∆ = 6 is a constant) and the amount of increase is at most pmax. Thefore, the message size is bounded by Mmax. The stack is implemented in a distributed manner. Each processor P maintains its own stack. Whenever the processor P raises a demand instance d, it pushes d onto its stack along with a tuple t (consisting of the corresponding epoch, stage and iteration numbers). The second phase proceeds in the reverse order. Each round of the second phase is associated with a tuple t (consisting of epoch, stage and iteration numbers). A processor P will compare tuple t′ on the top of the stack with the tuple t; if they match, then it will pop the demand instance d on the top of the stack. It will output d, if feasibility is maintained. In this case, the processor P will inform its neighboring processors that d has been included in the output solution. Finally, we note that it is not difficult to bypass the assumption that all the processors know the values of pmax and pmin. 6 Arbitrary Height Case for Tree-Networks Panconesi and Sozio [15] presented a distributed (20 + ǫ)-approximation algorithm for the unit height case of the line-networks. Then, they extended this algorithm for the arbitrary height case and obtained a (55 + ǫ)-approximation algorithm [16]. In this section, we extend our (7 + ǫ)- 21 approximation algorithm for the unit height case of the tree-networks to the arbitrary height case and derive a (20+ǫ)-approximation algorithm. We note that the extra ideas needed for the extension roughly follow the theme of Panconesi and Sozio [16]. The main difference is that their algorithm follows the two-phase framework with the slackness parameter being λ = 1/(5 + ǫ), whereas we aim for λ = (1 − ǫ). Below we highlight the necessary changes. We first develop some notation for the arbitrary height case. The problem setup is as before, except that each demand a ∈ A also has a bandwidth requirement (or height) h(a). All the edges in all the tree-networks are assumed to provide a uniform bandwidth of 1 unit. For each demand a ∈ A owned by a processor P and each tree-network T accessible to P , create a copy of a with the same end-points, height and profit; these copies are called demand instances of a. Let D denote the set of all demand instances (over all demands). A demand instance d ∈ D belonging to a tree-network T has a height h(d) and a profit p(d), and it can be viewed as a path between its end-points in T . A feasible solution selects a subset of demand instances S ⊆ D such that: (i) for any demand a ∈ A, at most one demand instance of a is selected; (ii) for any edge e in some tree-network T , among the demand instances in S, the sum of heights of the demand instances passing through e is at most 1 unit. The profit of the solution is the sum of profits of the demand instances contained in it. The goal is to choose the solution having the maximum profit. We classify the input demand instances d ∈ D into two categories based on their height: (i) narrow instances: d is said to be narrow, if h(d) ≤ 1/2; (ii) wide instances: d is said to be wide, if h(d) > 1/2. Notice that two wide demand instances which are overlapping cannot be picked by a feasible solution. Hence, if our input consists only of wide demand instances, we can reuse the algorithm for the unit height case and get a (7 + ǫ) approximation factor. We next describe a (13 + ǫ)-approximation algorithm for the special case where in the input consists of only narrow instances. The final algorithm will be derived by combining the above two algorithms. 6.1 Narrow Instances Here, we assume that the input consists of only narrow instances and develop a (13+ǫ)-approximation algorithm. LP and Dual The LP and the dual have to be modified suitably to reflect the notion of heights. Recall that for each demand instance d ∈ D, we have a variable x(d). max x(d) · p(d) Xd∈D x(d) · h(d) ≤ 1 for edges e ∈ E x(d) ≤ 1 for all demands a ∈ A x(d) ≥ 0 for all demand instances d ∈ D Xd∈D : d∼e Xd∈Inst(a) The first set of constraints capture the fact that the cumulative height of the demand instances active on an edge e cannot exceed one unit. Similarly, the second set of constraints capture the fact that a feasible solution can select at most one demand instance belonging to any demand. 22 The dual of the LP is as follows. For each demand a ∈ A and each edge e ∈ E, the dual includes a variable α(a) and β(e), respectively. Similarly, for each demand instance d ∈ D, the dual includes a constraint; we call this the dual constraint of d. Recall that ad denotes the demand to which a demand instance d belongs. min α(ad) + h(d) Xe : d∼e Xa∈A α(a) +Xe∈E β(e) β(e) ≥ p(d) for demand instances d ∈ D The dual also consists of the non-negativity constraints: for all a ∈ A and e ∈ E, α(a) ≥ 0 and β(e) ≥ 0. Two-phase Framework We modify the two-phase framework as follows. As before, the algorithm proceeds iteratively and a typical iteration is performed as below. We choose suitable independent set I and raise each demand instance d ∈ I. The slackness computation is modified to reflect the notion of heights in the constraints. Define the slackness to be: s = p(d) − α(ad) + h(d) · Xe : d∼e β(e)! . We next select a suitable subset π(d) consisting of critical edges on which d is active. The strategy for raising the dual variables is modified slightly. We raise α(ad) by δ(d) and for each e ∈ π(d), raise β(e) by 2π(d)δ(d). Towards that goal, define δ(d) = s/(1 + 2h(d)π(d)2). We see that the dual constraint is satisfied tightly in the process. The second phase of the algorithm remains the same. The parameters critical set size ∆ and slackness λ are defined as before. Similarly, the concept of interference property remains the same. Lemma 3.1 can be extended as follows, using similar arguments. Approximation Guarantee Lemma 6.1 Suppose the input consists of only narrow instances. Consider any algorithm satis- fying the interference property and governed by parameters ∆ and λ. Then the feasible solution S produced by the algorithm satisfies p(S) ≥(cid:16) λ 1+2∆2(cid:17) · p(Opt). Proof: As before, let α(·) and β(·) be the dual variable assignment produced at the end of the first phase. Convert the assignment hα, βi into a dual feasible solution by scaling the values by an amount 1/λ: for each demand instance d, setbα(d) = α(d)/λ and for each edge e, set bβ(e) = β(e)/λ. Notice that the hbα,bβi forms a feasible dual solution. Let val(α, β) and val(bα,bβ) be the objective value of the dual assignment hα, βi and the dual feasible solution hbα,bβi, respectively. By the weak duality theorem, val(bα,bβ) ≥ p(Opt). The scaling process implies that val(bα,bβ) = val(α, β)/λ. We now establish a relationship between val(α, β) and p(S). 23 Let R denote the set of all demand instances that are raised in the first phase. The value val(α, β) can be computed as follows. For any d ∈ R, the variable α(ad) is raised by an amount δ(d) and for each e ∈ π(d), the variable β(e) is raised by an amount 2π(d)δ(d). We have that π(d) ≤ ∆. So, whenever a demand instance d ∈ R is raised, the objective value raises at most (2∆2 + 1)δ(d). Therefore, val(α, β) ≤ (2∆2 + 1)Xd∈R δ(d). (4) We next compute the profit of the solution p(S). For a pair of demand instances d1, d2 ∈ R, we say that d1 is a predecessor of d2, if the pair is conflicting and d1 is raised before d2; in this case d2 is called the successor of d1. For a demand instance d ∈ R, let pred(d) and succ(d) denote the set of predecessors and successors of d, respectively; we exclude d from both the sets. Define K = R − S; we say that demand instances in K are killed by the procedure. We say that a demand d′ is killed by a demand d if the following three conditions are true: (i) d ∈ S; (ii) both d and d′ belong to the same demand; (iii) d′ ∈ pred(d). For a demand d ∈ S, let K1(d) denote the set of demand instances killed by d; notice that K1(d) ⊆ pred(d). Let K1 be the union of K1(d) over all demand instances d ∈ S. Let K2 be the demand instances in K that could not be added to the solution because of bandwidth constraints (i.e., K2 consists of demand instances d such that for some edge e ∈ path(d), h(d) +Pd′∈S : d′∼e h(d′) > 1). Consider any demand instance d ∈ S and we shall computer a lowerbound on p(d). Consider the iteration in which d was raised; after the raise, the LHS of the constraint of d becomes equal to the RHS (i.e., p(d)). The demand instance d contributes at least δ(d) to the LHS. In the previous iterations, any demand instance d′ ∈ K1(d) would have contributed δ(d′) to the LHS. Similarly, for any e ∈ path(d) and any demand instance d′ ∈ pred(d) ∩ K2 such that e ∈ π(d′), d′ would have contributed 2h(d)π(d′)δ(d′) to the LHS. Thus, we see that: d′∈pred(d)∩K2 : e∈π(d′) Summing up p(d) over all the demand instances d ∈ S, we get that p(d) ≥ δ(d) + Xd′∈K1(d) δ(d) +Xd∈S Xd′∈K1(d) p(S) ≥Xd∈S δ(d′) + Xd′∈K1 p(d) ≥ Xd′∈S δ(d′) + Xe∈path(d) X δ(d′) +Xd∈S Xe∈path(d) δ(d′) +Xd′∈K2 Rewriting the second and the third terms of the RHS: Xd∈S 2π(d′)δ(d′) Xe∈π(d′) Xd∈S∩succ(d′) : d∼e Now let us analyze the third term in the RHS. Consider any d′ ∈ K2. The demand instance d′ could not be added to S because of the bandwidth constraint being violated at some edge e′ ∈ path(d′). Meaning, 2h(d)π(d′)δ(d′) . X d′∈pred(d)∩K2 : e∈π(d′) 2h(d)π(d′)δ(d′) . h(d) . (5) h(d′) + Xd∈S∩succ(d′) : d∼e′ h(d) > 1. 24 Since all demand instances are assumed to be narrow, we have that h(d′) ≤ 1/2. It follows that Xd∈S∩succ(d′) : d∼e′ h(d) > 1/2. Let X = {d ∈ S ∩ succ(d′) : d ∼ e′}. By the interference property, all the demand instances in X h(d) > 1 , 2π(d′) Xd∈ eX second summation is over all the edges e ∈ π(d′). We replace this summation by the single quantity are active at one of the edges in π(d′). It follows that there exists an edgeee ∈ π(d′) such that where eX = {d ∈ X : d ∼ ee}. Consider the third term in the RHS of the formula (5). The corresponding toee. We get that δ(d′) +Xd′∈K1 p(d) ≥ Xd′∈S p(d) ≥ Xd′∈S ≥ Xd′∈R h(d) Xd∈S∩succ(d′) : d∼ee 2π(d′) δ(d′) + Xd′∈K2 δ(d′)! + Xd′∈K1 δ(d′) + Xd′∈K2 2π(d′)δ(d′) × 2π(d′)δ(d′) Xd∈S Xd∈S 1 Therefore, δ(d′). The second statement follows from the fact that R is the union of S, K1 and K2. Comparing (4), we see that val(α, β) ≤ (2∆2 + 1)p(S). The lemma is proved by the observations made at the beginning of the proof. (cid:3) Distributed Algorithm Fix any ǫ > 0. Our goal is to design a two-phase procedure with critical set size ∆ = 6 and slackness parameter λ = (1 − ǫ). The distributed algorithm is similar to that of the unit height case (Section 5). We use the same layered decompositions given by Lemma 4.3 (with ∆ = 6 and , for some suitable length ℓ = log n). The only difference is that we set the parameter ξ = constant c. Arguments similar that of Lemma 5.1 can be used to show that in any epoch k and any stage j, the algorithm takes at most O(log(pmax/pmin)) steps (or iterations). The number of epochs in O(log n), as before. The number of stages within each epoch is logξ(ǫ). The above value of ξ ensures that the above quantity is at most O(1/hmin) log(1/ǫ). Therefore, the total number of steps is O(Time(MIS) · (1/hmin) · (log n) · log(1/ǫ) · log(pmax/pmin)). The above algorithm satisfies the interference property with critical set size ∆ = 6 and slackness parameter λ = (1 − ǫ). By Lemma 6.1, the approximation ratio is (2∆2 + 1)/λ = 73/(1 − ǫ). We have established the following lemma. c+hmin c Lemma 6.2 Fix any hmin ≤ 1/2 and ǫ > 0. Consider the special case of the scheduling problem on tree-networks with heights wherein all the demands a are narrow and satisfy h(a) ≥ hmin. There exists a distributed algorithm for the above problem with approximation ratio (73 + ǫ). The number of (communication) rounds is at most O(cid:16) Time(MIS) hmin log n log 1 ǫ log pmax pmin(cid:17). 25 Overall Algorithm Fix any ǫ′ > 0. We present an algorithm within an approximation ratio of (80+ǫ′), for the arbitrary height case of tree-networks. We classify the demand instances into wide and narrow instances. Let Opt1 and Opt2 denote the optimal solutions considering only the wide and narrow instances, respectively. Notice that p(Opt) ≤ p(Opt1) + p(Opt2). For the wide instances, we run the algorithm for the unit height case (Theorem 5.3) and obtain a solution S1 such that p(Opt1) ≤ (7+ǫ′)p(S1). Next we run the algorithm for the narrow instances (Lemma 6.2) and obtain a solution S2 such that p(Opt2) ≤ (73 + ǫ′)p(S2). Output a combined solution S as follows. For each tree-network T ∈ T , consider the set of demand instances scheduled on T by the solution S1 and the set of demand instances scheduled on T by the solution S2; among the two sets, choose the one with the higher profit. It is easy to see that the bandwidth constraints are satisfied by S. Furthermore, for any demand a, either all the demand instances of a are narrow or all of them are wide. Therefore, S will pick at most one demand instance from any demand. This shows that S is indeed a feasible solution. We have that p(S) ≥ max{p(S1), p(S2)}. It follows that p(Opt) ≤ (80 + 2ǫ′)p(S). We have established the following theorem. Theorem 6.3 Fix any hmin ≤ 1/2 and ǫ > 0. Consider the scheduling problem on tree-networks with arbitrary heights wherein all the demands a satisfy h(a) ≥ hmin. There exists a distributed algorithm for the above problem with approximation ratio (80 + ǫ). The number of (communication) rounds is at most O(cid:16) Time(MIS) hmin pmin(cid:17). log n log 1 ǫ log pmax 7 Line-Networks Recall that Panconesi and Sozio [16] presented distributed algorithms for the case of line-networks with windows. For the unit height case the approximation ratio was (20 + ǫ) and for the arbitrary height case, the ratio was (55 + ǫ). In this section, we obtain a improved approximation ratios (4 + ǫ) and (23 + ǫ), respectively. We next explain the new algorithms within our framework. We first develop some notation. Let P be the set of m processors, T be the set of r resources and A be the set of n demands. We divide timeline into n discrete timeslots, 1, 2, . . . , n. Each processor P owns a demand a ∈ A. Each demand a ∈ A is specified by a window [rt(a), dl(a) and a processing time ρ(a), where rt(a) and dl(a) are the release time and deadline of a. A profit p(a) and a height h(a) are associated with each demand a. Consider a processor P and the demand a owned by P . For each resource T accessible by P and each interval of length ρ(a) contained within [rt(a), dl(a)], create a demand instance d; its profit and height are the same as that of a; the number of demand instances is at most nAcc(P ), where Acc(P ) is the set of resource accessible to P . Let D denote the set of all demand instances. Each demand instance d ∈ D is described by a starting time s(d), and ending time e(d), a profit p(d), a height h(d) and the resource to which it belongs. Recall that the time-line can be viewed as a tree-network with n + 1 vertices. In other words, the case of line-networks can be reduced to the case of tree-networks. Therefore, Theorem 5.3 and 6.3 apply to the case of line-networks. We next show how to improve these results in the case of line networks. The improvements are obtained by designing layered decompositions with better parameters. 26 Improved Layered Decomposition In the case of tree-networks, we derived decompositions with critical set size ∆ = 6 and length ℓ = O(log n). In the case special of line-networks, we show how to construct decompositions with parameters ∆ = 3 and ℓ = O(log(Lmax/Lmin)) (Lmax and Lmin are the maximum and minimum length of the demand instances). We note that this decomposition is implicit in [16]. Partition the demand instances in to ℓ = ⌈log(Lmax/Lmin)⌉ categories based on their length, where the length of a demand instance is len(d) = e(d) − s(d) + 1. For 1 ≤ i ≤ ℓ, define Gi = {d : 2i−1Lmin ≤ len(d) ≤ 2iLmin. Define an ordering σ = G1, G2, . . . , Gℓ. For each demand instance d, let mid(d) = ⌊(s(d) + e(d))/2⌋ be the mid-point of d. Define π(d) = {s(d), mid(d), e(d)}, for all d ∈ D. It is not difficult to argue that the pair hσ, πi forms layered decomposition. Unit Height Case Fix ǫ > 0. We modify the distributed algorithm given in Section 5 to use the above layered decomposition. We suitably change the value of ξ to 8/9 (instead of 14/15). This algorithm would satisfy the interference property with ∆ = 3 and λ = (1−ǫ). So, the approximation ratio is 4/(1−ǫ). The number of (communication) rounds is O(Time(MIS)·log(1/ǫ)·log(Lmax/Lmin)·log(pmax/pmin). We have established the following result. Theorem 7.1 There exists a distributed algorithm for the scheduling problem for the unit height case of line-networks with windows with approximation ratio (4 + ǫ). The number of (communica- tion) rounds is at most O(cid:16)Time(MIS) log 1 ǫ log Lmax Lmin log pmax pmin(cid:17), Arbitrary Height Case Here, we discuss the arbitrary height case. As in Section 6, we partition the set of demand instances into narrow and wide categories. For the case of wide instances, Theorem 7.1 applies and yields an algorithm with an approximation ratio of (4 + ǫ). For the case of narrow instances, the algorithm , for a is similar to that of Lemma 6.2; the only change is that we set the parameter ξ = suitable constant c′. This way we get an algorithm with an approximation ratio of 19 + ǫ (because, in the current setup ∆ = 3). We obtain an overall algorithm by combining the solutions output by the above two algorithm; the idea is same as that of Theorem 6.3. We have established the following result. c′+hmin c′ Theorem 7.2 Fix any hmin ≤ 1/2 and ǫ > 0. Consider the scheduling problem on tree-networks with arbitrary heights wherein all the demands a satisfy h(a) ≥ hmin. There exists a distributed algorithm for the above problem with approximation ratio (23 + ǫ). The number of (communication) rounds is at most O(cid:16) Time(MIS) hmin log n log 1 ǫ log pmax pmin(cid:17). References [1] M. Andrews, J. Chuzhoy, S. Khanna, and L. Zhang. Hardness of the undirected edge-disjoint paths problem with congestion. In FOCS, 2005. [2] N. Bansal, A. Chakrabarti, A. Epstein, and B. Schieber. A quasi-PTAS for unsplittable flow on line graphs. In ACM Symposium on Theory of Computing (STOC), pages 721 -- 729, 2006. 27 [3] N. Bansal, Z. Friggstad, R. Khandekar, and M. Salavatipour. A logarithmic approximation for unsplittable flow on line graphs. In ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 702 -- 709, 2009. [4] A. Bar-Noy, R. Bar-Yehuda, A. Freund, J. Naor, and B. Schieber. A unified approach to approximating resource allocation and scheduling. Journal of the ACM, 48(5):1069 -- 1090, 2001. [5] P. Berman and B. DasGupta. Improvements in throughout maximization for real-time schedul- ing. In STOC, 2000. [6] P. Bonsma, J. Schulz, and A. Wiese. A constant factor approximation algorithm for unsplit- table flow on paths. In FOCS, 2011. [7] G. Calinescu, A. Chakrabarti, H. J. Karloff, and Y. Rabani. Improved approximation algo- rithms for resource allocation. In IPCO, 2002. [8] V. Chakaravarthy, V. Pandit, Y. Sabharwal, and D. Seetharam. Varying bandwidth resource allocation problem with bag constraints. In IPDPS, 2010. [9] V. Chakaravarthy, S. Roy, and Y. Sabharwal. Distributed algorithms for scheduling on line and tree networks. In PODC, 2012. [10] A. Chakrabarti, C. Chekuri, A. Gupta, and A. Kumar. Approximation algorithms for the unsplittable flow problem. Algorithmica, 47(1):53 -- 78, 2007. [11] C. Chekuri, M. Mydlarz, and F. Shepherd. Multicommodity demand flow in a tree and packing integer programs. ACM Transactions on Algorithms, 3(3), 2007. [12] S. Kolliopoulos. Edge-disjoint paths and unsplittable flow. In T. Gonzalez, editor, Handbook of Approximation Algorithms and Metaheuristics. Chapman and Hall/CRC, 2007. [13] L. Lewin-Eytan, J. Naor, and A. Orda. Admission control in networks with advance reserva- tions. Algorithmica, 40(4):293 -- 304, 2004. [14] M. Luby. A simple parallel algorithm for the maximal independent set problem. SIAM Journal of Computing, 15(4):1036 -- 1053, 1986. [15] A. Panconesi and M. Sozio. Fast distributed scheduling via primal-dual. In SPAA, 2008. [16] A. Panconesi and M. Sozio. Fast primal-dual distributed algorithms for scheduling and match- ing problems. Distributed Computing, 22(4):269 -- 283, 2010. [17] A. Panconesi and A. Srinivasan. On the complexity of distributed network decomposition. Journal of Algorithms, 20(2):356 -- 374, 1996. [18] R. Tarjan. Decomposition by clique separators. Discrete Mathematics, 55(2):221 -- 232, 1985. [19] D. Williamson and D. Shmoys. The Design of Approximation Algorithms. Cambridge Univer- sity Press, 2011. 28 Begin // Initialize For all a ∈ A, set α(a) = 0; for all e ∈ E, set β(e) = 0. Initialize an empty stack. // First phase For i = 1 to r While Let U = {d ∈ D(Ti) : dual constraint of d is unsatisfied}. If U = ∅, exit the loop. Let d be the element of U appearing earliest in σ(Ti). Compute slackness: s = p(d) − α(ad) −Pe:d∼e β(e). Compute: δ(d) = s/(π(d) + 1). Raise the variables: α(ad) ← α(ad) + δ(d); for all e ∈ π(d), β(e) ← β(e) + δ(d). Push d into the stack. // Second Phase S = ∅. While(stack not empty) Pop the top element d of the stack If S ∪ {d} is an independent set, then add d to S. Output S. End Figure 8: Sequential Algorithm: Pseudocode A A Sequential Algorithm for Tree-networks Here, we present a sequential algorithm satisfying the interference property with critical set size ∆ = 2 and slackness parameter λ = 1. Let T = {T1, T2, . . . , Tr} be the given set of tree-networks. For 1 ≤ i ≤ r, construct a rooted tree Hi by arbitrarily selecting a node gi ∈ V and making gi as the root of Ti. Let H = {H1, H2, . . . , Hr} be the set of rooted trees constructed by the above process. Consider an input tree-network T ∈ T . Let H ∈ H be the rooted tree corresponding to T with g as the root. For a node x, define its depth (or height) to be the number of the nodes along the path from g to x; the root g itself is defined to have to depth 1. For a demand instance d ∈ D(T ), let µ(d) denote the node in H having the least depth among all the nodes appearing in path(d). We say that d is captured at the node µ(d); observe that µ(d) is uniquely determined. See Figure 6. A rooted-tree H has been constructed by picking the node 1 as the root. The demand instance d = h4, 13i will be captured at the node µ(d) = 2. With respect to H, a node y is said to be an ancestor of x, if y appears along the path from g to x; in this case, x is said to be a descendent of y. By convention, we do not consider x to be an ancestor or descendent of itself. Consider a demand instance d ∈ D(T ). We have that path(d) passes through the node µ(d). Let π(d) denote the set of edges of path(d) that are adjacent to µ(d). If µ(d) is one of the end-points of d then π(d) will have only one edge; otherwise, it will have two edges. See Figure 6. The set π(d) for the demand instance d = h4, 13i is given by π(d) = {h2, 4i, h2, 5i}. We can now make the following important observation. 29 Observation A.1 Consider any two overlapping demand instances d1, d2 ∈ D(T ). If d1 is captured at a node z and d2 is captured at an ancestor of z, then path(d2) will include one of the edges from π(d1). Furthermore, if d1 and d2 are captured at the same node z, then also path(d2) will include one of the edges from π(d1). Based on the above observation, our algorithm works as follows. In the two-phase framework, in each iteration, we need to determine an independent set I. We shall perform the above task by selecting a singleton demand instance d (forming a trivial independent set); we can afford to do this, since we are designing a sequential algorithm. Towards determining d, we define an ordering of the demand instances for each tree-network. Consider a tree-network T ∈ T and let H be the rooted tree corresponding to T with g as the root. Order the demand instances d ∈ D(T ) in the descending order of the depth of µ(d); ties are broken arbitrarily. Thus, demand instances captured at the bottom-most leaves of H will be placed first and those captured at the root will be placed last. Let σ(T ) denote the ordering obtained by the above process. The first phase works in r rounds, where the ith round will process the tree-network Ti. The round i works in multiple iterations, where each iteration is performed as described below. Let U be the demand instances belonging to Ti whose constraint is unsatisfied (recall that λ = 1). Among demand instances in U , pick the demand instance d appearing earliest in the ordering σ(Ti) and raise the demand d: namely, raise the dual variable α(ad) and the dual variables of the edges found in π(d). The ith round is completed when the dual constraints of all the demand instances of D(Ti) are satisfied. The pseudocode of the algorithm is presented in Figure 8. Observation A.1 shows that the algorithm satisfies the interference property. Furthermore, for any demand instance d, π(d) ≤ 2. Thus, we have a two-phase procedure with parameters ∆ = 2 and λ = 1. Lemma 3.1 shows that the algorithm is a 3-approximation algorithm. In the special case where there is only one tree-network, we do not need to raise the dual variables α(·) and the approximation ratio can be improved to 2. The resulting algorithm would essentially be the same as that of Lewin-Eytan et al. [13]. The round complexity of the algorithm can be as high as n, since only a single demand instance is raised in each iteration. 30
1702.03989
3
1702
2018-09-26T05:59:57
Selecting with History
[ "cs.DS" ]
We define a new selection problem, \emph{Selecting with History}, which extends the secretary problem to a setting with historical information. We propose a strategy for this problem and calculate its success probability in the limit of a large sequence.
cs.DS
cs
Selecting with History Tom Hess and Sivan Sabato Ben-Gurion University of the Negev Beer Sheva, Israel {tomhe,sabatos}@cs.bgu.ac.il Abstract We define a new selection problem, Selecting with History, which extends the secretary problem to a setting with historical information. We propose a strategy for this problem and calculate its success probability in the limit of a large sequence. In the classical secretary problem (Dynkin, 1963; Gilbert and Mosteller, 1966), n numbers appear at a random order. The algorithm is allowed to select a single number. If it decides to select a number, it must do so immediately, before observing the next numbers, and it cannot later change its decision. The goal of the algorithm is to select the maximal number with the highest probability, where the set of numbers is selected by an adversary and the order of their appearance is random. Gilbert and Mosteller (1966) show that, for any input size n, there is a number tn < n such that the optimal strategy is to observe the first tn numbers, set θ to be the maximal number among those, and then select the first number in the rest of the sequence which is larger than θ. They show that limn→∞ tn/n = 1/e and that the probability of success of the optimal strategy by also tends to 1/e when for n → ∞. In this note we define a new selection problem, Selecting with History (SwH), which extends the secre- tary problem to a setting with historical information. We propose a strategy for this problem, and calculate its success probability in the limit of a large sequence. Let N, K ≥ 2 be integers, such that K divides N . Let Z be a finite set of real numbers of size N . In this problem, the numbers in Z are ordered according to a uniformly random order. The algorithm observes the first N (1 − 1/K) numbers (the history). Then, the algorithm observes the last N/K numbers (the selection sequence) one by one, and should select the maximal number in the selection sequence with the highest probability. As in the secretary problem, the algorithm may only select a number immediately after observing it, and cannot regret this selection later. The secretary problem is thus equivalent to SwH with K = 1. When K ≥ 2, one can ignore the history and simply apply the optimal secretary problem strategy to the selection sequence. However, this does not exploit the information from the history. Instead, we propose the following strategy for SwH. This strategy is parametrized by β ∈ (0, 1). During the first ⌈βN/K⌉ numbers in the selection sequence, select the first number that exceeds the Kth-largest value in the history. If no such number was found in this part of the selection sequence, select from the rest of the sequence the first number that exceeds the maximal number observed so far in the selection sequence. 1 This strategy is inspired by a strategy proposed in Gilbert and Mosteller (1966) for a setting where a selection sequence is drawn i.i.d. from a known distribution. Whereas under a known distribution the first threshold can be set based on this knowledge, here we estimate it based on the history. As in the secretary problem, the probability of success of this strategy depends only on the rank order of the numbers, and not on their specific values. For K ≥ 2 that divides N , we denote by R(N, K) the probability that the proposed strategy succeeds in selecting the maximal number from the selection sequence, for any Z of size N . This probability depends on β, which we leave as an implicit parameter of R. For convenience, we also let R(N, 1) := Psp(N ), where Psp(n) denotes the success probability of the optimal secretary problem strategy on an input sequence of size n. Define Q(K) := lim L→∞ R(LK, K). By the definition of R, Q(1) = limn→∞ Psp(n) = 1/e. The following lemma gives the value of Q(K) for K > 1, as a function of β. Lemma 1. If K > 1, then Q(K) = β log(1/β)(1 − 1 K )K + ∞ Xj=1 (cid:18)j + K − 1 K − 1 (cid:19)(1 − 1 K )K 1 K j (cid:18) 1 − (1 − β)j j + βZ 1 β (1 − x)j−1 x dx(cid:19) . Proof. Let N = LK. We calculate R(N, K) based on its definition, and then take the limit L → ∞. Let Z = {z1, . . . , zN } be the set of input numbers, where z1 > z2 > . . . > zN . Denote by G the event that the SwH strategy selects the maximal number in the selection sequence, when the strategy is applied to a random ordering of Z. Let A1 be the set of numbers in the history, and let A2 = Z \A1 be the set of numbers in the selection sequence. Let A′ 2 ⊆ A2 be the set of first B := ⌈βL⌉ numbers in selection sequence. Let θ be the K'th largest number in A1, and let θ′ be the largest number in A′ 2. The strategy described above selects the first number observed from A′ 2 which is larger than θ if one exists. Otherwise, it selects the first 2 that is larger than θ′ (if one exists). Let J = {z ∈ A2 z > θ}. We have number observed from A2 \ A′ P[G J = j]P[J = j]. Note that the probabilities all depend (implicitly) on L. Let c > 1. P[G] = PL For any L ≥ cK 2, j=0 P[G] = cK 2 Xj=0 P[G J = j]P[J = j] + P[G J > cK 2]P[J > cK 2]. Define q(j) := limL→∞ P[G J = j], p(j) := limL→∞ P[J = j], and suppose that for some α : R → R, α(c) ≥ limL→∞ P[J > cK 2]. Assuming all these limits exist, we have cK 2 Xj=0 q(j)p(j) ≤ lim L→∞ P[G] ≤ cK 2 Xj=0 q(j)p(j) + α(c). If in addition limc→∞ α(c) = 0, then, taking c → ∞ on the inequality above, we get lim L→∞ P[G] = ∞ Xj=0 q(j)p(j). 2 (1) We now give expressions for q(j), p(j) and α(c). First, for p(j), we calculate P[J = j]. Define the random variable I which satisfies θ = zI . If I = i, this means that out of the numbers z1, . . . , zi−1, exactly K − 1 are in A1, and also zi ∈ A1. Therefore J = i − K. Since A1 = N − L and its content is allocated uniformly at random, we have P[J = i − K] = P[I = i] = (cid:18) i − 1 K − 1(cid:19) K−1 Yl=0 N − L − l N − l i−K−1 Yl=0 L − l N − K − l . Therefore P[J = j] = (cid:18)j + K − 1 K − 1 (cid:19) K−1 Yl=0 N − L − l N − l j−1 Yl=0 L − l N − K − l . Taking the limit for L → ∞ (recalling N = LK) we get p(j) ≡ lim L→∞ P[J = j] = (cid:18)j + K − 1 K − 1 (cid:19)(1 − 1 K )K 1 K j . (2) Second, to find q(j), we now calculate P[G J = j]. If j = 0, then all z ∈ A2 have z < θ, therefore no element will be selected from A′ 2. The probability of success is thus exactly as the probability of success of the secretary problem strategy with input size L and threshold B = ⌈βL⌉. Denote this probability PL. We have, following the analysis in Ferguson (1989) for the secretary problem, lim L→∞ PL = lim L→∞ ⌈βL⌉ L L Xi=B+1 1 i − 1 = lim L→∞ ⌈βL⌉ L L Xi=B+1 1 L (cid:18) L i − 1(cid:19) = βZ 1 β 1 x dx = β log(1/β). Hence , q(0) ≡ lim L→∞ P[G J = 0] = β log(1/β). (3) To find q(j) for j > 0, let R be the location in A2 of the maximal number z∗ = max A2. Note that if the strategy does not select anything before reaching location R, it will certainly select z∗ by the definition of the strategy. Distinguish two cases: 1. If R ≤ B, then z∗ is selected as long as all other j − 1 items that exceed θ are located after z∗. Hence, for r ≤ min(B, L − j + 1) P[G R = r, J = j] = j−2 Yl=0 L − r − l L − 1 − l j−2 (1 − = Yl=0 r − 1 L − 1 − l ). 2. If R > B, then z∗ is selected as long as all other j − 1 items that exceed θ are located after z∗, and also 2 that the maximal item in the first R − 1 items is in the first B items, so that z∗ is the first item in A2 \ A′ is larger than θ′. Hence, for B ≤ r ≤ L − j + 1, P[G R = r, J = j] = j−2 Yl=0 L − r − l L − 1 − l B r − 1 j−2 (1 − = Yl=0 r − 1 L − 1 − l ) B r − 1 . 3 3. Neither of the conditions above can hold if R > L − j + 1, since j − 1 numbers cannot be located after z∗ in this case. Hence ,P[G R > L − j + 1, J = j] = 0. Therefore We have and B r−1 = ⌈βL⌉ L P[G J = j] = = L−j−1 Xr=1 Xr=1 1 L L−j+1 P[R = r]P[G J = j, R = r] r − 1(cid:19)I[r>B] (cid:18) B j−2 (1 − · Yl=0 r − 1 L − 1 − l ). (1 − r − 1 L + 1 − j )j−1 ≤ j−2 (1 − Yl=0 r − 1 L − 1 − l ) ≤ (1 − r − 1 L − 1 )j−1, L r−1 . Therefore 1 L L−j+1 Xr=1 (cid:18) ⌈βL⌉ L L r − 1(cid:19)I[r>B] · (1 − r − 1 L + 1 − j )j−1 ≤ P[G J = j] Taking the limit L → ∞ on both sides and defining x = r/L, this gives, for j ≥ 1, ≤ 1 L L−j+1 Xr=1 (cid:18) ⌈βL⌉ L L r − 1(cid:19)I[r>B] · (1 − r − 1 L − 1 )j−1. q(j) ≡ lim L→∞ P[G J = j] = Z β (1 − x)j−1 dx + βZ 1 (1 − x)j−1 dx 0 1 − (1 − β)j = j β x (1 − x)j−1 x + βZ 1 β dx. (4) Lastly, we are left to show an upper bound α(c) ≥ limL→∞ P[J > cK 2] such that limc→∞ α(c) = 0. Recall that if θ = zi then J = i − K. For an integer t, denote Bt = {i i < t and zi ∈ A2}. Note that J ≥ t if and only if θ ≤ zt+K , which occurs if and only if Bt+K ≥ t. Therefore P[J ≥ t] = P[Bt+K ≥ t]. We now give an upper bound on P[Bt+K ≥ t], using a concentration bound for sampling without replacement from a population. Denote the ordered numbers in the selection sequence by I[ji < t]. Bt is a sum of L uniformly random draws without replacement from the sequence x1, . . . , xN , where xi := I[i < t]. We have P[ji < t] = (t − 1)/N . Hence ,E[Bt] = L(t − 1)/N = (t − 1)/K. Setting t = cK 2 for c > 1, we have t − (t + K − 1)/K ≥ t/4. Hence , (zj1, . . . , zjL). Then Bt = PL i=1 P[Bt+K ≥ t] = P[Bt+K − E[Bt+K ] ≥ t − (t + K − 1)/K] ≤ P[Bt+K − E[Bt+K ] ≥ t/4]. By Bernstein's inequality for sampling without replacement (Boucheron et al., 2013), setting ǫ = t/(4L) and σ2 = 1 i=1(xi − (t − 1)/N )2, N PN P[Bt+K ≥ t] ≤ P[ 1 L Bt+K − 1 L E[Bt+K] ≥ ǫ] ≤ exp(−Lǫ2/(2σ2 + (2/3)ǫ)). 4 i=1 x2 Noting that σ2 ≤ 1 i = (t − 1)/N ≤ cK/L, and ǫ = cK 2/(4L), we get that for some constant b, P[J ≥ cK 2] ≤ exp(−bcK 2). Setting the RHS to α(c), we get α(c) ≥ limL→∞ P[J > cK 2] and limc→∞ α(c) = 0, as required. Combining Eq. (1), Eq. (2), Eq. (3), Eq. (4) and the limit above, we get the equality in the statement of the lemma. N PN The value of Q(K) for a given β can be calculated numerically. We propose to select β := 0.63. This gives, e.g. Q(2) ≈ 0.47, Q(3) ≈ 0.51, Q(10) ≈ 0.55. Compare this to Q(1) = 1/e ≈ 0.37. In a previous version of this manuscript we proposed to use the strategy for SwH above to improve the competitive ratio of the submodular secretary problem under resource constraints. Unfortunately our analysis turned out to have an error which we have not been able to solve as of yet. References S. Boucheron, G. Lugosi, and P. Massart. Concentration inequalities: A nonasymptotic theory of indepen- dence. Oxford university press, 2013. E. B. Dynkin. The optimum choice of the instant for stopping a markov process. In Sov. Math. Dokl, volume 4(52), pages 627 -- 629, 1963. T. S. Ferguson. Who solved the secretary problem? Statistical science, pages 282 -- 289, 1989. J. P. Gilbert and F. Mosteller. Recognizing the maximum of a sequence. Journal of the American Statistical Association, 61(313):35 -- 73, 1966. 5
1207.7134
1
1207
2012-07-30T23:38:52
Improved approximation algorithms for low-density instances of the Minimum Entropy Set Cover Problem
[ "cs.DS", "cs.CC" ]
We study the approximability of instances of the minimum entropy set cover problem, parameterized by the average frequency of a random element in the covering sets. We analyze an algorithm combining a greedy approach with another one biased towards large sets. The algorithm is controled by the percentage of elements to which we apply the biased approach. The optimal parameter choice has a phase transition around average density $e$ and leads to improved approximation guarantees when average element frequency is less than $e$.
cs.DS
cs
Improved approximation algorithms for low-density instances of the Minimum Entropy Set Cover Problem. Cosmin Bonchiş∗, Gabriel Istrate† July 31, 2018 Abstract We study the approximability of instances of the minimum entropy set cover problem, parameterized by the average frequency of a ran- dom element in the covering sets. We analyze an algorithm combining a greedy approach with another one biased towards large sets. The al- gorithm is controled by the percentage of elements to which we apply the biased approach. The optimal parameter choice has a phase tran- sition around average density e and leads to improved approximation guarantees when average element frequency is less than e. 1 Introduction The minimum entropy set cover problem (MESC) [Halperin and Karp(2005)] arose from a maximum likelihood approach to haplotype inference in com- putational biology (see also [Mãndoiu and Paşaniuc(2005)]). Halperin and Karp showed that the problem is NP-complete and provided an additive up- per bound (equal to three) on the performance of the Greedy algorithm. This was later improved by Cardinal et al. [Cardinal et al.(2008a)], who showed a ∗Department of Computer Science, West University of Timişoara, Bd. V. Pârvan 4, Timişoara, RO-300223, Romania. †e-Austria Research Institute, Bd. V. Pârvan 4, cam. 045 B, Timişoara, RO-300223, Romania.email:[email protected]. corresponding author 1 tight additive upper bound of log2(e). Cardinal et al. [Cardinal et al.(2012)] also studied several versions of this problem, notably minimum entropy graph coloring [Cardinal et al.(2004)] and minimum en- tropy orientation [Cardinal et al.(2008b)], as well as a generalization to ar- bitrary objective functions [Cardinal and Dumeunier(2008)]. Minimum en- tropy graph coloring has found applications to problems related to functional compression in information theory [Cardinal et al.(2004)]. Minimum entropy set cover also lies behind a recently proposed family of measures of worst-case fairness in cost allocations in cooperative game theory [Bonchiş and Istrate(2012a)]. This was accomplished by first studying [Bonchiş and Istrate(2012b)] a minimum entropy version of the well-known submodular set cover problem [Wolsey(1982), Fujita(2000)]. Submodularity corresponds in the setting of cooperative game theory to concavity of the associated game, a property that guarantees many useful features of the game such as the non-emptiness of the core, membership of the Shapley value in the core, equivalence between group-strategyproofness and cross-monotonicity in mechanism design [Moulin(1999)] and so on. In this paper we further study MESC restricted to sparse instances, that is to instances of Set Cover parameterized by f (formally defined below), the average number of sets that cover a random element. In the spirit of the minimum entropy orientation problem (a version of MESC for which f = 2) we aim to provide better approximation guarantees than those valid for the Greedy algorithm. To accomplish this goal we study the performance of an approximation algorithm BiasedGreedy(δ) parameterized by a constant δ ∈ [0, 1]. Our main result can be summarized as follows: we give general upper bounds on the performance of our proposed algorithm. These bounds im- prove on the approximation guarantee of the greedy algorithm when average element frequency is less than the constant e. Furthermore, the best choice of control parameter δ depends on this frequency: it corresponds to the choice of a "biased" algorithm below critical value e, and to the greedy algorithm above it. The paper is structured as follows: in Section 2 we review basic notions and define the algorithm BiasedGreedy. The main result is presented and further discussed in Section 3. Its proof is given in Section 4. Next we present several applications of our main result to the Minimum Entropy Graph Coloring problem. 2 2 Preliminaries In this paper we need the definition of Shannon entropy and its associated divergence of two distributions P and Q: D(P k Q) = Xi pi log2 pi qi . We recall that D(P k Q) ≥ 0 for all P and Q. We are concerned with the following problem: Definition 1. [MINIMUM ENTROPY SET COVER (MESC)]: Let U = {u1, u2, . . . , un} be an n−element ground set, for some n ≥ 1, and let P = {P1, P2, . . . , Pm} be a family of subsets of U which cover U. A cover is a function g : U → [m] such that for every 1 ≤ i ≤ n, ui ∈ Pg(ui)("ui is covered by set Pg(ui)") The entropy of cover g is defined by: Ent(g) = − m Xi=1 g−1(i) U log2 g−1(i) U . (2.1) [OBJECTIVE:] Find a cover g of minimum entropy. Consider an instance (U, P) as above. Define f = Pm i=1 Pi U , the average frequency of a random element in U. In the algorithm below we divide the elements of the ground set into Light and Heavy elements, based on their frequency of occurrence. Parameter δ controls this division: the least frequent δn elements are deemed Light, while the rest are considered Heavy. Informally, the algorithm will first covers Light elements in a biased man- ner, simultaneously covering each such elemen by a set of maximum cardinal- ity containing it. Once this phase is complete all Light elements are deleted from all sets. The Heavy elements are handled in an incremental manner via a Greedy approach. The algorithm is formally presented in the following: 3 INPUT: An instance (U, P) of MESC P H := {P H i = Pi \ L for all i ∈ [k] 1 , P H 2 , . . . , P H k } where P H While (there exists e ∈ L) choose ie ∈ [k] to maximize Pie where Pie ∋ e; let g(e) = ie; L := L \ {e}; While (there exists e ∈ H) choose ie ∈ [k] to maximize P H ie where P H ie ∋ e; let g(e) = ie; erase e from all P H i ; H := H \ {e}; OUTPUT: the cover g. Figure 2.1: BiasedGreedy(δ) 3 Main result Our main result shows that the following upper bound on the performance of algorithm BiasedGreedy holds: Theorem 1. Algorithm BiasedGreedy(δ) produces a cover BG : U 7−→ [k] satisfying: Ent(BG) ≤ Ent(OP T ) − (1 − δ) log2(cid:18)1 − δ e (cid:19) + log2 f + o(1). (3.1) Corollary 1. The Biased algorithm, defined as the BiasedGreedy algorithm with δ = 1, produces a cover BI whose entropy satisfies Ent(BI) ≤ Ent(OP T ) + log2 f. (3.2) Observation 1. Optimizing over constant δ in inequality (3.1) reveals an interesting fact: the optimal choice of δ is always δ ∈ {0, 1}, i.e. the pure Biased or Greedy algorithms. More precisely 4 • choice δ = 1 (i.e. Biased) is optimal for f < e. • when f > e choice δ = 0 (i.e. Greedy) becomes best. Thus the optimal choice for δ has a phase transition from δ = 1 to δ = 0 around average density f = e. 4 Proof of the main result Proof. Let BG be the cover generated by the BiasedGreedy algorithm, and denote by p♭ the associated probability distribution. i = BG−1(i) If OP T is the optimal solution of the same instance, denote xi = OP T −1(i) n and yi = OP T −1(i) ∩ Heavy for all 1 ≤ i ≤ k. By choice of δ, Pk n − ⌈δn⌉ ≤ (1 − δ)n while Pk We rewrite the entropy of BG as follows: i=1 xi = n. i=1 yi = Ent(BG) = − k Xi=1 p♭ i log2 p♭ i = − k Xi=1 p♭ i log2(cid:18)Pi p♭ i Pi(cid:19) Denoting by # = (#i) the distribution #i = Pi Pk j=1 Pj we obtain: k + log2 Pi Xi=1 Xi=1 k p♭ i log2 Pi − k Xi=1 p♭ i log2 p♭ i #i Ent(BG) = − = − k Xi=1 Xi=1 k p♭ i log2 Pi − D(BG k #) + log2 Pi (4.1) Considering now just the first sum we obtain − k Xi=1 p♭ i log2 Pi = − = − k Xi=1 n Xv∈U 1 BG−1(i) n log2 Pi = − 1 n k Xi=1 Xv∈BG−1(i) log2 PBG(v) log2 PBG(v) = − 1 n Xv∈U log2 av where av is the size of the set assigned by BiasedGreedy to cover v. 5 Continuing, we infer − k Xi=1 p♭ i log2 Pi = − = − 1 n 1 n k Xi=1 Xv∈OP T −1(i) log2 av = − 1 n k Xi=1 log2 Yv∈OP T −1(i) av k Xi=1 log2 Yv∈OP T −1(i)∩Light av · Yv∈OP T −1(i)∩Heavy av From the definition of the algorithm we conclude the following: • for all v ∈ OP T −1(i) ∩ Light, av =PBG(v) = max j,Pj∋v Pj ≥ POP T (v) ≥ OP T −1(i) = xi • On the other hand, for v ∈ OP T −1(i) ∩ Heavy we analyze the Greedy phase of BiasedGreedy algorithm in a manner completely similar to the analysis of the Greedy algorithm in [Cardinal et al.(2008a)] and infer that Yv∈OP T −1(i)∩Heavy av ≥ yi! Therefore, − k Xi=1 k 1 n  Yv∈OP T −1(i)∩Light Xi=1 Xi=1 yi log2 xi − 1 n k xi  (yi!) = Xi=1 1 n k k Xi=1 log2 yi! (xi − yi) log2 xi − log2 yi! p♭ i log2 Pi ≤ − 1 n k Xi=1 k log2 = − = − 1 n Xi=1 Xi=1 xi n k log2(cid:0)xxi−yi i (cid:1) (yi!) = − log2 xi n − log2 n + 1 n Applying now the inequality y! ≥ (y/e)y we obtain: 6 − k Xi=1 p♭ i log2 Pi ≤ Ent(OP T ) − log2 n + yi log2 xi − 1 n 1 n k Xi=1 Xi=1 k 1 n 1 n k Xi=1 Xi=1 k log2 yyi i eyi yi log2 e = Ent(OP T ) − log2 n + ≤ Ent(OP T ) − log2 n − 1 n 1 n k Xi=1 Xi=1 k yi log2 xi − yi log2 yi + yi log2 yi xi + (1 − δ) log2 e (4.2) Considering now distributions xi = xi n , yi = yi Pj yj we obtain − 1 n k Xi=1 yi log2 yi xi = − 1 n k Xi=1 (n − ⌈δn⌉)yi log2 (n − ⌈δn⌉)yi nxi = − = − (n − ⌈δn⌉) n (n − ⌈δn⌉) n k Xi=1 yi log2 yi xi − (n − ⌈δn⌉) n log2 (n − ⌈δn⌉) n D(y k x) − (n − ⌈δn⌉) n log2 (n − ⌈δn⌉) n Putting all things together: Ent(BG) ≤Ent(OP T ) − (1 − δ) log2(1 − δ) + (1 − δ) log2 e + log2 f + o(1). and the proof is complete. 5 Application to minimum entropy graph col- oring Just as it is the case with the Greedy algorithm [Cardinal et al.(2012)], our result has implications for the minimum entropy coloring problem. This problem can be recast as an implicit set cover problem [Karp(2011)], where the sets are the maximal independent sets in G. Given the intractability of the maximum independent set problem, we can only efficiently implement the Biased algorithm on special classes of graphs, where this problem is easier. On the other hand algorithm Biased has some nice properties, similar to those discussed in [Cardinal et al.(2012)]) for the Greedy algorithm: 7 1. it can be implemented in polynomial time on perfect graphs. Indeed, the largest independent set containing a given vertex can easily be computed in a perfect graph. 2. it allows the use of η-approximately optimal independent sets (for some constant η ≥ 1) instead of optimal ones at the expense of introducing an extra factor of log2(η) in the upper bound of equation (3.1). This follows easily by simply redoing the proof of the main Theorem in this setting. We can apply this observation to get a slight improvement of Theorem 8 from [Cardinal et al.(2012)] when f < e: Corollary 2. Algorithm Biased produces a coloring of a graph G = (V, E) with maximum degree ∆ satisfying Ent(Biased) ≤ Ent(OP T ) + log2(∆ + 2) + log2(f /3). The proof of the corollary directly parallels that of Theorem 8 from [Cardinal et al.(2012)]. Applying Theorem 1 to graph coloring problems is rather inconvenient as parameter f involves maximal independent sets and is not easy to compute. The situation is slightly better for graphs with independence number α(G) ≤ 3. In this case maximal independent sets correspond either to triangles, edges, or isolated vertices in the complement graph G. Parameter f also has an easier interpretation: Let I be the number of isolated vertices in G. Let T be the number of distinct triangles in G. Finally, let M be the number of edges that are not contained in any triangle. Then f = I + 2M + 3T n Furthermore, in this case the algorithm Biased has a very natural inter- pretation: we create a tentative color cW for any maximal independent set (triangle, edge or isolated vertex) W and add color cW to a list coloring of all vertices in W . Then for each vertex we select a random color from its list. The algorithm Biased can be improved in practice by employing a number of heuristics such as: • Attempt to color all elements of a largest independent set with the same color. 8 • Collapse two colors into one if legal. These heuristics can only decrease the entropy of the resulting coloring. There are instances (e.g. edge orientations of a cycle from [Cardinal et al.(2008b)]) where Biased outperforms Greedy. But even when it doesn't, our analysis may provide better theoretical guarantees than those available for Greedy. Example 1. Consider graph G = (V, E) from Figure 5.1 (a) (its complement is displayed in Figure 5.1 (b)). 1 8 a b 2 7 3 6 4 5 1 8 2 7 3 6 4 5 Figure 5.1: (a) graph G (b) its complement G a a b b c c b c b c a a a d Figure 5.2: Two colorings C1 and C2 of graph G. For convenience the com- plement graph G is pictured, rather than G. C1 is an optimal solution. Graph G provides an easy instance where Greedy and Biased (may) pro- duce different colorings. Indeed, node 4 is colored by Biased with a color cor- responding to a triangle, whereas 5 takes a color corresponding to an edge, so 9 nodes 4 and 5 must assume different colors in a Biased coloring, whereas they may have the same color in a Greedy coloring. With the optimizations de- scribed above both Greedy and Biased produce one of the two colorings C1, C2 from Figure 1, with color classes of cardinalities (3; 3; 2; 0) and (3; 2; 2; 1), respectively. The first one corresponds to the optimal solution. On the other hand for this graph the average element frequency f = 3×3+1×2 8 < e, so the upper bound on the entropy of coloring C2 given by Corollary 3.2 is tighter than the one provided by the Greedy algorithm in [Cardinal et al.(2012)]. = 11 8 Acknowledgments Both authors contributed in a substantially equal manner to this work: G.I. suggested the problem, performed research and wrote the paper. C.B. per- formed research and wrote the paper. The first author has been supported by a project on Postdoctoral national programs, contract CNCSIS PD_575/2010. The corresponding author has been supported by CNCS IDEI Grant PN- II-ID-PCE-2011-3-0981 "Structure and computational difficulty in combina- torial optimization: an interdisciplinary approach". References [Halperin and Karp(2005)] E. Halperin, R. Karp, The minimum entropy set cover problem, Theoretical Computer Science 348 (2005) 340 -- 350. [Mãndoiu and Paşaniuc(2005)] I. Mãndoiu, B. Paşaniuc, Haplotype infer- ence by entropy minimization, in: 9th Annual International Conference on Research in Computational Molecular Biology (RECOMB) (2005), pp. 221 -- 222. [Cardinal et al.(2008a)] J. Cardinal, S. Fiorini, G. Joraet, Tight results on minimum entropy set cover, Algorithmica 51 (2008) 49 -- 60. [Cardinal et al.(2012)] J. Cardinal, S. Fiorini, G. Joret, Minimum entropy combinatorial optimization problems, Theory of Computing Systems 51 (2012) 4 -- 21. 10 [Cardinal et al.(2008b)] J. Cardinal, S. Fiorini, G. Joret, Minimum entropy orientations, Operations Research Letters 36 (2008) 680 -- 683. [Cardinal and Dumeunier(2008)] J. Cardinal, C. Dumeunier, Set Cover- ing Problems with General Objective Functions, Technical Report 0802.2184, arXiv.org, 2008. [Cardinal et al.(2004)] J. Cardinal, S. Fiorini, G. Van Assche, On minimum in: Proceedings of ISIT'04, the International entropy graph colorings, Symposium on Information Theory (2004), p. 43. [Bonchiş and Istrate(2012a)] C. Bonchiş, G. Istrate, A parametric worst-case approach to fairness in TU-Cooperative Games, 2012a. Manuscript. [Bonchiş and Istrate(2012b)] C. Bonchiş, G. Istrate, Minimum entropy sub- modular set cover and fairness in cooperative games, 2012b. Manuscript. [Wolsey(1982)] L. Wolsey, An analysis of the greedy algorithm for the sub- modular set covering problem, Combinatorica 2 (1982) 385 -- 393. [Fujita(2000)] T. Fujita, Approximation algorithms for submodular set cover with applications, IEICE Transactions on Information and Systems E83- D (2000) 480 -- 487. [Moulin(1999)] H. Moulin, Incremental cost sharing: Characterization by coalition strategy-proofness, Social Choice and Welfare 16 (1999) 279 -- 320. [Karp(2011)] R. M. Karp, Heuristic algorithms in computational molecular biology, Journal of Computer and System Sciences 77 (2011) 122 -- 128. 11
1302.5401
1
1302
2013-02-21T20:19:31
Sparse Fault-Tolerant BFS Trees
[ "cs.DS" ]
This paper addresses the problem of designing a sparse {\em fault-tolerant} BFS tree, or {\em FT-BFS tree} for short, namely, a sparse subgraph $T$ of the given network $G$ such that subsequent to the failure of a single edge or vertex, the surviving part $T'$ of $T$ still contains a BFS spanning tree for (the surviving part of) $G$. Our main results are as follows. We present an algorithm that for every $n$-vertex graph $G$ and source node $s$ constructs a (single edge failure) FT-BFS tree rooted at $s$ with $O(n \cdot \min\{\Depth(s), \sqrt{n}\})$ edges, where $\Depth(s)$ is the depth of the BFS tree rooted at $s$. This result is complemented by a matching lower bound, showing that there exist $n$-vertex graphs with a source node $s$ for which any edge (or vertex) FT-BFS tree rooted at $s$ has $\Omega(n^{3/2})$ edges. We then consider {\em fault-tolerant multi-source BFS trees}, or {\em FT-MBFS trees} for short, aiming to provide (following a failure) a BFS tree rooted at each source $s\in S$ for some subset of sources $S\subseteq V$. Again, tight bounds are provided, showing that there exists a poly-time algorithm that for every $n$-vertex graph and source set $S \subseteq V$ of size $\sigma$ constructs a (single failure) FT-MBFS tree $T^*(S)$ from each source $s_i \in S$, with $O(\sqrt{\sigma} \cdot n^{3/2})$ edges, and on the other hand there exist $n$-vertex graphs with source sets $S \subseteq V$ of cardinality $\sigma$, on which any FT-MBFS tree from $S$ has $\Omega(\sqrt{\sigma}\cdot n^{3/2})$ edges. Finally, we propose an $O(\log n)$ approximation algorithm for constructing FT-BFS and FT-MBFS structures. The latter is complemented by a hardness result stating that there exists no $\Omega(\log n)$ approximation algorithm for these problems under standard complexity assumptions.
cs.DS
cs
Sparse Fault-Tolerant BFS Trees Merav Parter ∗† David Peleg ∗ October 18, 2018 Abstract A fault-tolerant structure for a network is required to continue functioning fol- lowing the failure of some of the network's edges or vertices. This paper considers breadth-first search (BFS) spanning trees, and addresses the problem of designing a sparse fault-tolerant BFS tree, or FT-BFS tree for short, namely, a sparse sub- graph T of the given network G such that subsequent to the failure of a single edge or vertex, the surviving part T (cid:48) of T still contains a BFS spanning tree for (the surviving part of) G. For a source node s, a target node t and an edge e ∈ G, the shortest s − t path Ps,t,e that does not go through e is known as a replacement path. Thus, our FT-BFS tree contains the collection of all replacement paths Ps,t,e for every t ∈ V (G) and every failed edge e ∈ E(G). Our main results are as follows. We present an algorithm that for every n-vertex graph G and source node s constructs a (single edge failure) FT-BFS tree rooted at s with O(n · min{Depth(s), n}) edges, where Depth(s) is the depth of the BFS tree rooted at s. This result is complemented by a matching lower bound, showing that there exist n-vertex graphs with a source node s for which any edge (or vertex) FT-BFS tree rooted at s has Ω(n3/2) edges. √ We then consider fault-tolerant multi-source BFS trees, or FT-MBFS trees for short, aiming to provide (following a failure) a BFS tree rooted at each source s ∈ S for some subset of sources S ⊆ V . Again, tight bounds are provided, showing that there exists a poly-time algorithm that for every n-vertex graph and source set S ⊆ V of size σ constructs a (single failure) FT-MBFS tree T ∗(S) from each source √ si ∈ S, with O( σ · n3/2) edges, and on the other hand there exist n-vertex graphs with source sets S ⊆ V of cardinality σ, on which any FT-MBFS tree from S has Ω( σ · n3/2) edges. √ ∗The Weizmann Institute of Science, Rehovot, Israel. Email: {merav.parter,david.peleg}@ weizmann.ac.il. Supported in part by the Israel Science Foundation (grant 894/09), the United States- Israel Binational Science Foundation (grant 2008348), the Israel Ministry of Science and Technology (infrastructures grant), and the Citi Foundation. †Recipient of the Google Europe Fellowship in distributed computing; research supported in part by this Google Fellowship. 1 Finally, we propose an O(log n) approximation algorithm for constructing FT-BFS and FT-MBFS structures. The latter is complemented by a hardness result stating that there exists no Ω(log n) approximation algorithm for these problems under standard complexity assumptions. In comparison with the randomized FT-BFS con- √ struction implicit in [14], our algorithm is deterministic and may improve the num- n for some instances. All our algorithms can be ber of edges by a factor of up to extended to deal with one vertex failure as well, with the same performance. 1 Introduction Background and motivation Modern day communication networks support a variety of logical structures and services, and depend on their undisrupted operation. As the vertices and edges of the network may occasionally fail or malfunction, it is desirable to make those structures robust against failures. Indeed, the problem of designing fault- tolerant constructions for various network structures and services has received considerable attention over the years. Fault-resilience can be introduced into the network in several different ways. This paper focuses on a notion of fault-tolerance whereby the structure at hand is augmented or "reinforced" (by adding to it various components) so that subsequent to the failure of some of the network's vertices or edges, the surviving part of the structure is still operational. As this reinforcement carries certain costs, it is desirable to minimize the number of added components. To illustrate this type of fault tolerance, let us consider the structure of graph k- spanners (cf. [17, 19, 20]). A graph spanner H can be thought of as a skeleton structure that generalizes the concept of spanning trees and allows us to faithfully represent the underlying network using few edges, in the sense that for any two vertices of the network, the distance in the spanner is stretched by only a small factor. More formally, consider a weighted graph G and let k ≥ 1 be an integer. Let dist(u, v, G) denote the (weighted) distance between u and v in G. Then a k-spanner H satisfies that dist(u, v, H) ≤ k · dist(u, v, G) for every u, v ∈ V . Towards introducing fault tolerance, we say that a subgraph H is an f -edge fault- tolerant k-spanner of G if dist(u, v, H \ F ) ≤ k · dist(u, v, G \ F ) for any set F ⊆ E of size at most f , and any pair of vertices u, v ∈ V . A similar definition applies to f -vertex fault-tolerant k-spanners. Sparse fault-tolerant spanner constructions were presented in [6, 11]. This paper considers breadth-first search (BFS) spanning trees, and addresses the problem of designing fault-tolerant BFS trees, or FT-BFS trees for short. By this we mean a subgraph T of the given network G, such that subsequent to the failure of some of the 2 vertices or edges, the surviving part T (cid:48) of T still contains a BFS spanning tree for the surviving part of G. We also consider a generalized structure referred to as a fault-tolerant multi-source BFS tree, or FT-MBFS tree for short, aiming to provide a BFS tree rooted at each source s ∈ S for some subset of sources S ⊆ V . The notion of FT-BFS trees is closely related to the problem of constructing replacement paths and in particular to its single source variant, the single-source replacement paths problem, studied in [14]. That problem requires to compute the collection Ps of all s − t replacement paths Ps,t,e for every t ∈ V and every failed edge e that appears on the s − t shortest-path in G. The vast literature on replacement paths (cf. [4, 14, 23, 25, 28]) focuses on time-efficient computation of the these paths as well as their efficient maintenance in data structures (a.k.a distance oracles). In contrast, the main concern in the current paper is with optimizing the size of the resulting fault tolerant structure that contains the collection Ps of all replacement paths given a source node s. A typical motivation for such a setting is where the graph edges represent the channels of a communication network, and the system designer would like to purchase or lease a minimal collection of channels (i.e., a subgraph G(cid:48) ⊆ G) that maintains its functionality as a "BFS tree" with respect to the source s upon any single edge or vertex failure in G. In such a context, the cost of computation at the preprocessing stage may often be negligible compared to the purchasing/leasing cost of the resulting structure. Hence, our key cost measure in this paper is the size of the fault tolerant structure, and our main goal is to achieve sparse (or compact) structures. Most previous work on sparse / compact fault-tolerant structures and services con- cerned structures that are distance-preserving (i.e., dealing with distances, shortest paths or shortest routes), global (i.e., centered on "all-pairs" variants), and approximate (i.e., settling for near optimal distances), such as spanners, distance oracles and compact rout- ing schemes. The problem considered here, namely, the construction of FT-BFS trees, still concerns a distance preserving structure. However, it deviates from tradition with respect to the two other features, namely, it concerns a "single source" variant, and it insists on exact shortest paths. Hence our problem is on the one hand easier, yet on the other hand harder, than previously studied ones. Noting that in previous studies, the "cost" of adding fault-tolerance (in the relevant complexity measure) was often low (e.g., merely polylogarithmic in the graph size n), one might be tempted to conjecture that a similar phenomenon may reveal itself in our problem as well. Perhaps surprisingly, it turns out that our insistence on exact distances plays a dominant role and makes the problem significantly harder, outweighing our willingness to settle for a "single source" solution. Contributions We obtain the following results. In Sec. 2, we define the Minimum FT-BFS and Minimum FT-MBFS problems, aiming at finding the minimum such structures 3 tolerant against a single edge or vertex fault. Section 3 presents lower bound constructions for these problems. For the single source case, in Subsec. 3.1, we present a lower bound stating that for every n there exists an n-vertex graph and a source node s ⊆ V for which any FT-MBFS tree from s requires Ω(n3/2) edges. In Subsec. 3.2, we then show that there exist n-vertex graphs with source sets S ⊆ V of size σ, on which any FT-MBFS tree from the source set S has Ω( σ · n3/2) edges. √ These results are complemented by matching upper bounds. In Subsec. 4.1, we √ present a simple algorithm that for every n-vertex graph G and source node s, constructs a (single edge failure) FT-BFS tree rooted at s with O(n · min{Depth(s), n}) edges. A similar algorithm yields an FT-BFS tree tolerant to one vertex failure, with the same size bound. In addition, for the multi source case, in Subsec. 4.2, we show that there exists a polynomial time algorithm that for every n-vertex graph and source set S ⊆ V of size S = σ constructs a (single failure) FT-MBFS tree T ∗(S) from each source si ∈ S, with √ O( σ · n3/2) edges. In Sec. 5, we show that the minimum FT-BFS problem is NP-hard and moreover, cannot be approximated (under standard complexity assumptions) to within a factor of Ω(log n), where n is the number of vertices of the input graph G. Note that while the algorithms of Sec. 4 match the worst-case lower bounds, they might still be far from optimal for certain instances, as illustrated in Sec. 6. Consequently, in Sec. 6, we complete the upper bound analysis by presenting an O(log n) approximation algorithm for the Minimum FT-MBFS problem. This approximation algorithm is superior in instances where the graph enjoys a sparse FT-MBFS tree, hence paying O(n3/2) edges (as does the algorithm of Sec. 4) is wasteful. In light of the hardness result for these problems (of Sec. 5), the approximability result is tight (up to constants). Related work To the best of our knowledge, this paper is the first to study the spar- sity of fault-tolerant BFS structures for graphs. The question of whether it is possible to construct a sparse fault tolerant spanner for an arbitrary undirected weighted graph, raised in [9], was answered in the affirmative in [6], presenting algorithms for construct- ing an f -vertex fault tolerant (2k − 1)-spanner of size O(f 2kf +1 · n1+1/k log1−1/k n) and an f -edge fault tolerant 2k − 1 spanner of size O(f · n1+1/k) for a graph of size n. A randomized construction attaining an improved tradeoff for vertex fault-tolerant span- ners was shortly afterwards presented in [11], yielding (with high probability) for every graph G = (V, E), odd integer s and integer f , an f -vertex fault-tolerant s-spanner edges. This should be contrasted with the best stretch-size with O tradeoff currently known for non-fault-tolerant spanners [24], namely, 2k − 1 stretch with O(n1+1/k) edges. s+1 n1+ 2 (cid:17) (cid:16) f 2− 2 s+1 log n An efficient algorithm that given a set V of n points in d-dimensional Euclidean space constructs an f -vertex fault tolerant geometric (1 + )-spanner for V , namely, a sparse 4 graph H satisfying that dist(u, v, H \ F ) ≤ (1 + )dist(u, v, G) for any set F ⊆ V of size f and any pair of points u, v ∈ V \ F , was presented in [15]. A fault tolerant geometric spanner of improved size was later presented in [16]; finally, a fault tolerant geometric spanner of optimal maximum degree and total weight was presented in [9]. The distinction between the stronger type of fault-tolerance obtained for geometric graphs (termed rigid fault-tolerance) and the more flexible type required for handling general graphs (termed competitive fault-tolerance) is elaborated upon in [18]. A related network service is the distance oracle [3, 22, 25], which is a succinct data structure capable of supporting efficient responses to distance queries on a weighted graph G. A distance query (s, t) requires finding, for a given pair of vertices s and t in V , the distance (namely, the length of the shortest path) between u and v in G. The query protocol of an oracle S correctly answers distance queries on G. In a fault tolerant distance oracle, the query may include also a set F of failed edges or vertices (or both), and the oracle S must return, in response to a query (s, t, F ), the distance between s and t in G(cid:48) = G \ F . Such a structure is sometimes called an F -sensitivity distance oracle. The focus is on both fast preprocessing time, fast query time and low space. It has been shown in [10] that given a directed weighted graph G of size n, it is possible to construct in time O(mn2) a 1-sensitivity fault tolerant distance oracle of size O(n2 log n) capable of answering distance queries in O(1) time in the presence of a single failed edge or vertex. The preprocessing time was recently improved to O(mn), with unchanged size and query time [4]. A 2-sensitivity fault tolerant distance oracle of size O(n2 log3 n), capable of answering 2-sensitivity queries in O(log n) time, was presented in [12]. Recently, distance sensitivity oracles have been considered for weighted and directed graphs in the single source setting [14]. Specifically, Grandoni and Williams considered the problem of single-source replacement paths where one aims to compute the collection of all replacement paths for a given source node s, and proposed an efficient random- ized algorithm that does so in (cid:101)O(AP SP (n, M )) where AP SP (n, M ) is the time required to compute all-pairs-shortest-paths in a weighted graph with integer weights [−M, M ]. Interestingly, although their algorithm does not aim explicitly at minimizing the total number of edges used by the resulting collection of replacement paths, one can show that the resulting construction yields a rather sparse path collection, with at most O(n3/2 log n) edges (although it may also be far from optimal in some instances). Label-based fault-tolerant distance oracles for graphs of bounded clique-width are presented in [8]. The structure is composed of a label L(v) assigned to each vertex v, and handles queries of the form (L(s), L(t), F ) for a set of failures F . For an n-vertex graph of tree-width or clique-width k, the constructed labels are of size O(k2 log2 n). A relaxed variant of distance oracles, in which distance queries are answered by ap- proximate distance estimates instead of exact ones, was introduced in [25], where it was shown how to construct, for a given weighted undirected n-vertex graph G, an approxi- 5 mate distance oracle of size O(n1+1/k) capable of answering distance queries in O(k) time, where the stretch (multiplicative approximation factor) of the returned distances is at most 2k − 1. An f -sensitivity approximate distance oracle S was presented in [5]. For an integer parameter k ≥ 1, the size of S is O(kn1+ 8(f +1) k+2(f +1) log (nW )), where W is the weight of the heaviest edge in G, the stretch of the returned distance is 2k − 1, and the query time is O(F · log2 n · log log n · log log d), where d is the distance between s and t in G \ F . A fault-tolerant label-based (1+)-approximate distance oracle for the family of graphs with doubling dimension bounded by α is presented in [2]. For an n-vertex graph G(V, E) in this family, and for desired precision parameter  > 0, the distance oracle constructs and stores an O(log n/2α)-bit label at each vertex. Given the labels of two end-vertices s and t and of collections FV and FE of failed (or "forbidden") vertices and edges, the oracle computes, in time polynomial in the length of the labels, an estimate for the distance between s and t in the surviving graph G(V \ FV , E \ FE), which approximates the true distance by a factor of 1 + . Our final example concerns fault tolerant routing schemes. A fault-tolerant routing protocol is a distributed algorithm that, for any set of failed edges F , enables any source vertex s to route a message to any destination vertex d along a shortest or near-shortest path in the surviving network G \ F in an efficient manner (and without knowing F in advance). In addition to route efficiency, it is often desirable to optimize also the amount of memory stored in the routing tables of the vertices, possibly at the cost of lower route efficiency, giving rise to the problem of designing compact routing schemes (cf. [1, 7, 17, 21, 24]). Label-based fault-tolerant routing schemes for graphs of bounded clique-width are presented in [8]. To route from s to t, the source needs to specify the labels L(s) and L(t) and the set of failures F , and the scheme efficiently calculates the shortest path between s and t that avoids F . For an n-vertex graph of tree-width or clique-width k, the constructed labels are of size O(k2 log2 n). Fault-tolerant compact routing schemes are considered in [5], for up to two edge fail- ures. Given a message M destined to t at a source vertex s, in the presence of a failed edge set F of size F ≤ 2 (unknown to s), the scheme presented therein routes M from s to t in a distributed manner, over a path of length at most O(k) times the length of the optimal path (avoiding F ). The total amount of information stored in vertices of G on average is bounded by O(kn1+1/k). This should be compared with the best memory-stretch tradeoff currently known for non-fault-tolerant compact routing [24], namely, 2k − 1 stretch with O(n1+1/k) memory per vertex. A compact routing scheme capable of handling multiple edge failures is presented 6 in [7]. The scheme routes messages (provided their source s and destination t are still connected in the surviving graph G \ F ) over a path whose length is proportional to the distance between s and t in G\ F , to F3 and to some poly-log factor. The routing table required at a node v is of size proportional to v's degree and some poly-log factor. A routing scheme with stretch 1 +  for graphs of bounded doubling dimension is also presented in [2]. The scheme can be generalized also to the family of weighted graphs of bounded doubling dimension and bounded degree. In this case, the label size will also depend linearly on the maximum vertex degree ∆, and this is shown to be necessary. 2 Preliminaries paths (or BFS) tree rooted at s. For a source node set S ⊆ V , let T0(S) =(cid:83) Notation Given a graph G = (V, E) and a source node s, let T0(s) ⊆ G be a shortest s∈S T0(s) be a union of the single source BFS trees. Let π(s, v, T ) be the s − v shortest-path in tree T , when the tree T = T0(s), we may omit it and simply write π(s, v). Let Γ(v, G) be the set of v neighbors in G. Let E(v, G) = {(u, v) ∈ E(G)} be the set of edges incident to v in the graph G and let deg(v, G) = E(v, G) denote the degree of node v in G. When the graph G is clear from the context, we may omit it and simply write deg(v). Let depth(s, v) = dist(s, v, G) denote the depth of v in the BFS tree T0(s). When the source node s is clear from the context, we may omit it and simply write depth(v). Let Depth(s) = maxu∈V {depth(s, u)} be the depth of T0(s). For a subgraph G(cid:48) = (V (cid:48), E(cid:48)) ⊆ G (where V (cid:48) ⊆ V and E(cid:48) ⊆ E) and a pair of nodes u, v ∈ V , let dist(u, v, G(cid:48)) denote the shortest-path distance in edges between u and v in G(cid:48). For a path P = [v1, . . . , vk], let LastE(P ) be the last edge of path P . Let P denote the length of the path and P [vi, vj] be the subpath of P from vi to vj. For paths P1 and P2, P1 ◦ P2 denote the path obtained by concatenating P2 to P1. Assuming an edge weight function W : E(G) → R+, let SP (s, vi, G, W ) be the set of s − vi shortest-paths in G according to the edge weights of W . Throughout, the edges of these paths are considered to be directed away from the source node s. Given an s − v path P and an edge e = (x, y) ∈ P , let dist(s, e, P ) be the distance (in edges) between s and e on P . In addition, for an edge e = (x, y) ∈ T0(s), define dist(s, e) = i if depth(x) = i − 1 and depth(y) = i. Definition 2.1 A graph T ∗ is an edge (resp., vertex) FT-BFS tree for G with respect to a source node s ∈ V , iff for every edge f ∈ E(G) (resp., vertex f ∈ V ) and for every v ∈ V , dist(s, v, T ∗ \ {f}) = dist(s, v, G \ {f}). A graph T ∗ is an edge (resp., vertex) FT-MBFS tree for G with respect to source set S ⊆ V , iff for every edge f ∈ E(G) (resp., vertex f ∈ V ) and for every s ∈ S and v ∈ V , dist(s, v, T ∗ \ {f}) = dist(s, v, G \ {f}). 7 To avoid cumbersome notation, we refer to edge FT-BFS (resp., edge FT-MBFS) trees simply by FT-BFS (resp., FT-MBFS) trees. Throughout, we focus on edge fault, yet the entire analysis extends trivially to the case of vertex fault as well. The Minimum FT-BFS problem Denote the set of solutions for the instance (G, s) by T (s, G) = {(cid:98)T ⊆ G (cid:98)T is an FT-BFS tree w.r.t. s}. Let Cost∗(s, G) = min{E((cid:98)T ) T (s, G)} be the minimum number of edges in any FT-BFS subgraph of G. These definitions naturally extend to the multi-source case where we are given a source set S ⊆ V of size σ. Then T (S, G) = {(cid:98)T ⊆ G (cid:98)T is a FT-MBFS with respect to S} (cid:98)T ∈ and ∗(S, G) = min{E((cid:98)T ) (cid:98)T ∈ T (S, G)}. Cost In the Minimum FT-BFS problem we are given a graph G and a source node s and the goal is to compute an FT-BFS (cid:98)T ∈ T (s, G) of minimum size, i.e., such that E((cid:98)T ) = source node set S and the goal is to compute an FT-MBFS (cid:98)T ∈ T (S, G) of minimum size i.e., such that E((cid:98)T ) = Cost∗(S, G). Cost∗(s, G). Similarly, in the Minimum FT-MBFS problem we are given a graph G and a 3 Lower Bounds In this section we establish lower bounds on the size of the FT-BFS and FT-MBFS structures. In Subsec. 3.1 we consider the single source case and in Subsec. 3.2 we consider the case of multiple sources. 3.1 Single Source We begin with a lower bound for the case of a single source. Theorem 3.1 There exists an n-vertex graph G(V, E) and a source node s ∈ V such that any FT-BFS tree rooted at s has Ω(n3/2) edges, i.e., Cost∗(s, G) = Ω(n3/2). Proof: Let us first describe the structure of the graph G = (V, E). Set d = (cid:98)√ n/2(cid:99). The graph consists of four main components. The first is a path π = [s = v1, . . . , vd+1 = v∗] of length d. The second component consists of a node set Z = {z1, . . . , zd} and a collec- tion of d disjoint paths of deceasing length, P1, . . . , Pd, where Pj = [vj = pj 1, . . . , zj = pj tj ] connects vj with zj and its length is tj = Pj = 6 + 2(d − j), for every j ∈ 1,··· , d. j=1 V (Pj), is of size Q = d2 + 7d. The Altogether, the set of nodes in these paths, Q =(cid:83)d 8 to Z. Overall, V = X ∪ Q and E = E ∪ E(π) ∪(cid:83)d third component is a set of nodes X of size n − (d2 + 7d), all connected to the terminal node v∗. The last component is a complete bipartite graph B = (X, Z, E) connecting X j=1 E(Pj). Note that n/4 ≤ Q ≤ n/2 for sufficiently large n. Consequently, X = n − Q ≥ n/2, and E = Q · X ≥ n3/2/4. Figure 1: Lower bound construction for FT-BFS The original BFS tree consists of the non- dashed edges. The dashed edges are the ones necessary to make it an FT-BFS tree. For example, the bold dashed edge (xj, zi) is required upon failure of the edge ei. A BFS tree T0 rooted at s for this G (illustrated by the solid edges in Fig. 1) is given by E(T0) = {(xi, zi) i ∈ {1, . . . , d}} ∪ d(cid:91) E(Pj) \ {(pj (cid:96)j (cid:96)j−1)}, , pj j=1 where (cid:96)j = tj − (d − j) for every j ∈ {1, . . . , d}. We now show that every FT-BFS tree T (cid:48) ∈ T (s, G) must contain all the edges of B, namely, the edges ei,j = (xi, zj) for every i ∈ {1, . . . ,X} and j ∈ {1, . . . , d} (the dashed edges in Figure 1). Assume, towards contradiction, that there exists a T (cid:48) ∈ T (s, G) that does not contain ei,j (the bold dashed edge (xi, zj) in the figure). (the bold dashed edge (xi, zj) in Figure 1). Note that upon the failure of the edge ej = (vj, vj+1) ∈ π, the unique s − xi shortest-path connecting s and xi in G \ {ej} is P (cid:48) j = π[v1, vj] ◦ Pj ◦ [zj, xi], and all other alternatives are strictly longer. Since ei,j /∈ T (cid:48), also P (cid:48) (cid:42) T (cid:48), and therefore dist(s, xi, G \ {ej}) < dist(s, xi, T (cid:48) \ {ej}), in contradiction to the fact that T (cid:48) is an FT-BFS tree. It follows that every FT-BFS tree T (cid:48) must contain at least E = Ω(n3/2) edges. The theorem follows. j 9 X Z xi zj 𝑑=𝑂(𝑛) ej vj Pj v* B S z1 vd zd 3.2 Multiple Sources We next consider an intermediate setting where it is necessary to construct a fault-tolerant subgraph FT-MBFS containing several FT-BFS trees in parallel, one for each source s ∈ S, for some S ⊆ V . We establish the following. Theorem 3.2 There exists an n-vertex graph G(V, E) and a source set S ⊆ V of cardi- √ σ · n3/2) edges, i.e., nality σ, such that any FT-MBFS tree from the source set S has Ω( Cost∗(S, G) = Ω( σ · n3/2). √ Proof: Our construction is based on the graph G(d) = (V1, E1), which consists of three components: (1) a set of vertices U = {u1, . . . , ud} connected by a path P1 = [u1, . . . , ud], (2) a set of terminal vertices Z = {z1, . . . , zd} (viewed by convention as ordered from left to right), and (3) a collection of d vertex disjoint paths Qi of length Qi = 6 + 2(d − i) d. The vertex connecting ui and zi for every i ∈ {1, . . . , d}. Thus Q1 r(G(d)) = ud is fixed as the root of G(d), hence the edges of the paths Qi are viewed as directed away from ui, and the terminal vertices of Z are viewed as the leaves of the graph, denoted Leaf(G(d)) = Z. See Fig. 2 for illustration. 1 > . . . > Q1 Overall, the vertex and edge sets of G(d) are V1 = U ∪ Z ∪(cid:83)d E(P1) ∪(cid:83)d i=1 E(Qi). Figure 2: The graph G1(d). i=1 V (Qi) and E1 = Observation 3.3 (a) The number of leaves in G(d) is Leaf(G(d)) = d. (b) V1 = c · d2 for some constant c. 10 u11 u12 u13 u14 z1 z2 z3 z4 Take σ copies, G(cid:48) 1, . . . , G(cid:48) 1), . . . , Leaf(G(cid:48) σ, of G(d), where d = O((n/σ)1/2). Note that Obs. 3.3, each copy G(cid:48) i consists of O(n/σ) nodes. Let yi be the node ud and si = r(G(cid:48) i) in the ith copy G(cid:48) i. Add a node v∗ connected to a set X of Ω(n) nodes and connect v∗ to each of the nodes yi, for i ∈ {1, . . . , d}. Finally, connect the set X to the σ leaf sets Leaf(G(cid:48) σ) by a complete bipartite graph, adjusting the size of the set X in the construction so that V (G) = n. Since nLeaf(G(cid:48) i) = Ω((n/σ)1/2) (see Obs. 3.3), overall E(G) = Ω(n· σ· nLeaf(G1(d))) = Ω(n· (σn)1/2). Since the path from each source j for j (cid:54)= i, the analysis of the single-source case can be si to X cannot aid the nodes of G(cid:48) applied to show that each of the bipartite graph edges in necessary upon a certain edge fault. See Fig. 3 for an illustration. Figure 3: Illustration of the lower bound for the multi-source case. 4 Upper Bounds In this section we provide tight matching upper bounds to the lower bounds presented in Sec. 3. 4.1 Single Source For the case of FT-BFS trees, we establish the following. 11 s X 𝑂(𝑛) s 𝑑 s s𝜎 Z𝜎 v* G'𝜎 𝑑 s2 s1 G'2 G'1 𝑑=𝑂(𝑛/𝜎) Z2 Z1 √ Theorem 4.1 There exists an O(nm) time algorithm that for every n-vertex graph G and source node s constructs an FT-BFS tree rooted at s with O(n · min{Depth(s), n}) edges. To prove the theorem, we first describe a simple algorithm for the problem and then prove its correctness and analyze the size of the resulting FT-BFS tree. We note that using the sparsity lemma of [23] and the tools of [14], one can provide a randomized construction for an FT-BFS tree with O(n3/2 log n) edges with high probability. In contrast, the algorithm presented in this paper is deterministic and achieve an FT-BFS tree with O(n3/2) edges, matching exactly the lower bound established in Sec. 3. The Algorithm To avoid complications due to shortest-paths of the same length, we assume all shortest-path are computed with a weight assignment W that guarantees the uniqueness of the shortest-paths. This can be achieved by considering a weight function W defined so as to ensure that the shortest paths are also of minimal number of edges but at the same time guarantees the uniqueness of the u− v shortest-path, for every u, v ∈ V . Let e1, . . . , em be some arbitrary ordering of E(G). Then set W (ek) = 2m+1 + 2k. Let T0 = BF S(s, G) be the BFS tree rooted at s in G, computed according to the weight assignment W . For every ej ∈ T0, let T0(ej) be the BFS tree rooted at s in G \ {ej}. Then the final FT-BFS tree is given by T ∗(s) = T0 ∪ (cid:91) T0(ej). ej∈T0 The correctness is immediate by construction. Observation 4.2 T ∗(s) is an FT-BFS tree. Proof: Consider a vertex v and an edge e. If e /∈ π(s, v), then π(s, v) ⊆ T ∗(s)\{e}, hence dist(s, v, T ∗(s) \ {e}) = π(s, v) = dist(s, v, G \ {e}). Otherwise, e ∈ π(s, v) ⊆ T0. Then by construction, T0(e) ⊆ T ∗(s). By definition, dist(s, v, T ∗(s) \ {e}) = dist(s, v, T0(e)) = dist(s, v, G \ {e}). The observation follows. Due to [26] each of the n− 1 BFS trees T0(ej) can be constructed in O(m) time, hence O(nm) rounds are required in total. It therefore remains to bound the size of T ∗(s). Size Analysis We first provide some notation. For a path P , let Cost(P ) =(cid:80) e∈P W (e) be the weighted cost of P , i.e., the sum of its edge weights. An edge e ∈ G is defined as new if e /∈ E(T0). For every vi ∈ V and ej ∈ T0, let P ∗ i,j = π(s, vi, T0(ej)) ∈ SP (s, vi, G \ {ej}, W ) be the optimal replacement path of s and vi upon the failure of ej ∈ T0. Let New(P ) = E(P ) \ E(T0) and New(vi) = {LastE(P ∗ i,j) ej ∈ T0} \ E(T0) 12 be the set of vi new edges appearing as the last edge in the replacement paths P ∗ i,j of vi and ej ∈ T0. It is convenient to view the edges of T0(ej) as directed away from s. We then have that T ∗ = T0 ∪ (cid:91) New(vi). vi∈V \{s} I.e., the set of new edges that participate in the final FT-BFS tree T ∗ are those that appear as a last edge in some replacement path. i,j) /∈ E(T0), then ej ∈ π(s, vi). We now upper bound the size of the FT-BFS tree T ∗. Our goal is to prove that New(vi) n) edges for every vi ∈ V . The following observation is crucial in √ contains at most O( this context. Observation 4.3 If LastE(P ∗ i,j ⊆ T0(ej) be the s−vi Proof: Assume, towards contradiction, that ej /∈ π(s, vi) and let P ∗ replacement path in G \ {ej} according to the weight assignment W . Since LastE(P ∗ i,j) /∈ E(T0), we have two different s − vi shortest paths in G \ {ej}, namely, π(s, vi) and i,j. By the optimality of π(s, vi) in G, i.e., π(s, vi) ∈ SP (s, vi, G, W ), it holds that P ∗ i,j in G \ {ej}, i.e., Cost(π(s, u)) < Cost(P ∗ i,j ∈ SP (s, vi, G\{ej}, W ), we have that Cost(π(s, u)) > Cost(P ∗ P ∗ Obs. 4.3 also yields the following. i,j). On the other hand, by the optimality of P ∗ i,j). Contradiction. Corollary 4.4 (1) New(vi) = {LastE(P ∗ (2) New(vi) ≤ min{depth(vi), deg(vi)}. i,j) ej ∈ π(s, vi)} \ E(T0) and This holds since the edges of New(vi) are coming from at most depth(vi) replacement i,j (one for every ej ∈ π(s, vi)), and each such path contributes at most one edge paths P ∗ incident to vi. For the reminder of the analysis, let us focus on one specific node u = vi and let π = π(s, u), N = New(u). For every edge ek ∈ New(u), we define the following parameters. Let f (ek) ∈ π be the failed edge such that ek ∈ T0(f (ek)) appears in the replacement path Pk = π(s, u, T (cid:48)) for T (cid:48) = T0(f (ek)). (Note that ek might appear as the last edge on the path π(s, u, T0(e(cid:48))) for several edges e(cid:48) ∈ π; in this case, one such e(cid:48) is chosen arbitrarily). Let bk be the last divergence point of Pk and π, i.e., the last vertex on the replacement path Pk that belongs to V (π) \ {u}. Since LastE(Pk) /∈ E(T0), it holds that bk is not the neighbor of u in Pk. Let New(u) = {e1, . . . , eN} be sorted in non-decreasing order of the distance between bk and u, dist(bk, u, π) = π(bk, u). I.e., dist(b1, u, π) ≤ dist(b2, u, π) . . . ≤ dist(bN , u, π). (1) We consider the set of truncated paths P (cid:48) k = Pk[bk, u] and show that these paths are 13 vertex-disjoint except for the last common endpoint u. We then use this fact to bound the number of these paths, hence bound the number N of new edges. The following observation follows immediately by the definition of bk. Observation 4.5 (V (P (cid:48) k) ∩ V (π)) \ {bk, u} = ∅. Lemma 4.6 (cid:0)V (P (cid:48) i ) ∩ V (P (cid:48) j)(cid:1) \ {u} = ∅ for every i, j ∈ {1, . . . , N}, i (cid:54)= j. u(cid:48) ∈(cid:0)V (P (cid:48) j)(cid:1) \ {u} i ) ∩ V (P (cid:48) i ) (cid:54)= LastE(P (cid:48) Proof: Assume towards contradiction that there exist i (cid:54)= j, and a node j), by Obs. 4.5 we have that P (cid:48) j ⊆ in the intersection. Since LastE(P (cid:48) G \ E(π). The faulty edges f (ei), f (ej) belong to E(π). Hence there are two distinct u(cid:48) − u shortest paths in G \ {f (ei), f (ej)}. By the optimality of P (cid:48) in T0(f (ei)), (i.e., Pi ∈ SP (s, u, G\{f (ei)}, W )), we have that Cost(P (cid:48) j[u(cid:48), u]). In addition, i [u(cid:48), u]) < Cost(P (cid:48) j in T0(f (ej)), (i.e., Pj ∈ SP (s, u, G \ {f (ej)}, W )), we have that by the optimality of P (cid:48) i [u(cid:48), u]). Contradiction. j[u(cid:48), u]) < Cost(P (cid:48) Cost(P (cid:48) We are now ready to prove our key lemma. i , P (cid:48) i Lemma 4.7 New(u) = O(n1/2) for every u ∈ V . Proof: Assume towards contradiction that N = New(u) > 2n. By Lemma 4.6, we have that b1, . . . , bN are distinct and by definition they all appear on the path π. There- fore, by the ordering of the P (cid:48) k, we have that the inequalities of Eq. (1) are strict, i.e., dist(b1, u, π) < dist(b2, u, π) < . . . < dist(bN , u, π). Since b1 (cid:54)= u (by definition), we also have that dist(b1, u, π) ≥ 1. We Conclude that √ Next, note that each P (cid:48) π(bk, u), implying that P (cid:48) dist(bk, u, π) = π(bk, u) ≥ k . (2) k is a replacement bk − u path and hence it cannot be shorter than k ≥ π(bk, u). Combining, with Eq. (2), we have that k ≥ k for every k ∈ {1, . . . , N} . P (cid:48) (3) Since by Lemma 4.6, the paths P (cid:48) k are vertex disjoint (except for the common vertex u), we have that(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) N(cid:91) k=1 (V (P (cid:48) k) \ {u}) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) = N(cid:88) k) \ {u} ≥ N(cid:88) V (P (cid:48) k=1 k=1 (k − 1) > n, where the first inequality follows by Eq. (3) and the last inequality by the assumption that N > √ 2n. Since there are a total of n nodes in G, we end with contradiction. Turning to the case of a single vertex failure, the entire proof goes through almost without change, yielding the following. 14 Theorem 4.8 There exists a polynomial time algorithm that for every n-vertex graph and source node s constructs an FT-BFS tree from s tolerant to one vertex failure, with O(n · min{Depth(s), n}) edges. √ 4.2 Multiple Sources For the case of multiple sources, we establish the following upper bound. Theorem 4.9 There exists a polynomial time algorithm that for every n-vertex graph G = (V, E) and source set S ⊆ V of size S = σ constructs an FT-MBFS tree T ∗(S) from each source si ∈ S, tolerant to one edge or vertex failure, with a total number of √ si∈S depth(si), O( σn)} edges. n · min{(cid:80) The algorithm As in the single source case, to avoid complications due to shortest- paths of the same length, all shortest path distances in G are computed using a weight function W defined so as to ensure the uniqueness of a single u − v shortest-path. For every si ∈ S and every ej ∈ T0(si), let T (si, ej) be the BFS tree rooted at si in G \ {ej}. Let (cid:91) si∈S (cid:91) the FT-BFS tree for si is T ∗(si) = T0 ∪(cid:83) T0(S) = T0(si) be the joint structure containing all the BFS trees of S. Then by the previous section, ej∈T0(si) T (si, ej). Define the FT-MBFS for S as (cid:91) si∈S T ∗(S) = T ∗(si) = T (si, ej). si∈S,ej∈T0(si) Analysis The correctness follows immediately by the single source case. It remains to bound the number of edges of T ∗(S). An edge e is new if e /∈ T0(S). For every vi ∈ V , define its new edge set in the graph T ∗(S) by New(S, vi) = {LastE(π(s, vi, T (si, ej))) si ∈ S, ej ∈ T0(si)} \ E(T0(S)). To bound the size of T ∗(S), we focus on node u = vi, and bound its new edges New(S, u) = {e1, . . . , eN}. Obs. 4.3 yields the following. Corollary 4.10 New(S, u) ≤(cid:80) si∈S depth(si). √ σn) new Towards the end of this section, we prove that New(S, u) contains at most O( edges. For ease of notation, let π(si) = π(si, u) for every i ∈ {1, . . . , σ}. For every edge ek ∈ New(S, u), we define the following parameters. Let s(ek) ∈ S and f (ek) ∈ T0(s(ek)) be such that ek ∈ T (s(ek), f (ek)). I.e., the edge ek appears in the replacement s(ek) − u 15 P =(cid:83) path Pk = π(s, u, T (cid:48)), where T (cid:48) = T (s(ek), f (ek)) is the BFS tree rooted at s(ek) in G \ {f (ek)}. By Obs. 4.3, f (ek) ∈ π(s(ek)). (Note that for a given new edge ek there might be several s(cid:48) and e(cid:48) such that ek = LastE(π(s(cid:48), u, T (s(cid:48), e(cid:48)))); in this case one such pair s(cid:48), e(cid:48) is chosen arbitrarily.) For every replacement path Pk (whose last edge is ek), denote by bk the last divergence point of Pk and the collection of shortest si − u paths si∈S π(si, u) \ {u}. I.e., bk is the last point on Pk that belongs to V (P) \ {u}. Let P (cid:48) k = Pk[bk, u] be the truncated path from the divergence point bk to u. Note that since e = (x, u) = LastE(Pk) /∈ E(T0(S)) is a new edge, it holds that x /∈ V (P) \ {u} and bk is in V \ {u}. The following observation is useful. Observation 4.11 P (cid:48) We now show that the paths P (cid:48) regardless of their respective source s(ek)). k ⊆ G \ E(P) for every k ∈ {1, . . . , N}. k are vertex disjoint except for their endpoint u (this is Lemma 4.12 (cid:0)V (P (cid:48) i ) ∩ V (P (cid:48) Proof: Assume towards contradiction that there exists i (cid:54)= j, and a node j)(cid:1) \ {u} = ∅ for every i (cid:54)= j ∈ {1, . . . , N}. u(cid:48) ∈(cid:0)V (P (cid:48) j)(cid:1) \ {u} i ) ∩ V (P (cid:48) i ) (cid:54)= LastE(P (cid:48) j ⊆ G \ E(P), in the intersection. Since LastE(P (cid:48) and the faulty edges f (ei), f (ej) ∈ P, we have two distinct u(cid:48) − u replacement paths in i in T (s(ei), f (ei)), (i.e., Pi ∈ SP (s(ei), u, G \ G \ {f (ei), f (ej)}. By the optimality of P (cid:48) {f (ei)}, W )), we have that Cost(P (cid:48) j). Similarly, by the optimality of P (cid:48) j in T (s(ej), f (ej)), (i.e., Pj ∈ SP (s(ej), u, G \ {f (ej)}, W )), we have that Cost(P (cid:48) j) < Cost(P (cid:48) j) and by Obs. 4.11, P (cid:48) i ), contradiction. The lemma follows. i ) < Cost(P (cid:48) i , P (cid:48) We are now ready to state and prove our main lemma. √ Lemma 4.13 N = New(S, u) = O( We begin by classifying the set of new edges ei ∈ New(S, u) into σ classes according to the position of the divergence point bi. For every ei ∈ New(S, u), let(cid:98)s(ei) ∈ S be some source node such that the divergence point bi ∈ π((cid:98)s(ei), u) appears on its(cid:98)s(ei)− u shortest path σn). T0(S). If there are several such sources for the edge ei, one is chosen arbitrarily. For every sj ∈ S, let New(sj) = {ei ∈ New(S, u) (cid:98)s(ei) = sj} (cid:83) be the set of new edges in New(S, u) that are mapped to sj ∈ S. Then, New(S, u) = sj∈S New(sj). Let xj = New(sj). We now focus on sj. For every ejk ∈ New(sj), k = {1, . . . , xj}, let Pjk = π(s(ejk), u, T (cid:48)) for T (cid:48) = T (s(ejk), f (ejk)) be the replacement path such that LastE(Pjk) = ejk and bjk 16 be its corresponding (last) divergence point with π(sj, u) (sj =(cid:98)s(ejk)). In addition, the truncated path is given by P (cid:48) = Pjk[bjk, u]. Note that LastE(Pjk) = ejk. jk Consider the set of divergence points bj1, . . . , bjxj sorted in non-decreasing order of the distance between bjk and sj on the shortest sj − u path π(sj) i.e., π(bjk, u, T0(sj)), where π(bj1, u, T0(sj)) ≤ π(bj2, u, T0(sj)) . . . ≤ π(bjxj (4) Note that by Lemma 4.12, bj(cid:96) (cid:54)= bj(cid:96)(cid:48) for every (cid:96), (cid:96)(cid:48) ∈ {1, . . . , xj}. In addition, since each ∈ π(sj), combining with Eq. (4) bj(cid:96) (cid:54)= u, π(bj1, u, T0(sj)) ≥ 1. Hence, since bj1, . . . , bjxj , u, T0(sj)) . we get that 1 ≤ π(bj1, u, T0(sj)) < π(bj2, u, T0(sj)) . . . < π(bjxj is an alternative bj(cid:96) − u replacement path, we have that , u, T0(sj)) . Since P (cid:48) j(cid:96) P (cid:48) ≥ π(bj(cid:96), u, T0(sj)) ≥ (cid:96). where the last inequality follows by Eq. (4). Hence, since all P (cid:48) for the last node u, we get the total number of nodes V (sj) =(cid:83) V (P (cid:48) j(cid:96) j(cid:96) are vertex disjoint, except )\{u} occupied by j(cid:96) (5) (6) P (cid:48) j(cid:96) paths is xj(cid:88) V (P (cid:48) j(cid:96) ) = V (sj) = O(x2 j ). Since the nodes of V (sj1) and V (sj2) are disjoint for every sj1, sj2 ∈ S, by Lemma j ) ≤ n. Therefore, j=1 V (sj) = O(x2 4.12, it follows that New(S, u) = (cid:80)σ New(S, u) =(cid:80)σ √ j=1 xj ≤ O( j=1 xj but (cid:80)σ σn). (cid:96)=1 As there are n nodes, combining with Cor. 4.10, we get that the total number of edges in T ∗(S) is given by E(T ∗(S)) ≤ E(T0(S)) + (cid:88) u∈V New(S, u) ≤ σn + n · min{(cid:88) si∈S √ depth(si), O( σn)}, as required. Thm. 4.9 is established. The analysis for the case of vertex faults follows with almost no changes. 5 Hardness of Approximation of the Minimum FT-BFS Problem In this section we establish the following. Theorem 5.1 The Minimum FT-BFS problem is NP-complete and cannot be approxi- mated to within a factor c log n for some constant c > 0 unless NP ⊆ T IME(npoly log(n)). 17 We prove Theorem 5.1 by showing a gap preserving reduction from the Set-Cover problem to the Minimum FT-BFS problem. An instance (cid:104)U, F(cid:105) of the Set-Cover problem consists of a set of N elements U = {u1, . . . , uN} and a collection of M sets F = {S1, . . . , SM} such that Si ⊆ U and (cid:83) Si = U . The task is to choose the minimal number of sets in F whose union covers all of U . Fiege [13] showed that the Set Cover problem cannot be approximated within a ratio of (1 − o(1)) ln n unless NP ⊆ T IME(M poly log(M )). The Transformation. Given a Set-Cover instance (cid:104)U, F(cid:105), we construct a Minimum FT-BFS instance I(U, F) = (G, s) as follows. Let X = {x1, . . . , xM} (resp., Z = {z1, . . . , zN}) be the vertex set corresponding to the collection of sets F (resp., elements of U ). Let BXZ = (X, Z, EXZ) be the bipartite graph corresponding to the input (cid:104)U, F(cid:105), where EXZ = {(xj, zi) ui ∈ Sj, j ∈ {1, . . . , M} and i ∈ {1, . . . , N}}. Embed the bi- partite graph BXZ in G in the following manner. Construct a length-(N + 1) path P = [s = p0, p1 . . . , pN , pN +1], connect a vertex v(cid:48) to pN and connect a set of ver- tices Y = {y1, . . . , yR} for R = O((M N )3) to the vertex pN +1 by the edges of EpY = {(pN +1, yi) i ∈ {1, . . . , R}}. Connect these vertices to the bipartite graph BXZ as follows. For every i ∈ {1, . . . , N}, connect the node pi−1 of P to the node zi of Z = zi] where ti = Qi = 6 + 2(N − i). Thus the by a path Qi = [pi−1 = qi paths Qi are monotonely decreasing and vertex disjoint. In addition, connect the vertices v(cid:48) and pN +1 to every vertex of X, adding the edge sets EvX = {(v(cid:48), xi) xi ∈ X} and EpX = {(pN +1, xj) xj ∈ X}. Finally, construct a complete bipartite graph BXY = (X, Y, EXY ) where EXY = {(y(cid:96), xj) xj ∈ X, y(cid:96) ∈ Y }. This completes the description of G. For illustration, see Fig. 4. Overall, 0, . . . , qi ti V (G) = X ∪ Z ∪ V (P ) ∪ N(cid:91) V (Qi) ∪ {v(cid:48)} ∪ Y, i=1 and E(G) = EXZ ∪ E(P ) ∪ N(cid:91) i=1 E(Qi) ∪ {(pN , v(cid:48))} ∪ EpY ∪ EvX ∪ EpX ∪ EXY . Note that V (G) = O(R) and that E(G) = O(EXZ + N 2 + M R) = O(M R). First, note the following. Observation 5.2 Upon the failure of the edge ei = (pi−1, pi), i ∈ {1, . . . , N}, the follow- ing happen: (a) the unique s − zi shortest path in G \ {ei} is given by (cid:101)Pi = P [s, pi−1] ◦ Qi. (b) the shortest-paths connecting s and the vertices of {pN , pN +1, v(cid:48)} ∪ X ∪ Y disconnect and hence the replacement paths in G \ {ei} must go through the Z nodes. 18 Figure 4: Schematic illustration of the reduction from Set-Cover to Minimum FT-BFS. In this example F = {S1, S2, . . . , S5} where S1 = {u1, u3, u4}, S2 = {u1, u3}, S3 = {a2, a4}, S4 = {a3} and S5 = {a1, a4}. Thus, N = 4 and M = 5. The minimal vertex cover is given by S2 and S3. The vertex set Y is fully connected to X. In the optimal FT-BFS T ∗, Y is required to be connected to the xj nodes that corresponds to the sets appearing in the optimal cover. For example, y(cid:96) is connected to x2 and x3 which "covers" the Z nodes. The red edges are necessary upon the fault of e3. All edges described except for the (xj, y(cid:96)) edges are required in any FT-BFS tree. We begin by observing that all edges except those of BXY are necessary in every FT-BFS tree (cid:98)T ∈ T (s, G). Let (cid:101)E = E(G) \ EXY . Observation 5.3 (cid:101)E ⊆ (cid:98)T for every (cid:98)T ∈ T (s, G). Proof: The edges of the paths P and the edges of EpY ∪ {(pN , v(cid:48))} are trivially part of every FT-BFS tree. The edges of the path Qi are necessary, by Obs. 5.2(a), upon the failure of ei for every i ∈ {1, . . . , N}. To see that the edges of EvX are necessary, note that upon the failure of the edge (pN , pN +1) or the edge (pN +1, xj), the unique s − xj replacement path goes through v(cid:48) for every j ∈ {1, . . . , M}. Similarly, the edges EpX are necessary upon the failure of (pN , v(cid:48)) or (v(cid:48), xj). It remains to consider the edges of EXZ. Assume, towards contradiction, that there exists some T (cid:48) ∈ T (s, G) that does not contain ej,i = (xj, zi) ∈ EXZ. Note that by Obs. 19 e3 p5 x1 x2 x3 x4 x5 z4 z3 z2 z1 s v' P Qi Y p1 p2 p3 p4 yl p0 BXY BXZ Z X EpY EpX EvX (7) 5.2(a), upon the failure of the edge ei = (pi−1, pi) ∈ P , the unique s − xj shortest-path in G \ {ei} is P (cid:48) i = π[p0, pi−1] ◦ Qi ◦ [zi, xj], and all other alternatives are strictly longer. Since ej,i /∈ T (cid:48), also P (cid:48) (cid:42) T (cid:48), and therefore dist(s, xj, G \ {ei}) < dist(s, xj, T (cid:48) \ {ei}), in contradiction to the fact that T (cid:48) ∈ T (s, G). The observation follows. i We now prove the correctness of the reduction and then consider gap-preservation. E((cid:98)T ) ≥ (cid:101)E + κ((cid:98)T ) · R . there exists some ui ∈ U not covered by F(cid:48). Consider the graph G(cid:48) = G \ {ei} where Let (cid:98)T ∈ T (s, G) and define by Γ(y(cid:96),(cid:98)T ) = {xj (xj, y(cid:96)) ∈ (cid:98)T} the X nodes that are connected to y(cid:96) in (cid:98)T , for every y(cid:96) ∈ Y . Let κ((cid:98)T ) = min{Γ(y(cid:96),(cid:98)T ) y(cid:96) ∈ Y }. Note that since the edges of (cid:101)E are necessary in every (cid:98)T ∈ T (s, G) it follows that Lemma 5.4 If (cid:98)T ∈ T (s, G) then there exists a Set-Cover for (cid:104)U, F(cid:105) of size at most κ((cid:98)T ). Proof: Consider (cid:98)T ∈ T (s, G) and let y(cid:96) ∈ Y be such that Γ(y(cid:96),(cid:98)T ) = κ((cid:98)T ). A cover F(cid:48) for U for size κ((cid:98)T ) is constructed as follows. Let F(cid:48) = {Sj xj ∈ Γ(y(cid:96),(cid:98)T )}. By definition, F(cid:48) = κ((cid:98)T ). We now claim that it is a cover for U . Assume, towards contradiction, that ei = (pi−1, pi). Recall that by Obs. 5.2(a), (cid:101)Pk = P [s, pk−1] ◦ Qk is the s − zk path in G \ {ek}. Note that (cid:101)Pk (cid:42) G(cid:48) for every k > i and (cid:101)Pk > (cid:101)Pi for every k < i. Hence j = (cid:101)Pi ◦ (zi, xj). Therefore the s − y(cid:96) shortest-paths in G(cid:48) are all given by j ◦ (xj, y(cid:96)), for every xj ∈ Γ(zi). But since (xj, y(cid:96)) /∈ (cid:98)T for every xj ∈ Γ(zi), we have that dist(s, y(cid:96), G(cid:48)) < dist(s, y(cid:96),(cid:98)T \ {ei}), in contradiction to the fact that (cid:98)T ∈ T (s, G). Lemma 5.5 If there exists a Set-Cover of size κ then Cost∗(s, G) ≤ (cid:101)E + κ · R. Proof: Given a cover F(cid:48) ⊆ F, F(cid:48) = κ, construct a FT-BFS tree (cid:98)T ∈ T (s, G) with (cid:101)E+κ·R edges as follows. Add (cid:101)E to (cid:98)T . In addition, for every Sj ∈ F(cid:48), add the edge (y(cid:96), xj) to (cid:98)T for every y(cid:96) ∈ Y . Clearly, E((cid:98)T ) = (cid:101)E + κ · R. It remains to show that (cid:98)T ∈ T (s, G). denoting the set of neighbors of zi in X by Γ(zi) = {xj (zi, xj) ∈ EXZ}, by Obs. 5.2(b), the unique s − xj shortest-path, for every xj ∈ Γ(zi) such that (zi, xj) ∈ EXY , is given by P (cid:48) P (cid:48) Note that there is no s − u replacement path that uses any y(cid:96) ∈ Y as a relay, for any u ∈ V (G) and y(cid:96) ∈ Y ; this holds as X is connected by two alternative shortest-paths to both pN +1 and to v(cid:48) and the path through y(cid:96) is strictly longer. In addition, if the edge e ∈ {(pN , pN +1), (pN +1, y(cid:96))} fails, then the s − y(cid:96) shortest path in G \ {e} goes through any neighbor xj of y(cid:96). Since each y(cid:96) has at least one X node neighbor in (cid:98)T , it holds that dist(s, y(cid:96),(cid:98)T \ {e}) = dist(s, y(cid:96), G \ {e}). Since the only missing edges of (cid:98)T , namely, E(G)\E((cid:98)T ), are the edges of EXY , it follows path in G \ {ei}, which is by Obs. 5.2(b), P (cid:48) = (cid:101)Pi ◦ (zi, xj) ◦ (xj, y(cid:96)), exists in (cid:98)T \ {ei} for that it remains to check the edges ei = (vi−1, vi) for every i ∈ {1, . . . , N}. Let Sj ∈ F(cid:48) such that ui ∈ Sj. Since F(cid:48) is a cover, such Sj exists. Hence, the optimal s − y(cid:96) replacement 20 every y(cid:96) ∈ Y . It follows that (cid:98)T ∈ T (s, G), hence Cost∗(s, G) ≤ E((cid:98)T ) = (cid:101)E + κ· R. The lemma follows. Let κ∗ be the cost of the optimal Set-Cover for the instance (cid:104)U, F(cid:105). We have the following. Corollary 5.6 Cost∗(s, G) = (cid:101)E + κ∗ · R. Proof: Let T ∗ ∈ T (s, G) be such that E(T ∗) = Cost∗(s, G). It then holds that (cid:101)E + κ(T ∗) · R ≤ E(T ∗) = Cost ∗(s, G) ≤ (cid:101)E + κ∗ · R, where the first inequality holds by Eq. (7) and the second inequality follows by Lemma 5.5. Hence, κ(T ∗) ≤ κ∗. Since by Lemma 5.4, there exists a cover of size κ(T ∗), we have that κ∗ ≤ κ(T ∗). It follows that κ∗ = κ(T ∗) and Cost∗(s, G) = (cid:101)E + κ∗ · R as desired. We now show that the reduction is gap-preserving. Assume that there exists an α approximation algorithm A for the Minimum FT-BFS problem. Then applying our transformation to an instance I(U, F) = (G, s) would result in an FT-BFS tree (cid:98)T ∈ T (s, G) such that (cid:101)E + κ((cid:98)T ) · R < E((cid:98)T ) ≤ α((cid:101)E + κ∗ · R) ≤ 3α · κ∗ · R , where the first inequality follows by Eq. (7), the second by the approximation guarantee of A and by Cor. 5.6, and the third inequality follows by the fact that (cid:101)E ≤ 2R. By Lemma 5.4, a cover of size κ((cid:98)T ) ≤ 3ακ∗ can be constructed given (cid:98)T , which results in a 3α approximation to the Set-Cover instance. As the Set-Cover problem is inapproximable within a factor of (1 − o(1)) ln n, under an appropriate complexity assumption [13], we get that the Minimum FT-BFS problem is inapproximable within a factor of c · log N for some constant c > 0. This complete the proof of Thm. 5.1. 6 O(log n)-Approximation for FT-MBFS Trees In Sec. 4.1, we presented an algorithm that for every graph G and source s constructs an FT-BFS tree (cid:98)T ∈ T (s, G) with O(n3/2) edges. In Sec. 3.1, we showed that there exist FT-BFS (cid:98)T ∈ T (s(cid:48), G(cid:48)) which is denser by a factor of Ω( FT-BFS tree, i.e., such that E((cid:98)T ) ≥ Ω( graphs G and s ∈ V (G) for which Cost∗(s, G) = Ω(n3/2), establishing tightness of our algorithm in the worst-case. Yet, there are also inputs (G(cid:48), s(cid:48)) for which the algorithm of √ Sec. 4, as well as algorithms based on the analysis of [14] and [23], might still produce an n) than the size of the optimal n) · Cost∗(s(cid:48), G(cid:48)). For an illustration of such a case consider the graph G(cid:48) = (V, E) which is a modification of the graph G described in √ 21 Sec. 3.1. The modifications are as follows. First, add a node z0 to Z and connect it to every xi ∈ X. Replace the last edge e(cid:48) i = LastE(Pi) of the vi − zi path Pi by a vertex ri that is connected to the endpoints of the edge e(cid:48) i be the s − zi modified path where LastE(P (cid:48) i ) = (ri, zi). Finally, connect the node z0 to all nodes ri for every i ∈ {1, . . . , d}. See Fig. 5 for illustration. i for every i ∈ {1, . . . , d}. Let P (cid:48) Figure 5: Bad example for the algorithm of Sec. 4. The weights of the z0 edges are larger than those of the other edges. Thus, the entire complete bipartite graph B(X, Z \ {z0}) algorithm. However, an FT-BFS tree T ∗ of O(n) edges can be given by including the edges of (z0, xi) for every xi ∈ X. The red edges are two optional edges necessary upon the failure of ei. Adding the edge (xj, z0) is better, yet the algorithm of Sec. 4 adds (xj, zi) of size Ω(n3/2) is included in the resulting FT-BFS tree (cid:98)T ∈ T (s, G) returned by the to (cid:98)T for every xj ∈ X. as the edges of the complete bipartite graph B that are required in every (cid:98)T ∈ T (s, G) are certain weight assignments the algorithm of Sec. 4 constructs an FT-BFS tree (cid:98)T of size Observe that whereas Cost∗(s, G) = Ω(n3/2), the modified G(cid:48) has Cost∗(s, G(cid:48)) = O(n), no longer required in every T (cid:48) ∈ T (s, G(cid:48)); it is sufficient to connect the nodes of X to z0 only, and by that "save" the Ω(n3/2) edges of B in T (cid:48). Nevertheless, as we show next, for O(n3/2). Specifically, let W be such that each of the edges of E(cid:48) = {(z0, ri) i ∈ {1, . . . , d}} ∪ {(z0, xi) xi ∈ X} is assigned a weight which is strictly larger than the weights of the other edges. That is, W (ek) > W (e(cid:96)) for every ek ∈ E(cid:48) and e(cid:96) ∈ E(G(cid:48)) \ E(cid:48). Note that for every edge ei = (vi, vi+1) ∈ π, i ∈ {1, . . . , d}, there are two alternative s − xj replacement paths of the same length, namely, Qi,j = π[s, vi] ◦ P (cid:48) π[s, vi]◦P (cid:48) i ◦ (zi, xj) that goes through zi and (cid:98)Qi,j = i [s, ri]◦(ri, z0)◦(z0, xi) that goes through z0. Although Qi,j = (cid:98)Qi,j, the weight 22 ei v2 vi vi+1 r1 s vd P'i 𝑑=𝑂(𝑛) z0 z1 zi ri rd zd v* X xj Z R B assignment implies that Cost(Qi,j) < Cost((cid:98)Qi,j) and hence (cid:98)Qi,j /∈ SP (s, xj, G \ {ei}, W ) for every i ∈ {1, . . . , d} and every xj ∈ X. Therefore, E(B) ⊆ (cid:98)T , for every FT-BFS tree (cid:98)T computed by the algorithm of Sec. 4 with the weight assignment W . Hence E((cid:98)T ) = Θ(n3/2) while Cost∗(s, G(cid:48)) = O(n). Clearly, a universally optimal algorithm is unlikely given the hardness of approximation result of Thm. 5.1. Yet the gap can be narrowed down. The goal of this section is to present an O(log n) approximation algorithm for the Minimum FT-BFS Problem (hence also to its special case, the Minimum FT-BFS Problem, where S = 1). To establish this result, we first describe the algorithm and then bound the number of edges. Let ApproxSetCover(F, U ) be an O(log n) approximation algorithm for the Set- Cover problem, which given a collection of sets F = {S1, . . . , SM} that covers a universe U = {u1, . . . , uN} of size N , returns a cover F(cid:48) ⊆ F that is larger by at most O(log N ) than any other F(cid:48)(cid:48) ⊆ F that covers U (cf. [27]). The Algorithm Starting with (cid:98)T = ∅, the algorithm adds edges to (cid:98)T until it becomes an FT-MBFS tree. Set an arbitrary order on the vertices V (G) = {v1, . . . , vn} and on the edges E+ = E(G) ∪ {e0} = {e0, . . . , em} where e0 is a new fictitious edge whose role will be explained later on. For every node vi ∈ V , define Ui = {(cid:104)sk, ej(cid:105) sk ∈ S \ {vi}, ej ∈ E+}. The algorithm consists of n rounds, where in round i it considers vi. Let Γ(vi, G) = {u1, . . . , udi} be the set of neighbors of vi in some arbitrary order, where di = deg(vi, G). For every neighbor uj, define a set Si,j ⊆ Ui containing certain source-edge pairs (cid:104)sk, e(cid:96)(cid:105) ∈ Ui. Informally, a set Si,j contains the pair (cid:104)sk, e(cid:96)(cid:105) iff there exists an sk−vi shortest path in G \ {e(cid:96)} that goes through the neighbor uj of vi. Note that Si,j contains the pair (cid:104)sk, e0(cid:105) iff there exists an sk − vi shortest-path in G \ {e0} = G that goes through uj. I.e., the fictitious edge e0 is meant to capture the case where no fault occurs, and thus we take care of true shortest-paths in G. Formally, every pair (cid:104)sk, e(cid:96)(cid:105) ∈ Ui is included in every set Si,j satisfying that dist(sk, uj, G \ {e(cid:96)}) = dist(sk, vi, G \ {e(cid:96)}) − 1. (8) Let Fi = {Si,1, . . . , Si,di}. The edges of vi that are added to (cid:98)T in round i are now selected i, add the edge (uj, vi) to (cid:98)T . We now turn to prove the correctness of by using algorithm ApproxSetCover to generate an approximate solution for the set cover problem on the collection F = {Si,j i = ApproxSetCover(Fi, Ui). For every Si,j ∈ F(cid:48) this algorithm and establish Thm. 6.5. uj ∈ Γ(vi, G)}. Let F(cid:48) 23 bound its size. Analysis We first show that algorithm constructs an FT-MBFS (cid:98)T ∈ T (S, G) and then Lemma 6.1 (cid:98)T ∈ T (S, G). Proof: Assume, towards contradiction, that (cid:98)T /∈ T (S, G). Let s ∈ S be some source node such that (cid:98)T /∈ T (s, G) is not an FT-BFS tree with respect to s. By the assumption, such s exists. Let BP = {(i, k) vi ∈ V, ek ∈ E+ and dist(s, vi,(cid:98)T \ {ek}) > dist(s, vi, G \ {ek})} distance in (cid:98)T \{ek} is greater than that in G\{ek}. (By the assumption that (cid:98)T /∈ T (s, G), be the set of "bad pairs," namely, vertex-edge pairs (i, k) for which the s−vi shortest path it holds that BP (cid:54)= ∅.) For every vertex-edge pair (i, k), where vi ∈ V \{s} and ek ∈ E+, define an s − vi shortest-path P ∗ i,k in G \ {ek} in the following manner. Let uj ∈ Γ(vi, G) in the cover returned by the algorithm ApproxSetCover in round i. Thus, (uj, vi) ∈ (cid:98)T be such that the pair (cid:104)s, ek(cid:105) ∈ Si,j is covered by the set Si,j of uj and Si,j ∈ F(cid:48) i is included and dist(s, uj, G\{ek}) = dist(s, vi, G\{ek})− 1. Let P (cid:48) ∈ SP (s, uj, G\{ek}) and define i,k = P (cid:48) ◦ (uj, vi). P ∗ By definition, P ∗ BE(i, k) = P ∗ i,k \ E((cid:98)T ) to be the set of "bad edges," namely, the set of P ∗ i,k = dist(s, vi, G \ {ek}) and by construction, LastE(P ∗ i,k) ∈ (cid:98)T . Define are missing in (cid:98)T . By definition, BE(i, k) (cid:54)= ∅ for every bad pair (i, k) ∈ BP . Let i,k edges that i,k)} be the maximal depth of a missing edge in BE(i, k), d(i, k) = maxe∈BE(i,k){dist(s, e, P ∗ and let DM (i, k) denote that "deepest missing edge" for (i, k), i.e., the edge e on P ∗ i,k). Finally, let (i(cid:48), k(cid:48)) ∈ BP be the pair that minimizes satisfying d(i, k) = dist(s, e, P ∗ d(i, k), and let e1 = (v(cid:96)1, vi1) ∈ BE(i(cid:48), k(cid:48)) be the deepest missing edge on P ∗ i(cid:48),k(cid:48), namely, e1 = DM (i(cid:48), k(cid:48)). Note that e1 is the shallowest "deepest missing edge" over all bad pairs (i, k) ∈ BP . Let P1 = P ∗ i(cid:48),k(cid:48)[vi1, vi(cid:48)]; see Fig. 6 for (i1, k(cid:48)) /∈ BP , then any s−vi1 shortest-path P (cid:48) ∈ SP (s, vi1,(cid:98)T\{ek(cid:48)}) , where P (cid:48) = P ∗ illustration. Note that since (i(cid:48), k(cid:48)) ∈ BP , it follows that also (i1, k(cid:48)) ∈ BP . (Otherwise, if can be appended to P3 resulting in P (cid:48)(cid:48) = P (cid:48) ◦ P3 such that (1) P (cid:48)(cid:48) ⊆ (cid:98)T \ {ek(cid:48)} and (2) i1,k(cid:48), we conclude that (i1, k(cid:48)) ∈ BP . Finally, note that LastE(P1) ∈ (cid:98)T by definition, and i(cid:48),k(cid:48), contradicting the fact that (i(cid:48), k(cid:48)) ∈ BP .) Thus P (cid:48)(cid:48) = P (cid:48) + P3 = P2 + P3 = P ∗ i1,k(cid:48), P2 = P ∗ i(cid:48),k(cid:48)[s, vi1] and P3 = P ∗ therefore the deepest missing edge of (i, k) must be shallower, i.e., d(i1, k(cid:48)) < d(i(cid:48), k(cid:48)). However, this is in contradiction to our choice of the pair (i(cid:48), k(cid:48)). The lemma follows. i,k Let W : E(G) → R>0 be the weight assignment that guarantees the uniqueness of shortest-paths. Note that the algorithm did not use W in the computation of the as considered by the algorithm. For every FT-MBFS tree (cid:101)T ∈ T (S, G), vi ∈ V, e(cid:96) ∈ E+ and shortest-paths. For every node vi, let Γ(vi, G) = {u1, . . . , udi} be its ordered neighbor set 24 Figure 6: Red solid lines correspond to new edges. The "deepest missing edge" for (i(cid:48), k(cid:48)), edge e1, is the shallowest such edge over all bad pairs in BP . Yet the pair (i1, k(cid:48)) is bad too. As the last (green) edge of P1 is included in the FT-MBFS tree, and since P1 and P2 are of the same length, it follows that P1 has a shallower "deepest missing edge". sk ∈ S, let (cid:101)Pi(sk, e(cid:96)) ∈ SP (sk, vi,(cid:101)T \ {e(cid:96)}, W ) be an sk − vi shortest-path in (cid:101)T \ {e(cid:96)}. Let Ai((cid:101)T ) = {LastE((cid:101)Pi(sk, e(cid:96))) e(cid:96) ∈ E+, sk ∈ S \ {vi}} be the edges of vi that appear as last edges in the shortest-paths and replacement paths (9) from S to vi in (cid:101)T . Define We then have that Fi((cid:101)T ) = {Si,j (uj, vi) ∈ Ai((cid:101)T )}. Fi((cid:101)T ) = Ai((cid:101)T ) . 25 s vi' vi1 e1 P2 P3 ',*11kiPP (cid:104)sk, e(cid:96)(cid:105) ∈ Ui \ (cid:91) Si,j∈Fi((cid:101)T ) Si,j . (10) show the reverse direction. The correctness of the algorithm (see Lemma 6.1) established that if a subgraph (cid:101)T ⊆ G satisfies that Fi((cid:101)T ) is a cover of Ui for every vi ∈ V , then (cid:101)T ∈ T (S, G). We now turn to Lemma 6.2 For every (cid:101)T ∈ T (S, G), the collection Fi((cid:101)T ) is a cover of Ui, namely, (cid:83) Si,j∈Fi((cid:101)T ) Si,j = Ui, Proof: Assume, towards contradiction, that there exists an FT-MBFS tree (cid:101)T ∈ T (S, G) and a vertex vi ∈ V whose corresponding collection of sets Fi((cid:101)T ) does not cover Ui. Hence for every vi ∈ V . there exists at least one uncovered pair (cid:104)sk, e(cid:96)(cid:105) ∈ Ui, i.e., By definition sk (cid:54)= vi. We next claim that (cid:101)T does not contain an optimal sk − vi path when the edge e(cid:96) fails, contradicting the fact that (cid:101)T ∈ T (S, G). That is, we show that dist(sk, vi,(cid:101)T \ {e(cid:96)}) > dist(sk, vi, G \ {e(cid:96)}). i,(cid:96)) where P ∗ assumption, P ∗ Towards contradiction, assume otherwise, and let (uj, vi) = LastE(P ∗ SP (sk, vi,(cid:101)T \ {e(cid:96)}, W ), hence (uj, vi) ∈ Ai((cid:101)T ) and Si,j ∈ Fi((cid:101)T ). By the contradictory i,(cid:96) ∈ {e(cid:96)}) − 1. This implies that (cid:104)sk, e(cid:96)(cid:105) ∈ Si,j ∈ Fi((cid:101)T ), in contradiction to Eq. (10), stating i,(cid:96) = dist(sk, vi, G \ {e(cid:96)}) and hence dist(sk, uj, G \ {e(cid:96)}) = dist(sk, vi, G \ that (cid:104)sk, e(cid:96)(cid:105) is not covered by Fi((cid:101)T ). The lemma follows. We now turn to bound that number of edges in (cid:98)T . Lemma 6.3 E((cid:98)T ) ≤ O(log n) · Cost∗(S, G). Proof: Let δ = c log n be the approximation ratio guarantee of ApproxSetCover. For ease of notation, let Oi = Ai(T ∗) for every vi ∈ V . Let Fi = {Si,1, . . . , Si,di} be the collection of vi sets considered at round i where Si,j ⊆ Ui is the set of the neighbor uj ∈ Γ(vi, G) computed according to Eq. (8). i = ApproxSetCover(Si, Ui) be the cover returned by the algorithm and define i} as the collection of edges whose corresponding sets are included Let F(cid:48) Ai = {(uj, vi) Si,j ∈ F(cid:48) in S(cid:48) i. Thus, by Eq. (9), Oi = Fi(T ∗) and Ai = F(cid:48) Observation 6.4 Ai ≤ δOi for every vi ∈ V \ {s}. Proof: Assume, towards contradiction, that there exists some i such that Ai > δOi. (9) and by the approximation guarantee of ApproxSetCover where in Then by Eq. i ⊆ Fi that covers Ui, it follows that Fi(T ∗) is not particular Fi((cid:101)T ) ≤ δF(cid:48)(cid:48) i for every vi ∈ V . i for every F(cid:48)(cid:48) 26 a cover of Ui. Consequently, it follows by Lemma 6.2 that T ∗ /∈ T (S, G), contradiction. The observation follows. Since(cid:83) Ai contains precisely the edges that are added by the algorithm to the con- structed FT-MBFS tree (cid:98)T , we have that E((cid:98)T ) ≤ (cid:88) i Oi/2 (as every edge in(cid:83) (cid:80) where the second inequality follows by Obs. 6.4 and the third by the fact that E(T ∗) ≥ vi∈V Oi can be counted at most twice, by both its endpoints). Ai ≤ δ Oi ≤ 2δ · Cost ∗(S, G) , (cid:88) i i The lemma follows. The following theorem is established. Theorem 6.5 There exists a polynomial time algorithm that for every n-vertex graph G and source node set S ⊆ V constructs an FT-MBFS tree (cid:98)T ∈ T (S, G) such that E((cid:98)T ) ≤ O(log n) · Cost∗(S, G). Acknowledgment We are grateful to Gilad Braunschvig, Alon Brutzkus, Adam Sealfon and Oren Weimann for helpful discussions. 27 References [1] B. Awerbuch, A. Bar-Noy, N. Linial, and D. Peleg. Compact distributed data struc- tures for adaptive network routing. In Proc. 21st ACM Symp. on Theory of Com- puting, 230 -- 240, 1989. [2] I. Abraham, S. Chechik, C. Gavoille and D. Peleg. Forbidden-Set Distance Labels for Graphs of Bounded Doubling Dimension. In Proc. 29th ACM Symp. on Principles of Distributed Computing, 2010, 192 -- 200. [3] S. Baswana and S. Sen. Approximate distance oracles for unweighted graphs in expected O(n2) time. ACM Trans. Algorithms, 2(4):557 -- 577, 2006. [4] A. Bernstein and D. Karger. A nearly optimal oracle for avoiding failed vertices and edges. In Proc. 41st ACM Symp. on Theory of Computing, 101 -- 110, 2009. [5] S. Chechik, M. Langberg, D. Peleg, and L. Roditty. f -sensitivity distance oracles and routing schemes. Algorithmica, 861 -- 882, 2012. [6] S. Chechik, M. Langberg, D. Peleg, and L. Roditty. Fault-tolerant spanners for general graphs. In Proc. 41st ACM Symp. on Theory of computing, 435 -- 444, 2009. [7] S. Chechik. Fault-Tolerant Compact Routing Schemes for General Graphs. In Proc. 38th Int. Colloq. on Automata, Languages & Prog., 101 -- 112, 2011. [8] B. Courcelle and A. Twigg. Compact forbidden-set routing. In Proc. 24th Symp. on Theoretical Aspects of Computer Science, 37 -- 48, 2007. [9] A. Czumaj and H. Zhao. Fault-tolerant geometric spanners. Discrete & Computa- tional Geometry, 32, 2003. [10] C. Demetrescu, M. Thorup, R. Chowdhury, and V. Ramachandran. Oracles for distances avoiding a failed node or link. SIAM J. Computing, 37:1299 -- 1318, 2008. [11] M. Dinitz and R. Krauthgamer. Fault-tolerant spanners: better and simpler. In Proc. ACM Symp. on Principles of Distributed Computing, 2011, 169-178. [12] R. Duan and S. Pettie. Dual-failure distance and connectivity oracles. In Proc. 20th ACM-SIAM Symp. on Discrete Algorithms, 2009. [13] U. Feige. A Threshold of ln n for Approximating Set Cover. J. ACM, 634 -- 652, 1998. [14] F. Grandoni and V.V Williams. Single-Source Replacement Paths. Computer Science, 2012. Improved Distance Sensitivity Oracles via Fast In Proc. 53rd IEEE Symp. on Foundations of 28 [15] C. Levcopoulos, G. Narasimhan, and M. Smid. Efficient algorithms for constructing fault-tolerant geometric spanners. In Proc. 30th ACM Symp. on Theory of computing, 186 -- 195, 1998. [16] T. Lukovszki. New results of fault tolerant geometric spanners. In Proc. 6th Workshop on Algorithms and Data Structures, London 193 -- 204, 1999. [17] D. Peleg. Distributed Computing: A Locality-Sensitive Approach. SIAM, 2000. [18] D. Peleg. As good as it gets: Competitive fault tolerance in network structures. In Proc. 11th Symp. on Stabilization, Safety, and Security of Distributed Systems, LNCS 5873, 2009, 35 -- 46. [19] D. Peleg and A.A. Schaffer. Graph spanners. J. Graph Theory, 13:99 -- 116, 1989. [20] D. Peleg and J.D. Ullman. An optimal synchronizer for the hypercube. SIAM J. Computing, 18(2):740 -- 747, 1989. [21] D. Peleg and E. Upfal. A trade-off between space and efficiency for routing tables. J. ACM, 36:510 -- 530, 1989. [22] L. Roditty, M. Thorup, and U. Zwick. Deterministic constructions of approximate distance oracles and spanners. In Proc. 32nd Int. Colloq. on Automata, Languages & Prog., 261 -- 272, 2005. [23] L. Roditty and U. Zwick. Replacement paths and k simple shortest paths in un- weighted directed graphs. ACM Trans. Algorithms ,2012. [24] M. Thorup and U. Zwick. Compact routing schemes. In Proc. 14th ACM Symp. on Parallel Algorithms and Architecture, Hersonissos, Crete, 1 -- 10, 2001. [25] M. Thorup and U. Zwick. Approximate distance oracles. J. ACM, 52:1 -- 24, 2005. [26] M. Thorup. Undirected single-source shortest paths with positive integer weights in linear time. J. ACM, 362 -- 394, 1999. [27] V. Vazirani. Approximation Algorithms. College of Computing, Georgia Institute of Technology, 1997. [28] O. Weimann and R. Yuster. Replacement paths via fast matrix multiplication. In Proc. 51th IEEE Symp. on Foundations of Computer Science, 2010. 29
1508.01657
2
1508
2016-03-24T16:52:18
A parameterized complexity view on non-preemptively scheduling interval-constrained jobs: few machines, small looseness, and small slack
[ "cs.DS", "cs.DM", "math.CO" ]
We study the problem of non-preemptively scheduling $n$ jobs, each job $j$ with a release time $t_j$, a deadline $d_j$, and a processing time $p_j$, on $m$ parallel identical machines. Cieliebak et al. (2004) considered the two constraints $|d_j-t_j|\leq \lambda p_j$ and $|d_j-t_j|\leq p_j +\sigma$ and showed the problem to be NP-hard for any $\lambda>1$ and for any $\sigma\geq 2$. We complement their results by parameterized complexity studies: we show that, for any $\lambda>1$, the problem remains weakly NP-hard even for $m=2$ and strongly W[1]-hard parameterized by $m$. We present a pseudo-polynomial-time algorithm for constant $m$ and $\lambda$ and a fixed-parameter tractability result for the parameter $m$ combined with $\sigma$.
cs.DS
cs
Journal of Scheduling manuscript No. (will be inserted by the editor) A parameterized complexity view on non-preemptively scheduling interval-constrained jobs: few machines, small looseness, and small slack Ren´e van Bevern · Rolf Niedermeier · Ondrej Such´y 6 1 0 2 r a M 4 2 ] S D . s c [ 2 v 7 5 6 1 0 . 8 0 5 1 : v i X r a Submitted: August 7, 2015 Accepted: March 23, 2016 Abstract We study the problem of non-preemptively sched- uling n jobs, each job j with a release time t j, a deadline d j, and a processing time p j, on m parallel identical machines. Cieliebak et al (2004) considered the two constraints d j − t j ≤ λ p j and d j −t j ≤ p j + σ and showed the problem to be NP-hard for any λ > 1 and for any σ ≥ 2. We comple- ment their results by parameterized complexity studies: we show that, for any λ > 1, the problem remains weakly NP- hard even for m = 2 and strongly W[1]-hard parameterized by m. We present a pseudo-polynomial-time algorithm for constant m and λ and a fixed-parameter tractability result for the parameter m combined with σ. Keywords release times and deadlines · machine mini- mization · sequencing within intervals · shiftable intervals · fixed-parameter tractability · NP-hard problem 1 Introduction Non-preemptively scheduling jobs with release times and deadlines on a minimum number of machines is a well-stud- ied problem both in offline and online variants (Chen et al Ren´e van Bevern is supported by grant 16-31-60007 mol a dk of the Russian Foundation for Basic Research (RFBR). Ondrej Such´y is supported by grant 14-13017P of the Czech Science Foundation. Ren´e van Bevern Novosibirsk State University, Novosibirsk, Russian Federation, E-mail: [email protected] Rolf Niedermeier Institut fur Softwaretechnik und Theoretische Informatik, TU Berlin, Germany, E-mail: [email protected] Ondrej Such´y Faculty of Information Technology, Czech Technical University in Prague, Prague, Czech Republic, E-mail: [email protected] 2016; Chuzhoy et al 2004; Cieliebak et al 2004; Malucelli and Nicoloso 2007; Saha 2013). In its decision version, the problem is formally defined as follows: INTERVAL-CONSTRAINED SCHEDULING Input: A set J := {1, . . . ,n} of jobs, a number m ∈ N of machines, each job j with a release time t j ∈ N, a dead- line d j ∈ N, and a processing time p j ∈ N. Question: Is there a schedule that schedules all jobs onto m parallel identical machines such that 1. each job j is executed non-preemptively for p j time units, 2. each machine executes at most one job at a time, and 3. each job j starts no earlier than t j and is finished by d j. For a job j ∈ J, we call the half-open interval [t j,d j) its time window. A job may only be executed during its time window. The length of the time window is d j −t j. We study INTERVAL-CONSTRAINED SCHEDULING with two additional constraints introduced by Cieliebak et al (2004). These constraints relate the time window lengths of jobs to their processing times: Looseness If all jobs j ∈ J satisfy d j −t j ≤ λ p j for some number λ ∈ R, then the instance has looseness λ . By λ - LOOSE INTERVAL-CONSTRAINED SCHEDULING we denote the problem restricted to instances of looseness λ . Slack If all jobs j ∈ J satisfy d j − t j ≤ p j + σ for some number σ ∈ R, then the instance has slack σ. By σ -SLACK INTERVAL-CONSTRAINED SCHEDULING we denote the problem restricted to instances of slack σ. Both constraints on INTERVAL-CONSTRAINED SCHEDUL- ING are very natural: clients may accept some small deviation of at most σ from the desired start times of their jobs. More- over, it is conceivable that clients allow for a larger deviation 2 Ren´e van Bevern et al. for jobs that take long to process anyway, leading to the case of bounded looseness λ . Cieliebak et al (2004) showed that, even for constant λ > 1 and constant σ ≥ 2, the problems λ -LOOSE INTERVAL- CONSTRAINED SCHEDULING and σ -SLACK INTERVAL- CONSTRAINED SCHEDULING are strongly NP-hard. Instead of giving up on finding optimal solutions and resorting to approximation algorithms (Chuzhoy et al 2004; Cieliebak et al 2004), we conduct a more fine-grained com- plexity analysis of these problems employing the frame- work of parameterized complexity theory (Cygan et al 2015; Downey and Fellows 2013; Flum and Grohe 2006; Nieder- meier 2006), which so far received comparatively little atten- tion in the field of scheduling with seemingly only a handful of publications (van Bevern et al 2015a,b; Bodlaender and Fellows 1995; Cieliebak et al 2004; Fellows and McCartin 2003; Halld´orsson and Karlsson 2006; Hermelin et al 2015; Mnich and Wiese 2015). In particular, we investigate the effect of the parameter m of available machines on the pa- rameterized complexity of interval-constrained scheduling without preemption. Related work INTERVAL-CONSTRAINED SCHEDULING is a classical scheduling problem and strongly NP-hard already on one machine (Garey and Johnson 1979, problem SS1). Besides the task of scheduling all jobs on a minimum number of machines, the literature contains a wide body of work concerning the maximization of the number of scheduled jobs on a bounded number of machines (Kolen et al 2007). For the objective of minimizing the number of machines, (cid:112)logn/loglogn)- Chuzhoy et al (2004) developed a factor-O( approximation algorithm. Malucelli and Nicoloso (2007) for- malized machine minimization and other objectives in terms of optimization problems in shiftable interval graphs. Online algorithms for minimizing the number of machines have been studied as well and we refer to recent work by Chen et al (2016) for an overview. Our work refines the following results of Cieliebak et al (2004), who considered INTERVAL-CONSTRAINED SCHED- ULING with bounds on the looseness and the slack. They showed that INTERVAL-CONSTRAINED SCHEDULING is strongly NP-hard for any looseness λ > 1 and any slack σ ≥ 2. Besides giving approximation algorithms for various spe- cial cases, they give a polynomial-time algorithm for σ = 1 and a fixed-parameter tractability result for the combined parameter σ and h, where h is the maximum number of time windows overlapping in any point in time. Our contributions We analyze the parameterized complexity of INTERVAL-CONSTRAINED SCHEDULING with respect to three parameters: the number m of machines, the loose- ness λ , and the slack σ. More specifically, we refine known results of Cieliebak et al (2004) using tools of parameterized complexity analysis. An overview is given in Table 1.1. In Section 3, we show that, for any λ > 1, λ -LOOSE INTERVAL-CONSTRAINED SCHEDULING remains weakly NP-hard even on m = 2 machines and that it is strongly W[1]- hard when parameterized by the number m of machines. In Section 4, we give a pseudo-polynomial-time algorithm for λ - LOOSE INTERVAL-CONSTRAINED SCHEDULING for each fixed λ and m. Finally, in Section 5, we give a fixed-para- meter algorithm for σ -SLACK INTERVAL-CONSTRAINED SCHEDULING when parameterized by m and σ. This is in contrast to our result from Section 3 that the parameter com- bination m and λ presumably does not give fixed-parameter tractability results for λ -LOOSE INTERVAL-CONSTRAINED SCHEDULING. 2 Preliminaries Basic notation We assume that 0 ∈ N. For two vectors u = (u1, . . . ,uk) and v = (v1, . . . ,vk), we write u ≤ v if ui ≤ vi for all i ∈ {1, . . . ,k}. Moreover, we write u (cid:8) v if u ≤ v and u(cid:54)= v, that is, u and v differ in at least one component. Finally, 1k is the k-dimensional vector consisting of k 1-entries. Computational complexity We assume familiarity with the basic concepts of NP-hardness and polynomial-time many- one reductions (Garey and Johnson 1979). We say that a problem is (strongly) C-hard for some complexity class C if it is C-hard even if all integers in the input instance are bounded from above by a polynomial in the input size. Otherwise, we call it weakly C-hard. In the following, we introduce the basic concepts of pa- rameterized complexity theory, which are in more detail discussed in corresponding text books (Cygan et al 2015; Downey and Fellows 2013; Flum and Grohe 2006; Nieder- meier 2006). Fixed-parameter algorithms The idea in fixed-parameter al- gorithmics is to accept exponential running times, which are seemingly inevitable in solving NP-hard problems, but to restrict them to one aspect of the problem, the parameter. Thus, formally, an instance of a parameterized prob- lem Π is a pair (x,k) consisting of the input x and the parameter k. A parameterized problem Π is fixed-parame- ter tractable (FPT) with respect to a parameter k if there is an algorithm solving any instance of Π with size n in f (k)· poly(n) time for some computable function f . Such an algorithm is called a fixed-parameter algorithm. It is po- tentially efficient for small values of k, in contrast to an algorithm that is merely running in polynomial time for each fixed k (thus allowing the degree of the polynomial to de- pend on k). FPT is the complexity class of fixed-parameter tractable parameterized problems. A parameterized complexity view on non-preemptively scheduling interval-constrained jobs 3 Table 1.1 Overview of results on INTERVAL-CONSTRAINED SCHEDULING for various parameter combinations. The parameterized complexity with respect to the combined parameter λ + σ remains open. Combined with λ σ m looseness λ NP-hard for any λ > 1 (Cieliebak et al 2004) slack σ ? NP-hard for any σ ≥ 2 (Cieliebak et al 2004) Parameter number m of machines W[1]-hard for parameter m for any λ > 1 (Theorem 3.1), weakly NP-hard for m = 2 and any λ > 1 (Theorem 3.1), pseudo-polynomial time for fixed m and λ (Theorem 4.1) fixed-parameter tractable for parameter σ + m (Theorem 5.1) NP-hard for m = 1 (Garey and Johnson 1979) We refer to the sum of parameters k1 +k2 as the combined parameter k1 and k2. Parameterized intractability To show that a problem is pre- sumably not fixed-parameter tractable, there is a parameter- ized analog of NP-hardness theory. The parameterized analog of NP is the complexity class W[1] ⊇ FPT, where it is con- jectured that FPT (cid:54)= W[1]. A parameterized problem Π with parameter k is called W[1]-hard if Π being fixed-parameter tractable implies W[1] = FPT. W[1]-hardness can be shown using a parameterized reduction from a known W[1]-hard problem: a parameterized reduction from a parameterized problem Π1 to a parameterized problem Π2 is an algorithm mapping an instance I with parameter k to an instance I(cid:48) with parameter k(cid:48) in time f (k)· poly(I) such that k(cid:48) ≤ g(k) and I(cid:48) is a yes-instance for Π1 if and only if I is a yes-instance for Π2, where f and g are arbitrary computable functions. 3 A strengthened hardness result In this section, we strengthen a hardness result of Cieliebak et al (2004), who showed that λ -LOOSE INTERVAL-CON- STRAINED SCHEDULING is NP-hard for any λ > 1. This section proves the following theorem: Theorem 3.1 Let λ : N → R be such that λ (n) ≥ 1 + n−c for some integer c ≥ 1 and all n ≥ 2. Then λ (n)-LOOSE INTERVAL-CONSTRAINED SCHED- ULING of n jobs on m machines is (i) weakly NP-hard for m = 2, and (ii) strongly W[1]-hard for parameter m. Note that Theorem 3.1, in particular, holds for any constant function λ (n) > 1. We remark that Theorem 3.1 cannot be proved using the NP-hardness reduction given by Cieliebak et al (2004), which reduces 3-SAT instances with k clauses to INTERVAL-CON- STRAINED SCHEDULING instances with m = 3k machines. Since 3-SAT is trivially fixed-parameter tractable for the parameter number k of clauses, the reduction of Cieliebak et al (2004) cannot yield Theorem 3.1. Instead, to prove Theorem 3.1, we give a parameterized polynomial-time many-one reduction from BIN PACKING with m bins and n items to λ (mn)-LOOSE INTERVAL-CON- STRAINED SCHEDULING with m machines and mn jobs. BIN PACKING Input: A bin volume V ∈ N, a list a1, . . . ,an ∈ N of items, and a number m ≤ n of bins. Question: Is there a partition S1 (cid:93)···(cid:93) Sm = {1, . . . ,n} such that ∑i∈Sk ai ≤ V for all 1 ≤ k ≤ m? Since BIN PACKING is weakly NP-hard for m = 2 bins and W[1]-hard parameterized by m even if all input numbers are polynomial in n (Jansen et al 2013), Theorem 3.1 will follow. Our reduction, intuitively, works as follows: for each of the n items ai in a BIN PACKING instance with m bins of volume V , we create a set Ji := { j1 i } of m jobs that have to be scheduled on m mutually distinct machines. Each machine represents one of the m bins in the BIN PACK- ING instance. Scheduling job j1 i on a machine k corresponds to putting item ai into bin k and will take B + ai time of machine k, where B is some large integer chosen by the reduction. If j1 i is not scheduled on machine k, then a job in Ji \{ j1 i } has to be scheduled on machine k, which will take only B time of machine k. Finally, we choose the latest deadline of any job as nB +V . Thus, since all jobs have to be finished by time nB +V and since there are n items, for each machine k, the items ai for which j1 i is scheduled on machine k must sum up to at most V in a feasible schedule. This corresponds to satisfying the capacity constraint of V of each bin. i , . . . , jm Formally, the reduction works as follows and is illustrated in Figure 3.1. Construction 3.2 Given a BIN PACKING instance I with n ≥ 2 items a1, . . . ,an and m ≤ n bins, and λ : N → R such that λ (n) ≥ 1 + n−c for some integer c ≥ 1 and all n ≥ 2, we construct an INTERVAL-CONSTRAINED SCHEDULING 4 Ren´e van Bevern et al. Fig. 3.1 Reduction from BIN PACKING with four items a1 = 1,a2 = a3 = 2,a4 = 3, bin volume V = 3, and m = 3 bins to 3/2-LOOSE INTERVAL- CONSTRAINED SCHEDULING. That is, Construction 3.2 applies with c = 1, A = 8, and B = 3· 4· 8 = 96. The top diagram shows (not to scale) the jobs created by Construction 3.2. Herein, the processing time of each job is drawn as a rectangle of corresponding length in an interval being the job's time window. The bottom diagram shows a feasible schedule for three machines M1,M2, and M3 that corresponds to putting items a1 and a3 into the first bin, item a2 into the second bin, and a4 into the third bin. instance with m machines and mn jobs as follows. First, let A := n∑ i=1 ai and B := (mn)c · A ≥ 2A. If V > A, then I is a yes-instance of BIN PACKING and we return a trivial yes-instance of INTERVAL-CONSTRAINED SCHEDULING. Otherwise, we have V ≤ A and construct an instance of INTERVAL-CONSTRAINED SCHEDULING as follows: for i } of each i ∈ {1, . . . ,n}, we introduce a set Ji := { j1 jobs. For each job j ∈ Ji, we choose the release time t j := (i− 1)B, i , . . . , jm the processing time p j := B + ai B if j = j1 i , if j (cid:54)= j1 i , (cid:40) (cid:40) and the deadline d j := iB + A if i < n, iB +V if i = n. This concludes the construction. (3.1) (cid:117)(cid:116) Remark 3.3 Construction 3.2 outputs an INTERVAL-CON- STRAINED SCHEDULING instance with agreeable deadlines, that is, the deadlines of the jobs have the same relative order as their release times. Thus, in the offline scenario, all hard- ness results of Theorem 3.1 will also hold for instances with agreeable deadlines. In contrast, agreeable deadlines make the problem sig- nificantly easier in the online scenario: Chen et al (2016) showed an online-algorithm with constant competitive ratio for INTERVAL-CONSTRAINED SCHEDULING with agree- able deadlines, whereas there is a lower bound of n on the competitive ratio for general instances (Saha 2013). In the remainder of this section, we show that Construc- tion 3.2 is correct and satisfies all structural properties that allow us to derive Theorem 3.1. First, we show that Construction 3.2 indeed creates an IN- TERVAL-CONSTRAINED SCHEDULING instance with small looseness. Lemma 3.4 Given a BIN PACKING instance with n≥ 2 items and m bins, Construction 3.2 outputs an INTERVAL-CON- STRAINED SCHEDULING instance with (i) at most m machines and mn jobs and (ii) looseness λ (mn). Proof It is obvious that the output instance has at most mn jobs and m machines and, thus, (i) holds. 0BB+a1B+A2B2B+a22B+A3B3B+a33B+A4B4B+a44B+Vj11j21j31j12j22j32j13j23j33j14j24j34createdinstancefeasiblescheduleM1M2M33B+a23B+a1+a3j11j22j132B+a14B+a1+a3=4B+a4j24j21j12j23j34j31j32j33j14 A parameterized complexity view on non-preemptively scheduling interval-constrained jobs 5 Towards (ii), observe that mn ≥ n ≥ 2, and hence, for each i ∈ {1, . . . ,n} and each job j ∈ Ji, (3.1) yields d j −t j A B B −c ≤ λ (mn). ≤ (iB + A)− (i− 1)B = 1 + (mn) = 1 + = 1 + B A B + A p j = (mn)c · A (cid:117)(cid:116) We now show that Construction 3.2 runs in polynomial time and that, if the input BIN PACKING instance has polynomially bounded integers, then so has the output INTERVAL-CON- STRAINED SCHEDULING instance. Lemma 3.5 Let I be a BIN PACKING instance with n ≥ 2 items a1, . . . ,an and let amax := max1≤i≤n ai. Construc- tion 3.2 applied to I (i) runs in time polynomial in I and (ii) outputs an INTERVAL-CONSTRAINED SCHEDULING instance whose release times and deadlines are bounded by a polynomial in n + amax. Proof We first show (ii), thereafter we show (i). (ii) It is sufficient to show that the numbers A and B in Construction 3.2 are bounded polynomially in n + amax since all release times and deadlines are computed as sums and products of three numbers not larger than A, B, or n. i=1 ai ≤ n·max1≤i≤n ai, which is polynomially Clearly, A = ∑n bounded in n + amax. Since mn ≤ n2, also B = (mn)c · A is polynomially bounded in n + amax. 1=1 ai is clearly computable in time polynomial in the input length. It follows that also B = (mn)c· (cid:117)(cid:116) A is computable in polynomial time. (i) The sum A = ∑n It remains to prove that Construction 3.2 maps yes-instances of BIN PACKING to yes-instances of INTERVAL-CONSTRAINED SCHEDULING, and no-instances to no-instances. Lemma 3.6 Given a BIN PACKING instance I with m bins and the items a1, . . . ,an, Construction 3.2 outputs an IN- TERVAL-CONSTRAINED SCHEDULING instance I(cid:48) that is a yes-instance if and only if I is. Proof (⇒) Assume that I is a yes-instance for BIN PACKING. Then, there is a partition S1 (cid:93)···(cid:93) Sm = {1, . . . ,n} such that ∑i∈Sk ai ≤ V for each k ∈ {1, . . . ,m}. We construct a feasible schedule for I(cid:48) as follows. For each i ∈ {1, . . . ,n} and k such (cid:34) that i ∈ Sk, we schedule j1 (i− 1)B +∑ iB +∑ a j j∈Sk, j<i j∈Sk, j<i i } on a distinct machine (cid:96) ∈ and each of the m− 1 jobs Ji \{ j1 (cid:34) (cid:33) {1, . . . ,m}\{k} in the interval (i− 1)B +∑ a j j∈S(cid:96), j<i i on machine k in the interval iB +∑ a j j∈S(cid:96), j<i a j + ai (cid:33) . , , i ai > V. It is easy to verify that this is indeed a feasible schedule. (⇐) Assume that I(cid:48) is a yes-instance for INTERVAL-CON- STRAINED SCHEDULING. Then, there is a feasible schedule for I(cid:48). We define a partition S1 (cid:93)···(cid:93) Sm = {1, . . . ,n} for I as follows. For each k ∈ {1, . . . ,m}, let i is scheduled on machine k}. (3.2) Sk := {i ∈ {1, . . . ,n} j1 Since, for each i ∈ {1, . . . ,n}, the job j1 is scheduled on exactly one machine, this is indeed a partition. We show that ∑i∈Sk ai ≤ V for each k ∈ {1, . . . ,m}. Assume, towards a contradiction, that there is a k such that ∑ i∈Sk By (3.1), for each i ∈ {1, . . . ,n}, the jobs in Ji have the same release time, each has processing time at least B, and the length of the time window of each job is at most B + A ≤ B + B/2 < 2B. Thus, in any feasible schedule, the execution times of the m jobs in Ji mutually intersect. Hence, the jobs in Ji are scheduled on m mutually distinct machines. By the pigeonhole principle, for each i ∈ {1, . . . ,n}, exactly one i ∈ Ji is scheduled on machine k. We finish the proof by job j∗ showing that, ∀i ∈ {1, . . . ,n}, time iB +∑ a j. j∈Sk, j≤i is not finished before job j∗ (3.3) (3.4) i This claim together with (3.3) then yields that job j∗ finished before nB +∑ a j > nB +V, a j = nB +∑ j∈Sk j∈Sk, j≤n n is not 1 is B if j∗ 1 = j1 which contradicts the schedule being feasible, since jobs in Jn have deadline nB +V by (3.1). It remains to prove (3.4). We proceed by induction. The earliest possible execution time of j∗ 1 is, by (3.1), 1 (cid:54)= j1 time 0. The processing time of j∗ 1, and B + a1 otherwise. By (3.2), 1 ∈ Sk if and only if j1 1 is scheduled on machine k, that is, if and only if j∗ 1. Thus, job j∗ 1 is not finished before B + ∑ j∈Sk, j≤i a j and (3.4) holds for i = 1. Now, assume that (3.4) holds for i−1. We prove it for i. Since i−1 is not finished before (i− 1)B + ∑ j∈Sk, j≤i−1 a j, this is j∗ the earliest possible execution time of j∗ i . The processing time of j∗ i and B + ai otherwise. By (3.2), i ∈ Sk if and only if j∗ i . Thus, job j∗ is not finished (cid:117)(cid:116) before iB + ∑ j∈Sk, j≤i a j and (3.4) holds. We are now ready to finish the proof of Theorem 3.1. (cid:54)= j1 i = j1 is B if j∗ i i i Proof (of Theorem 3.1) By Lemmas 3.4 to 3.6, Construc- tion 3.2 is a polynomial-time many-one reduction from BIN PACKING with n ≥ 2 items and m bins to λ (mn)-LOOSE IN- TERVAL-CONSTRAINED SCHEDULING, where λ : N → R 6 such that λ (n) ≥ 1 +n−c for some integer c ≥ 1 and all n ≥ 2. We now show the points (i) and (ii) of Theorem 3.1. (i) follows since BIN PACKING is weakly NP-hard for m = 2 (Jansen et al 2013) and since, by Lemma 3.4(i), Construc- tion 3.2 outputs instances of λ (mn)-LOOSE INTERVAL-CON- STRAINED SCHEDULING with m machines. (ii) follows since BIN PACKING is W[1]-hard parameter- ized by m even if the sizes of the n items are bounded by a polynomial in n (Jansen et al 2013). In this case, Construc- tion 3.2 generates λ (mn)-LOOSE INTERVAL-CONSTRAINED SCHEDULING instances for which all numbers are bounded polynomially in the number of jobs by Lemma 3.5(ii). More- over, Construction 3.2 maps the m bins of the BIN PACKING instance to the m machines of the output INTERVAL-CON- (cid:117)(cid:116) STRAINED SCHEDULING instance. Concluding this section, it is interesting to note that Theo- rem 3.1 also shows W[1]-hardness of λ -LOOSE INTERVAL- CONSTRAINED SCHEDULING with respect to the height parameter considered by Cieliebak et al (2004): Definition 3.7 (Height) For an INTERVAL-CONSTRAINED SCHEDULING instance and any time t ∈ N, let St := { j ∈ J t ∈ [t j,d j)} denote the set of jobs whose time window contains time t. The height of an instance is t∈N St. h := max Proposition 3.8 Let λ : N → R be such that λ (n) ≥ 1 +n−c for some integer c ≥ 1 and all n ≥ 2. Then λ (n)-LOOSE INTERVAL-CONSTRAINED SCHED- ULING of n jobs on m machines is W[1]-hard parameterized by the height h. Proof Proposition 3.8 follows in the same way as Theo- rem 3.1; one additionally has to prove that Construction 3.2 outputs INTERVAL-CONSTRAINED SCHEDULING instances of height at most 2m. To this end, observe that, by (3.1), for each i ∈ {1, . . . ,n}, there are m jobs released at time (i− 1)B whose deadline is no later than iB + A < (i + 1)B since A≤ B/2. These are all jobs created by Construction 3.2. Thus, St contains only the m jobs released at time (cid:98)t/B(cid:99)· B and the m jobs released at time (cid:98)t/B− 1(cid:99)· B, which are 2m jobs in (cid:117)(cid:116) total. Remark 3.9 Proposition 3.8 complements findings of Cie- liebak et al (2004), who provide a fixed-parameter tractabil- ity result for INTERVAL-CONSTRAINED SCHEDULING pa- rameterized by h + σ: our result shows that their algorithm presumably cannot be improved towards a fixed-parameter tractability result for INTERVAL-CONSTRAINED SCHEDUL- ING parameterized by h alone. Ren´e van Bevern et al. 4 An algorithm for bounded looseness In the previous section, we have seen that λ -LOOSE IN- TERVAL-CONSTRAINED SCHEDULING for any λ > 1 is strongly W[1]-hard parameterized by m and weakly NP-hard for m = 2. We complement this result by the following the- orem, which yields a pseudo-polynomial-time algorithm for each constant m and λ . Theorem 4.1 λ -LOOSE INTERVAL-CONSTRAINED SCHED- ULING is solvable in (cid:96)O(λ m) · n + O(nlogn) time, where (cid:96) := max j∈J d j −t j. The crucial observation for the proof of Theorem 4.1 is the following lemma. It gives a logarithmic upper bound on the height h of yes-instances (as defined in Definition 3.7). To prove Theorem 4.1, we will thereafter present an algorithm that has a running time that is single-exponential in h. Lemma 4.2 Let I be a yes-instance of λ -LOOSE INTER- VAL-CONSTRAINED SCHEDULING with m machines and (cid:18) (cid:96) := max j∈J d j −t j. Then, I has height at most 2m· (cid:19) log (cid:96) + 1 . logλ − log(λ − 1) Proof Recall from Definition 3.7 that the height of an INTER- VAL-CONSTRAINED SCHEDULING instance is maxt∈NSt. We will show that, in any feasible schedule for I and at any time t, there are at most N jobs in St that are active on the first machine at some time t(cid:48) ≥ t, where N ≤ log (cid:96) (4.1) + 1. logλ − log(λ − 1) By symmetry, there are at most N jobs in St that are active on the first machine at some time t(cid:48) ≤ t. Since there are m machines, the total number of jobs in St at any time t, and therefore the height, is at most 2mN. It remains to show (4.1). To this end, fix an arbitrary time t and an arbitrary feasible schedule for I. Then, for any d ≥ 0, let J(t +d) ⊆ St be the set of jobs that are active on the first machine at some time t(cid:48) ≥ t but finished by time t +d. We show by induction on d that (cid:40) J(t + d) ≤ 0 − logd log(1−1/λ ) + 1 if d = 0, if d ≥ 1. (4.2) If d = 0, then J(t + 0) = 0 and (4.2) holds. Now, consider the case d ≥ 1. If no job in J(t + d) is active at time t + d − 1, then J(t + d) = J(t + d − 1) and (4.2) holds by the induction hypothesis. Now, assume that there is a job j ∈ J(t + d) that is active at time t + d − 1. Then, d j ≥ t + d and, since j ∈ St, t j ≤ t. Hence, p j ≥ d j −t j ≥ t + d −t = λ λ d λ . A parameterized complexity view on non-preemptively scheduling interval-constrained jobs 7 It follows that J(t + d) ≤ 1 +J(t + d −(cid:100)d/λ(cid:101)). (4.3) Thus, if d −(cid:100)d/λ(cid:101) = 0, then J(t + d) ≤ 1 +J(t) ≤ 1 and (4.2) holds. If d −(cid:100)d/λ(cid:101) > 0, then, by the induction hypoth- esis, the right-hand side of (4.3) is Algorithm 4.4 We solve INTERVAL-CONSTRAINED SCHED- ULING using dynamic programming. First, for an INTERVAL- CONSTRAINED SCHEDULING instance, let (cid:96) := max j∈J d j− t j, let St be as defined in Definition 3.7, and let S< t ⊆ J be the set of jobs j with d j ≤ t, that is, that have to be finished by time t. We compute a table T that we will show to have the following semantics. For a time t ∈ N, a subset S ⊆ St of jobs and a vector b = (b1, . . . ,bm) ∈ {−(cid:96), . . . , (cid:96)}m,  1 0 if all jobs in S∪ S< t can be scheduled so that machine i is idle from time t + bi for each i ∈ {1, . . . ,m}, otherwise. To compute T , first, set T [0, /0,b] := 1 for every vector b ∈ {−(cid:96), . . . , (cid:96)}m. Now we compute the other entries of T by increasing t, for each t by increasing b, and for each b by S with increasing cardinality. Herein, we distinguish two cases. (a) If t ≥ 1 and S ⊆ St−1, then set T [t,S,b] := T [t −1,S(cid:48),b(cid:48)], where S(cid:48) := S∪ (St−1 ∩ S< b(cid:48) i := min{bi + 1, (cid:96)} for each i ∈ {1, . . . ,m}. t ) and b(cid:48) := (b(cid:48) 1, . . . ,b(cid:48) m) with (b) Otherwise, set T [t,S,b] := 1 if and only if at least one of the following two cases applies: i) there is a machine i ∈ {1, . . . ,m} such that bi > −(cid:96) and T [t,S,b(cid:48)] = 1, where b(cid:48) := (b(cid:48) 1, . . . ,b(cid:48) m) with (cid:40) bi − 1 bi(cid:48) b(cid:48) i(cid:48) := if i(cid:48) = i, if i(cid:48) (cid:54)= i, (cid:40) bi − p j bi(cid:48) or ii) there is a job j ∈ S and a machine i ∈ {1, . . . ,m} such that bi > 0, t + bi ≤ d j, t + bi − p j ≥ t j, and T [t,S\{ j},b(cid:48)] = 1, where b(cid:48) := (b(cid:48) m) with 1, . . . ,b(cid:48) if i(cid:48) = i, if i(cid:48) (cid:54)= i. b(cid:48) i(cid:48) := Note that, since j ∈ St, one has t j ≥ t − (cid:96) by defi- i ≥ −(cid:96) is within the allowed nition of (cid:96). Hence, b(cid:48) range {−(cid:96), . . . , (cid:96)}. Finally, we answer yes if and only if T [tmax,Stmax ,1m · (cid:96)] = 1, (cid:117)(cid:116) where tmax := max j∈J t j. Lemma 4.5 Algorithm 4.4 correctly decides INTERVAL-CON- STRAINED SCHEDULING. Proof We prove the following two claims: For any time 0 ≤ t ≤ tmax, any set S ⊆ St, and any vector b = (b1, . . . ,bm) ∈ {−(cid:96), . . . , (cid:96)}m, if T [t,S,b] = 1, then all jobs in S∪S< t can be sched- uled so that machine i is idle from time t + bi for each i ∈ {1, . . . ,m}, (4.4) + 1 ≤ 1− log(d −(cid:100)d/λ(cid:101)) log(1− 1/λ ) ≤ 1− log(d(1− 1/λ )) log(1− 1/λ ) = 1− logd + log(1− 1/λ ) = − log(1− 1/λ ) logd + 1, log(1− 1/λ ) + 1 + 1 T [t,S,b] = and (4.2) holds. Finally, since (cid:96) = max1≤ j≤nd j −t j, no job in St is active at time t + (cid:96). Hence, we can now prove (4.1) using (4.2) by means of N ≤ J(t + (cid:96)) ≤ − log (cid:96) + 1 log(1− 1/λ ) log(cid:0) λ−1 = − log (cid:96) λ (cid:1) + 1 = − = log (cid:96) log(λ − 1)− logλ + 1 + 1. logλ − log(λ − 1) log (cid:96) (cid:117)(cid:116) 1 ≤ λ . The following proposition gives some intuition on how the bound behaves for various λ . Proposition 4.3 For any λ ≥ 1 and any b ∈ (1,e], it holds that logb λ − logb(λ − 1) Proof It is well-known that (1− 1/λ )λ < 1/e for any λ ≥ 1. Hence, λ logb(1− 1/λ ) = logb(1− 1/λ )λ < logb 1/e ≤ −1, that is, −λ logb(1− 1/λ ) ≥ 1. Thus, −λ logb(1− 1/λ ) Finally, −logb(1− 1/λ ) ≤ λ . ≤ 1 and 1 1 1 −logb(1− 1/λ ) = = 1 −logb( λ−1 λ ) 1 −logb(λ − 1) + logb λ . (cid:117)(cid:116) Towards our proof of Theorem 4.1, Lemma 4.2 provides a logarithmic upper bound on the height h of yes-instances of INTERVAL-CONSTRAINED SCHEDULING. Our second step towards the proof of Theorem 4.1 is the following algorithm, which runs in time that is single-exponential in h. We first present the algorithm and, thereafter, prove its correctness and running time. 8 t (4.5) t = S(cid:48)∪S< and if all jobs in S ∪ S< can be scheduled so that machine i is idle from time t + bi for each i ∈ {1, . . . ,m}, then T [t,S,b] = 1. From (4.4) and (4.5), the correctness of the algorithm easily follows: observe that, in any feasible schedule, all machines are idle from time tmax + (cid:96) and all jobs J ⊆ Stmax ∪ S< tmax are scheduled. Hence, there is a feasible schedule if and only if T [tmax,Stmax ,1m · (cid:96)] = 1. It remains to prove (4.4) and (4.5). First, we prove (4.4) by induction. For T [0, /0,b] = 1, (4.4) holds since there are no jobs to schedule. We now prove (4.4) for T [t,S,b] under the assumption that it is true for all T [t(cid:48),S(cid:48),b(cid:48)] with t(cid:48) < t or t(cid:48) = t and b(cid:48) (cid:8) b. If T [t,S,b] is set to 1 in Algorithm 4.4(a), then, for S(cid:48) and b(cid:48) as defined in Algorithm 4.4(a), T [t − 1,S(cid:48),b(cid:48)] = 1. By the induction hypothesis, all jobs in S(cid:48) ∪ S< t−1 can be scheduled so that machine i is idle from time t − 1 + b(cid:48) i ≤ t +bi. Moreover, S∪S< t−1 since S(cid:48) = S∪(St−1∩S< t ). Hence, (4.4) follows. If T [t,S,b] is set to 1 in Algorithm 4.4(bi), then one has T [t,S,b(cid:48)] = 1 for b(cid:48) as defined in Algorithm 4.4(bi). By the induction hypothesis, all jobs in S∪ S< t can be scheduled so i(cid:48) ≤ t + bi(cid:48), and (4.4) that machine i(cid:48) is idle from time t + b(cid:48) follows. If T [t,S,b] is set to 1 in Algorithm 4.4(bii), then T [t,S\ { j},b(cid:48)] = 1 for j and b(cid:48) as defined in Algorithm 4.4(bii). By the induction hypothesis, all jobs in (S\{ j})∪ S< t can be scheduled so that machine i(cid:48) is idle from time t + b(cid:48) i(cid:48). It remains to schedule job j on machine i in the interval [t + b(cid:48) i,t +bi), which is of length exactly p j by the definition of b(cid:48). Then, machine i is idle from time t +bi and any machine i(cid:48) (cid:54)= i is idle from time t + b(cid:48) It remains to prove (4.5). We use induction. Claim (4.5) clearly holds for t = 0, S = /0, and any b ∈ {−(cid:96), . . . , (cid:96)}m by the way Algorithm 4.4 initializes T . We now show (4.5) provided that it is true for t(cid:48) < t or t(cid:48) = t and b(cid:48) (cid:8) b. t−1 for S(cid:48) as defined in Algorithm 4.4(a). Moreover, since no job in S(cid:48) ∪ S< t−1 can be active from time t − 1 + (cid:96) by definition of (cid:96), each machine i is idle from time t − 1 + min{bi + 1, (cid:96)} = t − 1 + b(cid:48) i, for b(cid:48) = m) as defined in Algorithm 4.4(a). Hence, T [t − (b(cid:48) 1, . . . ,b(cid:48) 1,S(cid:48),b(cid:48)] = 1 by the induction hypothesis, Algorithm 4.4(a) applies, sets T [t,S,b] := T [t − 1,S(cid:48),b(cid:48)] = 1, and (4.5) holds. If some machine i is idle from time t + bi − 1, then, by the induction hypothesis, T [t,S,b(cid:48)] = 1 in Algorithm 4.4(bi), the algorithm sets T [t,S,b] := 1, and (4.5) holds. In the remaining case, every machine i is busy at time t + bi − 1 and K := S \ St−1 (cid:54)= /0. Thus, there is a machine i executing a job from K. For each job j(cid:48) ∈ K, we have t j(cid:48) ≥ t. Since machine i is idle from time t + bi and executes j(cid:48), one has bi > 0. Let j be the last job scheduled on machine i. Then, since machine i is busy at time t + bi − 1, we have d j ≥ t + If S ⊆ St−1, then S∪ S< i(cid:48) = t + bi(cid:48), and (4.4) follows. t = S(cid:48) ∪ S< Ren´e van Bevern et al. bi > t and j /∈ S< t . Hence, j ∈ St. Since machine i is idle from time t +bi, we also have t +bi− p j ≥ t j. Now, if we remove j from the schedule, then machine i is idle from time t +bi− p j and each machine i(cid:48) (cid:54)= i is idle from time t + b(cid:48) i(cid:48) = t + bi(cid:48). Thus, by the induction hypothesis, T [t,S \ { j},b(cid:48)] = 1 in Algorithm 4.4(bii), the algorithm sets T [t,S,b] := 1, and (cid:117)(cid:116) (4.5) holds. Lemma 4.6 Algorithm 4.4 can be implemented to run in O(2h· (2(cid:96) +1)m· (h2m +hm2)·n(cid:96) +nlogn) time, where (cid:96) := max j∈J d j −t j and h is the height of the input instance. Proof Concerning the running time of Algorithm 4.4, we first bound tmax. If tmax > n(cid:96), then there is a time t ∈ {0, . . . ,tmax} such that St = /0 (cf. Definition 3.7). Then, we can split the instance into one instance with the jobs S< t and into one instance with the jobs J \ S< t . We answer "yes" if and only if both of them are yes-instances. Henceforth, we assume that tmax ≤ n(cid:96). In a preprocessing step, we compute the sets St and St−1∩ S< t , which can be done in O(nlogn + hn + tmax) time by sorting the input jobs by deadlines and scanning over the input time windows once: if no time window starts or ends at time t, then St is simply stored as a pointer to the St(cid:48) for the last time t(cid:48) where a time window starts or ends. Now, the table T of Algorithm 4.4 has at most (tmax + 1)· 2h · (2(cid:96) + 1)m ≤ (n(cid:96) + 1)· 2h · (2(cid:96) + 1)m entries. A table entry T [t,S,b] can be accessed in O(m + h) time using a carefully initialized trie data structure (van Bevern 2014) since S ≤ h and since b is a vector of length m. To compute an entry T [t,S,b], we first check, for each job j ∈ S, whether j ∈ St−1. If this is the case for each j, then Algorithm 4.4(a) applies. We can prepare b(cid:48) in O(m) time and S(cid:48) in O(h) time using the set St−1 ∩ S< t computed in the preprocessing step. Then, we access the entry T [t − 1,S(cid:48),b(cid:48)] in O(h + m) time. Hence, (a) takes O(h + m) time. If Algorithm 4.4(a) does not apply, then we check whether Algorithm 4.4(bi) applies. To this end, for each i∈{1, . . . ,m}, we prepare b(cid:48) in O(m) time and access T [t,S,b(cid:48)] in O(h + m) time. Hence, it takes O(m2 + hm) time to check (bi). To check whether Algorithm 4.4(bii) applies, we try each j ∈ S and each i ∈ {1, . . . ,m} and, for each, prepare b(cid:48) in O(m) time and check T [t,S \{ j},b(cid:48)] in O(h + m) time. (cid:117)(cid:116) Thus (bii) can be checked in O(h2m + hm2) time. With the logarithmic upper bound on the height h of yes- instances of INTERVAL-CONSTRAINED SCHEDULING given by Lemma 4.2 and using Algorithm 4.4, which, by Lemma 4.6, runs in time that is single-exponential in h for a fixed num- ber m of machines, we can now prove Theorem 4.1. (cid:18) Proof (of Theorem 4.1) We use the following algorithm. Let h := 2m· log (cid:96) + 1 . logλ − log(λ − 1) (cid:19) A parameterized complexity view on non-preemptively scheduling interval-constrained jobs If, for any time t ∈ N, we have St > h, then we are facing a no-instance by Lemma 4.2 and immediately answer "no". This can be checked in O(nlogn) time: one uses the interval graph coloring problem to check whether we can schedule the time windows of all jobs (as intervals) onto h machines. Otherwise, we conclude that our input instance has height at most h. We now apply Algorithm 4.4, which, by Lemma 4.6, runs in O(2h · (2(cid:96) + 1)m · (h2m + hm2) · n(cid:96) + nlogn) time. Since, by Proposition 4.3, h ∈ O(λ mlog (cid:96)), this running time is (cid:96)O(λ m)h· n + O(nlogn). (cid:117)(cid:116) A natural question is whether Theorem 4.1 can be generalized to λ = ∞, that is, to INTERVAL-CONSTRAINED SCHED- ULING without looseness constraint. This question can be easily answered negatively using a known reduction from 3-PARTITION to INTERVAL-CONSTRAINED SCHEDULING given by Garey and Johnson (1979): Proposition 4.7 If there is an (cid:96)O(m) · poly(n)-time algorithm for INTERVAL-CONSTRAINED SCHEDULING, where (cid:96) := max j∈J d j −t j, then P = NP. Proof Garey and Johnson (1979, Theorem 4.5) showed that INTERVAL-CONSTRAINED SCHEDULING is NP-hard even on m = 1 machine. In their reduction, (cid:96) ∈ poly(n). A sup- posed (cid:96)O(m) · poly(n)-time algorithm would solve such in- (cid:117)(cid:116) stances in polynomial time. Lemma 5.2 At any time t in any feasible schedule for σ - SLACK INTERVAL-CONSTRAINED SCHEDULING, each job j ∈ St is active at some time in the interval [t − σ ,t + σ ]. Proof If the time window of j is entirely contained in [t − σ ,t + σ ], then, obviously, j is active at some time during the interval [t − σ ,t + σ ]. Now, assume that the time window of j is not contained in [t − σ ,t + σ ]. Then, since j ∈ St, its time window con- tains t by Definition 3.7 and, therefore, one of t − σ or t + σ. Assume, for the sake of contradiction, that there is a sched- ule such that j is not active during [t − σ ,t + σ ]. Then j is inactive for at least σ + 1 time units in its time window -- (cid:117)(cid:116) a contradiction. Now that we know that each job in St has to occupy machine resources around time t, we can bound the size of St in the amount of resources available around that time. Lemma 5.3 Any yes-instance of σ -SLACK INTERVAL-CON- STRAINED SCHEDULING has height at most (2σ + 1)m. 9 5 An algorithm for bounded slack So far, we considered INTERVAL-CONSTRAINED SCHED- ULING with bounded looseness λ . Cieliebak et al (2004) additionally considered INTERVAL-CONSTRAINED SCHED- ULING for any constant slack σ. Recall that Cieliebak et al (2004) showed that λ -LOOSE INTERVAL-CONSTRAINED SCHEDULING is NP-hard for any constant λ > 1 and that Theorem 3.1 shows that hav- ing a small number m of machines does make the problem significantly easier. Similarly, Cieliebak et al (2004) showed that σ -SLACK INTERVAL-CONSTRAINED SCHEDULING is NP-hard al- ready for σ = 2. Now we contrast this result by showing that σ -SLACK INTERVAL-CONSTRAINED SCHEDULING is fixed-parameter tractable for parameter m + σ. More specifi- cally, we show the following: Theorem 5.1 σ -SLACK INTERVAL-CONSTRAINED SCHED- ULING is solvable in time (σ + 1)(2σ +1)m · n· σm· logσm + nlogn . O (cid:16) (cid:17) Similarly as in the proof of Theorem 4.1, we first give an upper bound on the height of yes-instances of INTERVAL- CONSTRAINED SCHEDULING as defined in Definition 3.7. To this end, we first show that each job j ∈ St has to occupy some of the (bounded) machine resources around time t. Proof Fix any feasible schedule for an arbitrary yes-instance of σ -SLACK INTERVAL-CONSTRAINED SCHEDULING and any time t. By Lemma 5.2, each job in St is active at some time in the interval [t−σ ,t +σ ]. This interval has length 2σ + 1. Thus, on m machines, there is at most (2σ + 1)m available processing time in this time interval. Consequently, there can (cid:117)(cid:116) be at most (2σ + 1)m jobs with time intervals in St. We finally arrive at the algorithm to prove Theorem 5.1. Proof (of Theorem 5.1) Let h := (2σ + 1)m. In the same way as for Theorem 4.1, in O(nlogn) time we discover that we face a no-instance due to Lemma 5.3 or, otherwise, that our input instance has height at most h. In the latter case, we apply the O(n· (σ + 1)h · hlogh)-time algorithm due to (cid:117)(cid:116) Cieliebak et al (2004). 6 Conclusion Despite the fact that there are comparatively few studies on the parameterized complexity of scheduling problems, the field of scheduling indeed offers many natural parameteri- zations and fruitful challenges for future research. Notably, Marx (2011) saw one reason for the lack of results on "pa- rameterized scheduling" in the fact that most scheduling problems remain NP-hard even for a constant number of ma- chines (a very obvious and natural parameter indeed), hence destroying hope for fixed-parameter tractability results with respect to this parameter. In scheduling interval-constrained jobs with small looseness and small slack, we also have been confronted with this fact, facing (weak) NP-hardness even for two machines. 10 Ren´e van Bevern et al. The natural way out of this misery, however, is to consider parameter combinations, for instance combining the parame- ter number of machines with a second one. In our study, these were combinations with looseness and with slack (see also Table 1.1). In a more general perspective, this consideration makes scheduling problems a prime candidate for offering a rich set of research challenges in terms of a multivariate complexity analysis (Fellows et al 2013; Niedermeier 2010). Herein, for obtaining positive algorithmic results, research has to go beyond canonical problem parameters, since basic scheduling problems remain NP-hard even if canonical pa- rameters are simultaneously bounded by small constants, as demonstrated by Kononov et al (2012).1 Natural parameters to be studied in future research on IN- TERVAL-CONSTRAINED SCHEDULING are the combination of slack and looseness -- the open field in our Table 1.1 -- and the maximum and minimum processing times, which were found to play an important role in the online version of the problem (Saha 2013). Finally, we point out that our fixed-parameter algorithms for INTERVAL-CONSTRAINED SCHEDULING are easy to implement and may be practically applicable if the looseness, slack, and number of machines is small (about three or four each). Moreover, our algorithms are based on upper bounds on the height of an instance in terms of its number of ma- chines, its looseness, and slack. Obviously, this can also be exploited to give lower bounds on the number of required ma- chines based on the structure of the input instance, namely, on its height, looseness, and slack. These lower bounds may be of independent interest in exact branch and bound or approx- imation algorithms for the machine minimization problem. References van Bevern R (2014) Towards optimal and expressive kernelization for d-Hitting Set. Algorithmica 70(1):129 -- 147 van Bevern R, Chen J, Huffner F, Kratsch S, Talmon N, Woeginger GJ (2015a) Approximability and parameterized complexity of multi- cover by c-intervals. Information Processing Letters 115(10):744 -- 749 van Bevern R, Mnich M, Niedermeier R, Weller M (2015b) Interval scheduling and colorful independent sets. Journal of Scheduling 18(5):449 -- 469 Bodlaender HL, Fellows MR (1995) W[2]-hardness of precedence constrained k-processor scheduling. Operations Research Letters 18(2):93 -- 97 Chen L, Megow N, Schewior K (2016) An O(logm)-competitive algo- rithm for online machine minimization. In: Proceedings of the 27th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA'16), SIAM, pp 155 -- 163 1 The results of Kononov et al (2012) were obtained in context of a multivariate complexity analysis framework described by Sevastianov (2005), which is independent of the framework of parameterized com- plexity theory considered in our work: it allows for systematic classifica- tion of problems as polynomial-time solvable or NP-hard given concrete constraints on a set of instance parameters. It is plausible that this frame- work is applicable to classify problems as FPT or W[1]-hard as well. Chuzhoy J, Guha S, Khanna S, Naor J (2004) Machine minimization for scheduling jobs with interval constraints. In: Proceedings of the 45th Annual Symposium on Foundations of Computer Science (FOCS'04), pp 81 -- 90 Cieliebak M, Erlebach T, Hennecke F, Weber B, Widmayer P (2004) Scheduling with release times and deadlines on a minimum number of machines. In: Exploring New Frontiers of Theoretical Informat- ics, IFIP International Federation for Information Processing, vol 155, Springer, pp 209 -- 222 Cygan M, Fomin FV, Kowalik L, Lokshtanov D, Marx D, Pilipczuk M, Pilipczuk M, Saurabh S (2015) Parameterized Algorithms. Springer Downey RG, Fellows MR (2013) Fundamentals of Parameterized Com- plexity. Springer Fellows MR, McCartin C (2003) On the parametric complexity of schedules to minimize tardy tasks. Theoretical Computer Science 298(2):317 -- 324 Fellows MR, Jansen BMP, Rosamond FA (2013) Towards fully mul- tivariate algorithmics: Parameter ecology and the deconstruction of computational complexity. European Journal of Combinatorics 34(3):541 -- 566 Flum J, Grohe M (2006) Parameterized Complexity Theory. Springer Garey MR, Johnson DS (1979) Computers and Intractability: A Guide to the Theory of NP-Completeness. Freeman Halld´orsson MM, Karlsson RK (2006) Strip graphs: Recognition and scheduling. In: Proceedings of the 32nd International Workshop on Graph-Theoretic Concepts in Computer Science (WG'06), Springer, LNCS, vol 4271, pp 137 -- 146 Hermelin D, Kubitza JM, Shabtay D, Talmon N, Woeginger G (2015) Scheduling two competing agents when one agent has significantly fewer jobs. In: Proceedings of the 10th International Symposium on Parameterized and Exact Computation (IPEC'15), Leibniz In- ternational Proceedings in Informatics (LIPIcs), vol 43, Schloss Dagstuhl -- Leibniz-Zentrum fur Informatik, pp 55 -- 65 Jansen K, Kratsch S, Marx D, Schlotter I (2013) Bin packing with fixed number of bins revisited. Journal of Computer and System Sciences 79(1):39 -- 49 Kolen AWJ, Lenstra JK, Papadimitriou CH, Spieksma FCR (2007) Interval scheduling: A survey. Naval Research Logistics 54(5):530 -- 543 Kononov A, Sevastyanov S, Sviridenko M (2012) A complete 4- parametric complexity classification of short shop scheduling prob- lems. Journal of Scheduling 15(4):427 -- 446 Malucelli F, Nicoloso S (2007) Shiftable intervals. Annals of Operations Research 150(1):137 -- 157 Marx D (2011) Fixed-parameter tractable scheduling problems. In: Packing and Scheduling Algorithms for Information and Commu- nication Services (Dagstuhl Seminar 11091) Mnich M, Wiese A (2015) Scheduling and fixed-parameter tractability. Mathematical Programming 154(1-2):533 -- 562 Niedermeier R (2006) Invitation to Fixed-Parameter Algorithms. Oxford University Press Niedermeier R (2010) Reflections on multivariate algorithmics and problem parameterization. In: Proceedings of the 27th Interna- tional Symposium on Theoretical Aspects of Computer Science (STACS'10), Schloss Dagstuhl -- Leibniz-Zentrum fur Informatik, Leibniz International Proceedings in Informatics (LIPIcs), vol 5, pp 17 -- 32 Saha B (2013) Renting a cloud. In: Annual Conference on Founda- tions of Software Technology and Theoretical Computer Science (FSTTCS) 2013, Schloss Dagstuhl -- Leibniz-Zentrum fur Infor- matik, Leibniz International Proceedings in Informatics (LIPIcs), vol 24, pp 437 -- 448 Sevastianov SV (2005) An introduction to multi-parameter complexity analysis of discrete problems. European Journal of Operational Research 165(2):387 -- 397
1312.1764
1
1312
2013-12-06T04:23:26
Optimal Error Rates for Interactive Coding I: Adaptivity and Other Settings
[ "cs.DS", "cs.IT", "cs.IT" ]
We consider the task of interactive communication in the presence of adversarial errors and present tight bounds on the tolerable error-rates in a number of different settings. Most significantly, we explore adaptive interactive communication where the communicating parties decide who should speak next based on the history of the interaction. Braverman and Rao [STOC'11] show that non-adaptively one can code for any constant error rate below 1/4 but not more. They asked whether this bound could be improved using adaptivity. We answer this open question in the affirmative (with a slightly different collection of resources): Our adaptive coding scheme tolerates any error rate below 2/7 and we show that tolerating a higher error rate is impossible. We also show that in the setting of Franklin et al. [CRYPTO'13], where parties share randomness not known to the adversary, adaptivity increases the tolerable error rate from 1/2 to 2/3. For list-decodable interactive communications, where each party outputs a constant size list of possible outcomes, the tight tolerable error rate is 1/2. Our negative results hold even if the communication and computation are unbounded, whereas for our positive results communication and computation are polynomially bounded. Most prior work considered coding schemes with linear amount of communication, while allowing unbounded computations. We argue that studying tolerable error rates in this relaxed context helps to identify a setting's intrinsic optimal error rate. We set forward a strong working hypothesis which stipulates that for any setting the maximum tolerable error rate is independent of many computational and communication complexity measures. We believe this hypothesis to be a powerful guideline for the design of simple, natural, and efficient coding schemes and for understanding the (im)possibilities of coding for interactive communications.
cs.DS
cs
Optimal Error Rates for Interactive Coding I: Adaptivity and Other Settings Mohsen Ghaffari Bernhard Haeupler MIT Microsoft Research Madhu Sudan Microsoft Research [email protected] [email protected] [email protected] Abstract We consider the task of interactive communication in the presence of adversarial errors and present tight bounds on the tolerable error-rates in a number of different settings. Most significantly, we explore adaptive interactive communication where the communicating parties decide who should speak next based on the history of the interaction. In particular, this allows this decision to depend on estimates of the amount of errors that have occurred so far. Braverman and Rao [STOC'11] show that non-adaptively one can code for any constant error rate below 1/4 but not more. They asked whether this bound could be improved using adaptivity. We answer this open question in the affirmative (with a slightly different collection of resources): Our adaptive coding scheme tolerates any error rate below 2/7 and we show that tolerating a higher error rate is impossible. We also show that in the setting of Franklin et al. [CRYPTO'13], where parties share randomness not known to the adversary, adaptivity increases the tolerable error rate from 1/2 to 2/3. For list-decodable interactive communications, where each party outputs a constant size list of possible outcomes, the tight tolerable error rate is 1/2. Our negative results hold even if the communication and computation are unbounded, whereas for our positive results communication and computation are polynomially bounded. Most prior work considered coding schemes with linear amount of communication, while al- lowing unbounded computations. We argue that studying tolerable error rates in this relaxed context helps to identify a setting's intrinsic optimal error rate. We set forward a strong working hypothesis which stipulates that for any setting the maximum tolerable error rate is independent of many computational and communication complexity measures. We believe this hypothesis to be a powerful guideline for the design of simple, natural, and efficient coding schemes and for understanding the (im)possibilities of coding for interactive communications. 3 1 0 2 c e D 6 ] S D . s c [ 1 v 4 6 7 1 . 2 1 3 1 : v i X r a 1 Introduction "Interactive Coding" or "Coding for Interactive Communication" studies the task of protecting an interaction between two parties in the presence of communication errors. This line of work was initated by Schulman [10] who showed, surprisingly at the time, that protocols with n rounds of communication can be protected against a (small) constant fraction of adversarial errors while incurring only a constant overhead in the total communication complexity. In a recent powerful result that revived this area, Braverman and Rao [5] explored the maximal rate of errors that could be tolerated in an interactive coding setting. They showed the existence of a protocol that handles a 1/4 − ǫ error rate and gave a matching negative result under the assumption that the coding scheme is non-adaptive in deciding which player transmits (and which one listens) at any point of time. They left open the questions whether the 1/4 error rate can be improved by allowing adaptivity (see [3, Open Problem 7] and [5, Conclusion]) or by reducing the decoding requirement to list decoding (see [3, Open Problem 9] and [5, Conclusion]), that is, requiring each party only to give a small list of possible outcomes of which one has to be correct. In this work we answer both questions in the affirmative (in a somewhat different regime of computational and communication resources): We give a rate adaptive coding scheme that tolerates any error rate below 2/7. We furthermore show matching impossibility result which strongly rules out any coding scheme achieving an error rate of 2/7. Moreover, we also consider the adaptive coding schemes in the setting of [8] in which both parties share some randomness not known to the adversary. While non-adaptive coding schemes can tolerate any error rate below 1/2 this bound increases to 2/3 using adaptivity, which we show is also best possible. Lastly, we initiate the study of list decodable interactive communication. We show that allowing both parties to output a constant size list of possible outcomes allows non-adaptive coding schemes that are robust against any error rate below 1/2, which again is best possible for in both the adaptive and non-adaptive setting. All our coding schemes are deterministic and work with communication and computation being polynomially bounded in the length of the original protocol. We note that most previous works considered the more restrictive setting of linear amount of communication (often at the cost of exponential time computations). Interestingly, our matching negative results hold even if the communication and computation are unbounded. We show that this sharp threshold behavior extends to many other computational and communication complexity measures and is common to all settings of interactive communication studied in the literature. In fact, an important conceptual contribution of this paper is the formulation of a strong working hypothesis that stipulates that maximum tolerable error rates are invariable with changes in complexity and efficiency restrictions on the coding scheme. Throughout this paper this hypothesis lead us to consider the simplest setting for positive results and then expanding on the insights derived to get the more general positive results. We believe that in this way, the working hypothesis yields a powerful guideline for the design of simple and natural coding schemes as also the search for negative results. This has been already partially substantiated by subsequent results (see [9] and Appendix B). Organization In what follows, we briefly introduce the interactive communication model more formally in Section 2. We also introduce the model for adaptive interaction there. Then, in Section 3, we explain our results as well as the underlying high-level ideas and techniques. In 1 Section 4 we describe the simple Exchange problem and give an adaptive protocol tolerating 2/7- fraction error in Section 4.1. (Combined with Section 3 this section introduces all the principal ideas of the paper. Rest of the paper may be considered supplemental material.) In the remainder of Section 4, we prove that error-rate of 2/7 is the best achievable for the Exchange problem and thus also for the general case of interactive communication. In Section 5, we give interactive coding schemes over large alphabets tolerating 2/7 error rate for general interactions. In Section 6 we then convert these to coding schemes over constant size alphabets. Finally, in Section 7, we give protocols tolerating an 2/3 error rate in the presence of shared randomness. The appendix contains some technical proofs, as well as some simple impossibility results showing tightness of our protocols. 2 New and Old Settings for Interactive Coding In this section, we define the classical interactive coding setup as well as all new settings considered in this work, namely, list decoding, the shared randomness setting, and adaptive protocols. We start with some standard terminology: An n-round interactive protocol Π between two players Alice and Bob is given by two functions ΠA and ΠB. For each round of communication, these functions map (possibly probabilistically) the history of communication and the player's private input to a decision on whether to listen or transmit, and in the latter case also to a symbol of the communication alphabet. All protocols studied prior to this work are non-adaptive1 in that the decision of a player to listen or transmit deterministically depends only on the round number, ensuring that exactly one party transmits in each round. In this case, the channel delivers the chosen symbol of the transmitting party to the listening party, unless the adversary interferes and alters the symbol arbitrarily. In the adversarial channel model with error rate ρ, the number of such errors is at most ρn. The outcome of a protocol is defined to be the transcript of the interaction. A protocol Π′ is said to robustly simulate a protocol Π for an error rate ρ if the following holds: Given any inputs to Π, both parties can uniquely decode the transcript of an error free execution of Π on these inputs from the transcript of any execution of Π′ in which at most a ρ fraction of the transmissions were corrupted. This definition extends easily to list decoding by allowing both parties to produce a small (constant size) list of transcripts that is required to include the correct decoding, i.e., the transcript of Π. We note that the simulation Π′ typically uses a larger alphabet and a larger number of rounds. While our upper bounds are all deterministic, we strengthen the scope of our lower bounds by also considering randomized protocols in which both parties have access to independent private randomness. We also consider the setting of [8] in which both parties have access to shared randomness. In both cases we assume that the adversary does not know the randomness and we say a randomized protocol robustly simulates a protocol Π with failure probability p if, for any input and any adversary, the probability that both parties correctly (list) decode is at least 1 − p. We now present the notion of an adaptive protocol. It turns out that defining a formal model for adaptivity leads to several subtle issues. We define the model first and discuss these issues later. In an adaptive protocol, the communicating players are allowed to base their decision on whether to transmit or listen (probabilistically) on the communication history. In particular, this allows players to base their decision on estimates of the amount of errors that have happened so far (see Theorem 3.2 for why this kind of adaptivity is a natural and useful approach). This can lead to rounds in which both parties transmit or listen simultaneously. In the first case no symbols are 1Braverman and Rao [5] referred to protocols with this property as robust. 2 delivered while in the latter case the symbols received by the two listening parties are chosen by the adversary, without it being counted as an error. It was shown in [5] that protocols which under no Discussion on the adaptivity model. circumstances have both parties transmit or listen simultaneously are necessarily non-adaptive. Any model for adaptivity must therefore allow parties to simultaneously transmit or listen and specify what happens in either case. Doing this and also deciding on how to measure the amount of communication and the number of errors leads to several subtle issues. While it seems pessimistic to assume that the symbols received by two simultaneously listening parties are determined by the adversary this is a crucial assumption. If, e.g., a listening party could find out without doubt if the other party transmitted or listened by receiving silence in the latter case then uncorrupted communication could be arranged by simply using the listen/transmit state as an incorruptible one-bit communication channel. More subtle points arise when considering how to define the quantity of communication on which the adversaries budget of corruptions is based. The number of transmissions performed by the communicating parties, for example, seems like a good choice. This however would make the adversaries budget a variable (possibly probabilistic) quantity that, even worse, non-trivially depends on when and how this budgets is spent. It would furthermore allow parties to time-code, that is, encode a large number (even an encoding of all answers to all possible queries) in the time between two transmissions. While time-coding strategies do not seem to lead to very efficient algorithms they would prevent strong lower bounds which show that even over an unbounded number of rounds no meaningful communication is possible (see, e.g., Theorem 3.2 which proves exactly this for an error rate of 2/7). Our model avoids all these complications. For non-adaptive protocols that perfectly coordinate a designated sender and receiver in each round our model matches the standard setting. For the necessary case that adaptive parties fail to coordinate our model prevents any signaling or time- sharing capabilities and in fact precludes any information exchange. This matches the intuition that in a conversation no advantage can be derived from both parties speaking or listening at the same time. It also guarantees that the product between the number of rounds and the bit-size of the communication alphabet is a clean and tight information theoretic upper bound on the total amount of information or entropy that can be exchanged (in either direction) between the two parties. This makes the number of rounds the perfect quantity to base the adversaries budget on. All this makes our model, in hindsight, the arguably cleanest and most natural extension of the standard setting to adaptive protocols (see also Appendix A for a natural interpretation as a wireless channel model with bounded unpredictable noise). The strongest argument for our model however is the fact that it allows to prove both strong and natural positive and negative results, implying that our model does not overly restrict or empower the protocols or the adversary. 3 Overview In this section we state our results and explain the high level ideas and insights behind them. 3.1 Adaptivity A major contribution of this paper is to show that adaptive protocols can tolerate more than the 1/4 error rate of the non-adaptive setting: 3 Theorem 3.1. Suppose Π is an n-round protocol over a constant bit-size alphabet. For any ǫ > 0, there is a deterministic computationally efficient protocol Π′ that robustly simulates Π for an error rate of 2/7 − ǫ using O(n2) rounds and an O(1)-bit size alphabet. The proof is presented in Section 6. Furthermore, in Section 4.2, we show a matching impossi- bility result which even applies to the arguably simplest interactive protocol, namely, the Exchange Protocol. In the Exchange Protocol each party simply gets an input -- simply a one bit input in our impossibility results -- and sends this input to the other party. Theorem 3.2. There is no (deterministic or randomized) protocol that robustly simulates the Exchange Protocol for an error rate of 2/7 with an o(1) failure probability even when allowing com- putationally unbounded protocols that use an arbitrarily large number of rounds and an unbounded alphabet. Why Adaptivity is Natural and Helpful Next, we explain why it should not be surprising that adaptivity leads to a higher robustness. We also give some insights for why the 2/7 error rate is the natural tolerable error for adaptive protocols. It is helpful to first understand why the 1/4 error rate was thought of as a natural barrier. The intuitive argument, presented in [5], for why one should not be able to cope with an error rate of 1/4 is as follows: During any N round interaction one of the parties, w.l.o.g. Alice, is the designated sender for at most half of the rounds. With an error rate of 1/4 the adversary can corrupt half of the symbols Alice sends out. This makes it impossible for Alice to (reliably) deliver even a single input bit x because the adversary can always make the first half of her transmissions consistent with x = 0 and the second half with x = 1 without Bob being able to know which of the two is real and which one is corrupted. While this intuition is quite convincing at the first glance, it silently assumes that it is a priori clear which of the two parties transmits less often. This in turn essentially only holds for non-adaptive protocols for which the above argument can also be made into a formal negative result [5, Claim 10]. On the other hand, we show that assuming this a priori knowledge is not just a minor technical assumption but indeed a highly nontrivial restriction which is violated in many natural settings of interaction. For example, imagine a telephone conversation on a connection that is bad/noisy in one direction. One person, say Alice, clearly understands Bob while whatever Alice says contains so much noise that Bob has a hard time understanding it. In a non-adaptive conversation, Bob would continue to talk half of the time (even though he has nothing to say given the lack of understandable responses from Alice) while Alice continues to talk little enough that she can be completely out-noised. This is of course not how it would go in real life. There, Bob would listen more in trying to understand Alice and by doing this give Alice the opportunity to talk more. Of course, as soon as this happens, the adversary cannot completely out-noise Alice anymore and the conversation will be able to progress. In fact, similar dynamic rate adaptation mechanisms that adapt the bitrate of a senders to channel conditions and the communication needs of other senders are common in many systems, one prominent example being IEEE 802.11 wireless networks. Even if one is convinced that adaptive algorithms should be able to beat the 1/4 error rate, it is less clear at this point what the maximum tolerable error rate should be. In particular, 2/7 seems like a quite peculiar bound. Next, without going into details of the proofs, we want to give at least some insight why 2/7 is arguably the right and natural error rate for the adaptive setting. We first give an intuitive argument why even adaptive protocols cannot deal with an error rate of 1/3. For this, the adversary runs the same strategy as above which concentrates all errors on 4 one party only. In particular, given a 3N rounds conversation and a budget of N corruptions, the adversary picks one party , say Alice, and makes her first N transmissions sound like as if her input is x = 1. The next N transmissions are made to sound like Alice has input x = 0. During the first N responses, regardless of whether x = 1 (resulting in Alice talking herself) or x = 0 (resulting in the adversary imitating the same transmissions), the whole conversation will sound legitimate. This prevents any rate adaptation, in this case on Bob's side, to kick in before 2N rounds of back and forth have passed. Only then it becomes apparent to the receiver of the corruptions, in this case Bob, that the adversary is trying to fool him. Knowing that the adversary will only try to fool one party, Bob can then stop talking and listen to Alice for the rest of the conversation. Still, even if Bob listens exclusively from this point on, there are only N rounds left which is just enough for all of them to be corrupted. Having received N transmission from Alice claiming x = 1 and equally many claiming x = 0, Bob is again left puzzled. This essentially proves the impossibility of tolerating an error rate of 1/3. But even this 1/3 error rate is not achievable. To explain why even a lower fraction of errors, namely 2/7, leads to a negative result, we remark that the radical immediate back-off we just assumed for Bob is not possible. The reason is that if both parties are so sensitive and radical in their adjustment, the adversary can fool both parties simultaneously by simply corrupting a few transmissions of both parties after round 2N . This would lead to both parties assuming that the transmissions of the other side are being corrupted. The result would be both parties being silent simultaneously which wastes valuable communication rounds. Choosing the optimal tradeoff for how swift and strong protocols are able to adaptively react without falling into this trap naturally leads to an error rate between 1/4 and 1/3, and what rate in this range could be more natural than the mediant 2/7. Other Settings We also give results on other settings that have been suggested in the literature, in particular, list decoding and the shared randomness setting of [8]. We briefly describe these results next. Franklin et al. [8] showed that if both parties share some random string not known to the adversary, then non-adaptive protocols can boost the tolerable error rate from 1/4 to 1/2. We show that also in this setting adaptivity helps to increase the tolerable error rate. In particular, in Section 7, we prove that an error rate of 2/3 − ǫ is achievable and best possible2: Theorem 3.3. In the shared randomness setting of [8], there exists a efficient robust coding scheme for an error rate of 2/3 − ǫ while no such scheme exists for an error rate of 2/3. That is, the equivalents of Theorem 3.1 and Theorem 3.2 hold for an error rate of 2/3. The number of rounds of the robust coding scheme can furthermore be reduced to O(n) if one allows exponential time computations. We also give the first results for list decodable coding schemes (see Section 2 for their definition). The notion of list decodability has been a somewhat recent but already widely successful addition to the study of error correcting codes. It is known that for error correcting codes such a relaxation leads to being able to efficiently [11] tolerate any constant error rate below 1, which is a factor of two higher than the 1/2 − ǫ error rate achievable with unique decoding. It has been an open question whether list decoding can also lead to higher tolerable error rates in interactive coding 2It is interesting to note that similarly to the 2/7 bound (see Theorem 3.2), 2/3 is the mediant between 1/2 and 1, that is, the mediant between the error rate for non-adaptive protocols and the hypothetical error rate of immediately reacting/adapting protocols. 5 schemes (see [3, Open Problem 9] and [5, Conclusion]). We show that this is indeed the case. In particular, for the non-adaptive setting the full factor of two improvement can also be realized in the interactive setting: Theorem 3.4. Suppose Π is an n-round protocol over a constant bit-size alphabet. For any ǫ > 0 there is a O(1)-list decodable, non-adaptive, deterministic, and computationally efficient protocol Π′ that robustly simulates Π for an error rate of 1/2 − ǫ using O(n2) rounds and an O(1)-bit size alphabet. The proof of this theorem is presented in Section 6. We also show that the 1/2 − ǫ error rate is best possible even for adaptive coding schemes. That is, no adaptive or non-adaptive coding scheme can achieve an error rate of 1/2. We prove these impossibility results formally in Appendix C. Taken together, our results provide tight negative and matching positive results for any of the eight interactive coding settings given by the three Boolean attributes, {unique decoding / list de- coding}, {adaptive / non-adaptive}, and {without shared randomness / with shared randomness} (at least when allowing a linear size alphabet or quadratic number of rounds in the simulation). Table 1 shows the maximum tolerable error rate for each of these settings: Non-adaptive Adaptive unique dec. (UD) UD & shared rand. 1/2 ( [8] ) 2/3 1/4 ( [5] ) 2/7 list dec. (LD) LD & shared rand. 1/2 1/2 1/2 2/3 Table 1: Unless marked with a citation all results in this table are new and presented in this paper. Matching positive and negative results for each setting show that the error rates are tight. Even more, the error rates are invariable of assumptions on the communication and computational complexity of the coding scheme and the adversary (see 3.5, Corollary 3.6, and Appendix B). 3.2 Invariability Hypothesis: A Path to Natural Interactive Coding Schemes In this section, we take a step back and propose a general way to understand the tolerable error rates specific to each setting and to design interactive coding schemes achieving them. We first formulate a strong working hypothesis which postulates that tolerable error rates are invariable regardless of what communication and computational resources are given to the protocol and to the adversary. We then use this hypothesis to determine the tight tolerable error rate for any setting by looking at the simplest setup. Finally, we show how clean insights coming from these simpler setups can lead to designs for intuitive, natural, and easily analyzable interactive coding schemes for the more general setup. Invariability Hypothesis In this section we formulate our invariability hypothesis. Surveying the literature for what error rates could be tolerated by different interactive cod- ing schemes, the maximum tolerable error rate appears to vary widely depending on the setting and more importantly, depending on what kind of efficiency one strives for. For example, even for the standard setting -- that is, for non-adaptive unique decoding coding schemes using a large alphabet -- the following error rates apply: for unbounded (or exponential time) computations, Schulman [10] tolerates a 1/240 error rate; Braverman and Rao [5] improved this to 1/4; for sub- exponential time computations, Braverman [4] gave a scheme working for any error rate below 1/40; 6 for randomized polynomial time algorithms, Brakerski and Kalai [1] got an error rate of 1/16; for randomized linear time computations, Brakerski and Naor [2] obtained an unspecified constant error rate smaller than 1/32; lastly, assuming polynomially bounded protocols and adversaries and using a super-linear number of rounds, Chung et al. [6] gave coding schemes tolerating an error rate of 1/6 (with additional desirable properties). We believe that this variety is an artifact of the current state of knowledge rather then being the essential truth. In fact, it appears that any setting comes with exactly one tolerable error rate which furthermore exhibits a strong threshold behavior: For any setting, there seems to be one error rate for which communication is impossible regardless of the resources available, while for error rates only minimally below it simple and efficient coding schemes exist. In short, the tolerable error rate for a setting seems robust and completely independent of any communication resource or computational complexity restrictions made to the protocols or to the adversary. Taking this observation as a serious working hypothesis was a driving force in obtaining, under- standing, and structuring the results obtained in this work. As we will show, it helped to identify the simplest setup for determining the tolerable error rate of a setting, served as a good pointer to open questions, and helped in the design of new, simple, and natural coding schemes. We believe that these insights and schemes will be helpful in future research to obtain the optimal, and effi- cient coding schemes postulated to exist. In fact, we already have a number of subsequent works confirming this (e.g., the results of [1,4,6] mentioned above can all be extended to have the optimal 1/4 error rate; see also Appendix B). All in all, we believe that identifying and formulating this hypothesis is an important conceptual contribution of this work: Hypothesis 3.5 (Invariability Hypothesis). Given any of the eight settings for interactive com- munication (discussed above) the maximum tolerable error rates is invariable regardless: 1. whether the protocol to be simulated is an arbitrary n-round protocol or the much simpler (n-bit) exchange protocol, and 2. whether only O(1)-bit size alphabets are allowed or alphabets of arbitrary size, and 3. whether the simulation has to run in O(n) rounds or is allowed to use an arbitrary number of rounds, and 4. whether the parties are restricted to polynomial time computations or are computationally unbounded, and 5. whether the coding schemes have to be deterministic or are allowed to use private randomness (even when only requiring an o(1) failure probability), and 6. whether the adversary is computationally unbounded or is polynomially bounded in its com- putations (allowing simulation access to the coding scheme if the coding scheme is not com- putationally bounded) We note that our negative results are already as strong as stipulated by the hypothesis, for all eight settings. The next corollary furthermore summarizes how far these negative results combined with the positive results presented in this work (see Table 1) already imply and prove two weaker versions of the hypothesis: 7 Corollary 3.6. The Invariability Hypothesis holds if one weakens point 3. to "3'. whether only O(n)-bit size alphabets are allowed or alphabets of arbitrary size". The Invariability Hypothesis also holds if one weakens point 4. to "4'. whether the simulation has to run in O(n2) rounds or is allowed to use an arbitrary number of rounds". We also refer the reader to [9] and Appendix B for further (subsequent) results supporting the hypothesis, such as, a proof that the hypothesis holds if point 4. is replaced by "4'. whether the simulation has to run in O(n(log∗ n)O(log∗ n)) rounds3 or is allowed to use an arbitrary number of rounds". Determining and Understanding Tolerable Error Rates in the Simplest Setting Next, we explain how we use the invariability hypothesis in finding the optimal tolerable error rates. Suppose that one assumes, as a working hypothesis, the invariability of tolerable error rates to hold regardless of the computational setup and even the structure of the protocol to be simulated. Under this premise, the easiest way to approach determining the best error rate is in trying to design robust simulations for the simplest possible two-way protocol, the Exchange Protocol. This protocol simply gives each party n bits as an input and has both parties learn the other party's input bits by exchanging them (see also Section 4). Studying this setup is considerably simpler. For instance, for non-adaptive protocols, it is easy to see that both parties sending their input in an error correcting code (or for n = 1 simply repeating their input bit) leads to the optimal robust protocol which tolerates any error rate below 1/4 but not more. The same coding scheme with applying any ECC list decoder in the end also gives the tight 1/2 bound for list decoding. For adaptive protocols (both with and without shared randomness), finding the optimal robust 1-bit exchange protocol was less trivial but clearly still better than trying to design highly efficient coding schemes for general protocols right away. Interestingly, looking at simpler setup actually crystallized out well what can and cannot be done with adaptivity, and why. These insights, on the one hand, lead to the strong lower bounds for the exchange problem but, on the other hand, were also translated in a crucial manner to the same tradeoffs for robustly simulating general n-round protocols. Natural Interactive Coding Schemes The invariability working hypothesis was also helpful in finding and formalizing simple and natural designs for obtaining robust coding schemes for general protocols. Before describing these natural coding schemes we first discuss the element of "surprise/magic" in prior works on interactive coding. The existence of an interactive coding scheme that tolerates a constant error rate is a fairly surprising outcome of the prior works, and remains so even in hindsight. One reason for this is that the simplest way of adding redundancy to a conversation, namely encoding each message via an error correcting code, fails dramatically because the adversary can use its budget non-uniformly and corrupt the first message(s) completely. This derails the interaction completely and makes all further exchanges useless even if no corruptions happens from there on. While prior works, such as [10] or [5], manage to overcome this major challenge, their solution remains a technically intriguing works, both in terms of the ingredients they involve (tree 3Here log∗ n stands for the iterated logarithm which is defined to be the number of times the natural logarithm function needs to be applied to n to obtain a number less than or equal to 1. We note that this round blowup is smaller than any constant times iterated logarithm applied to n, that is, 2O(log∗ n · log log∗ n) = o( 8 constant times { } z log log . . . log n). codes, whose existence is again a surprising event) and the recipe for converting the ingredients into a solution to the interactive coding problem. As a result it would appear that the challenge of dealing with errors in interactive communication is an inherently complex task. In contrast to this, we aim to give an intuitive and natural strategy which lends itself nicely to a simple explanation for the possibility of robust interactive coding schemes and even for why their tolerable error rates are as they are. This strategy simply asserts that if there is no hope to fully trust messages exchanged before one should find ways to put any response into the assumed common context by (efficiently) referring back to what one said before. Putting this idea into a high-level semi-algorithmic description gives the following natural outline for a robust conversation: Algorithm 1 Natural Strategy for a Robust Conversation (Alice's Side) B ← What you heard Bob say last (or so far) Listen E ′ EA ← What you said last (or so far) if EA and E ′ 1: Assume nothing about the context of the conversation 2: loop 3: 4: 5: 6: 7: 8: 9: 10: 11: Assume / Output the conversation outcome(s) that seem most likely B makes sense together then Determine the most relevant response r Send the response r but also include an (efficient) summary of what you said so far (EA) else Repeat what you said last (EA) At first glance the algorithm may appear vague. In particular notions like "making sense", and "most relevant response", seem ambiguous and subject to interpretation. It turns out that this is not the case. In fact, formalizing this outline into a concrete coding scheme turns out to be straight forward. This is true especially if one accepts the invariability working hypothesis and allows oneself to not be overly concerned with having to immediately get a highly efficient implementation. In particular, this permits to use the simplest (inefficiently) summary, namely referring back word by word to everything said before. This straight-forward formalization leads to Algorithm 2. Indeed, a reader that compares the two algorithms side-by-side will find that Algorithm 2 is essentially a line-by-line formalization of Algorithm 1. In addition to being arguably natural, Algorithm 2 is also easy to analyze. Simple counting arguments show that the conversation outcome output by most parties is correct if the adversary interferes at most a 1/4 − ǫ fraction of the time, proving the tight tolerable error rate for the robust (while somewhat still inefficient) simulation of general n-round protocols. Maybe even more surprisingly, the exact same simple counting argument also directly shows our list decoding result, namely, that even with an error rate of 1/2 − ǫ the correct conversation outcome is among the 1/ǫ most likely choices for both parties. Lastly, it is easy to enhance both Algorithm 1 and similarly Algorithm 2 to be adaptive. For this one simply adds the following three, almost obvious, rules of an adaptive conversation: Rules 3.7 (Rules for a Successful Adaptive Conversation). Be fair and take turns talking and listening, unless: 1. you are sure that your conversation partner already understood you fully and correctly, in which case you should stop talking and instead listen more to also understand him; or reversely 9 2. you are sure that you already understood your conversation partner fully and correctly, in which case you should stop listening and instead talk more to also inform him. Our algorithm Algorithm 3 exactly adds the formal equivalent of these rules to Algorithm 3. A relatively simple proof that draws on the insights obtained from analyzing the optimal robust exchange protocol then shows that this simple and natural coding scheme indeed achieves the optimal 2/7 − ǫ tolerable error rate for adaptive unique-decoding. This means that Algorithm 3 is one intuitive and natural algorithm that simultaneously achieves the 1/4 error rate (if the adaptivity rules are ignored), the 2/7 − ǫ error rate for adaptive protocols and the 1/2 − ǫ error rate with optimal list size when list decoding is allowed. Of course, so far, this result comes with the drawback of using a large (O(n)-bits) alphabet. Nonetheless, this result together with the invariability hypothesis hold open the promise of such a "perfect" algorithm that works even without the drastic communication overhead4. 4 Results for the Exchange Problem In this section we study the Exchange Problem, which can be viewed as the simplest instance of a two-way (i.e., interactive) communication problem. In the Exchange Problem, each party is given a bit-string of n bits, that is, iA, iB ∈ {0, 1}n, and each party wants to know the bit-string of the other party. Recall that the 1/4 impossibility bound on tolerable error-rate for non-adaptive interactive protocols presented by Braverman and Rao [5] is this simple setting. In Section 4.1, we show that adding rate adaptivity to the exchange algorithms helps one break this 1/4 impossiblity bound and tolerate an error-rate of 2/7 − ǫ, and in fact, this is done with a minimal amount of adaptivity- based decisions regarding whether a party should transmit or listen in each round. We show in Section 4.2 that the error-rate of 2/7 is not tolerable even for the exchange problem, even if one is given infinite number of rounds, alphabet size, and computational power. Furthermore, the intuition used to achieve the 2/7 − ǫ possibility result also extends to the more general simulation problem, discussed in Section 5. 4.1 An Algorithm for the Exchange Problem under Error-Rate 2/7 − ǫ Note that a simple solution based on error correcting codes suffices for solving exchange problem under error-rate 1 4 − ǫ: parties use a code with relative distance 1 − ǫ. In the first half of the time, Alice sends its encoded message and in the second half of the time, Bob sends its encoded message. At the end, each party decodes simply by picking the codeword closest to the received string. As discussed before, the error rate 1 4 − ǫ of this approach is the best possible if no rate adaptation is used. In the following, we explain that a simple rate adaptation technique boosts the tolerable error-rate to 2 7 − ǫ, which we later prove to be optimal. Theorem 4.1. In the private randomness model with rate adaptation, there is an algorithm for the n-bit Exchange Problem that tolerates adversarial error rate of 2/7 − ǫ ≈ 0.2857 − ǫ for any ǫ > 0. Proof. The algorithm runs in N = 7n/ǫ rounds, which means that the budget of adversary is (2/7 − ǫ)7n/ǫ = 2n/ǫ − 7. Throughout the algorithm, we use an error-correction code C : {0, 1}n → 4Subsequent works of the authors have already moved towards this constant size alphabet protocol by reducing the alphabet size from O(n) bits to merely O(logǫ n) bits (see Appendix B). 10 {1, . . . , q} concatenating κ copies of C. ǫ that has distance n n ǫ − 1. Also, for simplicity, we use Cκ to denote the code formed by The first 6N/7 rounds of the algorithm do not use any rate adaptation: Simply, Alice sends C3(iA) in the first 3N/7 rounds and Bob sends C3(iB) in the second 3N/7 rounds. At the end of this part, each party "estimates" the errors invested on the transmissions of the other party by simply reading the hamming distance of the received string to the closest codeword of code C3. If this estimate is less than N/7 = n/ǫ, the party -- say Alice -- can safely assume that the closest codeword is the correct codeword. This is because the adversary's total budget is 2n/ǫ − 7 and the distance between two codewords of C3(iB) is at least 3n/ǫ − 3. In this case, in the remaining N/7 rounds of the algorithm, Alice will be sending C(iA) and never listening. On the other hand, if Alice reads an estimated error greater than N/7 = n/ǫ, then in the remaining N/7 rounds, she will be always listening. The algorithm for Bob is similar. Note that because of the limit on the budget of the adversary, at most only one of the parties will be listening in the last N/7 rounds. Suppose that there is exactly one listening party and it is Alice. In this case, throughout the whole algorithm, Alice has listened a total of 4N/7 = 4n/ǫ rounds where Bob has been sending C4(iB). Since the adversaries budget is less than 2n/ǫ − 7, and because C4 has distance 4n ǫ − 4, Alice can also decode correctly by just picking the codeword of C4 with the smallest hamming distance to the received string. 4.2 Impossibility of Tolerating Error-Rate 2/7 in the Exchange Problem In this section, we turn our attention to impossibility results and particularly prove that the error- rate 2/7 is not tolerable. See the formal statement in Theorem 3.2. Note that Braverman and Rao [5] showed that it is not possible to tolerate error-rate of 1/4 with non-adaptive algorithms. For completeness, we present a (slightly more formal) proof in the style of distributed indistinguishably arguments, in Appendix D, which also covers random algorithms. We first explain a simple (but informal) argument which shows that even with adaptivity, error- rate 1/3 is not tolerable. A formal version of this proof is deferred to Appendix D. The informal version explained next serves as a warm up for the more complex argument used for proving the 2/7 impossibility, presented formally in Theorem 4.3. Lemma 4.2. There is no (deterministic or randomized) adaptive protocol that robustly simulates the Exchange Protocol for an error rate of 1/3 with an o(1) failure probability even when allow- ing computationally unbounded protocols that use an arbitrarily large number of rounds and an unbounded alphabet. Informal Proof. To simplify the discussion, here we only explain the reasoning about deterministic algorithms and we also ignore the rounds in which both parties listen. Note that by the definition of the model, in those all-listening rounds, the adversary can deliver arbitrary messages to each of the parties at no cost. A complete proof is presented in Appendix D. For the sake of contradiction, suppose that there is an algorithm that solves the exchange problem under adversarial error-rate 1/3, in N rounds. We work simply with 1-bit inputs. Let SX,Y denote the setting where Alice receives input X and Bob gets input Y . The idea is to make either settings S0,0 and S0,1 look indistinguishable to Alice or settings S0,0 and S1,0 look indistinguishable to Bob. 11 Alice Bob Inputs: 0 0 Alice Bob 0 1 2R/3 R/3 Copy Bob's transmissions in rounds when Alice is listening alone (at most R/3). Copy Bob's transmissions in rounds when Alice is listening alone. Figure 1: The adversary's strategy for the 1/3-impossibility proof Consider setting S0,0 and suppose that for the first 2N/3 rounds, the adversary does not inter- fere. Without loss of generality, we can assume that in this setting, Alice listens (alone) in less than N/3 of these 2N/3 rounds. We next explain adversary's strategy for the case that this assumption holds. An illustration of the adversary's strategy is presented in Figure 1. First, we explain the adversary's strategy for setting S0,1: Adversary creates a dummy person- ality gBob0 and simulates it with Alice in setting S0,0 where adversary does not interfere. In the first 2N/3 rounds of setting S0,1, whenever Alice listens (alone), the adversary delivers transmission of gBob0 to Alice. As a shorthand for this, we say Alice is connected to gBob0. Since Alice listens less than N/3 of the time, the adversary will have enough budget to completely fake Bob as gBob0 (from Alice's viewpoint). Thus, the two settings look identical to Alice for the first 2N/3 rounds. During the last N/3 rounds of the execution in setting S0,1, the adversary lets Alice and the real Bob talk without no interference. Now, we explain the adversary's strategy for setting S0,0: The adversary generates another dummy personality gBob1 by simulating Bob in setting S0,1 where alone-listening rounds of Alice in the first 2N/3 rounds are connected to gBob0. In setting S0,0, the adversary lets Alice and Bob adversary connects her to gBob1. talk freely during the first 2N/3 rounds but for the last N/3 rounds, whenever Alice listens, the To conclude, we know that in each of the settings S0,1 and S1,0, at most N/3 rounds get corrupted by the adversary. Furthermore, the two settings look identical to Alice which means that she can not know Bob's input. This contradiction completes the proof. Theorem 4.3. [A rephrasing of Theorem 3.2] There is no (deterministic or randomized) adaptive protocol that robustly simulates the Exchange Protocol for an error rate of 2/7 with an o(1) failure probability even when allowing computationally unbounded protocols that use an arbitrarily large number of rounds and an unbounded alphabet. Proof. Suppose that there is an algorithm that solves the exchange problem under adversarial error- rate 1/3, in N rounds. We study this algorithm simply with 1-bit inputs. Let SX,Y denote the setting where Alice receives input X and Bob gets input Y . We specifically work only with settings 12 S0,0, S0,1, and S1,0. Note that if a party has an input 1, it knows in which of these three settings we are. The idea is to present an adversarial strategy that changes the receptions of the party, or parties, that have a 0 input so as to make that party, or parties, to not be able to distinguish (between two of) the settings. For simplicity, we first assume that the algorithm is deterministic and we also ignore the rounds where both parties listen. Note that by the definition of the model for adaptive algorithms (see Section 2), for these rounds, the adversary can deliver arbitrary messages to the parties at no cost. For this lower bound, we need to define the party that becomes the base of indistinguishability (whom we confuse by errors) in a more dynamic way, compared to that in Lemma 4.2 or in [5, Claim 10]. For this purpose, we first study the parties that have input 0 under a particular pattern of received messages (regardless of the setting in which they are), without considering whether the adversary has enough budget to create this pattern or not. Later, we argue that the adversary indeed has enough budget to create this pattern for at least one party and make that party confused. To determine what should be delivered to each party with input 0, the adversary cultivates dummy personalities ]Alice0, ]Alice1, gBob0, gBob1, by simulating Alice or Bob respectively in settings S0,0, S1,0, S0,0, and S0,1, where each of these settings is modified by adversarial interferences (to be specified). Later, when we say that in a given round, e.g. "the adversary connects dummy personality gBob1 to Alice", we mean that the adversary delivers the transmission of gBob1 in that round to Alice5. For each setting, the adversary uses one method of interferences, and thus, when we refer to a setting, we always mean the setting with the related adversarial interferences included. We now explain the said pattern of received messages. Suppose that Alice has input 0 and consider her in settings S0,0 and S0,1, as a priori these two settings are identical to Alice. Using connections to dummy personalities, the adversary creates the following pattern: In the first 2N/7 rounds in which Alice listens alone, her receptions will be made to imply that Bob also has a 0. This happens with no adversarial interference in setting S0,0, but it is enforced to happen in setting S0,1 by the adversary via connecting to Alice the dummy personality gBob0 cultivated in setting S0,0. Thus, at the end of those 2N/7 listening-alone rounds of Alice, the two settings are indistinguishable to Alice. In the rest of the rounds where Alice listens alone, the receptions will be made to look as if Bob has a 1. That is, the adversary leaves those rounds of setting S0,1 intact, but in rounds of setting S0,0 in which Alice listens alone, the adversary connects to Alice the dummy personality gBob1 cultivated in setting S0,1 (with the adversarial behavior described above). The adversary creates a similar pattern of receptions for Bob when he has an input 0, in settings S0,0 and S1,0. That is, the first 2N/7 of his alone receptions are made to imply that Alice has a 0 but the later alone-receptions imply that Alice has a 1. The described reception pattens make Alice unable to distinguish S0,0 from S0,1 and also they make Bob unable to distinguish S0,0 from S1,0. However, the above discussions ignore the adver- sary's budget. We now argue that the adversary indeed has enough budget to create this reception pattern to confuse one or both of the parties. Let xA be the total number of rounds where Alice listens, when she has input 0 and her receptions follow the above pattern. Similarly, define xB for Bob. If xA ≤ 4N/7, then the adversary indeed has enough budget to make the receptions of Alice in settings S0,0 and S0,1 follow the discussed behavior, where the first 2N/7 alone-receptions of Alice are altered in S0,1 and the remaining alone- receptions are altered in S0,0. Thus, if xA ≤ 4N/7, the adversary has a legitimate strategy to make 5This is assuming gBob1 transmits in that round, we later discuss the case where both Alice and gBob1 listen later. 13 Alice confused between S0,0 and S0,1. A similar statement is true about Bob: if xB ≤ 4N/7, the adversary has a legitimate strategy to make Bob confused between S0,0 and S0,1. Now suppose that xA > 4N/7 and xB > 4N/7. In this case, the number of alone-receptions of Alice is at most xA −(xA +xB −N ) = N −xB ≤ 3N/7 and similarly, the number of alone-receptions of Bob is at most xB − (xA + xB − N ) = N − xA ≤ 3N/7. This is because xA + xB − N is a lower bound on the overlap of the round that the two parties listen. In this case, the adversary has enough budget to simultaneously confuse both Alice and Bob of setting S0,0; Alice will be confused between S0,0 and S0,1 and Bob will be confused between S0,0 and S1,0. For this purpose, in setting S0,0, the adversary leaves the first 2N/7 alone-receptions of each party intact but alters the remaining at most N/7 alone-receptions of each party, for a total of at most 2N/7 errors. On the other hand, in setting S0,1, only 2N/7 errors are used on the first 2N/7 alone-receptions of Alice and similarly, in setting S1,0, only 2N/7 errors are used on the first 2N/7 alone-receptions of Bob. Note that these errors make the receptions of each party that has input 0 follow the pattern explained above. We now go back to the issue of the rounds where both parties listen. The rounds of S0,0 in which both parties listen are treated as follows: The adversary delivers the transmission of gBob1 (cultivated in setting S0,1) to Alice and delivers the transmission of ]Alice1 (cultivated in setting S1,0) to Bob. Recall that the adversary does not pay for these interferences. Furthermore, note that these connections make sure that these all-listening rounds do not help Alice to distinguish S0,0 from S0,1 and also they do not help Bob to distinguish S0,0 from S1,0. Finally, we turn to covering the randomized algorithms. Note that for this case we only show that the failure probability of the algorithm is not o(1) as just by guessing randomly, the two parties can have success probability of 1/4. First suppose that P r[xA ≤ 4N/7] ≥ 1/3. Note that the adversary can easily compute this probability, or even simpler just get a (1 + o(1))-factor estimation of it. If P r[xA ≤ 4N/7] ≥ 1/3, then the adversary will hedge his bets on that xA ≤ 4N/7, and thus, it will try to confuse Alice. In particular, he gives Alice an input 0 and tosses a coin and gives Bob a 0 or a 1, accordingly. Regarding whether Bob gets input 0 or 1, the adversary also uses the dummy personalities gBob0 and gBob1, respectively. With probability 1/3, we will have that in fact xA ≤ 4N/7, and in this case the adversary by determining whether Alice hears from the real Bob or the dummy Bob, the adversary makes Alice receive the messages with the pattern described above. This means Alice would not know whether Bob has a 0 or a 1. Hence, the algorithm fails with probability at least 1/6 (Alice can still guess in this case which is correct with probability 1/2). Similarly, if P r[xB ≤ 4N/7] ≥ 1/3, then adversary will make Bob confused between S0,0 and S1,0. On the other hand, if P r[xA ≤ 4N/7] < 1/3 and P r[xB ≤ 4N/7] < 1/3, then just using a union bound we know that Pr[xA > 4N/7&xB > 4N/7] ≥ 1/3. In this case, the adversary gambles on the assumption that it will actually happen that xA > 4N/7 and xB > 4N/7. This assumption happens with probability at least 1/3, and in that case, the adversary makes Alice confused between S0,0 and S0,1 and Bob confused between S0,0 and S1,0, simultaneously, using the approach described above. Hence, in conclusion, in any of the cases regarding random variables xA and xB, the adversary can make the algorithm fail with probability at least 1/6. 14 Figure 2: A Binary Interactive Protocol in the Canonical Form 5 Natural Interactive Coding Schemes With Large Alphabets We start by presenting a canonical format for interactive communication and then present our natural non-adaptive and adaptive coding schemes. 5.1 Interactive Protocols in Canonical Form We consider the following canonical form of an n-round two party protocol over alphabet Σ: We call the two parties Alice and Bob. To define the protocol between them, we take a rooted complete Σ-ary tree of depths n. Each non-leaf node has Σ edges to its children, each labeled with a distinct symbol from Σ. For each node, one of the edges towards children is preferred, and these preferred edges determine a unique leaf or equivalently a unique path from the root to a leaf. We say that the set X of the preferred edges at odd levels of the tree is owned by Alice and the set Y of the preferred edges at even levels of the tree is owned by Bob. This means that at the beginning of the protocol, Alice gets to know the preferred edges on the odd levels and Bob gets to know the preferred edges on the even levels. The knowledge about these preferred edges is considered as inputs X and Y given respectively to Alice and Bob. The output of the protocol is the unique path from the root to a leaf following only preferred edges. We call this path the common path and the edges and nodes on this path the common edges and the common nodes. The goal of the protocol is for Alice and Bob to determine the common path. The protocol succeeds if and only if both Alice and Bob learn the common path. Figure 2 illustrates an example: Alice's preferred edges are indicated with blue arrows and Bob's preferred edges are indicated with red arrows, and the common leaf is indicated by a green circle. It is easy to see that if the channel is noiseless, Alice and Bob can determine the common path of a canonical protocol P by performing n rounds of communication. For this Alice and Bob move down on the tree together simply by following the path of preferred edges; they take turns and exchange one symbol of Σ per round, where each symbol indicates the next common node. We call this exchange the execution of the protocol P . 5.2 Natural Non-Adaptive Coding Schemes In this section, we present a non-adaptive coding scheme which can be viewed as a straightforward formalization of the natural high level approach presented in Section 3. This coding scheme tolerates the optimal error rate of 1/4 − ǫ when unique decoding and simultaneously the optimal error rate of 1/2−ǫ when list decoding. The coding scheme is furthermore simple, intuitive, and computationally 15 Algorithm 2 Natural Non-Adaptive Coding Scheme at Alice's Side B ∪ EA Receive edge-set E ′ E ← E ′ if E is a valid edgeset then 1: X ← the set of Alice's preferred edges; 2: EA ← ∅; 3: N ← 2n ǫ ; 4: for i = 1 to N do 5: 6: 7: 8: 9: 10: 11: 12: 13: Add one vote to this leaf r ← ∅ follow the common path in E if the common path ends at a leaf then else ⊲ EA is Alice's set of important edges. We preserve that always EA ⊆ X B; ⊲ E ′ B is the received version of Bob's important edge-set EB r ← {e} where e is the next edge in X continuing the common path in E (if any) else EA ← EA ∪ r Send EA 14: 15: 16: 17: 18: Output the leaf with the most votes for unique decoding 19: Output the O(1/ǫ) leaves with the most votes for list decoding Send EA efficient, but it makes use of a large O( n ǫ )-bit size alphabet. We note that one can also view this algorithm as a simplified version of the Braverman-Rao algorithm [5] with larger alphabet size and without using tree codes [10]. The algorithm, for which a pseudo code is presented in Algorithm 2, works as follows: In the course of the algorithm, Alice and Bob respectively maintain sets EA and EB which are a subset of their own preferred tree edges that are considered to be important. We call these important edge-sets or sometimes simple edge-sets. Initially these edge-sets are empty and in each iteration, Alice and Bob add one edge to their sets. In each iteration, when a party gets a turn to transmit, it sends its edge-set to the other party. The other party receives either the correct edge-set or a corrupted symbol which represents an edge-set made up by the adversary. In either case, the party combines the received edge-set with its own important edge-set and follows the common path in this set. Then, if this common path can be extended by the party's own set of preferred edges by a new edge e, the party adds this edge e to its edge-set, and sends this new edge-set in the next round. If, on the other hand, the common path already ends at a leaf, then the party registers this as a vote for this leaf and simply re-sends its old edge-set. In the end, both parties simply output the the leaf (respectively the O(1/ǫ) leaves) with the most votes for unique decoding (resp., for list decoding). Analysis We now prove that Algorithm 2 indeed achieves the optimal tolerable error rates for non-adaptive unique decoding and list decoding. Theorem 5.1. For any ǫ > 0, Algorithm 2 is a deterministic polynomial time non-adaptive simu- lator with alphabet size of O( n that tolerates an error-rate of 1/4 − ǫ for unique decoding, and also tolerates an error-rate of 1/2 − ǫ for list decoding with a list of size 1 ǫ . ǫ )-bits and round complexity 2n ǫ 16 Proof. Clearly, both EA and EB grow by at most one edge per round. Furthermore, the edges always attach to an already present edge and therefore, each of these edge-sets always forms a subtree with size at most N starting at the root of the tree of the canonical form, which has depth n. One can easily see that each such subtree can be encoded using O(N ) bits, e.g., by encoding each edge of the breadth first search traversal of the subtree using alphabet of size 3 (indicating "left", "right" or "up"). Hence, parties can encode their edge-sets using O( n ǫ )-bits symbols, which shows that the alphabet size is indeed as specified. We now prove the correctness of the algorithm, starting with that of unique decoding. Note that any two consecutive rounds in which Bob and Alice's transmissions are not corrupted by adversary, one of the following two good things happens: Either the path in EA ∪ EB gets extended by at least one edge, or both Alice and Bob receive a vote for the correct leaf. Now suppose that the simulation runs in N = 2n/ǫ rounds which can be grouped into n/ǫ round pairs. Given the error rate of 1/4 − ǫ at most a 1/2 − 2ǫ fraction of these round pairs can be corrupted, which leaves a total of N/2(1/2 + 2ǫ) uncorrupted round pairs. At most n of these round pairs grow the path while the remaining N/2(1/2 + 2ǫ) − n rounds vote for the correct leaf. This results in at least N (1/2 + 2ǫ) − ⌈n/2⌉ = n 2ǫ + 2n − n > N/4 out of N/2 votes being correct. For the list decoding, with error rate 1/2 − ǫ, we get that at most 1 − 2ǫ fraction of round-pairs are corrupted, and thus at least N ǫ = 2n uncorrupted pairs exist. Hence, the correct leaf gets a vote of at least 2n − n. Noting that the total number of the votes that one party gives to its leaves is N/2 = n ǫ , we get that the correct leaf has at least a ǫ fraction of all the votes. Therefore, if we output the 1/ǫ leaves with the most votes, the list will include the correct leaf. 5.3 Natural Adaptive Coding Scheme In this section we show that the simplest way to introduce adaptation into the natural coding scheme presented in Algorithm 2. In particular we use the simple rules specified as 3.7 and show that this leads to a coding scheme tolerating an error rate of 2/7 − ǫ, the optimal error rate for this setting. Next we explain how to incorporate the rules specified in 3.7 easily and efficiently into Algorithm 2. For this we note that for example if one party has a leaf with more than (2/7 − ǫ)N votes, since adversary has only budget of (2/7 − ǫ)N , this leaf is the correct leaf and thus the party can follow the second rule. Generalizing this idea, we use the rule that, if the party has a leaf v such that only at most N 7 votes are on leaves other than v, then the party can safely assume that this is the correct leaf. In our proof we show that this assumption is indeed safe and furthermore, at least one party can safely decode at the end of the first 6/7 fraction of the simulation. Since both parties know this in advance, if a party can not safely decode after 6/7 fraction of the time, it knows that the other party has safely decoded -- which corresponds to the condition in the first rule -- and in this case, the party only listens for the last 1/7 fraction of the protocol. The pseudo code for this coding scheme is presented in Algorithm 3. Theorem 5.2. Algorithm 3 is a deterministic adaptive coding scheme with alphabet size of O( n bits, round complexity of O( n of 2/7 − ǫ for unique decoding. ǫ )- ǫ ), and polynomial computational complexity that tolerates an error-rate Proof. First, we show that if at the end of 6N 7 of 7 which are dedicated to one leaf v, then this party can safely assume that this leaf v is the correct leaf. Proof of this part is by a simply contradiction. Note that if the party has s votes, then rounds, one party has t votes, s ≥ t − N 17 Algorithm 3 Natural Adaptive Coding Scheme at Alice's Side B; ǫ ); B ∪ EA 7 N do Receive edge-set E ′ E ← E ′ if E is a valid edgeset then 1: X ← the set of Alice's preferred edges; 2: EA ← ∅; 3: N ← Θ( n 4: for i = 1 to 6 5: 6: 7: 8: 9: 10: 11: 12: 13: Add one vote to this leaf r ← ∅ follow the common path in E if the common path ends at a leaf then else r ← {e} where e is the next edge in X continuing the common path in E (if any) else 7 do Send EA EA ← EA ∪ r Send EA 7 then for i = 1 to N 14: 15: 16: 17: 18: Let s be number of votes of the leaf with the most votes and t be the total number of votes 19: if s ≥ t − N 20: 21: 22: else 23: 24: 25: 26: 27: 28: 29: Output the leaf with the most votes follow the common path in E if the common path ends at a leaf then Receive edge-set E ′ B; E = E ′ if E is a valid edge-set then Add one vote to this leaf for i = 1 to N Send EA B ∪ EA 7 do 7 ≥ 2N 7 − t + t − N there are at least 3N 7 − t that either stopped the growth of the path or turned an edge-set into a nonvalid edge-set. Furthermore, if v is not the correct leaf, then the votes v are created by errors of adversary which means that adversary has invested s errors on turning the edge-sets sent by the other party into other valid-looking edge-sets. Hence, in total, adversary has spent at least 3N 7 − t + s ≥ 3N 7 errors which is a contradiction. Now that we know that the rule for safely decoding at the end of 6N 7 rounds is indeed safe, we show that at least one party will safely decode at that point of time. Suppose that no party can decode safely. Also assume that Alice has tA votes, rA of which are votes on the good leaf. That means at least adversary has turned at least tA − rA edge-sets sent by Bob into other valid-looking edge-sets. Similarly, tB − rB errors are introduced by the adversary on edge-sets sent by Alice. If neither Alice nor Bob can decode safely, we know that tA − rA ≥ N 7 , which means that in total, adversary has introduced at least 2N 7 errors. Since this is not possible give adversary's budget, we conclude that at the end of 6N 7 rounds, at least one party decodes safely. 7 and tB − rB ≥ N Now suppose that only one party, say Alice, decodes safely at the end of 6N 7 rounds. Then, in the last N 7 rounds, Bob is listening and Alice is sending. In this case, we claim that Bob's leaf that gets the majority of the votes at the end is the correct leaf. The reason is, suppose that Bob has 18 7 rounds and t′ tB votes from the first 6N the correct leaf had rB votes from the first 6N the adversary has introduced at least ( 3N errors. Since adversaries budget is at most ( 2 clearly Bob has at most 4N 7 − tB) + ( N B) + (tB − rB) + (t′ 7 − ǫ)N , we get that rB + r′ 7 votes in total, the correct leaf has the majority. 7 − t′ B votes from the last N 7 rounds and r′ 7 rounds. Furthermore, suppose that B votes from the last N 7 rounds. Then, 7 − rB + r′ B 7 . Hence, since B − r′ B > 2N B) = 4N 6 Coding Schemes with Small Alphabet and O(n2) Rounds In this section, we show how to implement the natural coding schemes presented as Algorithms 2 and 3 over a channel supporting only constant size symbols at the cost of increasing the number of rounds to O(n2). ǫ3 ) symbols and send this encoding in O( n ǫ2 ), using an ECC with relative distance 1 − ǫ/10, alphabet size O( 1 ǫ3 ) rounds. We call each such O( n To emulate Algorithms 2 and 3 over a finite alphabet, we use Error Correcting Codes (ECC) and list decoding. In particular, on the transmission side, we encode each edge-set, which will have size at most O( n ǫ ), and code-length O( n ǫ3 ) rounds related to transmission of one edge-set a block. On the receiver side, we use a list decoder to produce a list of O( 1 ǫ ) edge-sets such that, if the error-rate in the block is at most 1 − ǫ/3, then one of the edge-sets in the list in indeed equal to the transmitted edge-set. If the error-rate is greater than 1 − ǫ/3, the list provided by the list decoder does not need to provide any guarantee. We use O( n to O( n each of these edge-sets to the set of important edges leads to the list decoding result: ǫ3 ) rounds for each block as because of list decoding, now each edge-set contains up ǫ ) edges in Algorithms 2 and 3). Adding edges corresponding to ǫ2 ) edges (compare to O( n Lemma 6.1. If the error rate is at most 1/2 − ǫ, then in both parties, the set of O(1/ǫ2) leaves with the highest votes includes the correct leaf. Proof. This is because, with error-rate 1/2 − ǫ, the adversary can corrupt at most 1/2 − ǫ/3 blocks beyond corruption rate of 1 − ǫ/3. Hence, we are now in a regime that at most 1/2 − ǫ/3 fraction of edge-sets are corrupted, each corrupted possibly even completely, and for every other edge- set, the (list) decoding includes the correct transmitted edge-set. Hence, similar to the proof of Theorem 5.1, we get that the correct leaf gets a vote of at least Ω(ǫN ). On the other hand, now each block might give a vote of at most O(1/ǫ) to different leaves and thus, the total weight is at most O(N/ǫ). Therefore, the correct leaf is within the top O(1/ǫ2) voted leaves. We next explain a simple idea that allows us to extend this result to unique decoding; specifically non-adaptive unique decoding when error-rate is at most 1/4 − ǫ, and adaptive unique decoding when error-rate is at most 2/7 − ǫ. The idea is to use a variation of Forney's technique for decoding concatenated codes [7]. Recall that each received edge-set might lead to two things: (1) extending the common path, or (2) adding a vote to a leaf. While we keep the first part as above with list decoding, we make the voting weighted. In particular, in the receiver side, we take each edge-set leading to a leaf (when combined with local important edge set) as a vote for the related leaf but we weight this vote according to the hamming-distance to the received block. More precisely, if the edge-set has relative distance δ from the received block, the related leaf gets a vote of max{1 − 2δ, 0}. Using this weighting function, intuitively we have that if the adversary corrupts an edge-set 2 corruption rate, even though the edge-sets gets added to the set of important edges, in the to 1 19 weighting procedure this edge-set can only add at most weight 2ǫ to any (incorrect) leaf. Hence, for instance if the adversary wants to add a unit of weight to the votes of an incorrect leaf, it has to almost completely corrupt the symbols of the related block. Lemma 6.2. If the error rate is at most 1/4 − ǫ, then in both parties, the leaf with the highest weighted votes is the correct leaf. Proof. We show that the correct leaf ug get strictly more weighted votes compared to any other leaf ub. For this, we use a potential Φ = W (ug) − W (ub), that is, the total weight added to the good leaf minus that of the bad leaf, and we show this potential to be strictly positive. Let Pc be the set of edges of the correct path. Let t be the time at which point the common path in EA ∪ EB ∪ Pc ends in a leaf. First note that for each two consecutive blocks before time t in which the corruption rate is at most 1 − ǫ/3, the common path in EA ∪ EB ∪ Pc gets extended by (at least) one edge (towards the correct leaf). Hence, at most n such ("not completely corrupted") block pairs are spent on growing the common path in EA ∪ EB ∪ Pc and also, t happens after at most N 2(1/2 − 2ǫ)(1 + ǫ/3) < N (1 − 2ǫ) < N − 4n blocks. That is, t happens at least 4n blocks before the end of the simulation. Before time t, we do not add any weight to W (ug) but each block corrupted with rate x ≥ 1/2 changes Φ in the worst case as 1 − 2x ≤ 0. For each block after time t, each block corrupted with rate x ∈ [0, 1 − ǫ/3] changes Φ in the worst case by 1 − 2x and each block corrupted to rate x ∈ (1 − ǫ/3, 1] changes Φ by at most −1. These two cases can be covered as a change of no worse than 1 − 2(1 + ǫ/3)x. In total, since adversary's error rate is at most (1/4 − ǫ), in total of before and after time t, we get that it can corrupt at most 1/2 − 2ǫ fraction of the receptions of one party and thus, Φ ≥ 1 − 2(1/2 − 2ǫ)(1 + ǫ/3) ≥ 3ǫ > 0. For the 2/7 − ǫ adaptive algorithm, we first present a lemma about the total weight assigned to the leaves due to one edge-set reception. Lemma 6.3. For each list decoded block that has corruption rate ρ, the summation of the weight given to all the codewords in the list is at most 1 − 2ρ + 3ǫ/5. Proof. First we show that only at most 3 codewords receive nonzero weight. The proof is by contradiction. Suppose that there are 4 codewords x1 to x4 that each agree with the received string x in at least ǫ/10 fraction of the symbols. Furthermore, for each xi, let Si be the set of coordinates where xi agrees with the received string x. Let ℓ be the length of string x. Note that ∀i 6= j ∈ {1, 2, 3, 4}, Si ≥ ℓ/2 and Si ∩ Sj ≤ ǫ/10. Hence, with a simple inclusion-exclusion, we have ℓ ≥ ∪i Si ≥ X Si −X 4ℓ 2 6ǫ 10 Si ∩ Sj ≥ − > ℓ, which is a contradiction. i i<j Having that at most 3 codewords receive nonzero weight, we now conclude the proof. Let x1 to x3 be the codewords that receive nonzero weights and assume that x1 is the closest codeword to x. We have ∀i > 1, ∆(x, xi) ≥ ∆(x1, xi) − ∆(x, x1) ≥ 1 − ǫ/10 − 1/2 ≥ 1/2 − ǫ/10. Thus, the weight that x2 or x3 get is at most 2ǫ/10. On the other hand, ∆(x1, x) ≥ min{ρ, 1 − ǫ/10 − ρ} = 1 − ǫ/10 2 − 1 − ǫ/10 2 − ρ. 20 Thus, the weight that x1 receives is at most ǫ/10 + 1 − ǫ/10 − 2ρ ≤ 2ǫ/10 + 1 − 2ρ. Summing up with the weight given to x2 and x3, we get that the total weight given to all codewords is at most 3ǫ/5 + 1 − 2ρ. The algorithm is as in Algorithm 3, now enhanced with list decoding and weighted voting. In the end of the 6N rounds, a party decodes safely (and switched to only transmitting after that) if 7 for the leaf u that has the most votes, the following holds: Ψ = W (u)+W∅−W (v) > 1/7 where here, W (v) is the weighted vote of the second leaf that has the most votes and W∅ is the total weight for decoded codewords that are inconsistent with the local important edge set (and thus mean an error). We call Ψ the parties confidence. N The following lemma serves as completing the proof of Theorem 3.1. Lemma 6.4. If the error rate is at most 2/7 − ǫ, then in the end, in both parties, the leaf with the highest weighted votes is the correct leaf. Proof. We first show that at the end of the first 6N/7 rounds, at least one party has confidence at least 1/7 + ǫ/2. For this, we show the summation of the confidence of the two parties to be at least 2/7 + ǫ. The reasoning is similar to the proof that of Lemma 6.2. Let t be the time at which point the common path in EA ∪ EB ∪ Pc ends in a leaf and note that for each two consecutive blocks before time t in which the corruption rate is at most 1 − ǫ/3, the common path in EA ∪ EB ∪ Pc gets extended by (at least) one edge (towards the correct leaf). Hence, at most n such ("not completely corrupted") block pairs are spent on growing the common path in EA ∪ EB ∪ Pc. Furthermore, t happens after at most 2 · N (2/7 − ǫ)(1 + ǫ/3) < N (4/7 − ǫ) blocks. Specifically, t happens at least N (2/7 + ǫ) blocks before the end of the first 6N/7 blocks. On the other hand, for each corruption rate x on one block, only the confidence of the party receiving it gets effected and in worst case it goes down by 1−2x(1+ǫ/3) . Since the adversary's total budget is N (2/7 − ǫ), at the end of the first 6N/7 rounds, the summation of the confidence of the two parties is at least 6N/7−2n−2N (2/7−ǫ)(1+ǫ/3) N N ≥ N (2/7 + ǫ). Now we argue that if a party decodes at the end of 6N/7 blocks because it has confidence at least 1/7, then the decoding of this party is indeed correct. Proof is by contradiction. Using Lemma 6.3, each block with corruption rate x can add a weight of at most max{2x − 1 + 3ǫ/5, 0} to the set of bad leaves or those incorrect codeword edge-sets that do not form a common path with the local edge-sets, i.e., the weight given to W∅. Hence, knowing that the adversary has budget of N (2/7 − ǫ), it can create a weight of at most 2N (2/7 − ǫ) − N/3(1 − 3ǫ/5) < N/7 − ǫ/5 < N/7, which means that there can not be a confidence of more than 1/7 on an incorrect leaf. The above shows that at least one party decides after 6N/7 blocks and if a party decides then, it has decided on the correct leaf. If a party does not decide, it listens for the next N/7 blocks where the other party is constantly transmitting. It is easy to see that in this case, this leaf that has the maximum vote in this listening party is the correct party. 7 Adaptivity in the Shared Randomness Setting In this section, we present our positive and negative results for adaptive protocols with access to shared randomness. In the shared randomness setting of Franklin et al. [8] Alice and Bob have access to a shared random string that is not known to the adversary. As shown in Fanklin et al. [8] the main advantage 21 of this shared randomness is that Alice and Bob can use a larger communication alphabet for their protocol and agree on using only random subset of it which is independent from round to round. Since the randomness is not known to the adversary any attempt at corrupting a transmission results with good probability on an unused symbol. This makes most corruptions detectable to Alice and Bob and essentially results in corruptions being equivalent to erasures. Fanklin et al. call this way of encoding the desired transmissions into a larger alphabet to detect errors a blue- berry code. It is well known for error correcting codes that erasures are in essence half as bad as corruption. Showing that the same holds for the use of tree codes in the algorithm of Braverman and Rao translates this factor two improvement to the interactive setting. For non-adaptive protocols this translates into a tolerable error rate of 1/2 − ǫ instead of a 1/4 − ǫ error rate. In what follows we show that allowing adaptive protocols in this setting allows to further rise the tolerable error rate to 2/3 − ǫ. We also show that no coding scheme can tolerate more than an 2/3 error rate: Theorem 7.1. [The second part of Theorem 3.3] In the shared randomness setting there is no (deterministic or randomized) adaptive protocol that robustly simulates the Exchange Protocol for an error rate of 2/3 with an o(1) failure probability even when allowing computationally unbounded protocols that use an arbitrarily large number of rounds and an unbounded alphabet. With the intuition that in the shared randomness setting corruptions are almost as bad as erasures we prove Theorem 7.1 directly for an strictly weaker adversary, which can only delete transmitted symbols instead of altering them to other symbols. Formally, when the adversary erases the transmission of a party, we say that the other party receives a special symbol ⊥ which identifies the erasure as such. Proof. Suppose that there is a coding scheme with N rounds that allows Alice and Bob exchange their input bits, while the adversary erases at most 2N/3 of the transmissions. Consider each party in the special scenario in which this party receives a ⊥ symbol whenever it listens. Let xA and xB be the (random variable of) the number of rounds where, respectively, Alice and Bob listen when they are in this special scenario. Suppose this number is usually small for one party, say Alice. That is, suppose we have Pr[xA ≤ 2N/3] ≥ 1/3. In this case the adversary gambles on the condition xA ≤ 2N/3 and simply erases Bob's transmission whenever Alice listens and Bob transmits. Furthermore, if both parties listen, the adversary delivers the symbol ⊥ to both parties at no cost. This way, with probability at least 1/3, Alice stays in the special scenario while the adversary adheres to its budget of at most 2N/3 erasures. Since, in this case, Alice only receives the erasure symbol she cannot know Bob's input. Therefore, if the adversary chooses Bob's input to be a random bit the output of Alice will be wrong with probability at least 1/2 leading to a total failure probability of at least 1/6. If on the other hand Pr[xA ≤ 2N/3] ≤ 1/3 and Pr[xB ≤ 2N/3] ≤ 1/3, then even a union bound shows that Pr[(xA ≥ 2N/3) ∧ (xA ≥ 2N/3)] ≥ 1/3. In this case, the adversary tries to erase all transmissions of both sides. Indeed, if xA ≥ 2N/3 and xA ≥ 2N/3 this becomes possible because in this case there must be are at least N/3 rounds in which both parties are listening simultaneously. For these rounds, the adversary gets to deliver the erasure symbol to both sides at no cost. In this case, which happens with probability 1/3 there remain at most 2N/3 rounds in which one of the parties listens alone which the adversary can erase without running out of budget. With probability Pr[(xA ≥ 2N/3) ∧ (xA ≥ 2N/3)] > 1/3 the adversary can thus prevent both parties from learning the other party's input. Choosing the inputs randomly results in at least one party 22 being wrong in its decoding with probability 3/4 which in total leads to a failure probability of at least 1/3 · 3/4 > 1/6. Turning to positive results we first show how to solve the Exchange Problem robustly with an error rate of 2/3 − ǫ. While this is a much simpler setting it already provides valuable insights into the more complicated general case of robustly simulating arbitrary n-round protocols. For simplicity we stay with the adversary who can only erase symbols. Our general simulation result presented in Theorem 7.4 works of course for the regular adversary. Lemma 7.2. Suppose ǫ > 0. In the shared hidden randomness model with rate adaptation there is a protocol that solves the Exchange Problem in O(1/ǫ) rounds under an adversarial erasure rate of 2/3 − ǫ. Proof. The protocol consists of 3/ǫ rounds grouped into three parts containing 1/ǫ rounds each. In the first part Alice sends her input symbol in every round while Bob listens. In the second part Bob sends his input symbol in each round while Alice listens. In the last part each of the two parties sends its input symbol if and only if they have received the other parties input and not just erasures during the first two parts; otherwise a party listens during the last part. Note that the adversary has a budget of 3/ǫ · (2/3 − ǫ) = 2ǫ − 1 erasures which is exactly one erasure to little to erase all transmission during the first two parts. This results in at least one party learning the other party's input symbol. If both parties learn each others input within the first two rounds then the algorithm succeeded. If on the other hand one party, say without loss of generality Alice, only received erasures then Bobs received her input symbol at least once. This results in Bob sending his input symbol during the last part while Alice is listens. Bob therefore sends his input symbol a total of 2/ǫ times while Alice listens. Not all these transmissions can be erased and Alice therefore also knows Bob's input symbol in the end. Lemma 7.2 and even more the structure of the robust Exchange Protocol presented in its proof already give useful insights into how to achieve a general robust simulation result. We combine these insights with the blue-berry code idea of [8] to build what we call an adaptive exchange block. An adaptive exchange block is a simple three round protocol which will serve as a crucial building block in Theorem 7.4. An adaptive exchange block is designed to transmit one symbol σA ∈ Σ from Alice to Bob and one symbol σB ∈ Σ from Bob to Alice. It assumes a detection parameter δ < 1 and works over an alphabet Σ′ of size Σ′ = ⌈Σ/δ⌉ and works as follows: First, using the shared randomness, Alice and Bob use their shared randomness to agree for each of the three rounds on an independent random subset of of the larger communication alphabet Σ′ to be used. Then, in the first round of the adaptive exchange block Alice sends the agreed equivalent of σA while Bob listens. In the second round Bob sends the equivalent of σB while Alice listens. Both parties try to translate the received symbol back to the alphabet σ and declare a (detected) corruption if this is not possible. In the last round of the adaptive exchange block a party sends the encoding of its σ-symbol if and only if a failure was detected; otherwise a party listens and tries again to decode any received symbol. The following two properties of the adaptive exchange block easily verified: Lemma 7.3. Regardless of how many transmissions an adversary corrupted during an adaptive exchange block, the probability that at least one of the parties decodes a wrong symbol is at most 3δ. In addition, if an adversary corrupted at most one transmission during an adaptive exchange block the with probability at least 1 − δ both parties received their σ symbols correctly. 23 Proof. For a party to decode to a wrong symbol it must be the case that during one of the three rounds the adversary hit a meaningful symbol in the alphabet Σ′ during a corruption. Since Σ/Σ′ ≤ δ this happens at most with probability δ during any specific round and at most with probability 3δ during any of the three rounds. To prove the the second statement we note that in order for a decoding error to happen the adversary must interfere during the first two rounds. With probability 1 − δ such an interference is however detected leading to the corrupted party to resend in the third round. Next we explain how to use the adaptive exchange block together with the ideas of [8] to prove that adaptive protocols with shared randomness can tolerate any error rate below 2/3: Theorem 7.4. [The first part of Theorem 3.3] Suppose Π is an n-round protocol over a constant bit-size alphabet. For any ǫ > 0, there is an adaptive protocol Π′ that uses shared randomness and robustly simulates Π for an error rate of 2/3 − ǫ with a failure probability of 2−Ω(n). rounds which are grouped into 2n Proof Sketch. The protocol Π′ consists of N = 6n ǫ adaptive ǫ exchange blocks. The adversary has an error budget of 4n ǫ − 6n corruptions. Choosing the with parameter δ in the exchange blocks to be at most ǫ/(6 · 4 + 1) and using Lemma 7.3 together with a Chernoff bound gives that with probability 1 − 2−Ω(n) there are at most n/4 adaptive exchange blocks in which a wrong symbol is decoded. Similarly, the number of adaptive exchange blocks in which only one corruption occurred but not both parties received correctly is with probability 1 − 2−Ω(n) at most n/3. Lastly, the number of adaptive exchange blocks in which the adversary can force an erasure by corrupting two transmissions is at most ( 4n ǫ − 6n)/2. We can therefore assume that regardless of the adversaries actions at most n corruptions and at most 2n ǫ − 8/3n erasures happen during any execution of Π′, at least with the required probability of 1 − 2−Ω(n). We can now apply the arguments given in [8]. These arguments build on the result in [5] and essentially show that detected corruptions or erasures can essentially be counted as half a corruption. Since almost all parts of the lengthy proofs in [5] and [8] stay the same, we restrict ourselves to a proof sketch. For this we first note that the result in [5] continues to hold if instead of taking turns transmitting for N rounds both Alice and Bob use N/2 rounds transmitting their next symbol simultaneously. The extensions described in [8] furthermore show that this algorithm still performs a successful simulation if the number effectively corrupted simultaneous rounds is at least n rounds less than half of all simultaneous rounds. Here the number of effectively corrupted simultaneous rounds is simply the number of simultaneous rounds with an (undetected) corruption plus half the number of simultaneous rounds suffering from an erasure (a detected corruption). Using one adaptive exchange block to simulate one simultaneous round leads to 2n ǫ simultaneous rounds and an effective number of corrupted rounds of n/4 + ( 2n ǫ )/2 − n. Putting everything together proves that with probability at least 1 − 2−Ω(n) the protocol Π′ successfully simulates the protocol Π, as claimed. ǫ − 8/3n)/2 < ( 2n This way of constructing the adaptive protocol Π′ leads to an optimal linear number of rounds and a constant size alphabet but results in exponential time computations. We remark that using efficiently decodable tree codes, such as the ones described in the postscript to [10] on Schulman's webpage, one can also obtain a computationally efficient coding scheme at the cost of using a large O(n)-bit alphabet. Lastly, applying the same ideas as in Section 6 also allows to translate this computationally efficient coding schemes with a large alphabet into one that uses a constant size alphabet but a quadratic number of rounds. 24 References [1] Z. Brakerski and Y. Kalai. Efficient interactive coding against adversarial noise. In Proceedings of the IEEE Symposium on Foundations of Computer Science (FOCS), pages 160 -- 166, 2012. [2] Z. Brakerski and M. Naor. Fast algorithms for interactive coding. In Proceedings of the ACM- SIAM Symposium on Discrete Algorithms (SODA), pages 443 -- 456, 2013. [3] M. Braverman. Coding for interactive computation: progress and challenges. In Allerton Conference on Communication, Control, and Computing (Allerton), pages 1914 -- 1921, 2012. [4] M. Braverman. Towards deterministic tree code constructions. In Proceedings of the Innova- tions in Theoretical Computer Science Conference (ITCS), pages 161 -- 167, 2012. [5] M. Braverman and A. Rao. Towards coding for maximum errors in interactive communication. In Proceedings of the ACM Symposium on Theory of Computing (STOC), pages 159 -- 166, 2011. [6] K.-M. Chung, R. Pass, and S. Telang. Knowledge preserving interactive coding. Proceedings of the IEEE Symposium on Foundations of Computer Science (FOCS), 2013. [7] G. D. Forney. Concatenated codes. PhD thesis, MIT, 1966. [8] M. Franklin, R. Gelles, R. Ostrovsky, and L. J. Schulman. Optimal coding for streaming In Proceedings of International Cryptology authentication and interactive communication. Conference (CRYPTO), pages 258 -- 276, 2013. [9] M. Ghaffari and M. Haeupler. Optimal Error Rates for Interactive Coding II: Efficiency and List decoding. In arXiv, 2013. [10] L. J. Schulman. Coding for interactive communication. IEEE Transactions on Information Theory, 42(6):1745 -- 1756, 1996. [11] M. Sudan. Decoding of reed solomon codes beyond the error-correction bound. Journal of Complexity, 13(1):180 -- 193, 1997. A Adaptivity as a Natural Model for Shared-Medium Channels In this section we briefly describe two natural interpretations of our adaptivity setting as modeling communication over a shared medium channel (e.g., a wireless channel). We first remark that one obvious parallel between wireless channels (or generally shared medium channels) and our model is that full-duplex communication, that is, sending and receiving at the same time, is not possible. Beyond this, one natural interpretation relates our model to a setting in which the signals used by these two parties are not much stronger than the average background noise level. In this setting having the background noise corrupt the signal a ρ fraction of the time in an undetermined way is consistent with assuming that the variable noise level will be larger than the signal level at most this often. It is also consistent with the impossibility of distinguishing between the presence and absence of a signal which leads to undetermined signal decodings in the case that both parties listen. As always, the desire to avoid making possibly unrealistic assumptions about these corruptions 25 naturally gives rise to think of any undetermined symbols as being worst case or equivalently as being determined by an adversary. In a second related interpretation of our model one can think of the adversary as an active malicious entity that jams the shared medium. In this case our assumptions naturally correspond to the jammer having an energy budget that allows to over-shout a sent signal at most a ρ fraction of the time. In this setting it is also natural to assume that the energy required for sending a fake signal to both parties when no signal is present is much smaller than corrupting sent signals, and does as such not significantly reduce the jammer's energy budget. B Further Results Supporting the Invariability Hypothesis In this section we mention several results that further support the Invariability Hypothesis. We first remark that the lower bound in this paper are, in all settings and all properties, already as strong as required by the hypothesis. Our positive results, as summarized in Corollary 3.6, furthermore show that the invariability hypothesis holds if one allows either a large alphabet or a quadratic number of rounds. Both assumptions lead to the communication rate being O(1/n). Next we list several results which show that the invariability hypothesis provably extends beyond these low rate settings: 1. Subsequent results in [9] show that: The IH is true for all eight settings when allowing randomized algorithms with exponentially small failure probability and a round blowup of (log∗ n)O(log∗ n). 2. Subsequent results in [9] show that: The Invariability Hypothesis is true for all eight settings if one removes points 5. and 6., that is, when one can use randomized protocols that can generate private and public encryption keys which the adversary cannot break. 3. A subsequent result in [9] gives an efficient randomized coding scheme for non-adaptive unique decoding which tolerates the optimal 1/4−ǫ error rate. This improves over the coding scheme of Brakerski-Kalai [1] which requires an error rate below 1/16. In different terms this result shows that: The Invariability Hypothesis is true for unique decoding if one weakens point 5. efficient randomized algorithms with exponentially small failure probability. to allow 4. The result of Braverman and Rao [5] shows that: The Invariability Hypothesis is true for non-adaptive unique decoding if one removes point 4. (which requires protocols to be computationally efficient). 5. A subsequent result of the authors show that the 1/10 − ǫ distance parameter of the tree code construction in [4] can be improved to 1 − ǫ which shows that: The Invariability Hypothesis is true for unique decoding if one weakens point 4. deterministic sub-exponential time computations. to allow 6. The improved tree code construction mentioned in point 5. can also be used together with the analysis of Franklin at al. [8] to show that: The Invariability Hypothesis is true for non-adaptive unique decoding with shared randomness if one weakens point 4. to allow deterministic sub-exponential time computations. 26 7. The improved tree code construction mentioned in point 5. can also be used together with the ideas of Theorem 7.4 to show that: The Invariability Hypothesis is true for adaptive unique decoding with shared randomness if one weakens point 4. to allow deterministic sub-exponential time computations. Lastly, we remark that the 1/6 − ǫ tolerable error rate of the knowledge preserving coding schemes given by Chung et al. [6] can be improved to the optimal 1/4 − ǫ tolerable error rate of the unique decoding setting. The communication blowup for knowledge preserving protocols is however inherently super constant. C Impossibility Results for List Decodable Interactive Coding Schemes In this section we prove that list decodable interactive coding schemes are not possible beyond an error rate of 1/2. This holds even if adaptivity or shared randomness is allowed (but not both). We remark that for both results we prove a lower bound for the n-bit Exchange Problem as list decoding with a constant list size becomes trivial for any protocol with only constantly many different inputs. The intuitive reason why shared randomness does not help in non-adaptive protocols to go beyond an error rate of 1/2 is because the adversary can completely corrupt the party that talks less: Lemma C.1. There is no (deterministic or randomized) list decodable non-adaptive protocol that robustly simulates the n-bit Exchange Protocol for an error rate of 1/2 with an o(1) failure probability and a list size of 2n−1 regardless of whether the protocols have access to shared randomness and regardless of whether computationally unbounded protocols that use an arbitrarily large number of rounds and an unbounded alphabet are allowed. Proof. We recall that non-adaptive protocols will for every round specify a sender and receiver in advance, that is, independent from the history of communication. We remark that the proof that follows continues to hold if these decisions are based on the shared randomness of the protocols. The adversary's strategy is simple: It gives both Alice and Bob random inputs, then randomly picks one of them, and blocks all symbols sent by this party by replacing them with a fixed symbol from the communication alphabet. With probability at least 1/2 the randomly chosen player speaks less than half the time and so the fraction of errors introduced is at most 1/2. On the other hand no information about the blocked player's input is revealed to the other player and so other player can not narrow down the list of possibilities in any way. This means that even when allowed a list size of 2n−1 there is a probability of 1/2 that the list does not include the randomly chosen input. This results in a failure probability of at least 1/4. A 1/2 impossibility result also holds for list decodable coding schemes that are adaptive: Lemma C.2. There is no (deterministic or randomized) list decodable adaptive protocol that ro- bustly simulates the n-bit Exchange Protocol for an error rate of 1/2 with an o(1) failure probability and a list size of 2n−1 even when allowing computationally unbounded protocols that use an arbi- trarily large number of rounds and an unbounded alphabet. 27 To show that adaptivity is not helpful, one could try to prove that the adversary can imitate one party completely without being detected by the other party. This, however, is not possible with an error rate of 1/2 because both parties could in principle listen for more than half of the rounds if no error occurs and use these rounds to alert the other party if tempering is detected. Our proof of Lemma C.2 shows that this "alert" strategy cannot work. In fact, we argue that it is counterproductive for Alice to have such a hypothetical "alert mode" in which she sends more than half of the rounds. The reason is that the adversary could intentionally trigger this behavior while only corrupting less than half of the rounds (since Alice is sending alerts and not listening during most rounds). The adversary can furthermore do this regardless of the input of Bob which makes it impossible for Alice to decode Bob's input. This guarantees that Alice never sends for more than half of the rounds and the adversary can therefore simply corrupt all her transmissions. In this case Bob will not be able to learn anything about Alice's input. Proof. Suppose there exists a protocol that robustly simulates the n-bit Exchange Pro tocol for an error rate of 1/2 using N rounds over an alphabet Σ. We consider pairs of the form (x, ~r) where x ∈ {0, 1}n is an input to A lice and ~r = (r1, r2, . . . , rN ) ∈ ΣN is a string over the chann el alphabet with one symbol for each round. We now look at the following hypothetical communication between Alice and the adversary: Alice gets input x and samples her private randomness. In each round she then decides to send or listen. If she listens in round i she receives the symbol ri. For every pair (x, ~r) we now define p(x, ~r) to be the probability, taken over the private randomness of Alice, that in this communication Alice sends at least N/2 rounds (and conversely listens for at most N/2 rounds). The adversaries strategy now makes the following case distinction: If there is one (x, ~r) for which p(x, ~r) > 1/2 then the adversary picks a random input for Bob, gives Alice input x and during the protocol corrupts any symbol Alice listens to according to ~r. By definition of p(x, ~r) there is a probability of at least 1/2 that the adversary can do this without using more than N/2 corruptions. In such an execution Alice has furthermore no information on Bob's input and even when allowed a list size of 2n−1 has at most a probability of 1/2 to include Bob's input into her decoding list. Therefore Alice will fail to list decode correctly with probability at least 1/4. If on the other hand for every (x, ~r) it holds that p(x, ~r) < 1/2 then the adversary picks a random input for Alice and an arbitrary input for Bob and during the protocol corrupts any symbol Alice sends to a fixed symbol σ ∈ Σ. Furthermore in a round in which both Alice and Bob listens it chooses to deliver the same symbol σ to Bob. By definition of p(x, ~r) there is a probability of at least 1/2 that the adversary can do this without using more than N/2 corruptions. In such an execution Bob now has no information on Alice's input and even when allowed a list size of 2n−1 he therefore has at most a probability of 1/2 to include Alice's input into his decoding list. This leads to a failure probability of 1/4 as well. D Impossibility Results for Solving the Exchange Problem Adap- tively In this appendix we provide the proofs we deferred in Section 4. For completeness and to also cover randomized protocols we first reprove Claim 10 of [5] which states that no non-adaptive uniquely decoding protocol can solve the exchange problem for an error rate of 1/4: 28 Lemma D.1 (Claim 10 of [5]). There is no (deterministic or randomized) protocol that robustly simulates the Exchange Protocol for an error rate of 1/4 with an o(1) failure probability even when allowing computationally unbounded protocols that use an arbitrarily large number of rounds and an unbounded alphabet. Proof. Suppose that there is an algorithm A with no rate adaptation that solves the exchange problem under adversarial error-rate 1/4, in N rounds. We work simply with 1-bit inputs. Let SX,Y denote the setting where Alice receives input X and Bob gets input Y . For simplicity, we first ignore the rounds in which both parties listen; note that in those rounds the adversary can deliver arbitrary messages to each of the parties at no cost. First we explain adversary's strategy for setting S0,1: Consider the executions of A in setting S0,0 with no interference from the adversary. Without loss of generality, we can assume that in this execution, with probability at least 1/2, Alice listens in at most 1/2 of the rounds. Noting the restriction that A has no rate-adaptivity, we get that in setting S0,0, regardless of the adver- sary's interferences, with probability at least 1/2, Alice listens alone in at most 1/2 of the rounds. Adversary generates a dummy personality gBob0 by simulating algorithm A on Bob (and Alice) in setting S0,0 with no interferences. This dummy personality is then used in setting S0,1. Note that at the start, only Bob can distinguish S0,1 from S0,0. For the first N/4 times that Alice listens alone in S0,1, the adversary connects Alice to the dummy gBob0, that is, Alice receives transmis- sions of gBob0. Thus, up to the point that Alice has listened alone for N/4 rounds, Alice receives inputs (with distribution) exactly as if she was in setting S0,0 with real Bob and hence, she can not distinguish this setting from the setting S0,0 with no adversarial interference. After this point, the adversary lets Alice talk freely with Bob with no interference. We now explain adversary's strategy for setting S0,0: The adversary generates another dummy personality gBob1 by simulating algorithm A on Bob (and Alice) in setting S0,1 where the first N/4 listening-alone rounds of Alice were connected to gBob0. That is, exactly the situation that will happen to real Bob in setting S0,1. For the first N/4 rounds of setting S0,0 where Alice listens, the adversary does not interfere in the communications. After that, for the next N/4 rounds that Alice listens, the adversary delivers transmissions of dummy personality gBob1 to Alice. To conclude the argument, the adversary give a random input y ∈ {0, 1} input to Bob and gambles on that Alice will be listening alone less than 1/2 of the rounds. The adversary also uses the dummy personality gBobi for i = 1 − y and when Alice listens alone, the adversary connects Alice to the real Bob or this dummy personality according to the rules explained above. With probability at least 1/2, Alice indeed listens in at most N/2 rounds. If this happens, due to the adversarial errors, the two settings look identical to Alice (more formally, she observes the same probability distributions for the inputs) and she can not distinguish them from each other. This means that algorithm A has a failure probability of at least 1/4 (Alice can still guess y but the guess would be incorrect with probability at at least 1/8). We finally explain the adversary's rules for treating the rounds where both parties listen: For setting S0,0, if both Alice and the real Bob are listening, Alice is connected to gBob1 at no cost. Similarly, in setting S0,1, if both Alice and real Bob are listening, then Alice is connected to gBob0 at no cost. To make sure that this definition does not have a loop, if for a round r, both parties are listening in both settings, then the adversary delivers a 0 to Alice in both settings. Note that in using these rules, the behavior of the dummy personalities gBob0 and gBob1 are defined recursively based on the round number; for example, the simulation that generates the behavior of gBob0 in 29 round r might use the behavior of gBob1 in round r − 1. Because of these rules, we get that in each round that Alice listens (at least until Alice has had N/2 listening-alone rounds), the messages that she receives have the same probability distribution in two settings and thus, the two settings look indistinguishable to Alice. If the execution is such that Alice listens alone less than N/4 rounds, which happens with probability at least 1/2, the algorithm is bound to fail with probability at least 1/2 in this case. This means algorithm A fails with probability at least 1/4. Next we give the proof for Lemma 4.2 which shows that no adaptive protocol can robustly simulates the Exchange Protocol for an error rate of 2/7: Proof of Lemma 4.2. We first explain the adversaries strategy and then explain why this strategy makes at least one of the parties unable to know the input of the other party with probability greater than 1/2. Suppose that there is an algorithm A that solves the exchange problem under adversarial error- rate 1/3, in N rounds. We work simply with 1-bit inputs. Let SX,Y denote the setting where Alice receives input X and Bob gets input Y . For simplicity, we first ignore the rounds in which both parties listen; note that in those rounds the adversary can deliver arbitrary messages to each of the parties at no cost. First we explain adversary's strategy for setting S0,1: Consider setting S0,0 and suppose that for the first 2N/3 rounds in this, the adversary does not interfere. Without loss of generality, we can assume that with probability at least 1/2, Alice listens alone in less than N/3 of these rounds. Adversary creates a dummy personality gBob0 and simulates it with Alice in this S0,0 setting. In the first 2N/3 rounds of setting S0,1, whenever Alice listens alone, the adversary connects Alice to gBob0, that is, Alice receives the transmission of gBob0. With probability at least 1/2 regarding the randomness of Alice and gBob0, Alice listens less than N/3 of the time which means that the adversary will have enough budget to completely fake Bob as gBob0 (from Alice's viewpoint). In that case, the two settings look identical to Alice for the first 2N/3 rounds. During the last N/3 rounds of the execution in setting S0,1, the adversary lets Alice and the real Bob talk without no interference. We now explain adversary's strategy for setting S0,0: The adversary generates another dummy personality gBob1 by simulating Bob in setting S0,1 where alone-listenings of Alice in the first 2N/3 rounds are connected to gBob0. In setting S0,0, the adversary lets Alice and Bob talk freely during adversary connects her to gBob1. the first 2N/3 rounds but for the last N/3 rounds, whenever Alice listens (even if not alone), the To conclude, the adversary give a random input y ∈ {0, 1} input to Bob and gambles on that Alice listens alone less than N/3 rounds of the first 2N/3 rounds. The adversary also uses the dummy personality gBobi for i = 1 − y and when Alice listens alone, the adversary connects Alice to the real Bob or this dummy personality according to the rules explained above. We know that with probability at least 1/2, Alice listens alone less than N/3 rounds of the first 2N/3 rounds. If that happens, with at most N/3 errors, the adversary can follow the strategy explained above. Therefore, with probability 1/2, Alice can not know Bob's input and thus will fail with probability at least 1/4. Regarding the rounds where both parties are listening, the rule is similar to Lemma D.1 but a little bit more subtle because of the rate adaptivity of algorithm A: We need to declare what are the receptions when in the first 2N/3 rounds of setting S0,0, both Alice and Bob are listening. 30 However, at that point, it's not clear whether we will make an indistinguishability argument for Alice or for Bob, which since it is affected by which one of them listens alone less, it can also depend on the receptions during the all-listening rounds of the first 2N/3 rounds. The simple remedy is to create analogous situations for Alice and Bob so that we can determine the base of indistinguishability later at the end of 2N/3 rounds. Adversary generates dummy personalities ]Alice0 and ]Alice1, respectively in settings S0,0 and S1,0, similar to those of Bob. In each all- listening round of the first 2N/3 rounds, adversary makes Alice receive the transmission of gBob1 and Bob receive the transmission of ]Alice1. With these connections, whoever is more likely to listen alone less in the first 2N/3 rounds -- which we assumed to be Alice without loss of generality in the above discussions -- with constant probability will receive messages with the exact same probability distributions, in each round in the two different settings. Thus she will not be able to distinguish the two settings. 31
1911.03360
1
1911
2019-11-08T16:32:02
Local Search for Group Closeness Maximization on Big Graphs
[ "cs.DS", "cs.SI" ]
In network analysis and graph mining, closeness centrality is a popular measure to infer the importance of a vertex. Computing closeness efficiently for individual vertices received considerable attention. The NP-hard problem of group closeness maximization, in turn, is more challenging: the objective is to find a vertex group that is central as a whole and state-of-the-art heuristics for it do not scale to very big graphs yet. In this paper, we present new local search heuristics for group closeness maximization. By using randomized approximation techniques and dynamic data structures, our algorithms are often able to perform locally optimal decisions efficiently. The final result is a group with high (but not optimal) closeness centrality. We compare our algorithms to the current state-of-the-art greedy heuristic both on weighted and on unweighted real-world graphs. For graphs with hundreds of millions of edges, our local search algorithms take only around ten minutes, while greedy requires more than ten hours. Overall, our new algorithms are between one and two orders of magnitude faster, depending on the desired group size and solution quality. For example, on weighted graphs and $k = 10$, our algorithms yield solutions of $12,4\%$ higher quality, while also being $793,6\times$ faster. For unweighted graphs and $k = 10$, we achieve solutions within $99,4\%$ of the state-of-the-art quality while being $127,8\times$ faster.
cs.DS
cs
Local Search for Group Closeness Maximization on Big Graphs Eugenio Angriman, Alexander van der Grinten, Henning Meyerhenke Department of Computer Science Humboldt-Universitat zu Berlin, Germany {angrimae, avdgrinten, meyerhenke}@hu-berlin.de 9 1 0 2 v o N 8 ] S D . s c [ 1 v 0 6 3 3 0 . 1 1 9 1 : v i X r a Abstract -- In network analysis and graph mining, closeness centrality is a popular measure to infer the importance of a vertex. Computing closeness efficiently for individual vertices received considerable attention. The NP-hard problem of group closeness maximization, in turn, is more challenging: the objective is to find a vertex group that is central as a whole and state-of- the-art heuristics for it do not scale to very big graphs yet. In this paper, we present new local search heuristics for group closeness maximization. By using randomized approximation techniques and dynamic data structures, our algorithms are often able to perform locally optimal decisions efficiently. The final result is a group with high (but not optimal) closeness centrality. We compare our algorithms to the current state-of-the-art greedy heuristic both on weighted and on unweighted real-world graphs. For graphs with hundreds of millions of edges, our local search algorithms take only around ten minutes, while greedy requires more than ten hours. Overall, our new algorithms are between one and two orders of magnitude faster, depending on the desired group size and solution quality. For example, on weighted graphs and k = 10, our algorithms yield solutions of 12.4% higher quality, while also being 793.6× faster. For unweighted graphs and k = 10, we achieve solutions within 99.4% of the state-of-the-art quality while being 127.8× faster. Index Terms -- centrality, group closeness, graph mining, net- work analysis I. INTRODUCTION Identifying important vertices in large networks is one of the main problems in network analysis [1]. For this purpose, several centrality measures have been introduced over the past decades [2]. Among them, one of the most widely-used measures is closeness [3]. For a given vertex v, it is defined as the reciprocal of the average shortest-path distance from v to all other vertices. The problem of identifying the k ver- tices with highest closeness centrality has received significant attention [4] -- [6]. In graph mining applications, however, it is often necessary to determine a group of vertices that is central as a whole -- which is an orthogonal problem shown to be NP-hard [7]. One can view group closeness as special case (on graphs) of the well-known k-median problem for facility location. Example applications include: (i) retailers that want to advertise their product via social media; they could select as promoters the group of k members with highest centrality (≈ influence over the other members) [8]; (ii) in P2P networks, This work is partially supported by German Research Foundation (DFG) grant ME 3619/3-2 within Priority Programme 1736 Algorithms for Big Data. shared resources could be placed on k peers so that they are easily accessible by others [9]; (iii) in citation networks, group centrality measures can be employed as alternative indicators for the influence of journals or papers within their field [10]. Everett and Borgatti [11] formalized the concept of cen- trality for groups of vertices; the closeness of a group S is defined as the reciprocal of the average distance from S to all other vertices of the graph. While exact algorithms to find a group with maximal group closeness are known (e. g., algorithms based on integer linear programming (ILP) [12]), they do not scale to graphs with more than a few thousand edges. Hence, in practice, heuristics are used to find groups with high group closeness on large real-world data sets. For example, Chen et al. [7] proposed a greedy algorithm that heuristically computes a group S with high closeness C(S). To obtain a group of size k, it performs k iterations and adds in each iteration the vertex with highest marginal contribution to S.1 It was shown empirically that this greedy algorithm yields solutions of very high quality (within 97% of the optimum) [12] -- at least for those small graphs where running a comparison against an exact algorithm is still feasible within a few hours. Due to greedy's promising quality, Bergamini et al. [12] proposed techniques to speed up the algorithm by pruning, e. g., by exploiting the supermodularity of farness, i. e., 1/C(S). Pruning yields a significant acceleration (while retaining the same solution); however, graphs with hundreds of millions of edges still require several hours to complete. Indeed, pruning is most effective when the group is already large. When performing the first addition, however, the greedy algorithm has to perform one (pruned) single-source shorted- path (SSSP) computation for each vertex in the graph to compute its marginal contribution, and this phase scales super- linearly in the size of the graph. Our Contribution: We present two new local search algorithms for group closeness: the first algorithm, Local- Swap, requires little time per iteration but can only exchange vertices locally. Our second algorithm, Grow-Shrink, is able to perform non-local vertex exchanges, but updating its data 1While this greedy algorithm was claimed to have a bounded approximation quality (e. g., in [7], [12]), the proof of this bound relied on the assumption that C is submodular. A recent update [13] to the conference version [12] revealed that, in fact, C is not submodular. We are not aware of any approximation algorithm for group closeness that scales to large graphs. © 2019 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works. structures is more involved. The final result of both algorithms is heuristic, i. e., no approximation guarantee is known. Yet, each iteration of Local-Swap maximizes (in approximation) a lower bound on the objective function, while each iteration of Grow-Shrink locally maximizes the objective function itself. Despite these favorable properties, the time complexity of a single iteration of our algorithms matches the time complexity of a single evaluation of the objective function, i. e., for unweighted graphs, it is linear in the size of the graph. Our experiments show that our best algorithm, extended Grow-Shrink, finds solutions with a closeness score greater than 99.4% of the score of a greedy solution, while being 127.8× faster to compute (k = 10). We see this algorithm as our main contribution for unweighted graphs. When quality is not a primary concern, our other algorithms can further accelerate the computation: For example, the non-extended variant of Grow-Shrink yields solutions for groups of size 10 whose quality is 91.1% compared to the state of the art; in this case, it is 700.2× faster. The speedup varies between 927.9× and 43.0× for groups of sizes 5 and 100, respectively. On weighted graphs, our algorithms even improve both the quality and the running time performance compared to the state of the art, returning solutions of 12.4% higher quality at a speedup of 793.6× (k = 10). Other trade-offs between quality and performance are possible and discussed in Section III. II. LOCAL SEARCH FOR GROUP CLOSENESS Let G = (V, E) be an undirected connected graph. We allow both unweighted and positively weighted graphs G. Subsets S ⊆ V are called groups. The farness of any given group S is defined as: f (S) = dist(S, v). (cid:88) v∈V \S Here, dist(S, v) refers to the minimal shortest-path distance from any s ∈ S to v in G. Furthermore, the (group) closeness of S is defined as C(S) = V /f (S), i. e., C(S) is the reciprocal of the average distance of all vertices in V \ S to the nearest vertex in S. Recall that determining the group S∗ that maximizes C over all groups S with S ≤ k is known to be NP-hard [7]; we are not aware of any algorithm with a bounded approximation ratio. We consider the problem of improving the group closeness of a given set S via local search. More precisely, we consider exchanges of vertices from S and V \ S. Let u be a vertex in S and v ∈ V \ S. To simplify the presentation, we use the notation S+v−u := (S \ {u}) ∪ {v} to denote the set that is constructed by exchanging u and v. We also use the notation S+v := S∪{v} and S−u := S\{u}, to denote vertex additions and removals, respectively. Note that, as our algorithms can only perform vertex exchanges, they require the construction of an initial set S before the algorithms start. To avoid compromising our algorithms' running times, we cannot afford a superlinear initialization step. Thus, in all of our local search algorithms, we simply choose the initial S uniformly at random. For large graphs, this initialization can be expected to cover the graph reasonably well. Exploratory experiments revealed that other obvious initialization techniques (such as selecting the k vertices with highest degree) did not improve the performance of the algorithm. A. Estimating the Quality of Vertex Exchanges It is known that a simple greedy ascent algorithm yields results of good quality on real-world graphs [12]. This greedy algorithm starts with an empty set S and iteratively adds vertices v ∈ V \ S to S that maximize f (S) − f (S+v). Depending on the input graph and the value of k, however, the greedy algorithm might need to evaluate the difference in f for a substantial number of vertices -- this computation is rather expensive for large real-world graphs. The algorithms in this paper aim to improve upon the running time of the greedy algorithm. We achieve this by considering only local vertices for v, i. e., vertices that are already "near" S. It is clear that selecting only local vertices would decrease the quality of a greedy solution (as the greedy algorithm does not have the ability to eventually correct suboptimal choices). However, this is not necessarily true for our algorithms based on vertex exchanges in Sections II-B and II-C. To make our notion of locality more concrete, let BS ⊆ G be the DAG constructed by running a SSSP algorithm (i. e., BFS or Dijkstra's algorithm) from the vertices in S. We remark that we work with the full SSSP DAG here (and not a SSSP tree). Here, the vertices of S are all considered as sources of the SSSP algorithm, i. e., they are at distance zero. Furthermore, define ∆−(v) := f (S) − f (S+v) (cid:88) = x∈V \S dist(S, x) − dist(S+v, x). (1) To compute the greedy solution, it seems to be necessary to compute ∆−(v) exactly for a substantial number of vertices v.2 As discussed above, this seems to be impractical for large graphs. However, a lower bound for ∆−(v) can be computed from the shortest path DAG BS. To this end, let Dv be the set of vertices reachable from v in BS. Lemma 1. It holds that: ∆−(v) ≥ Dv · dist(S, v). In the unweighted case, equality holds if v is a neighbor of S. This lemma can be proven from the definition of BS. A formal proof can be found in Appendix A. The bound of Lemma 1 will be used in the two algorithms in Sections II-B and II-C. Instead of picking vertices that maximize ∆−, those algorithms pick vertices that maximize the right-hand side of Lemma 1, i. e., Dv · dist(S, v). The is more accurate for bound is local in the sense that it 2The techniques of [12] can avoid some of the computations; nevertheless, many evaluations of ∆−(v) still have to be performed. 2 Algorithm 1 Overview of Local-Swaps Algorithm 1: repeat 2: 3: 4: 5: 6: until previous iteration did not decrease f (S) approximate Dv for all V \ S (u, v) ← argmaxu∈S,v∈N (u)\S Dv − Λu S ← S+v−u run pruned BFS from v (cid:46) to recompute f (S) vertices near S: in particular, the reachability sets of vertices in (V \ S) ∩ N (S) are larger in G than those in B, as B does not contain back edges. Unfortunately, computing the size of Dv exactly for all v still seems to be prohibitively expensive: indeed, the fastest known algorithm to compute the size of the transitive closure of a DAG (=(cid:80)Dv) relies on iterated (Boolean) matrix multiplication (hence, the best known exact algorithm has a complexity of O(n2.37) [14]). However, it turns out that randomized algorithms can be used to approximate the sizes of Dv for all v at the same time. We employ the randomized algorithm of Cohen [15] for this task. In multiple iterations, this algorithm samples a random number for each vertex of the graph G, accumulates in each vertex v the minimal random number of any vertex reachable from v, and estimates Dv based on this information. We remark that since Cohen's algorithm yields an approx- imation, but not a lower bound for the right-hand side of Lemma 1, the inequality of the Lemma can be violated in our algorithms; in particular, it can happen that our algorithms pick a vertex v such that ∆−(v) < 0. In this case, instead of decreasing the closeness centrality of our current group, our algorithms terminate. Nevertheless, our experiments demon- strate that on real-world instances, a coarse approximation of the reachability set size is enough for Lemma 1 to yield useful candidates for vertex exchanges (see Section II-D5 and Appendix C-B). B. Local-Swaps Algorithm Let us first focus on unweighted graphs. To construct a fast local search algorithm, a straightforward idea is to allow swaps between vertices in S and their neighbors in V \S. This procedure can be repeated until no swap can decrease f (S). Let u ∈ S be a vertex of the group and let v ∈ N (S)\S be one of its neighbors outside of the group. To determine whether swapping u and v (i. e., replacing S by S+v−u) is beneficial, we have to check whether f (S) − f (S+v−u) > 0, i. e., whether the farness is decreased by the swap. The challenge here is to find a pair u, v that satisfies this inequality (without checking all pairs u, v exhaustively) and to compute the difference f (S) − f (S+v−u) quickly. Note that a crucial ingredient that allows us to construct an efficient algorithm is that the distance of S to every vertex x can only change by ±1 when doing a swap. Hence, we only have to count the numbers of vertices where the distance changes by −1 and the number of vertices where it changes by +1. Our algorithm requires a few auxiliary data structures to compute f (S)− f (S+v−u). In particular, we store the following: 3 • the distance dist(S, x) from S to all vertices x ∈ V \ S, • a set λx := {w ∈ S : dist(S, x) = dist(w, x)} for each x ∈ V \ S that contains all vertices in S that realize the shortest distance from S to x, • the value Λw for each w ∈ S, where Λw := {x ∈ V \S : λx = {w}} is the set of vertices for which the shortest distance is realized exclusively by w. Note that the sets λx consume O(kV ) memory in total. However, since k (cid:28) V , this can be afforded even for large real-world graphs. In our implementation, we store each λx in only k bits. All of those auxiliary data structures can be maintained dynamically during the entire algorithm with little additional overhead. More precisely, after a u-v swap is done, v is added to all λx satisfying dist(v, x) = dist(S, x); for x ∈ V \ S that satisfy dist(v, x) < dist(S, x), the set {v} replaces λx. u can be removed from all λx by a linear scan through all x ∈ V \S. Algorithm 1 states a high-level overview of the algorithm. In the following, we discuss how to pick a good swap (line 3 of the pseudocode) and how to update the data structures after a swap (line 5). The running time of the algorithm is dominated by the initialization of λx. Thus, it runs in O(kV +E) time for each update. 1) Choosing a Good Swap: Because it would be too ex- pensive to compute the exact difference in f for each possible swap, we find the pair of vertices (u, v) with u ∈ S, v ∈ N (v)\S that maximizes Dv·dist(S, v)−Λu = Dv−Λu. Note that this value is a lower bound for the decrease of f after swapping u and v: In particular, Lemma 1 implies that Dv is a lower bound for the decrease in farness when adding v to S. Additionally, Λu is an upper bound for the increase in farness when removing u from S (and hence also for the increase in farness when removing u from S+v).3 Thus, we can expect this strategy to yield pairs of vertices that lead to a decrease of f. To maximize Dv−Λu, for each v ∈ V \S, we compute the neighbor u ∈ N (v) ∩ S that minimizes Λu (in O(V +E) time). Afterwards, we can maximize Dv−Λu by a linear scan over all v ∈ V \ S. 2) Computing the Difference in Farness: Instead of com- paring distances, it is sufficient to define sets of vertices whose distance to S is increased or decreased (by 1) by the swap: u,v := {x ∈ V : dist(S, x) < dist(S+v−u, x)}, H + u,v := {x ∈ V : dist(S, x) > dist(S+v−u, x)} H− As dist(S, x) − dist(S+v−u, x) ∈ {−1, 0, +1}, it holds that: Lemma 2. f (S) − f (S+v−u) = H− u,v − H + u,v Fortunately, computing H− u,v is straightforward: this can be done by running a BFS rooted at v; the BFS simply counts those vertices x for which dist(v, x) < dist(S, x). Hence, to check this condition, we have to store the values of dist(S, x) for all x ∈ V . We remark that it is not necessary to run a full BFS: indeed, we can prune the search once dist(v, x) ≥ dist(S, x) (i. e., if the BFS is about to visit a 3 Note, however, that this bound is trivial if Dv − Λu ≤ 0. Algorithm 2 Overview of Grow-Shrink Algorithm 1: repeat 2: 3: 4: 5: 6: 7: 8: 9: until previous iteration did not decrease f (S) approximate Dv for all v ∈ V \ S v ← argmaxv∈V \S Dv · d(v) S ← S+v run pruned BFS from v u ← argminu∈S x∈Ru S ← S−u run Dijkstra-like algo. (cid:46) to recompute f (S), d, d(cid:48) d(cid:48)(x) − d(x) (cid:46) to recompute f (S), d, d(cid:48) (cid:80) u,v ∩ H− u,v ⊆ Λu \ H− vertex x satisfying this condition, the search continues without visiting x). However, as we will see in the following, it makes sense to sightly relax the pruning condition and only prune the BFS if dist(v, x) > dist(S, x); this allows us to update our auxiliary data structures on the fly. u,v can be computed from Λu with the help of the H + u,v ⊆ Λu, as only auxiliary data structures. We note that H + vertices x where dist(S, x) is uniquely realized by u (out of all vertices in the group) can have their distance from S increased u,v = ∅, we can further restrict this by the swap. As H + u,v, but, in general, Λu \ H− inclusion to H + u,v will consist of more vertices than just H + u,v. More precisely, u,v ∪ L0 u,v can be partitioned into Λu \ H− Λu \ H− u,v, u,v = H + u,v := {x ∈ Λu : dist(u, x) = dist(v, x)} consists where L0 only of vertices whose distance is neither increased nor decreased by the swap. By construction, L0 u,v are disjoint. This proves that the following holds: Lemma 3. H + u,v − L0 u,v) is completely visited We note that L0 u,v, the BFS only has to count the by our BFS. To determine L0 vertices x that satisfy dist(v, x) = dist(S, x) and λx = {u}. u,v, it has to count the On the other hand, to determine Λu∩H− vertices x satisfying dist(v, x) < dist(S, x) and λx = {u}. C. Grow-Shrink Algorithm u,v = Λu − Λu ∩ H− u,v (and also Λu∩H− u,v and H + u,v. The main issue with the swapping algorithm from Sec- tion II-B is that it can only exchange a vertex u ∈ S with one of its neighbors v ∈ N (u) \ S. Due to this behavior, the algorithm might take a long time to converge to a local optimum. It also makes it hard to escape a local optimum: indeed, the algorithm will terminate if no swap with a neighbor can improve the closeness. Our second algorithm lifts those limitations. It also allows G to be a weighted graph. In particular, it allows vertex exchanges that change the distances from S to the vertices in V \ S by arbitrary amounts. Computing the exact differences f (S) − S(S+v−u) for all possible pairs of u and v seems to be impractical in this setting. Hence, we decompose the vertex exchange of u and v into two operations: the addition of v to S and the removal of u from S+v. In particular, we allow the set S to grow to a size of k + 1 before we shrink the size of S back to k. Thus, the cardinality constraint S ≤ k is tem- porarily violated; eventually, the constraint is restored again. Fortunately, the individual differences f (S) − f (S+v) and f (S+v)−f (S+v−u) (or bounds for those differences) turn out to be efficiently computable for all possible u and v, at least in approximation. We remark, however, that while this technique does find the vertex that maximizes f (S) − f (S+v) and the vertex that maximizes f (S+v) − f (S+v−u), it does not neces- sarily find the pair of vertices maximizing f (S) − f (S+v−u). Nevertheless, our experiments in Section III demonstrate that the solution quality of this algorithm is superior to the quality of the local-swaps algorithm. maintains the following data structures: In order to perform these computations, our algorithm • the distance d(x) of each vertex x /∈ S to S, and a representative r(x) ∈ S that realizes this distance, i. e., it holds that dist(S, x) = dist(r(x), x) = d(x), • the distance d(cid:48)(x) from S\{r(x)} to x and representative r(cid:48)(x) for this distance (satisfying the analogous equality). Since the graph is connected, these data structures are well- defined for all groups S of size S ≥ 1. Furthermore, the difference between d(cid:48)(x) and d(x) yields exactly the difference in farness when r(x) is removed from the S. Later, we will use this fact to quickly determine differences in farness. We remark that it can happen that d(x) = d(cid:48)(x); nev- ertheless, r(x) and r(cid:48)(x) are always distinct. Indeed, there can be two distinct vertices r(x) and r(cid:48)(x) in S that satisfy dist(r(x), x) = dist(r(cid:48)(x), x) = dist(S, x). With Ru and R(cid:48) u, we denote the set of vertices x ∈ V \ S with r(x) = u and r(cid:48)(x) = u, respectively. Algorithm 2 gives a high-level overview of the algorithm. In the following two subsections, we discuss the growing phase (line 2-5) and the shrinking phase (line 6-8) individually. The running time of Grow-Shrink is dominated by the Dijkstra-like algorithm (in line 8). Therefore, it runs in O(V +E log V ) time per update (when using an appropriate priority queue). The space complexity is O(V + E). 1) Vertex additions: When adding a vertex v to S, we want to select v such that f (S+v) is minimized. Note that minimizing f (S+v) is equivalent to maximizing the difference f (S) − f (S+v) = ∆−(v). Instead of maximizing ∆−(v), we maximize the lower bound Dv · dist(S, v). We perform a small number of iterations of the reachability set size approximation algorithm (see Section II-A) to select the vertex v with (approximatively) largest Dv. After v is selected, we perform a BFS from v to compute ∆−(v) exactly. As we only need to visit the vertices whose distance to S+v is smaller than to S, this BFS can be pruned once a vertex x is reached with dist(S, x) < dist(v, x). During the BFS, the values of d, d(cid:48), r, r(cid:48) are updated to reflect the vertex addition: the only thing that can happen here is that v realizes either of the new distances d or d(cid:48). 2) Vertex removals: For vertex removals, we can efficiently calculate the exact increase ∆+(u) := f (S−u) − f (S) in farness for all vertices u ∈ S, even without relying on approximation. In fact, ∆+(u) is given as: (cid:88) x∈Ru d(cid:48)(x) − d(x). ∆+(u) = 4 d(cid:48)-boundary d-boundary w u w(cid:48) Fig. 1: w, u and w(cid:48) are vertices in S. Vertices within the solid regions belong to Rw, Ru and Rw(cid:48), respectively. Vertices within the dashed regions belong to R(cid:48) w and R(cid:48) u, respectively. After removing u from S, the vertices in R(cid:48) u will have an invalid r(cid:48) and d(cid:48). We need to compute k such sums (i. e., ∆+(u) for each u ∈ S); but they can all be computed at the same time by a single linear scan through all vertices x ∈ V . It is more challenging, however, to update d, d(cid:48), r and r(cid:48) after removing a vertex u from S. For vertices x with an invalid d(x) (i. e., vertices in Ru), we can simply update d(x) ← d(cid:48)(x) and r(x) ← r(cid:48)(x). This update invalidates d(cid:48)(x) and r(cid:48)(x). In the following, we treat d(cid:48)(x) as infinite and r(cid:48)(x) as undefined for all updated vertices x; eventually those expressions will be restored to valid values using the algorithm that we describe in the remainder of this section. Indeed, we now have to handle all vertices with an invalid d(cid:48)(x) (i. e., those in Ru ∪ R(cid:48) u). This computation is more involved. We run a Dijkstra-like algorithm (even in the unweighted case) to fix d(cid:48)(x) and r(cid:48)(x). The following definition yields the starting points for our Dijkstra-like algorithm. Definition 1. Let x ∈ V be any vertex and let y ∈ N (x) ∩ (Ru ∪ R(cid:48) u) be a neighbor of x that needs to be updated. • We call (x, y) a d-boundary pair for y iff r(x) (cid:54)= r(y). • We call (x, y) a d(cid:48)-boundary pair for y iff r(x) = r(y) u. In this case, we set b(x, y) := d(cid:48)(x) + In this case, we set b(x, y) := d(x) + dist(x, y). and x /∈ Ru ∪ R(cid:48) dist(x, y). In both cases, b(x, y) is called the boundary distance of (x, y). The definition is illustrated in Figure 1. Intuitively, boundary pairs define the boundary between regions of G that have a valid d(cid:48)(x) (blue regions in Figure 1) and regions of the graph that have an invalid d(cid:48)(y) (orange region in Figure 1). The boundary distance b(x, y) corresponds to the value of d(cid:48) that a SSSP algorithm could propagate from x to y. We need to distinguish d-boundary pairs and d(cid:48)-boundary pairs as the boundary distance can either be propagated on a shortest path from S over x to y (in case of a d-boundary pair) or on a shortest path from S−r(x) over x to y (in case of a d(cid:48)-boundary pair). Consider all y ∈ V \ S such that there exists at least one (d- or d(cid:48)-)boundary pair for y. For each such y, let (x, y) be the boundary pair with minimal boundary distance b(x, y). Our algorithm first determines all such y and up- dates d(cid:48)(y) ← b(x, y). If (x, y) is a d-boundary pair, we set r(y) ← r(x); for d(cid:48)-boundary pairs, we set r(y) ← r(cid:48)(x). After this initial update, we run a Dijkstra-like algorithm starting from these vertices y for which a boundary pair exists. This algorithm treats d(cid:48) as the distance. Compared to the usual Dijkstra algorithm, our algorithm needs the following modifications: For each vertex x, our algorithm only visits those neighbors y that satisfy r(y) (cid:54)= r(cid:48)(x). Furthermore, whenever such a visit results in an update of d(cid:48)(y), we propagate r(cid:48)(y) ← r(cid:48)(x). Note that these conditions imply that we never update r(cid:48)(y) such that r(cid:48)(y) = r(y). Lemma 4. After the Dijkstra-like algorithm terminates, d(cid:48) and r(cid:48) are correct. A proof of this lemma can be found in Appendix A. D. Variants and Algorithmic Improvements 1) Semi-local Swaps: One weakness of the algorithm in Section II-B is that it only performs local vertex exchanges. In particular, the algorithm always swaps a vertex u ∈ S and a vertex v ∈ N (u) \ S. This condition can be generalized: in particular, it is sufficient that u ∈ S also satisfies u ∈ N (S+v). In this situation, the distances of all vertices can still only change by a single hop and the proofs of the correctness of the algorithm remain valid. Note that this naturally partitions candidates u into two sets: first, the set N (v)∩S of candidates that the original algorithm considers, and the set N (S) ∩ S. Candidates in the latter set can be determined independently of v; indeed, they can be swapped with any v ∈ N (S)\S. Hence, our swap selection strategy from Section II-B1 continues to work with little modification. 2) Restricted Swaps: To further improve the performance of our Local-Swap algorithm at the cost of its solution quality, we consider the following variant: instead of selecting the pair of vertices (u, v) that maximize Dv−Λu, we just select the vertex v that maximizes Dv and then choose u ∈ N (v) ∩ S such that Λu is minimized. This restricts the choices for u; hence, we expect this Restricted Local-Swap algorithm to yield solutions of worse quality. Due to the restriction, however, it is also expected to converge faster. 3) Local Grow-Shrink: During exploratory experiments, it turned out that the Grow-Shrink algorithm sometimes over- estimates the lower bound Dv · dist(S, v) on the decrease f (S) − f (S+v) of the farness after adding an element v. This happens because errors in the approximation of Dv are amplified by multiplying with a large dist(S, v). Hence, we found that restricting the algorithm's choices for v to vertices near S improves the solution quality of the algorithm. It may seem that this modification makes Grow-Shrink vulnerable to the same weaknesses as Local-Swap. Namely, local choices imply that large numbers of exchanges might be required to reach local optima and it becomes hard to escape these local optima. Fortunately, additional techniques discussed in the next section can be used to avoid this problem. 4) Extended Grow-Shrink: Even in the case of Grow- Shrink, the bound of Lemma 1 becomes worse for vertices 5 at long distances from the current group. As detailed in Section II-A, this happens as our reachability set size approx- imation approach does not take back edges into account. This is a problem especially on graphs with a large diameter where we have to expect that many back edges exist. We mitigate this problem (as well as the problems mentioned in Section II-D3) by allowing the group to grow by more than one vertex before we shrink it again. In particular, we allow the group to grow to size k + h for some h ≥ 1, before we shrink it back to k. In our experiments in Section III, we consider two strategies to choose h. First, we consider constant values for h. However, this is not expected to be appropriate for all graphs: specifi- cally, we want to take the diameter of the graph into account. Hence, a more sophisticated strategy selects h = diam(G)/kp for a fixed p. This strategy is inspired by mesh-like graphs (e. g., real-world road networks and some other infrastructure networks): if we divide a quadratic two-dimensional mesh G √ into k quadratic sub-meshes (where k is a power of 2), the k. Hence, if we diameter of the sub-meshes is diam(G)/ assume that each vertex of the group covers an equal amount of vertices in the remaining graph, h = diam(G)/ k vertex additions should be sufficient to find at least one good vertex that will improve a size-k group. As we expect that real-world networks deviate from ideal two-dimensional meshes to some extend, we consider not only p = 1 2 but also other values of p. √ 5) Engineering the reachability set size approximation al- gorithm: Cohen's reachability set size approximation algo- rithm [15] has multiple parameters that need to be chosen appropriately: in particular, there is a choice of probability distribution (exponential vs. uniform), the estimator function (averaging vs. selection-based), the number of samples and the width of each random number. For the estimator, we use an averaging estimator, as this estimator can be implemented more efficiently than a selection-based estimator (i. e., it only requires averaging numbers instead of finding the k-smallest number). We performed exploratory experiments to determine a good configuration of the remaining parameters. It turns out that, while the exponential distribution empirically offers better accuracy than the uniform distribution, the algorithm can be implemented much more efficiently using the uniform distribution: in particular, for the uniform distribution, it is sufficient to generate and store the per-vertex random numbers as (unsigned) integers, while the exponential distribution re- quires floating point calculations. We deal with the decrease in accuracy by simply gathering more samples. For the uniform distribution and real-world graphs, 16 bits per integer turns out to yield sufficient accuracy. In this setting, we found that 16 samples are enough to accurately find the vertex with highest reachability set size. In particular, while the theoretical guarantee in [15] requires the number of samples to grow with log V , we found this number to have a negligible impact on the solution quality of our group closeness heuristic (see Appendix C-B). 6) Memory latency in reachability set size approximation: is well-known that the empirical performance of graph It 6 traversal algorithms (like BFS and Dijkstra) is often limited by memory latency [16], [17]. Unfortunately, the reachability set size approximation needs to perform multiple traversals of the same graph. To mitigate this issue, we perform multiple iterations of the approximation algorithm at the same time. This technique increases the running time performance of the algorithm at the cost of its memory footprint. More precisely, during each traversal of the graph, we store 16 random integers per vertex and we aggregate all 16 minimal values per vertex at the same time. This operation can be performed very efficiently by utilizing SIMD vector operations. In particular, we use 256-bit AVX operations of our Intel Xeon CPUs to take the minimum of all 16 values at the same time. As mentioned above, aggregating 16 random numbers per vertex is enough for our use case; thus, using SIMD aggregation, we only need to perform a single traversal of the graph. 7) Accepting swaps and stopping condition: As detailed in Sections II-B and II-C, our algorithms stop once they cannot find another vertex exchange that improves the closeness score of the current group. Exchanges that worsen the score are not accepted. To prevent vertex exchanges that change the group closeness score only negligibly, we also set a limit on the number of vertex exchanges. In our experiments, we choose a conservative limit that does not impact the solution quality measurably (see Appendix C-A). III. EXPERIMENTS In this section, we evaluate the performance of our al- gorithms against the state-of-the-art greedy algorithm of Bergamini et al. [12].4 As mentioned in Section I, it has been shown empirically that the solution quality yielded by the greedy algorithm is often nearly-optimal. We evaluate two variants, LS and LS-restrict (see Section II-D2), of our Local- Swap algorithm, and three variants, GS, GS-local (see Sec- tion II-D3) and GS-extended (see Section II-D4) of our Grow- Shrink algorithm. We evaluate these algorithms for group sizes of k ∈ {5, 10, 20, 50, 100} on the largest connected component of the input graphs. We measure the performance in terms of running time and closeness of the group computed by the algorithms. Because our algorithms construct an initial group S by selecting k vertices uniformly at random (see Section II), we average the results of five runs, each one with a different random seed, using the geometric mean over speedup and relative closeness.5 Unless stated otherwise, our experiments are based on the graphs listed in Tables II and III. They are all undirected and have been downloaded from the public repositories 9th DIMACS Challenge [18] and KONECT [19]. The running time of the greedy baseline varies between 10 minutes and 2 hours on those instances. Our algorithms are implemented in the NetworKit [20] C++ framework and use PCG32 [21] to generate random numbers. 4In our experiments we do not consider the naive greedy algorithm and the OSA heuristic of [7] because they are both dominated by [12]. 5These five runs are done to average out particularly bad (or good) selections of initial groups; as one can see from Appendix C-B, the variance due to the randomized reachability set size algorithm is negligible. (a) Speedup over the greedy algorithm (geom. mean). (b) Closeness score relative to the score of the group returned by greedy (geom. mean). Fig. 2: Performance of the extended Grow-Shrink algorithm for different values of h or p on unweighted graphs, k = 10. All experiments were managed by the SimexPal software to ensure reproducibility [22]. Experiments were executed with sequential code on a Linux machine with an Intel Xeon Gold 6154 CPU and 1.5 TiB of memory. A. Results for Extended Grow-Shrink In a first experiment, we evaluate performance of our extended Grow-Shrink algorithm and compare it to the greedy heuristic. Because of its ability to escape local optima, we expect this to be the best algorithm in terms of quality; hence, it should be a good default choice among our algorithms. For this experiment, we set k = 10. As discussed in Section II-D4, we distinguish two strategies to determine h: we either fix a constant h, or we fix a constant p. For each strategy, we evaluate multiple values for h or p. Results for both strategies are shown in Figure 2. As expected, higher values of h (or, similarly, lower values of p) increase the algorithm's running time; (while h > 1 allows the algorithm to perform better choices, it does not converge h-times as fast). Still, for all tested values of h or p, the extended Grow-Shrink algorithm is one to two orders of magnitude faster than the greedy baseline. Furthermore, values of p < 1 yield results of very good quality: for p = 0.75, for example, we achieve a quality of 99.4%. At the same time, using this setting for p, our algorithm is 127.8× faster than the greedy algorithm. We remark that for all but the smallest values of h (i. e., those corresponding to the lowest quality), choosing constant p is a better strategy than choosing constant h: for the same running time, constant p always achieves solutions of higher quality. B. Scalability to Large Graphs We also analyze the running time of our extended Grow- Shrink algorithm on large-scale networks. To this end, we switch to graphs larger than the ones in Table II. We fix p = 0.75, as Section III-A demonstrated that this setting results in a favorable trade-off between solution quality and running time. The greedy algorithm is not included in this experiment as it requires multiple hours of running time, even (a) R-MAT networks; 217 to 224 vertices (up to 268 million edges). (b) Random hyperbolic net- works; 217 to 226 vertices (up to 671 million edges). Fig. 3: Running time (s) of the extended Grow-Shrink al- gorithm on synthetic graphs (black line = linear regression); p = 0.75, k = 10. TABLE I: Running time of the extended Grow-Shrink algo- rithm on large real-world networks; p = 0.75, k = 10. Time (s) 95.3 135.6 199.9 368.0 333.1 680.1 Network soc-LiveJournal1 livejournal-links orkut-links dbpedia-link dimacs10-uk-2002 wikipedia link en E 42,845,684 48,687,945 117,184,899 126,888,089 261,556,721 334,640,259 V 4,843,953 5,189,808 3,072,441 18,265,512 18,459,128 13,591,759 for the smallest real-world graphs that we consider in this part. Hence, we also do not compare against its solution quality in this experiment. 1) Results on Synthetic Data: Figure 3 shows the average running time of our algorithm on randomly generated R- MAT [23] graphs as well as graphs from a generator [24] for random hyperbolic graphs. Like R-MAT, the random hyper- bolic model yields graphs with a skewed degree distribution, similar to the one found in real-world complex networks. In the (log-log) plot, the straight lines represent a linear regression of the running times. In both cases, the running time curves are at most as steep as the regression line, i. e., the running time behaves linearly in the number of vertices for the considered network models and sizes. 2) Results on Large Real-World Data Sets: Table I reports the algorithm's performance on large real-world graphs. In contrast to the greedy algorithm (which would require hours), our extended Grow-Shrink algorithm can handle real-world graphs with hundreds of millions of edges in a few minutes. For the orkut-links network, Bergamini et al. [12] report running times for greedy of 16 hours on their machine; it is the largest instance in their experiments. C. Accelerating Performance on Unweighted Graphs While the extended Grow-Shrink algorithm yields results of very high quality, if quality is not a primary concern, even faster algorithms might be desirable for very large graphs. To this end, we also evaluate the performance of the non- extended Grow-Shrink and the Local Swap algorithms. For extended Grow-Shrink, we fix p = 0.75 again. The speedup and the quality of our algorithms over the greedy algorithm, for different values of the group size k, is shown in Figures 4a 7 const hconst p151050h0100200300400Speedup over greedy2.01.751.51.251.00.750.5p0.900.920.940.960.981.00Relative closeness151050h02.01.751.51.251.00.750.5p1718192021222324Scale100101102103Time (s)GS-extended17181920212223242526Scale100101102103Time (s)GS-extended Grow-Shrink on weighted graphs is shown in Figure 5. In contrast to unweighted graphs, the quality of the non-local Grow-Shrink algorithm is superior to the greedy baseline for all considered group sizes. Furthermore, in contrast to the unweighted case, the ability to perform non-local vertex ex- changes greatly benefits the non-local Grow-Shrink algorithm compared to local Grow-Shrink.6 Thus, Grow-Shrink clearly dominates both the greedy algorithm and local Grow-Shrink on the weighted graphs in our benchmark set -- both in terms of speed and solution quality. E. Summary of Experimental Results On unweighted graphs, a good trade-off between solution quality and running time is achieved by the extended Grow- Shrink algorithm with constant p = 0.75. This strategy yields solutions with at least 99.4% of the closeness score of a greedy solution (greedy, in turn, was at most 3% away from the optimum on small networks in previous work [12]). Extended Grow-Shrink is 127.8× faster than greedy (k = 10). Thus, it is able to handle graphs with hundreds of millions of edges in a few minutes -- the state of the art needs multiple hours. If a fast but inaccurate algorithm is needed for exploratory analysis of graph data sets, we recommend to run the non-extended Grow-Shrink algorithm, or, if only a very coarse estimate of the group with maximal closeness is needed, restricted Local- Swap. On weighted graphs, we recommend to always use our Grow-Shrink algorithm, as it outperforms the greedy state of the art both in terms of quality (yielding solution that are on average 12.4% better than greedy solutions) and in terms of running time performance (with a speedup of two orders of magnitude), at the same time. IV. CONCLUSIONS In this paper, we introduced two families of new local- search algorithms for group closeness maximization in large networks. As maximizing group closeness exactly is infea- sible for graphs with more than a few thousand edges, our algorithms are heuristics (just like the state-of-the-art greedy algorithm). However, for small real-world networks, the results are empirically known to be close to optimal solutions [12]. Compared to previous state-of-the-art heuristics, our algo- rithms (in particular: extended Grow-Shrink) allow to find groups with high closeness centrality in real-world networks with hundreds of millions of edges in seconds to minutes instead of multiple hours, while sacrificing less than 1% in quality. In weighted graphs, Grow-Shrink (GS) even dominates the best known heuristic: the GS solution quality is more than 10% higher and GS is two orders of magnitude faster. Adapting the algorithm to even larger graphs in distributed memory is left to future work. (a) Speedup over the greedy algorithm (geom. mean). (b) Closeness score relative to the score of the group returned by greedy (geom. mean). Fig. 4: Performance of our local search algorithms for different values of k; unweighted graphs. (a) Speedup over the greedy algorithm (geom. mean). (b) Closeness score relative to the score of the group returned by greedy (geom. mean). Fig. 5: Performance of our local search algorithms for different values of k; weighted graphs. and 4b, respectively. Note that the greedy algorithm scales well to large k, so that the speedup of our algorithms decreases with k (as mentioned in Section I, the main bottleneck of greedy is adding the first vertex to the group). However, even for large groups of k = 100, all of our algorithms are still at least 43.0× faster. After extended Grow-Shrink, our non-extended local ver- sion of Grow-Shrink is the next best algorithm in terms of quality. As explained in Section II-D3, this variant yields better solutions than non-local Grow-Shrink and gives a speedup of 3.1× over extended Grow-Shrink with p = 0.75 and k = 10 (= a speedup of 365.8× over greedy); the solution quality in this case is 92.1% of the greedy quality. The non-restricted Local-Swap algorithm is dominated by Grow-Shrink, both regarding running time and solution qual- ity. Furthermore, compared to the other algorithms, the re- stricted Local-Swap algorithm only gives a rough estimate of the group with highest group closeness; however, it is also significantly faster than all other algorithms and may be employed during an exploratory analysis of graph data sets. D. Results on Weighted Road Networks Recall that the Local-Swaps algorithm does not work for weighted graphs; we thus report only Grow-Shrink data in the weighted case. The performance of Grow-Shrink and local 6For this reason, we do not include the extended Grow-Shrink algorithm in this experiment. In fact, we expect that it improves only slightly on GS-local (red line/bars in Fig. 5) but cannot compete with (non-local) GS: the ability to perform non-local vertex exchanges, as done by GS (green line/bars in Fig. 5) appears to be crucial to obtain high-quality results on weighted graphs. 8 LS-restrictLSGSGS-localGS-extended5102050100Group size050010001500Speedup over greedy0.70.80.91.0Relative closeness5102050100Group size0GSGS-local5102050100Group size02505007501000Speedup over greedy0.91.01.1Relative closeness5102050100Group size0 REFERENCES [1] M. Newman, Networks, 2nd ed. Oxford university press, 2018. [2] P. Boldi and S. Vigna, "Axioms for centrality," Internet Mathematics, vol. 10, no. 3-4, pp. 222 -- 262, 2014. [3] A. Bavelas, "A mathematical model for group structures," Human organization, vol. 7, no. 3, p. 16, 1948. [4] E. Bergamini, M. Borassi, P. Crescenzi, A. Marino, and H. Meyerhenke, "Computing top-k closeness centrality faster in unweighted graphs," ACM Transactions on Knowledge Discovery from Data (TKDD), vol. 13, no. 5, p. 53, 2019. [5] K. Okamoto, W. Chen, and X.-Y. Li, "Ranking of closeness centrality for large-scale social networks," in International Workshop on Frontiers in Algorithmics. Springer, 2008, pp. 186 -- 195. [6] P. W. Olsen, A. G. Labouseur, and J.-H. Hwang, "Efficient top-k closeness centrality search," in 2014 IEEE 30th International Conference on Data Engineering. IEEE, 2014, pp. 196 -- 207. [7] C. Chen, W. Wang, and X. Wang, "Efficient maximum closeness centrality group identification," in Australasian Database Conference. Springer, 2016, pp. 43 -- 55. [8] T. Zhu, B. Wang, B. Wu, and C. Zhu, "Maximizing the spread of influence ranking in social networks," Information Sciences, vol. 278, pp. 535 -- 544, 2014. [9] C. Gkantsidis, M. Mihail, and A. Saberi, "Random walks in peer-to-peer networks," in IEEE INFOCOM 2004, vol. 1. IEEE, 2004. [10] L. Leydesdorff, "Betweenness centrality as an indicator of the interdis- ciplinarity of scientific journals," Journal of the American Society for Information Science and Technology, vol. 58, no. 9, pp. 1303 -- 1319, 2007. [11] M. G. Everett and S. P. Borgatti, "The centrality of groups and classes," The Journal of mathematical sociology, vol. 23, no. 3, pp. 181 -- 201, 1999. [12] E. Bergamini, T. Gonser, and H. Meyerhenke, "Scaling up group close- ness maximization," in 2018 Proceedings of the Twentieth Workshop on Algorithm Engineering and Experiments (ALENEX). SIAM, 2018, pp. 209 -- 222. [13] -- -- , "Scaling up group closeness maximization," CoRR, vol. abs/1710.01144, 2017, updated on May 15, 2019. [Online]. Available: http://arxiv.org/abs/1710.01144 [14] F. Le Gall, "Powers of tensors and fast matrix multiplication," in the 39th international symposium on symbolic and Proceedings of algebraic computation. ACM, 2014, pp. 296 -- 303. [15] E. Cohen, "Size-estimation framework with applications to transitive closure and reachability," Journal of Computer and System Sciences, vol. 55, no. 3, pp. 441 -- 453, 1997. [16] D. A. Bader, G. Cong, and J. Feo, "On the architectural requirements for efficient execution of graph algorithms," in Parallel Processing, 2005. ICPP 2005. International Conference on. IEEE, 2005, pp. 547 -- 556. [17] A. Lumsdaine, D. Gregor, B. Hendrickson, and J. Berry, "Challenges in parallel graph processing," Parallel Processing Letters, vol. 17, no. 01, pp. 5 -- 20, 2007. [18] C. Demetrescu, A. V. Goldberg, and D. S. Johnson, The Shortest Path Problem: Ninth DIMACS Implementation Challenge. American Mathematical Soc., 2009, vol. 74. [19] J. Kunegis, "Konect: the Koblenz Network Collection," in Proceedings of the 22nd International Conference on World Wide Web. ACM, 2013, pp. 1343 -- 1350. [20] C. L. Staudt, A. Sazonovs, and H. Meyerhenke, "Networkit: A tool suite for large-scale complex network analysis," Network Science, vol. 4, no. 4, pp. 508 -- 530, 2016. [21] M. E. O'Neill, "Pcg: A family of simple fast space-efficient statistically good algorithms for random number generation," Harvey Mudd College, Claremont, CA, Tech. Rep. HMC-CS-2014-0905, Sep. 2014. [22] E. Angriman, A. v. d. Grinten, M. v. Looz, H. Meyerhenke, M. Nollenburg, M. Predari, and C. Tzovas, "Guidelines for experimental algorithmics: A case study in network analysis," Algorithms, vol. 12, no. 7, p. 127, 2019. [23] D. Chakrabarti, Y. Zhan, and C. Faloutsos, "R-mat: A recursive model the 2004 SIAM International for graph mining," in Proceedings of Conference on Data Mining. SIAM, 2004, pp. 442 -- 446. [24] M. von Looz, M. S. Ozdayi, S. Laue, and H. Meyerhenke, "Generating massive complex networks with hyperbolic geometry faster in prac- tice," in 2016 IEEE High Performance Extreme Computing Conference (HPEC). IEEE, 2016, pp. 1 -- 6. [25] R. C. Murphy, K. B. Wheeler, B. W. Barrett, and J. A. Ang, "Introducing the graph 500," Cray Users Group (CUG), vol. 19, pp. 45 -- 74, 2010. APPENDIX A TECHNICAL PROOFS Proof of Lemma 1. Let x ∈ Dv. Because of the sub path op- timality property of shortest paths, it is clear that dist(S, x) = dist(S, v)+dist(v, x) (as v is a predecessor of x on a shortest path from S). On the other hand, adding v to S decreases the length of this path (as the distance between S and v becomes zero); in other words: dist(S+v, x) = dist(v, x). These observations allow us to express the right-hand side of Eq. 1 as dist(S, x) − dist(S+v, x) = dist(S, v). Sum- ming this equation for all vertices in Dv yields the term Dv · dist(S, v) of the lemma. For vertices x /∈ Dv, it holds that dist(S, x) − dist(S+v, x) ≥ 0, hence the inequality. w∈S(Z ∩ R(cid:48) prove the lemma, it is sufficient to prove that Z =(cid:83) Let us first prove that (cid:83) For the statement about the unweighted case, we need to show that the contribution of all other vertices is zero, i. e., dist(S, x) = dist(S+v, x) for all vertices x /∈ Dv. Note that dist(S, x) < dist(S, v) + dist(v, x) (otherwise x would be in Dv) and dist(S, v) = 1. Thus, dist(S, x) ≤ dist(v, x) which completes the proof. Proof of Lemma 4. Let Z be the set of vertices that need to be updated by the algorithm, i. e., Z equals the set Ru ∪ R(cid:48) u before the Dijkstra-like algorithm runs. We have not shown yet whether all vertices in Z are indeed updated. For the remainder of this proof, all symbols (such as r(cid:48), d(cid:48) and R(cid:48)) refer to the state of our data structures after the algorithm terminates. To w∈S(Z ∩ w) (i. e., that no r(cid:48) remains undefined, or, in other words, R(cid:48) r(cid:48) is updated wherever necessary) and that dist(S−r(x), x) = dist(r(cid:48)(x), x) for all x ∈ Z (i. e., that the definition of r(cid:48) is respected). w) = Z. Let z ∈ Z. There exists a path from every w ∈ S to z and each such path contained at least one boundary pair (x, y) before the algorithm started. Indeed, there is a boundary pair for the first vertex y on that path that is also in Z. Thus, the algorithm sets r(cid:48)(y) = w for some w ∈ S (i. e., y ∈ Z ∩ R(cid:48) w) and propagates the update of r(cid:48) along the path from w to z. We have to prove that our pruning condition does not prevent any necessary update along this path. Hence, let (x, y) be a pair of vertices so that the algorithm is pruned before visiting y from x. Only the y ∈ Z case is interesting, as r(cid:48) must already be correct otherwise. Pruning only happens if r(cid:48)(x) = r(y) and therefore r(x) (cid:54)= r(y). But in this case, (x, y) was a d- boundary pair and the preceding argument shows that y ∈ w∈S Z ∩ R(cid:48) w. Now consider the second part of the proof. Let w ∈ S be any group vertex and let y ∈ Z ∩ Rw be any vertex that is updated by the algorithm with r(y) = w. The algorithm guarantees that dist(S−w, y) ≤ dist(r(cid:48)(y), y) ≤ d(cid:48)(y) as r(cid:48)(y) ∈ S−w and (by construction of the algorithm) d(cid:48) is the length of a (not yet proven to be shortest) path from r(cid:48)(y) to y. It is sufficient to show that this path is a shortest one, i. e., dist(S−w, y) = d(cid:48)(y). We prove this statement for all (cid:83) 9 y ∈ Rw by an inductive argument using dist(S−w, y). We distinguish two cases depending on whether there exists a neighbor of y in Rw that is on a shortest path from S−w to y. First, we handle the case that no such neighbor exists. In this case, r(x) (cid:54)= w holds for all x ∈ N (y) on shortest paths from S−w to y. As r(x) did not change during the algorithm, all such x correspond to d-boundary pairs for y and dist(S−w, y) is the minimal boundary distance over these pairs (x, y). Hence, d(cid:48)(y) was updated correctly all before the Dijkstra-like algorithm ran. On the other hand, let x ∈ N (y) ∩ Rw be a neighbor of y that is on a shortest path from S−w to y. x ∈ Rw implies r(cid:48)(x) (cid:54)= w; thus, the algorithm cannot be pruned when visiting y from x. In this case, however, the algorithm sets d(cid:48)(y) = d(cid:48)(x) + dist(x, y). As dist(S−w, x) < dist(S−w, y), the induction yields that d(cid:48)(x) is already correct, i. e., d(cid:48)(x) = dist(S−w, x). Since x is on a shortest path from S−w to y, d(cid:48)(y) is also updated correctly. APPENDIX B DETAILS OF THE EXPERIMENTAL SETUP TABLE II: Unweighted real-world networks used in the ex- periments. Network dimacs9-NY dimacs9-BAY web-Stanford hyves youtube-links com-youtube web-Google trec-wt10g dimacs10-eu-2005 soc-pokec-relationships wikipedia link ca E 365,050 397,415 1,941,926 2,777,419 2,987,468 2,987,624 4,291,352 6,225,033 16,138,468 22,301,964 27,133,794 V 264,346 321,270 255,265 1,402,673 1,134,885 1,134,890 855,802 1,458,316 862,664 1,632,803 926,588 Category Road Road Hyperlink Social Social Social Hyperlink Hyperlink Road Social Hyperlink TABLE III: Weighted networks used in the experiments. All networks are road networks of different states of the US. State DC HI AK DE RI CT ME V 9,522 21,774 48,560 48,812 51,642 152,036 187,315 E 14,807 26,007 55,014 59,502 66,650 184,393 206,176 State ND SD WY ID MD WV NE V 203,583 206,998 243,545 265,552 264,378 292,557 304,335 E 249,809 249,828 293,825 310,684 312,977 320,708 380,004 Tables II and III show details about our real-world in- stances. To generate the synthetic graphs in Figure 3, we use the same parameter setting as in the Graph 500's bench- mark [25] (i. e., edge factor 16, a = 0.57, b = 0.19, c = 0.19, and d = 0.05) for the R-MAT generator. For the random hyperbolic generator, we set the average degree to 20, and the exponent of the power-law distribution to 3. 10 (a) Speedup over the greedy algorithm (geom. mean). (b) Closeness score relative to the score of the group returned by greedy (geom. mean). Fig. 6: Performance of the Grow-Shrink algorithm for different numbers of samples to estimate reachability set size; k = 10. (a) Unweighted graphs. (b) Weighted graphs. Fig. 7: Behavior of the relative closeness score (compared to the group returned by greedy, geom. mean) over the execution of the algorithms (in terms of vertex exchanges); k = 10. APPENDIX C ADDITIONAL EXPERIMENTS A. Impact of the number of vertex exchanges Figures 7a and 7b depict the relative closeness (compared to the closeness of the group returned by the greedy algorithm), depending on the progress of the algorithm in terms of vertex exchanges. For extended Grow-Shrink, we fix p = 0.75. All of the local search algorithm quickly converge to a value near their final result; additional vertex exchanges improve the group closeness score by small amounts. In order to avoid an excessive amount of iterations, it seems reasonable to set a limit on the number of vertex exchanges. In our experiments we set a conservative limit of 100 exchanges. B. Impact of reachability set size approximation As mentioned in Section II-D3, the errors in the approxima- tion of Dv are amplified by the multiplication with dist(S, v), and this results in GS-local computing higher quality solutions than GS. We study how increasing the accuracy of the reach- ability set size approximation by incrementing the number of samples impacts the performances of both GS and GS-local. Figure 6a shows that GS needs at least 64 samples to converge to a better local optimum than GS-local. However, in both cases increasing the number of samples degrades the speedup without yielding a significant quality improvement (Figure 6b). GSGS-local163264128256Number of samples0200400600800Speedup over greedy0.900.92Relative closeness163264128256Number of samples0LS-restrictLSGSGS-localGS-extended0.60.81.0Relative closeness02468101214Number of exchanges00.81.0Relative closeness01234567891011Number of exchanges0
1708.03228
1
1708
2017-08-10T14:13:45
Lower bounds for several online variants of bin packing
[ "cs.DS", "cs.DM", "math.CO", "math.OC" ]
We consider several previously studied online variants of bin packing and prove new and improved lower bounds on the asymptotic competitive ratios for them. For that, we use a method of fully adaptive constructions. In particular, we improve the lower bound for the asymptotic competitive ratio of online square packing significantly, raising it from roughly 1.68 to above 1.75.
cs.DS
cs
Lower bounds for several online variants of bin packing∗ J´anos Balogh † J´ozsef B´ek´esi ‡ Gyorgy D´osa§ Leah Epstein¶ Asaf Levink Abstract We consider several previously studied online variants of bin packing and prove new and improved lower bounds on the asymptotic competitive ratios for them. For that, we use a method of fully adaptive constructions. In particular, we improve the lower bound for the asymptotic competitive ratio of online square packing significantly, raising it from roughly 1.68 to above 1.75. 1 Introduction In bin packing problems, there is an input consisting of a set of items, and the goal is to partition it into a minimum number of subsets called bins, under certain conditions and constraints. In the classic variant [28, 19, 20, 31, 24], items have one-dimensional rational numbers in (0, 1], called sizes, associated with them, and the total size of items of one bin cannot exceed 1. In online variants items are presented as a sequence and the partition is created throughout this process in the sense that any new item should be assigned to a bin before any information regarding the next item is provided. The conditions on the partition or packing remain as in the offline problem where the items are all given at once as a set. Using an algorithm A to partition the items into subsets, which is also seen as a process of packing items into bins, the number of partitions or bins used for the packing is defined to be the cost of A. Algorithms for bin packing problems are normally studied using the asymptotic approximation ratio, also called asymptotic competitive ratio for the case of online algorithms (and we will use this last term). For an algorithm A and an input I, let A(I) denote the number of bins used by A for I, that is, the cost of A for I. Let OP T (I) denote the number of bins that an optimal solution uses for I, that is, the cost of an optimal (offline) algorithm OP T for I. Consider the set of inputs JQ of all inputs for which the number of bins used by OP T is Q. For the problems studied here (and non-empty inputs for them), Q will be a positive integer. Let c(Q) = maxI∈JQ A(I) (where for c(Q) Q . The absolute competitive reasonable algorithms this value is finite), and let RA = lim supQ→∞ A(I) ratio of A is defined by supI OP T (I) , that is, this is the supremum ratio between the cost of A and the optimal cost, over all inputs, and the asymptotic competitive ratio is the superior limit of the ∗Gy. D´osa was supported by VKSZ 12-1-2013-0088 "Development of cloud based smart IT solutions by IBM Hungary in cooperation with the University of Pannonia" and by National Research, Development and Innovation Office -- NKFIH under the grant SNN 116095. L. Epstein and A. Levin were partially supported by a grant from GIF - the German-Israeli Foundation for Scientific Research and Development (grant number I-1366-407.6/2016). †Department of Applied Informatics, Gyula Juh´asz Faculty of Education, University of Szeged, Hungary. [email protected] ‡Department of Applied Informatics, Gyula Juh´asz Faculty of Education, University of Szeged, Hungary. [email protected] §Department of Mathematics, University of Pannonia, Veszprem, Hungary, [email protected]. ¶Department of Mathematics, University of Haifa, Haifa, Israel. [email protected]. kFaculty of Industrial Engineering and Management, The Technion, Haifa, Israel. [email protected]. 1 absolute competitive ratios for fixed values of Q = OP T (I) when Q grows to infinity. Since the standard measures for online bin packing problems (and offline bin packing problems, respectively), are the asymptotic competitive ratio (and the asymptotic approximation ratio), we also use the terms competitive ratio (and approximation ratio) for them, and always use the word absolute when we discuss the absolute measures. To prove lower bounds on the (asymptotic) competitive ratio one can use inputs where the optimal cost is arbitrarily large, and we use this method. The study of lower bounds on the competitive ratio for a given problem characterizes the extent to which the performance of the system deteriorates due to lack of information regarding the future input items. Here, we study three versions of the online bin packing problem, providing new lower bounds on the competitive ratio for them. Previous constructions used for proving such lower bounds were often inputs where items arrive in batches, such that the items of one batch all have the exact same size (and the input may stop after a certain batch or it can continue to another one). In the known lower bounds for classic bin packing, it is even known what the next batches will be, if they are indeed presented [23, 29, 6]. While it may be obvious that adaptive inputs where the properties of the next item are based on the packing of previous items are harder for an algorithm to deal with, it was not known until recently how to use this idea for designing lower bounds, except for special cases [9, 2, 17]. In cardinality constrained bin packing [22, 21, 12, 2, 8], items are one-dimensional, a fixed integer t ≥ 2 is given, and the two requirements for a packed bin are that its total size of items is at most 1, and that it contains at most t items. The special case analyzed in the past [9, 2, 17] is t = 2, which can also be seen as a matching problem, as every bin can contain at most two items. In [4] we showed that the overall competitive ratio (supremum over all values of t) is 2 (an upper bound was known prior to that work [2, 8]), and provided improved lower bounds for relatively small values of t. For standard bin packing, the best known lower bound on the competitive ratio is 1.5403 [29, 6] and the best upper bound is 1.57829 [5]. Another lower bound presented in [4] is for the competitive ratio of vector packing in at least two dimensions. For an integer dimension d ≥ 2, the items have d-dimensional vectors associated with them, whose components are rational numbers in [0, 1] (none of which are all-zero vectors), and bins are all-one vectors of dimension d. A subset of items can be packed into a bin if taking no component exceeds 1 in their vector sum. This generalizes cardinality constrained bin packing, and we showed a lower bound of 2.03731129 on the competitive ratio of the online variant for any d ≥ 2 (prior to that work, no lower bound strictly above 2 for a constant dimension was known). Our main goal here is to exhibit how to exploit adaptive constructions with some connection to those used in [4] in order to obtain lower bounds for other variants. We focus on the following three variants. In all three variants of online bin packing which we study, the input consists of rational numbers in (0, 1], however there is additional information received with the input in some of the cases and the input is interpreted in different ways. Two of the problems are one-dimensional and the input numbers are sizes of items. The third variant is two-dimensional, and the numbers are side lengths of squares. In our first variant called bin packing with known optimal cost, the cost of an optimal (offline) solution is given in advance, that is, it is known how many bins are required for packing the input. This problem is also called K-O (known-OPT). It is currently hard to find an appropriate way to use this additional piece of information for algorithm design, but in all lower bounds known for standard online bin packing [29, 6] the property that the optimal cost is different for different inputs is crucial for achieving the result. For K-O, a lower bound of 1.30556 on the competitive ratio was presented [14] and later improved to 1.32312 [3]. We show a new lower bound of 87 62 ≈ 1.4032258 on the competitive ratio, improving the previous result significantly. This problem is related to the field of semi-online algorithms and to the so-called model of online algorithms with advice [10, 1], where the online algorithm is provided with some (preferably very small) pieces of information regarding the input. In the square packing (SP) problem, the goal is to assign an input set of squares whose sides 2 are rational numbers in (0, 1] into bins that are unit squares in a non-overlapping and axis-parallel way, so as to minimize the number of non-empty bins. We use the standard definition of this packing problem, where two squares do not overlap if their interiors do not overlap (but they may have common points on the boundaries of the squares). The offline variant is well-studied [7, 15]. The history of lower bounds on the competitive ratio of online algorithms for this problem is as follows. Several such lower bounds were proved for the online version of SP, starting with a simple construction yielding a lower bound of 4 3 on the competitive ratio by Coppersmith and Raghavan [11], and then there were several improvements [25, 16, 18], all showing bounds above 1.6. In 2016 a copy of the thesis of Blitz [9] from 1996 was found by the authors of [18]. This thesis contains a number of lower bounds for bin packing problems, including a lower bound of 1.680783 on the competitive ratio of online algorithms for SP. The result of Blitz [9] is now the previous best lower bound on the competitive ratio for the problem (prior to our work), and it is higher than the lower bounds of [25, 16, 18]. Here, we show a much higher lower bound, larger than 1.7515445, on the competitive ratio of this problem. Finally, we consider class constrained bin packing (CLCBP) [27, 26, 30, 13]. In this one- dimensional variant every item has a size and a color, and for a given parameter t ≥ 1, any bin can receive items of at most t different colors (of total size at most 1), while the number of items of each color can be arbitrary. This problem generalizes standard bin packing, as for any input of standard bin packing, defining a common color to all items results in an instance of CLCBP for any t. It also generalizes bin packing with cardinality constraints, though here to obtain an instance of CLCBP one should assign distinct colors to all items. We provide improved lower bounds for t = 2, 3. For t = 2, the previous known lower bound was 1.5652 [13]. For t = 3, the previous lower bound was 5 3 ≈ 1.6667 [26]. This last result was proved even for the special case with equal size items. Interestingly, it has elements of adaptivity, but with respect to colors (as all items have identical sizes), and the input moves to presenting items of a new color once the algorithm performs a certain action. We show that the competitive ratio of any online algorithm for CLCBP with t = 2 is at least 1.717668, and that the competitive ratio of any online algorithm for CLCBP with t = 3 is at least 1.808142. The drawback of previous results for all those problems is that while the exact input was not known in advance, the set of sizes used for it was determined prior to the action of the algorithm. We show here that our methods for proving lower bounds can be combined with a number of other approaches to result in improved lower bounds for a variety of bin packing problems. We use the following theorem proved in [4] (see the construction in Section 3.1 and Corollary 3). Theorem 1 (i) Let N ≥ 1 and k ≥ 2 be large positive integers. Assume that we are given an arbitrary deterministic online algorithm for a variant of bin packing and a condition C1 on the possible behavior of an online algorithm for one item (on the way that the item is packed). An adversary is able to construct a sequence of values ai (1 ≤ i ≤ N ) such that for any i, ai ∈ (cid:16)k−2N +3 k4(cid:1). For any item i1 satisfying C1 and any item i2 not satisfying C1, it holds that > k. Specifically, there are values β and γ such that for any item i1 satisfying C1, and any item i2 not satisfying C1, it holds that ai1 < γ < ai2 and , k−2N +2(cid:17), and in particular ai ∈ (cid:0)0, 1 ai2 ai1 ai2 ai1 > β. (ii) If another condition C ′ is given for stopping the input (it can be a condition on the packing or on the constructed input), it is possible to construct a sequence ai consisting of N items such that C ′ never holds, or a sequence of N ′ < N items, such that C ′ holds after N ′ items were introduced (but not earlier), and where the sequence satisfies the requirements above. Examples for the condition C1 can be the following: "the item is packed as a second item of its bin", "the item is packed into a non-empty bin", "the item is packed into a bin an item of size 3 above 1 of non-empty bins". 2 ", etc. An example for the condition C ′ can be "the algorithm has at least a given number The construction of such inputs is based on presenting items one by one, where there is an active (open) interval of sizes out of which future values ai are selected. When a new item is presented, and the algorithm packs it such that it does not satisfy C1, all future items will be smaller. If the algorithm packs a new item such that it satisfies C1, all future items will be larger. This reduces the length of the active interval. Thus, even though the active interval becomes shorter in every step where a new item arrives, it always has a positive length. One can see this as a kind of binary search on the value γ, which will always be contained in the remaining interval (as it remains non-empty). For example, Fujiwara and Kobayashi [17] used a similar approach and in their work the middle point of the active interval is the size of the next item, and the active interval has length that it smaller by a factor of 2 after every step. To obtain the stronger property that items whose sizes is at least the right endpoint of the active interval are larger by a factor of k than items no larger than the left endpoint of the active interval, the selection of the next size is performed by a process similar to geometrical binary search. Note that an important feature is that the value ai is defined before it is known whether C1 holds for the ith item (the item corresponding to ai, that is, the item whose size is a function of ai). We will use this theorem throughout the paper. We study the problems in the order they were defined. 2 Online bin packing with known optimal cost (K-O) Here, we consider the problem K-O, and prove a new lower bound on the competitive ratio for it. We prove the following theorem. Theorem 2 The competitive ratio of any online algorithm for K-O is at least 87 62 ≈ 1.4032258. Let M be a large integer that is divisible by 4 (M will be the value of the known optimal cost). We will create several alternative inputs, such that the optimal cost will be equal to M for each one of them. We use the following construction. For k = 10 and N = M , define an input built using Theorem 1 as follows applied twice on different parts of the input as explained below. The outline of our lower bound construction is as follows. The first part of the input will consist of M items of sizes slightly above 1 7 (such that some of them, those packed first into bins, are larger than the others). Then, there are M items of sizes slightly above 1 3 (where items packed into new bins are larger than 7 or with another item of size roughly 1 others, while those combined with items of sizes roughly 1 3 , or both, are slightly smaller). Finally, the algorithm will be presented with a list of identical items of one of the three sizes 1 (exactly), or slightly above 1 3 , such that every larger item of size slightly above 1 3 ). Additionally, after the first M items arrive, it is possible that instead of the input explained here there are items of sizes slightly below 6 7 , either such that every such item can be packed with any item out of the first M items, or such that it can only be combined with the smaller items out of the first M items (due to the property that the size of an item will be just below 6 7 , in both cases it can be combined with at most one item of size just above 1 3 cannot be packed together with such an item (of size slightly below 2 2 , or slightly below 2 Next, we formally define our input sequences. Throughout this section, let the condition C1 be that the item is not packed as a first item into a bin. The first M items are defined as follows. Using Theorem 1, we create M items such that the size of item i is 1 7 + ai. These items are called S-items. The sizes of such items are in ( 1 7 , 0.143), and there is a value γ1 such that any item whose packing satisfies condition C1 has size below 1 7 + γ1 and any item whose packing does not satisfy 7 ). 4 C1 has size above 1 items are called large S-items. 7 + γ1. The first kind of items are called small S-items, and the second kind of Let Y7 denote the current number of bins used by the algorithm (after all S-items have arrived), and this is also the number of large S-items. Two possible continuations at this point are M items of sizes equal to 4 7 − γ1 (the second option). 5 (the first option), and M − ⌈ Y7 6 ⌉ items of sizes equal to 6 Lemma 3 In both options, an optimal solution has cost M . Proof. In the first option, an optimal solution has one item of size 4 than 0.143 in every bin. It is optimal as every item of size above 1 it can be possibly packed with smaller items). 5 and one item of size no larger 2 requires a separate bin (where In the second option, an optimal solution uses ⌈ Y7 7 − γ1 > 0.857, and M − Y7 of them also have one item (each) of size below 1 6 ⌉ bins to pack the large S-items: Every bin can contain at most six such items, as their sizes are in ( 1 6 ), each remaining bin has one item of size 6 7 + γ1. This is an optimal solution as the two larger kinds of items (those of sizes above 1 2 and the large S-items) cannot be combined into the same bins, and the packing for each of these two kinds of items is optimal. 7 , 1 In the first case, the algorithm can use bins containing exactly one item to pack (also) an item 5 , but it cannot use any other bin again. In the second case, as every bin has exactly one 7 + γ1, the algorithm uses an empty bin for every item of size 6 7 − γ1. of size 4 item of size above 1 We explain the continuation of the input in the case where none of the two continuations already defined is used. The next M items are defined using Theorem 1, and we create M items such that the size of the ith item of the current subsequence of M items is 1 3 +ai (the values ai are constructed here again, and they are different from the values ai constructed earlier). We call these items T - items. The sizes of T -items are in ( 1 3 , 0.33344), and there is a value γ2 such that any item whose packing satisfies condition C1 (defined in this section) has size below 1 3 + γ2 and for any item whose packing does not satisfy C1, it has size above 1 3 + γ2. The first kind of items are called small T -items, and the second type items are called large T -items. Here, there are three possible continuations. The first one is M 2 items, all of size 1. The second one is M items, each of size 0.52. Let Y3 denote the number of new bins created for the T -items, which is also the number of large T -items (so after the T -items are packed the algorithm uses Y7 + Y3 bins). If Y3 ≤ M 3 − γ2 (where 3 − γ2 > 0.66656). Otherwise (Y3 > M 2 2 ⌉ items, each of size 2 3 − γ2) in both cases, and the number of items is M − max{ M 3 − γ2. Thus, in the third continuation, the sizes of items are the same (i.e., 2 2 ), the third continuation is with M − ⌈ Y3 2 , the third continuation is with 3M items, each of size 2 4 4 , ⌈ Y3 2 ⌉}. Lemma 4 The optimal cost in all cases (i.e., after the packing of the items of each possible con- tinuation has been completed) is exactly M . Note that it is sufficient to show that the optimal cost is at most M , as in the case where it is strictly smaller than M , it is possible to present items of size 1 until the optimal cost is exactly M , while the cost of the algorithm does not decrease. We prove that the value is exactly M to stress the property that one cannot prove a better lower bound using the same kind of input. Proof. For the first continuation, an optimal solution packs M 2 bins, each with two S-items and two T -items, and another M 2 bins, each with one item of size 1. This solution is optimal as every item of size 1 has to be packed alone into a bin, and no bin can contain more than two items of sizes above 1 3 . For the second continuation, an optimal solution packs M bins, each with one item of size 0.52, one T -item and one S-item. This solution is optimal as no bin can contain more than one item of size above 1 2 . 5 2 , there are M For the third continuation, the two options for optimal solutions are as follows. Y3 ≤ M packed into these bins (which is possible as there are M There are also M one item of size 2 total size will be below 0.143 · 2 + 2 (this is possible as the size of each small T -item is below 1 In the case 4 bins, each with two T -items and two S-items. All large T -items will be 2 ≥ Y3 T -items packed into those bins). 2 − Y3 small T -items packed into these bins. Each of the remaining bins contains 3 − γ2, where M 4 of those bins also contain two S-items (which is possible as the 2 bins has one small T -item 3 < 1), and each of the remaining M 2 , there are ⌈ Y3 In the case Y3 > M 2 ⌉ bins with two S-items and two large T -items (at most one bin may contain a smaller number of large T -items). All large T -items are packed into these bins, and no small T -items are packed into these bins. The remaining bins all contain one item (each) of size 2 2 ⌉ of those bins also contain two S-items, and M − Y3 of those bins (not containing S-items) also contain one small T -item (this is possible as ⌈ Y3 2 ⌉+M −Y3 ≤ M ). 2 ) is optimal as separate bins are needed The solution for the second case (i.e., for the case Y3 > M 3 − γ2, where M 2 − ⌈ Y3 2 −⌈ Y3 2 ⌉+ M 3 + γ2). for items of size 2 3 − γ2 and large T -items, and the solution obtained for each kind is optimal. Thus, it remains to prove that in the first case (i.e., in the case Y3 ≤ M 2 ), the optimal cost is M . Observe that we showed a feasible solution of cost M , so we need to show that the optimal cost is at least M . In this case every bin with an item of size 2 3 − γ2 can receive either two S-items or one small T -item. Consider an optimal solution and let ∆ ≥ 0 be the number of items of size 2 3 − γ2 packed with a T -item. The remaining (M − ∆) T -items are packed at most two in each bin, so if ∆ ≤ M 2 + 1, at most 2( 3M 2 S-items remain to be packed with (M − ∆) T -items. Even replacing each T -item with two items of size in ( 1 7 , 1 items where a bin can contain at most six items, so at least M 4 = M bins. 6 ] (virtually, for the sake of proof), we have to pack 2(M − ∆) + 2∆ − M 2 = 3M 4 bins are needed, for a total of 3M 2 ≥ M bins. Otherwise, ∆ ≥ M 3 − γ2, and M − 2( 3M 4 − ∆) S-items are packed with items of size 2 2 , we are done as there are at least 3M 4 − ∆) = 2∆ − M 4 + M −∆ 4 + M 2 This completes the description of the input where we showed that in each case the optimal cost is exactly M . Next, we consider the behavior of the algorithm. Consider the kinds of bins the algorithm may have after all T -items have arrived. The T -items do not necessarily arrive, but we will deduce the numbers of different kinds of bins the algorithm has after the S-items have arrived from the numbers of bins assuming that the T -items have arrived. This is an approach similar to that used in [29], where numbers of bins packed according to certain patterns (subsets of items that can be packed into one bin) at the end of the input are considered, and based on them, the number of bins already opened at each step of the input are counted. More precisely, if the input consists of batches of identical (or similar) items, given the contents of a bin it is clear when it is opened and at what times (after arrival of sub-inputs) it should be counted towards the cost of the algorithm. A bin with no T -items can receive an item of size 0.52 if it has at most three S-items and it can receive an item of size 2 3 − γ2 if it has at most two S-items. The only case where a bin with at least one S-item and at least one T -item can receive another item (out of a continuation of the input) is the case that a bin has one of each of these types of items, and it will receive an item of size 0.52. Let X60 denote the number of bins with four or five or six S-items and no T -items. Such a bin cannot receive any further items in addition to its S-items. Let X30 denote the number of bins with three S-items and no T -items. Such a bin can receive an item of size 0.52 (but not a larger item). Let X20 and X10 denote the number of bins with two S-items and one S-item, respectively, and no T -items. Out of possible input items, such a bin can receive an item of size 0.52 or an item of size 2 3 − γ2. We distinguish these two kinds of bins due to the possible other continuations after T -items have arrived. Let X41 denote the number of bins with two or three or four S-items and one T -item. Such bins cannot receive any further items out of our inputs. Let X11 denote the number of bins 6 with one S-item and one T -item. Let X12 and X22 denote the numbers of bins with two T -items and one and two S-items, respectively. Obviously, there can be bins without S-items containing one or two T -items, and we denote their numbers by X01 (one T -item) and X02 (two T -items). We have five scenarios based on the different options and continuations described above, and we use ALGi to denote the cost of a given algorithm for each one of them, in the order they were ALGi M , which is a presented. Let R be the (asymptotic) competitive ratio. Let Ai = lim supM →∞ lower bound on the competitive ratio R since the optimal cost is always M (by Lemmas 3 and 4), so for i = 1, 2, 3, 4, 5 we have the constraint Ai ≤ R. The Ai (for i = 1, 2, 3, 4, 5) will not appear explicitly as variables in the forthcoming linear program. Instead, we will compute each Ai based on the other variables in the program and substitute the resulting expression in the constraint Ai ≤ R. We use yi = Yi M for those values of i and j such that Yi and Xij are defined. For all thirteen variables there is a non-negativity constraint. In addition, the number of items should satisfy Pi,j j · Xij = M and Pi,j i · Xij ≥ M (the second constraint is not an equality as in some cases Xij counts bins with at most (i) S-items). Using the definitions of Y7 and Y3 we have Y7 = X60 + X30 + X20 + X10 + X41 + X11 + X12 + X22 and Y3 = X01 + X02. M and xij = Xij We get the following four constraints: x41 + x11 + 2x12 + 2x22 + x01 + 2x02 = 1 6x60 + 3x30 + 2x20 + x10 + 4x41 + x11 + x12 + 2x22 ≥ 1 y7 − x60 − x30 − x20 − x10 − x41 − x11 − x12 − x22 = 0 y3 − x01 − x02 = 0 (1) (2) (3) (4) ALG2 = M − ⌈ Y7 The costs of the algorithm are as follows. We have ALG1 = M + X60 + X30 + X20 + X41 + X22, 2 , and ALG4 = X60 + X41 + X22 + X12 + X02 + M . 2 , we have ALG5 = 2 , we have ALG5 = Y7 + Y3 − X20 − X10 + 3M 6 ⌉ + Y7, ALG3 = Y7 + Y3 + M 4 , and if Y3 > M If Y3 ≤ M Y7 + Y3 − X20 − X10 + M − ⌈ Y3 2 ⌉. The four first costs of the algorithm (for the first four scenarios) gives the constraints R − x60 − x30 − x20 − x41 − x22 ≥ 1 6R − 5y7 ≥ 6 2R − 2y7 − 2y3 ≥ 1 R − x60 − x41 − x22 − x12 − x02 ≥ 1 (5) (6) (7) (8) The two final constraints form two cases (according to the value of y3), and therefore our list of constraints results in two linear programs (with all previous constraints and two additional ones). The inputs for the two cases are different, and therefore they are considered separately (due to the different inputs, there is one other different constraint except for the constraint on the value of y3). For each one of the linear programs, the objective is to minimize the value of R. One pair of constraints is y3 ≤ 1 2 and 2R − 2y7 − y3 + 2x20 + 2x10 ≥ 2 (observe that the constraint y3 ≥ 1 2 and 4R − 4y7 − 4y3 + 4x20 + 4x10 ≥ 3, and the alternative pair 2 is a relaxation is y3 ≥ 1 of the valid constraint y3 > 1 2 , and thus the weaker constraint y3 ≥ 1 2 is valid in this case). Multiplying the first five constraints by the values 2, 1, 3, 2, 1, respectively, and taking the sum gives: 2x60 + 2x41 + 2x12 + 2x02 + 2x22 − 2x10 − x30 − 2x20 + 3y7 + 2y3 + R ≥ 4 . (9) For the first case, we take the sum of the sixth, eighth, and tenth constraints multiplied by the values 2, 20, 5, respectively, and get: 52R − 30y7 − 20y3 − 20x60 − 20x41 − 20x22 − 20x12 − 20x02 + 20x20 + 20x10 ≥ 47 . 7 Summing this with ten times (9) we get 62R − 10x30 ≥ 87, and by x30 ≥ 0 we get R ≥ 87 1.4032258. 62 ≈ For the second case, we take the sum of the seventh, eighth, and tenth constraints multiplied by the values 1, 4, 2, respectively, and get: 10R − 6y7 − 4y3 − 4x60 − 4x41 − 4x22 − 4x12 − 4x02 + 4x20 + 4x10 ≥ 9 . Summing this with twice (9) we get 12R − 2x30 ≥ 17, and as x30 ≥ 0, we have R ≥ 17 Thus, we have proved R ≥ 1.4032258. 12 ≈ 1.41666. 3 Online Square packing (SP) We continue with the online square packing (SP) problem. We prove the following theorem. Theorem 5 The competitive ratio of any online algorithm for SP is at least 1.7515445. Here, in the description of the input, when we refer to the size of an item, this means the length of the side of the square (and not its area). Consider the following input. For a large positive even integer M and k = 10, we define an input based on using Theorem 1 twice. The construction is similar to that of the previous section, though here we are not committed to a specific optimal cost, and we take into account the multidimensionality. Moreover, for one of the item types the number of such items is also determined by the action of the algorithm (which was difficult to implement in the previous section when the cost of an optimal packing is fixed in advance, and we did not use such an approach there as extensively as in the current section). Here, we only compute upper bounds on the optimal cost for each case. The outline of the construction is as follows. The first part of the input will consist of M items of sizes slightly above 1 4 (such that some of them, those packed first into bins, are larger than the others), then, there are items of sizes slightly above 1 3 (where such items that are packed into bins containing relatively few items, where the exact condition is defined below, will be larger than other items of this last kind). Finally, there will be items of one of the sizes: 3 5 , and slightly below 2 3 (all of them will have exactly the same size), such that every larger item of size slightly above 1 3 cannot be packed together with such an item of size slightly smaller than 2 3 . Additionally, after the first M items arrive, it is possible that instead of the input explained here there are items of sizes slightly below 3 4 , such that it can be only be combined with the smaller items out of the first M items (any bin with an item of size slightly below 3 4 may have at most five smaller items out of the first M items in a common bin). Next, we formally define the construction. Let the condition C11 be that the item is not packed 4 . For 3 , let the condition C12 be that the item is either packed in a bin 3 , or that it contains at least five items whose sizes are in as a first item into a bin. This is the condition we will use for items of sizes slightly above 1 items of sizes slightly above 1 already containing an item of size above 1 4 , 1 ( 1 3 ]. The first M items are defined as follows. Using Theorem 1, we create M items such that the size of item i is 1 4 + ai. These items are called F -items. The sizes of items are in (0.25, 0.2501), and there is a value γ1 such that any item whose packing satisfies condition C11 has size below 1 4 + γ1 and for any item whose packing does not satisfy C11, it has size above 1 4 + γ1. The first kind of items are called small F -items, and the second type items are called large F -items. No matter how the input continues, as any packing of the first M items requires at least M 9 bins, the cost of an optimal solution is Ω(M ). Let Y4 denote the current number of bins used by the algorithm, and this is also the number ⌉ items of (identical) sizes equal of large F -items. A possible continuation at this point is ⌈ M −Y4 5 8 4 − γ1. Note that such an item cannot be packed into a bin with an item of size above 1 to 3 4 + γ1, as it cannot be packed next to it or below (or above) it, and the remaining space (not next to it or below it or above it) is too small (the sum of the diagonals of these two items is too large to be packed into a unit square bin). Lemma 6 There exists a packing of the items of the presented sequence (in this case) of cost at most M 5 − 4Y4 45 + 2. 5 Proof. A possible packing of the items of sizes 3 4 − γ1 together with the (M ) F -items is to use ⌈ M −Y4 ⌉ bins for the new items and combine five small F -items into these bins (one such bin may have a smaller number of F -items). This packing is feasible as the large item can be packed in one corner of a unit square bin, leaving an L shaped area of width 1 4 + γ1, the opposite corner will contain an F -item, and there are two additional such items next to it on each side of the L shaped area. The remaining large F -items are packed into bins containing nine items each (possibly except for one bin), such that the number of such bins is ⌈ Y4 9 ⌉. The total number of bins in this packing is at most M 5 − 4Y4 45 + 2. The algorithm has one large F -item in each of the first Y4 bins and therefore it uses a new bin 4 − γ1. Thus, the total number of bins in the packing of the algorithm (in for every item of size 3 this case) is exactly Y4 + ⌈ M −Y4 ⌉. 5 3 + ai, and the sizes of items are in ( 1 We explain the continuation of the input in the case where the continuation defined above is not used. Here, for the construction, we state an upper bound on the number of items as the exact number of items is not known in advance and it will be determined during the presentation of the input. There will be at most 1.5M items of sizes slightly above 1 3 . We will use the variables S3 and L3 to denote the numbers of items for which condition C12 was satisfied and was not satisfied, respectively, in the current construction. Initialize S3 = L3 = 0, and increase the value of the suitable variable by 1 when a new item is presented. The ith item of the current construction has size 1 3 , 0.33344). These items are called T -items. There is a value γ2 such that any item whose packing satisfies condition C12 has size below 1 3 + γ2 and any item whose packing does not satisfy C12 has size above 1 3 + γ2. The first kind of items are called smaller T -items and the second type items are called larger T -items. Present items until 8S3 + 15L3 ≥ 12M holds (this does not hold initially, so at least one item is presented, and this is defined to be condition C ′). We show that indeed at most 1.5M items are presented. If 1.5M items were already presented, 8S3 + 15L3 ≥ 8 · (1.5M ) = 12M , and therefore the construction is stopped. In what follows, let S3 and L3 denote the final values of these variables. Before the last item of this part of the input was presented, it either was the case that 8(S3 − 1) + 15L3 < 12M or 8S3 + 15(L3 − 1) < 12M (as exactly one of S3 and L3 was increased by 1 when the last item was presented), so 8S3 + 15L3 − 15 < 12M , or alternatively, 8S3 + 15L3 ≤ 12M + 15. Moreover, S3 + L3 ≥ 4M 5 as 12M ≤ 8S3 + 15L3 ≤ 15(S3 + L3). Let M ′ = S3 + L3 (and we have M ′ = Θ(M )). 3 ⌋) identical items, each of size Here, there are two possible continuations. The first one is (⌊ M ′ 3 ⌋ identical items, each of size 2 exactly 0.6, and the second one is ⌊ S3 3 − γ2. Lemma 7 The optimal cost in the first continuation is at most M 9 + 7S3 27 + 7L3 27 + 3. Proof. A possible packing for this case consists of ⌊ M ′ 3 ⌋ bins with one item of size 0.6, three T - items, and two F -items (placing the item of size 0.6 in a corner leaves an L shaped area of width 0.4, so we place one T -item in each of the other corners and in the remaining space between each pair of adjacent T -items we pack an F -item). As M ′ ≤ 3M 3 ⌋ ≥ 0 unpacked F -items, 27 +2 bins, where each bin has nine items (the 2 , there are M − 2⌊ M ′ and they are packed into exactly ⌈ 9 − 2M ′ M −2⌊ M ′ 3 ⌋ ⌉ ≤ M 9 9 last bin may have less items). In addition, there are at most two unpacked T -items, and they are packed into a bin together. The total number of bins is at most M 27 + 3. 27 + 3 = M 9 + 7M ′ 27 + 7L3 9 + 7S3 Lemma 8 The optimal cost in the second continuation is at most S3 3 + L3 4 + 2. 3 ⌋ bins with one item of size 2 Proof. A possible packing for this case consists of ⌊ S3 3 − γ2, three small T -items, and two F -items (placing the item of size 2 3 − γ2 in a corner of a unit square bin leaves an L shaped area of width 1 3 + γ2 where the remaining items are packed). There are at least (S3 − 2) T -items that were packed and at least (2 S3−2 ) F -items are packed. There are also ⌈ L3+2 4 ⌉ bins, each with at most four T -items and at most five F -items (there is a square with four larger items in a corner and the smaller items are packed around them, in the L-shaped area of the bin). This allows to pack the remaining T -items as there is space for at least S3 + L3 such items, and to pack all F -items as there is a place for at least 2 S3−2 4 ≥ M such items, where the last inequality holds by the condition 8S3 + 15L3 ≥ 12M . The total number of bins is at most 3 + L3 S3 3 + 5 L3+2 4 ≥ 2S3 3 + 5 L3 4 + 2. 3 Let Y3 denote the number of new bins created for the T -items (where these bins were empty prior to the arrival of T -items). Here, there may be previously existing bins containing larger T -items (with at most four F -items), and Y3 ≤ L3. Consider the kinds of bins the algorithm may have after all T -items have arrived. Once again, T -items do not necessarily arrive, but we will deduce the numbers of different kinds of bins the algorithm has after all F -items have arrived based on number of bins existing after the arrival of T -items. After all T -items have arrived, a non-empty bin can receive an item of size 0.6 if it has at most five items, out of which at most three are T -items. The construction is such that any non-empty bin except for bins with at most five F -items has either at least six items in total (each of size above 1 3 + γ2 (or both options may occur simultaneously), and therefore it cannot receive an item of size above 2 4 ) or it has an item of size above 1 3 − γ2. 2 that may arrive (but not an item of size 3 Consider a given online algorithm for SP after the T -items were presented. Let X90 denote the number of bins with six, seven, eight, or nine F -items and no T -items. Such a bin cannot receive any further items in addition to its F -items in any of our continuations. Let X50 denote the number of bins with at least one and at most five F -items and no T -items. Such a bin can receive any item of size larger than 1 4 − γ1). Let X81 denote the number of bins with five, six, seven, or eight F -items and one (small) T -item. Let X41 denote the number of bins with at least one and at most four F -items and one (large) T -item. Let X72 denote the number of bins with five, six, or seven F -items and two (small) T -items. Let X42 denote the number of bins with four F -items and two T -items (out of which one is small and one is large). Let X32 be the number of bins with at least one and at most three F -items and two T -items (out of which one is small and one is large). Let X63 denote the number of bins with five or six F -items and three T -items (all of which are small). Let X43 denote the number of bins with three or four F -items and three T -items (out of which two are small and one is large). Let X23 denote the number of bins with one or two F -items and three T -items (out of which two are small and one is large). Let X54 denote the number of bins with five F -items and four T -items (all of which are small). Let X44 denote the number of bins with two or three or four F -items and four T -items (out of which three are small and one is large). Let X14 denote the number of bins with one F -item and four T -items (out of which three are small and one is large). Let X03 be the number of bins with no F -items and at least one and at most three T -items, one of which is a large T -item, while the others (at most two) are small. Let X04 be the number of bins with no F items and four T -items, one of which is large, while three are small. We have three scenarios, and we use ALGi to denote the cost of the algorithm for each one ALGi M . The optimal cost is of them, in the order they were presented. Let Ai = lim supM →∞ 10 M and s3 = S3 M and xij = Xij M , and the ratio Ai OP Ti Oi M , so 12 ≤ 8s3 + 15ℓ3 ≤ 12 + 15 always in Θ(M ), and we let OP Ti denote our upper bounds on the optimal cost of the ith scenario, is lower bound on the competitive ratio R. We use the Oi = lim inf M →∞ notation yi = Yi M for those values of i and j such that Yi and Xij are defined. Let ℓ3 = L3 M , and for M growing to infinity, 8s3 + 15ℓ3 = 12. Let R be the (asymptotic) competitive ratio. For all twenty variables there is a non-negativity constraint. In addition, the number of items should satisfy Pi,j j·Xij ≥ S3+L3 and Pi,j i·Xij ≥ M (once again, the first constraint is inequality and not equality as X03 counts also bins with less than three T -items, and the second constraint is not an equality as in some cases Xij counts bins with fewer than i F -items). Using the definitions of Y4 and Y3 we have Y4 = X90 + X50 + X81 + X41 + X72 + X42 + X32 + X63 + X43 + X23 + X54 + X44 + X14 and Y3 = X03 + X04. We also have ALG1 = Y4 + ⌈ M −Y4 ⌉ while OP T1 ≤ M 5 5 − 4Y4 45 + 2, so R ≥ A1 O1 ≥ 1/5 + 4y4/5 1/5 − 4y4/45 = 9 + 36y4 9 − 4y4 . Additionally, ALG2 = Y4 + Y3 − X50 − X41 − X32 − X23 − X03 + ⌊ M ′ X32 − X23 − X03 + S3+L3 Y4 + Y3 − X50 + S3 3 − 2 while OP T2 ≤ M 3 + L3 3 − 1 while OP T3 ≤ S3 9 + 7S3 4 + 2, so 27 + 7L3 27 + 3, and ALG3 = Y4 + Y3 − X50 + ⌊ S3 3 ⌋ ≥ Y4 + Y3 − X50 − X41 − 3 ⌋ ≥ R ≥ A2 O2 ≥ y4 + y3 − x50 − x41 − x32 − x23 − x03 + s3/3 + ℓ3/3 7s3/27 + 7ℓ3/27 + 1/9 and R ≥ A3 O3 ≥ y4+y3−x50+s3/3 s3/3+ℓ3/4 . We get the following set of constraints: y4 = x90 + x50 + x81 + x41 + x72 + x42 + x32 + x63 + x43 + x23 + x54 + x44 + x14 8s3 + 15ℓ3 = 12 y3 = x03 + x04 x81 + x41 + 2x72 + 2x42 + 2x32 + 3x63 + 3x43 + 3x23 + 4x44 + 4x54 + 4x14 + 3x03 + 4x04 ≥ ℓ3 + s3 x41 + x42 + x32 + x43 + x23 + x44 + x14 + x03 + x04 = ℓ3 9x90 + 5x50 + 8x81 + 4x41 + 7x72 + 4x42 + 3x32 + 6x63 + 4x43 + 2x23 + 5x54 + 4x44 + x14 ≥ 1 9 + 36y4 ≤ R(9 − 4y4) (y4 + y3 − x50 − x41 − x32 − x23 − x03 + s3/3 + ℓ3/3) ≤ R(7s3/27 + 7ℓ3/27 + 1/9) y4 + y3 − x50 + s3/3 ≤ R(s3/3 + ℓ3/4) (10) (11) (12) (13) (14) (15) (16) (17) (18) The optimal objective function value of the mathematical program of minimizing R subject to all these constraints is approximately 1.751544578513 (and it is not smaller than this number). Thus, we have proved R ≥ 1.751544578513. 4 Online class constrained bin packing (CLCBP) In this section we exhibit our approach to proving lower bounds for the last variant of the bin packing problem which we study here, by improving the known lower bounds for the cases t = 2 and t = 3 of CLCBP. We will prove the following theorem. 11 Theorem 9 The competitive ratios of online algorithms for CLCBP with t = 2 and t = 3 are at least 1.717668486 and at least 1.80814287, respectively. The constructions for t = 2 and t = 3 have clear differences, but the general idea is similar. The outline of the constructions is as follows. Start with a large number of tiny items, all of distinct colors, so every bin of any algorithm will contain at most t tiny items. Here, the construction is such that the items packed first into their bins are much larger than other items (large tiny items will be larger by at least a constant multiplicative factor than small tiny items, but they are still very small). One option at this point is to continue with huge items of sizes close to 1, all of distinct colors out of the colors of small tiny items, such that every item of size almost 1 can be packed into a bin with t small tiny items in an offline solution, one of which has the same color as the huge item packed with it. Note that no large tiny item can be combined with a huge item, so those items will be packed separately, t items per bin. The number of huge items is chosen in a way such that the optimal cost is not increased. Another option to continue the construction (instead of introducing the huge items) is with items of sizes slightly above 1 3 , where an item packed into a bin already containing an item of size above 1 3 is smaller than an item packed into a bin with no such item (but it could possibly be packed with tiny items). It is ensured that bins of the algorithm already containing t (tiny) items will not be used again by the algorithm by never introducing items of their colors again. The sizes will be 1 3 plus small values, where these small values are much larger than sizes of tiny items (including sizes of large tiny items). An interesting feature is that there will be exactly two items of sizes slightly above 1 3 with each color which is used for such items, where the idea is to reuse (as much as possible) colors of tiny items packed by the algorithm into bins with at most t − 1 tiny items (where those tiny items can be large or small), and never reuse colors of tiny items packed in bins of t items. In some cases (if there are too few such colors which can be reused), new colors are used as well for items of sizes slightly above 1 3 (but there are still two items of sizes just above 1 3 for each color). After these last items are presented, the final list of 3 , 1 items will be items of sizes above 1 2 ] with the goal of packing such pairs of one color together into bins of offline solutions. There are two options for the final items. There are either such items not much larger than 1 2 , or there are 3 , such that such an item having a color of an item of size slightly above 1 items of sizes close to 2 3 can be combined into a bin with that item and with at most t tiny items coming from bins of the algorithm with at most t − 1 items (no matter whether they are small or large, but one of them has to be of the same color). However, in the case of items of sizes almost 2 3 , only small items of sizes just above 1 3 will be combined with them in good offline solutions while others are packed in pairs (of the same color whenever possible, and of different colors otherwise, combining tiny items where possible). 2 whose colors will match exactly those of items of sizes in ( 1 First, we present the parts of the constructions that are identical for t = 2 and t = 3. The condition C1 will be that the current item is not the first item of its type packed into its bin, where a type consists of all items of similar size (the two relevant types are tiny items and items of sizes slightly above 1 3 ). Let M > 1 be a large integer divisible by 6. The construction starts with the first type of items, where these items are called E-items or tiny items, consisting of M items constructed using Theorem 1. Let the value of k be 20, and the resulting values ai are smaller than 20−22M +2 . The number of tiny items presented is always exactly M (so the stopping condition is that there are M items), and the size of the ith item is simply ai. Every E-item has its own color that may be reused in future parts of the construction but not for E-items. Let ε1 and γ1 be such that the size of any E-item satisfying C1 (which we call a small E-item) is below 2ε1 t and the size of any E-item not satisfying C1 (which we call a large E-item) is above 2ε1 (but smaller than 20−22M +2 ). Let Xj (for 1 ≤ j ≤ t) be the number of bins of the algorithm with j E-items. Let X denote the total number of bins of E-items, i.e., X = Pt 20 < ε1 j=1 Xj. 12 If huge items arrive now, their number is ⌊ M −X ⌋ and their colors are distinct colors out of colors of small E-items. The size of every huge item is 1 − ε1. If Xt ≤ M 2t , there are no other continuations. In all other cases, there are two possible continuations except for the one with huge items, which was just discussed. t 22 1022M +3 = 2M +2 2M +3 2M +2 2M +2 , 10−22M +2 ). We have (by M ≥ 1) 10−2 20−22M +2 = 102 In all other continuations, items of a second type are presented such that their number is at most 2M , and they will be called T -items. They are constructed using Theorem 1 with k = 10, so their values of ai are in (10−22M +3 22 104 > 6 > t. The size of the ith T -item is 1 3 + ai, and here condition C1 means that the T -item is packed by the algorithm as the second T -item of its bin. Let ε2 and γ2 be such that a T -item satisfying C1 (which we call a small T -item) has size smaller than 1 10 and a T -item not satisfying C1 (which we call a large T -item) has size larger than 1 3 + ε2. The number of T -items is even, and their colors are such that there are two T -items for each color. These colors are colors of E-items that are not packed in bins of t E-items by the algorithm. As the number of such E-items is M − t · Xt, if the number of T -items is larger than 2(M − t · Xt), new colors (which were not used for any earlier item) are used (and for the new colors there are also two T -items for each color). The variables Z1 and Z2 denote the numbers of bins with at least one T -item and with exactly two T -items, respectively, used by the algorithm (so Z2 ≤ Z1). The algorithm may use bins with at most (t − 1) E-items to pack T items (but not bins with (t) E-items, as no additional items have colors as those items). 3 + ε2 For t = 2, the number of T -items is max{2X1, 2X2}. Since 2X2 ≤ M and 2X1 ≤ 2M , the number of T -items does not exceed 2M . For t = 3, the stopping condition is defined as follows. First, present items until at least one of Z1 + Z2 + 6X3 ≥ 2M − 1, 3Z1 + 4Z2 ≥ 2M − 7 holds. Then, if the second condition holds, stop presenting items. If the first condition holds (and the second one does not hold), continue presenting items until 2Z1 + 3Z2 ≥ 6X3 − 5 holds and stop. At this time, if the current number of T -items is odd, one additional item is presented. Thus, we guarantee that the value of Z1 + Z2 is an even number. Since the value X3 is already fixed when T -items are presented, we analyze the increase in the value of each expression when a new T -item is presented. If a new item is packed into a bin with no T -item (and it is large), then the value of Z1 increases by 1 while the value of Z2 is unchanged. Otherwise (it is small), the value of Z2 increases by 1 while the value of Z1 is unchanged. Thus, the value of Z1 + Z2 can increase by at most 1, while that of 3Z1 + 4Z2 can increase by at most 4, and that of 2Z1 + 3Z2 can increase by at most 3. Thus, there are two cases. If the first condition that holds is 3Z1 + 4Z2 ≥ 2M − 7, when it started to hold, the value of the left hand side was increased by at most 4. If another item is presented to make the number of items even, it could increase by at most 4 again, so 3Z1 + 4Z2 ≤ 2M . If Z1 + Z2 + 6X3 ≥ 2M − 1 holds first (note that the two conditions could potentially start holding at the same time), then still Z1 + Z2 + 6X3 ≤ 2M . If in the current step it holds that Z1 + Z2 + 6X3 ≥ 2M − 1 and 3Z1 + 4Z2 ≤ 2M − 8, at that time, 2Z1 + 3Z2 ≤ 6X3 − 6 holds (as otherwise, taking the sum of Z1 + Z2 + 6X3 ≥ 2M − 1 and 2Z1 + 3Z2 ≥ 6X3 − 5 gives 3Z1 +4Z2 ≥ 2M −6 > 2M −7). Therefore in the case the first condition holds first while the second one does not, additional items are presented and finally 2Z1 + 3Z2 ≤ 6X3 (counting the last two items). Thus, after all T -items have arrived, it is either the case that Z1 + Z2 ≤ 3Z1 + 4Z2 ≤ 2M or that Z1 + Z2 ≤ 2Z1 + 3Z2 ≤ 6X3 ≤ 2M (as 3X3 ≤ M ), so there are indeed at most (2M ) T -items. 2 with the same color. There are two continuations as follows. In the first one, there are items of sizes 0.6, such that there is a matching item for every T -item (a different matching item for every item, i.e., Z1 + Z2 items of size 0.6 in total). In the second one, there are items of sizes 2 5 , such that every small T -item has a matching item (once again, a different matching item for every item, i.e., Z2 items in total). This concludes the description of our lower bounds constructions for the two cases of t = 2 and t = 3. A matching item for a T -item is an item of size above 1 3 − ε2 13 4.1 The analysis Let ALGi and OP Ti respectively denote the costs of the algorithm and of an optimal solution for the ith continuation. We use algi = ALGi M . This auxiliary notation will assist us as we would like to find the bounds for M growing to infinity. The competitive ratio satisfies . We will also use xi = Xi ALGi M , for values of i R ≥ lim supM →∞ OP Ti that these variables are defined, and x = X M . M and opti = OP Ti M and zi = Zi = lim supM →∞ algi opti Consider a given online algorithm and an offline solution after the huge items are presented. Lemma 10 We have ALG1 = X + ⌊ M −X t ⌋ and OP T1 ≤ M t . Proof. Every huge item can be packed with t small E-items, if one of them has the same color as the huge item. No huge item can be packed with a large E-item in one bin. Thus, the algorithm has ⌊ M −X ⌋ bins with huge items (one huge item packed into each such bin), and all of them contain no other items (as every bin of the algorithm with E-items has a large E-item). A possible offline solution has ⌊ M −X ⌋ bins with a huge item and a small E-item of the same color (as the color of t t the huge item) and t − 1 other small E-items, and there are ⌋ bins with t E-items not packed in the previous set of bins. All E-items are packed, and the total number of bins is M t . t t = M t − ⌊ M −X t M −t(⌊ M −X ⌋) Lemma 11 We have R ≥ tx + (1 − x). If xt ≤ 1 2t , then the competitive ratio is at least 2 − 1 2t . Proof. In this case we consider the input without continuations. By Lemma 10 and by letting M grow to infinity, we have alg1 = t−1 2t , at least M − tXt ≥ M t−1 and x ≥ xt + 1−txt 2 items are packed in bins containing at most t − 1 items, and thus x − xt ≥ 1−txt t , and R ≥ (t − 1)x + 1. As Xt ≤ M 2t(t−1) . We get R ≥ 4t−1 t−1 ≥ 1−1/(2t) t−1 = 2t−1 2t = 2 − 1 2t . t x + 1 t , opt1 ≤ 1 t−1 = 1−xt Using the first part of the last lemma, we get R ≥ 2x + (1 − x) = x + 1 = x1 + x2 + 1 for t = 2, and R ≥ 2x + 1 for t = 3. As we prove lower bounds that are lower than 1.75 for t = 2 and lower than 1.8333 for t = 3, by the last lemma, it is left to deal with the case xt ≥ 1 2t . Note that the continuation of huge items is still possible for those cases. The remaining part of the analysis is performed separately for the two cases. 2 < 2x2. As the number of The case t = 2. T -items is 2 max{X1, X2}, there are two T -items of any color of an E-item packed alone in a bin by the algorithm just after the E-items have arrived. In this case we assume x2 > 1 4 and therefore x1 < 1 Lemma 12 We have alg2 ≥ x2 + z1 + 2z2, alg3 ≥ x2 + z1 + z2, opt2 ≤ z1 + z2, and opt3 ≤ z1+2z2+2x2−max{x1,x2} 2 . Proof. The algorithm never reuses bins with two E-items as no further item has color of any of their colors. If the final items have sizes of 0.6, the bins with one T -item can possibly be reused (but not those with two such items). The number of final items is the same as the T -items, that is, Z1 + Z2. If the final items have sizes of 2 5 , as any bin with at least one T -item has a large T -item, no bins with T -items can be reused by the algorithm. The number of final items is Z2 in this case. The lower bounds on the costs of the algorithm follow from the numbers of items of sizes above 1 2 in the final part of the input, and from the property that they cannot be added to bins with two tiny items, to bins with two T -items, and in the case of items of sizes 2 5 they cannot be added to any bin with a large T -item (in this case they cannot be added to any bin with at least one T -item). 3 − ε2 3 − ε2 14 Consider the following offline solutions. If the final items have sizes of 0.6, every bin contains a T -item and its matching item of size 0.6. It also contains an E-item of the same color, if it exists (it is also possible that it exists but it is packed in another bin with a T -item of the same color), and at most one E-item of another color. As Z1 + Z2 ≥ 2X1 and Z1 + Z2 ≥ 2X2, every E-item packed alone in the algorithm (after all the E-items arrive) has a T -item of its color (there are two items with this color, and it can be packed with one of them). Given the number of bins of this solution, it is possible to add (at most) one E-item, which is packed in bins of two E-items by the algorithm, to each bin containing an item of size 0.6 (as the number of such E-items is 2X2 and the number of bins is the number of T -items, that is, at least 2X2). The total size of items in every bin is below 0.94. Thus, those Z1 + Z2 bins are packed in a valid way and contain all items. 3 − ε2 If the final items have sizes of 2 3 − ε2 5 , as E-items have sizes no larger than ε2 60 , it is possible to pack one small T -item with its matching item of size 2 5 , and at most two E-items, one of which has the same color as the small T -item. As there are Z2 small T -items, there are at least Z1 − Z2 large T -items such that the other T -item of the same color is large, and therefore there are at least Z1−Z2 pairs of large T -items with common colors (as Z1 + Z2 is even, Z1 − Z2 is even too). There are Z1 − Z2 large T -items that are packed in pairs, such that Z1−Z2 pairs of two large T -items of the same color are packed together with one E-item of their color and one E-item of another color (because it cannot contain items of an additional color). Note that even if there is a larger number of pairs of large T -items with common colors, exactly Z1−Z2 pairs are packed in this way. The other large T -items and unpacked E-items are simply packed in pairs. Note that there are (2X2) E-items with unique colors (where no other item has the same color). We have packed Z2 + Z1−Z2 = max{X1, X2} < 2X2 items (recall that the number of T -items is 2 · max{X1, X2} and it is also Z1 + Z2, while there are (2X2) E-items of unique colors and the number of other E-items is X1 ≤ max{X1, X2}, while the number of colors of T -items is max{X1, X2}) that are E-items with unique colors, so there are still such items to be packed. There are Z1 large T -items, and therefore Z2 such items remain. Therefore, as the number of ⌉ = X2 − ⌊ Z1−Z2 unpacked E-items of unique colors is 2X2 − Z1+Z2 ⌋ bins are used for the pairs. Thus, the number of bins is at most Z2 + Z1−Z2 4 + 1 = X2 + Z1+3Z2 2 , and in the case Z1 + Z2 = 2X1, we have X2 + Z1+3Z2 2 . In both cases the number of bins is at most Z1 4 . The other E-items are packed with T -items of their colors. 4 + 1. In the case Z1 + Z2 = 2X2, we have X2 + Z1+3Z2 2 +Z2 2 2 + X2 − Z1−Z2 = Z1 2 + Z2 + X2 − X1 = Z1 2 + Z2 + X2 = Z1+Z2 2 2 2 + Z2 + X2 − max{X1,X2} 2 , an additional ⌈ 2 2 2 2 2X2− Z1+Z2 4 4 Here we solve two mathematical programs, both minimizing R under constraints including non- negativity constraints for all variables, and the properties x1 ≤ 2x2, x1 + x2 + 1 ≤ R, x2 + z1 + 2z2 ≤ R(z1 + z2), z2 ≤ z1, and x1 + 2x2 = 1. The first program is for the case x2 ≥ x1, which is one of the constraints (where z1 + z2 = 2x2). The other constraints are z2 + z1 − 2x2 = 0, x2 + z1 + z2 ≤ R(z1/2 + z2 + x2/2). Solving the program shows that R ≥ 1.7320507 in this case. The second program is for the case x1 ≥ x2, which is one of the constraints (and here z1 + z2 = 2x1). The other constraints are z2 + z1 − 2x1 = 0, x2 + z1 + z2 ≤ R(z1/2 + z2 + x2 − x1/2). Solving the program shows that R ≥ 1.717668486 in this case. The case t = 3. In this case we assume x3 > 1 6 . Lemma 13 We have alg2 ≥ x3 + z1 + 2z2, alg3 ≥ x3 + z1 + z2, opt2 ≤ z1 + z2, and opt3 ≤ z1+2z2 2 . Proof. The algorithm never reuses bins with three E-items as no further item has any color of their colors. Other than that, the arguments for the costs of the algorithm are the same as in the case t = 2. 15 Next, we analyze offline solutions. In both cases of final items, the difference with the case t = 2 is that every bin can contain two E-items whose colors are unique (either because they come from bins with three E-items of the algorithm or because the number of colors of T -items is smaller than the number of items coming from bins of the algorithm with less than three items). It is possible to add such items to the bins as the size of three E-items is still below ε2 10 . We first calculate the number of E-items of unique colors (that is, E-items of colors that appear In the case where Z1 + Z2 + 6X3 ≥ 2M − 1 we have in fact only once for the entire input). Z1 + Z2 + 6X3 ≥ 2M as the value Z1 + Z2 is even. In this case every E-item packed in a bin with less than three E-items by the algorithm has two T -items of its color, and it can always be packed with one of them. In this case the number of E-items of unique colors is 3X3. Otherwise, the number of E-items of unique colors is M − Z1+Z2 , as there are (Z1 + Z2) T -items, and there are two T -items of each color. 2 3 − ε2 We claim that in the case of final items of sizes 2 5 , it is possible to pack all E-items of unique colors, possibly except for a constant number of items which can be packed separately into a constant number of bins. We claim that there is always space for at least (Z1 + 1.5Z2 − 1) E-items of unique colors. The difference with the case t = 2 is that the bins with the final items can receive two E-items of unique colors and not only one (and there are Z2 such bins). The bins with pairs of large T -items of one color can receive two E-items of unique colors (and there are Z1−Z2 such bins), and the remaining bins, with two large T -items of distinct colors can receive one such E-item (and there are ⌈ Z2 2 ⌉) E-items If their number if 3X3, we also have Z1 + 1.5Z2 ≥ 3X3 − 2.5, so excluding a of unique colors. constant number of such items, all of them are packed. If their number is M − Z1+Z2 , we also have 3Z1 + 4Z2 ≥ 2M − 7, so M − Z1+Z2 2 ≤ Z1 + 1.5Z2 + 3.5. Thus, we find opt2 ≤ z1+2z2 . In the case where the final items have sizes of 0.6, it is possible to pack (2Z1 + 2Z2) E-items of unique colors in those bins, and opt2 ≤ z1 + z2. 2 ⌉ such bins). Thus, it is possible to pack at least (2Z2 + 2 Z1−Z2 2 + ⌈ Z2 2 2 2 Here we also solve two mathematical programs, both minimizing R under constraints including non-negativity constraints for all variables. Other constraints are x1+2x2+3x3 = 1, x = x1+x2+x3, 1 + 2x ≤ R, z2 ≤ z1, x3 + z1 + z2 ≤ R(z1 + 2z2)/2, and x3 + z1 + 2z2 ≤ R(z1 + z2). The first program is for the case where Z1 + Z2 + 6X3 ≥ 2M − 1 and −5 ≤ 2Z1+ 3Z2− 6X3 ≤ 0. These properties result in the constraints z1 + z2 + 6x3 ≥ 2 and 2z1 + 3z2 − 6x3 = 0. Solving the program shows that R ≥ 1.902018 in this case. The second program is for the case where Z1+Z2+6X3 ≤ 2M +12 and 2M −7 ≤ 3Z1+4Z2 ≤ 2M hold. Note that if we stop presenting T -items due to the second case where 2M − 7 ≤ 3Z1 + 4Z2 it means that in the previous (even-indexed) step the first condition Z1 + Z2 + 6X3 ≥ 2M − 1 did not hold. Therefore, at that time Z1 + Z2 + 6X3 ≤ 2M − 2 holds, and the value of the left hand side may increase by at most 7 in one step (and thus by at most 14 in the last two steps). Those properties result in the constraints z1 + z2 + 6x3 ≤ 2 and 3z1 + 4z2 = 2. Solving the program shows that R ≥ 1.80814287 in this case. 5 Summary We showed that the method of designing fully adaptive instances, previously used for cardinality constrained bin packing and vector packing [4] (see also [9, 2, 17]) can be used to improve the known lower bounds for several additional bin packing problems. We analyzed its effect (together with many additional ideas) for several variants, and expect that it could be useful for a number of other variants as well. 16 References [1] S. Angelopoulos, C. Durr, S. Kamali, M. P. Renault, A. Ros´en. Online bin packing with advice of small size. In Proc. of The 14th International Symposium Algorithms and Data Structures (WADS'15), 40 -- 53, 2015. [2] L. Babel, B. Chen, H. Kellerer, and V. Kotov. Algorithms for on-line bin-packing problems with cardinality constraints. Discrete Applied Mathematics, 143(1-3):238 -- 251, 2004. [3] J. Balogh and J. B´ek´esi. Semi-on-line bin packing: a short overview and a new lower bound. Central European Journal of Operations Research, 21(4):685 -- 698, 2013. [4] J. Balogh, J. B´ek´esi, Gy. D´osa, L. Epstein, and A. Levin, Online bin packing with cardinal- ity constraints resolved. The Computing Res. Rep. (CoRR), http://arxiv.org/abs/1608.06415, 2016. Also in ESA'17, to appear. [5] J. Balogh, J. B´ek´esi, Gy. D´osa, L. Epstein, and A. Levin, A new and improved algorithm for online bin packing. The Computing Res. Rep. (CoRR), http://arxiv.org/abs/1707.01728, 2017. [6] J. Balogh, J. B´ek´esi, and G. Galambos. New lower bounds for certain classes of bin packing algorithms. Theoretical Computer Science, 440-441:1 -- 13, 2012. [7] N. Bansal, J. Correa, C. Kenyon, and M. Sviridenko. Bin packing in multiple dimensions: Inapproximability results and approximation schemes. Mathematics of Operations Research, 31(1):31 -- 49, 2006. [8] J. B´ek´esi, Gy. D´osa, and L. Epstein. Bounds for online bin packing with cardinality constraints. Information and Computation 249:190 -- 204, 2016. [9] D. Blitz. Lower bounds on the asymptotic worst-case ratios of on-line bin packing algorithms. M.Sc. thesis, University of Rotterdam, number 114682, 1996. [10] J. Boyar, S. Kamali, K. S. Larsen, and A. L´opez-Ortiz. Online bin packing with advice. Algo- rithmica 74(1):507 -- 527, 2016. [11] D. Coppersmith and P. Raghavan. Multidimensional online bin packing: Algorithms and worst case analysis. Operations Research Letters, 8(1):17 -- 20, 1989. [12] L. Epstein. Online bin packing with cardinality constraints. SIAM Journal on Discrete Math- ematics, 20(4):1015 -- 1030, 2006. [13] L. Epstein, Cs. Imreh, and A. Levin. Class constrained bin packing revisited. Theoretical Computer Science, 411(34-36):3073 -- 3089, 2010. [14] L. Epstein and A. Levin. On bin packing with conflicts. SIAM J. on Optimization, 19(3):1270 -- 1298, 2008. [15] L. Epstein and A. Levin. Robust approximation schemes for cube packing. SIAM Journal on Optimization, 23(2):1310 -- 1343, 2013. [16] L. Epstein and R. van Stee. Online square and cube packing. Acta Informatica, 41(9):595 -- 606, 2005. 17 [17] H. Fujiwara and K. Kobayashi. Improved lower bounds for the online bin packing problem with cardinality constraints. Journal of Combinatorial Optimization, 29(1):67 -- 87, 2015. [18] S. Heydrich, R. van Stee, Improved Lower Bounds for Online Hypercube Packing. The Com- puting Res. Rep. (CoRR), http://arxiv.org/abs/1607.01229, 2016. [19] D. S. Johnson. Fast algorithms for bin packing. Journal of Computer and System Sciences, 8:272 -- 314, 1974. [20] D. S. Johnson, A. Demers, J. D. Ullman, M. R. Garey, and R. L. Graham. Worst-case perfor- mance bounds for simple one-dimensional packing algorithms. SIAM Journal on Computing, 3:256 -- 278, 1974. [21] H. Kellerer and U. Pferschy. Cardinality constrained bin-packing problems. Annals of Opera- tions Research, 92:335 -- 348, 1999. [22] K. L. Krause, V. Y. Shen, and H. D. Schwetman. Analysis of several task-scheduling algorithms for a model of multiprogramming computer systems. Journal of the ACM, 22(4):522 -- 550, 1975. [23] F. M. Liang. A lower bound for on-line bin packing. Information Processing Letters, 10(2):76 -- 79, 1980. [24] S. S. Seiden. On the online bin packing problem. Journal of the ACM, 49(5):640 -- 671, 2002. [25] S. S. Seiden and R. van Stee. New bounds for multi-dimensional packing. Algorithmica, 36(3):261 -- 293, 2003. [26] H. Shachnai and T. Tamir. Tight bounds for online class-constrained packing. Theoretical Computer Science, 321(1):103 -- 123, 2004. [27] H. Shachnai and T. Tamir. Polynomial time approximation schemes for class-constrained packing problems. Journal of Scheduling, 4(6):313 -- 338, 2001. [28] J. D. Ullman. The performance of a memory allocation algorithm. Technical Report 100, Princeton University, Princeton, NJ, 1971. [29] A. van Vliet. An improved lower bound for online bin packing algorithms. Information Processing Letters, 43(5):277 -- 284, 1992. [30] E. C. Xavier and F. K. Miyazawa. The class constrained bin packing problem with applications to video-on-demand. Theoretical Computer Science, 393(1-3):240 -- 259, 2008. [31] A. C. C. Yao. New algorithms for bin packing. Journal of the ACM, 27:207 -- 227, 1980. 18
1802.09709
1
1802
2018-02-27T03:56:48
Fully Dynamic Maximal Independent Set with Sublinear Update Time
[ "cs.DS" ]
A maximal independent set (MIS) can be maintained in an evolving $m$-edge graph by simply recomputing it from scratch in $O(m)$ time after each update. But can it be maintained in time sublinear in $m$ in fully dynamic graphs? We answer this fundamental open question in the affirmative. We present a deterministic algorithm with amortized update time $O(\min\{\Delta,m^{3/4}\})$, where $\Delta$ is a fixed bound on the maximum degree in the graph and $m$ is the (dynamically changing) number of edges. We further present a distributed implementation of our algorithm with $O(\min\{\Delta,m^{3/4}\})$ amortized message complexity, and $O(1)$ amortized round complexity and adjustment complexity (the number of vertices that change their output after each update). This strengthens a similar result by Censor-Hillel, Haramaty, and Karnin (PODC'16) that required an assumption of a non-adaptive oblivious adversary.
cs.DS
cs
Fully Dynamic Maximal Independent Set with Sublinear Update Time Sepehr Assadi∗ University of Pennsylvania Krzysztof Onak† IBM Research Baruch Schieber‡ IBM Research Shay Solomon§ IBM Research Abstract A maximal independent set (MIS) can be maintained in an evolving m-edge graph by simply recomputing it from scratch in O(m) time after each update. But can it be maintained in time sublinear in m in fully dynamic graphs? We answer this fundamental open question in the affirmative. We present a deterministic algorithm with amortized update time O(min{∆, m3/4}), where ∆ is a fixed bound on the maximum degree in the graph and m is the (dynamically changing) number of edges. We further present a distributed implementation of our algorithm with O(min{∆, m3/4}) amortized message complexity, and O(1) amortized round complexity and adjustment complex- ity (the number of vertices that change their output after each update). This strengthens a similar result by Censor-Hillel, Haramaty, and Karnin (PODC'16) that required an assumption of a non-adaptive oblivious adversary. 8 1 0 2 b e F 7 2 ] S D . s c [ 1 v 9 0 7 9 0 . 2 0 8 1 : v i X r a ∗[email protected] Supported in part by NSF grant CCF-1617851. †[email protected][email protected] §[email protected] 1 Introduction Dynamic graph algorithms constitute an active area of research in theoretical computer science. Their objective is to maintain a solution to a combinatorial problem in an input graph-for exam- ple, a minimum spanning tree or maximal matching-under insertion and deletion of edges. The research on dynamic graph algorithms addresses the natural question of whether one essentially needs to recompute the solution from scratch after every update. This question has been asked over the years for a wide range of problems such as connectivity [30, 32], minimum spanning tree [20,22,29,32,45], maximal matching [7,31,37,43], approximate matching and vertex cover [10–12,14–16,25,31,37,38], shortest paths [1,8,9,19,21,26–28,34,42,44], and graph coloring [3, 6, 13] (this is by no means a comprehensive summary of previous results). Surprisingly however, almost no work has been done for the prominent problem of maintaining a maximal independent set (MIS) in dynamic graphs. Indeed, the only previous result for this problem that we are aware of is due to Censor-Hillel et al. [17], who developed a randomized algorithm for this problem in distributed dynamic networks and left the sequential case (the main focus of this paper) as a major open question. We note that implementing their distributed algorithm in the sequential setting requires Ω(∆)1 update time in expectation, where ∆ is a fixed upper bound on the degree of vertices in the graph and can be as large as Θ(m) in sparse graphs. The maximal independent set problem is of fundamental importance in graph theory with natural connections to a plethora of other basic problems, such as vertex cover, matching, vertex coloring, and edge coloring (in fact, all these problems can be solved approximately by finding an MIS, see, e.g., the paper of Linial [35]). As a result, this problem has been studied extensively in different settings, in particular in parallel and distributed algorithms [2, 4, 5, 18, 23, 33, 35, 36, 39]. (We refer the interested reader to the papers of Barenboim et al. [5] and Ghaffari [23] for the story of this problem in these settings and a comprehensive summary of previous work.) In this paper, we concentrate on sequential algorithms for maintaining a maximal independent set in a dynamic graph. Our results are also applicable to the dynamic distributed setting and improve upon the previous work of Censor-Hillel et al. [17]. 1.1 Problem Statement and Our Results Recall that a maximal independent set (MIS) of an undirected graph, is a maximal collection of vertices subject to the restriction that no pair of vertices in the collection are adjacent. In the maximal independent set problem, the goal is to compute an MIS of the input graph. We study the fully dynamic variant of the maximal independent set problem in which the goal is to maintain an MIS of a dynamic graph G, denoted by M := M(G), subject to a sequence of edge insertions and deletions. When an edge change occurs, the goal is to maintain M in time significantly faster than simply recomputing it from scratch. Our main result is the following: Theorem 1. Starting from an empty graph on n fixed vertices, a maximal independent set can be maintained deterministically over any sequence of edge insertions and deletions in O(m3/4) amortized update time, where m denotes the dynamic number of edges. As a warm-up to our main result in Theorem 1, we also present an extremely simple deterministic algorithm for maintaining an MIS with O(∆) amortized update time, where ∆ is a fixed upper bound on the maximum degree of the graph. Our algorithms can be combined together to achieve a deterministic O(min (cid:8)∆, m3/4(cid:9)) amortized update time algorithm for maintaining an MIS in dynamic graphs. This constitutes the first improvement on the update time required for this 1 It is not clear whether O(∆) time is also sufficient for this algorithm or not; see Section 6 of their paper. 1 problem in fully dynamic graphs over the naıve O(m) bound for all possible values of m. We now elaborate more on the details of our algorithm in Theorem 1. Deterministic Algorithm. An important feature of our algorithm in Theorem 1 is that it is deterministic. The distinction between deterministic and randomized algorithms is particularly im- portant in the dynamic setting as almost all existing randomized algorithms require the assumption of a non-adaptive oblivious adversary who is not allowed to learn anything about the algorithm's random bits. Alternately, this setting can be viewed as the requirement that the entire sequence of updates be fixed in advance, in which case the adversary cannot use the solution maintained by the algorithm in order to break its guarantees. While these assumptions can be naturally justified in many settings, they can render randomized algorithms entirely unusable in certain scenarios (see, e.g., [8, 10, 15] for more details). As a result of this assumption, obtaining a deterministic algorithm for most dynamic problems is considered a distinctively harder task compared to finding a randomized one. This is evident by the polynomial gap between the update time of best known deterministic algorithms compared to randomized ones for many dynamic problems. For example, a maximal matching can be maintained in a fully dynamic graph with O(1) update time via a randomized algorithm [43], assuming a non- adaptive oblivious adversary, while the best known deterministic algorithm for this problem requires Θ(√m) update time [37] (see [13] for a similar situation for (∆ + 1)-coloring of vertices of a graph). O(1)-Amortized Adjustment Complexity. An important performance measure of a dynamic algorithm is its adjustment complexity (sometimes called recourse) that counts the number of vertices (or edges) that need to be inserted to or deleted from the maintained solution after each update (see, e.g. [3, 13, 17, 24]). For many natural graph problems such as maintaining a maximal matching, constant worst-case adjustment complexity can be trivially achieved since one edge update cannot ever necessitate more than a constant number of changes in the maintained solution. This is, however, not the case for the MIS problem: by inserting an edge between two vertices already in M, the adversary can force the algorithm to delete at least one end point of this edge from M, which in turn forces the algorithm to pick all neighbors of this deleted vertex to ensure maximality (this phenomena also highlights a major challenge in the treatment of this problem compared to the maximal matching problem which we discuss further below). Nevertheless, we prove that the adjustment complexity of our algorithm in Theorem 1 is O(1) on average which is clearly optimal. Can we further improve our results to achieve an O(1) worst-case adjustment complexity? We claim that this is indeed not possible by showing that the worst-case adjustment complexity of any algorithm for maintaining an MIS is Ω(n), using a simple adaption of an example proposed originally by [17] for proving a similar result in distributed settings when vertex deletions are also allowed by the adversary (this follows seamlessly from the result in [17] and is provided in Appendix A only for completeness). Distributed Implementation. Finding a maximal independent set is one of the most studied problems in distributed computing. In the distributed computing model, there is a processor on each vertex of the graph. Computation proceeds in synchronous rounds during which every processor can communicate messages of size O(log n) with its neighbors (this corresponds to the CONGEST model of distributed computation; see Section 5 for further details). In the dynamic setting, both edges and vertices can be inserted to or deleted from the graph and the goal is to update the solution in a small number of rounds of communication, with small communication cost and adjustment complexity. Our results in the sequential setting also imply a deterministic distributed algorithm for main- taining an MIS in a dynamic network with O(1) amortized round complexity, O(1) amortized ad- justment complexity, and O(min (cid:8)∆, m3/4(cid:9)) amortized message complexity per each update. This 2 result achieves an improved message complexity compared to the distributed algorithm of [17] with asymptotically the same round and adjustment complexity (albeit in amortized sense as opposed to in expectation; see Section 5). More importantly, our result is achieved via a deterministic algorithm and does not require the assumption of a non-adaptive oblivious adversary. Similar to [17], our algorithm can also be implemented in the asynchronous model, where there is no global synchronization of communication between nodes. We elaborate more on this result in Section 5. Maximal Independent Set vs. Maximal Matching. We conclude this section by comparing the maximal independent set problem to the closely related problem of maintaining a maximal matching2 in dynamic graphs. We discuss additional challenges that one encounters for the maximal independent set problem. In sharp contrast to the maximal independent set problem, maintaining maximal matchings in dynamic graphs has been studied extensively, culminating in an O(√m) worst-case update time deterministic algorithms [37] and O(1) expected update time randomized algorithm [43] (assuming a non-adaptive oblivious adversary). Maintaining an MIS in a dynamic graph seems inherently more complicated than maintaining a maximal matching. One simple reason is that as argued before, a single update can only change the status of O(1) edges/vertices in the maximal matching, while any algorithm can be forced to make Ω(n) changes to the MIS for a single edge update in the worst case. As a result, a maximal matching can be maintained with an O(∆) worst-case update time via a straightforward algorithm (see, e.g. [31, 38]), while the analogous approach for MIS only results in O(m) update time. Another, perhaps more fundamental difference between the two problems lies in their different level of "locality." To adjust a maximal matching after an update, we only need to consider the neighbors of the recently unmatched vertices (to find another unmatched vertex to match with), while to fix an MIS, we need to consider the two-hop neighborhood of a recently removed vertex from the MIS (to add to the MIS the neighbors of this vertex which themselves do not have another neighbor in the MIS). We note that this difficulty is similar-in-spirit to the barrier for maintaining a better than 2 approximate matching via excluding length-3 augmenting paths in dynamic graphs. Currently, the best known algorithm for achieving a better than 2-approximation to matching in dynamic graphs requires O(m1/4) update time [10, 11]. Achieving sub-polynomial in m update time-even using randomness and assuming a non-adaptive oblivious adversary-remains a major open problem in this area (we refer the interested reader to [15] for more details). We emphasize that even for the seemingly easier problem of maximal matching, the best upper bound on update time using a deterministic algorithm (the focus of our paper) is only O(√m) [37]. 1.2 Overview of Our Techniques O(∆)-Amortized Update Time. Consider the following simple algorithm for maintaining an MIS M of a dynamic graph: for each vertex, maintain the number of its neighbors in M in a counter, and for each update in the graph or M, spend O(∆) time to update this counter for the neighbors of the updated vertex. What is the complexity of this algorithm? Unfortunately, as argued before, an update to the graph may inevitably result in an update of size Ω(n) to M. Processing it may take Ω(n · ∆) time as we have to update all neighbors of every updated vertex. However, all we need to handle this case is the following basic observation: while a single update can force the algorithm to insert up to Ω(n) vertices to M, it can never force the algorithm to remove more than one vertex from M. We therefore charge the O(∆) time needed to insert a vertex into M (and there can be many such vertices per one update) to the time spent in a previous update in which the same vertex was (the only one) removed from M. This allows us to argue that on 2A maximal matching in a graph G can be obtained by computing an MIS of the line graph of G. 3 average, we only spend O(∆) time per update. O(m3/4)-Amortized Update Time. Achieving an o(∆) amortized update time however is dis- tinctly more challenging. On the one hand, we cannot afford to update all neighbors of a vertex after every change in the graph. On the other hand, we do not have enough time to iterate over all neighbors of an updated vertex to even check whether or not they should be added to M and hence need to maintain this information, which is a function of vertices in the two-hop neighborhood of a vertex, explicitly for every vertex. To bypass these challenges, we relax our requirement for knowing the status of all vertices in the neighborhood of a vertex, and instead maintain the status of some vertices that are in the two-hop neighborhood of a vertex. More concretely, we allow "high" degree vertices to not update their "low" degree neighbors about their status (as the number of low degree neighbors can be very large), while making every "low" degree vertex update not only all its neighbors but even some of its neighbor's neighbors, using the extra time available to this vertex (as its degree is small). This approach allows us to maintain a "noisy" version of the information described above. Note that this information is not completely accurate as the status of some vertices in M would be unknown to their neighbors and their neighbor's neighbors (in the actual algorithm, we use a more fine-grained partition of vertices based on their degree into more than two classes, not only "high" and "low"). We now need to address a new challenge introduced by working with this "noisy" information: we may decide that a vertex is ready to join M based on the information stored in the algorithm and insert this vertex to M, only to find out that there are already some vertices in M adjacent to this vertex. To handle this, we also relax the property of the basic algorithm above that only allowed for deleting one vertex from M per each update. This allows us to insert multiple vertices to M as long as a large portion (but not all) of their neighbors are known to be not in M. Then we go back and delete a small number of "violating" vertices from M to make sure it is indeed an independent set. Note that deleting those vertices may now require inserting a new set vertices in their neighborhood to M to ensure maximality. In order to be able to perform all those operations and recursively treat the newly deleted vertices in a timely manner, we maintain the invariant that whenever we need to remove more than one vertex from M, the number of inserted vertices leading to this case is much larger than the number of removed vertices. This allows us to extend the simple charging scheme used in the analysis of the basic algorithm above to this new algorithm and prove our upper bound on the amortized update time of the algorithm. We point out that despite the multiple challenges along the way that are described above, our algorithm turned to be quite simple in hindsight. The main delicate matters are in the choice of parameters and in the analysis. This in turn makes the implementation of our results in sequential and distributed settings quite practical. Organization. We introduce our notation and preliminaries in Section 2. We then present a simple proof of the O(∆)-amortized update time algorithm in Section 3 as a warm-up to our main result. Section 4 contains the proof of our main result in Theorem 1. The distributed implementation of our result and a detailed comparison of our results with that of Censor-Hillel et al. [17] appear in Section 5. 2 Preliminaries Notation. We denote the static vertex set of the input graph by V . Let G = hG0, G1, . . .i be the sequence of graphs that are given to the algorithm: initial graph G0 is empty and each graph Gt is obtained from the previous graph Gt−1 by either inserting or deleting a single edge et = (ut, vt). We use Gt(V, Et) to denote the graph at step t and define mt := Et. Finally, throughout the 4 paper, M denotes the maximal independent set maintained by the algorithm at every time step. Greedy MIS Algorithm. Consider the following algorithm for computing an MIS of a given graph: Fix an arbitrary ordering of the vertices in the graph, add the first vertex to the MIS, remove all its neighbors from the list, and continue. This algorithm clearly computes an MIS of the input graph. In the rest of the paper, we refer to this algorithm as the greedy MIS algorithm. Fact 2.1. For an n-vertex graph G with maximum degree ∆, the greedy MIS algorithm computes an MIS of size at least n/(∆ + 1). 3 Warm-Up: A Simple O(∆)-Update-Time Dynamic Algorithm As a warm-up to our main result, we describe a straightforward algorithm for maintaining an MIS M in a dynamic graph with O(∆) amortized update time, where ∆ is a fixed upper bound on the maximum degree in the graph. For every vertex v in the graph, we simply maintain a counter MISCounter[v], counting number of its neighbors in M. In the following, we consider updating M and this counter after each edge update. Let et = (ut, vt) be the updated edge. Suppose first that we delete this edge. In this case, ut and vt cannot both be in M by definition of an independent set. Also, if none of them belong to M, there is nothing to do. The interesting case is thus when exactly one of ut or vt belongs to M; without loss of generality, we assume this vertex is ut. We first subtract one from MISCounter[vt] (as it is no longer adjacent to ut). If MISCounter[vt] > 0 still, it means that vt is adjacent to some vertex in M and hence we are done. Otherwise, we add vt to M and update the counter of all its neighbors in O(∆) time. Clearly, this step takes O(∆) time in the worst case, after that M is indeed an MIS. Now suppose et was inserted to the graph. The only interesting case here is when both ut and vt belong to M (we do not need to do anything in the remaining cases, other than perhaps updating the neighbor list of ut and vt in O(1) time). To ensure that M remains an independent set, we need to remove one of these vertices, say ut, from M. After this, to ensure the maximality, we have to insert to M any neighbor of ut that can now join M. To do this, we first update the MISCounter[·] of all neighbors of ut in O(∆) time. Next (using the updated counter), we iterate over all neighbors of ut and for each one check if they can be inserted to M now or not. If so, we add this new vertex to M and inform all its neighbors in O(∆) time to update their MISCounter[·]. It is easy to see that in this case, we spend O(k · ∆) time in the worst case, where k is the number of vertices added to M. The correctness of this algorithm is straightforward to verify. We now prove that the amortized running time of the algorithm is O(∆). The crucial observation is that whenever we change M, we may increase its size without any restriction, but we never decrease its size by more than one. We use the following straightforward charging scheme. Initially, we start with all vertices being in M as the original graph is empty. Whenever we delete one vertex from M, we spend O(∆) time to handle this vertex (including updating its neighbors and checking which ones can join M), and place O(∆) "extra budget" on this vertex to be spent later. We use this budget when this vertex is being inserted to M again. Whenever we want to bring this vertex back to M, we only need to spend this extra budget and hence the O(∆) time spent for inserting this vertex back to M can be charged to the time spent for this vertex when we removed it from M. This implies that the update time is O(∆) in average. We can therefore conclude the following lemma. Lemma 3.1. Starting from an empty graph on n vertices, a maximal independent set can be maintained deterministically over any sequence of K edge insertions and deletions in O(K · ∆) time where ∆ is a fixed bound on the maximum degree in the graph. 5 4 An O(m3/4)-Update-Time Dynamic Algorithm We present our fully dynamic algorithm for maintaining a maximal independent set in this section and prove Theorem 1. The following lemma is a somewhat weaker looking version of Theorem 1. However, we prove next that this lemma is all we need to prove Theorem 1. Lemma 4.1. Starting with any arbitrary graph on n vertices and m edges, a maximal independent set M can be maintained deterministically over any sequence of K = Ω(m) edge insertions and deletions in O(K · m3/4) time, as long as the number of edges remains within a factor 2 of m. We first show that this lemma implies Theorem 1. Proof of Theorem 1. For simplicity, we define m = 1 in case of empty graphs. We start from the empty graph and run the algorithm in Lemma 4.1 until the number of edges mt in the graph differs from m by a factor more than 2. This crucially implies that the total number of updates before terminating the algorithm (the parameter K in Lemma 4.1), is Ω(m). As such, we can invoke Lemma 4.1 to obtain an upper bound of O(m3/4) on the amortized update time of the algorithm throughout these updates. We then update m = mt and start running the algorithm in Lemma 4.1 on the current graph using the new choice of m. Clearly, this results in an amortized update time of O(m3/4) where m now denotes the number of dynamic edges in the graph. As the algorithm in Lemma 4.1 always maintain an MIS of the underlying graph, we obtain the final result. The rest of this section is devoted to the proof of Lemma 4.1. In the following, we first describe the data structure maintained in the algorithm for storing the required information and its main properties and then present our update algorithm. 4.1 The Data Structure For every vertex v, we maintain the following information: • neighbors[v]: a list of current neighbors of v in the graph. • degree[v]: an estimate of the degree of v to within a factor of two. • neighbors-degree[v]: a list containing degree[u] for every vertex u in neighbors[v]. • MIS-flag[v]: a boolean entry indicating whether or not v belongs to M. • MIS-neighbors[v]: a counter denoting the size of a suitable subset of current neighbors of v in M. Any vertex counted in MIS-neighbors[v] belongs to M but not all neighbors of v in M are (necessarily) counted in MIS-neighbors[v] (see Invariant 1 for more detail). • MIS-2hop-neighbors[v]: a list, containing for every vertex w in neighbors[v], a counter that counts the size of a suitable subset of current neighbors of w in M. Any vertex counted in MIS-2hop-neighbors[v][w] is also counted in MIS-neighbors[w] but not vice versa (see Invariant 2 below for more detail). Additionally, we maintain a partition (VHigh, VMed-High, VMed-Low, VLow) of the vertices into four sets based on their current approximate degree, namely, degree[v]. In particular, v belongs to VHigh iff degree[v] ≥ m3/4, to VMed-High iff m3/4 > degree[v] ≥ m1/2, to VMed-Low iff m1/2 > degree[v] ≥ m1/4, and to VLow iff degree[v] < m1/4. We refer to the vertices of VLow as the low-degree vertices. Throughout, we assume that in any of the lists maintained for a vertex by the algorithm, we can directly iterate over vertices of a particular subset in (VHigh, VMed-High, VMed-Low, VLow). (This can be done, for example, by storing these lists as four separate linked lists, one per each such subset.) 6 The following invariant is concerned with the information we need from MIS-neighbors[v]. Invariant 1. For any vertex v ∈ V \VLow, MIS-neighbors[v] counts the number of all neighbors of v in M. For any vertex v ∈ VLow, MIS-neighbors[v] counts the number of neighbors of v that are in M but not in VHigh, i.e., are in M \ VHigh. By Invariant 1, any vertex either knows the number of all its neighbors in M or is a low-degree vertex and can iterate over all its neighbors in O(m1/4) time to count this number. Moreover, even a low-degree vertex knows the number of its neighbors in M\VHigh. This is crucial for our algorithm as in some cases, we need to iterate over many vertices that belong to VLow and decide if they can join M and hence cannot spend O(m1/4) time per each vertex to determine this information. Note that the information we obtain in this way is "noisy", as we ignore some neighbors of vertices in VLow that are potentially in M. We shall address this problem using a post-processing step that exploits the fact that the total number of ignored vertices, i.e., vertices in VHigh, is small. The following invariant is concerned with the information we need from MIS-2hop-neighbors[v]. Invariant 2. For any v ∈ V and and every u ∈ neighbors[v]∩VLow, MIS-2hop-neighbors[v][u] counts the number of vertices in VMed-Low ∪ VLow that belong to M and are neighbors of u (the entry in MIS-2hop-neighbors[v][u] for any vertex u /∈ VLow is ⊥). Invariant 2 allows us to infer some nontrivial information about the two-hop neighborhood of any vertex. We use Invariant 2 to quickly determine which neighbors of a vertex v can be added to M in case v is deleted from it. Similar to the one-hop information we obtain through maintaining Invariant 1, the information we obtain in this way is also "noisy". We show how to update the information per each vertex after a change in the topology or M. Maintaining neighbors[v] under edge updates is straightforward. To maintain degree[v], each vertex simply keeps a 2-approximation of its degree in degree[v]. Whenever the current actual degree of v differs from degree[v] by more than a factor of two, v updates degree[v] to its actual degree and informs all its neighbors u ∈ neighbors[v] to update neighbors-degree[u]. This requires only O(1) amortized time. The above information is a function of the underlying graph and not M. We also need to update the information per each vertex that are functions of M whenever M changes. Maintaining MIS-flag[v] is trivial for any vertex v, hence in the following we focus on the remaining two parts. Once a vertex u changes its status in M, we apply the following algorithm to update the value of MIS-neighbors[v] for every vertex v (we only need to update this for v ∈ neighbors[u]). Algorithm UpdateNeighbors(u). An algorithm called whenever a vertex u enters or exists M to update MIS-neighbors[v] for neighbors of u. 1. If u ∈ VHigh, update MIS-neighbors[v] for any vertex v ∈ neighbors[u] not in VLow accord- ingly (i.e., add or subtract one depending on whether u joined or left M). 2. If u /∈ VHigh, update MIS-neighbors[v] for every vertex v ∈ neighbors[u]. It is immediate to see that by running UpdateNeighbors(u) in our main algorithm whenever a vertex u is updated in M, we can maintain Invariant 1. Also each call to UpdateNeighbors(u) takes O(m3/4) time in worst-case since in both cases of the algorithm, we only need to update O(m3/4) vertices: (i) if u ∈ VHigh, the algorithm only updates the vertices in V \ VLow whose size 7 is O(m3/4), and (ii) if u /∈ VHigh, u only has O(m3/4) neighbors to update. We also point out that MIS-neighbors[v] can be updated easily whenever an edge incident on (u, v) is inserted or deleted in O(1) time by simply visiting MIS-flag[u] and updating MIS-neighbors[v] accordingly. Now consider updating MIS-2hop-neighbors[·]. We use the following algorithm on a vertex u that has changed its status in M to update MIS-2hop-neighbors[v] for every vertex v in the graph (we only need to update this information for the two-hop neighborhood of u). Algorithm UpdateTwoHopNeighbors(u). An algorithm called when a vertex u enters or exists M to update MIS-2hop-neighbors[v] for the two-hop neighborhood of u. 1. If u ∈ VMed-Low ∪ VLow, for any vertex w ∈ neighbors[u]: (a) If w belongs to VLow, iterate over all vertices v ∈ neighbors[w]. (b) For any such v, update MIS-2hop-neighbors[v][w] accordingly (i.e., add or subtract one depending on whether u joined or left M). Each call to UpdateTwoHopNeighbors(u) takes O(m3/4) time in the worst case. This is because u only updates its neighbors if it has O(m1/2) neighbors as u should be in VMed-Low ∪ VLow and when it updates its neighbors, it changes the counter of O(m1/4) vertices (as w should be in VLow). This ensures that the running time of the algorithm is O(m1/2 · m1/4) = O(m3/4). Whenever an edge (u, v) is updated in the graph, we can run a similar algorithm to update the two-hop neighborhood of u and v in the same way in O(m3/4) time; we omit the details. It is also straightforward to verify that by running UpdateTwoHopNeighbors(u) in our main algorithm whenever a vertex u is updated in M, we preserve Invariant 2. Finally, recall that we also need a preprocessing step that given a graph G initializes this data structure. We can implement this step by first initializing all non-MIS-related information in this data structure in O(m) time (we do not need to handle isolated vertices at this point). Next, we run the greedy MIS algorithm to compute an MIS M of this graph in O(m) time (again only on non-isolated vertices). Finally, we update the information for every vertex in M using the two procedures above which takes O(m · m3/4) time in total. (We note that a more efficient implementation for this initial stage is possible.) As K = Ω(m) in Lemma 4.1, this (one time only) initialization cost is within the bounds stated in the lemma statement. We summarize the results in this section in the following two lemmas. Lemma 4.2. After updating any single edge, the data structure stored in the algorithm can be updated in O(m3/4) amortized time. Moreover, Invariants 1 and 2 hold after this update. Lemma 4.3. After updating any single vertex in M, the data structure stored in the algorithm can be updated in O(m3/4) worst case time. Moreover, Invariants 1 and 2 hold after this update. 4.2 The Update Algorithm The update algorithm is applied following edge insertions and deletions to and from the graph. After any edge update, the algorithm updates the data structure and M. In order to do the latter task, the algorithm may need to remove and/or insert multiple vertices from and to M. Since we already argued that maintaining the data structure requires O(m3/4) amortized time (by Lemma 4.2), from now on, without loss of generality, we only measure the time needed to fix M after any edge update and ignore the additive term needed to update the data structure. The following is the core invariant that we aim to maintain in our algorithm. 8 Invariant 3 (Core Invariant). Following every edge update, the set M maintained by the algorithm is an MIS of the input graph. Moreover, (i) if only a single vertex leaves M, then there is no restriction on the number of vertices joining M (which could be zero). (ii) if at least two vertices leave M, then at least twice as many vertices join M. In either case, the total time spent by the algorithm to fix M for an edge update is at most an O(m3/4) factor larger than the total number of vertices leaving and joining M. Before showing how to maintain Invariant 3, we present the proof of Lemma 4.1 using this invariant. Proof. The main idea behind the proof is as follows. By Invariant 3, after each step, the size of M either decreases by at most one, or it will increase. At the same time, M cannot grow more than n, the number of vertices in the graph. It then follows that the average number of changes to M per each update is O(1). As we only spend O(m3/4) per each update, we obtain the final result. We now present the formal proof using the following charging scheme. Recall that we compute an MIS M of the initial graph in the preprocessing step and that the initialization phase takes O(m · m3/4) time in total. We place O(m3/4) "extra budget" on vertices in the initial graph that do not belong to M to be spent later when these vertices are inserted to M. As the number of such vertices is O(m), this extra budget can be charged to the time spent in the initialization phase. Note that at this point, an extra budget is allocated to any vertex not in M and we maintain this throughout the algorithm. Whenever an update results in only a single vertex leaving M (corresponding to Part (i) of Invariant 3), we spend O(m3/4) time to handle this vertex and additionally place O(m3/4) budget on this vertex and then for the vertices inserted to M, we simply use the extra budget allocated to these vertices before to charge for the O(m3/4) time needed to handle each. If an update results in removing k > 1 vertices from M, we know that at least 2 · k vertices would be added to M after this update (corresponding to Part (ii) of Invariant 3). In this case, we use the O(m3/4) extra budget on these (at least) 2 · k vertices that are joining M to charge for the time needed to insert these vertices to M, remove the k initial vertices from M, and place O(m3/4) extra budget on every removed vertex. As a result, this type of updates can be handled free of charge. Finally, if an update only involves inserting some vertices to M, we simply use the budgets on these vertices to handle them free of charge. This finalizes the proof of Lemma 4.1. We point out that using the above charging scheme, we can also argue that the average number of changes to M is O(1) in each update. Fix a time step t and suppose the invariant holds up until this time step. Let et = (ut, vt) be the edge updated at this time step. In the remainder of this section, we describe one round of the update algorithm to handle this single edge update and preserve Invariant 3. 4.2.1 Edge Deletions We start with the easier case of deleting an edge et = (ut, vt). Case 1: Neither ut nor vt belong to M. In this case, there is nothing to do. Case 2: ut belongs to M but not vt (or vice versa). After deleting the edge et, it is possible that vt may need to join M as well. We first check whether MIS-neighbors[vt] = 0. If not, there is nothing else to do as vt is still adjacent to some vertex in M. Otherwise, we need to ensure that vt does not have any neighbor in M (outside those vertices counted in MIS-neighbors[vt]). If vt ∈ V \ VLow, 9 by Invariant 1, MIS-neighbors[vt] counts all neighbors of vt and hence there is nothing more to check. If vt ∈ VLow, we can go over all the O(m1/4) vertices in the neighborhood of vt and check whether vt has a neighbor in M or not. This only takes O(m1/4) time in the worst case. Again, if we find a neighbor in M there is nothing else to do. Otherwise, we add vt to M and update the data structure which takes O(m3/4) time in the worst case by Lemma 4.3. After this step, M is again a valid MIS and hence Invariant 3 is preserved as we only spent O(m3/4) time and inserted at most one vertex to M without deleting any vertex from it. Case 3: Both ut and vt belong to M. This case is not possible in the first place by Invariant 3 as otherwise M maintained by the algorithm before this edge update was not an MIS. 4.2.2 Edge Insertions We now consider the by far more challenging case of edge insertions where we concentrate bulk of our efforts. It is immediate to see that the only time we need to handle an edge insertion is when the inserted edge et = (ut, vt) connects two vertices already in M (there is nothing to do in the remaining cases). Hence, in the following, we assume both ut and vt belong M. To ensure that M is an independent set, we first need to remove one of ut or vt from it and then potentially insert some of the neighbors of the deleted vertex to M to ensure its maximality. Let ut be the deleted vertex (the choice of which vertex to delete is arbitrary). After deleting ut, we update the algorithm's data structure in O(m3/4) time by Lemma 4.3. Let L := neighbors[ut] ∩ VLow denote the set of low degree neighbors of ut. We first show that one can easily handle all neighbors of ut which are not in L. To do so, we can iterate over these vertices as there are O(m3/4) of them and for any vertex w, by Invariant 1, we know whether w can be added M or not by simply checking MIS-neighbors[w]. Hence, we can add the necessary vertices to M and spend O(m3/4) time for each inserted one using Lemma 4.3. As such, we spend O(m3/4) time for iterating the vertices which did not join M and k· O(m3/4) time for the k vertices that joined M. Hence, Invariant 3 is preserved after this step. We now consider the challenging case of updating the neighbors of ut that belong to L. As the number of such vertices is potentially very large, we cannot iterate over all of them anymore. Define the following subsets of L: • LMIS ⊆ L: the set of vertices in L that do not have any neighbor in M. • L1-hop ⊇ LMIS: all vertices w ∈ L where MIS-neighbors[w] = 0 i.e., our algorithm did not count any neighbor for them in M. Recall that MIS-neighbors[w] does not count all neighbors of w in M; it is missing the vertices in VHigh by Invariant 1. • L2-hop ⊇ L1-hop ⊇ LMIS: all vertices w ∈ L, where MIS-2hop-neighbors[ut][w] = 0. Again, recall that MIS-2hop-neighbors[ut][wt] does not count all neighbors of w ∈ MIS-neighbors[w] (and consequently in M); it misses the vertices in VMed-High in MIS-neighbors[w] (and additionally VHigh in M) by Invariant 2. Let ℓMIS := LMIS, ℓ1-hop := L1-hop and ℓ2-hop := L2-hop, where ℓMIS ≤ ℓ1-hop ≤ ℓ2-hop. Our algorithm does not know the sets LMIS and L1-hop or even their sizes. However, the up- date algorithm knows the value of ℓ2-hop and has access to vertices in L2-hop through the list MIS-2hop-neighbors[ut] and can iterate over them in O(1) time per each vertex in L2-hop (notice that even this can be potentially too time consuming as size of this list can be too large). We consider different cases based on the value of these parameters. Case 1: when ℓ2-hop is small, i.e., ℓ2-hop ≤ 4· m3/4. In this case, we iterate over vertices w ∈ L2-hop in O(ℓ2-hop) = O(m3/4) time and check whether MIS-neighbors[w] = 0 or not. This allows us to compute the set L1-hop and ℓ1-hop as well. We further distinguish between two cases. 10 Case 1-a: when ℓ1-hop is very small, i.e., ℓ1-hop ≤ 4 · m1/2. We iterate over vertices w ∈ L1-hop and for each vertex, spend O(m1/4) time to go over all its neighbors and decide whether w has any neighbor in M or not (degree of w is O(m1/4) since it belongs to VLow). Hence, in this case, we can obtain the set LMIS fully in O(m3/4) time in total. We then iterate over vertices in LMIS, insert each one greedily to M, and update the data structure in O(m3/4) time using Lemma 4.3. It is possible that some vertices in LMIS are adjacent to each other and hence before inserting any vertex w, we first need to check MIS-neighbors[w] to make sure it is zero still (by Invariant 1 and since all vertices in LMIS belong to VLow, any vertex added to M here would update MIS-neighbors[w] for any neighbor w). Hence, in this case, we spend O(m3/4) time for each vertex inserted to M and did not delete any vertex from it. Therefore, Invariant 3 is preserved after the edge update in this case. Case 1-b: when ℓ1-hop is not very small, i.e., ℓ1-hop > 4 · m1/2. In this case, we cannot afford to compute LMIS explicitly. Rather, we simply add the vertices in L1-hop to M directly, without considering whether they are adjacent to vertices already in M or not at all (although we check that they are not adjacent to the previously inserted vertices from L1-hop). As a result, it is possible that after this process, M is not an independent set of the graph anymore. To fix this, we perform a post processing step in which we delete some vertices from M to ensure that the remaining vertices indeed form an MIS of the original graph. Concretely, we go over vertices in L1-hop and insert each to M if none of its neighbors have been added to M in this step, and then invoke Lemma 4.3 to update the algorithm's data structure. Since in this step, we are only adding vertices that are in VLow, we can check in O(1) time whether a vertex has a neighbor in M (that has been added in this step) or not by Invariant 1. This step clearly takes O(m3/4) time per each vertex inserted to the MIS. At this point, it is possible that there are some vertices in M which are adjacent to the newly inserted vertices. By Invariant 1, we know that these vertices can only belong to VHigh and hence there are at most m1/4 of them. We iterate over all vertices in VHigh and check whether they have a neighbor in M (by Invariant 1, we stored this information for these vertices) and mark all such vertices. Next, we remove all these marked vertices from M simultaneously and update the algorithm's state by Lemma 4.3. We are not done yet though because after removing these vertices, it is possible that we may need to bring some of their neighbors back to M. We solve this problem recursively using the same update algorithm by treating these marked vertices the same as ut. We argue that Invariant 3 is preserved. As the degree of vertices in L1-hop is bounded by m1/4, (m1/4+1) ≥ 2 · m1/4 (by Fact 2.1 and the number of vertices added to M in this part is at least the assumption on ℓ1-hop in this case). On the other hand, the number of vertices removed from M is at most equal to size of VHigh which is m1/4. As a result, in this specific step, the number of vertices inserted to M is at least twice as many as the vertices removed from it. For any vertex inserted or deleted from M also, we spent O(m3/4) time. As we are performing the recursive step using the same algorithm, we can argue inductively that for any vertex deleted in those recursive calls, at least twice as many vertices would be added to M and that the total running time would be proportional to the number of vertices added or removed from M times O(m3/4). We point out that any recursive call that leads to another one in this algorithm necessarily increase the number of vertices in M and hence the algorithm does indeed terminate (see also case 2 ). Case 2: when ℓ2-hop is not small, i.e., ℓ2-hop > 4· m3/4. We use a similar strategy as case 1-b here as well. We iterate over all vertices in L2-hop, greedily add each vertex to M as long as this vertex is not adjacent to any of the newly added vertices (which can be checked in O(1) time by Invariant 1), and update the data structure using Lemma 4.3. As the maximum degree of vertices in L2-hop is at most m1/4, we add at least m1/4+1 > 2· m1/2 vertices to M by Fact 2.1. By Invariant 2, if a vertex ℓ2-hop ℓ1-hop 11 belongs to L2-hop, the only neighbors of this vertex in M belong to VHigh or VMed-High and hence has degree at least m1/2. We go over these vertices next and mark them. Then, we remove all of them from M simultaneously and update the algorithm by Lemma 4.3. Similar to case 1-b, we now also have to consider bringing some of the neighbors of these vertices to M which is handled recursively exactly the same way as in case 1-b. We first analyze the time complexity of this step. Iterating over L2-hop takes O(ℓ2-hop) = O(m) time and since we are inserting at least m1/2 vertices from L2-hop to M, we can charge the time needed for this step to the time allowed for inserting these vertices to M. Moreover, we inserted at least 2 · m1/2 vertices to M and would remove at most m1/2 vertices after considering violating vertices in VHigh and VMed-High. Hence, number of inserted vertices is at least twice the number of removed ones at this step. We can also argue inductively that this property hold for each recursive call similar to the case 1-b. This finalizes the proof of this case. To conclude, we proved that Invariant 3 is preserved after any edge insertion or deletion in the algorithm, which finalizes the proof of Lemma 4.1. 5 Maximal Independent Set in Dynamic Distributed Networks We consider the CONGEST model of distributed computation (cf. [41]) which captures the essence of both spatial locality and congestion. The network is modeled by an undirected graph G(V, E) where the vertex-set is V , and E corresponds to both the edge-set in the current graph and also the vertex pairs that can directly communicate with each other. We assume a synchronous com- munication model, where time is divided into rounds and in each round, each vertex can send a message of size O(log n) bits to any of its neighbors, where n = V . The goal is to maintain an MIS M in G in a way that each vertex is able to output whether or not it belongs to M. We focus on dynamically changing networks where both edges and vertices can be inserted to or deleted from the network. For deletions, we consider graceful deletions where the deleted vertex/edge may be used for passing messages between its neighbors (endpoints), and is only deleted completely once the network is stable again. After each change, the vertices communicate with each other to adjust their outputs, namely make the network stable again. We make the standard assumption that the changes occur in large enough time gaps, and hence the network is always stable before the next change occurs (see, e.g., [17, 40]). We further assume that each change in the network is indexed and vertices affected by this change know how many updates have happened before3. There are three complexity measures for the algorithms in this model. The first is the so-called adjustment complexity, which measures the number of vertices that change their output as a result of a recent topology change. The second is the round complexity, the number of rounds required for the network to become stable again after each update. The third is the message complexity, measuring the total number of O(log n)-length messages communicated by the algorithm. Our main result in this section is an implementation of Theorem 1 in this distributed setting for maintaining an MIS in a dynamically changing network. Theorem 2. Starting from an empty distributed network on n vertices, a maximal independent set can be maintained deterministically in a distributed fashion (under the CONGEST communication model) over any sequence of vertex/edge insertions and (graceful) deletions with (i) O(1) amor- tized adjustment complexity, (ii) O(1) amortized round complexity, and (iii) O(m3/4) amortized message complexity. Here, m denotes the number of dynamic edges. 3This is only needed by our algorithm in Theorem 2 to have an approximation of the number of edges in the graph, which is a global quantity and cannot be maintained by each vertex locally 12 The algorithm in Lemma 3.1 can also be trivially implemented in this distributed setting, resulting in an extremely simple deterministic distributed algorithm for maintaining an MIS of a dynamically changing graph in O(1) amortized adjustment complexity and round complexity, and O(∆) amortized message complexity. As argued before, this simple algorithm already strengthens the previous randomized algorithm of Censor-Hillel et al. [17] by virtue of being deterministic and not requiring an assumption of a non-adaptive oblivious adversary. In the following, we compare our results in the distributed setting with those of [17]. Amortized vs in Expectation Guarantee. The guarantees on the complexity measures pro- vided by our deterministic algorithms in this setting are amortized, while the randomized algorithm in [17] achieves its bound in expectation which may be considered somewhat stronger than our guar- antee. To achieve this guarantee however, the algorithm in [17], besides using randomization, also assumes a non-adaptive oblivious adversary. An adaptive adversary (the assumption supported by all our algorithms in this paper) can force the algorithm in [17] to adjust the MIS by Ω(n) vertices in every round, which in turn blows up all the complexity measures in [17] by a factor of Ω(n). It is also worth mentioning that the guarantee achieved by [17] only holds in expectation and not with high probability and for a fundamental reason: It was shown in [17] that for every value of k, there exists an instance for which at least Ω(k) adjustments are needed for any algorithm with probability at least 1/k (see Section 1.1 of their paper). Broadcast vs Unicast. The communication in algorithm of [17] in each round is O(1) broadcast messages in expectation that requires only O(1) bits on every edge (i.e., each vertex communicates the same O(1) bits to every one of its neighbors). As such, the total communication at every round of this algorithm is O(∆) bits in expectation. Our amortized O(∆)-message complexity algorithm (distributed implementation of Lemma 3.1) also works with the same guarantee: indeed, every vertex simply needs to send O(1) bits to all its neighbors in a broadcast manner so that their neighbors know whether to add or subtract the contribution of this vertex to or from their counter. This is however not the case for our main algorithm in Theorem 2 which requires a processor to communicate differently to its neighbor over each edge (in general, one cannot hope to achieve o(∆) communication with only broadcast messages). Additionally, this algorithm now requires to communicate O(log n) bits (as opposed to O(1) in the previous two algorithms) over every edge. This is mainly due to the fact that in this new algorithm we need to communicate with vertices which are at distance 2 of the current vertex and hence we need to carry the ID of original senders in the messages also. Graceful vs Abrupt Deletions. A stronger notion of deletion in the dynamic setting is abrupt deletion in which the neighbors of the deleted vertex/edge simply discover that this vertex/edge is being deleted and the deleted vertex/edge cannot be used for communication anymore right after the deletion happens. Censor-Hillel et al. [17] also extend their result to this more general setting and achieved the same guarantees except for message complexity of abrupt deletion of a node which is now O(min{log n, ∆}) broadcasts as opposed to O(1). We do not consider this model explicitly. However, it is straightforward to verify that our amortized O(∆)-message complexity algorithm (distributed implementation of Lemma 3.1) works in this more general setting with virtually no change and even still achieves amortized O(1) broadcast per abrupt deletion of a vertex as well. We believe that our main algorithm in Theorem 2 should also work in this more general setting with proper modifications but we did not prove this formally. Synchronous vs Asynchronous Communication. We focused only on the synchronous com- munication in this paper. Censor-Hillel [17] also considered the asynchronous model of communi- cation and showed that their algorithm holds in this model as well, albeit with a weaker guarantee 13 on its message complexity. Our algorithms can be modified to work in an asynchronous model as well, as at each stage of the algorithm we can identify a (different) local "coordinator" that can be used to synchronize the operations with an added overhead that is within a constant multiplicative of the synchronous complexity (as per each update only vertices within two-hop neighborhood of a vertex need to communicate with each other in our algorithm); we omit the details but refer the reader to Section 5.2.2 for more information on the use of a local coordinator in our algorithms. We now turn to proving Theorem 2, using the following lemma the same way we used Lemma 4.1 in the proof of Theorem 1. Lemma 5.1. Starting with any arbitrary graph on n vertices and m edges, a maximal independent set M can be maintained deterministically in a distributed fashion (under the CONGEST commu- nication model) over any sequence of K = Ω(m) vertex/edge insertions and (graceful) deletions as long as the number of edges in the graph remains within a factor 2 of m. The algorithm: (i) makes O(K) adjustment to M in total, i.e., has O(1) amortized adjustment complexity, (ii) requires O(K) rounds in total, i.e., has O(1) amortized round complexity, and (iii) communicates O(K·m3/4) messages in total, i.e., has O(m3/4) amortized message complexity. The algorithm in Lemma 5.1 is a simple implementation of our sequential dynamic algorithm in Lemma 4.1. In the following, we first adapt the data structures introduced in Section 4.1 to the distributed setting. We then show that with proper adjustments, the (sequential) update algorithm in Section 4.2 can also be used in the CONGEST model and prove Theorem 2. 5.1 The Data Structure We store the same exact information in Section 4.1 per each vertex here as well and maintain Invari- ants 1 and 2. We first prove that the two procedures UpdateNeighbors and UpdateTwoHopNeighbors can both be implemented in constant rounds and O(m3/4) messages in total. In particular, Lemma 5.2. For any vertex u ∈ V , (i) UpdateNeighbors(u) operation requires spending 1 round and m3/4 messages in total, and (ii) UpdateTwoHopNeighbors(u) operation requires 2 rounds and 2 · m3/4 messages in total. Proof. Part (i). If u ∈ VHigh, it only needs to send a message to its neighbors in V \ VLow and inform them on the status of u (whether it is inserted to or deleted from M), which requires only 1 round (as they are all neighbors to u) and m3/4 messages as V \ VLow ≤ m/m1/4 = m3/4. If u /∈ VHigh, it would update all its neighbors again in 1 round and m3/4 messages as the latter is an upper bound on number of its neighbors. Part (ii). If u /∈ VLow ∪ VMed-Low there is nothing to do. Otherwise, u needs to send a message to all its (at most m1/2) neighbors that belong to VLow and ask them to relay this information to their neighbors. These vertices can then spend another round to inform all their (at most m1/4) neighbors about the status of u. This takes 2 rounds and m1/2 + m1/2 · m1/4 < 2 · m3/4 messages in total. Lemma 5.2 ensures that Invariants 1 and 2 (the only MIS-related information stored for u beside MIS-flag[u] that can be trivially updated) are preserved after any change in M within a constant number of rounds and O(m3/4) messages. In the following, we briefly describe how to update the information stored for vertices per each topology change in the graph. 14 Vertex Updates. Let u be the updated vertex. In case of vertex insertion, we simply initial- ize the data structures at u and we are almost done as the neighbors of u are already informed about u being inserted to the graph and hence can update their information locally. We only need to send degree[u] to all the neighbors (the time needed for this can be charged to the initializa- tion cost of this algorithm). Now suppose u is being deleted. We can update neighbors[v] and neighbors-degree[v] for any neighbor v of u without any communication as they are informed that u is deleted. We can also run UpdateNeighbors(u) (virtually) with no communication as this procedure only informs the neighbors of u that this vertex is being deleted from M and by knowing that u has left the graph, any vertex v in the neighborhood of u can update MIS-neighbors[v] accordingly. Finally, we can also run UpdateTwoHopNeighbors(u) with only 1 round of communi- cation and m3/4 messages (see Lemma 5.2) by relaying the information from the neighbors of u (which are informed about u leaving the graph) to their neighbors. Edge Updates. These updates are handled exactly the same as in our sequential algorithm. Let (u, v) be the updated edge. Nertices u and v can update all information except for updat- ing MIS-2hop-neighbors[·] (in particular neighbors-degree[·] can be updated by the procedure described in Section 4.1 with O(1) worst-case round complexity and O(1) amortized message com- plexity). To do the latter task, vertex u (resp. v) can simulate UpdateTwoHopNeighbors(v) (resp. UpdateTwoHopNeighbors(u)) as described above, which takes m3/4 messages and 1 round. We hence showed that after each change in the topology, all the information stored for vertices can be updated in O(1) rounds and O(m3/4) amortized messages. 5.2 The Distributed Algorithm We design a distributed algorithm for updating M in the network in the spirit of our update algorithm in Section 4.2. The algorithm is a simple adaption of our sequential algorithm to this dynamic model. For every update, we first perform the steps in the previous section to update the information on every vertex in the graph and then make the network stable again by adjusting M. Throughout, we aim to maintain the following invariant which is the direct analogue of Invari- ant 3 in the dynamic setting. Invariant 4. Following every vertex/edge update, the set M maintained by the algorithm is an MIS of the input graph. Moreover, (i) if only a single vertex leaves M then there is no restriction on the number of vertices joining M (which could be zero). (ii) if at least two vertices leave M, then at least twice as many vertices are added to M. In either case, the worst case number of rounds and messages spent by the algorithm for any update is within, respectively, an O(1) and an O(m3/4) factor of the total number of vertices leaving and joining M. Using the same exact argument as in the proof of Lemma 4.1, maintaining Invariant 4 ensures that the amortized adjustment complexity and amortized round complexity of the algorithm is O(1) and its amortized message complexity is O(m3/4). Hence, to prove Lemma 5.1, it suffices to prove that Invariant 4 is preserved after every update. We consider different cases based on insertion and deletion of edges and vertices. 5.2.1 Edge Deletions Suppose we delete the edge (u, v). We only consider the case that u belongs to M and v is not; the remaining cases are either symmetric to this one or need no update in M (see Section 4.2.1). If v 15 is not in VLow, by Invariant 1, it knows all its neighbors in M and can decide whether to join M or not to locally; if it enters M, it can update the network in O(1) rounds and O(m3/4) messages by Lemma 5.2. If v is in VLow, it first sends a message to all its O(m1/4) neighbors and ask for their status to which its neighbors reply whether they belong to M or not. This only takes 2 rounds and O(m1/4) communication and then v can decide again whether to join M or not to. Note that this part of the result holds even with abrupt deletions. 5.2.2 Edge Insertions Suppose we insert the edge (u, v). We only consider the case when both u and v belong to M; the remaining cases need no update in M (see Section 4.2.2). Remember that in Section 4.2.2, we needed to handle these updates in three separate cases. While the algorithm and analysis in each case is different, the procedures needed to carry the information around the network are essentially the same among these cases and hence in the following, for simplicity, we only consider one of the main cases, namely case 1-b (see Section 4.2.2 for definition of this case). The algorithm in the remaining cases can be adapted to this setting in the same exact way. Recall that in this case, the vertex u is deleted from M and moreover u knows the set L1-hop entirely, which is of size O(m3/4). The general approach is to make u a "coordinator" for running the update algorithm in Section 4.2.2 by communicating with its two-hop neighborhood and gather the necessary information to run the sequential update algorithm. Vertex u first sends a message to all its neighbors in L1-hop and asks for their status to which they respond whether or not they belong to M. This takes 2 rounds and O(m3/4) messages. Next, u informs one of its neighbors that it can join M and this new vertex updates its status and the information in the graph which takes O(1) rounds and O(m3/4) messages by Lemma 5.2. After this, u again sends a message to all its neighbors in L1-hop and asks for their status in M to which they respond whether they belong to M or whether one of their neighbors in L1-hop has been added to M in this step. Then, again, u informs one of its neighbors (if such exists) that it can join M, and continues. This way, we only spend O(1) rounds and O(m3/4) communication per each vertex entering M in addition to O(1) rounds and O(m3/4) communication for communicating with neighbors of u that would not join M eventually. After processing the list L1-hop, we also need to delete from M, the set of vertices in VHigh that are now incident to vertices in L1-hop that just joined M. Note that such vertices are necessarily in the two-hop neighborhood of u and hence u can communicate with them (which are only O(m1/4) many) in O(1) rounds and use the above idea to implement the same update algorithm in Section 4.2.2 in this model. This allows us to preserve Invariant 4 by the same exact analysis in Section 4.2.2. 5.2.3 Vertex Deletions This case is essentially equivalent to the edge insertion case discussed above. Since we have a graceful deletion, we can treat the deleted vertex the same way as in Section 5.2.2 by deleting it from M (if it belonged to it) and using it as the "coordinator" to implement the process described in Section 5.2.2. 5.2.4 Vertex Insertions The only thing we need to do in this case is to check whether we need to add this new vertex to M or not. If this vertex is not in VLow, it already knows this information and hence can decide whether or not to join M; after that we are done. Otherwise, if the vertex belongs to VLow, it sends a message to all its O(m1/4) neighbors and ask for their status in M, and use that to decide about joining M. In either case, we only need O(1) rounds and O(m1/4) total communication. After this, we update the neighbors using first part of Lemma 5.2 in O(m3/4) communication and O(1) 16 rounds. To conclude, we showed that Invariant 4 is preserved after any edge or vertex insertion or deletion by the distributed algorithm, hence proving Lemma 5.1. We are now ready to prove Theorem 2. Proof of Theorem 2. The proof is identical to the proof of Theorem 1. The only difference is that in this distributed setting, we are not able to maintain the exact number of edges in the graph in a distributed fashion across all vertices. However, recall that we assumed vertices affected by an update in the topology know the index of this update, i.e., how many updates have happened before this one. Hence, whenever the number of updates reaches Ω(m), any vertex that knows this information sends a message to all its neighbors to terminate the process which would then be broadcast across the whole graph. This takes O(m) rounds and O(m) communication and can be charged to the total number of updates, i.e., Ω(m) in this step. Hence, the vertices can initialize their data structure using the new choice of m and continue the distributed algorithm in Lemma 5.1. References [1] I. Abraham, S. Chechik, and S. Krinninger. Fully dynamic all-pairs shortest paths with worst- In Proceedings of the 28th Annual ACM-SIAM Symposium on case update-time revisited. Discrete Algorithms, SODA 2017, Barcelona, Spain, January 16-19, 2017, pages 440–452, 2017. [2] 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. [3] L. Barba, J. Cardinal, M. Korman, S. Langerman, A. van Renssen, M. Roeloffzen, and S. Ver- donschot. Dynamic graph coloring. In Proceedings of the 15th International Symposium on Algorithms and Data Structures, WADS 2017, St. John's, NL, Canada, July 31 - August 2, 2017, pages 97–108, 2017. [4] L. Barenboim, M. Elkin, and F. Kuhn. Distributed (∆ + 1)-coloring in linear (in ∆) time. SIAM J. Comput., 43(1):72–95, 2014. [5] L. Barenboim, M. Elkin, S. Pettie, and J. Schneider. The locality of distributed symmetry breaking. J. ACM, 63(3):20:1–20:45, 2016. [6] L. Barenboim and T. Maimon. Fully-dynamic graph algorithms with sublinear time inspired by distributed computing. In Proceedings of the International Conference on Computational Science, ICCS 2017, Zurich, Switzerland, June 12-14, 2017, pages 89–98, 2017. [7] S. Baswana, M. Gupta, and S. Sen. Fully dynamic maximal matching in O(log n) update time. In Proceedings of the 52nd IEEE Annual Symposium on Foundations of Computer Science, FOCS 2011, Palm Springs, CA, October 23-25, 2011, pages 383–392, 2011 (see also SICOMP'15 version, and subsequent erratum). [8] A. Bernstein and S. Chechik. Deterministic decremental single source shortest paths: beyond the O(mn) bound. In Proceedings of the 48th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2016, Cambridge, MA, USA, June 18-21, 2016, pages 389–397, 2016. 17 [9] A. Bernstein and L. Roditty. Improved dynamic algorithms for maintaining approximate shortest paths under deletions. In Proceedings of the 22nd Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2011, San Francisco, CA, USA, January 23-25, 2011, pages 1355–1365, 2011. [10] A. Bernstein and C. Stein. Fully dynamic matching in bipartite graphs. In Proc. 42nd ICALP, pages 167–179, 2015. [11] A. Bernstein and C. Stein. Faster fully dynamic matchings with small approximation ratios. In Proceedings of the 27th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2016, Arlington, VA, USA, January 10-12, 2016, pages 692–711, 2016. [12] S. Bhattacharya, D. Chakrabarty, and M. Henzinger. Deterministic fully dynamic approximate vertex cover and fractional matching in O(1) amortized update time. In Proceedings of the 19th International Conference on Integer Programming and Combinatorial Optimization, IPCO 2017, Waterloo, ON, Canada, June 26-28, 2017, pages 86–98, 2017. [13] S. Bhattacharya, D. Chakrabarty, M. Henzinger, and D. Nanongkai. Dynamic algorithms In Proceedings of the 29th Annual ACM-SIAM Symposium on Discrete for graph coloring. Algorithms, SODA 2018, New Orleans, LA, USA, January 7-10, 2018, pages 1–20, 2018. [14] S. Bhattacharya, M. Henzinger, and G. F. Italiano. Deterministic fully dynamic data structures for vertex cover and matching. In Proceedings of the 26th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, San Diego, CA, USA, January 4-6, 2015, pages 785–804, 2015. [15] S. Bhattacharya, M. Henzinger, and D. Nanongkai. New deterministic approximation algo- rithms for fully dynamic matching. In Proceedings of the 48th Annual ACM SIGACT Sympo- sium on Theory of Computing, STOC 2016, Cambridge, MA, USA, June 18-21, 2016, pages 398–411, 2016. [16] S. Bhattacharya, M. Henzinger, and D. Nanongkai. Fully dynamic maximum matching and vertex cover in O(log3 n) worst case update time. In Proceedings of the 28th Annual ACM- SIAM Symposium on Discrete Algorithms, SODA 2017, Barcelona, Spain, January 16-19, 2017, pages 470–489, 2017. [17] K. Censor-Hillel, E. Haramaty, and Z. S. Karnin. Optimal dynamic distributed MIS. In Proceedings of the 2016 ACM Symposium on Principles of Distributed Computing, PODC 2016, Chicago, IL, USA, July 25-28, 2016, pages 217–226, 2016. [18] S. A. Cook. An overview of computational complexity. Commun. ACM, 26(6):400–408, 1983. [19] C. Demetrescu and G. F. Italiano. A new approach to dynamic all pairs shortest paths. J. ACM, 51(6):968–992, 2004. [20] D. Eppstein, Z. Galil, G. F. Italiano, and A. Nissenzweig. Sparsification - a technique for speeding up dynamic graph algorithms. J. ACM, 44(5):669–696, 1997. [21] S. Even and Y. Shiloach. An on-line edge-deletion problem. J. ACM, 28(1):1–4, 1981. [22] G. N. Frederickson. Data structures for on-line updating of minimum spanning trees, with applications. SIAM J. Comput., 14(4):781–798, 1985. 18 [23] M. Ghaffari. An improved distributed algorithm for maximal independent set. In Proceedings of the 27th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2016, Arlington, VA, USA, January 10-12, 2016, pages 270–277, 2016. [24] A. Gupta, R. Krishnaswamy, A. Kumar, and D. Panigrahi. Online and dynamic algorithms In Proceedings of the 49th Annual ACM SIGACT Symposium on Theory of for set cover. Computing, STOC 2017, Montreal, QC, Canada, June 19-23, 2017, pages 537–550, 2017. [25] M. Gupta and R. Peng. Fully dynamic (1 + ǫ)-approximate matchings. In Proceedings of the 54th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2013, Berkeley, CA, USA, October 26-29, 2013, pages 548–557, 2013. [26] M. Henzinger, S. Krinninger, and D. Nanongkai. Decremental single-source shortest paths on undirected graphs in near-linear total update time. In Proceedings of the 55th IEEE An- nual Symposium on Foundations of Computer Science, FOCS 2014, Philadelphia, PA, USA, October 18-21, 2014, pages 146–155, 2014. [27] M. Henzinger, S. Krinninger, and D. Nanongkai. Sublinear-time decremental algorithms for single-source reachability and shortest paths on directed graphs. In Proceedings of the 46th Annual ACM on Symposium on Theory of Computing, STOC 2014, New York, NY, USA, May 31 - June 03, 2014, pages 674–683, 2014. [28] M. Henzinger, S. Krinninger, D. Nanongkai, and T. Saranurak. Unifying and strengthening hardness for dynamic problems via the online matrix-vector multiplication conjecture. In Proceedings of the 47th Annual ACM on Symposium on Theory of Computing, STOC 2015, Portland, OR, USA, June 14-17, 2015, pages 21–30, 2015. [29] M. R. Henzinger and V. King. Maintaining minimum spanning trees in dynamic graphs. In Proceedings of the 24th International Colloquium on Automata, Languages, and Programming, ICALP 1997, Bologna, Italy, July 7-11, 1997, pages 594–604, 1997. [30] M. R. Henzinger and V. King. Randomized fully dynamic graph algorithms with polylogarith- mic time per operation. J. ACM, 46(4):502–516, 1999. [31] Z. Ivkovi´c and E. L. Lloyd. Fully dynamic maintenance of vertex cover. In Proceedings of the 19th International Workshop on Graph-Theoretic Concepts in Computer Science, WG 1993, Utrecht, The Netherlands, June 16-18, 1993, pages 99–111, 1993. [32] M. T. J. Holm, K. de. Lichtenberg. Poly-logarithmic deterministic fully-dynamic algorithms for connectivity, minimum spanning tree, 2-edge, and biconnectivity. J. ACM, 48(4):723–760, 2001. [33] R. M. Karp and A. Wigderson. A fast parallel algorithm for the maximal independent set problem. J. ACM, 32(4):762–773, 1985. [34] V. King. Fully dynamic algorithms for maintaining all-pairs shortest paths and transitive closure in digraphs. In Proceedings of the 40th Annual Symposium on Foundations of Computer Science, FOCS 1999, New York, NY, USA, October 17-18, 1999, pages 81–91, 1999. [35] N. Linial. Distributive graph algorithms-global solutions from local data. In Proceedings of the 28th IEEE Annual Symposium on Foundations of Computer Science, FOCS 1987, Los Angeles, CA, USA, October 27-29, 1987, pages 331–335, 1987. 19 [36] M. Luby. A simple parallel algorithm for the maximal independent set problem. SIAM J. Comput., 15(4):1036–1053, 1986. [37] O. Neiman and S. Solomon. Simple deterministic algorithms for fully dynamic maximal match- ing. In Proceedings of the 45th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2013, Palo Alto, CA, USA, June 1-4, 2013, pages 745–754, 2013. [38] K. Onak and R. Rubinfeld. Maintaining a large matching and a small vertex cover. In Proceedings of the 42nd Annual ACM SIGACT Symposium on Theory of Computing, STOC 2010, Cambridge, MA, USA, June 6-8, 2010, pages 457–464, 2010. [39] A. Panconesi and A. Srinivasan. On the complexity of distributed network decomposition. J. Algorithms, 20(2):356–374, 1996. [40] M. Parter, D. Peleg, and S. Solomon. Local-on-average distributed tasks. In Proceedings of the 27th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2016, Arlington, VA, USA, January 10-12, 2016, pages 220–239, 2016. [41] D. Peleg. Distributed Computing: A Locality-Sensitive Approach. SIAM, 2000. [42] L. Roditty and U. Zwick. On dynamic shortest paths problems. Algorithmica, 61(2):389–401, 2011. [43] S. Solomon. Fully dynamic maximal matching in constant update time. In Proceedings of the 57th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2016, New Brunswick, NJ, USA, October 9-11, 2016, pages 325–334, 2016. [44] M. Thorup. Worst-case update times for fully-dynamic all-pairs shortest paths. In Proceed- ings of the 37th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2005, Baltimore, MD, USA, May 21-24, 2005, pages 112–119, 2005. [45] C. Wulff-Nilsen. Fully-dynamic minimum spanning forest with improved worst-case update time. In Proceedings of the 49th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2017, Montreal, QC, Canada, June 19-23, 2017, pages 1130–1143, 2017. 20 A An Ω(n) Lower Bound on Worst-Case Adjustment Complexity By a straightforward modification of the lower bound example in [17], we can show that adjustment- complexity of any deterministic algorithm is Ω(n) in the worst-case. Consider the following example: Let G1 be a complete bipartite graph between two sets of vertices L1 and R1, each of size n/4. We create an identical copy of G1 named G2 with bipartition L2, R2 on the remaining vertices and let G be the union of these graphs. Consider any deterministic algorithm A for maintaining an MIS on G. Without loss of generality, assume L1 ∪ L2 is the MIS chosen by A (in any MIS of G either L1 is entirely in the MIS or R1 and similarly for L2 and R2). Let u1 and u2 be two arbitrary vertices in L1 and L2. The adversary starts deleting all edges incident to all vertices in L1 \ {u1} and L2 \ {u2}. Finally, it adds an edge between u1 and u2. We argue that at some point during these updates, A adjusted Ω(n) vertices in the maintained MIS. There are two cases to consider. For simplicity of exposition, we assume that at each time step, all edges incident to a vertex are deleted at once. Suppose at some point before inserting the last edge, A decides to add a vertex in R1 to the MIS for the first time (the argument is symmetric for R2 as well). Since u1 is incident to all vertices in R1, this means that u1 needs to leave the MIS. Also, since a vertex in R1 has joined the MIS, we know that there cannot be any edge from vertices in the MIS to any vertex in R1 (as we start with a complete bipartite graph and assumed that all edges incident to a vertex are deleted simultaneously). This means that after this step, all vertices in R1 should join the MIS to ensure maximality. Therefore, at this step, Ω(n) vertices are inserted to the MIS at once, proving the claim in this case. Now suppose that before inserting the last edge, no vertex in R1 and R2 belong to the MIS and hence both u1 and u2 should be inside it. By adding an edge between u1 and u2, A is forced to remove at least one of them, say u1, from the MIS, which in turn forces all R1 to join MIS to keep the maximality. Hence, again, Ω(n) vertices are inserted to the MIS at once, finalizing the proof. Remark A.1. We remark that this simple example explains why we obtain our results in amortized bounds rather than worst-case bounds. 21
1604.02188
1
1604
2016-04-07T22:31:38
Simultaneous Nearest Neighbor Search
[ "cs.DS", "cs.CG" ]
Motivated by applications in computer vision and databases, we introduce and study the Simultaneous Nearest Neighbor Search (SNN) problem. Given a set of data points, the goal of SNN is to design a data structure that, given a collection of queries, finds a collection of close points that are compatible with each other. Formally, we are given $k$ query points $Q=q_1,\cdots,q_k$, and a compatibility graph $G$ with vertices in $Q$, and the goal is to return data points $p_1,\cdots,p_k$ that minimize (i) the weighted sum of the distances from $q_i$ to $p_i$ and (ii) the weighted sum, over all edges $(i,j)$ in the compatibility graph $G$, of the distances between $p_i$ and $p_j$. The problem has several applications, where one wants to return a set of consistent answers to multiple related queries. This generalizes well-studied computational problems, including NN, Aggregate NN and the 0-extension problem. In this paper we propose and analyze the following general two-step method for designing efficient data structures for SNN. In the first step, for each query point $q_i$ we find its (approximate) nearest neighbor point $\hat{p}_i$; this can be done efficiently using existing approximate nearest neighbor structures. In the second step, we solve an off-line optimization problem over sets $q_1,\cdots,q_k$ and $\hat{p}_1,\cdots,\hat{p}_k$; this can be done efficiently given that $k$ is much smaller than $n$. Even though $\hat{p}_1,\cdots,\hat{p}_k$ might not constitute the optimal answers to queries $q_1,\cdots,q_k$, we show that, for the unweighted case, the resulting algorithm is $O(\log k/\log \log k)$-approximation. Also, we show that the approximation factor can be in fact reduced to a constant for compatibility graphs frequently occurring in practice. Finally, we show that the "empirical approximation factor" provided by the above approach is very close to 1.
cs.DS
cs
Simultaneous Nearest Neighbor Search∗ Piotr Indyk MIT [email protected] Robert Kleinberg Cornell and MSR [email protected] Sepideh Mahabadi MIT [email protected] Yang Yuan Cornell University [email protected] Abstract Motivated by applications in computer vision and databases, we introduce and study the Simultane- ous Nearest Neighbor Search (SNN) problem. Given a set of data points, the goal of SNN is to design a data structure that, given a collection of queries, finds a collection of close points that are "compatible" with each other. Formally, we are given k query points Q = q1,··· , qk, and a compatibility graph G with vertices in Q, and the goal is to return data points p1,··· , pk that minimize (i) the weighted sum of the distances from qi to pi and (ii) the weighted sum, over all edges (i, j) in the compatibility graph G, of the distances between pi and pj. The problem has several applications in computer vision and databases, where one wants to return a set of consistent answers to multiple related queries. Further- more, it generalizes several well-studied computational problems, including Nearest Neighbor Search, Aggregate Nearest Neighbor Search and the 0-extension problem. In this paper we propose and analyze the following general two-step method for designing efficient data structures for SNN. In the first step, for each query point qi we find its (approximate) nearest neighbor point pi; this can be done efficiently using existing approximate nearest neighbor structures. In the second step, we solve an off-line optimization problem over sets q1,··· , qk and p1,··· , pk; this can be done efficiently given that k is much smaller than n. Even though p1,··· , pk might not constitute the optimal answers to queries q1,··· , qk, we show that, for the unweighted case, the resulting algorithm satisfies a O(log k/ log log k)-approximation guarantee. Furthermore, we show that the approximation factor can be in fact reduced to a constant for compatibility graphs frequently occurring in practice, e.g., 2D grids, 3D grids or planar graphs. Finally, we validate our theoretical results by preliminary experiments. In particular, we show that the "empirical approximation factor" provided by the above approach is very close to 1. 1 Introduction The nearest neighbor search (NN) problem is defined as follows: given a collection P of n points, build a data structure that, given any query point from some set Q, reports the data point closest to the query. The problem is of key importance in many applied areas, including computer vision, databases, information retrieval, data mining, machine learning, and signal processing. The nearest neighbor search problem, as well as its approximate variants, have been a subject of extensive studies over the last few decades, see, e.g., [2, 3, 4, 5, 6, 7] and the references therein. Despite their success, however, the current algorithms suffer from significant theoretical and practical limitations. One of their major drawbacks is their inability to support and exploit structure in query sets that is often present in applications. Specifically, in many applications (notably in computer vision), queries ∗This work was in part supported by NSF grant CCF 1447476 [1] and the Simons Foundation. 1 issued to the data structure are not unrelated but instead correspond to samples taken from the same object. For example, queries can correspond to pixels or small patches taken from the same image. To ensure consistency, one needs to impose "compatibility constraints" that ensure that related queries return similar answers. Unfortunately, standard nearest neighbor data structures do not provide a clear way to enforce such constraints, as all queries are processed independently of each other. To address this issue, we introduce the Simultaneous Nearest Neighbor Search (SNN) problem. Given k simultaneous query points q1, q2,··· , qk, the goal of a SNN data structure is to find k points (also called labels) p1, p2,··· , pk in P such that (i) pi is close to qi, and (ii) p1,··· , pk are "compatible". Formally, the compatibility is defined by a graph G = (Q, E) with k vertices which is given to the data structure, along with the query points Q = q1,··· , qk. Furthermore, we assume that the data set P is a subset of some space X equipped with a distance function distX, and that we are given another metric distY defined over P ∪ Q. Given the graph G and the queries q1,··· , qk, the goal of the SNN data structure is to return points p1,··· , pk from P that minimize the following function: κidistY (pi, qi) + λi,jdistX (pi, pj) (1) k(cid:88) i=1 (cid:88) (i,j)∈E where κi and λi,j are parameters defined in advance. The above formulation captures a wide variety of applications that are not well modeled by traditional NN search. For example, many applications in computer vision involve computing nearest neighbors of pixels or image patches from the same image [8, 9, 10]. In particular, algorithms for tasks such as de- noising (removing noise from an image), restoration (replacing a deleted or occluded part of an image) or super-resolution (enhancing the resolution of an image) involve assigning "labels" to each image patch1. The labels could correspond to the pixel color, the enhanced image patch, etc. The label assignment should have the property that the labels are similar to the image patches they are assigned to, while at the same time the labels assigned to nearby image patches should be similar to each other. The objective function in Equation 1 directly captures these constraints. find a data point p that minimizes the sum2(cid:80) From a theoretical perspective, Simultaneous Nearest Neighbor Search generalizes several well-studied computational problems, notably the Aggregate Nearest Neighbor problem [12, 13, 14, 15, 16] and the 0- extension problem [17, 18, 19, 20]. The first problem is quite similar to the basic nearest neighbor search problem over a metric dist, except that the data structure is given k queries q1 ··· qk, and the goal is to i dist(qi, p). This objective can be easily simulated in SNN by setting distY = dist and distX = L · uniform, where L is a very large number and uniform(p, q) is the uniform metric. The 0-extension problem is a combinatorial optimization problem where the goal is to minimize an objective function quite similar to that in Equation 1. The exact definition of 0-extension as well as its connections to SNN are discussed in detail in Section 2.1. 1.1 Our results In this paper we consider the basic case where distX = distY and λi,j = κi = 1; we refer to this variant as the unweighted case. Our main contribution is a general reduction that enables us to design and analyze efficient data structures for unweighted SNN. The algorithm (called Independent Nearest Neighbors or INN) 1This problem has been formalized in the algorithms literature as the metric labeling problem [11]. The problem considered in this paper can thus be viewed as a variant of metric labeling with a very large number of labels. 2Other aggregate functions, such as the maximum, are considered as well. 2 consists of two steps. In the first (pruning) step, for each query point qi we find its nearest neighbor3 point pi ; this can be done efficiently using existing nearest neighbor search data structures. In the second (opti- mization) step, we run an appropriate (approximation) algorithm for the SNN problem over sets q1,··· , qk and p1,··· , pk; this can be done efficiently given that k is much smaller than n. We show that the resulting algorithm satisfies a O(b log k/ log log k)-approximation guarantee, where b is the approximation factor of the algorithm used in the second step. This can be further improved to O(bδ), if the metric space dist admits a δ-padding decomposition (see Preliminaries for more detail). The running time incurred by this algorithm is bounded by the cost of k nearest neighbor search queries in a data set of size n plus the cost of the ap- proximation algorithm for the 0-extension problem over an input of size k. By plugging in the best nearest neighbor algorithms for dist we obtain significant running time savings if k (cid:28) n. We note that INN is somewhat similar to the belief propagation algorithm for super-resolution described in [8]. Specifically, that algorithm selects 16 closest labels for each qi, and then chooses one of them by running a belief propagation algorithm that optimizes an objective function similar to Equation 1. However, we note that the algorithm in [8] is heuristic and is not supported by approximation guarantees. We complement our upper bound by showing that the aforementioned reduction inherently yields super- constant approximation guarantee. Specifically, we show that, for an appropriate distance function dist, queries q1,··· , qk, and a label set P , the best solution to SNN with the label set restricted to p1,··· , pk √ can be Θ( log k) times larger than the best solution with label set equal to P . This means that even if the second step problem is solved to optimality, reducing the set of labels from P to P inherently increases the cost by a super-constant factor. However, we further show that the aforementioned limitation can be overcome if the compatibility graph G has pseudoarboricity r (which means that each edge can be mapped to one of its endpoint vertices such that at most r edges are mapped to each vertex). Specifically, we show that if G has pseudoarboricity r, then the gap between the best solution using labels in P , and the best solution using labels in P , is at most O(r). Since many graphs used in practice do in fact satisfy r = O(1) (e.g., 2D grids, 3D grids or planar graphs), this means that the gap is indeed constant for a wide collection of common compatibility graphs. In Appendix 6 we also present an alternative algorithm for the r-pseudoarboricity case. Similarly to INN, the algorithm computes the nearest label to each query qi. However, the distance function used to compute the nearest neighbor involves not only the distance between qi and a label p, but also the distances between the neighbors of qi in G and p. This nearest neighbor operation can be implemented using any data structure for the Aggregate Nearest Neighbor problem [12, 13, 14, 15, 16]. Although this results in a more expensive query time, the labeling computed by this algorithm is final, i.e., there is no need for any additional postprocessing. Furthermore, the pruning gap (and therefore the final approximation ratio) of the algorithm is only 2r + 1, which is better than our bound for INN. Finally, we validate our theoretical results by preliminary experiments comparing our SNN data structure with an alternative (less efficient) algorithm that solves the same optimization problem using the full label set P . In our experiments we apply both algorithms to an image denoising task and measure their performance using the objective function (1). In particular, we show that the "empirical gap" incurred by the above approach, i.e, the ratio of objective function values observed in our experiments, is very close to 1. 3Our analysis immediately extends to the case where the we compute approximate, not exact, nearest neighbors. For simplicity we focus only on the exact case in the following discussion. 3 1.2 Our techniques We start by pointing out that SNN can be reduced to 0-extension in a "black-box" manner. Unfortunately, this reduction yields an SNN algorithm whose running time depends on the size of labels n, which could be very large; essentially this approach defeats the goal of having a data structure solving the problem. The INN algorithm overcomes this issue by reducing the number of labels from n to k. However the pruning step can increase the cost of the best solution. The ratio between the optimum cost after pruning to the optimum cost before pruning is called the pruning gap. To bound the pruning gap, we again resort to existing 0-extension algorithms, albeit in a "grey box" manner. Specifically, we observe that many algorithms, such as those in [19, 20, 18, 21], proceed by first creating a label assignment in an "extended" metric space (using a LP relaxation of 0-extension), and then apply a rounding algorithm to find an actual solution. The key observation is that the correctness of the rounding step does not rely on the fact that the initial label assignment is optimal, but instead it works for any label assignment. We use this fact to translate the known upper bounds for the integrality gap of linear programming relaxations of 0-extension into upper bounds for the pruning gap. On the flip side, we show a lower bound for the pruning gap by mimicking the arguments used in [19] to lower bound the integrality gap of a 0-extension relaxation. To overcome the lower bound, we consider the case where the compatibility graph G has pseudoarboric- ity r. Many graphs used in applications, such as 2D grids, 3D grids or planar graphs, have pseudoarboricity r for some constant r. We show that for such graphs the pruning gap is only O(r). The proof proceeds by directly assigning labels in P to the nodes in Q and bounding the resulting cost increase. It is worth not- ing that the "grey box" approach outlined in the preceding paragraph, combined with Theorem 11 of [19], yields an O(r3) pruning gap for the class of Kr,r-minor-free graphs, whose pseudoarboricity is O(r). Our O(r) pruning gap not only improves this O(r3) bound in a quantitative sense, but it also applies to a much broader class of graphs. For example, three-dimensional grid graphs have pseudoarboricity 6, but the class of three-dimensional grid graphs includes graphs with Kr,r minors for every positive integer r. Finally, we validate our theoretical results by experiments. We focus on a simple de-noising scenario where X is the pixel color space, i.e., the discrete three-dimensional space space {0 . . . 255}3. Each pixel in this space is parametrized by the intensity of the red, green and blue colors. We use the Euclidean norm to measure the distance between two pixels. We also let P = X. We consider three test images: a cartoon with an MIT logo and two natural images. For each image we add some noise and then solve the SNN problems for both the full color space P and the pruned color space P . Note that since P = X, the set of pruned labels P simply contains all pixels present in the image. Unfortunately, we cannot solve the problems optimally, since the best known exact algorithm takes exponential time. Instead, we run the same approximation algorithm on both instances and compare the solutions. We find that the values of the objective function for the solutions obtained using pruned labels and the full label space are equal up to a small multiplicative factor. This suggests that the empirical value of the pruning gap is very small, at least for the simple data sets that we considered. 2 Definitions and Preliminaries We define the Unweighted Simultaneous Nearest Neighbor problem as follows. Let (X, dist) be a metric space and let P ⊆ X be a set of n points from the space. Definition 2.1. In the Unweighted Simultaneous Nearest Neighbor problem, the goal is to build a data structure over a given point set P that supports the following operation. Given a set of k points Q = 4 {q1,··· , qk} in the metric space X, along with a graph G = (Q, E) of k nodes, the goal is to report k (not necessarily unique) points from the database p1,··· , pk ∈ P which minimize the following cost function: k(cid:88) i=1 (cid:88) (qi,qj )∈E dist(pi, qi) + dist(pi, pj) (2) We refer to the first term in sum as the nearest neighbor (NN) cost, and to the second sum as the pairwise (PW) cost. We denote the cost of the optimal assignment from the point set P by Cost(Q, G, P ). In the rest of this paper, simultaneous nearest neighbor (SNN) refers to the unweighted version of the problem (unless stated otherwise). Next, we define the pseudoarboricity of a graph and r-sparse graphs. Definition 2.2. Pseudoarboricity of a graph G is defined to be the minimum number r, such that the edges of the graph can be oriented to form a directed graph with out-degree at most r. In this paper, we call such graphs as r-sparse. Note that given an r-sparse graph, one can map the edges to one of its endpoint vertices such that there are at most r edges mapped to each vertex. The doubling dimension of a metric space is defined as follows. Definition 2.3. The doubling dimension of a metric space (X, dist) is defined to be the smallest δ such that every ball in X can be covered by 2δ balls of half the radius. It is known that the doubling dimension of any finite metric space is O(log X). We then define padding decompositions. Definition 2.4. A metric space (X, dist) is δ-padded decomposable if for every r, there is a randomized partitioning of X into clusters C = {Ci} such that, each Ci has diameter at most r, and that for every x1, x2 ∈ X, the probability that x1 and x2 are in different clusters is at most δdist(x1, x2)/r. It is known that any finite metric with doubling dimension δ admits an O(δ)-padding decomposition [22]. 2.1 0-Extension Problem The 0-extension problem, first defined by Karzanov [17] is closely related to the Simultaneous Nearest Neighbor problem. In the 0-extension problem, the input is a graph G(V, E) with a weight function w(e), and a set of terminals T ⊆ V with a metric d defined on T . The goal is to find a mapping from the vertices to the terminals f : V → T such that each terminal is mapped to itself and that the following cost function is minimized: (cid:88) (u,v)∈E w(u, v) · d(f (u), f (v)) It can be seen that this is a special case of the metric labeling problem [11] and thus a special case of the general version of the SNN problem defined by Equation 1. To see this, it is enough to let Q = V and P = T , and let κi = ∞ for qi ∈ T , κi = 0 for qi (cid:54)∈ T , and λi,j = w(i, j) in Equation 1. Calinescu et al. [19] considered the semimetric relaxation of the LP for the 0-extension problem and gave an O(log T) algorithm using randomized rounding of the LP solution. They also proved an integrality Later Fakcharoenphol et al. [18] improved the upper-bound to O(log T/ log log T), and Lee and Naor [21] proved that if the metric d admits a δ-padded decomposition, then there is an O(δ)-approximation ratio of O((cid:112)log T) for the semimetric LP relaxation. 5 algorithm for the 0-extension problem. For the finite metric spaces, this gives an O(δ) algorithm where δ is the doubling dimension of the metric space. Furthermore, the same results can be achieved using another metric relaxation (earth-mover relaxation), see [20]. Later Karloff et al. [23] proved that there is no polynomial time algorithm for 0-extension problem with approximation factor O((log n)1/4−) unless N P ⊆ DT IM E(npoly(log n)). SNN can be reduced to 0-extension in a "black-box" manner via the following lemma. Lemma 2.5. Any b-approximate algorithm for the 0-extension problem yields an O(b)-approximate algo- rithm for the SNN problem. Proof. Given an instance of the SNN problem (Q, G(cid:48), P ), we build an instance of the 0-extension problem (V, T, G) as follows. Let T = P and V = T ∪ Q. The metric d is the same as dist. However the graph G of the 0-extension problem requires some modification. Let G(cid:48) = (Q, EG(cid:48)), then G = (V, E) is defined as follows. For each qi, qj ∈ Q, we have the edge (qi, qj) ∈ E iff (qi, qj) ∈ EG(cid:48). We also include another type of edges in the graph: for each qi ∈ Q, we add an edge (qi, pi) ∈ E where pi ∈ P is the nearest neighbor of qi. Note that we consider the graph G to be unweighted. Using the b-approximation algorithm for this problem, we get an assignment µ that maps the non- terminal vertices q1,··· , qk to the terminal vertices. Suppose qi is mapped to the terminal vertex pi in this assignment. Let p∗ k be the optimal SNN assignment. Next, we show that the same mapping µ for the SNN problem, gives us an O(b) approximate solution. The SNN cost of the mapping µ is denoted as follows: CostSNN(µ) = dist(qi, pi) + dist(pi, pj) ≤ Cost(Q, G(cid:48), P ) + b · [ dist(qi, p∗ i ) + dist(p∗ i , p∗ j )] where we have used triangle inequality and the following facts in the above. First, pi is the closest point in P to qi and thus dist(qi, pi) ≤ dist(qi, p∗ i ). Second, by definition we have that Cost(Q, G(cid:48), P ) = j ). Finally, since µ is a b approximate solution for the 0-extension (qi,qj )∈EG(cid:48) dist(pi, pj) is smaller than b times the 0-extension (cid:80)k i )+(cid:80) i=1 dist(pi, pi) +(cid:80) problem, we have that(cid:80)k i=1 dist(qi, p∗ cost of any other assignment, and in particular(cid:80)k (qi,qj )∈EG(cid:48) dist(p∗ i ) +(cid:80) i , p∗ j ). By plugging in the known 0-extension algorithms cited earlier we obtain the following: (qi,qj )∈EG(cid:48) dist(p∗ i=1 dist(pi, p∗ i , p∗ 6 1,··· , p∗ k(cid:88) ≤ k(cid:88) ≤ k(cid:88) i=1 i=1 i=1 dist(qi, p∗ (cid:88) k(cid:88) (qi,qj )∈EG(cid:48) i=1 i=1 k(cid:88) i ) + b · [ k(cid:88) k(cid:88) i=1 ≤ Cost(Q, G(cid:48), P ) + b · [ ≤ Cost(Q, G(cid:48), P )(2b + 1) i=1 dist(qi, pi) + dist(pi, pi) + dist(pi, pj) (cid:88) (qi,qj )∈EG(cid:48) (cid:88) k(cid:88) (qi,qj )∈EG(cid:48) dist(pi, p∗ i ) + dist(pi, qi) + i=1 dist(pi, qi) + Cost(Q, G(cid:48), P )] dist(p∗ i , p∗ j )] (cid:88) (qi,qj )∈EG(cid:48) Corollary 2.6. There exists an O(log n/ log log n) approximation algorithm for the SNN problem with running time nO(1), where n is the size of the label set. Corollary 2.7. If the metric space (X, dist) is δ-padded decomposable, then there exists an O(δ) approxi- mation algorithm for the SNN problem with running time nO(1). For finite metric spaces X, δ could represent the doubling dimension of the metric space (or equivalently the doubling dimension of P ∪ Q). Unfortunately, this reduction yields a SNN algorithm with running time depending on the size of labels n, which could be very large. In the next section we show how to improve the running time by reducing the labels set size from n to k. However, unlike the reduction in this section, our new reduction will no longer be "black-box". Instead, its analysis will use particular properties of the 0-extension algorithms. Fortunately those properties are satisfied by the known approximation algorithms for this problem. 3 Independent Nearest Neighbors Algorithm In this section, we consider a natural and general algorithm for the SNN problem, which we call Independent Nearest Neighbors (INN). The algorithm proceeds as follows. Given the query points Q = {q1,··· , qk}, for each qi the algorithm picks its (approximate) nearest neighbor pi. Then it solves the problem over the set P = { p1,··· , pk} instead of P . This simple approach reduces the size of search space from n down to k. The details of the algorithm are shown in Algorithm 1. Algorithm 1 Independent Nearest Neighbors (INN) Algorithm Input Q = {q1,··· , qk}, and input graph G = (Q, E) 1: for i = 1 to k do 2: 3: end for 4: Find the optimal (or approximately optimal) solution among the set P = { p1,··· , pk}. Query the NN data structure to extract a nearest neighbor (or approximate nearest neighbor) pi for qi In the rest of the section we analyze the quality of this pruning step. More specifically, we define the pruning gap of the algorithm as the ratio of the optimal cost function using the points in P over its value using the original point set P . Definition 3.1. The pruning gap of an instance of SNN is defined as α(Q, G, P ) = Cost(Q,G, P ) the pruning gap of the INN algorithm, α, as the largest value of α(Q, G, P ) over all instances. Cost(Q,G,P ). We define First, in Section 3.1, by proving a reduction from algorithms for rounding the LP solution of the 0- extension problem, we show that for arbitrary graphs G, we have α = O(log k/ log log k), and if the metric (X, dist) is δ-padded decomposable, we have α = O(δ) (for example, for finite metric spaces X, δ can represent the doubling dimension of the metric space). Then, in Section 3.2, we prove that α = O(r) where r is the pseudoarboricity of the graph G. This would show that for the sparse graphs, the pruning gap √ remains constant. Finally, in Section 4, we present a lower bound showing that the pruning gap could be as large as Ω( log k) and as large as Ω(r) for (r ≤ √ log k). Therefore, we get the following theorem. Theorem 3.2. The following bounds hold for the pruning gap of the INN algorithm. First we have α = O( log k log log k ), and that if metric (X, dist) is δ-padded decomposable, we have α = O(δ). Second, α = O(r) 7 √ where r is the pseudoarboricity of the graph G. Finally, we have that α = Ω( r ≤ √ log k. log k) and α = Ω(r) for Note that the above theorem results in an O(b · α) time algorithm for the SNN problem where b is the approximation factor of the algorithm used to solve the metric labeling problem for the set P , as noted in line 4 of the INN algorithm. For example in a general graph b would be O(log k/ log log k) that is added on top of O(α) approximation of the pruning step. 3.1 Bounding the pruning gap using 0-extension In this section we show upper bounds for the pruning gap (α) of the INN algorithm. The proofs use specific properties of existing algorithms for the 0-extension problem. Definition 3.3. We say an algorithm A for the 0-extension problem is a β-natural rounding algorithm if, given a graph G = (V, E), a set of terminals T ⊆ V , a metric space (X, dX ), and a mapping µ : V → X, it outputs another mapping ν : V → X with the following properties: • ∀t ∈ T : ν(t) = µ(t) • ∀v ∈ V : ∃t ∈ T s.t. ν(v) = µ(t) • Cost(ν) ≤ βCost(µ), i.e.,(cid:80) (u,v)∈E dX (ν(u), ν(v)) ≤ β ·(cid:80) (u,v)∈E dX (µ(u), µ(v)) Many previous algorithms for the 0-extension problem, such as [19, 20, 18, 21], first create the mapping µ using some LP relaxation of 0-extension (such as semimetric relaxation or earth-mover relaxation), and then apply a β-natural rounding algorithm for the 0-extension to find the mapping ν which yields the solution to the 0-extension problem. Below we give a formal connection between guarantees of these rounding algorithms, and the quality of the output of the INN algorithm (the pruning gap of INN). Lemma 3.4. Let A be a β-natural rounding algorithm for the 0-extension problem. Then we can infer that the pruning gap of the INN algorithm is O(β), that is, α = O(β). Proof. Fix any SNN instance (Q, GS, P ), where GS = (Q, EP W ), and its corresponding INN invocation. We construct the inputs to the algorithm A from the INN instance as follows. Let the metric space of A be the same as (X, dist) defined in the SNN instance. Also, let V be a set of 2k vertices corresponding to P ∪ P ∗ with T corresponding to P . Here P ∗ = {p∗ k} is the set of the optimal solutions of SNN, and P is the set of nearest neighbors as defined by INN. The mapping µ simply maps each vertex from V = P ∪ P ∗ to itself in the metric X defined in SNN. Moreover, the graph G = (V, E) is defined such that E = {(pi, p∗ i , p∗ Cost(Q, GS, P ) = Cost(Q, GS, P ∗)) First we claim the following (note that Cost(µ) is defined in Definition 3.3, and that by definition i )1 ≤ i ≤ k} ∪ {(p∗ j )(qi, qj) ∈ EP W}. 1,··· , p∗ Cost(µ) ≤ 2Cost(Q, GS, P ∗) = 2Cost(Q, GS, P ) We know that Cost(Q, GS, P ∗) can be split into NN cost and PW cost. We can also split Cost(µ) into i )1 ≤ i ≤ k}) and PW cost (corresponding to edge set NN cost (corresponding to edge set {(pi, p∗ j )(qi, qj) ∈ EP W}). By definition we know the PW costs of Cost(Q, GS, P ) and Cost(µ) are equal. {(p∗ i ) ≤ dist(pi, qi) + dist(qi, p∗ i ) ≤ 2 · dist(qi, p∗ For NN cost, by triangle inequality, we know dist(pi, p∗ i ). Here we use the fact that pi is the nearest database point of qi. Thus, the claim follows. i , p∗ 8 We then apply algorithm A to get the mapping ν. By the assumption on A, we know that Cost(ν) ≤ βCost(µ). Given the mapping ν by the algorithm A, consider the assignment in the SNN instance where i ) ∈ T , this would map all points qi to points in each query qi is mapped to ν(p∗ P . Thus, by definition, we have that Cost(Q, GS, P ) ≤ k(cid:88) ≤ k(cid:88) ≤ k(cid:88) i=1 i=1 dist(qi, pi) + i=1 dist(qi, pi) + Cost(ν) i ), and note that since ν(p∗ (cid:88) dist(qi, ν(p∗ i )) + dist(ν(p∗ k(cid:88) (qi,qj )∈EP W dist(pi, ν(p∗ i )) + i ), ν(p∗ j )) (cid:88) (qi,qj )∈EP W dist(ν(p∗ i ), ν(p∗ j )) i=1 ≤ Cost(Q, GS, P ) + βCost(µ) ≤ (2β + 1)Cost(Q, GS, P ) where we have used the triangle inequality. Therefore, we have that the pruning gap α of the INN algorithm is O(β), as claimed. Using the previously cited results, and noting that in the above instance V = O(k), we get the follow- ing corollaries. Corollary 3.5. The INN algorithm has pruning gap α = O(log k/ log log k). Corollary 3.6. If the metric space (X, dist) admits a δ-padding decomposition, then the INN algorithm has pruning gap α = O(δ). For finite metric spaces (X, dist), δ is at most the doubling dimension of the metric space. 3.2 Sparse Graphs In this section, we prove that the INN algorithm performs well on sparse graphs. More specifically, here we prove that when the graph G is r-sparse, then α(Q, G, P ) = O(r). To this end, we show that there exists an assignment using the points in P whose cost function is within O(r) of the optimal solution using the points in the original data set P . Let p∗ Given a graph G of pseudoarboricity r, we know that we can map each edge to one of its end points such that the number of edges mapped to each vertex is at most r. For each edge e, we call the vertex that e is mapped to as the corresponding vertex of e. This would mean that each vertex is the corresponding vertex of at most r edges. k ∈ P denote the optimal solution of SNN. Algorithm 2 shows how to find an assignment 1,··· , p∗ p1,··· , pk ∈ P . We show that the cost of this assignment is within a factor O(r) from the optimum. Lemma 3.7. The assignment defined by Algorithm 2, has O(r) approximation factor. Proof. For each qi ∈ Q, let yi = dist(p∗ i , qi) and for each edge e = (qi, qj) ∈ E let xe = dist(p∗ i , p∗ j ). e∈E xe. Note that Y is the NN cost and X is the PW cost of the optimal e, Y (cid:48) , X(cid:48) in the same way assignment and that OP T = Cost(Q, G, P ) = X + Y . Define the variables y(cid:48) i=1 yi and X =(cid:80) Also let Y =(cid:80)k i, x(cid:48) 9 1,··· , p∗ Algorithm 2 r-Sparse Graph Assignment Algorithm Input Query points q1,··· , qk, Optimal assignment p∗ input graph G = (Q, E) Output An Assignment p1,··· , pk ∈ P 1: for i = 1 to k do Let j0 = i and let qj1,··· , qjt be all the neighbors of qi in the graph G 2: 3: m ← arg mint Assign pi ← pjm 4: 5: end for (cid:96)=0 dist(p∗ ) + dist(p∗ i , p∗ , qj(cid:96)) j(cid:96) j(cid:96) k, Nearest Neighbors p1,··· , pk, and the i as follows. but for the assignment p1,··· , pk produced by the algorithm. That is, for each qi ∈ Q, y(cid:48) i = dist(pi, qi), and for each edge e = (qi, qj) ∈ E, x(cid:48) e = dist(pi, pj). Moreover, for a vertex qi, we define the designated neighbor of qi to be qjm for the value of m defined in the line 3 of Algorithm 2 (note that the designated neighbor might be the vertex itself). Fix a vertex qi and let qc be the designated neighbor of qi. We can bound the value of y(cid:48) y(cid:48) i = dist(qi, pi) = dist(qi, pc) ≤ dist(qi, p∗ i ) + dist(p∗ ≤ yi + dist(p∗ c) + 2dist(p∗ i , p∗ ≤ yi + 2[dist(p∗ i , p∗ c) + dist(p∗ ≤ 3yi (by definition of designated neighbor and the value m in line 3 of Algorithm 2) Thus summing over all vertices, we get that Y (cid:48) ≤ 3Y . Now for any fixed edge e = (qi, qs) (with qi being its corresponding vertex), let qc be the designated neighbor of qi, and qz be the designated neighbor of qs. Then we bound the value of x(cid:48) c, qc) + dist(qc, pc) (since pc is the nearest neighbor of qc) (by triangle inequality) c) + dist(p∗ c, qc) c, qc)] i , p∗ e as follows. x(cid:48) e = dist(pi, ps) = dist(pc, pz) ≤ dist(pc, qc) + dist(qc, p∗ z) + dist(p∗ + dist(p∗ s, p∗ ≤ 2dist(qc, p∗ c) + dist(p∗ z) + 2dist(p∗ + dist(p∗ s, p∗ ≤ 2[dist(qc, p∗ c) + dist(p∗ ≤ 2yi + xe + 2[xe + yi] ≤ 4(xe + yi) (by definition of designated neighbor and line 4 of Algorithm 2) i , p∗ s) i ) + dist(p∗ i ) + dist(p∗ c) + dist(p∗ (by triangle inequality) c, p∗ z, qz) + dist(qz, pz) c, p∗ i , p∗ s) z, qz) i )] + dist(p∗ c, p∗ (since qc(qz respectively) is designated neighbor of qi(qs respectively)) (since pc(pz respectively) is a NN of qc(qz respectively)) s) + 2[dist(p∗ z) + dist(p∗ s, p∗ i , p∗ z, qz)] Hence, summing over all the edges, since each vertex qi is the corresponding vertex of at most r edges, we get that X(cid:48) ≤ 4X + 4rY . Therefore we have the following. Cost(Q, G, P ) ≤ X(cid:48) + Y (cid:48) ≤ 3Y + 4X + 4rY ≤ (4r + 3) · Cost(Q, G, P ) and thus α(Q, G, P ) = O(r). 10 4 Lower bound √ log k) for the approximation factor of the INN algorithm. In this section we prove a lower bound of Ω( √ Furthermore, the lower bound example presented in this section is a graph (in fact a multi-graph) that has pseudoarboricity equal to O( log k), showing that in a way, the upper bound of α = O(r) for the r-sparse log k, we have α = Ω(r). We note that the lower bound construction presented in this paper is similar to the approach of [19] for proving a lower bound for the integrality ratio of the LP relaxation for the 0-extension problem. graphs is tight. More specifically, we show that for r ≤ √ Lemma 4.1. For any value of k, there exists a set of points P of size O(k) in a metric space X, and a query (Q, G) such that Q = k and the pruning step induces an approximation factor of at least α(Q, G, P ) = √ Ω( log k). √ Proof. In what follows, we describe the construction of the lower bound example. Let H = (V, E) be an expander graph with k vertices V = {v1,··· , vk} such that each vertex has constant degree d and the vertex expansion of the graph is also a constant c. Let H(cid:48) = (V (cid:48), E(cid:48), W (cid:48)) be a weighted graph constructed from H by adding k vertices {u1,··· , uk} such that each new vertex ui is log k. All the other edges between {v1,··· , vk} (which a leaf connected to vi with an edge of weight were present in H) have weight 1. This graph H(cid:48) defines the metric space (X, dist) such that X is the set of nodes V (cid:48) and dist is the weight of the shortest path between the nodes in the graph H(cid:48). Moreover, let P = V (cid:48) be all the vertices in the graph H(cid:48). Let the set of k queries be Q = V (cid:48) \ V = {u1, . . . , uk}. Then, while running the INN algorithm, the set of candidates P would be the queries themselves, i.e., P = Q = {u1,··· , uk}. Also, let the input graph G = (Q, EG) be a multi-graph which is obtained from H by replacing each edge (vi, vj) in H with log k copies of the edge (ui, uj) in G. This is the input graph given along with the k queries to the algorithm. Consider the solution P ∗ = {p∗ √ 1,··· , p∗ k} where p∗ (cid:88) i = vi. The cost of this solution is dist(vi, vj) = k(cid:112)log k + kd(cid:112)log k/2 k(cid:88) i=1 dist(qi, p∗ i ) + (ui,uj )∈EG Therefore, the cost of the optimal solution OP T = Cost(Q, G, P ) is at most O(k the optimal labeling P ∗ = { p∗ 1,··· , p∗ of the following forms. Case 1: For all 1 ≤ i ≤ k, we have p∗ log k). Next, consider k} ⊆ P using only the points in P . This optimal assignment has one i = ui. The cost of P ∗ in this case would be √ k(cid:88) i=1 (cid:88) dist(ui, uj) ≥ 0 + EG · 2(cid:112)log k ≥ dk log k 2 Cost(Q, G, P ) = dist(qi, ui) + Thus the cost in this case would be Ω(OP T Case 2: All the p∗ would be: (ui,uj )∈EG √ log k). i 's are equal. Without loss of generality suppose they are all equal to u1. Then the cost Cost(Q, G, P ) = dist(qi, u1) + dist(u1, u1) ≥ Ω(k log k) + 0 k(cid:88) i=1 (cid:88) (ui,uj )∈EG 11 2 of any vertex is at most 1 + d + ··· , d 2 log d = Θ(log k). Thus, again the cost of the assignment P in this case would be Ω(OP T This is true because in an expander graph with constant degree, the number of vertices at distance less √ than logd k k. Thus Θ(k) vertices are farther than logd k 2 = log k log k). Case 3: Let S = {S1,··· , St} be a partition of [k] such that each part corresponds to all the indices i having their p∗ i(cid:48). Now, two cases are possible. First if all the parts Sj have size at most k/2. In this case, since the graph H has expansion c, the total number of edges between different parts would be at least i equal. That is, for each 1 ≤ j ≤ t, we have ∀i, i(cid:48) ∈ Sj : p∗ 2 ≤ 2 i = p∗ √ logd k (cid:12)(cid:12)(cid:12){(ui, uj) ∈ EG p∗ i (cid:54)= p∗ j}(cid:12)(cid:12)(cid:12) ≥ 1 2 t(cid:88) j=1 cSj(cid:112)log k ≥ kc(cid:112)log k/2 log k/2 · √ √ Therefore similar to Case 1 above, the PW cost would be at least kc log k = Ω(k log k). Otherwise, at least one of the parts such as Sj has size at least k/2. In this case, similar to Case 2 above, the NN cost would be at least Ω(k log k). Therefore, in both cases the cost of the assignment P ∗ would be at least Ω(OP T √ log k). Hence, the pruning gap of the INN algorithm on this graph is Ω( log k). √ √ Since the degree of all the vertices in the above graph is d √ also Θ( above proof, the same arguments hold and we get the following corollary. log k). It is easy to check that if we repeat each edge r times instead of log k, the pseudoarboricity of the graph is log k times in EG in the √ Corollary 4.2. For any value of r ≤ √ log k, there exists an instance of SNN(Q,G,P) such that the input graph G has arboricity O(r) and that the pruning gap of the INN algorithm is α(Q, G, P ) = Ω(r). 5 Experiments We consider image denoising as an application of our algorithm. A popular approach to denoising (see e.g. [24]) is to minimize the following objective function: (cid:88) i∈V (cid:88) (i,j)∈E κid(qi, pi) + λi,jd(pi, pj) Here qi is the color of pixel i in the noisy image, and pi is the color of pixel i in the output. We use the standard 4-connected neighborhood system for the edge set E, and use Euclidean distance as the distance function d(·,·). We also set all weights κi and λi,j to 1. When the image is in grey scale, this objective function can be optimized approximately and efficiently using message passing algorithm, see e.g. [25]. However, when the image pixels are points in RGB color space, the label set becomes huge (n = 2563 = 16, 777, 216), and most techniques for metric labeling are not feasible. Recall that our algorithm proceeds by considering only the nearest neighbor labels of the query points, i.e., only the colors that appeared in the image. In what follows we refer to this reduced set of labels as the image color space, as opposed to the full color space where no pruning is performed. In order to optimize the objective function efficiently, we use the technique of [24]. We first embed the original (color) metric space into a tree metric (with O(log n) distortion), and then apply a top-down divide and conquer algorithm on the tree metric, by calling the alpha-beta swap subroutine [26]. We use the random-split kd-tree for both the full color space and the image color space. When constructing the kd- tree, split each interval [a, b] by selecting a random number chosen uniformly at random from the interval [0.6a + 0.4b, 0.4a + 0.6b]. 12 Avg cost for full color Avg cost for image color Empirical pruning gap MIT Snow Surf 341878 ± 3.1% 9338604 ± 4.5% 8304184 ± 6.6% 340477 ± 1.1% 9564288 ± 6.2% 7588244 ± 5.1% 0.996 1.024 0.914 Table 1: The empirical values of objective functions for the respective images and algorithms. To evaluate the performance of the two algorithms, we use one cartoon image with MIT logo and two images from the Berkeley segmentation dataset [27] which was previously used in other computer vision papers [24]. We use Matlab imnoise function to create noisy images from the original images. We run each instance 20 times, and compute both the average and the variance of the objective function (the variance is due to the random generating process of kd tree). Table 2: MIT logo (first column, size 45 ∗ 124), and two images from the Berkeley segmentation dataset [27] (second & third columns, size 321∗ 481). The first row shows the original image; the second row shows the noisy image; the third row shows the denoised image using full color space; the fourth row shows the denoised image using image space (our algorithm). 13 The results are presented in Figure 2 and Table 1. In Figure 2, one can see that the images produced by the two algorithms are comparable. The full color version seems to preserve a few more details than the image color version, but it also "hallucinates" non-existing colors to minimize the value of the objective function. The visual quality of the de-noised images can be improved by fine-tuning various parameters of the algorithms. We do not report these results here, as our goal was to compare the values of the objective function produced by the two algorithms, as opposed to developing the state of the art de-noising system. Note that, as per Table 1, for some images the value of the objective function is sometimes lower for the image color space compared to the full color space. This is because we cannot solve the optimization problem exactly. In particular, using the kd tree to embed the original metric space into a tree metric is an approximate process. 5.1 De-noising with patches To improve the quality of the de-noised images, we run the experiment for patches of the image, instead of pixels. Moreover, we use Algorithm 3 which implements not only a pruning step, but also computes the solution directly. In this experiment (see Figure 3 for a sample of the results), each patch (a grid of pixels) from the noisy image is a query point, and the dataset consists of available patches which we use as a substitute for a noisy patch. In our experiment, to build the dataset, we take one image from the Berkeley segmentation data set, then add noise to the right half of the image, and try to use the patches from the left half to denoise the right half. Each patch is of size 5 × 5 pixels. We obtain 317 × 236 patches from the left half of the image and use it as the patch database. Then we apply Algorithm 3 to denoise the image. In particular, for each noisy patch qn (out of 317 × 237 patches) in the right half of the image, we perform a linear scan to find the closest patch pi from the patch database, based on the following cost function: (cid:88) dist(pj, pi) 5 dist(qn, pi) + pj∈neighbor(qn) where dist(p, q) is defined to be the sum of squares of the l2 distances between the colors of corresponding pixels in the two patches. After that, for each noisy patch we retrieve the closest patch from the patch database. Then for each noisy pixel x, we first identify all the noisy patches (there are at most 25 of them) that cover it. The denoised color of this pixel x is simply the average of all the corresponding pixels in those noisy patches which cover x. Since the nearest neighbor algorithm is implemented using a linear scan, it takes around 1 hour to denoise one image. One could also apply some more advanced techniques like locality sensitive hashing to find the closest patches with much faster running time. Acknowledgements The authors would like to thank Pedro Felzenszwalb for formulating the Simul- taneous Nearest Neighbor problem, as well as many helpful discussions about the experimental setup. 6 2r + 1 approximation Motivated by the importance of the r-sparse graphs in applications, in this section we focus on them and present another algorithm (besides INN) which solves the SNN problem for these graphs. We note that unlike INN, the algorithm presented in this section is not just a pruning step, but it solves the whole SNN problem. 14 Table 3: Two images from the Berkeley segmentation dataset [27] (size 321 ∗ 481). The first column shows the original image; the second column shows the half noisy image; the third column shows the de-noised image using our algorithm for the patches. For a graph G = (Q, E) of pseudoarboricity r, let the mapping function be f : E → Q, such that for every e = (qi, qj), f (e) = qi or f (e) = qj, and that for each qi ∈ Q, C(qi) ≤ r, where C(qi) is defined as {ef (e) = qi}. Once we have the mapping function f, we can run Algorithm 3 to get an approximate solution. Although the naive implementation of this algorithm needs O(rkn) running time, by using the aggregate nearest neighbor algorithm, it can be done much more efficiently. We have the following lemma on the performance of this algorithm. Algorithm 3 Algorithm for graph with pseudoarboricity r Input Query points q1,··· , qk, the input graph G = (Q, E) with pseudoarboricity r Output An Assignment p1,··· , pk ∈ P 1: for i = 1 to k do 2: 3: end for Assign pi ← minp∈P dist(qi, p) +(cid:80) j:(qi,qj )∈C(qj ) dist(p,qj ) r+1 Lemma 6.1. If G has pseudoarboricity r, the solution of Algorithm 3 gives 2r + 1 approximation to the optimal solution. Proof. Denote the optimal solution as P ∗ = {p∗ 1,··· , p∗ Cost(Q, G, P ∗) = dist(qi, p∗ i ) + dist(p∗ i , p∗ (cid:88) i (cid:88) (qi,qj )∈E k}. We know the optimal cost is (cid:88) dist(p∗ (cid:88) i , qi) + j ) = dist(p∗ i , p∗ j ) j:(qi,qj )∈C(qj )  i 15 Let Sol be the solution reported by Algorithm 3. Then we have Cost(Sol) = dist(pi, pj)  (cid:88) j:(qi,qj )∈C(qj ) dist(pi, qj) + dist(pi, qj) ≤(cid:88) ≤(cid:88) i i ≤(r + 1) ≤(r + 1) dist(qi, pi) + (cid:88) (cid:88) j:(qi,qj )∈C(qj ) j:(qi,qj )∈C(qj ) i (cid:88) dist(qi, pi) + dist(qi, pi) + (cid:88) dist(qi, p∗ (cid:88) dist(qi, p∗ (cid:88) i i i ) + i ) + (qi,qj )∈C(qj ) (cid:88) (cid:88) (cid:88) (cid:88) j:(qi,qj )∈C(qj ) j:(qi,qj )∈C(qj ) (cid:88) (cid:88) i =(r + 1) dist(qi, pi) + dist(pi, qj) j:(qi,qj )∈C(qj )  + r (by definition of pseudoarboricity) j dist(qj, pj) dist(qj, pj)  (by triangle inequality) (cid:88) (cid:88)  (by the optimality of pi in the algorithm)  (by triangle inequality) j ) + dist(p∗ r + 1 j , qj) i , qj) dist(p∗ r + 1 dist(p∗ i , p∗ i ≤(r + 1)Cost(Q, G, P ∗) + ≤(r + 1)Cost(Q, G, P ∗) + r dist(p∗ j , qj) (by definition of pseudoarboricity) j:(qi,qj )∈C(qj ) dist(p∗ j , qj) = (2r + 1) Cost(Q, G, P ∗) j References [1] Pedro Felzenszwalb, William Freeman, Piotr Indyk, Robert Kleinberg, and Ramin Zabih. Big- data: F: Dka: Collaborative research: Structured nearest neighbor search in high dimensions. http://cs.brown.edu/pff/SNN/, 2015. [2] Jon Louis Bentley. Multidimensional binary search trees used for associative searching. Communica- tions of the ACM, 18(9):509 -- 517, 1975. [3] Sunil Arya, David M Mount, Nathan S Netanyahu, Ruth Silverman, and Angela Y Wu. An optimal algorithm for approximate nearest neighbor searching fixed dimensions. Journal of the ACM (JACM), 45(6):891 -- 923, 1998. [4] Piotr Indyk and Rajeev Motwani. Approximate nearest neighbors: towards removing the curse of dimensionality. In Proceedings of the thirtieth annual ACM symposium on Theory of computing, pages 604 -- 613. ACM, 1998. [5] Eyal Kushilevitz, Rafail Ostrovsky, and Yuval Rabani. Efficient search for approximate nearest neigh- bor in high dimensional spaces. SIAM Journal on Computing, 30(2):457 -- 474, 2000. 16 [6] Robert Krauthgamer and James R Lee. Navigating nets: simple algorithms for proximity search. In Proceedings of the fifteenth annual ACM-SIAM symposium on Discrete algorithms, pages 798 -- 807. Society for Industrial and Applied Mathematics, 2004. [7] Alexandr Andoni, Piotr Indyk, Huy L Nguyen, and Ilya Razenshteyn. Beyond locality-sensitive hash- ing. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1018 -- 1028. SIAM, 2014. [8] William T Freeman, Thouis R Jones, and Egon C Pasztor. Example-based super-resolution. Computer Graphics and Applications, IEEE, 22(2):56 -- 65, 2002. [9] Yuri Boykov, Olga Veksler, and Ramin Zabih. Fast approximate energy minimization via graph cuts. Pattern Analysis and Machine Intelligence, IEEE Transactions on, 23(11):1222 -- 1239, 2001. [10] Connelly Barnes, Eli Shechtman, Adam Finkelstein, and Dan Goldman. Patchmatch: A randomized correspondence algorithm for structural image editing. ACM Transactions on Graphics-TOG, 28(3):24, 2009. [11] Jon Kleinberg and Eva Tardos. Approximation algorithms for classification problems with pairwise relationships: Metric labeling and markov random fields. Journal of the ACM (JACM), 49(5):616 -- 639, 2002. [12] Man Lung Yiu, Nikos Mamoulis, and Dimitris Papadias. Aggregate nearest neighbor queries in road networks. Knowledge and Data Engineering, IEEE Transactions on, 17(6):820 -- 833, 2005. [13] Yang Li, Feifei Li, Ke Yi, Bin Yao, and Min Wang. Flexible aggregate similarity search. In Proceedings of the 2011 ACM SIGMOD international conference on management of data, pages 1009 -- 1020. ACM, 2011. [14] Feifei Li, Bin Yao, and Piyush Kumar. Group enclosing queries. Knowledge and Data Engineering, IEEE Transactions on, 23(10):1526 -- 1540, 2011. [15] Pankaj K Agarwal, Alon Efrat, and Wuzhou Zhang. Nearest-neighbor searching under uncertainty. In Proceedings of the 32nd symposium on Principles of database systems. ACM, 2012. [16] Tsvi Kopelowitz and Robert Krauthgamer. Faster clustering via preprocessing. arXiv preprint arXiv:1208.5247, 2012. [17] Alexander V Karzanov. Minimum 0-extensions of graph metrics. European Journal of Combinatorics, 19(1):71 -- 101, 1998. [18] Jittat Fakcharoenphol, Chris Harrelson, Satish Rao, and Kunal Talwar. An improved approximation algorithm for the 0-extension problem. In Proceedings of the fourteenth annual ACM-SIAM symposium on Discrete algorithms, pages 257 -- 265. Society for Industrial and Applied Mathematics, 2003. [19] Gruia Calinescu, Howard Karloff, and Yuval Rabani. Approximation algorithms for the 0-extension problem. SIAM Journal on Computing, 34(2):358 -- 372, 2005. 17 [20] Aaron Archer, Jittat Fakcharoenphol, Chris Harrelson, Robert Krauthgamer, Kunal Talwar, and ´Eva In Proceedings of the fifteenth annual Tardos. Approximate classification via earthmover metrics. ACM-SIAM symposium on Discrete algorithms, pages 1079 -- 1087. Society for Industrial and Applied Mathematics, 2004. [21] James R Lee and Assaf Naor. Metric decomposition, smooth measures, and clustering. Preprint, 2004. [22] Anupam Gupta, Robert Krauthgamer, and James R Lee. Bounded geometries, fractals, and low- distortion embeddings. In Foundations of Computer Science, 2003. Proceedings. 44th Annual IEEE Symposium on, pages 534 -- 543. IEEE, 2003. [23] Howard Karloff, Subhash Khot, Aranyak Mehta, and Yuval Rabani. On earthmover distance, metric labeling, and 0-extension. SIAM Journal on Computing, 39(2):371 -- 387, 2009. [24] Pedro F Felzenszwalb, Gyula Pap, Eva Tardos, and Ramin Zabih. Globally optimal pixel labeling algo- rithms for tree metrics. In Computer Vision and Pattern Recognition (CVPR), 2010 IEEE Conference on, pages 3153 -- 3160. IEEE, 2010. [25] Pedro F Felzenszwalb and Daniel P Huttenlocher. Efficient belief propagation for early vision. Inter- national journal of computer vision, 70(1):41 -- 54, 2006. [26] Yuri Boykov and Vladimir Kolmogorov. An experimental comparison of min-cut/max-flow algorithms for energy minimization in vision. Pattern Analysis and Machine Intelligence, IEEE Transactions on, 26(9):1124 -- 1137, 2004. [27] David R Martin, Charless C Fowlkes, and Jitendra Malik. Learning to detect natural image boundaries using local brightness, color, and texture cues. Pattern Analysis and Machine Intelligence, IEEE Transactions on, 26(5):530 -- 549, 2004. 18
1204.2933
1
1204
2012-04-13T09:43:27
Improved Randomized Online Scheduling of Intervals and Jobs
[ "cs.DS" ]
We study the online preemptive scheduling of intervals and jobs (with restarts). Each interval or job has an arrival time, a deadline, a length and a weight. The objective is to maximize the total weight of completed intervals or jobs. While the deterministic case for intervals was settled a long time ago, the randomized case remains open. In this paper we first give a 2-competitive randomized algorithm for the case of equal length intervals. The algorithm is barely random in the sense that it randomly chooses between two deterministic algorithms at the beginning and then sticks with it thereafter. Then we extend the algorithm to cover several other cases of interval scheduling including monotone instances, C-benevolent instances and D-benevolent instances, giving the same competitive ratio. These algorithms are surprisingly simple but have the best competitive ratio against all previous (fully or barely) randomized algorithms. Next we extend the idea to give a 3-competitive algorithm for equal length jobs. Finally, we prove a lower bound of 2 on the competitive ratio of all barely random algorithms that choose between two deterministic algorithms for scheduling equal length intervals (and hence jobs).
cs.DS
cs
Improved Randomized Online Scheduling of Intervals and Jobs∗ Stanley P. Y. Fung† Chung Keung Poon‡ Feifeng Zheng§ November 20, 2018 Abstract We study the online preemptive scheduling of intervals and jobs (with restarts). Each inter- val or job has an arrival time, a deadline, a length and a weight. The objective is to maximize the total weight of completed intervals or jobs. While the deterministic case for intervals was settled a long time ago, the randomized case remains open. In this paper we first give a 2-competitive randomized algorithm for the case of equal length intervals. The algorithm is barely random in the sense that it randomly chooses between two deterministic algorithms at the beginning and then sticks with it thereafter. Then we extend the algorithm to cover several other cases of interval scheduling including monotone instances, C-benevolent instances and D-benevolent instances, giving the same competitive ratio. These algorithms are surprisingly simple but have the best competitive ratio against all previous (fully or barely) randomized algorithms. Next we extend the idea to give a 3-competitive algorithm for equal length jobs. Finally, we prove a lower bound of 2 on the competitive ratio of all barely random algorithms that choose between two deterministic algorithms for scheduling equal length intervals (and hence jobs). keywords: interval and job scheduling; preemption with restart; online algorithms; randomized; lower bound 1 Introduction In this paper, we study two online preemptive scheduling problems. In the interval scheduling problem, we are to schedule a set of weighted intervals which arrive online (in the order of their left endpoints) so that at any moment, at most one interval is being processed. We can abort the interval currently being processed in order to start a new one. The goal is to maximize the sum of the weights of completed intervals. The problem can be viewed as a job scheduling problem in which each job has, besides its weight, an arrival time, a length and a deadline. Moreover, the deadline is always tight, i.e., deadline always equals arrival time plus length. Thus, if one does not start an interval immediately upon its arrival, or if one aborts it before its completion, that ∗The work described in this paper was fully supported by grants from the Research Grant Council of the Hong Kong SAR, China [CityU 119307] and NSFC Grant No. 60736027 and 70702030. †Department of Computer Science, University of Leicester, Leicester, United Kingdom. Email: [email protected] ‡Department of Computer Science, City University of Hong Kong, Hong Kong. Email: [email protected] §School of Management, Xi'an Jiaotong University, Xi'an, China. Email: [email protected] 1 interval will never be completed. The problem is fundamental in scheduling and is clearly relevant to a number of online problems such as call control and bandwidth allocation (see e.g., [2, 6, 19]). We also study the more general problem of job scheduling with restart. Here, the deadline of a job needs not be tight and we can abort a job and restart it from the beginning some time later. Both problems are in fact special cases of the broadcast scheduling problem which gains much attention recently due to its application in video-on-demand, stock market quotation, etc (see e.g., [13, 18, 20]). In that problem, a server holding a number of pages receives requests from its clients and schedules the broadcasting of its pages. A request is satisfied if the requested page is broadcasted in its entirety after the arrival time and before the deadline of the request. The page currently being broadcasted can be aborted in order to start a new one, and the aborted page can be re-broadcasted from the beginning later. Interval and job scheduling with restart can be seen as a special case in which each request asks for a different page. Our results concern barely random algorithms, i.e., randomized algorithms that randomly choose from a very small (constant) number of deterministic algorithms at the beginning and then stick with it thereafter. Quite some previous work in online scheduling considered the use of barely random algorithms (see e.g. [1, 9, 17]); it is interesting to consider how the competitiveness improves (upon their deterministic counterparts) by combining just a few deterministic algorithms. From now on, whenever we refer to "barely random algorithms", we mean algorithms that choose between two deterministic algorithms but possibly with unequal probability. Types of instances. In this paper, we consider the following special types of intervals or jobs: 1. equal length instances where all intervals or jobs have the same length, 2. monotone instances where intervals arriving earlier also have earlier deadlines, and 3. C- and D-benevolent instances where the weight of an interval is given by some 'nice' function of its length (convex increasing for C-benevolent, and decreasing for D-benevolent). The models will be defined precisely in the next section. These cases are already highly non-trivial, as we will see shortly, and many previous works on these problems put further restrictions on the inputs (such as requiring jobs to be unweighted or arrival times to be integral, in addition to being equal-length). The power of randomization for these problems is especially unclear. 1.1 Previous work The general case where intervals can have arbitrary lengths and weights does not admit constant competitive algorithms [19], even with randomization [6]. Therefore, some special types of instances have been studied in the literature. We first mention results for equal length interval scheduling. The deterministic case was settled in [19] where a 4-competitive algorithm and a matching lower bound were given. Miyazawa and Erlebach [16] were the first to give a better randomized algorithm: its competitive ratio is 3 but it only works for a special case where the weights of the intervals form a non-decreasing sequence. They also gave the first randomized lower bound of 5/4. The first randomized algorithm for arbitrary weight that has competitive ratio better than 4 (the bound for deterministic algorithms) was devised in [12]. It is 3.618-competitive and is barely random, choosing between two deterministic algorithms with equal probability. In the same paper, a lower bound of 2 for such barely random algorithms and 2 equal length upper bound 2.455 [11] 3.227 (barely random) [11] lower bound 1.693 [11] 2 (barely random) [this paper] 2 (barely random) [this paper] monotone C-benevolent same as above 3.732 [17] 2 (barely random) [this paper] same as above 1.693 [11] D-benevolent 2.455 [11] 1.5 [11] (with a surjective condition) 3.227 (barely random) [11] 2 (barely random) [this paper] Table 1: Best previous and new results for randomized interval scheduling a lower bound of 4/3 for general randomized algorithms were also proved. Recently, Epstein and Levin [11] gave a 2.455-competitive randomized algorithm and a 3.227-competitive barely random algorithm. They also gave a 1.693 lower bound on the randomized competitive ratio. The class of monotone instances (also called similarly ordered [9] or agreeable [15] instances in the literature) is a generalization of the class of equal length instances. Therefore, the former class inherits all the lower bounds for the latter class. In the offline case, the class of monotone instances is actually equivalent to that of equal length instances because of the result (see e.g. [4]) that the class of proper interval graphs (intersection graphs of intervals where no interval is strictly contained in another) is equal to the class of unit interval graphs. In the online case however, it is not completely clear that such an equivalence holds although some of the algorithms for the equal length case also work for the monotone case (e.g. [16, 12, 11]). Some of the aforementioned results for equal length instances also work for C- and D-benevolent instances, including Woeginger's 4-competitive deterministic algorithm, the lower bound of 4/3 in [12]1, the upper bounds in [11] (for D-benevolent instances only) and the lower bound in [11] (for C- benevolent instances only; they gave another slightly weaker lower bound of 3/2 for D-benevolent instances). A 3.732-competitive barely random algorithm for C-benevolent instances was given by Seiden [17]. Table 1 summarizes the various upper and lower bounds for randomized interval scheduling. Next we consider the problem of job scheduling with restarts. Zheng et al. [20] gave a 4.56- competitive deterministic algorithm. The algorithm was for the more general problem of scheduling broadcasts but it works for jobs scheduling with restarts too. We are not aware of previous results in the randomized case. Nevertheless, Chrobak et al. [9] considered a special case where the jobs have no weights and the objective is to maximize the number of completed jobs. For the randomized nonpreemptive case they gave a 5/3-competitive barely random algorithm and a lower bound of 3/2 for barely random algorithms that choose between two deterministic algorithms. They also gave an optimal 3/2-competitive algorithm for the deterministic preemptive (with restart) case, and a lower bound of 6/5 for the randomized preemptive case. We can also assume that the time is discretized into unit length slots and all (unit) jobs can only start at the beginning of each slot. Being a special case of the problem we consider in this paper, this version of unit job scheduling has been widely studied and has applications in buffer 1 This and most other lower bounds for D-benevolent instances only work for a subclass of functions that satisfy a surjective condition. 3 management of QoS switches. For this problem, a e/(e − 1)-competitive randomized algorithm was given in [7], and a randomized lower bound of 1.25 was given in [8]. The current best deterministic algorithm is 1.828-competitive [10]. An alternative preemption model is to allow the partially-executed job to resume its execution from the point that it is preempted. This was studied, for example, in [3, 14]. 1.2 Our results In this paper we give new randomized algorithms for the different versions of the online interval scheduling problem. They are all barely random and have a competitive ratio of 2. Thus they substantially improve previous results. See Table 1. It should be noted that although the algorithms are fairly simple, they were not discovered in several previous attempts by other researchers and ourselves [11, 12, 16]. Moreover the algorithms for all these versions of the problem are based on the same idea, which gives a unified way of analyzing these algorithms that were not present in previous works. Next we extend the algorithm to the case of job scheduling (with restarts), and prove that it is 3-competitive. This is the first randomized algorithm we are aware of for this problem. The extension of the algorithm is very natural but the proof is considerably more involved. Finally we prove a lower bound of 2 for barely random algorithms for scheduling equal length intervals (and jobs) that choose between two deterministic algorithms, not necessarily with equal probability. Thus it matches the upper bound of 2 for this class of barely random algorithms. Although this lower bound does not cover more general classes of barely random or randomized algorithms, we believe that this is still of interest. For example, a result of this type appeared in [9]. Also, no barely random algorithm using three or more deterministic algorithms with a better performance is known. The proof is also much more complicated than the one in [12] with equal probability assumption. 2 Preliminaries A job J is specified by its arrival time r(J), its deadline d(J), its length (or processing time) p(J) and its weight w(J). All r(J), d(J), p(J) and w(J) are nonnegative real numbers. An interval is a job with tight deadline, i.e. d(J) = r(J) + p(J). We further introduce the following concepts for intervals: for intervals I and J with r(I) < r(J), I contains J if d(I) ≥ d(J); if r(J) < d(I) < d(J), the two intervals overlap; and if d(I) ≤ r(J) < d(J), the intervals are disjoint. Next we define the types of instances that we consider in this paper. The equal length case is where p(J) is the same for all J; without loss of generality we can assume p(J) = 1. The remaining notions apply to intervals only. An instance is called monotone if for any two intervals I and J, if r(I) < r(J) then d(I) ≤ d(J). An instance is called C-benevolent if the weights of intervals are given by a function f of their lengths, where the function f satisfies the following three properties: (i) f (0) = 0 and f (p) > 0 for all p > 0, (ii) f is strictly increasing, and (iii) f is convex, i.e. f (p1) + f (p2) ≤ f (p1 − ǫ) + f (p2 + ǫ) for 0 < ǫ ≤ p1 ≤ p2. Finally, an instance is called D-benevolent if the weights of intervals are given by a function f of their lengths where 4 (i) f (0) = 0 and f (p) > 0 for any p > 0, and (ii) f is decreasing in (0, ∞). In our analysis, we partition the time axis into segments called slots, s1, s2, . . ., such that each time instant belongs to exactly one slot and the union of all slots cover the entire time axis. The precise way of defining the slots depends on the case being studied (equal-length, monotone, C- or D-benevolent instances). Slot si is an odd slot if i is odd, and is an even slot otherwise. The following is an important, though perhaps unusual, definition used throughout the paper. We say that a job (or an interval) is accepted by an algorithm A in a slot s if it is started by A within the duration of slot s and is then completed without interruption. Note that the completion time may well be after slot s. A may start more than one job in a slot, but it will become clear that for all online algorithms that we consider, at most one job will be accepted in a slot; all other jobs that were started will be aborted. For OP T we can assume that it always completes each interval or job it starts. The value of a schedule is the total weight of the jobs that are completed in the schedule. The performance of online algorithms is measured using competitive analysis [5]. An online randomized algorithm A is c-competitive if the expected value obtained by A is at least 1/c the value obtained by the optimal offline algorithm, for any input instance. The infimum of all such c is called the competitive ratio of A. We use OP T to denote the optimal algorithm (and its schedule). 3 Algorithms for Scheduling Intervals 3.1 Equal Length Instances In this section we describe and analyse a very simple algorithm RAN for the case of equal length intervals. RAN is barely random and consists of two deterministic algorithms A and B, described as follows. The time axis is divided into unit length slots, s1, s2, . . ., where slot si covers time [i − 1, i) for i = 1, 2, . . .. Intuitively, A takes care of odd slots and B takes care of even slots. Within each odd slot si, A starts the interval arriving first. If a new interval arrives in this slot while an interval is being processed, A will abort and start the new interval if its weight is larger than the current interval; otherwise the new interval is discarded. At the end of this slot, A is running (or about to complete) an interval with the largest weight among those that arrive within si; let Ii denote this interval. A then runs Ii to completion without abortion during the next (even) slot si+1. (Thus, Ii is the only interval accepted by A in slot si.) Algorithm A then stays idle until the beginning of the next odd slot. B runs similarly on even slots. RAN chooses one of A and B with equal probability 1/2 at the beginning. Theorem 3.1 RAN is 2-competitive for online interval scheduling on equal length instances. Proof. Each Ii is accepted by either A or B. Therefore, RAN completes each Ii with probability 1/2. On the other hand, OP T can accept at most one interval in each slot si, with weight at most w(Ii). It follows that the total value of OP T is at most 2 times the expected value of RAN . ✷ Trivial examples can show that RAN is not better than 2-competitive (e.g. a single interval). In fact we will show in Section 5 that no barely random algorithm that chooses between two deterministic algorithms is better than 2-competitive. But first we consider how this result can be generalized to other types of instances. 5 3.2 Monotone Instances Algorithm RAN -M . We adapt the idea of RAN to the case of monotone instances and call the algorithm RAN -M . Similar to RAN , RAN -M consists of two deterministic algorithms A and B, each chosen to execute with probability 1/2 at the beginning. The difference is that we cannot use the idea of unit length slots but we must define the lengths of the slots in an online manner. The execution of the algorithm is divided into phases and we name the slots in each phase locally as s1, s2, . . . independent of other phases. After the end of a phase and before the beginning of the next phase, the algorithm (both A and B) is idle with no pending intervals. A new phase starts when the first interval arrives while the algorithm is idle. Among all intervals that arrive at this time instant, let I0 be the one with the earliest deadline (ties broken arbitrarily). Then slot s1 is defined as [r(I0), d(I0)). A aims to accept the heaviest interval among those with arrival time falling within slot s1. To do this, A simply starts the first interval arriving in s1, and then whenever a new interval arrives that is heavier than the interval that A is currently executing, A aborts the current one and starts the new heavier interval. This is repeated until the time d(I0) is reached. By the property of monotone instances and the choice of I0, these intervals all have finishing time on or after d(I0). Let I1 denote the interval that A is executing (or about to complete) at the end of slot s1, i.e., time d(I0). B remains idle during the whole slot. If A just finishes I1 at time d(I0), then it will become idle again and this phase ends. Otherwise, d(I1) > d(I0) and slot s2 is now defined as [d(I0), d(I1)). In slot s2, A continues to execute I1 to completion without any interruption. (Thus, I1 is the only interval accepted by A in slot s1.) B accepts the heaviest interval among those with arrival time falling within slot s2, in the same manner A did in the previous slot. This interval is denoted by I2 and B will run it to completion during slot s3 (if its deadline is after the end of slot s2). In general, slot si (where i > 1) is defined as [d(Ii−2), d(Ii−1)). If i is odd, then at the beginning of slot si, B is executing Ii−1 (the interval accepted by B in slot si−1) and A is idle. B will run Ii−1 to completion while A will accept the heaviest interval among those arriving during this slot. If i is even, the actions are the same except that the roles of A and B are reversed. Theorem 3.2 RAN-M is 2-competitive for online interval scheduling on monotone instances. Proof. No interval will arrive during the idle time between phases (since otherwise RAN -M would have started a new phase), so each phase can be analyzed separately. Each interval completed by OP T will be analyzed according to the slot its arrival time falls into. In each slot si, OP T can accept at most one interval: This is true for s1 by the way s1 is chosen. For i > 1, consider the first interval I ′ accepted by OP T in slot si = [d(Ii−2), d(Ii−1)). (Recall that accepting a job means starting the job and then executing it to completion without interruption.) Since the start of slot si is after r(Ii−1), we have r(I ′) > r(Ii−1). By the monotone property, d(I ′) ≥ d(Ii−1). So, OP T cannot accept another interval in slot si. The rest of the proof is the same as the equal length case, namely, that the interval accepted by OP T in each slot has weight at most that of the interval accepted by A or B in the same slot. It follows that RAN -M is 2-competitive. ✷ 3.3 C-benevolent Instances Algorithm RAN -C. Once again, the algorithm for C-benevolent instances RAN -C consists of two deterministic algorithms A and B, each with probability 1/2 of being executed. The execution 6 of the algorithm is divided into phases as in the monotone case. When a new phase begins, the earliest arriving interval, denoted by I0, defines the first slot s1, i.e., s1 = [r(I0), d(I0)). (If there are several intervals arriving at the same time, let I0 be the one with the longest length.) We first describe the processing of intervals in slot s1, which is slightly different from the other slots. First, B starts and completes I0. During s1, A accepts the longest interval among those with arrival time during (r(I0), d(I0)) and finishing time after d(I0). Denote this interval by I1. (Note that there may be other intervals that arrive and end before I1 arrives. Naturally, A could finish them in order to gain more value. However, to simplify our analysis, we assume that A will not process them.) If there is no such I1, i.e., no interval arrives within s1 and ends after d(I0), the phase ends at the end of s1. Suppose I1 exists. Then define slot s2 as [d(I0), d(I1)). A uses the entire slot s2 to complete I1 without interruption. After completing I0 at time d(I0), B accepts the longest interval (denoted I2) among those arriving within slot s2 and finishing after d(I1), in a way similar to the action of A in the previous slot. Again, if such an I2 does not exist, the phase ends at the end of s2. Otherwise, slot s3 is defined as [d(I1), d(I2)) and B will complete I2 that ends after d(I1). Similarly, after A finishes I1 in time d(I1), it starts the longest interval (denoted by I3) arriving during s3 and finishing after d(I2), and so on. In general, slot si (for i > 1) is defined as [d(Ii−2), d(Ii−1)). If i is odd, then B takes the entire slot to complete the interval Ii−1 without interruption while A accepts the longest interval Ii that arrives during slot si and ends after d(Ii−1). If i is even then the roles of A and B are reversed. Competitive Analysis. We first state the following useful lemma which holds for any C-benevolent function f . Lemma 3.1 For any C-benevolent function f , given any k + 1 positive real numbers pi (1 ≤ i ≤ k) and P , if P ≥ Pk Proof. f (P ) ≥ f (Pk i=1 pi, then f (P ) ≥ Pk i=1 pi) ≥ f (p1) + f (Pk i=1 f (pi). ✷ i=1 f (pi). i=2 pi) ≥ P2 i=1 f (pi) + f (Pk i=3 pi) ≥ . . . ≥ Pk Theorem 3.3 RAN -C is 2-competitive for online interval scheduling on C-benevolent instances. Proof. As a first step to the proof we simplify the OP T schedule. Within each slot si in a phase, i ≥ 1, OP T starts a sequence of disjoint intervals (in increasing order of starting times) Oi = {oi,1, oi,2, . . . , oi,ki}. Only the last interval, oi,ki, may end later than d(Ii−1) (the ending time of si). If it does, then we merge oi,1, oi,2, . . . , oi,ki−1 into one interval prei such that r(prei) = r(oi,1) and d(prei) = r(oi,ki), and thus p(prei) = r(oi,ki) − r(oi,1) ≥ Pki−1 j=1 p(oi,j). By Lemma 3.1, f (p(prei)) ≥ Pki−1 j=1 f (p(oi,j)). Otherwise, (i.e. oi,ki ends before d(Ii−1)), we merge all the intervals in Oi into one interval prei such that r(prei) = r(oi,1) and p(prei) = d(oi,ki)−r(oi,1) ≥ Pki j=1 p(oi,j). Thus, in both cases, such merging can only make OP T 's value larger. So we can assume that OP T starts at most two intervals prei and oi,ki in slot si. After understanding the notations, we simply denote the two intervals prei and oi,ki by oi,1 and oi,2, respectively. The interval oi,1 (if exist) is contained in Ii−1 and so p(oi,1) ≤ p(Ii−1). The interval oi,2 (if exist) will end after d(Ii−1), and p(oi,2) ≤ p(Ii) since Ii is defined to be the longest interval that arrives during slot si and ends after d(Ii−1). Note that oi,2 may also end after d(Ii+l) for some l ≥ 0. In this case, neither ov,1 nor ov,2 exist for i ≤ v ≤ i + l. If any oi,1 or oi,2 does not exist, we set its length to zero. 7 We now analyze the competitive ratio of RAN -C. As in the monotone case, each phase can be analyzed separately. Consider an arbitrary schedule S = {I0, I1, . . . , In−1} produced by RAN -C in a phase with n ≥ 1 slots, where Ii overlaps Ii+1 (0 ≤ i < n − 1), and the corresponding schedule S∗ = {o1,1, o1,2, o2,1, . . . , on,1} produced by OP T as RAN -C produces S. (Note that on,2 cannot exist since otherwise this means there are some intervals that arrive within [d(In−2), d(In−1)) and end after d(In−1), and hence the phase will not end and RAN -C will start an In.) For each slot i, OP T starts two intervals oi,1 and oi,2 while RAN -C accepts Ii−1. For presenta- tion convenience, let xi,1 = p(oi,1), xi,2 = p(oi,2) and yi = p(Ii). We already have that xi,1 ≤ yi−1 for 1 ≤ i ≤ n and xi,2 ≤ yi for 1 ≤ i < n. We will show that n X i=1 f (xi,1) + n−1 X i=1 f (xi,2) ≤ n−1 X i=0 f (yi). (1) The left hand side of (1) represents the total weight of intervals in S∗ (note that on,2 does not exist) while the right hand side represents the total weight of intervals in S. Since RAN -C completes each interval in S with probability 1/2, its expected value is half of the right hand side of (1). Thus by proving (1) we show the 2-competitiveness of RAN -C. i=1 f (xi,1) + Pk−2 i=1 f (xi,2) ≤ Pk−2 i=1 f (xi,2) ≤ Pk−1 i=0 f (yi) and thus the claim holds for n = k. We prove (1) by induction on n. When n = 1, (1) reduces to f (x1,1) ≤ f (y0) which is true since x1,1 ≤ y0. Assume the claim holds for n = k − 1, i.e., Pk−1 i=1 f (yi). Consider Ik, ok−1,2 and ok,1. We have xk−1,2 ≤ yk−1 and xk,1 ≤ yk−1. If xk−1,2 + xk,1 ≤ yk−1, then f (xk−1,2) + f (xk,1) ≤ f (xk−1,2 + xk,1) ≤ f (yk−1). Adding this to the induction hypothesis gives Pk i=1 f (xi,1) + Pk−1 Otherwise, if xk−1,2 + xk,1 > yk−1, we first change the schedule S∗ as follows: we increase the length of xk,1 to yk−1 and decrease the length of xk−1,2 by the same amount. The corresponding r(ok−1,2) and d(ok,1) are fixed while both d(ok−1,2) and r(ok,1) decrease by an amount of yk−1 −xk,1. OP T will only get better since f (xk,1) + f (xk−1,2) ≤ f (yk−1) + f (xk−1,2 − (yk−1 − xk,1)) by the properties of C-benevolent functions. After this change, Ik−1 and ok,1 have the same length. The new ok−1,2 now ends on or before d(Ik−2). We merge the new ok−1,2 into ok−1,1 so that the new ok−1,1 extends its length to xk−1,2 + xk−1,1 and keeps its start time r(ok−1,1) unchanged. In the case that xk−1,1 = 0 before merging ok−1,2, we set r(ok−1,1) = r(ok−1,2). The new ok−1,1 is still contained by Ik−2 and thus xk−1,1 ≤ yk−2 still holds. After merging, xk−1,2 = 0 and xk,1 = yk−1. Therefore Pk i=0 f (yi) + f (yk−1) = Pk−1 ✷ i=1 f (xi,2) + f (xk,1) ≤ Pk−2 i=1 f (xi,1) + Pk−1 i=0 f (yi). Thus the claim is true for n = k. i=1 f (xi,2) = Pk−1 i=1 f (xi,1) + Pk−2 3.4 D-benevolent Instances Algorithm RAN -D. The basic idea of RAN -D is same as RAN : two algorithms A or B are executed each with probability 1/2. Intuitively, in an odd slot (where slots will be defined precisely in the following paragraphs), A accepts the largest-weight interval arriving during that slot, by starting an interval and preempting if a new one arrives with a larger weight. We call the interval being executed by A the main interval, denoted by IM . Meanwhile, B continues to run to com- pletion the interval started in the previous slot; we call this the residual interval, denoted by IR. This residual interval must be completed (as in the equal length case) because this is the interval accepted in the previous slot. However in the D-benevolent case, if a shorter (and therefore larger weight) interval arrives, the residual interval can actually be preempted and replaced by this new 8 interval. For even slots the roles of A and B are reversed (and the interval started by B is the main interval and the one completed by A the residual interval). Unlike RAN -M or RAN -C, here when slot si−1 finishes, the next slot si is not completely determined: slot si begins where si−1 ends, but the ending time of slot si will only get a provisional value, which may become smaller (but not larger) later on. This is called the provisional ending time of the slot, denoted by ei. Slots will also be grouped into phases as in the other types of instances. Note that IM , IR and ei change during the execution of the algorithm, even within the same slot. But RAN -D always maintains the following invariant: Invariant: Suppose IR and IM are the residual and main interval respectively during execution in a slot si. Then ei = d(IR) ≤ d(IM ) (if the intervals exist). Moreover ei can only be decreased, not increased. We describe the processing of intervals in a slot si (i ≥ 1). Consider an odd slot si (the case of even slots is the same with the roles of A and B reversed). At the beginning of si, A is idle and B is continuing the execution of a residual interval IR. At this point ei is provisionally set to d(IR). In the case of the first slot, there is no residual interval left over from the previous slot, so we set ei to be the deadline of the first interval that arrives. If more than one interval arrive at the same instant, choose anyone. Consider a time during si when an interval I arrives while A and B are respectively executing some intervals IM and IR. If more than one interval arrive at the same instant, process them in any order. If A or B is idle, assume IM or IR to have weight 0. Then A and B react according to the following three cases: 1. If d(I) ≥ ei and w(I) > w(IM ), then I preempts IM , and this I becomes the new IM . In this case, ei remains unchanged. 2. If d(I) < ei (which implies w(I) ≥ w(IM ) and w(I) ≥ w(IR) because by the invariant, d(IM ) ≥ d(IR) = ei > d(I), and I arrives no earlier than either IM or IR, and thus I is shorter), then I preempts both IM in A and IR in B. Here I becomes the new IM and IR, and ei is then set to d(I). 3. Otherwise, w(I) ≤ w(IM ) and I is discarded. Observe that the invariant is always maintained when we change any of IM , IR or ei. This process repeats until time ei is reached and slot si ends. If d(IM ) > ei at the end of slot si, then a new slot si+1 begins where slot si ends. A has not finished execution of IM yet, so it now becomes the IR of slot si+1, and ei+1 is provisionally set to d(IR). Otherwise, d(IM ) = ei and A just finishes execution of IM , then the phase ends. In this case we wait until the next interval arrival, then a new phase starts. Note that RAN -D needs to simulate the execution of both A and B (to determine when slots end) but the actual execution follows only one of them. Theorem 3.4 RAN -D is 2-competitive for online interval scheduling on D-benevolent instances. 9 Proof. Consider each slot si = [ei−1, ei). We claim that OP T can start at most one interval in si and that this interval cannot finish strictly before ei. The first part of the claim follows from the second since if OP T starts two or more intervals within si, then the first such interval must end strictly before ei. Assume to the contrary that OP T starts an interval I that finishes strictly before ei. Then I also finishes strictly before the provisional value of ei at the moment I arrives, since the provisional ending time only decreases. By the design of the algorithm, at that point ei will be reduced to d(I). ei may be reduced further subsequently, but in any case this contradicts the fact that d(I) < ei. Hence the claim follows. Now suppose OP T starts an interval I in an odd slot si and eventually completes it. We will show that if si is not the last slot in the phase, A will complete an interval of weight no less than w(I) in slot si+1; if si is the last slot, then A will complete an interval of weight no less than w(I) in slot si. Consider the moment when I arrives in si. If I has larger weight than the current IM , A will preempt it and start I. Thus, by the end of si, A should have started a main interval IM of weight at least w(I). If this is the last slot, then A completes IM at the end of si. Otherwise, IM becomes the residual interval in slot si+1 and A will execute it to completion (as an residual interval) in si+1 unless another interval I ′ arrives in si+1 such that d(I ′) < ei+1 (and hence w(I ′) ≥ w(IM )). Note that ei+1 will then be reduced to d(I ′). This I ′ may still be preempted by intervals of even larger weight and earlier deadline. In any case, at exactly the end of the next slot si+1, A would have completed the residual interval. We can make a similar claim for even slots. Therefore it follows that, for every interval started by OP T , either A or B will complete an interval of at least the same weight in the same or the next slot. Thus the total value of A and B is no less than that of OP T . The 2-competitiveness then follows since each of A/B is executed with 1/2 probability. ✷ 4 Algorithms for Equal Length Jobs Algorithm RAN -J. In this section we extend RAN to the online scheduling of equal length jobs with restarts. The algorithm remains very simple but the analysis is more involved. Again RAN -J chooses between two deterministic algorithms A and B, each with probability 1/2, and again A takes care of odd slots and B takes care of even slots, where the slots are defined as in the equal length interval case (i.e. they all have unit length). At the beginning of each odd slot, A considers all pending jobs that can still be completed, and starts the one with the largest weight. (If there are multiple jobs with the same maximum weight, start an arbitrary one.) If another job of a larger weight arrives within the slot, A aborts the current job and starts the new one instead. At the end of this odd slot, the job that is being executed will run to completion (into the following even slot) without abortion. A will then stay idle until the beginning of the next odd slot. Even slots are handled by B similarly. The following simple example (see Figure 1(a)) illustrates the algorithm, and shows that RAN - J is not better than 3-competitive. Consider three jobs X, Y, Z, where r(X) = 0, d(X) = 3, w(X) = 1 + ǫ for arbitrary small ǫ > 0; r(Y ) = 0, d(Y ) = 1, w(Y ) = 1; and r(Z) = 1, d(Z) = 2, w(Z) = 1. Both A and B will complete X only, but OP T can complete all three. Notations. We define some additional notations that will be used in the rest of this section to make our discussion clearer. The notation [s1..s2] denotes a range of slots from slot s1 to s2 10 X Z X Y X Y X (a) OPT A B I I X Z Z OPT A B Z J J Y (b) K K Y Y X X Y Figure 1: (a) An example showing RAN -J is not better than 3-competitive. (b) An example showing the charges and a bad slot. The weight of the jobs are (for small ǫ > 0): w(X) = 1 + ǫ, w(Y ) = 1 + 2ǫ, w(Z) = 1 + 3ǫ; w(I) = w(J) = w(K) = 1. Slot 4 is a bad slot. inclusive, where s1 is before s2. Arithmetic operators on slots carry the natural meaning, so s + 1 is the slot immediately after s, s − 1 is the slot immediately before s, s1 < s2 means s1 is before s2, etc. The job accepted by an algorithm A in slot s is denoted by A(s). (Any algorithm can accept at most one job in each slot since the slot has the same length as a job.) We define the inverse A−1(x) to be the slot s with A(s) = x, if it exists; otherwise it is undefined. Charging scheme. Our approach to the proof is to map (or charge) the weights of jobs accepted by OP T to slots where A or B have accepted 'sufficiently heavy' jobs; namely, that each slot s receives a charge at most 1.5 times of w(A(s)) or w(B(s)). In some cases this is not possible and we pair up slots with large charges with slots with small charges so that the overall ratio is still at most 1.5. Since each job in A or B is completed with probability 1/2 only, the expected value of the online algorithm is half the total value of A and B. This gives a competitiveness of 3. The charging scheme is defined as follows. Consider a slot s where OP T accepts the job OP T (s). Suppose s is odd (so A is choosing the heaviest job to start). If w(A(s)) ≥ w(OP T (s)), charge the weight of OP T (s) to s. We call this a downward charge. Otherwise, A must have accepted OP T (s) at some earlier slot s′. Charge half the weight of OP T (s) to this slot s′. This is called a self charge. For B, either it has accepted the job OP T (s) before s, in which case we charge the remaining half to that slot (this is also a self charge); or OP T (s) is still pending at slot s − 1, which means at slot s − 1, B accepts a job with weight at least w(OP T (s)). Charge the remaining half to the slot s − 1. This is called a backward charge. When s is an even slot the charges are similarly defined. Clearly, all job weights in OP T are charged to some slots. Observe that for each charge from OP T to a slot, the weight of the job generating the charge is no more than that of the job accepted in the slot receiving the charge. We define each downward charge to be of one unit, and each self or backward charge to be of 0.5 unit. With this definition, if every slot receives at most 1.5 units of charge, then we are done. Unfortunately, slots can receive up to 2 units of charges because a slot can receive at most one charge of each type. Slots receiving 2 units of charges are called bad; they must receive a backward charge. Slots with at most 1 unit charge are called good. Each bad slot s can be characterized by a pair (X, Y ) where X is the job A(s) or B(s), and Y is the job OP T (s + 1) generating the backward charge. The example in Figure 1(b) illustrates the charges 11 and the existence of bad slots. Competitive Analysis. The key part of the proof is to deal with bad slots. For each bad slot, we pair it up with a good slot so that the 'overall' charge is still under a ratio of 1.5. The proof of the following lemma will show how this is done. Lemma 4.1 For each bad slot s = (X, Y ), there is a good slot s′ such that the weight of A(s′) or B(s′) is at least w(Y ). Moreover, any two bad slots are paired with different good slots. If Lemma 4.1 is true, then we have Lemma 4.2 Slots s and s′ as defined in Lemma 4.1 together receive a charge at most 1.5 times the total weight of the jobs in A/B in the two slots. Proof. Let ws and ws′ be the weight of jobs accepted by A/B in s and s′ respectively. The charges to s is at most 1.5ws + 0.5w(Y ) while the charges to s′ is at most ws′. The overall ratio is therefore (1.5ws + 0.5w(Y ) + ws′)/(ws + ws′) ≤ 1.5 since w(Y ) ≤ ws′. ✷ Theorem 4.1 RAN -J is 3-competitive for the online scheduling of equal length jobs with restarts. Proof. All the weights of jobs accepted by OP T are charged to slots in A or B. Each slot in A and B receives charges at most 1.5 times the weight of the job in the slot, either as a single slot or as a pair of slots as defined in Lemma 4.1. Since each job in A or B is only completed with probability 1/2, the expected value of the online algorithm is half the total weight of jobs in A and B. It follows that the competitive ratio is 3. ✷ Before proving Lemma 4.1 we first show some properties of bad slots in the following lemma. (Although the lemma is stated in terms of odd slots, the case of even slots is similar.) Lemma 4.3 For each bad slot s = (X, Y ), where s is an odd slot, (i) both X and Y are accepted by B in some slots before s (call the slots s0 and s1, where s0 < s1); and (ii) for each odd slot s in [s0 + 1..s1 − 1], w(A(s)) ≥ w(B(s0)) ≥ w(Y ), and for each odd slot s in [s1 + 1..s − 1], w(A(s)) ≥ w(B(s1)) ≥ w(Y ). Proof. (i) Since slot s + 1 makes a backward charge instead of a downward charge, we have w(B(s + 1)) < w(Y ). Hence B must have accepted Y before s, or else Y could have been a candidate for B(s + 1). Furthermore, w(X) ≥ w(Y ) > w(B(s + 1)). By the same reasoning, B must have accepted X before s. (ii) If B(s0) = Y , then Y has already arrived before the end of slot s0 but is not accepted by A at/before s. Hence A must have accepted jobs with weights at least w(Y ) in all odd slots in [s0 + 1..s1 − 1]. If B(s0) = X then the same reasoning implies that A accepted jobs with weights at least w(X), which is at least w(Y ), in these slots. The same argument holds for A[s1 + 1..s]. ✷ We now prove Lemma 4.1. We give a step-by-step procedure for identifying a good slot (in which A or B has accepted a job of sufficient weight) for every bad slot. Consider an odd bad slot 12 s = (X, Y ). (The case for even slots is similar.) Roughly speaking, the procedure initially identifies the two slots s0 and s1 defined in Lemma 4.3 and designates s1 as a special slot, denoted by s∗. Then it checks if s∗ or s∗ − 1 is a good slot. If a good slot is found, the procedure stops. Otherwise, it will identify a new slot not found before, pick a new special slot s∗ from among the identified slots; and then move to the next step (which checks on s∗, s∗ − 1 and so on). In more detail, at the beginning of step i (i ≥ 1), a collection of i + 1 slots, s0 < s1 < · · · < si, have been identified. They are all even slots before the bad slot s and one of them is designated as the special slot s∗. Denote by Yj the job B(sj) for all j ∈ {0, . . . , i} and for convenience, let si+1 denote s. Step i proceeds as follows: Step i.1. Consider the job Y ∗ = B(s∗) in slot s∗. By Lemma 4.4(i) below, Y ∗ has weight at least w(Y ). So, if the slot s∗ receives at most 1 unit of charge, then we have identified a good slot of sufficient weight and we stop. Step i.2. Otherwise, s∗ has at least 1.5 unit of charge and must therefore have a downward charge. Denote by Z the job A(s∗ − 1). By Lemma 4.4(ii) below, w(Z) ≥ w(Y ). Since slot s∗ must have a downward charge, slot s∗ − 1 cannot receive a backward charge. If slot s∗ − 1 receives no self charge as well, then it is a good slot and we are done. Step i.3. Otherwise s∗−1 receives a self charge and hence Z is accepted by OP T in some slot s′ after s∗. In Lemma 4.5, we will show that B must also accept Z at a slot s′′ where s′′ < min{s, s′}. Note that Z is not in {Y0, Y1, . . . , Yi}. (A job in {Y0, Y1, . . . , Yi} is either the job Y , which is not accepted by A before slot s, or a job accepted by A in a slot other than s∗ − 1.) Therefore, s′′ is a different slot than s0, s1, . . . , si. Mark slot s0 or s′′, whichever is later, as the new special slot s∗. Re-index s0, . . . , si and s′′ as s0 < s1 < · · · < si+1 and move on to Step (i + 1). We need to show that (i) the procedure always terminates, (ii) the claims made in the above procedure are correct, and (iii) any two bad slots are paired with different good slots following this procedure. The first is easy: note that in each step, if a good slot is not found, a new slot, s′′, which is before s, is identified instead. But there are only a finite number of slots before s. Therefore, the procedure must eventually terminate and return a good slot. The claim in Step i.1 and i.2 is proved in the lemma below, which is basically a generalization of Lemma 4.3. Lemma 4.4 For any step i (i ≥ 1) and any j ∈ {0, . . . , i}, (i) w(Yj) ≥ w(Y ) and (ii) for all odd slots s in [sj + 1 . . . sj+1 − 1], w(A(s)) ≥ w(Yj). Proof. The proof is by induction on i. Clearly, (i) and (ii) are true for i = 1 as proved by Lemma 4.3. Suppose (i) and (ii) are true at the beginning of some step i. We will show that they are maintained at the beginning of step i + 1. Recall that Z is accepted by A in slot s∗ − 1 and by B in slot s′′. By (ii), w(Z) ≥ w(Y ). Thus, w(B(s′′)) ≥ w(Y ) and hence (i) is maintained in the next step. To show that (ii) is also maintained in the next step, it suffices to show that for any odd slot s in [s′′ + 1 . . . sq − 1] where sq is the closest slot among s0, s1, . . . , si after s′′ (or sq = s if s′′ lies after si), w(A(s)) ≥ w(Z). We consider two cases: 13 If s′′ < s∗ − 1, then Z is available before the end of slot s′′ and yet is not accepted by A until s∗ − 1. See Figure 2(a). Therefore, w(A(s)) ≥ w(Z) for every s ∈ [s′′ + 1..s∗ − 1]. A B A B Z Y* s*−1 s* (a) Z s'' Z Y* s*−1 s* Yp sp (b) Z s'' Yq sq Figure 2: Positions of Yi+1 and Yp in A and B. If s′′ > s∗ − 1, then let sp be the closest slot among s0, s1, . . . , si before s′′. See Figure 2(b). Such slot must exist because s∗ is one such candidate. Then w(Yp) ≥ w(Z) or else Z would have been accepted in slot sp. Therefore, w(A(s)) ≥ w(Yp) ≥ w(Z) for every odd slot s ∈ [s′′ + 1..sq − 1]. ✷ Lemma 4.5 In Step i.3, B accepts Z in a slot s′′ where s′′ < min(s, s′). Proof. First notice that w(B(s + 1)) < w(Y ) ≤ w(Yi+1). Therefore, s′′ < s or else Z would have been a candidate for slot s + 1. Now we assume that s′ < s and show that s′′ < s′. We distinguish two cases. Case i. s′ is an odd slot. Let U = A(s′). Let sp be the slot in s0, . . . , si that is closest to and before s′ (which must exist because s∗ itself is a candidate). Note that s∗ − 1 must be before sp since it must be before s′ and immediately before one of the sj's (in this case s∗), and sp is the latest such sj's before s′. OPT A B Z Y* s*−1 s* Yp sp Z U s' We have w(Z) > w(U ) since a self charge is made instead of a downward charge. By Lemma 4.4(ii), w(U ) ≥ w(Yp). Therefore w(Z) > w(Yp). Hence Z must be accepted before Yp in B or else it can take Yp's place in B. By definition of sp, sp < s′. Hence s′′ < s′. Case ii. s′ is an even slot. Let U = B(s′). Then w(Z) > w(U ) due to no downward charge in slot s′. Thus B must have accepted Z before s′, i.e., s′′ < s′. So in all cases B accepts Z at some slot s′′ < min(s, s′). ✷ Finally, the lemma below shows that two bad slots are paired with different good slots. 14 Lemma 4.6 All bad slots are paired with different good slots. Proof. There are two possible places in our procedure where good slots can be identified: in Step j.1 or in Step k.2 for some j and k. Call them substeps 1 and 2. Note that, for an odd bad slot, good slots identified in substep 1 are always when B is accepting jobs, and good slot identified in substep 2 are always when A is accepting jobs, and vice versa for even bad slots. Consider two distinct bad slots s = (X, Y ) and s′ = (X ′, Y ′). First, consider the case when s and s′ has different parity (odd or even slots). Then they can match with the same good slot only if one of them identifies it in substep 1 and the other in substep 2. However, a good slot in substep 1 must receive self-charge (this is how the Yj's are identified) while a good slot in substep 2 cannot receive a self charge (otherwise we would have moved on to some Step i.3 in the procedure). Thus it is impossible that a substep 1 good slot is also a substep 2 good slot. Next, consider the case when s and s′ are of the same parity. Without loss of generality assume that they are both odd slots. To facilitate our discussion, we re-index the Yj's in the order they are identified. So we let Y0, Y1, Y2, . . . be the chain of Yj's associated with s where {Y0, Y1} = {X, Y } and for j ≥ 2, Yj is the job identified in step (j − 1).3. Similarly, we let Y ′ 2 . . . be the chain associated with s′. We will show that no job appears in both chains. This proves the claim because for two bad slots of the same parity to be matched to the same good slot, they must both be identified in substep 1 or both in substep 2. But if the chains of Yi's associated with them are different, this is not possible. 1, Y ′ 0, Y ′ 0, Y ′ 0 and Y ′ To show the chains are distinct, we first show that Y0, Y1, Y ′ 1 are all distinct. Recall 1}. Clearly X 6= Y, X ′ 6= Y ′, X 6= X ′ and Y 6= Y ′. that {X, Y } = {Y0, Y1} and {X ′, Y ′} = {Y ′ Thus we only need to show that X 6= Y ′ and X ′ If this is not true, then either: (1) Y is accepted in A in a bad slot; or (2) X in OP T generates a backward charge. For (1), if A−1(Y ) < A−1(X)(= s), then OP T (s + 1)(= Y ) would not make a backward charge to s; while if A−1(Y ) > s, then A−1(Y ) cannot get a self charge and hence receives at most 1.5 units of charge. For (2), OP T −1(X) > OP T −1(Y ) due to the self charge to slot s, and by Lemma 4.3(i), X must also be accepted in B before s. Hence X cannot generate a backward charge. Thus neither (1) nor (2) can be true. 6= Y . j 6= Y ′ We have now established that Y0, Y1, Y ′ 0 and Y ′ k for any j and k. Note that, if Yj = Y ′ 1 are all different. It is also clear that Yj 6= Yk and Y ′ k, for some j > 1 and k > 1, then there must be some j′ < j and k′ < k such that Yj′ = Y ′ k′, because they are uniquely defined in such a way (in some substep 2). So the only remaining case to consider is Y0 or Y1 being the same as Y ′ j for some j > 1. Recall Y0 and Y1 are the X and Y of s. Y ′ j cannot be Y because by Lemma 4.5, both A and B accept Y ′ j cannot be X because this would mean the job B(s + 1) is Y ′ k for some k < j, so slot s + 1 should receive a downward charge but this contradicts that OP T (s + 1) makes a backward charge to s instead of a downward charge. ✷ j before OP T does but A accepts Y after OP T . Y ′ 5 Lower Bound for Equal Length Intervals In this section, we show a lower bound of 2 for barely random algorithms for scheduling equal length intervals that choose between two deterministic algorithms, possibly with unequal probability. Theorem 5.1 No barely random algorithm choosing between two deterministic algorithms for the online scheduling of equal length intervals has a competitive ratio better than 2. 15 w w ε'ε' v+ 3 v+ 2 ε' v+ v v Figure 3: SET (v, w, ǫ). On the left is the actual set of intervals; the vertical arrow on the right is the notation we use to denote such a set. Let ALG be a barely random algorithm that chooses between two deterministic algorithms A and B with probability p and q respectively such that p + q = 1 and 0 < p ≤ q < 1. Let δ be an arbitrarily small positive constant less than 1. We will show that there is an input on which OP T gains at least 2 − δ times of what ALG gains. We will be using sets of intervals similar to that in Woeginger [19]. More formally, let ǫ be an arbitrary positive real number and let v, w be any pair of real numbers such that 0 ≤ v ≤ w. We define SET (v, w, ǫ) as a set of intervals of weight v, v + ǫ′, v + 2ǫ′, . . . , w (where ǫ′ is the largest number such that ǫ′ ≤ ǫ and w − v is a multiple of ǫ′) and their relative arrival times are such that intervals of smaller weight come earlier and the last interval (i.e., the one that arrives last and has weight w) arrives before the first interval finishes. Thus, there is overlapping between any pair of intervals in the set. See Figure 3. This presents a difficulty for the online algorithm as it has to choose the right interval to process without knowledge of the future. To facilitate our discussion, we assume that all intervals have weight at least 1 throughout this section, except Section 5.3. If I is an interval in SET (v, w, ǫ) and w(I) > v (i.e., I is not the earliest interval in the set), then I − denotes the interval that arrives just before I in SET (v, w, ǫ). So, w(I −) ≥ w(I) − ǫ. 5.1 A Few Simple Cases We first present a few simple situations in which OP T can gain a lot compared with what ALG can gain. The first lemma shows that an algorithm should not start an interval that is lighter than the current interval being processed by the other algorithm. The second lemma shows that it is not good to have A processing an interval of equal or heavier weight than the interval currently being processed by B. Moreover, the two algorithms should avoid processing almost non-overlapping intervals as shown in the third lemma. Lemma 5.1 Suppose at some moment, one of the algorithms (say B) is processing an interval J from a set S = SET (v, w, ǫ) while the other algorithm (A) is processing another interval I, where w(J) > v, w(I) ≤ w(J) and r(I) > r(J). (Note that here the interval I cannot come from S.) Then OP T gains at least 2 − ǫ of ALG's gain on an input consisting of S, I and some subsequently arrived intervals. Proof. We illustrate the scenario in Figure 4. (There, the vertical line represents the set S and the horizontal line labelled J is one of the intervals in S. The horizontal line labelled I arrives later than J and has a smaller weight.) To defeat ALG, an interval J ′ with the same weight as J is released between d(J −) and d(J) and no more intervals are released. (See Figure 4.) Then OP T 16 w J v J' I Figure 4: (Lemma 5.1) Starting a lighter interval later J' w' J v' w I v Figure 5: (Lemma 5.2) A processing a heavier interval (J) completes J − (which finishes just before J ′ starts) and J ′, gaining w(J −) + w(J ′) ≥ 2w(J) − ǫ while ALG gains at most (p + q)w(J) = w(J) even if it aborts I to start J ′. Since w(J) ≥ 1, 2w(J)−ǫ ✷ w(J) ≥ 2 − ǫ. Lemma 5.2 Suppose at some moment, algorithm B is processing an interval I from a set S = SET (v, w, ǫ) while A is processing an interval J from a set S′ = SET (v′, w′, ǫ′), where w(I) > v, w(J) > v′, w(I) ≤ w(J) and r(I) ≤ r(J). (Note that S and S′ can be the same set; I and J can even be the same interval.) Then OP T gains at least 2 − max{ǫ, ǫ′} of ALG's gain on an input consisting of S, S′ and some subsequently arrived intervals. Proof. An interval J ′ with the same weight as J is released between d(I −) and d(I). See Figure 5. Clearly there is no point in algorithm A aborting J to start J ′. If algorithm B continues with I, then no more intervals arrived. OP T gains w(I −) + w(J ′) ≥ w(I) + w(J) − ǫ while ALG gains qw(I) + pw(J) ≤ (w(I) + w(J))/2. Since (w(I) + w(J))/2 ≥ 1, we have w(I)+w(J)−ǫ (w(I)+w(J))/2 ≥ 2 − ǫ. If B aborts I and starts J ′, then using Lemma 5.1, we can see that OP T gains at least 2 − ǫ′ of what ALG gains on an input consisting of S, S′ and the subsequently arrived intervals specified in Lemma 5.1. ✷ Lemma 5.3 Suppose at some moment, algorithm A is processing an interval I from a set S = SET (v, w, ǫ) while algorithm B is processing an interval J from another set S′ = SET (v′, w′, ǫ′), where w(I) > v, w(J) > v′, w(I) ≤ w(J) and the intervals of S′ arrive between d(I −) and d(I). Then OP T gains at least 2 − (ǫ + ǫ′) of ALG's gain on an input consisting of S, S′ and some subsequently arrived intervals. in the worst case. Proof. An interval J ′ with the same weight as J is released between d(J −) and d(J) and no more intervals are released. See Figure 6. OPT completes I − in S, J − in S′ and J ′. So it gains w(I −) + w(J −) + w(J ′) ≥ w(I) + 2w(J) − (ǫ + ǫ′). On the other hand, A completes I and then J ′ while B completes J. Thus ALG gains at most p(w(I) + w(J)) + qw(J) = pw(I) + w(J) ≤ (1/2)w(I) + w(J). Since w(I)/2 + w(J) ≥ 1, we have w(I)+2w(J)−(ǫ+ǫ′) ✷ ≥ 2 − (ǫ + ǫ′). w(I)/2+w(J) 17 w I v w' J v' J' Figure 6: (Lemma 5.3) A and B processing almost non-overlapping intervals 5.2 Constructing the Sequence of Intervals Our lower bound proof takes a number of steps. In each step, the adversary will release some set of intervals SET (·, ·, ·) adaptively according to how ALG reacts in the previous steps. In each step, the adversary forces ALG not to finish any interval (and hence gain no value) while OP T will gain some. Eventually, OP T will accumulate at least 2 − δ times of what ALG can gain no matter what ALG does in the last step. 5.2.1 Step 1 Let c = 2 − δ/2. The adversary releases S1 = SET (v1, w1, ǫ1) where v1 is some positive real number at least one, w1 = c(q/p)(4/δ)v1 and ǫ1 = δ/8. Denote by I1 and J1, where w(I1) ≤ w(J1), the intervals chosen by ALG. We claim that Lemma 5.4 Both algorithms A and B do not process the smallest-weight interval in S1, i.e., (i) w(I1) > v1 and (ii) w(J1) > v1. Hence both I − 1 and J − 1 exist. Proof. We first prove part (ii). By Lemma 5.2, we assume that I1 is processed by A and J1 is processed by B. So, the expected gain by ALG is pw(I1) + qw(J1) ≤ w(J1). Then we deduce that w(J1) > w1/c or else the adversary stops, OP T schedules the heaviest interval in S1 (of weight w1) so that it gains at least c > 2 − δ times the expected gain by ALG. Since v1 = (p/q)(δ/4)(w1/c) < w1/c, we have w(J1) > v1. 1) ≥ 2w(J1)−ǫ1 by executing J − 1 in S1 and then J ′ 1 )+w(J ′ To prove part (i), we assume to the contrary that w(I1) = v1. Then an interval J ′ 1 with the same weight as J1 is released between d(J − 1 ) and d(J1). See Figure 7(a). OP T can gain w(J − 1. Upon finishing I1, algorithm A can go on to finish J ′ 1))+qw(J1) = pw(I1)+w(J1). Note that v1 = (p/q)(δ/4)(w1/c) ≤ (δ/4)w(J1) and pw(I1) = pv1 < (δ/4)w(J1). Thus ALG's gain is at most pw(I1) + w(J1) ≤ (1 + δ/4)w(J1). So OP T 's gain is more than 2 − δ times that of ALG's. ✷ 1. The expected gain of ALG is at most p(w(I1)+w(J ′ Lemma 5.5 w(J1) < 2w(I1). We defer this to Section 5.3, where we prove that if w(J1) ≥ 2w(I1) then the adversary can force the competitive ratio to be at least 2 − δ. 18 w1 J1 I1 v1 J' (a) w2 v2 (b) w1 J1 I1 v1 Figure 7: Step 1. (left) Lemma 5.4, (right) Lemma 5.6 The adversary then releases a new set of intervals S2 = SET (v2, w2, ǫ2) such that all these 1 ) and d(I1), where v2 = w(I1), w2 = max{c(pw(I1) + qw(J1)) − intervals arrive between d(I − w(I1), v2} and ǫ2 = ǫ1/2. See Figure 7(b). Lemma 5.6 Upon the release of S2, both A and B must abort their current intervals in S1 and start some intervals I2 and J2 respectively in S2. Moreover, v2 < w(I2) < w(J2). Proof. is pw(I1) + qw(J1) while OP T can complete I − ≥ c(pw(I1) + qw(J1)) − ǫ1 = (2 − δ If ALG ignores S2 and continues with both I1 and J1, then the expected gain of ALG 1 ) + w2 1 and the last interval in S2, gaining w(I − Suppose algorithm B aborts J1 and starts some J2 in S2 while algorithm A continues to process I1. Then by Lemma 5.3, ALG loses. Suppose algorithm B continues with J1 but A aborts I1 to start some I2 in S2. By Lemma 5.2, it must be the case that w(I2) < w(J1). But then by Lemma 5.1, ALG loses too. 2 )(pw(I1) + qw(J1)) − δ 8 ≥ (2 − δ)(pw(I1) + qw(J1)). Based on the above discussion, the only remaining sensible response for ALG is to abort both I1 and J1 and start some I2 and J2 in S2. By Lemma 5.2, we can further assume that w(I2) < w(J2). Moreover, we claim that w(I2) > v2. Otherwise, ALG is effectively aborting only J1 but not I1. Then the construction of inputs given in Lemma 5.3 can be used to defeat ALG. ✷ This finishes our discussion on Step 1 and we now proceed to Step 2. 5.2.2 Step i 1 )+w(I − 2 )+· · · w(I − In general, at the beginning of Step i ≥ 2, we have the following situation: OP T has gained w(I − i−1) while ALG has not gained anything yet. Moreover, A and B of ALG are respectively executing Ii and Ji in Si = SET (vi, wi, ǫi) where vi = w(Ii−1), wi = max{c(pw(Ii−1) + qw(Ji−1)) − Pi−1 j=1 w(Ij), vi}, ǫi = ǫ1/2i−1 and vi < w(Ii) < w(Ji). We go through a similar analysis to that in Step 1. First, as in Lemma 5.5, we have w(Ji) < 2w(Ii) (the case w(Ji) ≥ 2w(Ii) is handled in the next subsection). Next, the adversary releases Si+1 = SET (vi+1, wi+1, ǫi+1) in the period between d(I − i ) and d(Ii) where vi+1 = w(Ii), wi+1 = max{c(pw(Ii) + qw(Ji)) −Pi j=1 w(Ij), vi+1} and ǫi+1 = ǫ1/2i. See Figure 8. Similar to Lemma 5.6, we can prove that Lemma 5.7 Upon the release of Si+1, both A and B must abort their current intervals in Si and start some intervals Ii+1 and Ji+1 respectively in Si+1. Moreover, vi+1 < w(Ii+1) < w(Ji+1). 19 w i +1 w i J i I i I i −1 v i v i +1 Figure 8: Step i ... I 1 Proof. ALG cannot continue with both Ii and Ji. Otherwise, OP T schedules (after finishing I − 1 , . . . , I − i and then the last interval of Si+1, thus gaining at least i−1) I − i X j=1 w(I − j ) + c(pw(Ii) + qw(Ji)) − i X j=1 w(Ij ) ≥ c(pw(Ii) + qw(Ji)) − i X j=1 ǫj > (2 − δ 2 )(pw(Ii) + qw(Ji)) − 2ǫ1 ≥ (2 − δ)(pw(Ii) + qw(Ji)). Suppose B aborts Ji in order to start some Ji+1 in Si+1 while A continues with Ii. Then by Lemma 5.3, ALG loses. Suppose B continues with Ji while A aborts Ii to start Ii+1. By Lemma 5.2, we have that w(Ii+1) < w(Ji). Then by Lemma 5.1, ALG loses too. Based on the above reasoning, we conclude that ALG has to abort both Ii and Ji and start some Ii+1 and Ji+1 in Si+1. By Lemma 5.2, we can assume that w(Ii+1) < w(Ji+1). We can also argue that w(Ii+1) > vi+1 in the same way as proving w(I2) > v2 in Step 1. ✷ We now proceed to Step i + 1. Note that OP T has already gained w(I − 1 ) + · · · + w(I − i ) while ALG still has not gained anything. We will make use of Lemma 4.3 of Woeginger [19]: Lemma 5.8 (Woeginger [19]). For 2 < d < 4, any strictly increasing sequence of positive numbers ha1, a2, . . .i fulfilling the inequality ai+1 ≤ dai − i X j=1 aj for every i ≥ 1 must be finite. j=1 w(Ij ) or vi+1. If c(pw(Ii) + qw(Ji)) − Pi Consider the sequence hw(I1), w(I2), . . .i. It is strictly increasing since w(Ii+1) > vi+1 = w(Ii) for all i. Moreover, recall that wi+1 is set to be the maximum of either c(pw(Ii) + qw(Ji)) − Pi j=1 w(Ij) > vi+1 for all i ≥ 1, then we have w(Ii+1) ≤ wi+1 = max{c(pw(Ii) + qw(Ji)) − Pi j=1 w(Ij ) ≤ cw(Ji) − Pi j=1 w(Ij) (since w(Ji) < 2w(Ii)) for all i. The existence of such an infinite sequence contradicts Lemma 5.8. So, eventually, there is a finite k such that c(pw(Ik) + j=1 w(Ij ), vi+1} = c(pw(Ii) + qw(Ji)) − Pi j=1 w(Ij ) < (4 − δ)w(Ii) − Pi 20 qw(Jk)) − Pk consists of a single interval of weight wk+1 (= w(Ik)). j=1 w(Ij) ≤ vk+1 and hence we set wk+1 = vk+1 and the next (and final) set Sk+1 In that situation, it makes no difference whether A or B of ALG aborts Ik or Jk to start the interval in Sk+1 since it has weight equal to w(Ik). Its expected gain is still at most pw(Ik)+qw(Jk). On the other hand, OP T schedules the interval of Sk+1 and gains in total w(I − k )+wk+1 ≥ c(pw(Ik) + qw(Jk)) − 2ǫ1 which is at least 2 − δ times of ALG's gain. 1 )+· · ·+w(I − 5.3 The Case of w(Ji) ≥ 2w(Ii) We now consider the case where in some Step i ≥ 1, w(Ji) ≥ 2w(Ii). We will show how the adversary forces ALG to lose the game, i.e., OP T will gain at least 2 − δ of what ALG can on Si and a set of subsequently arrived intervals. For simplicity, we drop the subscript i in Ii, Ji, and ǫi in the following discussion. Intuitively, when w(J) is relatively large compared with w(I), we can afford to let algo- rithm A finish the interval I and gain pw(I), which is relatively small. Therefore, a set Su = SET (0, uw(J), ǫ) is released between d(J −) and d(J), where u ≥ 1 is some parameter to be de- termined as a function of p. This allows algorithm A to finish I and then start some job in this new set Su. On the other hand, algorithm B has to decide whether to abort or continue with the current interval J. We will show that there is a choice of u such that no matter what B does, OP T can gain at least 2 − δ of what ALG gains. Case 1: Algorithm B continues with J. Then ALG gains at most p(w(I) + uw(J)) + qw(J) while OP T can gain w(J −) + uw(J). Therefore, the ratio of the gain by OP T to that of ALG on S and Su is at least w(J −) + uw(J) p(w(I) + uw(J)) + qw(J) ≥ ≥ (1 + u)w(J) − ǫ p(w(J)/2 + uw(J)) + (1 − p)w(J) 1 + u − ǫ/w(J) p(1/2 + u) + 1 − p where the first inequality makes use of the condition that w(I) ≤ w(J)/2. This ratio is at least 2 − δ provided 1 + u − ǫ w(J) ≥ (2 − δ)(1 − + pu) p 2 pδ 2 = (2 − δ − p + ) + (2p − pδ)u. After simplifying using ǫ/w(J) ≤ ǫ < δ, this condition is satisfied by having u ≥ 1 − p + pδ/2 1 − 2p + pδ . (2) Case 2: Algorithm B aborts J. Then algorithms A and B can start some intervals I ′ and J ′ in Su = SET (0, uw(J), ǫ). By Lemma 5.2, we can assume that w(I ′) ≤ w(J ′). Then another interval J ′′ with the same weight as J ′ is released between d((I ′)−) and d(I ′). 21 If ALG aborts I ′ to start J ′′, by Lemma 5.1, OP T gains at least 2 − ǫ of ALG's gain on Su and a set of subsequently arrived intervals. Also, on the set of intervals S = SET (v, w, ǫ), ALG gains pw(I) ≤ w(I)/2 while OP T gains at least w(J) − ǫ ≥ w(I) − ǫ. So ALG loses. On the other hand, if ALG does not abort I ′, then its expected gain is at most p(w(I)+w(I ′))+ qw(J ′) ≤ p(w(J)/2 + w(I ′)) + (1 − p)w(J ′). OP T will complete J − in S, (I ′)− in Su and then J ′′. (Note that if I ′ is the first interval with weight 0 in Su, then we set (I ′)− to be of weight 0 too.) The ratio of the gain by OP T to that of ALG on S, Su and J ′′ is at least (w(J) − ǫ) + (w(I ′) − ǫ) + w(J ′′) p(w(J)/2 + w(I ′)) + (1 − p)w(J ′) = w(I ′) + w(J) + w(J ′) − 2ǫ pw(I ′) + pw(J)/2 + (1 − p)w(J ′) . Since 1/p ≥ 2 > 2 − δ, it suffices to show that f = w(J) + w(J ′) − 2ǫ pw(J)/2 + (1 − p)w(J ′) is at least 2 − δ. Furthermore, 1/(p/2) ≥ 2 and 1−2ǫ/w(J ′) a function of w(J ′), is minimized when w(J ′) is maximized. That means, < 1 1−p 1−p ≤ 2. Therefore, the fraction f , as f ≥ w(J) + uw(J) − 2ǫ pw(J)/2 + (1 − p)uw(J) ≥ 1 + u − 2ǫ p/2 − pu + u . 2 − pu + u ≥ p Observe that p because ǫ ≤ δ/8. Hence to show that f ≥ 2 − δ, it suffices to show that condition is satisfied provided 2 − p + 1 ≥ 1 − p 2 > 1 2 using u ≥ 1 and p ≤ 1/2. Thus 1+u p/2−pu+u ≥ 2 − δ 2ǫ p/2−pu+u ≤ δ 2 2 . This 1 + u ≥ (2 − = (p − )( δ 2 pδ 4 p 2 − pu + u) ) + (2 − 2p + pδ 2 − δ 2 )u. or This is satisfied if i.e., By setting (1 − 2p + pδ 2 − δ 2 )u ≤ 1 − p + pδ 4 . (1 − 2p + pδ 2 )u ≤ 1 − p + pδ 4 , u ≤ 1 − p + pδ/4 1 − 2p + pδ/2 . u = 1 − p + pδ/4 1 − 2p + pδ/2 , (3) both ineq. (1) and ineq. (2) are satsified. This completes the proof for the case of w(Ji) ≥ 2w(Ii). 22 6 Conclusion In this paper, we designed 2-competitive barely random algorithms for various versions of preemp- tive scheduling of intervals. They are surprisingly simple and yet improved upon previous best results. Based on the same approach, we designed a 3-competitive algorithm for the preemptive (with restart) scheduling of equal length jobs. This is the first randomized algorithm for this prob- lem. Finally, we gave a 2 lower bound for barely random algorithms that choose between two deterministic algorithms, possibly with unequal probability. An obvious open problem is to close the gap between the upper and lower bounds for randomized preemptive scheduling of intervals in the various cases. We conjecture that the true competitive ratio is 2. Also, it is interesting to prove a randomized lower bound for the related problem of job scheduling with restart. References [1] S. Albers. On randomized online scheduling. In Proc. 34th ACM Symposium on Theory of Computing, 134 -- 143, 2002. [2] B. Awerbuch, Y. Bartal, A. Fiat, and A. Rosen. Competitive non-preemptive call control. In Proc. 5th ACM-SIAM Symposium on Discrete Algorithms, 312 -- 320, 1994. [3] S. Baruah, G. Koren, D. Mao, B. Mishra, A. Raghunathan, L. Rosier, D. Shasha, and F. Wang. On the competitiveness of on-line real-time task scheduling. Real-Time Systems, 4:125 -- 144, 1992. [4] K. P. Bogart and D. B. West. A short proof that 'Proper = Unit'. Discrete Mathematics, 201:21 -- 23, 1999. [5] A. Borodin and R. El-Yaniv. Online Computation and Competitive Analysis. Cambridge University Press, New York, 1998. [6] R. Canetti and S. Irani. Bounding the power of preemption in randomized scheduling. SIAM Journal on Computing, 27(4):993 -- 1015, 1998. [7] F. Y. L. Chin, M. Chrobak, S. P. Y. Fung, W. Jawor, J. Sgall and T. Tich´y. Online competitive algorithms for maximizing weighted throughput of unit jobs. Journal of Discrete Algorithms, 4(2):255 -- 276, 2006. [8] F. Y. L. Chin and S. P. Y. Fung. Online scheduling with partial job values: does timesharing or randomization help? Algorithmica, 37(3):149 -- 164, 2003. [9] M. Chrobak, W. Jawor, J. Sgall and T. Tich´y. Online scheduling of equal-length jobs: ran- domization and restarts help. SIAM Journal on Computing 36(6):1709 -- 1728, 2007. [10] M. Englert and M. Westermann. Considering suppressed packets improves buffer management in QoS switches. In Proc. 18th ACM-SIAM Symposium on Discrete Algorithms, 209 -- 218, 2007. [11] L. Epstein and A. Levin. Improved randomized results for the interval selection problem. Theoretical Computer Science, 411(34-36):3129 -- 3135, 2010. 23 [12] S. P. Y. Fung, C. K. Poon and F. Zheng, Online interval scheduling: randomized and multi- processor cases. In Proc. 13th International Computing and Combinatorics Conference, LNCS 4598, 176 -- 186, 2007. [13] J.-H. Kim and K.-Y. Chwa. Scheduling broadcasts with deadlines. Theoretical Computer Science, 325(3):479 -- 488, 2004. [14] G. Koren and D. Shasha. Dover: An optimal on-line scheduling algorithm for overloaded uniprocessor real-time systems. SIAM Journal on Computing, 24:318 -- 339, 1995. [15] F. Li, J. Sethuraman and C. Stein. An optimal online algorithm for packet scheduling with agreeable deadlines. In Proceedings of 16th ACM-SIAM Symposium on Discrete Algorithms, pages 801 -- 802, 2005. [16] H. Miyazawa and T. Erlebach. An improved randomized on-line algorithm for a weighted interval selection problem. Journal of Scheduling, 7(4):293 -- 311, 2004. [17] S. S. Seiden. Randomized online interval scheduling. Operations Research Letters, 22(4 -- 5):171 -- 177, 1998. [18] H.-F. Ting. A near optimal scheduler for on-demand data broadcasts. In Proc. 6th Italian Conference on Algorithms and Complexity, LNCS 3998, 163 -- 174, 2006. [19] G. J. Woeginger. On-line scheduling of jobs with fixed start and end times. Theoretical Computer Science, 130(1):5 -- 16, 1994. [20] F. Zheng, S. P. Y. Fung, W.-T. Chan, F. Y. L. Chin, C. K. Poon, and P. W. H. Wong. Improved on-line broadcast scheduling with deadlines. In Proc. 12th International Computing and Combinatorics Conference, LNCS 4112, 320 -- 329, 2006. 24
1811.00950
1
1811
2018-11-02T15:59:32
Near-Linear Time Algorithm for n-fold ILPs via Color Coding
[ "cs.DS" ]
We study an important case of ILPs $\max\{c^Tx \ \vert\ \mathcal Ax = b, l \leq x \leq u,\, x \in \mathbb{Z}^{n t} \} $ with $n\cdot t$ variables and lower and upper bounds $\ell, u\in\mathbb Z^{nt}$. In $n$-fold ILPs non-zero entries only appear in the first $r$ rows of the matrix $\mathcal A$ and in small blocks of size $s\times t$ along the diagonal underneath. Despite this restriction many optimization problems can be expressed in this form. It is known that $n$-fold ILPs can be solved in FPT time regarding the parameters $s, r,$ and $\Delta$, where $\Delta$ is the greatest absolute value of an entry in $\mathcal A$. The state-of-the-art technique is a local search algorithm that subsequently moves in an improving direction. Both, the number of iterations and the search for such an improving direction take time $\Omega(n)$, leading to a quadratic running time in $n$. We introduce a technique based on Color Coding, which allows us to compute these improving directions in logarithmic time after a single initialization step. This leads to the first algorithm for $n$-fold ILPs with a running time that is near-linear in the number $nt$ of variables, namely $(rs\Delta)^{O(r^2s + s^2)} L^2 \cdot nt \log^{O(1)}(nt)$, where $L$ is the encoding length of the largest integer in the input. In contrast to the algorithms in recent literature, we do not need to solve the LP relaxation in order to handle unbounded variables. Instead, we give a structural lemma to introduce appropriate bounds. If, on the other hand, we are given such an LP solution, the running time can be decreased by a factor of $L$.
cs.DS
cs
Near-Linear Time Algorithm for n-fold ILPs via Color Coding∗ Klaus Jansen Department of Computer Science, Kiel University, Kiel, Germany [email protected] Alexandra Lassota Department of Computer Science, Kiel University, Kiel, Germany [email protected] Lars Rohwedder Department of Computer Science, Kiel University, Kiel, Germany [email protected] Abstract We study an important case of ILPs max{cT x Ax = b, l ≤ x ≤ u, x ∈ Znt} with n · t variables and lower and upper bounds ℓ, u ∈ Znt. In n-fold ILPs non-zero entries only appear in the first r rows of the matrix A and in small blocks of size s × t along the diagonal underneath. Despite this restriction many optimization problems can be expressed in this form. It is known that n-fold ILPs can be solved in FPT time regarding the parameters s, r, and ∆, where ∆ is the greatest absolute value of an entry in A. The state-of-the-art technique is a local search algorithm that subsequently moves in an improving direction. Both, the number of iterations and the search for such an improving direction take time Ω(n), leading to a quadratic running time in n. We introduce a technique based on Color Coding, which allows us to compute these improving directions in logarithmic time after a single initialization step. This leads to the first algorithm for n-fold ILPs with a running time that is near-linear in the number nt of variables, namely (rs∆)O(r2s+s2)L2 · nt logO(1)(nt), where L is the encoding length of the largest integer in the input. In contrast to the algorithms in recent literature, we do not need to solve the LP relaxation in order to handle unbounded variables. Instead, we give a structural lemma to introduce appropriate bounds. If, on the other hand, we are given such an LP solution, the running time can be decreased by a factor of L. 2012 ACM Subject Classification Mathematics of computing → Integer programming Keywords and phrases Near-Linear Time Algorithm, n-fold, Color Coding 1 Introduction Solving integer linear programs of the form max {cT x Ax = b, x ∈ Z≥0} is one of the most fundamental tasks in optimization. This problem is very general and broadly applicable, but unfortunately also very hard. In this paper we consider n-fold ILPs, a class of integer linear programs with a specific block structure. This is, when non-zero entries appear only in the first r rows of A and in blocks of size s × t along the diagonal underneath. More ∗ This work was partially supported by DFG Project "Strukturaussagen und deren Anwendung in Scheduling- und Packungsprobleme", JA 612/20-1 XX:2 Near-Linear Time Algorithm for n-fold ILPs via Color Coding precisely, an n-fold matrix has the form A =   A1 A2 B1 0 0 B2 ... ... 0 0 . . . An 0 . . . 0 . . . ... . . . . . . Bn   , where A1, . . . , An are r × t matrices and B1, . . . , Bn are s × t matrices. In n-fold ILPs we also allow upper and lower bounds on the variables. Throughout the paper we subdivide a solution x into bricks of length t and denote by x(i) the i-th one. The corresponding columns in A will be called blocks. Lately, n-fold ILPs received great attention [2, 7, 12, 14, 16] and were studied intensively due to two reasons. Firstly, many optimization problems are expressible as n-fold ILPs [5, 10, 12, 14]. Secondly, n-fold ILPs indeed can be solved much more efficiently than arbitrary ILPs [7, 10, 16]. The previously best algorithm has a running time of (rs∆)O(r2s+rs2)L · (nt)2 log2(n·t)+ LP and is due to Eisenbrand et al. [7]. Here LP is the running time required for solving the corresponding LP relaxation. This augmentation algorithm is the last one in a line of research, where local improvement/augmenting steps are used to converge to an optimal solution. Clever insights about the structure of the improving directions allow them to be computed fast. Nevertheless, the dependence on n in the algorithm above is still high. Indeed, in practice a quadratic running time is simply not suitable for large data sets [3, 6, 13]. For example when analyzing big data, large real world graphs as in telecommunication networks or DNA strings in biology, the duration of the computation would go far beyond the scope of an acceptable running time [3, 6, 13]. For this reason even problems which have an algorithm of quadratic running time are still studied from the viewpoint of approximation algorithms with the objective to obtain results in subquadratic time, even for the cost of a worse quality [3, 6, 13]. Hence, it is an intriguing question, whether the quadratic dependency on the number nt of variables can be eliminated. In this paper, we answer this question affirmatively. The technical novelty comes from a surprising area: We use a combinatorial structure called splitter, which has been used to derandomize Color Coding algorithms. It allows us to build a powerful data structure that is maintained during the local search and from which we can derive an improving direction in logarithmic time. Handling unbounded variables in an n-fold is a non-trivial issue in the previous algorithms from literature. They had to solve the corresponding LP relaxation and use proximity results. Unfortunately, it is not known whether linear programming can be solved in near-linear time in the number of variables. Hence, it is an obstacle for obtaining a near-linear running time. We manage to circumvent the necessity of solving the LP by introducing artificial bounds as a function of the finite upper bounds and the right-hand side of the n-fold. Summary of Results We present an algorithm, which solves n-fold ILPs in time (rs∆)O(r2s+s2)L · nt log4(nt) + LP, where LP is the time to solve the LP relaxation of the n-fold. This is the first algorithm with a near-linear dependence on the number of variables. The crucial step is to speed up the computation of the improving directions. We circumvent the need for solving the LP relaxation. This leads to a purely combina- torial algorithm with running time (rs∆)O(r2s+s2)L2 · nt log6(nt). K. Jansen, A. Lassota, L. Rohwedder XX:3 In the running times above the dependence on the parameters, i.e., (rs∆)O(r2s+s2), im- proves on the function (rs∆)O(r2s+rs2) in the previous best algorithms. Outline of New Techniques We will briefly elaborate the main technical novelty in this paper. Let x be some feasible, It is clear that when y∗ is an optimal solution for non-optimal solution for the n-fold. max{cT y Ay = 0, ℓ − x ≤ y ≤ u − x, y ∈ Znt}, then x + y∗ is optimal for the initial n-fold. In other words, y∗ is a particularly good improving step. A sensible approximation of y∗ is to consider directions y of small size and multiplying them by some step length, i.e., find some λ · y with kyk1 ≤ k for a value k depending only on ∆, r, and s. This implies that at most k of the n blocks are used for y. If we randomly color the blocks into k2 colors, then with high probability at most one block of every color is used. This reduces the problem to choosing a solution of a single brick for every color and to aggregate them. We add data structures for every color to implement this efficiently. There is of course a chance that the colors do not split y perfectly. We handle this by using a deterministic structure of multiple colorings (instead of one) such that it is guaranteed that at least one of them has the desired property. Related Work The first XP-time algorithm for solving n-fold integer programs is due to De Loera et al. [5] with a running time of ng(A)L. Here g(A) denotes a so-called Graver complexity of the constraint matrix A and L is the encoding length of the largest number in the input. This algorithm already uses the idea of iterative converging to the optimal solution by finding improving directions. Nevertheless, the Graver complexity appears to be huge even for small n-fold integer linear programs and thus this algorithm was of no practical use [10]. The exponent of this algorithm was then greatly improved by Hemmecke et al. in [10] to a constant factor yielding the first cubic time algorithm for solving n-fold ILPs. More precisely, the running time of their algorithm is ∆O(t(rs+st))L · (nt)3, i.e., FPT-time parameterized over ∆, r, s, and t. Lately, two more breakthroughs were obtained. One of the results is due to Koutecký et al. [16], who gave a strongly polynomial algorithm with running time ∆O(r2s+rs2)(nt)6 · log(nt) + LP . Here LP is the running time for solving the corresponding LP relaxation, which is possible in strongly polynomial time, since the entries of the matrix are bounded. Simultaneously, Eisenbrand et al. reduced in [7] the running time from a cubic factor to a quadratic one by introducing new proximity and sensitivity results. This leads to an algorithm with running time (∆rs)O(r2s+rs2)L · (nt)2 log2(nt) + LP . Note that both results require only polynomial dependency on t. As for applications, n-fold ILPs are broadly used to model various problems. We refer to the works [5, 10, 11, 12, 15, 18] and the references therein for an overview. Structure of the Document In Section 2 we introduce the necessary preliminaries. Section 3 gives the algorithm for efficiently computing the augmenting steps. This is then integrated into an algorithm for n-fold ILPs in Section 4. At first we require finite variable bounds and then discuss how to eliminate this requirement using the solution of the LP relaxation. Finally, in Section 5 we discuss how to handle infinite variable bounds without the LP relaxation and give new structural results. XX:4 Near-Linear Time Algorithm for n-fold ILPs via Color Coding 2 Preliminaries In the following we introduce n-folds formally and state the main results regarding them. Further we familiarize splitters, a technique known from Color Coding. ◮ Definition 1. Let n, r, s, t ∈ N. Furthermore let A1, . . . , An be r × t integer matrices and B1, . . . , Bn be s × t integer matrices. Then an n-fold A is of following form: A =   A1 A2 B1 0 0 B2 ... ... 0 0 . . . An 0 . . . . . . 0 ... . . . . . . Bn   . The matrix A is of dimension (r +n·s)×n·t. We will divide A into blocks of size (r +n·s)×t. Similarly, the variables of a solution x are partitioned into bricks of length t. This means each brick x(i) corresponds to the columns of one submatrix Ai and therefore also Bi. Given c, ℓ, u ∈ Zn·t and b ∈ Zr+n·s, the corresponding n-fold Integer Linear Programming problem is defined by: max {cT x Ax = b, ℓ ≤ x ≤ u, x ∈ Zn·t}. The main idea for the state-of-the-art algorithms relies on some insight about the Graver basis of n-folds, which are special elements of the kern of A. More formally, we introduce the following definitions: ◮ Definition 2. The kern of a matrix A is defined as the set of integral vectors x with Ax = 0. We write kern(A) for them. ◮ Definition 3. A Graver basis element g is a minimal element of kern(A). An element is minimal, if it is not the sum of two sign-compatible elements u, v ∈ kern(A). Here, sign-compatible means that ui < 0 if and only if vi < 0 for every i. ◮ Theorem 4 ([4]). Let A ∈ Zn×m and let x ∈ kern(A). Then there exist 2n − 1 Graver basis elements g1, . . . , g2n−1, which are sign-compatible with x such that x = X2n−1 i=1 λigi for some λ1, . . . , λ2n−1 ∈ Z≥0. Many results for n-fold ILPs rely on the fact that the ℓ1-norm of Graver basis elements for n-fold matrices are small. The best bound known for the ℓ1-norm is due to [7]. ◮ Theorem 5 ([7]). The ℓ1-norm of the Graver basis elements of an n-fold matrix A is bounded by O(rs∆)rs. Next, we will introduce a technique called splitters (see e.g. [17]), which has its origins in the FPT community and was used to derandomize the Color Coding technique [1]. So far it has not been used with n-fold ILPs. We refer the reader to the outline of techniques in the introduction for the idea on how we apply the splitters. ◮ Definition 6. An (n, k, ℓ) splitter is a family of hash functions F from {1, . . . , n} to {1, . . . , ℓ} such that for every S ⊆ {1, . . . , n} with S = k, there exists a function f ∈ F that splits S evenly, that is, for every j, j′ ≤ ℓ we have f −1(j) ∩ S and f −1(j′) ∩ S differ by at most 1. K. Jansen, A. Lassota, L. Rohwedder XX:5 If ℓ ≥ k, the above means that there is some hash function that has no collisions when restricted to S. Interestingly, there exist splitters of very small size. ◮ Theorem 7 ([1]). There exists an (n, k, k2) splitter of size kO(1) log(n) which is computable in time kO(1) · n log(n). We note that an alternative approach to the result above is to use FKS hashing. Although it has an extra factor of log(n), it is particularly easy to implement. ◮ Theorem 8 (Corollary 2 and Lemma 2 in [9]). Define for every prim q < k2 log(n) and prim p < q the hash function x 7→ 1 + (p · (x mod q) mod k2). This is an (n, k, k2) splitter of size O(k4 log2(n)). 3 Efficient Computation of Improving Directions The backbone of our algorithm is the efficient computation of augmenting steps. The impor- tant aspect is the fact that we can update the augmenting steps very efficiently if the input changes only slightly. In other words, whenever we change the current solution by applying an augmenting step, we do not have to recompute the next augmenting step from scratch. The augmenting steps depend on a partition of the bricks. In the following we define the notion of a best step based on a fixed partition. Later, we will independently find steps for a number of partitions and take the best among them. ◮ Definition 9. Let P be a partition of the n bricks into k2 disjoint sets P1, P2, . . . , Pk2 . Let u ∈ Znt ≤0 be some upper and lower bounds on the variables (not necessarily the same as in the n-fold). A (P, k)-best step is an optimal solution of ≥0 and ℓ ∈ Znt max cT x Ax = 0 xi ≤ k Xi∈Bj xi = 0 ℓ ≤ x ≤ u x ∈ Znt Bj ∈ Pj ∀j ∈ {1, . . . , k2} ∀j ∈ {1, . . . , k2}, Bj ′ ∈ Pj \ {Bj}, i ∈ Bj ′ ∀j ∈ {1, . . . , k2} This means a (P, k)-best step is an element of kern(A), which uses only one brick of every Pj ∈ P . Within that brick the norm of the solution must be at most k. ◮ Theorem 10. Consider the problem of finding a (P, k)-best step in an n-fold where the lower and upper bounds u, ℓ can change. This problem can be solved initially in time kO(r) · ∆O(r2+s2) · nt and then in kO(r) · ∆O(r2+s2) · log(nt) update time whenever the bounds of a single variable change. Proof. Let P be a partition of the bricks from matrix A into k2 disjoint sets P1, P2, . . . , Pk2 . Solving the (P, k)-best step problem requires that from each set Pj ∈ P we choose at most one brick and set this brick's variables. All variables in other bricks of Pj must be 0. Let x be a (P, k)-best step and let x(j) have the values of x in variables of Pj and 0 in all other variables. Then by definition, kx(j)k1 ≤ k. This implies that the right-hand side XX:6 Near-Linear Time Algorithm for n-fold ILPs via Color Coding regarding x(j), that is to say, Ax(j), is also small. Since the absolute value of an entry in A is at most ∆, we have that kAx(j)k∞ ≤ k∆. Let ai be the i-th row of A. If i > r, then aix(j) = 0. This is because Ax = 0 and ai has all its support either completely inside Pj or completely outside Pj. Meaning, the value of Ax(j) is one of the (2k∆ + 1)r many values we get by enumerating all possibilities for the first r rows. Furthermore, since P has only k2 sets, the partial sum A(x(1) + · · · + x(j)) is always one of (2k3∆ + 1)r = (k∆)O(r) many candidates. Hence to find a (P, k)-best step we can restrict our search to solutions whose partial sums stay in this range. To do so, we set up a graph containing k2 + 2 layers L0, L1, . . . Lk2 , Lk2+1. An example is given in figure 1. The first layer L0 will consist of just one node marking the starting point with partial sum zero. Similarly, the last layer Lk2+1 will just contain the target point also having partial sum zero, since a (P, k)-best step is an element of kern(A). Each layer Lj with 1 ≤ j ≤ k2 will contain (2k3∆ + 1)r many nodes, each representing one possible value of A(x(1) + · · · x(j)). Two points v, w from adjacent layers Lj−1, Lj will be connected if the difference of the corresponding partial sums, namely w − v, can be obtained by a solution y of variables from only one brick of Pj (with kyk1 ≤ k). The weight of the edge will be the largest gain for the objective function cT y over all possible bricks. Hence, it could be necessary to compute and compare up to n values for each Pj and each difference in the partial sums to insert one edge into the graph. Finally, we just have to find the longest path in this graph as it corresponds to a (P, k)-best step. The out-degree of each node is bounded by (2k3∆ + 1)r since at most this many nodes are reachable in the next layer. Therefore the overall number of edges is bounded by (k2 + 2) · (2k3∆ + 1)r · (2k3∆ + 1)r = (k∆)O(r). Using the Bellman-Ford algorithm we can solve the Longest Path problem for a graph with N vertices and M edges in time N · M as the graph does not contain any circles. This gives a running time of (k∆)O(r) · (k∆)O(r) = (k∆)O(r) for solving the problem. Constructing the graph, however, requires solving a number of IPs of the form max c′T x Bj(cid:19) x = (cid:18)b′ (cid:18)Aj 0(cid:19) kxk1 ≤ k ℓ′ ≤ x ≤ u′ x ∈ Zt, where b′ ∈ Zr is the corresponding right-hand side of the top rows and ℓ′, u′, c′ are the upper and lower bounds, and the objective of the block. This is an IP with r + s constraints, t variables, lower and upper bounds, and entries of the matrix bounded by ∆ in absolute value. Using the algorithm by Eisenbrand and Weismantel [8], solving one of them requires time t · O(r + s + 1)r+s+4 · O(∆)(r+s+1)(r+s+4) · log2((r + s + 1)∆) = t · ∆O(r2+s2). In fact, a little thought allows us to reduce the dependency on t to a logarithmic one: Since the number of constraints in the ILP above is very small, there are only ∆O(r+s) many different columns. Because of the cardinality constraint kxk1 ≤ k, we only have to consider 2k many variables of each type of column, namely: K. Jansen, A. Lassota, L. Rohwedder XX:7 Layer L0 Layer L1 Layer L2 Layer Lk2 Layer Lk2+1 ... ... . . . . . . . . . ... Figure 1 This figure shows an example for a layered graph obtained while solving the (P, k)-best step problem. There are k + 2 layers, visually separated by gray dashed lines. This includes one source layer L0, one target layer Lk2+1 both with just a single node representing the zero sum. Further there are k2 layers with (2k3∆ + 1)r nodes each, where in one layer the nodes stand for all reachable partial sums. Two points v, w from adjacent layers Lj−1, Lj will be connected if the difference of the corresponding partial sums, namely w − v, can be obtained by a solution y of variables from only one brick of Pj (with kyk1 ≤ k). The weight of the edge will be the largest gain for the objective function cT y over all possible bricks. For the sake of clarity both the values of the nodes and the edges are not illustrated. The k many with u′ the k many with ℓ′ i > 0 and maximal c′ i < 0 and minimal c′ i. i and If some solution uses a variable not in this set, then by pigeonhole principle there is a variable with the same column values and a superior objective value and which can be increased/de- creased. We can reduce the variable outside this set and increase the corresponding variable inside this set until all variables outside the set are 0. We can use an appropriate data struc- ture (e.g. AVL trees) to maintain a set of all variables with u′ i < 0) such that we can find the k best among them in time O(k log(t)). Whenever the bounds of some variable change, we might have to add or remove entries, which also takes only logarithmic time. After initialization in time O(nt) (in total for all bricks) solving such an IP can therefore be implemented in time i > 0 (ℓ′ k log(t) + 2k∆O(r+s)∆O(r2+s2) ≤ k log(t)∆O(r2+s2). The number of IPs to solve is at most n times the number of edges, since we have to compare the values of up to n bricks. This gives a running time of O(nt) + n · (k∆)O(r) · log(t) · ∆O(r2+s2) ≤ nt · kO(r) · ∆O(r2+s2) for constructing the graph. To obtain the update time from the premise of the theorem, it is perfectly fine to solve the Longest Path problem again, but we cannot construct the graph from scratch. However, in order to construct the graph we still have to find the best value over all bricks for each edge. Fortunately, if only a few bricks are updated (in their lower and upper bounds) it is not necessary to recompute all values. Each edge corresponds to a particular Pj ∈ P and a fixed right-hand side (a possible value of Ax(j)). We require XX:8 Near-Linear Time Algorithm for n-fold ILPs via Color Coding an appropriate data structure De for every edge e, which supports fast computation of the operations FindMax, Insert, and Delete. Again, an AVL tree computes each of these operations in time O(log(N )), where N is the number of elements. In De we store pairs (v, i) where i is a brick in Pj and v is the maximum gain of brick i for the right-hand side of e. The pairs are stored in lexicographical order. Since there are at most n bricks in Pj, the data structure will have at most n elements. Initially, we can build De in time nt · ∆O(r2+s2) (this is replicated for each edge). Now consider a change to the instance. Recall that we are looking at changes that affect only a single brick, namely the upper and lower bounds within that brick change. We are going to update the data structure De (for each edge) to reflect the changes and we are going to recompute the edge value of each edge e using De. Then we simply solve the Longest Path problem again. Let Pj ∈ P be the set that contains the brick i that has changed in some variable. We only have to consider edges from Lj−1 to Lj, since none of the other edges are affected by the change. For a relevant edge e we compute the previous value v and current value v′ that the brick i would produce (before and after the bounds have changed). In De we have to remove (v, i) and insert (v′, i). Both operations need only O(log(n)) time. Then the running time to update De for one edge is k log(t) · ∆O(r2+s2) + O(log(n)) ≤ k log(nt) · ∆O(r2+s2). In order to update the edge value of e using De, we simply have to find the maximum element in De, which again takes time O(log(n)). To summarize, the total time to update the (P, k)-best step after a change to a single brick consists of (1) updating each De, (2) finding the maximum in each De, and (3) solving the Longest Path problem. We conclude that the update time is k log(nt) · ∆O(r2+s2) · (k∆)O(r) + log(n) · (k∆)O(r) + (k∆)O(r) ≤ kO(r)∆O(r2+s2) · log(nt). ◭ 4 The Augmenting Step Algorithm In this section we will assume that all lower and upper bounds are finite and give a complete algorithm for this case. Later, we will explain how to cope with infinite bounds. We start by showing how to converge to an optimal solution when an initial feasible solution is given. To compute the initial solution, we also apply this algorithm on a slightly modified instance. The approach resembles the procedure in previous literature, although we apply the results from the previous section to speed up the computation of augmenting steps. Let x be a feasible solution for the n-fold, in particular Ax = b. Let x∗ be an optimal one. Theorem 4 states that we can decompose the difference vector x′ = x∗ − x into at most 2nt weighted Graver basis elements, that is x′ = x∗ − x = X2nt−1 j=1 λjgj. For intuition, consider the following simple approach (this is similar to the algorithm in [10]). Suppose we are able to guess the best vector λigi = argmaxj{cT (λjgj)} regarding the gain for the objective function. This pair of step length λi and Graver element gi is called the Graver best step. Then we can augment the current solution x by adding λigi to it, i.e., we set x ← x + λigi. Feasibility follows because all gj are sign-compatible. This procedure is repeated until no improving step is possible and therefore x must be optimal. In each iteration this decreases the gap to the optimal solution by a factor of at least 1 − 1/(2nt) by K. Jansen, A. Lassota, L. Rohwedder XX:9 the pigeonhole principle. It may be costly to guess the precise Graver best step, but for our purposes it will suffice to find an augmenting step that is approximately as good. We will now describe how to guess λi. Since x + λigi is feasible, we have that λigi ≤ u − x ≤ u − ℓ and λigi ≥ ℓ − x ≥ ℓ − u. Let (gi)j ∈ supp(gi) be some non-zero variable. If (gi)j > 0, then λi ≤ (λigi)j ≤ uj − ℓj. Otherwise, (gi)j < 0 and λi ≤ −(λigi)j ≤ −(ℓj − uj) = uj − ℓj. Hence, it suffices to check all values in the range {1, . . . , Γ}, where Γ = maxj{uj − ℓj}. Proceeding like in [7], we lower the time a bit further by not taking Instead, we look at guesses of the form λ′ = 2k for k ∈ every value into consideration. {0, . . . , ⌊log(Γ)⌋}. Doing so we lose a factor of at most 2 regarding the improvement of the objective function, since cT (λ′gi) > 0.5 · cT (λigi) when taking λ′ = 2⌊log(λi)⌋ > λi/2. Fix λ′ to the value above. Next we describe how to compute an augmenting step that is at least as good as λ′gi. Note that gi is a solution of Ay = 0 kyk1 ≤ k ⌈ ℓ − x λ′ ⌉ ≤ y ≤ ⌊ u − x λ′ ⌋, λ′ ⌉ and u = ⌊ u−x where k = O(rs∆)rs is the bound on the norm of Graver elements from Theorem 5. Suppose we have guessed some partition P = {P1, . . . , Pk2 } of the bricks such that of each Pj only a single brick has non-zero variables in gi. Clearly, the augmenting step λ′y∗, where y∗ is a (P, k)-best step with bounds ℓ = ⌈ ℓ−x λ′ ⌋ would be at least as good as λ′gi. Indeed Theorem 10 explains how to compute such a (P, k)-best step dynamically and when we add λ′gj to x we only change the bounds of at most k3 many variables. Hence, it is very efficient to recompute (P, k)-best steps until we have converged to the optimal solution. However, valid choices of λ′ and P might be different in every iteration. Regarding λ′, we simply compute (P, k)-best steps for every of the O(log(Γ)) many guesses and take the best among them. We proceed similarly for P . We guess a small number of partitions and guarantee that always at least one of them is valid. For this purpose we employ splitters. More precisely, we compute a (n, k, k2) splitter of the n bricks. Since gj has a norm bounded by k, it can also only use at most k bricks. Therefore the splitter always contains a partition P = {P1, . . . , Pk2 } where gj only uses a single brick in every Pj. To recap, in every iteration we solve a (P, k)-best step problem for every guess λ′ and every partition P in the splitter and take the overall best solution as an improving direction λ′y∗. Then we update our solution x by adding λ′y∗ onto it. At most k2 many bricks change (and within each brick only k variables can change) and therefore we can efficiently recompute the (P, k)-best steps for every guess for the next iteration. This way we guarantee that we improve the solution by a factor of at least 1−1/(4nt) in every iteration. The explicit running time of these steps will be analyzed in the next theorem. Initial Solution Recall that we still have to find an initial solution. This solution indeed can be computed by using the augmenting step algorithm described above. We construct a new n-fold ILP which has a trivial feasible solution and whose optimal solution corresponds to a feasible solution of the original problem. First we extend our n-fold A by adding (r + s)n new columns as follows: After the first block (A1, B1, 0, . . . , 0)T add r + s columns. The first r ones will contain an r × r identity matrix we call Ir. This matrix Ir has all ones in the diagonal. All other entries are zero. The next s columns will contain an s × s identity matrix Is. This submatrix will start at XX:10 Near-Linear Time Algorithm for n-fold ILPs via Color Coding row r + 1. Again all other entries are zeros in these columns. After the next block we again introduce r + s new columns, the first r ones containing just zeros, the next an Is matrix at the height of B2. We repeat this procedure of adding r + s columns after each block, the first r having solely zero entries and the next s containing Is at the height of Bi until our resulting matrix Ainit for finding the initial solution looks like the following: Ainit =   A1 B1 0 0 ... 0 Ir 0 0 0 ... 0 0 A2 Is 0 0 B2 0 ... 0 0 ... 0 0 0 0 0 ... 0 0 0 Is 0 ... 0 . . . An 0 . . . . . . . . . 0 0 ... Bn 0 0 0 0 ... 0 0 0 0 0 ... Is   . Due to our careful extension Ainit has again n-fold structure. For clarity the relevant sub- matrices are framed in the matrix above. Remark that zero entries inside of a block do not harm as solely the zeros outside of the blocks are necessary for an n-fold structure. At first glance, it seems that for the right-hand side b we now have a trivial solution consisting only of the new columns. Keep in mind, however, that the old variables have upper and lower bounds and that 0 might be outside these bounds. In order to handle this case we subtract ℓ, the lower bound, from all upper and lower bounds and set the right-hand side to b′ = b − Aℓ. We get an equivalent n-fold where every solution is shifted by ℓ. Now we can find a feasible solution (for b′) using solely the new variables by defining y′ = (0, . . . 0, b′ 1, b′ 2, . . . b′ r+s, 0, . . . 0, b′ r+s+1, . . . b′ r+2s, 0, . . . 0, b′ r+ns−s, b′ r+ns)T where each non-zero entry corresponds to the columns containing the submatrices Ir and Is respectively with a multiplicity of the remaining right-hand side b′. Next we introduce an objective function that penalizes using the new columns by having non-zero entries c′ i corresponding to the positions of the new variables. We set cinit = (0, . . . 0, c′ 1, . . . c′ r+s, 0, . . . 0, c′ r+ns−s, . . . , c′ r+ns), where the zero entries correspond to old variables. The values c′ bounds for the new variables depend on the sign of the right-hand side. i and the lower and upper i = −1, the lower bound to 0, and the upper bound to b′ i. This way i ≥ 0, then set c′ If b′ the variable can only be non-negative. If b′ must be non-positive. i < 0, set ci = 1, the lower bound to b′ i and the upper bound to 0. Hence this variable Clearly a solution has a value of 0, if and only if none of the new columns are used and no solution of better value is possible. Hence, if we use our augmenting step algorithm and solve this problem optimally, we either find a solution with value 0 or one with a negative value. In the former, we indeed have not taken any of the new columns into our solution, therefore we can delete the new columns and obtain a solution for the original problem (after adding ℓ to it). Otherwise, there is no feasible solution for the original problem as we solved the problem optimal regarding the objective function. ◮ Theorem 11. The dynamic augmenting step algorithm described above computes an opti- mal solution for the n-fold Integer Linear Program problem in time (rs∆)O(r2s+s2) · O(L2 · K. Jansen, A. Lassota, L. Rohwedder XX:11 nt log4(nt)) when finite variable bounds are given for each variable. Here L is the encoding length of the largest occurring number in the input. Proof. Due to Theorem 4 we know that the difference vector of an optimal solution x∗ to our current solution x, i.e. x′ = x∗ − x, can be decomposed into 2nt weighted Graver basis elements. Hence, if we adjust our solution x with the Graver best step, we reduce the gap between the value of an optimal solution and our current solution by a factor of at least 1 − 1/(2nt) due to the pigeonhole principle. Our algorithm finds an augmenting step that is at least half as good as the Graver best step. Therefore, the gap to the optimal solution is still reduced by at least a factor of 1 − 1/(4nt). Regarding the running time we first have to compute the splitter. Theorem 7 says, that this can be done in time kO(1) · n log(n) = (rs∆)O(rs) · n log(n). Next we have to try all values for the weight λ. Due to our step-length we get O(log(Γ)) guesses. Recall that Γ denotes the largest difference between an upper bound and the corresponding lower bound, i.e., Γ = maxj{uj − ℓj}. Fixing one, we have to find the best improving direction regarding each of the ((rs∆)O(rs))O(1) log(n) = (rs∆)O(rs) log(n) partitions. In the first iteration we have to set up the tables in time kO(r) · ∆O(r2+s2) · nt = (rs∆)O(r2s) · ∆O(r2+s2) · nt by computing the gain for each possible summand for each set and setting up the data structure. In each following iteration we update each table and search for the optimum in time kO(r) · ∆O(r2+s2) · log(nt) = (rs∆)O(r2s) · ∆O(r2+s2) · log(nt). Now it remains to bound the number I of iterations needed to converge to an optimal solution. To obtain such a bound we calculate: 1 > (1 − 1/(4nt))IcT (x∗ − x). By reordering the term, we get I < − log(cT (x∗ − x)) log(1 − 1/(4nt)) . As log(1 + x) = Θ(x), we can bound log(1 − 1/(4nt)) by Θ(−1/(4nt)) and thus I < O( − log(cT (x∗ − x)) −1/(4nt) ) ≤ O(4nt log(cT (x∗ − x))). As the maximal difference between the current solution x and an optimal one x∗ can be at most the maximal value of c times the largest number in between the bounds for each variable, we get cT (x∗ − x) ≤ nt maxi ci · Γ and thus I < O(4nt log(cT (x∗ − x))) ≤ O(nt log(nt max i ci · Γ)) ≤ O(nt log(ntΓ max i ci)). Let L denote the encoding length of largest integer in the input. Clearly 2L bounds the largest absolute value in c and thus we get I < O(nt log(ntΓ max i ci)) = O(nt log(ntΓ2L)) = O(nt log(ntΓ2L)). Hence after this amount of steps by always improving the gain by a factor of at least 1 − 1/(4nt) we close the gap between the initial solution and an optimal one. Given this, we XX:12 Near-Linear Time Algorithm for n-fold ILPs via Color Coding can now bound the overall running time with: (rs∆)O(rs) · n log(n) + (rs∆)O(rs) · (rs∆)O(r2s) · (rs∆)O(r2+s2) · nt + Splitter Partitions First Iteration O(nt log(ntΓ2L)) · O(log(Γ)) · (rs∆)O(rs) · (rs∆)O(r2s) · (rs∆)O(r2+s2) · log(nt)) {z {z I } } {z {z } } {z } = O((nt log(ntΓ2L)) · O(log(Γ)) · (rs∆)O(r2s+s2) · log(nt) = (rs∆)O(r2s+s2) · O(log2(Γ + 2L) · nt log2(nt)). λ Guesses Partitions Update Time {z } {z } Here Splitter denotes the time to compute the initial set P of partitions and Partitions denotes the cardinality of P. First Iteration is the time to solve the first iteration of the (P, k)-best step problem. Further λ Guesses is the number of guesses we have to do to get the right weight and lastly Update Time is the time needed to solve each following (P, k)-best step including updating the bounds and data structures. Note, that we still have to argue about finding the initial solution, since in the con- struction the parameters of the n-fold slightly change. The length of a brick changes to t′ = t + r + s. This, however, can be hidden in the O-Notation of (rs∆)O(r2s+s2). Fur- ther, Γ′, the biggest difference in upper and lower bounds can be bounded by a function in Γ, ∆, L, t and n. Recall, that the difference between the bounds of old variables does not change. For the new variables, however, the difference can be as large as kb′k∞. Thus we bound this value by kb′k∞ = kb − Aℓk∞ ≤ kbk∞ + kAℓk∞ ≤ kbk∞ + ∆ · kℓk1 ≤ O(∆ · nt · 2L). We conclude that the running time for finding an initial solution (and also the overall running time) is (rs∆)O(r2s+s2)O(log2(Γ′ +2L)nt2 log2(nt)) = (rs∆)O(r2s+s2)O(log2(∆2Lnt)nt2 log2(nt)) = (rs∆)O(r2s+s2) · L2nt log4(nt). ◭ Handling Infinite Bounds Remark, that if no finite bounds are given for all variables, we have to introduce some artificial bounds first. Here we can proceed as in [7], where first the LP relaxation is solved to obtain an optimal fractional solution z∗. Using the proximity results from [7], we know that an optimal integral solution x∗ exists such that kx∗ − z∗k1 ≤ nt(rs∆)O(rs). This allows us to introduce artificial upper bounds for the unbounded variables. Remark that this comes at the price of solving the corresponding relaxation of the n-fold Integer Linear Program problem. However we also lessen the dependency from L2 to L as the finite upper and lower bounds can also be bounded more strictly due to the same proximity result. This yields an overall running time of (rs∆)O(r2s+s2) · L · nt log4(nt) + LP. Nevertheless, solving this LP can be very costly, indeed it is not clear if a potential algorithm even runs in time linear in n. Thus, it may even dominate the running time of solving the n-fold ILP with finite upper bounds. Fortunately we can circumvent the necessity of solving the LP as we will describe in the following section using new structural results. ◮ Theorem 12. The dynamic augmenting step algorithm described above computes an op- timal solution for the n-fold Integer Linear Program problem in time (rs∆)O(r2s+s2) · L · nt log4(nt) + LP when some variables have infinite upper bounds. Here LP is the running time to solve the corresponding relaxation of the n-fold ILP problem. K. Jansen, A. Lassota, L. Rohwedder XX:13 5 Bounds on ℓ1-norm In the following, we prove that even with infinite variable bounds in an n-fold there always exists a solution of small norm (if the n-fold has a finite optimum). Therefore, we can apply the algorithm for finite variable bounds by replacing every infinite one with this value. ◮ Lemma 13. If the n-fold is feasible and y is some (possibly infeasible) solution satisfying the variable bounds, then there exists a feasible solution x with kxk1 ≤ O(rs∆)rs+1 · (kyk1 + kbk1) Proof. We take the same construction as in the algorithm for finding a feasible solution in Section 4. Indeed, this construction was not setup for infinite bounds, but we consider the straight-forward adaption where infinite bounds simply stay the same. The useful property is that an optimal solution for this n-fold is a feasible solution for the original n-fold. Recall, the construction has a right-hand side b′ with kb′k1 ≤ kAyk1 + kbk1, the value of t becomes t′ = t + r + s, and the objective function c′ consists only of the values {−1, 0, 1}. Moreover, there is a feasible solution y with kyk1 = kb′k1. Let x∗ be an optimal solution for this altered n-fold that minimizes kx∗ − yk1. We consider the decomposition into Graver elements λigi = x∗ − y. Then c′T gi > 0 or λi = 0 for all i, since otherwise x∗ − gi would be a better solution than x∗. It follows that c′T gi ≥ 1 by discreteness of c. Also, by Theorem 5, kgik1 ≤ O(rs∆)rs. Recall that by construction c′T x∗ = 0 and c′T y = −kb′k1, P2n(t+r+s)−1 which implies Pi λi ≤ kb′k1. Therefore, i=1 λikgik1 kx∗k1 ≤ kyk1 + kXi λigik1 ≤ kb′k1 +Xi ≤ kb′k1 + kb′k1 · O(rs∆)rs ≤ (kbk1 + kyk1) · O(rs∆)rs+1. Here we use that kb′k1 ≤ kbk1 + kAyk ≤ kbk1 + (r + s)∆ · kyk1. ◭ ◮ Lemma 14. If the n-fold is bounded and feasible, then there exists an optimal solution x with kxk1 ≤ (rs∆)O(rs) · (kbk1 + ntζ), where ζ denotes the largest absolute value among all finite variable bounds. Proof. Clearly there exists a (possibly infeasible) solution y satisfying the bounds with kyk1 ≤ ntζ. By the previous lemma we know that there is a feasible solution y with kyk1 ≤ (rs∆)O(rs) · (kbk1 + ntζ). Let x∗ be an optimal solution of minimal norm. W.l.o.g. assume that x∗ − y has only non-negative entries. If there is a negative entry, consider the equivalent n-fold problem with the corresponding column inverted and its bounds inverted and swapped. We know that there is a decomposition of x∗ − y into weighted Graver basis elements P2nt−1 i=1 λigi = x∗ − y. Since every gi is sign-compatible with x∗ − y, we have that all gi are non-negative as well. Furthermore, it holds that cT gi > 0 or λi = 0 for every gi, since otherwise x∗ − gi would be a solution of smaller norm with an objective value that is not worse. Now suppose toward contradiction that there is some gi where all variables in supp(gi) have infinite upper bounds. Then the n-fold is clearly unbounded, since y + α · gi is feasible for every α > 0 and in this way we can scale the objective value beyond any bound. Thus, every Graver basis element adds at least the value 1 to some finitely bounded variable. This implies that Pi λi ≤ kyk1 + ntζ: If not, then by pigeonhole principle there is some finitely bounded variable x∗ j with x∗ j = yj + (Xi λigi)j > yj + ζ + yj ≥ ζ. XX:14 Near-Linear Time Algorithm for n-fold ILPs via Color Coding Since x∗ is feasible, this cannot be the case. We conclude, kx∗k1 ≤ kyk1 +Xi λikgik1 ≤ kyk1 + O(rs∆)rs ·Xi λi ≤ O(rs∆)rs · (kyk1 + ntζ) ≤ (rs∆)O(rs) · (kbk1 + ntζ). ◭ This yields an alternative approach to solving the LP relaxation, because now we can simply replace all infinite bounds with ±(rs∆)O(rs) · nt · 2L. Then we can apply the algorithm that works only on finite variable bounds. The new encoding length L′ of the largest integer in the input can be bounded by L′ ≤ log((rs∆)O(rs) · 2L · nt) ≤ O(rs · log(rs∆) · L · log(nt)). This way we obtain the following. ◮ Corollary 15. We can compute an optimal solution for an n-fold in time (rs∆)O(r2s+s2)L2· nt log6(nt). In a similar way, we can derive the following bound on the sensitivity of an n-fold ILP. This bound is not needed in our algorithm, but may be of independent interest, since it implies small sensitivity for problems that can be expressed as n-fold. ◮ Theorem 16. Let x be an optimal solution of an n-fold with right-hand side b, in particular, Ax = b. If the right hand side changes to b′ and the n-fold still has a finite optimum, then there exists an optimal solution x′ for b′ (Ax′ = b′) with kx − x′k1 ≤ O(rs∆)rs · kb − b′k1. It is notable that this bound does not depend on n. This is in contrast to the known bounds for the distance between LP and ILP solutions of an n-fold [7]. Proof. Consider the matrix Ainit from the construction used for finding an initial solution, that is, identity matrices are added after every block. As opposed to the proof of Lemma 13, we leave everything except for the matrix the same. In particular, we do not change the value in the objective function c and new columns get a value of 0. As the right-hand side of the n-fold we use b′. For some solution x, we write xold and xnew for the vector restricted to the old variables (with all others 0) and the variables added in the matrix Ainit, respectively. This means x = xold + xnew. new. Let P2n(t+r+s)−1 i=1 Let x be an optimal solution with Ainit · xnew = b′ − b and x′ one with Ainit · x′ new = 0. Here we assume that x′ is chosen so as to minimize kx − x′k1. Those solutions naturally correspond to solutions of the original n-fold with right-hand side b = b′ − (Ainit · xnew) and b′ = b′ − Ainit · x′ λigi = x′ − x be the decomposition into Graver basis elements. Suppose toward contradiction there is some gi where all of supp(gi) are old variables. If cT gi > 0, then x is not optimal, because x + gi is feasible and has a better objective value. If on the other hand cT gi ≤ 0, then x′ − gi is a solution of at least the same value as x′ and thus kx − x′k1 is not minimal. Indeed, this means k(gi)newk1 ≥ 1 for all gi. In other words, each graver element contains a non-zero new variable. Recall that Ainit is the identity matrix when restricted to the new variables (plus some zero columns). Due to the sign-compatibility we get Xi λi ≤ k(Xi λigi)newk1 = kAinit · (Xi λigi)newk1 = kAinit · (x′ − x)newk1 = kb − b′k1. We conclude, kx − x′k1 = kXi λigik1 ≤ O(rs∆)rs ·Xi λi ≤ O(rs∆)rs · kb − b′k1. ◭ K. Jansen, A. Lassota, L. Rohwedder XX:15 References 1 Noga Alon, Raphael Yuster, and Uri Zwick. Color-coding. Journal of the ACM, 42(4):844 -- 856, 1995. Previously appeared in STOC 1994. 2 Katerina Altmanová, Dusan Knop, and Martin Koutecký. Evaluating and Tuning n-fold Integer Programming. In 17th International Symposium on Experimental Algorithms, vol- ume 103 of Leibniz International Proceedings in Informatics (LIPIcs), pages 10:1 -- 10:14, Germany, 2018. Schloss Dagstuhl -- Leibniz-Zentrum fuer Informatik. 3 Alexandr Andoni and Krzysztof Onak. Approximating edit distance in near-linear time. SIAM Journal on Computing, 41(6):1635 -- 1648, 2012. Previously appeared in STOC 2009. An integer analogue of 4 William Cook, Jean Fonlupt, and Alexander Schrijver. 5 Carathéodory's theorem. Journal of Combinatorial Theory, Series B, 40(1):63 -- 70, 1986. Jesús A De Loera, Raymond Hemmecke, Shmuel Onn, and Robert Weismantel. N-fold integer programming. Discrete Optimization, 5(2):231 -- 241, 2008. 6 Doratha E Drake and Stefan Hougardy. A linear time approximation algorithm for weighted matchings in graphs. Journal of the ACM Transactions on Algorithms, 1(1):107 -- 122, 2005. 7 8 Friedrich Eisenbrand, Christoph Hunkenschröder, and Kim-Manuel Klein. Faster Algo- rithms for Integer Programs with Block Structure. In 45th International Colloquium on Au- tomata, Languages, and Programming, volume 107 of Leibniz International Proceedings in Informatics (LIPIcs), pages 49:1 -- 49:13, Germany, 2018. Schloss Dagstuhl -- Leibniz-Zentrum fuer Informatik. Friedrich Eisenbrand and Robert Weismantel. Proximity results and faster algorithms for integer programming using the steinitz lemma. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 808 -- 816. Society for Industrial and Applied Mathematics, 2018. 9 Michael L. Fredman, János Komlós, and Endre Szemerédi. Storing a sparse table with O(1) worst case access time. Journal of the ACM, 31(3):538 -- 544, 1984. Previously appeared in FOCS 1982. 10 Raymond Hemmecke, Shmuel Onn, and Lyubov Romanchuk. N-fold integer programming in cubic time. Mathematical Programming, pages 1 -- 17, 2013. 11 Raymond Hemmecke, Shmuel Onn, and Robert Weismantel. N -fold integer programming and nonlinear multi-transshipment. Optimization Letters, 5(1):13 -- 25, 2011. 12 Klaus Jansen, Kim-Manuel Klein, Marten Maack, and Malin Rau. Empowering the configuration-ip - new ptas results for scheduling with setups times. In 10th Innovations in Theoretical Computer Science (ITCS), 2019. to appear. 13 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 multicommodity generalizations. In Proceedings of the twenty-fifth annual ACM-SIAM symposium on Dis- crete algorithms, pages 217 -- 226. SIAM, 2014. 14 Dušan Knop and Martin Kouteck`y. Scheduling meets n-fold integer programming. Journal of Scheduling, pages 1 -- 11, 2017. 15 Dusan Knop, Martin Koutecký, and Matthias Mnich. Combinatorial n-fold integer pro- In 25th Annual European Symposium on Algorithms, ESA gramming and applications. 2017, September 4-6, 2017, Vienna, Austria, pages 54:1 -- 54:14, 2017. 16 Martin Koutecký, Asaf Levin, and Shmuel Onn. A Parameterized Strongly Polynomial Algorithm for Block Structured Integer Programs. In 45th International Colloquium on Au- tomata, Languages, and Programming, volume 107 of Leibniz International Proceedings in Informatics (LIPIcs), pages 85:1 -- 85:14, Germany, 2018. Schloss Dagstuhl -- Leibniz-Zentrum fuer Informatik. XX:16 Near-Linear Time Algorithm for n-fold ILPs via Color Coding 17 Moni Naor, Leonard J. Schulman, and Aravind Srinivasan. Splitters and near-optimal derandomization. In 36th Annual Symposium on Foundations of Computer Science, Mil- waukee, Wisconsin, USA, 23-25 October 1995, pages 182 -- 191, 1995. Shmuel Onn and Pauline Sarrabezolles. Huge unimodular n-fold programs. SIAM J. Dis- crete Math., 29(4):2277 -- 2283, 2015. 18
1104.3806
1
1104
2011-04-19T17:16:59
How to Play Unique Games against a Semi-Random Adversary
[ "cs.DS", "cs.CC" ]
In this paper, we study the average case complexity of the Unique Games problem. We propose a natural semi-random model, in which a unique game instance is generated in several steps. First an adversary selects a completely satisfiable instance of Unique Games, then she chooses an epsilon-fraction of all edges, and finally replaces ("corrupts") the constraints corresponding to these edges with new constraints. If all steps are adversarial, the adversary can obtain any (1-epsilon) satisfiable instance, so then the problem is as hard as in the worst case. In our semi-random model, one of the steps is random, and all other steps are adversarial. We show that known algorithms for unique games (in particular, all algorithms that use the standard SDP relaxation) fail to solve semi-random instances of Unique Games. We present an algorithm that with high probability finds a solution satisfying a (1-delta) fraction of all constraints in semi-random instances (we require that the average degree of the graph is Omega(log k). To this end, we consider a new non-standard SDP program for Unique Games, which is not a relaxation for the problem, and show how to analyze it. We present a new rounding scheme that simultaneously uses SDP and LP solutions, which we believe is of independent interest. Our result holds only for epsilon less than some absolute constant. We prove that if epsilon > 1/2, then the problem is hard in one of the models, the result assumes the 2-to-2 conjecture. Finally, we study semi-random instances of Unique Games that are at most (1-epsilon) satisfiable. We present an algorithm that with high probability, distinguishes between the case when the instance is a semi-random instance and the case when the instance is an (arbitrary) (1-delta) satisfiable instance if epsilon > c delta.
cs.DS
cs
How to Play Unique Games against a Semi-Random Adversary Study of Semi-Random Models of Unique Games Alexandra Kolla Microsoft Research Konstantin Makarychev Yury Makarychev IBM Research TTIC Abstract In this paper, we study the average case complexity of the Unique Games problem. We propose a natural semi-random model, in which a unique game instance is generated in several steps. First an adversary selects a completely satisfiable instance of Unique Games, then she chooses an ε -- fraction of all edges, and finally replaces ("corrupts") the constraints corresponding to these edges with new constraints. If all steps are adversarial, the adversary can obtain any (1 − ε) satisfiable instance, so then the problem is as hard as in the worst case. In our semi-random model, one of the steps is random, and all other steps are adversarial. We show that known algorithms for unique games (in particular, all algorithms that use the standard SDP relaxation) fail to solve semi-random instances of Unique Games. We present an algorithm that with high probability finds a solution satisfying a (1 − δ) fraction of all constraints in semi-random instances (we require that the average degree of the graph is Ω(log k)). To this end, we consider a new non-standard SDP program for Unique Games, which is not a relaxation for the problem, and show how to analyze it. We present a new rounding scheme that simultaneously uses SDP and LP solutions, which we believe is of independent interest. Our result holds only for ε less than some absolute constant. We prove that if ε ≥ 1/2, then the problem is hard in one of the models, that is, no polynomial -- time algorithm can distinguish between the following two cases: (i) the instance is a (1 − ε) satisfiable semi -- random instance and (ii) the instance is at most δ satisfiable (for every δ > 0); the result assumes the 2 -- to -- 2 conjecture. Finally, we study semi-random instances of Unique Games that are at most (1 − ε) satisfiable. We present an algorithm that with high probability, distinguishes between the case when the instance is a semi-random instance and the case when the instance is an (arbitrary) (1 − δ) satisfiable instance if ε > cδ (for some absolute constant c). 1 1 0 2 r p A 9 1 ] S D . s c [ 1 v 6 0 8 3 . 4 0 1 1 : v i X r a 1 Introduction In this paper, we study the average case complexity of the Unique Games problem in a semi-random model. In the Unique Games problem, we are given a graph G = (V, E) (denote n = V ), a set of labels [k] = {0, . . . , k − 1} and a set of permutations πuv on [k], one permutation for every edge (u, v). Our goal is to assign a label (or state) xu ∈ [k] to every vertex u so as to maximize the number of satisfied constraints of the form xv = πuv(xu). The value of the solution is the number of satisfied constraints. The problem is conjectured to be very hard in the worst case. The Unique Games Conjecture (UGC) of Khot [17] states that for every positive ε, δ and sufficiently large k, it is NP-hard to distinguish between the case where at least a 1 − ε fraction of constraints is satisfiable, and the case where at most a δ fraction of all constraints is satisfiable. One reason which makes UGC particularly intriguing is its numerous implications. The conjecture, if true, implies that the currently best known approximation algorithms for many important computational problems have optimal approximation ratios. Indeed, since its origin, UGC has been successfully used to prove often optimal hardness of approximation results for several important NP-hard problems such as MAX CUT [18], Vertex Cover [19], Maximum Acyclic Subgraph [14], Max k-CSP [23, 15, 25], which are not known to follow from standard complexity assumptions. Arguably, a seemingly strong reason for belief in UGC is the failure of several attempts to design ef- ficient algorithms for Unique Games using current state-of-the-art techniques, even though a large amount of research activity in recent years has focused on the design of such algorithms. One direction of research has concentrated on developing polynomial-time approximation algorithms for arbitrary instances of unique games. The first algorithm was presented by Khot in his original paper on the Unique Games Conjec- ture [17], and then several algorithms were developed in papers by Trevisan [26], Gupta and Talwar [10], Charikar, Makarychev and Makarychev [8], Chlamtac, Makarychev, and Makarychev [9]. Another direc- tion of research has been to study subexponential approximation algorithms for Unique Games. The work was initiated by Kolla [21] and Arora, Impagliazzo, Matthews and Steurer [4] who proposed subexponen- tial algorithms for certain families of graphs. Then, in a recent paper, Arora, Barak and Steurer [3] gave a subexponential algorithm for arbitrary instances of Unique Games. These papers, however, do not disprove the Unique Games Conjecture. Moreover, Khot and Vishnoi [20] showed that it is impossible to disprove the Conjecture by using the standard semidefinite programming re- laxation for Unique Games, the technique used in the best currently known polynomial-time approximation algorithms for general instances of Unique Games. Additionally, Khot, Kindler, Mossel, and O'Donnell [18] proved that the approximation guarantees obtained in [8] cannot be improved if UGC is true (except possibly for lower order terms). All that suggests that Unique Games is a very hard problem. Unlike many other problems, however, we do not know any specific families of hard instances of Unique Games. In contrast, we do know many specific hard instances of other problems. Many such instances come from cryptography; for example, it is hard to invert a one-way function f on a random input, it is hard to factor the product z = xy of two large prime numbers x and y. Consequently, it is hard to satisfy SAT formulas that encode statements "f (x) = y" and "xy = z". There are even more natural families of hard instances of optimization problems; e.g. • 3-SAT: Feige's 3-SAT Conjecture [11] states that no randomized polynomial time algorithm can dis- tinguish random instances of 3-SAT (with a certain clause to variable ratio) from 1 − ε satisfiable instances of 3-SAT (with non-negligible probability). • Linear Equations in Z/2Z: Alekhnovich's Conjecture [1] implies that given a random (1 − ε) satisfiable instance of a system of linear equations in Z/2Z, no randomized polynomial time algorithm 1 can find a solution that satisfies a 1/2 + δ fraction of equations (for certain values of parameters ε and δ). • Maximum Clique Problem: It is widely believed [16] that no randomized polynomial time algorithm can find a clique of size (1 + ε) log2 n in a G(n, 1/2) graph with a planted clique of size m = n1/2−δ (for every constant ε, δ > 0). No such results are known or conjectured for Unique Games. In order to better understand Unique Games, we need to identify, which instances of the problem are easy and which are potentially hard. That motivated the study of specific families of Unique Games. Barak, Hardt, Haviv, Rao, Regev and Steurer [6] showed that unique game instances obtained by parallel repetition are "easy" (we say that a family of 1 − ε satisfiable instances is easy if there is a randomized polynomial-time algorithm that satisfies a constant fraction of constraints) . Arora, Khot, Kolla, Steurer, Tulsiani, and Vishnoi [5] showed that unique games on spectral expanders are easy (see also Makarychev and Makarychev [22], and Arora, Impagliazzo, Matthews and Steurer [4]). In this paper, we investigate the hardness of semi-random (semi-adversarial) instances of Unique Games. In a semi-random model, an instance is generated in several steps; at each step, choices are either made adversarially or randomly. Semi-random models were introduced by Blum and Spencer [7] (who considered semi-random instances of the k-coloring problem) and then studied by Feige and Kilian [12], and Feige and Krauthgamer [13]. In this paper, we propose and study a model, in which a 1 − ε satisfiable unique game instance is generated as follows: 1. Graph Selection Step. Choose the constraint graph G = (V, E) with n vertices and m edges. 2. Initial Instance Selection Step. Choose a set of constraints {πuv}(u,v)∈E so that the obtained instance is completely satisfiable. 3. Edge Selection Step. Choose a set of edges Eε of size εm = εE. 4. Edge Corruption Step. Replace the constraint for every edge in Eε with a new constraint. Note that if an adversary performs all four steps, she can obtain an arbitrary 1 − ε satisfiable instance, so, in this fully -- adversarial case, the problem is as hard as in the worst case. The four most challenging semi- random cases are when choices at one out of the four steps are made randomly, and all other choices are made adversarially. The first case -- when the graph G is random and, in particular, is an expander -- was studied by Arora, Khot, Kolla, Steurer, Tulsiani, and Vishnoi [5], who showed that this case is easy. of constraints (if the average degree of G is at least Ω(log k) and ε is less than some absolute constant). We present algorithms for the other three cases that with high probability (w.h.p.) satisfy a 1− δ fraction Theorem 1.1. For every k ≥ k0, ε0 > 0 and δ > C max(ε0, log k/√k) (where C and k0 are absolute con- stants), there exists a randomized polynomial time algorithm that given a semi-random instance of Unique Games with ε = ε0 (generated in one of the three models; see Section 2.3 for details) on a graph G with average degree at least Ω(log k)δ−3, finds a solution of value at least 1 − δ with probability1 1 − o(1). 1The probability is over both the random choices that we make when we generate the semi-random instance, and the random choices that the algorithm does. That is, the probability that the model generates a semi-random instance I, such that the algorithm finds a solution of I of value at least 1 − δ with probability 1 − o(1), is 1 − o(1). 2 The theorem follows from Theorems 3.1, 4.1, and 6.1, in which we analyze each model separately, and establish more precise bounds on the parameters for each model. In our opinion, this is a very surprising result since the adversary has a lot of control over the semi- random instance. Moreover, our results suggest that the Unique Games problem is different in nature than several NP-hard problems like SAT, which are thought to be hard on average. We want to point out that previously known approximation algorithms for Unique Games cannot find good solutions of semi-random instances. Also techniques developed for analyzing semi-random instances of other problems such as local analysis, statistical analysis, spectral gap methods, standard semidefinite programming techniques seem to be inadequate to deal with semi-random instances of Unique Games. To illustrate this point, consider the following example. Suppose that the set of corrupted edges is chosen at random, and all other steps are adversarial ("the random edges, adversarial constraints case"). The adversary generates a semi-random instance as follows. It first prepares two instances I1 and I2 of Unique Games. The first instance I1 is the Khot -- Vishnoi instance [20] on a graph G with the label set [k] = {0, . . . , k − 1} uv} whose SDP value is ε′ < ε/2 but which is only k−Ω(ε′) satisfiable. The second and permutations {π1 instance I2 is a completely satisfiable instance on the same graph G with the label set {k, . . . , 2k − 1} and permutations π2 uv = id. She combines these instances together: the combined instance is an instance on the graph G with the label set [2k] = {0, . . . , 2k − 1}, and permutations {πuv : πuv(i) = π1 uv(i) if i ∈ [k], and πuv(i) = π2 uv(i), otherwise}. Once the adversary is given a random set of edges Eε, she randomly changes ("corrupts") permutations {π2 uv, and then updates permutations {πuv}(u,v)∈Eε accordingly. It turns out that the SDP value of I2 with corrupted edges is very close to ε, and therefore, it is larger than ε′, the SDP value of I1 (if we choose parameters properly). So in this case the SDP solution assigns positive weight only to the labels in [k] from the first instance. That means that the SDP solution does not reveal any information about the optimal solution (the only integral solution we can obtain from the SDP solution has value k−Ω(ε)). Similarly, algorithms that analyze the spectral gap of the label extended graph cannot deal with this instance. Of course, in this example, we let our first instance, I1, to be the Khot -- Vishnoi instance because it "cheats" SDP based algorithms. Similarly, we can take as I1 another instance that cheats another type of algorithms. For instance, if UGC is true, we can let I1 to be a 1 − ε′ satisfiable unique game that is indistinguishable in polynomial-time from a δ -- satisfiable unique game. Our algorithms work only for values of ε less than some absolute constants. We show that this restriction is essential. For every ε ≥ 1/2 and δ > 0, we prove that no polynomial time algorithm satisfies a δ fraction of constraints in the "adversarial constraints, random edges" model (only the third step is random), assuming the 2 -- to -- 2 conjecture. uv}(u,v)∈Eε but does not change π1 One particularly interesting family of semi-random unique games (captured by our model) are mixed instances. In this model, the adversary prepares a satisfiable instance, and then chooses a δ fraction of edges and replaces them with adversarial constraints (corrupted constraints); i.e. she performs all four steps in our model and can obtain an arbitrary 1 − δ satisfiable instance. Then the "nature" replaces every corrupted constraint with the original constraint with probability 1 − ε. In our model, this case corresponds to an adversary who at first prepares a list of corrupted constraints π′ uv, and then at the fourth step replaces constraints for edges in Eε with constraints π′ uv (if an edge from Eε is not in the list, the adversary does not modify the corresponding constraint). Distinguishing Semi-Random At Most (1 − ε) Satisfiable Instances From Almost Satisfiable In- stances. We also study whether semi-random instances of Unique Games that are at most (1− ε) satisfiable can be distinguished from almost satisfiable instances of Unique Games. This question was studied for other problems. In particular, Feige's "Random 3-SAT Conjecture" states that it is impossible to distinguish be- 3 tween random instances of 3-SAT (with high enough clause density) and 1−δ satisfiable instances of 3-SAT. In contrast, we show that in the "adversarial edges, random constraints" case (the fourth step is random), semi-random (1− ε)-satisfiable instances can be efficiently distinguished from (arbitrary) (1− δ)-satisfiable instances when ε > cδ (for some absolute constant c). (This problem, however, is meaningless in the other two cases -- when the adversary corrupts the constraints -- since then she can make the instance almost satisfiable even if ε is large.) Linear Unique Games We separately consider the case of Linear Unique Games (MAX Γ-LIN). In the semi-random model for Linear Unique Games, we require that constraints chosen at the second and fourth steps are of the form xu − xv = suv(mod k). Note that in the "random edges, adversarial constraints" model, the condition that constraints are of the form xu − xv = suv(mod k) only restricts the adversary (and does not change how the random edges are selected). Therefore, our algorithms for semi-random general instances still applies to this case. However, in the "adversarial edges, random constraints" case, we need to sample constraints from a different distribution of permutations at the fourth step: for every edge (u, v) we now choose a random shift permutation xv = xu − suv, where suv ∈U Z/kZ. We show that our algorithm still works in this case; the analysis however is different. We believe that it is of independent interest. We do not consider the case where only the initial satisfying assignment is chosen at random, since for Linear Unique Games, the initial assignment uniquely determines the constraints between edges (specifically, suv = xu − xv(mod k)). Thus the case when only the second step is random is completely adversarial. It is interesting that systems of linear equations affected by noise with more than two variables per equations are believed to be much harder. Suppose we have a consistent system of linear equations Ax = b over Z/2Z. Then we randomly change an ε fraction of entries of b. Alekhnovich [1] conjectured that no polynomial-time algorithm can distinguish the obtained instance from a completely random instance even if ε ≈ n−c, for some constant c (Alekhnovich stated his conjecture both for systems with 3 variables per equation and for systems with an arbitrary number of variables per equation). Our results can be easily generalized to Unique Games in arbitrary Abelian groups. We omit the details in the conference version of this paper. 1.1 Brief Overview of Techniques In this paper, we develop new powerful algorithmic techniques for solving semi-random instances of unique games. We use different algorithms for different models. First, we outline how we solve semi-random unique games in the "adversarial constraints, random edges" model (see Section 3 for details). As we explained above, we cannot use the standard SDP relaxation (or other standard techniques) to solve semi- random instances in this model. Instead, we consider a very unusual SDP program for the problem, which we call "Crude SDP" (C-SDP). This SDP is not even a relaxation for Unique Games and its value can be large when the instance is satisfiable. The C-SDP assigns a unit vector ui to every vertex (u, i) of the label -- extended graph (for a description of the label -- extended graph we refer the reader to Section 2). We use vectors ui to define the length of edges of the label -- extended graph: the length of ((u, i), (v, j)) equals kui − vjk2. Then we find super short edges w.r.t. the C-SDP solution, those edges that have length O(1/ log k). One may expect that there are very few short edges since for a given C-SDP most edges will be long if we choose the unique games instance at random. We prove, however, that for every C-SDP solution {ui}, with high probability (over the semi-random instance) either 1. there are many super short edges w.r.t. {ui} in the satisfiable layer of the semi-random game, 2. or there is another C-SDP solution of value less than the value of the solution {ui}. 4 Here, as we describe later on in section 2, the "satisfiable layer" corresponds to the representation of the satisfying assignment in the label -- extended graph. Note that if our instance is completely satisfiable, then in the optimal (integral) C-SDP solution all the edges that correspond to the satisfiable layer have length zero and, therefore are super short. Our proof shows how to combine the C-SDP solution with an integral solution so that the C-SDP value goes down unless almost all edges in the satisfiable layer are super short. We then show that this claim holds with high probability not only for one C-SDP solution but also for all C-SDP solutions simultaneously. The idea behind this step is to find a family F of representative C-SDP solutions and then use the union bound. One of the challenges is to choose a very small family F, so that we can prove our result under the assumption that the average degree is only Ω(log k). The result implies that w.h.p. there are many super short edges w.r.t. the optimal C-SDP solution. Now given the set of super short edges, we need to find which of them lie in the satisfiable layer. We write and solve an LP relaxation for Unique Games, whose objective function depends on the set of super short edges. Then we run a rounding algorithm that rounds the C-SDP and LP solutions to a combinatorial solution using a variant of the "orthogonal separators" technique developed in [9]. Our algorithm for the "adversarial edges, random constraints" model is quite different. First, we solve the standard SDP relaxation for Unique Games. Now, however, we cannot claim that many edges of the label -- extended graph are short. We instead find the "long" edges of the graph G w.r.t. the SDP solution. We prove that most corrupted edges are long, and there are at most O(ε) long edges in total (Theorem 4.4). We remove all long edges and obtain a highly -- satisfiable instance. Then we write and solve an SDP for this instance, and round the SDP solution using the algorithm of [8]. We also present algorithms for two more cases: the case of "adversarial edges, random constraints" where the constraints are of the special form MAX-Γ-LIN and the case of "random initial constraints". In this paper, we develop several new techniques. In particular, we propose a novel C-SDP program, and then show how to exploit the optimality of a C-SDP solution in the analysis. We develop a rounding algo- rithm that simultaneously uses SDP and LP solutions. We demonstrate how to bound the number of different SDP solutions using dimension reduction methods and other tricks. We believe that our techniques are of independent interest and that they will prove useful for solving semi-random instances of other problems. 2 Notation and Preliminaries 2.1 The Label-Extended Graph For a given instance of Unique Games on a constraint graph G = (V, E), with alphabet size k and constraints {πuv}(u,v)∈E we define the Label-Extended graph M (V ′ = V × [k], E′) associated with that instance as follows: M has k vertices Bv = {v0,··· , vk−1} for every vertex v ∈ V . We refer to this set of vertices as the block corresponding to v. M has a total of V blocks, one for each vertex of G. Two vertices ui, vj ∈ V ′ are connected by an edge if (u, v) ∈ E and πuv(i) = j. We refer to a set of nodes L = {u(z) z=1 as a "layer" if L contains exactly one node from each block Bu(z). We note that a layer L can be seen as an assignment of labels to each vertex of G. If a layer L consists of vertices with the same index i, i.e. L = {u(z) z=1, we will call L the i-th layer. i(z)}V i }V 5 2.2 Standard SDP for Unique Games Our algorithms use the following standard SDP relaxation for Unique Games (see also [17, 20, 8, 9]). min subject to 1 k kui − vπuv(i)k2 2E X(u,v)∈E Xi∈[k] Xi=1 kuik2 = 1 hui, uji = 0 hui, vji ≥ 0 kui − vjk2 ≤ kui − wlk2 + kwl − vjk2 for all u ∈ V for all u ∈ V, i, j ∈ [k](i 6= j) for all u, v ∈ V, i, j ∈ [k](i 6= j) for all u, v, w ∈ V, i, j, l ∈ [k]. In this relaxation, we have a vector variable ui for every vertex u and label i. In the intended solution, ui is an indicator variable for the event "xu = i". That is, if xu = i then ui = e; otherwise, and ui = 0; where e is a fixed unit vector. The objective function measures the fraction of unsatisfied constraints: if the unique game has value 1 − ε, then the value of the intended SDP solution equals ε (and, therefore, the value of the optimal SDP solution is at most ε). finds a solution of value 1 − O(√ε log k). We will use this approximation algorithm as a subroutine (we Given an SDP solution of value ε, the approximation algorithm of Charikar, Makarychev, and Makarychev [8] will refer to it as CMMa). We will also use the following fact. Lemma 2.1 (see e.g. Lemmas A.1 and A.2 in [9]). Suppose, we are given two random Gaussian variables γ1 and γ2 with mean 0 and variance 1 (not necessarily independent), and a parameter k ≥ 2. Let α = 1/(2k2). Consider a threshold t s.t. Pr(γ1 ≥ t) = Pr(γ2 ≥ t) = α. Then Pr(γ1 ≥ t and γ2 ≥ t) ≥ α(cid:16)1 −q 1 c∗ Var(γ1 − γ2) log k(cid:17) for some absolute constant c∗. 2.3 Models In what follows, we will use several models for generating semi-random (1 − ε) satisfiable instances of Unique Games2: 1. "Random Edges, Adversarial Constraints" Model. The adversary selects a graph G(V, E) on n vertices and m edges and an initial set of constraints {πuv}(u,v)∈E so that the instance is completely satisfiable. Then she adds every edge of E to a set Eε with probability ε (the choices for different edges are independent). Finally, the adversary replaces the constraint for every edge in Eε with a new constraint of her choice. Note that this model also captures the case where at the last step the constraints for every edge in Eε are replaced with a new random constraint (random adversary). 2. "Adversarial Edges, Random Constraints" Model. The adversary selects a graph G(V, E) on n vertices and m edges and an initial set of constraints {πuv}(u,v)∈E so that the instance is completely satisfiable. Then she chooses a set Eε of εE edges. Finally, the constraint for every edge in Eε is randomly replaced with a new constraint. We will also consider some variations of this model, where at all steps the constraints are MAX Γ-LIN. In particular, at the last step, choosing a random constraint of the form MAX Γ-LIN, corresponds to choosing a random value s ∈ [Γ]. 2The parameters of the models are the number of vertices n, the number of edges m, and the probability ε that an edge is corrupted. 6 3. "Random Initial Constraints" Model. The adversary chooses the constraint graph G = (V, E) and a "planted solution" {xu}. Then for every edge (u, v) ∈ E, she randomly chooses a permutation (constraint) πuv such that πuv(xu) = xv (among (k − 1)! possible permutations). Then the adversary chooses an arbitrary set Eε of edges of size at most εE and replaces constraint πuv with a constraint π′ uv of her choice for (u, v) ∈ Eε. Remark 2.2. Without loss of generality, we will assume, when we analyze the algorithms, that the initial completely satisfying assignment corresponds to the "zero" layer. I.e. for every edge (u, v), πuv(0) = 0. Note that in reality, the real satisfying assignment is hidden from us. 3 Random Edges, Adversarial Constraints In this section, we study the "random edges, adversarial constraints" model and prove the following result. Theorem 3.1. Let k ∈ N (k ≥ 2), ε ∈ (0, 1/3), and η ∈ (0, 1). There exists a polynomial-time approxima- tion algorithm, that given an instance of Unique Games from the "random edges, adversarial constraints" model on graph G with Cη−3(1/3 − ε)−4n log k(log(η−1 log k))2 edges (C is a sufficiently large absolute constant), finds a solution of value (1 − ε − η)/(1 + ε + η) + O(1/k), with probability 1 − o(1). Corollary 3.2. There exists a polynomial-time approximation algorithm, that given an instance of unique games from the "random edges, adversarial constraints" model on graph G with Cn log k(log log k)2 edges (C is a sufficiently large absolute constant) and ε ≤ 1/4, finds a solution of value 1/2, with probability 1 − o(1). Remark 3.3. We can make the constant in the O(1/k) term in (1− ε− η)/(1 + ε + η) + O(1/k) arbitrarily small by increasing the value of C (and decreasing the value of α in the proof). We omit the details to simplify the exposition. The main challenge in solving "random edges, adversarial constraints" unique games is that the stan- dard SDP relaxation may assign zero vectors to layers corresponding to the optimal solution (as well as to some other layers) and assign non-zero vectors to layers, where every integral solution satisfies very few constraints. To address this issue, we introduce a new slightly modified SDP. As usual the SDP has a vector ui for every vertex -- label pair (u, i) ∈ V × [k]. We require that vectors ui, ui′ corresponding to the same vertex u are orthogonal: hui, ui′i = 0 for all u ∈ V and i, i′ ∈ [k], i 6= i′. We also impose triangle inequality constraints: 1 2kui − vjk2 + 1 2kui′ − vjk2 ≥ 1, for all (u, v) ∈ E and i, i′, j ∈ [k], i 6= i′; and require that all vectors have unit length: kuik = 1 for all u ∈ V and i ∈ [k]. Observe, that our SDP is not a relaxation3, since the integer solution does not satisfy the last constraint. The objective function is min X(u,v)∈E Xi∈[k] j=πuv(i) kui − vjk2 2 . Usually, this objective function measures the number of unsatisfied unique games constraints. However, in our case it does not. In fact, it does not measure any meaningful quantity. Note, that the value of the SDP 3Unless, the unique game is from a special family like Linear Unique Games (see Section 5). 7 can be arbitrary large even if the unique games instance is satisfiable. We call this SDP -- the Crude SDP or C-SDP. Given a C-SDP solution, we define the set of super short edges, which play the central role in our algorithm. Definition 3.4. We say that an edge ((u, i), (v, j)) in the label -- extended graph is η -- super short, if kui − vjk2 ≤ c∗η2/ log k, here c∗ is an absolute constant defined in Lemma 2.1. We denote the set of all η -- super short edges by Γη. In Section 3.1, we prove the following surprising result (Theorem 3.5), which states that all but very few edges in the zero level of the label-extended graph are super short. Theorem 3.5. Let k ∈ N (k ≥ 2), c ∈ (0, 1), ε ∈ (0, 1/3), η ∈ (c, 1) and γ ∈ (ε + c, 1) and let G = (V, E) be an arbitrary graph with at least Cη−2(γ − ε)−1(1/3− ε)−4 × n log k(log(c−1 log k))2, edges. Consider a semi-random instance of Unique Games in the "random edges, adversarial constraints" model. Let {ui} be the optimal solution of the C-SDP. Then with probability 1 − o(1), the set Γ0 η = Γη ∩ {((u, 0), (v, 0)) : (u, v) ∈ E} contains at least (1 − γ)E edges. More concretely, we proceed as follows. First, we solve the C-SDP. Then, given the C-SDP solution, we write and solve an LP to obtain weights x(u, i) ∈ [0, 1] for every (u, i) ∈ V × [k]. These weights are in some sense substitutes for lengths of vectors in the standard SDP relaxation. In the LP, for every vertex u ∈ V , we require that x(u, i) = 1. Xi∈[k] max X((u,i),(v,j))∈Γη The objective function is min(x(u, i), x(v, j)) (note that the objective function depends on the C-SDP solution). Denote the value of the LP by LP . The intended solution of this LP is x(u, 0) = 1 and x(u, i) = 0 for i 6= 0. Since the LP contribution η is 1, the value of the intended solution is at least Γ0 of every edge in Γ0 η. Applying Theorem 3.5 with γ = ε + η, we get Γ0 η ≥ (1 − γ)E = (1 − ε − η)E, so LP ≥ (1 − ε − η)E. In the next section, we present an approximation algorithm (which rounds C-SDP an LP solutions) and its analysis. We prove the approximation guarantee in Lemma 3.9, which implies Theorem 3.1. 3.1 Lower Bound on the Number of Super Short Edges: Proof of Theorem 3.5 We need the following lemma. Lemma 3.6. Let G = (V, E) be an arbitrary graph on n vertices, and let ε ∈ [0, 1/3), ρ = 1/3 − ε, ν ∈ (0, ρ). Suppose, that {Zuv}(u,v)∈E are i.i.d. Bernoulli random variables taking values 1 with probability ε and 0 with probability (1 − ε). Define the payoff function p : {0, 1} × R → R as follows p(z, α) =(−2α, α, if z = 1; if z = 0. 8 Then, with probability at least 1 − o(1) for every set of vectors {u0}u∈V satisfying (for some significantly large absolute constant C) 1 2 X(u,v)∈E ku0 − v0k2 ≥ CνE + Cρ−4 log2(1/ν)n the following inequality holds p(Zuv,ku0 − v0k2) > 0. X(u,v)∈E (1) (2) Proof. We need the following dimension reduction lemma, which is based on the Johnson -- Lindenstrauss Lemma and is fairly standard (for an example of using the Johnson -- Lindenstrauss Lemma in SDP rounding see Raghavendra and Steurer [24]). Lemma 3.7. For every positive ζ, η and ν, there exists a set N of unit vectors of size at most such that for every set of unit vectors U there exists a randomized mapping ϕ : U → N satisfying the following property: for every u, v ∈ U, exp(cid:0)O(ζ −2 log(1/η) log(1/ν))(cid:1) Pr((1 + ζ)−1ku − vk2 − η2 ≤ kϕ(u) − ϕ(v)k2 ≤ (1 + ζ)ku − vk2 + η2) ≥ 1 − ν. (3) Proof sketch. To prove the lemma, we consider an O(ζ −2 log(1/ν)) dimensional space L and choose a η2/32-net N in it. The size of N satisfies the bound in the lemma. To construct the mapping ϕ : U → N, we project all vectors from U to L using the Johnson -- Lindenstrauss lemma and then define ϕ(u) to be the closest vector u∗ ∈ N to the projection of u. Proof of Lemma 3.6. Set ζ = ρ/5 ≡ (1/3 − ε)/5. Define a new payoff function, pζ(z, α) =(−2(1 + ζ)α, (1 + ζ)−1α, if z = 1; if z = 0. Note, that ζ < 1/15 and pζ(0, α)− pζ (1, α) = ((1+ ζ)−1− (−2(1+ ζ)))α ≤ 4α (for α ≥ 0). Suppose, that for a given realization {Z ∗ uv}(u,v)∈E of {Zuv}(u,v)∈E there exists a set of unit vectors {u0}u∈V satisfying condition (1) and violating (2). Embed vectors {u0}u∈V into a net N of size exp(cid:0)O(ρ−2 log2(1/ν))(cid:1) using Lemma 3.7, such that for (1 − ν2/2) fraction of all edges (u, v) ∈ E, the following condition holds (1 + ζ)−1ku0 − v0k2 − ν2/8 ≤ ku∗ − v∗k2 ≤ (1 + ζ)ku0 − v0k2 + ν2/4, here u∗ is the image of u0; v∗ is the image of v0. Then, pζ(Z ∗ uv,ku∗ − v∗k2) < ν2E < νρE = 5νζE. X(u,v)∈E and (since we choose C to be sufficiently large) ku∗ − v∗k2 ≥ 40νE + Cρ−4 log2(1/ν)n. X(u,v)∈E 9 (4) (5) Thus, the existence of vectors {u0}u∈V satisfying condition (1) and violating (2) implies the existence of vectors {u∗}u∈V satisfying (4) and (5). We now show that for a random {Zuv} such vectors {u∗} exist with exponentially small probability. Fix a set {u∗}u∈V ⊂ N and consider random {Zuv}, E X(u,v)∈E pζ(Zuv,ku∗ − v∗k2) ≥ X(u,v)∈E ((1 − ε)(1 − ζ) − 2(1 + ζ)ε)ku∗ − v∗k2 ku∗ − v∗k2 = (1 − 3ε − 3εζ − ζ) X(u,v)∈E ≥ (1 − 3ε − 4ζ) X(u,v)∈E ≥ ζ X(u,v)∈E ku∗ − v∗k2. ku∗ − v∗k2 pζ(Zuv,ku∗ − v∗k2) < 2νρE By Hoeffding's inequality (using that pζ(0,ku∗−v∗k2)−pζ(1,ku∗−v∗k2) ≤ 4ku∗−v∗k2,P(u,v)∈E ku∗− v∗k2 − 10νE ≥ 3 2ζ 2(cid:16)P(u,v)∈E ku∗ − v∗k2 − 10νE(cid:17)2  Pr  X(u,v)∈E  P(u,v)∈E 16ku∗ − v∗k4 ζ 2(cid:16)P(u,v)∈E ku∗ − v∗k2(cid:17)2 P(u,v)∈E 64ku∗ − v∗k2   ku∗ − v∗k2 64 X(u,v)∈E  ρ−4 log2(1/ν)n(cid:19) ρ−2 log2(1/ν)n(cid:19) 4P(u,v)∈E ku∗ − v∗k2 and ku∗ − v∗k2 ≤ 4),  ≤ exp − ≤ exp − ≤ exp − ≤ exp(cid:18)− = exp(cid:18)− The number of all possible subsets {u∗}u∈V ⊂ N is at most Cζ 2 64 C 25 · 64 ζ 2 Hence, by the union bound with probability at least 1 − exp(−n) = 1 − o(1) for random {Zuv}(u,v)∈E, there does not exist a set of vectors {u0}u∈V satisfying condition (1) and violating (2). Nn ≤ exp(cid:0)O(nρ−2 log2(1/ν))(cid:1) . i } be the optimal SDP solution. Pick a unit vector e orthogonal to all vectors i for i 6= 0 (for all u ∈ V ). Note that restricted to 0 = e and uint i = u∗ Proof of Theorem 3.5. Let {u∗ u∗ i . Define a new SDP solution uint 0 }u∈V this solution is integral. Since {u∗ {uint i − v∗ ku∗ X(u,v)∈E Xi∈[k] j=πuv(i) i } is the optimal solution, jk2 ≤ X(u,v)∈E Xi∈[k] j=πuv(i) kuint i − vint j k2. 10 Denote by Eε the set of corrupted edges. Let Zuv = 1, if (u, v) ∈ Eε and Zuv = 0, otherwise. Let Eε = {(u, v) ∈ E : πuv(0) 6= 0}. Clearly, Eε ⊂ Eε. Write, X(u,v)∈E Xi∈[k] jk2 − kuint i − vint j k2 = i − v∗ ku∗ j=πuv(i) 0 − v∗ ku∗ 0k2 + X(u,v)∈ Eε πuv(0)k2 + kuint 0 − vint πvu(0) − vint 0 k2. 0 − v∗ πuv(0)k2 + ku∗ πvu(0) − v∗ 0k2 ku∗ = X(u,v)∈E\ Eε − X(u,v)∈ Eε πuv(0)k2 = kuint kuint For (u, v) ∈ Eε, we have kuint Thus, 0 − vint πvu(0) − vint 0 k2 = 2 and ku∗ 0− v∗ πuv(0)k2 ≥ 2−ku∗ 0− v∗ 0k2. X(u,v)∈E Xi∈[k] j=πuv(i) ku∗ i − v∗ jk2 − kuint i − vint j k2 ≥ X(u,v)∈E\ Eε ≥ X(u,v)∈E\Eε = X(u,v)∈E ku∗ 0 − v∗ ku∗ 0 − v∗ 0k2 − 2 X(u,v)∈ Eε 0k2 − 2 X(u,v)∈Eε 0 − v∗ 0k2), p(Zuv,ku∗ ku∗ 0 − v∗ 0k2 ku∗ 0 − v∗ 0k2 where p(·,·) is the function from Lemma 3.6. By Lemma 3.6, with probability 1 − o(1), for some absolute constant C ′, ρ = (1/3 − ε), ν = c∗η2(γ−ε) 2C ′ log k , 1 2E X(u,v)∈E ku∗ 0 − v∗ 0k2 < C ′νE + C ′ρ−4 log2(1/ν)n E ≤ c∗η2(γ − ε) log−1 k. The last inequality holds, because E ≥ Cη−2(γ − ε)−1ρ−4n log k(log(c−1 log k))2 ≥ C ′ 2c∗ η−2(γ − ε)−1ρ−4n log k log2(1/ν)2. 0 − v∗ 0 − v∗ 0k2 ≤ c∗η2/ log k. By the Markov inequality, for all but (γ − ε)/2 fraction of edges (u, v) ∈ E, ku∗ Recall that a pair ((u, 0), (v, 0)) is an η -- super short edge in the label -- extended graph if πuv(0) = 0 (i.e., 0k2 ≤ c∗η2/ log k. By the Chernoff Bound, (u0, v0) is an edge of the label -- extended graph) and ku∗ Eε ≤ (ε + (γ − ε)/2)E with probability (1 − o(1)); therefore, πuv(0) 6= 0 for at most a ε + (γ − ε)/2 fraction of edges. Thus, with probability (1− o(1)), there are at least (1− (γ − ε)/2− (ε + (γ − ε)/2))m = (1 − γ)E η -- super short edges. 3.2 SDP and LP Rounding We now present an algorithm that given a C-SDP solution {ui} and an LP solution {x(u, i)} finds an integer solution. We first present a procedure for sampling subsets of vertex -- label pairs, which is an analog of the algorithm for finding orthogonal separators in CMMb [9]. 11 LP Weighted Orthogonal Separators Input: An SDP solution {ui}, an LP solution {x(u, i)}. Output: A set S of label vertex pairs (u, i). 1. Set a parameter α = 1/(2k2), which we call the probability scale. 2. Generate a random Gaussian vector g with independent components distributed as N (0, 1). 3. Fix a threshold t s.t. Pr(ξ ≥ t) = α, where ξ ∼ N (0, 1). 4. Pick a random uniform value r in the interval (0, 1). 5. Find set S = {(u, i) ∈ V × [k] : hui, gi ≥ t and x(u, i) ≥ r} . 6. Return S. The rounding algorithm is given below. LP and SDP Based Rounding Algorithm Input: An instance of unique games. Output: An assignment of labels to the vertices. 1. Solve the SDP. 2. Find the set of all super short edges Γη. 3. Solve the LP. 4. Mark all vertices unprocessed. 5. while (there are unprocessed vertices) • Sample a set S of vertex -- label pairs using LP weighted orthogonal separators. • For all unprocessed vertices u: -- Let Su = {i : (u, i) ∈ S} -- If Su contains exactly one element i, assign label i to u and mark u as processed. If after nk/α iterations, there are unprocessed vertices, the algorithm assigns arbitrary labels to them and terminates. Lemma 3.8. Let S be an LP weighted orthogonal separator. Then, for every (u, i) ∈ V × [k], • Pr((u, i) ∈ S) = αx(u, i). For every ((u, i), (v, j)) ∈ Γη and (u, i′) ∈ V × [k] (i′ 6= i), 12 • Pr((u, i) ∈ S and (v, j) ∈ S) ≥ α min(x(u, i), x(v, j))(1 − η). • Pr((u, i) ∈ S; (v, j) ∈ S; (u, i′) ∈ S) ≤ α min(x(u, i), x(v, j))/(2k2 ). Proof. We have Pr((u, i) ∈ S) = Pr(hui, gi ≥ t and x(u, i) ≥ r) = Pr(hui, gi ≥ t) Pr(x(u, i) ≥ r) = αx(u, i). Then, by Lemma 2.1, Pr((u, i) ∈ S and (v, j) ∈ S) = Pr(hui, gi ≥ t and hvj, gi ≥ t) Pr(min(x(u, i), x(v, j)) ≥ r) ≥ α(1 − η) min(x(u, i), x(v, j)). Finally, we have (below we use that hui, gi and hui′, gi are independent random variables) Pr((u, i) ∈ S; (v, j) ∈ S; (u, i′) ∈ S) ≤ Pr(hui, gi ≥ t) Pr(hui′ , gi ≥ t) Pr(min(x(u, i), x(v, j)) ≥ r) = α2 min(x(u, i), x(v, j)) ≤ α min(x(u, i), x(v, j))/(2k2 ). Lemma 3.9. Given a C-SDP solution {ui} and an LP solution {x(u, i)} of value at least LP ≥ xE, the algorithm finds a solution to the unique games instance that satisfies (1 − η)x/(2 − (1 − η)x) − O(1/k) fraction of all constraints in the expectation. Proof. Consider an arbitrary edge (u, v). We estimate the probability that the algorithm assigns labels that satisfy the constraint πuv. For simplicity of presentation, assume that πuv(i) = i (we may always assume this by renaming the labels of v). Let δi(u, v) = min(x(u, i), x(v, i)) if ((u, i), (v, i)) ∈ Γη; and δi(u, v) = 0, otherwise. Let δ(u, v) =Pi δi(u, v) and δ′(u, v) = δ(u, v)(1 − η − 1/k). Consider an arbitrary iteration at which both u and v have not yet been processed. By Lemma 3.8 (item 2), if ((u, i), (v, i)) ∈ Γη, then Pr(i ∈ Su and i ∈ Sv) ≥ α min(x(u, i), x(v, i))(1 − η). Then, by Lemma 3.8 (3) and the union bound, the probability that Su or Sv contains more than one element and i ∈ Su, i ∈ Sv is at most α min(x(u, i), x(v, i))/k. Hence, the algorithm assigns i to both u and v with probability at least α min(x(u, i), x(v, i))(1 − η − 1/k) = αδi(u, v) × (1 − η − 1/k). The probability that the algorithm assigns the same label to u and v is at least Xi:((u,i),(v,i))∈Γη αδi(u, v) × (1 − η − 1/k) = αδ′(u, v). The probability that the algorithm assigns a label to u is at most α and similarly the probability that the algorithm assigns a label to v is at most α. Thus the probability that it assigns a label to either u or v is at most α(2 − δ′(u, v)). Hence, the probability that the algorithm assigns the same label to u and v at one of the iterations is at least (note that the probability that there are unlabeled vertices when the algorithm stops after nk/α 13 iterations is exponentially small, therefore, for simplicity we may assume that the number of iterations is infinite) ∞ Xt=0 (1 − α(2 − δ′(u, v)))tαδ′(u, v) = αδ′(u, v) α(2 − δ′(u, v)) = δ′(u, v) 2 − δ′(u, v) . The function δ 7→ δ/(2 − δ) is convex on (0, 2) and E X(u,v)∈E E X(u,v)∈E δ′(u, v) = 1 1 δ(u, v)(1 − η − 1/k) ≥ x(1 − η − 1/k), thus, by Jensen's inequality, the expected number of satisfied constraints is at least x(1 − η − 1/k) 2 − x(1 − η − 1/k)E. 3.3 Hardness: Semi-Random Instances for ε ≥ 1/2 In this section, we show that the problem becomes hard when ε ≥ 1/2 assuming the 2 -- to -- 2 conjecture. The 2 -- to -- 2 conjecture follows from Khot's 2 -- to -- 1 conjecture4, which is a frequently used complexity assumption [17]. We prove the following theorem. Theorem 3.10. For every ε ≥ 1/2 and δ > 0, no polynomial-time algorithm can distinguish with probability greater than o(1) between the following two cases: 1. Yes Case: the instance is a 1− ε satisfiable semi-random instance (in the "random edges, adversarial constraints" model), 2. No Case: the instance is at most δ satisfiable. This result holds if the 2 -- to -- 2 conjecture holds. Before we proceed with the proof we remind the reader the definition of 2 -- to -- 2 games and 2 -- to -- 2 conjecture. Definition 3.11. In a 2 -- to -- 2 game, we are given a graph G = (V, E), a set of labels [k] = {0, . . . , k−1} (k is even) and set of constraints, one constraint for every edge (u, v). Each constraint is defined by a 2 -- to -- 2 predicate Πuv: for every label i there are exactly two labels j such that Πuv(i, j) = 1 (the predicate is satisfied); similarly, for every j there are exactly two labels i such that Πuv(i, j) = 1. Our goal is to assign a label xu ∈ [k] to every vertex u so as to maximize the number of satisfied constraints Πuv(xu, xv) = 1. The value of the solution is the number of satisfied constraints. Definition 3.12. The 2 -- to -- 2 conjecture states that for every δ > 0 and sufficiently large k, there is no polynomial time algorithm that distinguishes between the following two cases (i) the instance is completely satisfiable and (ii) the instance is at most δ satisfiable. 4 The 2 -- to -- 1 conjecture implies the 2 -- to -- 2 conjecture because every 2 -- to -- 1 game can be converted to a 2 -- to -- 2 game of the same value as follows. Let I be an instance of a 2 -- to -- 1 game on a graph (L, R, E), s.t. every constraint has degree 2 on the left side, and degree 1 on the right side. We create two copies a1 and a2 for every label a for vertices in L. We replace each constraint Πlr with a constraint Π∗ lr(a2, b) = Πlr(a, b). We obtain a 2 -- to -- 2 game. It is clear that its value equals the value of the original 2 -- to -- 1 game. lr defined by Π∗ lr(a1, b) = Π∗ 14 Proof. We construct a randomized reduction that maps every satisfiable 2 -- to -- 2 game to a semi-random unique game, and every at most δ satisfiable 2 -- to -- 2 game to an at most δ satisfiable unique game. Suppose we are given an instance of a 2 -- to -- 2 game on a graph G with predicates Πuv. For each predicate Πuv, we find two permutations π0 uv(i) for every label i as follows. We consider a bipartite graph on vertex set {(u, i) : i ∈ [k]}∪{(v, j) : j ∈ [k]}, in which two vertices (u, i) and (v, j) are connected with an edge if Πuv(i, j) = 1. Every vertex has degree 2 in this graph. Therefore, it is a union of two matchings; each of them defines a permutation. Now for every edge (u, v), we choose one of the two permutations, π0 uv , at random. We obtain a unique game instance. uv(i)) = 1 and Πuv(i, π1 uv such that Πuv(i, π0 uv(i)) = 1, and π0 uv or π1 uv and π1 uv(i) 6= π1 uv(xu) or xv = π1 First of all it is clear, that the value of the unique game is at most the value of the 2 -- to -- 2 game (if a labeling {xu} satisfies xv = π0 uv(xu) then it also satisfies Πuv(xu, xv)). Hence our reduction maps an at most δ satisfiable 2 -- to -- 2 game to an at most δ satisfiable unique game. Now suppose that the 2 -- to -- 2 game instance is completely satisfiable. We show how an adversary can generate semi- random instances that have the same distribution as instances generated by our reduction. The adversary finds a solution {x∗ u} to the 2 -- to -- 2 game that satisfies all constraints Πuv. For every edge (u, v), she chooses ruv ∈ {0, 1} such that πruv v. She obtains a completely satisfiable unique game on G with constraints πruv uv (xu) = xv. Now she performs the random step -- she chooses a random set of edges Eε; every edge belongs to Eε with probability ε. She replaces every constraint πruv uv (xu) = xv with the constraint π1−ruv (xu) = xv with probability 1/(2ε), and returns the obtained instance. Note that the constraint for the uv edge (u, v) is π0 uv(xu) = xv with probability 1/2. Therefore, the distribution of instances coincides with the distribution generated by our reduction. uv(xu) = xv with probability 1/2 and π1 u) = x∗ uv (x∗ Our positive results (for ε < 1/3) apply only to graphs with average degree greater than ε−1 log k log log k. We want to point out that our negative results (for ε ≥ 1/2) also apply to graphs with high average degree. Indeed, note that our reduction does not change the constraint graph. As the following lemma shows, if the 2 -- to -- 2 conjecture is true then it is also true for instances on graphs with very high average degree (as large as n1−θ ≫ k log k). Lemma 3.13. Suppose that the 2 -- to -- 2 conjecture holds. Then it also holds for graphs with average degree at least n1−θ (for every θ > 0). Proof. Suppose we are given an instance I of a 2 -- to -- 2 game on a graph G = (V, E) with constraints Πuv(xu, xv). We construct a new instance I ′ of a 2 -- to -- 2 game as follows. For every vertex u, we create a "cloud" of N = V 2/θ new vertices Vu. We connect all vertices in Vu with all vertices in Vv for every edge (u, v). For every edge between vertices a ∈ Vu and b ∈ Vv, we add the constraint Πuv(xa, xb) = 1 (where Πuv is the predicate for the edge (u, v) in I). We obtain a 2 -- to -- 2 game on a graph with average degree 2N 2E/(NV ) ≥ 2N/V ≥ (NV )1−θ. Clearly, this is a polynomial -- time reduction. We show that the values of I and I ′ are equal. If a solution {xu} for I has value t then the solution defined by xa = xu if a ∈ Vu for I ′ has also value t. On the other hand, given a solution {xa} for I ′ of value t, we construct a solution for I as follows: for every u, we choose a random vertex a from Vu and let xu = xa. Then the expected value of this solution is t. Therefore, the value of the optimal solution for I is at least t. 4 Adversarial Edges, Random Constraints Theorem 4.1. There exists a polynomial-time approximation algorithm that given k ∈ N (k ≥ k0), ε ∈ (0, 1), η ∈ (cpε log k/k, 1) and a semi-random instance of unique games from the "adversarial edges, 15 random constraints" model on graph G = (V, E) with at least Cη−2n log k edges (C is a sufficiently large absolute constant) finds a solution of value 1 − O(ε + η), with probability 1 − o(1). Our algorithm proceeds in several steps. First, it solves the standard SDP relaxation for Unique Games. Then it removes "η -- long edges" (see below) with respect to the SDP solution, and finally it runs the CMMa [8] algorithm to solve the unique game on the remaining graph (the CMMa algorithm will again solve the SDP relaxation for Unique Games -- it cannot reuse our SDP solution). Definition 4.2. We say that an edge (u, v) is η -- long with respect to an SDP solution {ui}, if 1 2 Xi∈[k] kui − vπuv(i)k2 > η. Otherwise, we say that the edge (u, v) is η -- short. Now we formally present the algorithm. Input: An instance of unique games. Output: An assignment of labels to the vertices. 1. Solve the SDP and obtain an SDP solution {u∗ i }. 2. Remove all 1/16 -- long (with respect to {u∗ graph G∗. i }) edges (u, v) ∈ E from the graph G. Denote the new 3. Solve the SDP on the graph G∗ and run the CMMa algorithm. In Theorem 4.4, we show that after removing all 1/16 -- long edges from the graph G, the unique games instance contains at most O(γ)E corrupted constraint w.h.p, where γ = η2/ log k. Since the value of the optimal SDP is at least ε, the algorithm removes at most 16ε edges at step 2. In the remaining graph, G′, the CMMa algorithm finds an assignment satisfying 1 − O(√γ log k) = 1 − O(η) fraction of all constraints. This assignment satisfies at least 1 − O(ε + η) fraction of all constraints in G. Remark 4.3. In the previous section we proved that a typical instance of unique games in the "random edges, adversarial constraints" model contains many "super short" edges of the label-extended graph. Then we showed how we can find an assignment satisfying many super short edges. Note, that edges in the set Eε are not necessarily short or long. In this section, we show something very different: in the typical instance of unique games in the "adversarial edges, random constraints" model, most edges in the set Eε are long. However, note that the label-extended graph does not have to have any super short edges at all. 4.1 Almost All Corrupted Edges are Long Theorem 4.4. Let k ∈ N (k ≥ k0), ε ∈ (0, 1], γ ∈ (cε/√k, 1/ log k). Consider a graph G = (V, E) with at least Cγ−1n edges and a unique game instance on G (c, C, and k0 are absolute constants). Suppose that all constraints for edges in Eε are chosen at random; where Eε is a set of edges of size εE. Then, the set Eε contains less than γE 1/16 -- short edges w.r.t. every SDP solution {ui} with probability 1 − o(1). 16 Proof. Consider a semi-random instance of unique games. Let {ui} be an SDP solution. Suppose, that at least γE edges in Eε is 1/16 -- short. Define, fα,{ui}(u, i, v) =(1, 0, if kui − vπuv(i)k2 < α(kuik2 + kvπuv(i)k2); otherwise. We shall omit the second index of f , when it is clear that we are talking about the set {ui}. For every short 1/16 -- short edge (u, v) ∈ Eε, we have kuik2 + kvjk2 (6) 1 1 8 × (1 − f1/8(u, i, v)) ≤ kui − vjk2 ≤ 1 16 , 2 Xi∈[k] j=πuv(i) 2 Xi∈[k] j=πuv(i) and, hence, 1 2 Xi∈[k] j=πuv(i) (kuik2 + kvjk2)f1/8(u, i, v) ≥ 1 2 Xi∈[k] j=πuv(i) (kuik2 + kvjk2) − 1 2 = 1 2 . (7) We get (from (7) and the assumption that there are at least γE 1/16 -- short edges in Eε) X(u,i)∈V ×[k] Xv:(u,v)∈Eε kuik2f1/8(u, i, v) = X(u,v)∈Eε Xi∈[k] (kuik2 + kvjk2)f1/8(u, i, v) ≥ γE. = γ 2E + j=πuv(i) γ 8 X(u,i)∈V ×[k] kuik2(ε−1 degEε(u) + ∆). Here degEε(u) denotes the number of edges in Eε incident to u; and ∆ denotes the average degree in the graph G. We used that Pi∈[k] kuik2 = 1. We now group all vertices of the label -- extended graph (u, i) ∈ E×[k] depending on the value of log2(kuik2). Specifically, we pick a random r ∈ (1, 2) distributed with density (x ln 2)−1 and for every t ∈ N, define Vt,r = {(u, i) ∈ V × [k] : kuik2 ∈ [r2−(t+1), r2−t]}. We define V∞,r = {(u, i) ∈ V × [k] : kuik2 = 0}. Let gr(u, i, v) = 1, if (u, i) and (v, πuv(i)) lie in the same group Vt,r; and gr(u, i, v) = 0, otherwise. We claim, that if f1/8(u, i, v) = 1, then Prr(gr(u, i, v) = 1) ≥ 1/2. Claim 4.5. If f1/8(u, i, v) = 1, then Prr(gr(u, i, v) = 1) ≥ 1/2. Proof. Denote j = πuv(i). If f1/8(u, i, v) = 1, then ui 6= 0 and vj 6= 0. Assume w.l.o.g. that kuik2 ≥ kvjk2. Note, that gr(u, i, v) = 0, if and only if r2−t ∈ [kvjk2,kuik2] for some t ∈ N. The probability of this event is bounded by ln(kuik2/kvjk2)/ ln 2, since the probability that an interval [x, x + ∆x] contains a point from {r2−t : t ∈ N} is ∆x/(x ln(2)) + o(1). Using the inequality kuik2 − kvjk2 ≤ kui − vjk2 ≤ kuik2 + kvjk2 8 , we get kuik2/kvjk2 ≤ 9/7. Thus, Pr r (gr(u, i, v) = 0) ≤ ln(9/7)/ ln 2 < 1/2. 17 Therefore, for some r ∈ [1, 2], X(u,i)∈V ×[k] Xv:(u,v)∈Eε kuik2f1/8(u, i, v)gr(u, i, v) ≥ Rewrite this inequality as follows γ 4E + γ 16 X(u,i)∈V ×[k] kuik2(ε−1 degEε(u) + ∆). Xt∈N X(u,i)∈Vt,r×[k] Xv:(u,v)∈Eε kuik2f1/8(u, i, v)gr (u, i, v) ≥ 2−(t+1) γ Xt∈N 4E +Xt∈N X(u,i)∈Vt,r kuik2(ε−1 degEε(u) + ∆). kuik2f1/8(u, i, v)gr (u, i, v) ≥ For some t ∈ N, X(u,i)∈Vt,r Xv:(u,v)∈Eε We now replace each term kuik2 in the left hand side with the upper bound r2−t and each term kuik2 in the right hand side with the lower bound r2−(t+1). Then, we divide both sides by r2−t ≤ 2−t. γ ε−1 degEε(u) + 32Vt,r∆. kuik2(ε−1 degEε(u) + ∆). f1/8(u, i, v)gr(u, i, v) ≥ 16 X(u,i)∈Vt,r 2−(t+1)γE γ 16E + + γ γ 4 X(u,i)∈Vt,r Xv:(u,v)∈Eε 32 X(u,i)∈Vt,r Define a new set of vectors u∗ 1, then fα,{u∗ i }(u, i, v) = 1 since for j = πuv(i), i = ui/kuik, if (u, i) ∈ Vt,r; u∗ i = 0, otherwise. Observe, that if fα(u, i, v)gr(u, i, v) = ku∗ i − v∗ jk2 = 2 − 2hu∗ i , v∗ ji = 2 − 2 hui, vji kuik kvjk kuik kvjk kuik kvjk ≤ 2 − (1 − α) · 2 = 2α = α(ku∗ = 2 − kuik2 + kvjk2 − kui − vjk2 i k2 + kv∗ jk2). < 2 − (1 − α)kuik2 + kvjk2 Therefore, f1/8,{u∗ i }(u, i, v) ≥ X(u,i)∈Vt,r Xv:(u,v)∈Eε We now embed vectors {u∗ i } in a net N of size exp(O(log k)) using a randomized mapping ϕ (see Lemma 3.7, a variant of the Johnson -- Lindenstrauss lemma), so that for some small absolute constant β and every (u, i), (v, j) ∈ Vt,r, 32 X(u,i)∈Vt,r ε−1 degEε(u) + (8) γ γ 16E + γ 32Vt,r∆. Pr((1 + β)−1ku − vk2 − β ≤ kϕ(u) − ϕ(v)k2 ≤ (1 + β)ku − vk2 + β) ≥ 1 − β k2 . i′ ) − ϕ(u∗ i′′)k2 ≥ 2 − 3β for i′ 6= i′′. I.e., if u is good then all vectors ϕ(ui We say that a vertex u ∈ V is good if for all i′, i′′ ∈ {i : (u, i) ∈ Vt,r}, the following inequality holds: ∗) are almost orthogonal. kϕ(u∗ By Lemma 3.7, vertex u is good with probability at least 1 − β. We let u∗∗ i ), if u is good; and u∗∗ i = 0, otherwise. To slightly simplify the proof, for every vertex u, we also zero out a random subset of ⌈βk/4⌉ vectors u∗∗ i }(u, i, v) = 1) ≥ 1 − 4β (unless u or i}(u, i, v) = 1, then Pr(f1/4,{u∗∗ . Thus, if f1/8,{u∗ i = ϕ(u∗ i 18 v are not good vertices; ui or vπuv(i) has been zeroed; or the distance between u∗ distorted by φ). Hence, for some sample {u∗∗ i }, R ≡ X(u,i):ku∗∗ 64(cid:16)E + X(u,i)∈Vt,r i k=1 Xv:(u,v)∈Eε i }(u, i, v) ≥ f1/4,{u∗∗ γ i and v∗ πuv(i) is significantly ε−1 degEε(u) + Vt,r∆(cid:17) ≡ S. (9) We denote the left hand side by R. We denote the right hand side by S. We now fix the set of vectors {u∗∗ i } and a random set of constraints {πuv} on edges (u, v) ∈ Eε inequality (9) holds. For each (u, v) ∈ Eε and i }(u, i, v) = 1) ≤ 1/k (since for every i, there is at most one j ∈ [k] such that i, Pr{πuv}(f1/4,{u∗∗ ku∗∗ i } and estimate the probability that for a given set {u∗∗ j k2 ≤ 1/4; here we use that all non-zero vectors vj are almost orthogonal). Thus, ER = E X(u,i):ku∗∗ degEε(u) < 64S/(√kc). i k2=1 Xv:(u,v)∈Eε k X(u,i):ku∗∗ i }(u, i, v) ≤ f1/4,{u∗∗ i − v∗∗ i k2=1 1 In the last inequality, we used the bound γ ≥ cε/√k and (9). We assume that 64/c ≪ 1. We would like to apply the Bernstein inequality, which would give us an upper bound of (10) ε−1 degEε(u) + γVt,r∆(cid:1) log(k)(cid:17) exp(−Ω(S)) ≡ exp(cid:16) − Ω(cid:16)(cid:0)γE + γ X(u,i)∈Vt,r on the probability that inequality (9) holds (note: E[R] ≪ S; log(S/E[R]) ≥ Θ(log k)). Formally, we cannot use this inequality, since random variables f1/4,{u∗∗ i }(u, i, v) are not independent. So, instead, we consider a random process, where we consequently pick edges (u, v) ∈ Eε and then for every i such that u∗∗ 6= 0 pick a random yet unchosen j ∈ [k] and set πuv(i) = j. For every u and i, there are at least ⌈βk/4⌉ i different candidates j (since at least ⌈βk/4⌉ ui's equal 0) and for at most one of them ku∗∗ j k2 ≤ 1/4. i }(u, i, v) = 1) ≤ 4/(βk). We now apply a martingale concentration Hence, at every step Pr(f1/4,{u∗∗ inequality and get the same bound (10). i } and then apply the union bound to show that w.h.p. the set Eε contains less than γE 1/16-short edges with respect to every SDP solution. Let W = Vt,r be the number of pairs (u, i) such that u∗∗ 6= 0. We choose W variables among {u∗∗ i }u,i and assign them values from N as follows. Let au = {u∗∗ 6= 0 : i}. First, we choose the values of au for all vertices (note that Pu∈V au = W ). The number of ways to choose {au} is at most the number of ways to write W as the sum of n numbers, which is (cid:0)n+W −1 n−1 (cid:1) < 2n+W . Then for each vertex u, we choose iau 6= 0. The number of ways to choose labels is at most Qu∈V kau = kW . Finally, we assign a vector from N to each chosen variable u∗∗ . The number of ways to do so is NW . Thus there are at most Finally, we bound the number of possible solutions {u∗∗ au labels i1, . . . , iau for which u∗∗ i1 6= 0, . . . , u∗∗ i − v∗∗ i i i 2n+W × NW × kW = exp(O(W log k + n)) ways to choose vectors {u∗∗ i } for given W . Since γVt,r∆ log k ≥ γW × (Cγ−1) log k ≥ CW log k and γE log k ≥ Cn inequality (9) holds for some collection {u∗∗} with exponentially small probability exp(−Ω(n)) for every fixed value of W . Since there are only n possible values on W , inequality (9) holds for some value of W with exponentially small probability. 19 5 Random Corrupted Constraints in Linear Unique Games In this section we study a special family of unique games, so-called Linear Unique Games (or MAX Γ- Lin). In Linear Unique Games all labels i ∈ [k] are elements of the cyclic group Z/kZ; all constraints have the form xu = xv − suv, where suv ∈ Z/kZ. It is known that if the Unique Games Conjecture holds for general unique games, then it also holds for this family. We note that the results from the previous subsection are not directly applicable for Linear Unique Games, since random permutations are restricted to be shifts πuv : xu 7→ xv + suv and, thus, a random unique game from the "adversarial edges, random constraints" model is most likely not a linear unique game. This is not the case in the "random edges, adversarial constraints" model, since there the adversary may choose corrupted constraints in any fashion she wants, particularly to be shifts. We note that the results of this section can be easily generalized to any finite Abelian group using the decomposition of the group into a sum of cyclic subgroups. We omit the details from the conference version of the paper. For Linear Unique Games, we use a shift invariant variant of the SDP relaxation (see e.g., a paper by Andersson, Engebretsen, and Hastad [2]). In this relaxation, all vectors ui are unit vectors, satisfying ℓ2 2 triangle inequalities, and an extra constraint kui − vjk = kui+s − vj+sk. The objective is to minimize 1 k × 1 2E X(u,v)∈E Xi∈[k] kui − vi+suvk2. Given an arbitrary SDP solution {ui} one can obtain a uniform solution using symmetrization (this trick works only for unique games on groups, not arbitrary unique games): u′ i = 1 √k Mj∈Z/kZ ui+j. It is easy to verify (and it is well-known, see e.g., [8]) that vectors {u′ i} satisfy all SDP constraints and the objective value of the SDP does not change. We adapt the definition of η -- short edges for this variant of SDP as follows: we say that an edge (u, v) is η -- short with respect to the SDP solution {ui} if 1/2 kui−vi+sk2 ≤ η for every i ∈ [k] (or, equivalently, for some i ∈ [k], since kui − vi+sk = kuj − vj+sk). We prove the following analog of Theorem 4.4, which immediately implies that our general algorithm for the adversarial edges, random constraints model works for linear unique games. Theorem 5.1. Let k ∈ N (k ≥ k0), ε ∈ (0, 1), η ∈ (ε/ log k, 1/ log k). Consider a graph G = (V, E) with at least Cnγ−1 edges (k0, c, C are absolute constants) and a random linear unique game from the "adversarial edges, random constraints" model. Let Eε be the set of corrupted edges; and let {ui} be the optimal SDP solution. Then, with probability 1 − o(1), at most γE edges in Eε are 1/32 -- short. Proof. As mentioned in the beginning of this section the result we would like to prove holds not only for cyclic groups but for arbitrary Abelian groups. In fact, the proof is simpler if the group can be decomposed into a direct sum of many cyclic groups of small size. So, in some sense, our plan is to represent the cyclic group as a "pseudo-direct sum" of such groups. Before proceeding to the proof, we note that all transformations described below are only required for the proof and are not performed by the approximation algorithm. Let S be a circle (or a one dimensional torus). We identify S with the segment [0, 1] with "glued" ends 0 and 1. Define an embedding θ : [k] → S as follows θ(i) = i/k. We denote the distance between two adjacent labels by τ = 1/k. Below, all "+" and "−" operations on elements of S are "modulo 1" and all operations on [k] (and later [T ]) are modulo k (and T respectively). 20 Recall, that in the "adversarial edges, random constraints" model of Linear Unique Games, the adversary first chooses a set of edges Eε, then the "nature" randomly picks a shift suv ∈ [k] for every (u, v) ∈ Eε. We assume that the nature picks suv in the following way: it chooses a random suv ∈ S, and then defines suv = ⌊suvk⌋. Then, clearly, suv is distributed uniformly in [k]. If M is a subset of S, then M + s denotes the shift of M by s. We denote by L(M ) the set of labels covered by M: We let Ψu(M ) =Pi∈L(M ) ui, and Ψ′ Fix T = R2 (where R ∈ N) to be a sufficiently large absolute constant (not depending on k or any other parameters). We represent each s ∈ S as ∞ L(M ) = {i ∈ [k] : θ(i) ∈ M}. u(M ) = Ψu(M )/kΨu(M )k. s = sp/T p, Xp=1 where every sp belongs to [T ], in other words, 0.s1s2s3 . . . is a representation of s in the numeral system with base T . (This representation is not unique for a set of measure 0. If it is not unique, we pick the representation that ends in zeros.) We define Dp(s) = sp. Note, that if s is uniformly distributed random variable in S, then Dp(s) is uniformly distributed in [T ] and all Dp(s) are independent for different p. We are interested in the first P = ⌈2 ln ln k⌉ digits of suv. We have chosen P so that T −P = log−Θ(1) k > τ R ≡ R/k, but eP ≥ ln2 k. For every integer p ∈ {1, . . . , P} and d ∈ [T ] define Mp,d = {s ∈ S : Dp(s) ∈ [d, d + R − 1]}, that is, Mp,d is the set of numbers in [0, 1], whose p-th digit is in the range [d, d + R − 1]. Note, that the set {s ∈ S : Dp(s) = d} is a union of segments of length T −P > τ R ≡ R/k (here and below, all segments are left-closed and right-open). Lemma 5.2. Let M ⊂ S be a union of segments of length at least Rτ and let s ∈ [0, 1]. Then, (1 − 1/R) µ(M )/τ ≤ L(M ) ≤ (1 + 1/R) µ(M )/τ. and L(M ) △ L(M + s) ≤ min(L(M ),L(M + s))/R × (2s/τ + 2), here △ denotes the symmetric difference of two sets; and µ is the uniform measure on [0, 1]. Proof. Let M be the disjoint union of segments I ∈ I of length at least Rτ each. Consider one of the segments I ⊂ M. This segment covers at least ⌊µ(I)/τ⌋ ≥ (µ(I)/τ − 1) and at most ⌈µ(I)/τ⌉ ≤ (µ(I)/τ +1) points θ(i). In other words, µ(I)/τ−1 ≤ L(I) ≤ µ(I)/τ +1. Observe that 1/R·µ(I)/τ ≥ 1, because µ(I) ≥ Rτ , thus (1 − 1/R)µ(I)/τ ≤ L(I) ≤ (1 + 1/R)µ(I)/τ. Using equalities L(M ) =PI∈I L(I) and µ(M ) =PI∈I µ(I), we get (1− 1/R)µ(M )/τ ≤ L(M ) ≤ (1 + 1/R)µ(M )/τ . To prove the second inequality, observe that L(M ) △ L(M + s) ⊂ [I∈I (L(I) △ L(I + s)). 21 For each I ∈ I, L(I)△L(I+s) = L(I△(I+s)). The set I△(I+s) is the union of two segments of length at most s, thus I△(I +s) covers at most 2(s/τ +1) points θ(i) (i ∈ [k]). Every interval covers at least R points. Thus, the size of the family I is at most L(I)/R. Therefore, L(M )△L(M + s) ≤ L(M )/R×(2s/τ +2). The same argument shows L(M ) △ L(M + s) ≤ L(M + s)/R × (2s/τ + 2). Lemma 5.3. Let suv = ⌊ksuv⌋ (suv ∈ [k], suv ∈ S), p ∈ {1, . . . , P} and let d = Dp(suv) be the p-th digit of suv. Then L(Mp,0),L(Mp,d) ∈ [(1 − 1/R)/(Rτ ), (1 + 1/R)/(Rτ )] and L(Mp,0) △ (L(Mp,d) − suv) ≤ 8 min(L(Mp,0),L(Mp,d))/R. Proof. We have µ(Mp,d) = R/T = 1/R, thus by Lemma 5.2, L(Mp,0) ∈ [(1 − 1/R)/(Rτ ), (1 + 1/R)/(Rτ )]. Write, L(Mp,0) △ (L(Mp,d) − suv) = (L(Mp,0) + suv) △ L(Mp,d) = L(Mp,0 + θ(suv)) △ L(Mp,d) ≤ L(Mp,0 + θ(suv)) △ L(Mp,0 + suv) + L(Mp,0 + suv) △ L(Mp,d). Since suv − θ(suv) ∈ [0, τ ], by Lemma 5.2, L(Mp,0 + θ(suv))△ L(Mp,0 + suv) ≤ L(Mp,0 + θ(suv))/R· (2(suv − θ(suv))/τ + 2) ≤ 4L(Mp,0)/R. The p-th digit of suv is Dp(suv) = d. Hence, the p-th digit of every number s in Mp,0 + suv is in the range [d, (R − 1) + d + 1] = [d, R + d]. Moreover, all numbers with p-th digit in the interval [d + 1, (R − 1) + d] are covered by Mp,0 + suv. Thus, (Mp,0 + suv) △ Mp,d ⊂ {s : Dp(s) ∈ {d, d + R}}. The measure of the set {s : Dp(s) ∈ {d, d + R}} is 2/T . It is a union of segments of lengths T −p ≥ τ R. By Lemma 5.2, L((Mp,0 + suv) △ Mp,d) ⊂ L({s : Dp(s) ∈ {d, d + R}}) ≤ (1 + 1/R) · 2/(T τ ) ≤ 4L(Mp,0)/R. Lemma 5.4. Let suv = ⌊ksuv⌋ (suv ∈ [k], suv ∈ S), p ∈ {1, . . . , P}, and let d = Dp(suv) be the p-th digit of suv. Suppose that an edge (u, v) ∈ Eε is 1/32 -- short, then kΨu(Mp,0) − Ψv(Mp,d)k2 ≤ 1/8 min(kΨu(Mp,0)k2,kΨv(Mp,Dp(s))k2); kΨ′ u(Mp,0) − Ψ′ v(Mp,d)k2 ≤ 1/8. (11) (12) and Proof. Write, ui − Xi∈L(Mp,d) kΨu(Mp,0) − Ψv(Mp,d)k2 = (cid:13)(cid:13) Xi∈L(Mp,0) X ui − i∈L(Mp,0)\(L(Mp,d)−suv) vi(cid:13)(cid:13) 2 =(cid:13)(cid:13)(cid:13) X X i∈(L(Mp,d)−suv)\L(Mp,0) 2 triangle inequalities hui−vi+suv, uj−vj+suvi = −hui, vj+suvi−hvi+suv , uji ≤ 0, hui,−vj+suvi ≤ Using ℓ2 0 (for i 6= j) and then Lemma 5.3, we get (for sufficiently large R) kΨu(Mp,0) − Ψv(Mp,d)k2 ≤ i∈L(Mp,0)∩(L(Mp,d)−suv) kui − vi+suvk2 + L(Mp,0) △ (L(Mp,d) − suv) ≤ 1/16 L(Mp,0) + 8L(Mp,0)/R ≤ 1/8 L(Mp,0) = kΨu(Mp,0)k2/8. X i∈L(Mp,0)∩(L(Mp,d)−suv) (ui − vi+suv) + 2 . vi+suv(cid:13)(cid:13)(cid:13) 22 Similarly, kΨu(Mp,0) − Ψv(Mp,d)k2 ≤ kΨu(Mp,d)k2/8. Inequality (12) immediately follows from inequality (11): let ψu = Ψu(Mp,0), ψv = Ψv(Mp,d) and assume kψuk ≤ kψvk, then k ψu/kψuk − ψv/kψuk k2 ≤ 1/8. Vector ψu/kψuk has length 1, and vector ψv/kψuk has length at least 1, hence k ψu/kψuk − ψv/kψvk k2 ≤ k ψu/kψuk − ψv/kψuk k2 ≤ 1/8. Observe, that vectors Ψ′ v(Mp,d′), Ψ′ kΨ′ v(Mp,d′′) are orthogonal if d′′ − d′ > R, and thus u(Mp,d′) − Ψ′ u(Mp,d′′)k2 = 2. We now proceed the same way as in the proof of Theorem 4.4. We embed O(n log log k) vectors Ψ′ u(Mp,d) (u ∈ V , p ∈ P , d ∈ T ) in a net N of size O(1) using a randomized mapping ϕ (see Lemma 3.7), so that for some small absolute constant β and every u, v ∈ V ; d′, d′′ ∈ T ; and p ∈ {1, . . . , P}, Pr((1 + β)−1kΨ′ u(Mp,d′) − Ψ′ v(Mp,d′′)k2 − β ≤ kΦ(u, p, d′) − Φ(v, p, d′′)k2 v(Mp,d′′)k2 + β) ≥ 1 − β/T 2, where Φ(u, p, d) = ϕ(Ψ′ u(Mp,d)). We say that a pair (u, p) ∈ V × {1, . . . , P} is good if the following inequality holds: kΦ(u, p, d′) − Φ(u, p, d′′)k2 ≥ 2 − 3β for all d′, d′′ ∈ [T ] such that d′′ − d′ > R. By Lemma 3.7, a pair (u, p) is good with probability at least 1 − β. Then, for a fixed 1/32 -- short edge (u, v) ∈ Eε, the expected fraction of p's for which both pairs (u, p) and (v, p) are good and u(Mp,d′) − Ψ′ ≤ (1 + β)kΨ′ kΦ(u, p, 0) − Φ(v, p, Dp(suv))k2 ≤ 1/4 (13) is at least 1 − 3β. Assume that γE = γε−1Eε edges in Eε are 1/32 -- short. We say that an edge (u, v) ∈ Eε is good with respect to the set {Φ(u′, p, d)u,p,d} if the following statement holds: "for at least (1 − 6β) fraction of p's in {1, . . . , P}, the pairs (u, p) and (v, p) are good, and inequality (13) holds". By the Markov inequality, there exists a realization of random variables Φ(u, p, d) (random with respect to a random embedding in the net N) such that for at least γ/2 fraction of edges (u, v) ∈ Eε the previous statement holds. Thus we have shown that for every linear unique game with γE 1/32 -- short edges there always exists a witness -- a collection of vectors {Φ(u, p, d)} ⊂ N, such that at least γE/2 edges in Eε are good with respect to this collection (Remark: so far we have not used that the instance is semi-random). Now, we will prove that for a fixed witness, the probability that γE/2 edges in Eε is good in a semi-random unique game is exponentially small. Fix an edge (u, v) ∈ Eε and compute the probability that it is good with respect to a fixed witness {Φ(u, p, d)} ⊂ N. The probability that kΦ(u, p, 0) − Φ(v, p, Dp(suv))k2 ≤ 1/4 (14) for a random (suv) is at most 1/R if pairs (u, p) and (v, p) are good, since among every R values d ∈ {d0, d0 + R, d0 + 2R,··· } there is at most one d satisfying kΦ(u, p, 0) − Φ(v, p, d)k2 ≤ 1/4. (Recall, that kΦ(v, p, d′)− Φ(v, p, d′′)k2 ≥ 2− 3β if d′ − d′′ > R). By the Chernoff bound the probability that for (1 − 6β) fraction of p's the inequality (14) is satisfied and (u, p), (v, p) are good is at most e−P ln((1−6β)R) ≤ e−P ≤ ln−2 k. 23 Hence, the expected number of good edges in Eε is at most Eε/ ln2 k = εE/ ln2 k, and the probability that γE/2 edges in Eε are good is at most exp(cid:0)−γE/2 · ln(cid:0)γε−1 ln2 k/2(cid:1)(cid:1) ≤ exp(−Cn/2 · ln(1/2 ln k)). The total number of possible witnesses {Φ(u, p, d)} ⊂ N is exp(O(n log log k)). So by the union bound (for sufficiently large absolute constant C) with probability 1 − exp(−n) = 1 − o(1), less than γE edges in Eε are 1/32 -- short. 6 Random Initial Constraints In this section, we consider the model, in which the initial set of constraints is chosen at random and other steps are controlled by the adversary. Specifically, in this model the adversary chooses the constraint graph G = (V, E) and a "planted solution" {xu}. Then for every edge (u, v) ∈ E, she randomly chooses a permutation (constraint) πuv such that πuv(xu) = xv (each of (k − 1)! possible permutations is chosen with the same probability 1/(k − 1)!; choices for different edges are independent). Then the adversary chooses an arbitrary set Eε of edges of size at most εE and (adversarially) changes the corresponding constraints: replaces constraint πuv with a constraint π′ uv for (u, v) ∈ Eε. Note that the obtained semi-random instance is 1 − ε satisfiable since the "planted solution" xu satisfies constraints for edges in E \ Eε. The analysis of this model is much simpler than the analysis of the other two models that we study. Theorem 6.1. There exists a polynomial-time algorithm that given k ∈ N (k ≥ k0), ε ∈ (0, 1), η ∈ (c log k/√k, 1) and a semi-random instance of unique games from the "random initial instance" model on graph G = (V, E) with at least Cη−1n log k edges finds a solution of value 1 − O(ε + η/ log k) with probability 1 − o(1) (where c, C and k0 are some absolute constants). Proof. We solve the standard SDP relaxation for the problem. Then we use a very simple rounding proce- dure. For every vertex u, if kuik2 > 1/2 for some label i, we label u with i; otherwise, we label u with an arbitrary label (since for every two labels i1 6= i2, kui1k2 +kui2k2 ≤ 1, we do not label any vertex with two labels). We now show that our labeling satisfies a 1 − O(ε + η/ log k) fraction of constraints w.h.p. Without loss of generality, we assume that the planted solution is xu = 0 for every u ∈ V . For every t ∈ (1/2; 3/4), let St = (cid:8)u : ku0k2 ≥ t(cid:9). Let t0 be the value of t that minimizes the size of the cut between St and V \ St; let S = St0. Note that if u ∈ S then we label vertex u with 0. Therefore, our labeling satisfies all constraints πuv for edges (u, v) within S (but not necessarily constraints π′ uv). We conservatively assume that constraints for all edges from S to V \ S and edges within V \ S are not satisfied. We now estimate their number. First, we bound the number of edges leaving S. Note that since the unique game instance is 1 − ε satisfiable the cost of the SDP solution is at most ε. In particular, 1 2 X(u,v)∈E(cid:12)(cid:12)(cid:12)ku0k2 − kv0k2(cid:12)(cid:12)(cid:12) ≤ 1 2 X(u,v)∈E and v /∈ St or u /∈ St and v ∈ St is at most 4(cid:12)(cid:12)(cid:12)ku0k2 − kv0k2(cid:12)(cid:12)(cid:12) On the other hand, if we choose t uniformly at random from (1/2; 3/4), then the probability that u ∈ St for every (u, v) ∈ E. Therefore, the expected size of the cut between St and V \ St is at most 8εE. Hence the size of the cut between S and V \ S is at most 8εE. ku0 − v0k2 ≤ ε. 24 Now we estimate the number of edges within V \ S. We consider a new instance of Unique Games on G with the label set {1, . . . , k − 1} and constraints π∗ uv = πuv{1,...,k−1} (the restriction of πuv to the set {1, . . . , k − 1}). Note that each π∗ uv is a permutation of {1, . . . , k − 1} since πuv(0) = 0. Moreover, each π∗ uv is a random permutation uniformly chosen among all permutations on {1, . . . , k − 1}. For each vertex u and label i ∈ {1, . . . , k− 1}, we define a vector u∗ i = ui. Otherwise, we let 1 = e and u∗ u∗ i = 0 for i > 1, where e is a fixed unit vector orthogonal to all vectors vj in the SDP solution. i } is a relaxed SDP solution if it satisfies all SDP conditions except possibly for the i k2 = 1 for every vertex u. We require instead that 1/4 ≤ Pi ku∗ i k2 ≤ 1. Note that i } is a relaxed SDP solution since for every u /∈ S, Pk−1 i k2 = 1 − ku0k2 ≥ i=1 ku∗ We say that {u∗ condition that Pi ku∗ the set of vectors {u∗ 1 − t0 ≥ 1/4; for every u ∈ S,Pk−1 i k2 = kek2 = 1. We now use a slightly modified version of Theorem 4.4. i as follows. If u /∈ S, we let u∗ i=1 ku∗ Lemma 6.2. Consider a unique game on a graph G = (V, E) with at least Cη−1n log k edges with random set of constraints π∗ i } be a relaxed SDP solution. Then, there are at most O(η/ log k)E 1/64 -- short edges with probability 1− o(1). The proof of the lemma almost exactly repeats the proof of Theorem 4.4 for ε = 1 (we only need to uv, where η ∈ (c log k/√k, 1) (where c and C are some absolute constants). Let {u∗ change inequalities (6) and (7) slightly). We apply this lemma to the solution {u∗ i }. We get that there are at most O(η/ log k)E 1/64 -- short ku∗ i − v∗ uv(i)k2 π∗ edges. In particular, there are at most O(η/ log k)E 1/64 -- short edges in E(V \ S). Thus 1 Xi=1 2 X(u,v)∈E 2 X(u,v)∈E(V \S) kui − vπuv(i)k2 = kui − vπuv(i)k2 ≥ Xi=1 k−1 k−1 k−1 1 1 2 X(u,v)∈E(V \S) ≥ E(V \ S) Xi=1 − O(η/ log k)E. 64 However, the left hand side is at most εE. Therefore, E(V \ S) = O(ε + η/ log k)E. We conclude that the solution that our algorithm finds satisfies a 1 − O(ε + η/ log k) fraction of con- straints πuv. Since there are at most εE corrupted constraints, the solution also satisfies a 1 − O(ε + η/ log k) − ε = 1 − O(ε + η/ log k) fraction of corrupted constraints. 7 Distinguishing Between Semi-Random Unsatisfiable Games and Almost Satisfiable Games In this section, we study the following question, Is it possible to distinguish between (1 − ε) satisfiable semi-random games and (1 − δ) satisfiable (non-random) games if δ ≪ ε? This question is interesting only in the model where the corrupted constraints are chosen at random (i.e. step 4 is random), since in the other two semi-random models (when the initial constraints are random, and when the set of corrupted edges Eε is random), the semi-random instance can be 1 − δ satisfiable, therefore, the answer is trivially negative. Specifically, we consider the following model. The adversary chooses a constraint graph G and a set of constraints πuv. We do not require that this instance is completely satisfiable. Then she chooses a set of edges Eε of size εE. She replaces constraints for edges in Eε with random constraints (each constraint is chosen uniformly at random among all k! possible constraints). We show that such semi-random instance can be distinguished w.h.p. from a (1 − δ) satisfiable instance if δ < cε (where c is an absolute constant) if E ≥ Cn max(ε−1, log k). To this end, we consider the 25 standard SDP relaxation for Unique Games. We prove that the SDP value of a semi-random instance is at least cε; whereas, of course, the SDP value of a (1 − δ) satisfiable instance is at most δ. Theorem 7.1. Let k ∈ N (k ≥ k0) and ε ∈ (0, 1]. Consider a graph G with at least Cn max(ε−1, log k) edges, and a semi-random unique games instance I on G with εE randomly corrupted constraints (k0 and C are absolute constants). Then the SDP value of I is at least ε/32 with probability 1 − o(1). Proof. We apply Theorem 4.4 to our instance of Unique Games, with γ = min(ε/2, 1/(2 log k)). We get that at least half of all edges in Eε are 1/16 -- long w.h.p. The contribution of these edges to the sum 1 the SDP value is at least ε/32. 2P(u,v)Pi kui−vπuv(i)k2 in the SDP objective function is at least 1/16×(Eε/2) = εE/32. Therefore, References [1] M. Alekhnovich. More on Average Case vs Approximation Complexity. In Proceedings of the 44st IEEE Symposium on Foundations of Computer Science: pp, 298 -- 307, 2003. [2] G. Andersson, L. Engebretsen, and J. Hastad. A new way to use semidefinite programming with applications to linear equations mod p, Journal of Algorithms, Vol. 39, 2001, pp. 162 -- 204. [3] S. Arora, B. Barak, and D. Steurer. Subexponential Algorithms for Unique Games and Related prob- lems. In Proceedings of the 51st IEEE Symposium on Foundations of Computer Science, 2010. [4] S. Arora, R. Impagliazzo, W. Matthews, and D. Stuerer. Improved algorithms for unique games via divide and conquer, In Electronic Colloquium on Computational Complexity, TR10-041, 2010. [5] S. Arora, S. Khot, A. Kolla, D. Steurer, M. Tulsiani, and N. Vishnoi. Unique games on expanding constraint graphs are easy. In Proceedings of the 40th ACM Symposium on Theory of Computing, pp. 21 -- 28, 2008. [6] B. Barak, M. Hardt, I. Haviv, A. Rao, O. Regev and D. Steurer. Rounding Parallel Repetitions of Unique Games, In Proceedings of the 49th IEEE Symposium on Foundations of Computer Science, pp. 374 -- 383, 2008. [7] A. Blum and J. Spencer. Coloring Random and Semi-Random k-Colorable Graphs, J. Algorithms, vol. 19, no. 2, pp. 204 -- 234, 1995. [8] M. Charikar, K. Makarychev, and Y. Makarychev. Near-Optimal Algorithms for Unique Games. In Proceedings of the 38th ACM Symposium on Theory of Computing, pp. 205 -- 214, 2006. [9] E. Chlamtac, K. Makarychev, and Y. Makarychev. How to Play Unique Games Using Embeddings. In Proceedings of the 47th IEEE Symposium on Foundations of Computer Science, pp. 687 -- 696, 2006. [10] A. Gupta and K. Talwar. Approximating Unique Games. In Proceedings of the 17th ACM-SIAM Symposium on Discrete Algorithms, pp. 99 -- 106, 2006. [11] U. Feige. Relations Between Average Case Complexity and Approximation Complexity In Proceedings of the 34th Annual ACM Symposium on Theory of Computing, pp. 534 -- 543, 2002. 26 [12] U. Feige and J. Kilian, Heuristics for Semirandom Graph Problems, Journal of Computing and System Sciences, vol. 63, pp. 639 -- 671, 2001. [13] U. Feige and R. Krauthgamer. Finding and Certifying a Large Hidden Clique in a Semi-Random Graph Random Structures and Algorithms, vol. 16(2), pp. 195 -- 208, 2000. [14] V. Guruswami, R. Manokaran, and P. Raghavendra. Beating the Random Ordering is Hard: In- In Proceedings of the 49th IEEE Symposium on approximability of Maximum Acyclic Subgraph. Foundations of Computer Science, pp. 573 -- 582, 2008. [15] V. Guruswami and P. Raghavendra. Constraint satisfaction over a non-boolean domain: Approxima- tion algorithms and unique-games hardness. In Proceedings of APPROX-RANDOM, 77 -- 90, 2008. [16] M. Jerrum. Large Cliques Elude the Metropolis Process, Random Structures and Algorithm, vol. 3 (4), pp. 347 -- 359, 1992. [17] S. Khot. On the power of unique 2-prover 1-round games. In Proceedings of the 34th ACM Sympo- sium on Theory of Computing, pp. 767 -- 775, 2002. [18] S. Khot, G. Kindler, E. Mossel, and R. O'Donnell. Optimal inapproximability results for MAX-CUT and other 2-variable CSPs? ECCC Report TR05-101, 2005. [19] S. Khot and O. Regev. Vertex cover might be hard to approximate to within 2 − ε. In Proceedings of the 18th IEEE Annual Conference on Computational Complexity, 2003. [20] S. Khot and N. Vishnoi. The Unique Games Conjecture, Integrality Gap for Cut Problems and Embeddability of Negative Type Metrics into ℓ1, Foundations of Computer Science, pp. 53 -- 62, 2005. [21] A. Kolla. Spectral Algorithms for Unique Games In Proceedings of the Conference on Computational Complexity, pp. 122 -- 130, 2010. [22] K. Makarychev and Y. Makarychev. How to Play Unique Games on Expanders, In Proceedings of the eighth Workshop on Approximation and Online Algorithms, 2010. [23] P. Raghavendra, Optimal algorithms and inapproximability results for every CSP?, Proceedings of the 40th Annual ACM Symposium on Theory of Computing, pp. 245 -- 254, 2008. [24] P. Raghavendra, D. Steurer, How to Round Any CSP, In Proceedings of the 50th IEEE Symposium on Foundations of Computer Science, pp. 586 -- 594, 2009. [25] A. Samorodnitsky and L. Trevisan. Gowers uniformity, influence of variables, and PCPs. In Proceed- ings of the 38th annual ACM symposium on Theory of computing, pp. 11 -- 20, 2006. [26] L. Trevisan. Approximation Algorithms for Unique Games. In Proceedings of the 46th IEEE Sympo- sium on Foundations of Computer Science, pp. 197 -- 205, 2005. 27
1602.05622
1
1602
2016-02-17T22:56:59
Compact Flow Diagrams for State Sequences
[ "cs.DS", "cs.CC" ]
We introduce the concept of compactly representing a large number of state sequences, e.g., sequences of activities, as a flow diagram. We argue that the flow diagram representation gives an intuitive summary that allows the user to detect patterns among large sets of state sequences. Simplified, our aim is to generate a small flow diagram that models the flow of states of all the state sequences given as input. For a small number of state sequences we present efficient algorithms to compute a minimal flow diagram. For a large number of state sequences we show that it is unlikely that efficient algorithms exist. More specifically, the problem is W[1]-hard if the number of state sequences is taken as a parameter. We thus introduce several heuristics for this problem. We argue about the usefulness of the flow diagram by applying the algorithms to two problems in sports analysis. We evaluate the performance of our algorithms on a football data set and generated data.
cs.DS
cs
Compact Flow Diagrams for State Sequences Kevin Buchin, Maike Buchin, Joachim Gudmundsson, Michael Horton, and Stef Sijben Abstract. We introduce the concept of compactly representing a large number of state sequences, e.g., sequences of activities, as a flow diagram. We argue that the flow diagram representation gives an intuitive summary that allows the user to detect patterns among large sets of state sequences. Simplified, our aim is to generate a small flow diagram that models the flow of states of all the state sequences given as input. For a small number of state sequences we present efficient algorithms to compute a minimal flow diagram. For a large number of state sequences we show that it is unlikely that efficient algorithms exist. More specifically, the problem is W [1]-hard if the number of state sequences is taken as a parameter. We thus introduce several heuristics for this problem. We argue about the usefulness of the flow diagram by applying the algorithms to two problems in sports analysis. We evaluate the performance of our algorithms on a football data set and generated data. 1 Introduction Sensors are tracking the activity and movement of an increasing number of objects, generating large data sets in many application domains, such as sports analysis, traffic analysis and behavioural ecology. This leads to the question of how large sets of sequences of activities can be represented compactly. We introduce the concept of representing the "flow" of activities in a compact way and argue that this is helpful to detect patterns in large sets of state sequences. To describe the problem we start by giving a simple example. Consider three objects (people) and their sequences of states, or activities, during a day. The set of state sequences T = {τ1, τ2, τ3} are shown in Fig. 1(a). As input we are also given a set of criteria C = {C1, . . . , Ck}, as listed in Fig. 1(b). Each criterion is a Boolean function on a single subsequence of states, or a set of subsequences of states. For example, in the given example the criterion C1 ="eating" is true for Person 1 at time intervals 7 -- 8am and 7 -- 9pm, but false for all other time intervals. Thus, a criterion partitions a sequence of states into subsequences, called segments. In each segment the criterion is either true or false. A segmentation of T is a partition of each sequence in T into true segments, which is represented by the corresponding sequence of criteria. If a criterion C is true for a set of subsequences, we say they fulfil C. Possible segments of T according to the set C are shown in Fig. 1(c). The aim is to summarize segmentations of all sequences efficiently; that is, build a flow diagram F, starting at a start state s and ending at an end state t, with a small number of nodes such that for each sequence of states τi, 1 ≤ i ≤ m, there exists a segmentation according to C which appears Fig. 1: The input is (a) a set T = {τ1, . . . , τm} of sequences of states and (b) a set of criteria C = {C1, . . . , , Ck}. (c) The criteria partition the states into a segmentation. (d) A valid flow diagram for T according to C. as an s -- t path in F. A possible flow diagram is shown in Fig. 1(d). This flow diagram for T according to C can be validated by going through a segmentation of each object while following a path in F from s to t. For example, for Person 1 the s -- t path s → C1 → C2 → C4 → C1 → t is a valid segmentation. Now we give a formal description of the problem. A flow diagram is a node- labelled DAG containing a source node s and sink node t, and where all other nodes are labelled with a criterion. Given a set T of sequences of states and set of criteria C, the goal is to construct a flow diagram with a minimum number of nodes, such that a segmentation of each sequence of states in T is represented, that is, included as an s -- t path, in the flow diagram. Furthermore (when criteria depend on multiple state sequences, e.g. C7 in Fig. 1) we require that the segmentations represented in the flow diagram are consistent, i.e. can be jointly realized. The Flow Diagram problem thus requires the segmentations of each sequence of states and the minimal flow diagram of the segmentations to be computed. It can be stated as: Problem 1. Flow Diagram (FD) Instance: A set of sequences of states T = {τ1, . . . , τm}, each of length at most n, a set of criteria C = {C1, . . . , Ck} and an integer λ > 2. Question: Is there a flow diagram F with ≤ λ nodes, such that for each τi ∈ T , there exists a segmentation according to C which appears as an s -- t path in F? Even the small example above shows that there can be considerable space savings by representing a set of state sequences as a flow diagram. This is not a lossless representation and comes at a cost. The flow diagram represents the sequence of flow between states, however, the information about an individual sequence of states is lost. As we will argue in Section 4, paths representing many 2 Person1Person2Person38-9amcycletoworkcycletoworkdrivetowork9am-5pmworkworkwork5-7pmstudydinnershop7-9pmdinnershopdinner7-8ambreakfastbreakfastgym(a)(b)sC3C1C4tC2C6C1C6(c)(d)8-9am9am-5pm5-7pm7-9pm7-8amPerson1[C2,C3][C4,C5][C4][C1,C7][C1,C7]Person2[C2][C4,C5][C1][C6][C3]Person3[C2,C3][C4,C5][C6][C1,C7][C1,C7]C1:Eating{breakfast,dinner}C3:Exercising{gym,cycletowork}C4:WorkingorstudyingC5:Workingforatleast4hoursC6:ShoppingC2:Commuting{cycle/drivetowork}C7:Atleast2peopleeatingsimultaneously segments in the obtained flow diagrams show interesting patterns. We will give two examples. First we consider segmenting the morphology of formations of a defensive line of football players during a match (Fig. 5). The obtained flow diagram provides an intuitive summary of these formations. The second example models attacking possessions as state sequences. The summary given by the flow diagram gives intuitive information about differences in attacking tactics. Properties of Criteria. The efficiency of the algorithms will depend on prop- erties of the criteria on which the segmentations are based. Here we consider four cases: (i) general criteria without restrictions; (ii) monotone decreasing and independent criteria; (iii) monotone decreasing and dependent criteria; and (iv) fixed criteria. To illustrate the properties we will again use the example in Fig. 1. A criterion C is monotone decreasing [7] for a given sequence of states τ that fulfils C, if all subsequences of τ also fulfil C. For example, if C4 is fulfilled by a sequence τ then any subsequence τ(cid:48) of τ will also fulfil C4. This is in contrast to criterion C5 which is not monotone decreasing. A criterion C is independent if checking whether a subsequence τ(cid:48) of a sequence τi ∈ T fulfils C can be achieved without reference to any other sequences τj ∈ T , i (cid:54)= j. Conversely, C is dependent if checking that a subsequence τ(cid:48) of τi requires reference to other state sequences in T . In the above example C4 is an example of an independent criterion while C7 is a dependent criterion since it requires that at least two objects fulfil the criterion at the same time. Related work. To the best of our knowledge compactly representing sequences of states as flow diagrams has not been considered before. The only related work we are aware of comes from the area of trajectory analysis. Spatial trajectories are a special case of state sequences. A spatial trajectory describes the movement of an object through space over time, where the states are location points, which may also include additional information such as heading, speed, and temperature. For a single trajectory a common way to obtain a compact representation is simplification [9]. Trajectory simplification asks to determine a subset of the data that represents the trajectory well in terms of the location over time. If the focus is on characteristics other than the location, then segmentation [1,2,7] is used to partition a trajectory into a small number of subtrajectories, where each subtrajectory is homogeneous with respect to some characteristic. This allows a trajectory to be compactly represented as a sequence of characteristics. For multiple trajectories other techniques apply. A large set of trajectories might contain very unrelated trajectories, hence clustering may be used. Clus- tering on complete trajectories will not represent information about interesting parts of trajectories; for this clustering on subtrajectories is needed [5,12]. A set of trajectories that forms different groups over time may be captured by a grouping structure [6]. These approaches also focus on location over time. For the special case of spatial trajectories, a flow diagram can be illustrated by a simple example: trajectories of migrating geese, see [8]. The individual trajectories can be segmented into phases of activities such as directed flight, 3 foraging and stop overs. This results in a flow diagram containing a path for the segmentation of each trajectory. More complex criteria can be imagined that depend on a group of geese, or frequent visits to the same area, resulting in complex state sequences that are hard to analyze without computational tools. Organization In Section 3 we present algorithms for the Flow Diagram problem using criteria with the properties described above. These algorithms only run in polynomial time if the number of state sequences m is constant. Below we observe that this is essentially the best we can hope for by showing that the problem is W [1]-hard. Both theorems are proved in Section 2. Unless W [1] = F P T , this rules out the existence of algorithms with time complexity of O(f (m) · (nk)c) for some constant c, where m, n and k are the number of state sequences, the length of the state sequences and the number of criteria, respectively. To obtain flow diagrams for larger groups of state sequences we propose two heuristics for the problem in Section 3. We experimentally evaluate the algorithms and heuristics in Section 4. 2 Hardness Results In this section, the following hardness results are proven. Theorem 2. The FD problem is NP-hard. This even holds when only two criteria are used or when the length of every state sequence is 2. Furthermore, for any 0 < c < 1/4, the FD problem cannot be approximated within factor of c log m in polynomial time unless N P ⊂ DT IM E(mpolylog m). Also for bounded m the running times of our algorithms is rather high. Again, we can show that there are good reasons for this. Theorem 3. The FD problem parameterized in the number of state sequences is W [1]-hard even when the number of criteria is constant. To obtain the stated results we will perform two reductions; one from the Shortest Common Supersequence problem and one from the Set Cover problem. 2.1 Reduction from SCS Problem 4. Shortest Common Supersequence (SCS) Instance: A set of strings R = {r1, r2, . . . , rk} over an alphabet Σ, a positive integer λ. Question: Does there exist a string s ⊂ Σ∗ of length at most λ, that is a supersequence of each string in R? The SCS problem has been extensively studied over the last 30 years (see [10] and references therein). Several hardness results are known, we will use the following two. 4 (a) (b) Fig. 2: Examples of flow diagrams produced by the reductions: (a) From Shortest Common Supersequence. (b) From Set Cover. Lemma 5 (Pietrzak [16]). The Shortest Common Supersequence problem pa- rameterized in the number of Strings is W [1] hard even when the alphabet has constant size. Lemma 6 (Raiha and E. Ukkonen [18]). The Shortest Common Superse- quence problem over a binary alphabet is NP-complete. Given an instance I = (R = {r1, . . . , rm}, Σ) of SCS construct an instance of FD as follows. Each character cl in the alphabet Σ corresponds to a criterion cl. Each string ri corresponds to a state sequence Ti, where Ti[j] = cri[j]. Thus at any step Ti fulfils exactly one criterion. An algorithm for FD given an instance outputs a flow diagram F of size f . Given F one can compute a linear sequence b of the vertices of F using topological sort, as shown in Fig. 2a. The linear sequence b has f − 2 vertices (omitting the start and end state of F ) and it is a supersequence of each string in R. It follows that the size of F is λ if the number of characters in the SCS of I has length λ− 2. Note that F contains a linear sequence of vertices (after topological sort), which correspondence to a supersequence, and a set of directed edges. Consequently a solution for the FD problem can easily be transformed to a solution for the SCS problem but not vice versa. From the above reduction, together with Lemmas 5-6, we obtain Theorem 3 and the following. Lemma 7. The FD problem is NP-hard even for two criteria. 2.2 Reduction from Set Cover Problem 8. Set Cover (SC) Instance: A set of elements E = {e1, e2, . . . , em}, a set of n subsets of E, S = {S1, S2, . . . , Sn} and a positive integer λ. Question: Does there exist set of λ items in S whose union equals E? 5 stts Set Cover is well known to be NP-hard, and also hard to approximate: Lemma 9 (Lund and Yannakakis [15]). For any 0 < c < 1/4, the Set Covering problem cannot be approximated within factor of c log m in polynomial time unless N P ⊂ DT IM E(mpolylogm). Given an instance I = (E = {e1, e2, . . . , em}, S = {S1, S2, . . . , Sn}) of Set Cover construct an instance of FD as follows. Each item ei in E corresponds to a state sequence Ti of length two. Each subset Sj corresponds to a criterion Cj. If a Sj contains ei then the whole state sequence Ti fulfils criterion Cj. An algorithm for FD given the new instance outputs a flow diagram F of size f . The output F is depicted in Fig. 2b. Given F the interior vertices of F corresponds to a set of subsets in S whose union is E. The diagram F has f vertices if and only there is f − 2 subsets in S that forms a Set Cover of E. We obtain Theorem 2 from the above reduction, together with Lemma 9. 3 Algorithms In this section, we present algorithms that compute a smallest flow diagram representing a set of m state sequences of length n for a set of k criteria. First, we present an algorithm for the general case, followed by more efficient algorithms for the case of monotone increasing and independent criteria, the case of monotone increasing and dependent criteria, and then two heuristic algorithms. 3.1 General criteria Next, we present a dynamic programming algorithm for finding a smallest flow diagram. Recall that a node v in the flow diagram represents a criterion Cj that is fulfilled by a contiguous segment in some of the state sequences. Let τ [i, j], i ≤ j, denote the subsequence of τ starting at the ith state of τ and ending at the jth state, where τ [i, i] is the empty sequence. Construct an (n + 1)m grid of vertices, where a vertex with coordinates (x1, . . . , xm), 0 ≤ x1, . . . , xm ≤ n, represents (τ1[0, x1], . . . , τm[0, xm]). Construct a prefix graph G as follows: 1, . . . , x(cid:48) m), labeled by some criterion Cj, if and only if, for every i, 1 ≤ i ≤ m, one of the following two conditions is fulfilled: (1) xi = x(cid:48) i, or (2) all remaining τi[xi + 1, x(cid:48) i] jointly fulfil Cj. Consider the edge between (x1, x2) = (1, 0) and (x(cid:48) 2) = (1, 1) in Fig. 3(b). Here x1 = x(cid:48) There is an edge between two vertices v = (x1, . . . , xm) and v(cid:48) = (x(cid:48) 1, x(cid:48) 1 and τ2[x2 + 1, x(cid:48) 2] fulfils C2. Finally, define vs to be the vertex in G with coordinates (0, . . . , 0) and add an additional vertex vt outside the grid, which has an incoming edge from (n, . . . , n). This completes the construction of the prefix graph G. Now, a path in G from vs to a vertex v represents a valid segmentation of some prefix of each state sequence, and defines a flow diagram that describes these segmentations in the following way: the empty path represents the flow diagram consisting only of the start node s. Every edge of the path adds one new node to the flow diagram, labeled by the criterion that the segments fulfil. Additionally, 6 Fig. 3: (a) A segmentation of T = {τ1, τ2} according to C = {C1, C2, C3}. (b) The prefix graph G of the segmentation, omitting all but four of the edges. (c) The resulting flow diagram generated from the highlighted path in the prefix graph. for each node the flow diagram contains an edge from every node representing a previous segment, or from s if the node is the first in a segmentation. For a path leading from vs to vt, the target node t is added to the flow diagram, together with its incoming edges. This ensures that the flow diagram represents valid segmentations and that each node represents at least one segment. An example of this construction is shown in Fig. 3. Hence the length of a path (where length is the number of edges on the path) equals the number of nodes of the corresponding flow diagram, excluding s and t. Thus, we find an optimal flow diagram by finding a shortest vs -- vt path in G. Lemma 10. A smallest flow diagram for a given set of state sequences is repre- sented by a shortest vs -- vt path in G. Proof. We show that every vs -- vt path P in G represents a valid flow diagram F , with the path length equal to the flow diagram's cost, and vice versa. Thus, a shortest path represents a minimal valid flow diagram for the given state sequences. Let P := (vs =: v1, v2, . . . , v(cid:96) := vt) be a vs -- vt path of length (cid:96) − 1 in G. As described in the text, every vs -- vt path in G represents a valid flow diagram, and every vertex visited by the path contributes exactly one node to the flow diagram. Thus, P represents a valid flow diagram with exactly (cid:96) nodes. For the other direction, let F be a valid flow diagram of a set of state sequences {T1, . . . , Tm}, each of length n. That is, there are segmentations S1, . . . ,Sm of the state sequences such that every segmentation is represented in F in the following way: assume the nodes of F are {s =: f1, f2, . . . , f(cid:96) := t} according to some topological sorting. Let Sj consist of the segments sj,1, . . . , sj,σj , where σj is the number of segments in Sj. Then there exists a path (s =: fj,0, fj,1, . . . , fj,σj , t) in F such that each segment sj,i fulfils the criterion C(fj,i) associated with fj,i. Let bj,i be the index in Tj at which sj,i ends, for 1 ≤ i ≤ σj, and let bj,0 := 1. Since Sj is a segmentation of Tj, bj,σj = n. Let Fλ be the subdiagram of F induced by (f1, . . . , fλ), for 1 ≤ λ ≤ (cid:96). We define xj,λ := max{bj,i fj,i ∈ {f1, . . . , fλ}}. We show inductively that for each λ ∈ {1, 2, . . . , (cid:96)}, G contains a path from vs 7 (a)(b)(c)231τ1[C1][C3][C1]τ2[C1,C2][C3][C2]sτ2τ1001122vtvsC2C3C1C1C2C3t to the vertex vλ := (x1,λ, . . . , xm,λ) with length λ − 1, i.e. the number of nodes in Fλ excluding s. -- Base case λ = 1: Note that v1 = vs, and thus there is a path of length λ − 1 = 0 from vs to v1. -- Induction step: The node fλ+1 represents the segments {Tj[xj,λ, xj,λ+1] 1 ≤ j ≤ m ∧ xj,λ (cid:54)= xj,λ+1}. Since the flow diagram is valid, these segments fulfil the criterion C(fλ+1), and thus G contains an edge from vλ to vλ+1. Since a path from vs to vλ of length λ exists by the induction hypothesis, there is a path from vs to vλ+1 of length λ + 1. For every state sequence Tj, there exists an index ϕj ∈ {1, . . . , (cid:96) − 1} such that xj,λ = n for all λ ≥ ϕj. Thus, v(cid:96)−1 = (n, n, . . . , n) and G contains an edge from v(cid:96)−1 to v(cid:96) = vt. So, there is a path from vs to vt of length (cid:96) − 1. (cid:117)(cid:116) Recall that G has (n + 1)m vertices. Each vertex has O(k(n + 1)m) outgoing edges, thus, G has O(k(n + 1)2m) edges in total. To decide if an edge is present in G, check if the nonempty segments the edge represents fulfil the criterion. Thus, we need to perform O(k(n + 1)2m) of these checks. There are m segments of length at most n, and we assume the cost for checking this is T (m, n). Thus, the cost of constructing G is O(k(n + 1)2m · T (m, n)), and finding the shortest path requires O(k(n + 1)2m) time. Theorem 11. The algorithm described above computes a smallest flow diagram for a set of m state sequences, each of length at most n, and k criteria in O((n + 1)2mk · T (m, n)) time, where T (m, n) is the time required to check if a set of m subsequences of length at most n fulfils a criterion. 3.2 Monotone decreasing and independent criteria If all criteria are decreasing monotone and independent, we can use ideas similar to those presented in [7] to avoid constructing the full graph. From a given vertex with coordinates (x1, . . . , xm), we can greedily move as far as possible along the sequences, since the monotonicity guarantees that this never leads to a solution that is worse than one that represents shorter segments. For a given criterion Cj, we can compute for each τi independently the maximum x(cid:48) i such that τi[xi + 1, x(cid:48) i] fulfils Cj. This produces coordinates (x(cid:48) m) for a new vertex, which is the optimal next vertex using Cj. By considering all criteria we obtain k new vertices. However, unlike the case with a single state sequence, there is not necessarily one vertex that is better than all others (i.e. largest ending position), since there is no total order on the vertices. Instead, we consider all vertices that are not dominated by another vertex, where a vertex p dominates a vertex p(cid:48) if each coordinate of p is at least as large as the corresponding coordinate of p(cid:48), and at least one of p's coordinates is larger. 1, . . . , x(cid:48) 8 Let Vi be the set of vertices of G that are reachable from vs in exactly i steps, and define M (V ) := {v ∈ V no vertex u ∈ V dominates v} to be the set of maximal vertices of a vertex set V . Then a shortest vs -- vt path through G can be computed by iteratively computing M (Vi) for increasing i, until a value of i is found for which vt ∈ M (Vi). Observe that M (V ) = O((n + 1)m−1) for any set V of vertices in the graph. Also note that V0 = M (V0) = vs. Lemma 12. For each i ∈ {1, . . . , (cid:96) − 1}, every vertex in M (Vi) is reachable in one step from a vertex in M (Vi−1). Here, (cid:96) is the distance from vs to vt. Proof. Assume there exists a vertex v ∈ M (Vi) that has no edge from a vertex in M (Vi−1). Since v ∈ M (Vi), v is also contained in Vi, and thus its distance from vs is i. Thus, there must be a vertex v(cid:48) at distance i − 1 from vs, i.e. v(cid:48) ∈ Vi−1, that has an edge to v representing a criterion Cj. By assumption, v(cid:48) is not contained in M (Vi−1), and thus there is a vertex v(cid:48)(cid:48) ∈ M (Vi−1) that dominates v(cid:48). But then, by the monotonicity of Cj, there must be a vertex reachable from v(cid:48)(cid:48) that (cid:117)(cid:116) is identical to v or dominates v. Both cases lead to a contradiction. M (Vi) is computed by computing the farthest reachable vertex for each v ∈ M (Vi−1) and criterion, thus yielding a set Di of O((n + 1)m−1k) vertices. This set contains M (Vi) by Lemma 12, so we now need to remove all vertices that are dominated by some other vertex in the set to obtain M (Vi). We find M (Vi) using a copy of G. Each vertex may be marked as being in Di or dominated by a vertex in Di. We process the vertices of Di in arbitrary order. For a vertex v, if it is not yet marked, we mark it as being in Di. When a vertex is newly marked, we mark its ≤ m immediate neighbours dominated by it as being dominated. After processing all vertices, the grid is scanned for the vertices still marked as being in Di. These vertices are exactly M (Vi). When computing M (Vi), O((n + 1)m−1k) vertices need to be considered, and the maximum distance from vs to vt is m(n + 1), so the algorithm considers O(mk(n+1)m) vertices. We improve this bound by a factor m using the following: Lemma 13. The total size of all Di, for 0 ≤ i ≤ (cid:96) − 1, is O(k(n + 1)m). Proof. If a vertex v appears in M (Vi) for some i ∈ {0, . . . , (cid:96) − 1}, it generates vertices for Di+1 that dominate v, and thus v (cid:54)∈ M (Vi+j) for any j > 0. So, each of the nm vertices appears in at most one M (Vi) and generates k candidate vertices for Di+1 (not all unique). Hence the total size of all Di is O(knm). (cid:117)(cid:116) Using this result, we compute all M (Vi) in O((k + m)(n + 1)m) time, since O(k(n + 1)m) vertices are marked directly, and each of the (n + 1)m vertices is checked at most m times when a direct successor is marked. One copy of the grid can be reused for each M (Vi), since each vertex of Di+1 dominates at least one vertex of M (Vi) and is thus not yet marked while processing Dj for any j ≤ i. Since the criteria are independent, the farthest reachable point for a given starting point and criterion can be precomputed for each state sequence separately. Using the monotonicity we can traverse each state sequence once per criterion and thus need to test only O(nmk) times whether a subsequence fulfils a criterion. 9 Theorem 14. The algorithm described above computes a smallest flow diagram for m state sequences of length n with k independent and monotone decreasing criteria in O(mnk · T (1, n) + (k + m)(n + 1)m) time, where T (1, n) is the time required to check if a subsequence of length at most n fulfils a criterion. 3.3 Monotone decreasing and dependent criteria For monotone decreasing and dependent criteria, we can use a similar approach to that described above, however, for a given start vertex v and criterion C, there is not a single vertex v(cid:48) that dominates all vertices reachable from v using this criterion. Instead there may be Θ((n + 1)m−1) maximal reachable vertices from v for criterion C. The maximal vertices can be found by testing O((n + 1)m−1) vertices on or near the upper envelope of the reachable vertices in O((n + 1)m−1 · T (m, n)) time. Using a similar reasoning as in Lemma 13, we can show that the total size of all Di (0 ≤ i ≤ (cid:96) − 1) is O(k(n + 1)2m−1), which gives: Theorem 15. The algorithm from the previous section computes a smallest flow diagram for m state sequences of length n with k monotone decreasing criteria in O(k(n + 1)2m−1 · T (m, n) + m(n + 1)m) time, where T (m, n) is the time required to check if a set of m subsequences of length at most n fulfils a criterion. 3.4 Heuristics The hardness results presented in the introduction indicate that it is unlikely that the performance of the algorithms will be acceptable in practical situations, except for very small inputs. As such, we investigated heuristics that may produce usable results that can be computed in reasonable time. For monotone decreasing and independent criteria, the heuristics we consider are based on the observation that by limiting Vi, the vertices that are reachable from vs in i steps, to a fixed size, the complexity of the algorithm can be controlled. Given that every path in a prefix graph represents a valid flow diagram, any path chosen in the prefix graph will be valid, though not necessarily optimal. In the worst case, a vertex that advances along a single state sequence a single time-step (i.e. advancing only one state) will be selected, and for each vertex, all k criteria must be evaluated, so O(kmn) vertices may be processed by the algorithm. We consider two strategies for selecting the vertices in Vi to retain: (1) For each vertex in Vi, determine the number of state sequences that are advanced in step i and retain the top q vertices [sequence heuristic]. (2) For each vertex in Vi, determine the number of time-steps that are advanced in all state sequences in step i and retain the top q vertices [time-step heuristic]. In our experiments we use q = 1 since any larger value would immediately give an exponential worst-case running time. 4 Experiments The objectives of the experiments were twofold: to determine whether compact and useful flow diagrams could be produced in real application scenarios; and to 10 empirically investigate the performance of the algorithms on inputs of varying sizes. We implemented the algorithms described in Section 3 using the Python programming language. For the first objective, we considered the application of flow diagrams to practical problems in football analysis in order to evaluate their usefulness. For the second objective, the algorithms were run on generated datasets of varying sizes to investigate the impact of different parameterisations on the computation time required to produce the flow diagram and the complexity of the flow diagram produced. 4.1 Tactical Analysis in Football Sports teams will apply tactics to improve their performance, and computational methods to detect, analyse and represent tactics have been the subject of several recent research efforts [4,11,14,19,20,21]. Two manifestations of team tactics are in persistent and repeated occurrence of spatial formations of players, and in plays -- a coordinated sequence of actions by players. We posited that flow diagrams would be a useful tool for compactly representing both these manifestations, and we describe the approaches used in this section. The input for the experiments is a database containing player trajectory and event data from four home matches of the Arsenal Football Club from the 2007/08 season, provided by Prozone Sports Limited [17]. For each player and match, there is a trajectory comprising a sequence of timestamped location points in the plane, sampled at 10 Hz and accurate to 10 cm. In addition, for each match, there is a log of all the match events, comprising the timestamp and location of each event. Defensive Formations. The spatial formations of players in football matches are known to characterize a team's tactics [3], and a compact representation of how formations change over time would be a useful tool for analysis. We investigated whether a flow diagram could provide such a compact representation of the defensive formation of a team, specifically to show how the formation evolves during a phase of play. The trajectories of the four defensive players were re-sampled at one-second intervals and used to compute a sequence of formation states which were then segmented to model the formation. The criteria were derived from those presented by Kim et al. [13]. The angles between pairs of adjacent players (along the defence line) were used to compute the formation criteria, see Fig 4. We extended this scheme to allow multiple criteria to be applied where the angle between pairs of players is close to 10◦. The reason for this was to facilitate compact results by allowing for smoothing of small variations in contiguous time-steps. The criteria applied to each state is a triple (x1, x2, x3), computed as follows. Given two player positions p and q, let ∠pq be the angle between p and q relative to the goal-line. Let R(−1) = [−90◦,−5◦), R(0) = (−15◦, +15◦), and R(+1) = (+5◦, +90◦] be three angular ranges. The (x1, x2, x3) if ∠pipi+1 ∈ R(xi) for all i ∈ {1, 2, 3}. positions of the four defenders satisfy the criteria (and thus have the formation) 11 Fig. 4: Segmentation of a single state sequence. The formation state sequence is used to compute the segmentation representation, where segments corresponding to criteria span the state sequence (bottom). The representation of this state sequence in the movement flow diagram is shaded in Fig. 5. Fig. 5: Flow diagram for formation morphologies of twelve defensive possessions. The shaded nodes are the segmentation of the state sequence in Fig. 4. The criteria in this experiment were monotone decreasing and independent, and we ran the corresponding algorithm using randomly selected sets of the state sequences as input. The size m of the input was increased until the running time exceeded a threshold of 6 hours. The algorithm successfully processed up to m = 12 state sequences, having a total of 112 assigned segments. The resulting flow diagram, Fig. 5, has a total complexity of 12 nodes and 27 edges. We believe that the flow diagram provides an intuitive summary of the defensive formation, and several observations are apparent. There appears to be a preference amongst the teams for the right-back to position himself in advance of the right centre-half (i.e. the third component of the triple is +1). Furthermore, the (0, 0, 0) triple, corresponding to a "flat back four" is not present 12 012345678910Trajectory Timestep(+1,0,+1)(+1,-1,+1)(0,+1,+1)(0,0,+1)(0,-1,+1)(-1,+1,+1)(-1,0,+1)(-1,-1,+1)Criteria3422222422st in the diagram. This is typically considered the optimal formation for teams that utilise the offside trap, and thus may suggest that the defences here are not employing this tactic. These observations were apparent to the authors as laymen, and we would expect that a domain expert would be able to extract further useful insights from the flow diagrams. Attacking Plays. During a football match, the team in possession of the ball is attempting to reach a position where they can take a shot at goal. Teams will typically use a variety of tactics to achieve such a position, e.g. teams can vary the intensity of an attack by pushing forward, moving laterally, making long passes, or retreating. We modelled attacking possessions as state sequences, segmented according to criteria representing the attacking intensity and tactics employed, and computed flow diagrams for the possessions. In particular, we were interested in determining whether differences in tactics employed by teams when playing at home or away [4] are apparent in the flow diagrams. We focus on ball events, where a player touches the ball, e.g. passes, touches, dribbles, headers, and shots at goal. The event sequence for each match was divided into sub-sequences where a single team was in possession, and then filtered to include only those that end with a shot at goal. We defined criteria that characterised the movement of the ball - relative to the goal the team is attacking - between event states in the possession sequence. The applied criteria are defined as follows. Let xi, yi, ti be the x-coordinate in metres, y-coordinate in metres and time-stamp in seconds, respectively, for event i. The velocity of the ball in the x-direction at event i, which is in the direction of the goal, is thus xv = (xi+1 − xi)/(ti+i − ti) in m/s. The velocity yv of the ball in the y direction is computed in a similar fashion, and together are used to specify the following criteria. -- Backward movement (BM): xv < 1, a sub-sequence of passes or touches that move in a defensive direction. lateral direction. -- Lateral movement (LM): −5 < xv < 5, passes or touches that move in a -- Forward movement (FM): −1 < xv < 12, passes or touches that move in an attacking direction, at a velocity in the range achievable by humans, i.e. to approximately 10m/s. -- Fast forward movement (FFM): 8 < xv, passes or touches moving in an attacking direction at a velocity generally in exceeds of maximum human velocity. -- Long ball (LB): a pass travelling 30m in the attacking direction. -- Cross-field ball (CFB): a pass travelling 20m in the cross-field direction, and that has angle in range [80, 100] or [−80,−100]. -- Shot resulting in goal (SG): a successful shot resulting in a goal. -- Shot not resulting in goal (SNG): an unsuccessful shot that does not produce a goal. 13 Fig. 6: Flow diagram produced for the home team. The edge weights are the number of possessions that span the edge, and the nodes with grey background are event types that are significant, as defined in Section 4.1. For a football analyst, the first four criteria are simple movements, and are not particularly interesting. The last four events are significant: the long ball and cross-field ball change the locus of attack; and the shot criteria represent the objective of an attack. The possession state sequences for the home and visiting teams were segmented according to the criteria and the time-step heuristic algorithm was used to compute the flow diagrams. The home-team input consisted of 66 sequences covered by a total of 866 segments, and resulted in a flow diagram with 25 nodes and 65 edges, see Fig. 6. Similarly, the visiting-team input consisted of 39 state sequences covered by 358 segments and the output flow diagram complexity was 22 nodes and 47 edges, as shown in Fig. 7. At first glance, the differences between these flow diagrams may be difficult to appreciate, however closer inspection reveals several interesting observations. The s -- t paths in the home-team flow diagram tend to be longer than those in the visiting team's, suggesting that the home team tends to retain possession of the ball for longer, and varies the intensity of attack more often. Moreover, the 14 sBM41FM21FFM4303CFB2SG2SNG47126BM351LM15BM4FM2FM7t759318FM23218BM10LB231114BM2FM3113274FFM129110BM4FM221131BM41FM31BM2222BM112 Fig. 7: Flow diagram produced for the visiting team. The edge weights are the number of possessions that span the edge, and the nodes with grey background are event types that are significant, as defined in Section 4.1. nodes for cross-field passes and long-ball passes tend to occur earlier in the s -- t paths in the visiting team's flow diagram. These are both useful tactics as they alter the locus of attack, however they also carry a higher risk. This suggests that the home team is more confident in its ability to maintain possession for long attack possessions, and will only resort to such risky tactics later in a possession. Furthermore, the tactics used by the team in possession are also impacted by the defensive tactics. As Bialkowski et al [4] found, visiting teams tend to set their defence deeper, i.e. closer to the goal they are defending. When the visiting team is in possession, there is thus likely to be more space behind the home team's defensive line, and the long ball may appear to be a more appealing tactic. The observations made from these are consistent with our basic understanding of football tactics, and suggest that the flow diagrams are interpretable in this application domain. 4.2 Performance Testing In the second experiment, we used a generator that outputs synthetic state sequences and segmentations, and tested the performance of the algorithms on inputs of varying sizes. The segmentations were generated using Markov Chain Monte Carlo sampling. Nodes representing the criteria set of size k were arranged in a ring and a Markov chain constructed, such that each node had a transition probability of 0.7 to 15 sBM28FM1121SNG3FFM2LB1SG1733BM17CFB2t373BM5FM4252FM10BM1LM12BM811LM5FM1411BM3FFM124111FM22LM2111212 remain at the node, 0.1 to move to the adjacent node, and 0.05 to move to the node two places away. Segmentations were computed by sampling the Markov chain starting at a random node. Thus, simulated datasets of arbitrary size m, state sequence length n, criteria set size k were generated. We performed two tests on the generated segmentations. In the first, ex- periments were run on the four algorithms described in Section 3 with varying configurations of m, n and k to investigate the impact of input size on the algorithm's performance. The evaluation metric used was the CPU time required to generate the flow diagram for the input. In the second test, we compared the total complexity of the output flow diagram produced by the two heuristic algorithms with the baseline complexity of the flow diagram produced by the exact algorithm for monotone increasing and independent criteria. We repeated each experiment five times with different input sequences for each trial, and the results presented are the mean values of the metrics over the trials. Limits were set such that the process was terminated if the CPU time exceeded 1 hour, or the memory required exceeded 8GB. The results of the first test showed empirically that the exact algorithms have time and storage complexity consistent with the theoretical worst-case bounds, Fig. 8 (top). The heuristic algorithms were subsequently run against larger test data sets to examine the practical limits of the input sizes, and were able to process larger input -- for example, an input of k = 128, m = 32 and n = 1024 was tractable -- although the cost is that the resulting flow diagrams were suboptimal, but correct, in terms of their total complexity. For the second test, we investigated the complexity of the flow diagram induced by inputs of varying parameterisations when using the heuristic algorithms. The objective was to examine how close the complexity was to the optimal complexity produced using an exact algorithm. The inputs exhibited monotone decreasing and independent criteria, and thus the corresponding algorithm was used to produce the baseline. Fig. 8 (bottom) summarises the results for varying input parameterisations. The complexity of the flow diagrams produced by the two heuristic algorithms are broadly similar, and increase at worst linearly as the input size increases. Moreover, while the complexity is not optimal it appears to remain within a constant factor of the optimal, suggesting that the heuristic algorithms could produce usable flow diagrams for inputs where the exact algorithms are not tractable. 5 Concluding Remarks We introduced flow diagrams as a compact representation of a large number of state sequences. We argued that this representation gives an intuitive summary allowing the user to detect patterns among large sets of state sequences, and gave several algorithms depending on the properties of the segmentation criteria. These algorithms only run in polynomial time if the number of state sequences m is constant, which is the best we can hope for given the problem is W [1]-hard. As a result we considered two heuristics capable of processing large data sets in 16 Fig. 8: Runtime statistics for generating flow diagram (top), and total complexity of flow diagrams produced (bottom). Default values of m = 4, n = 4 and k = 10 were used. The data points are the mean value and the error bars delimit the range of values over the five trials run for each input size. reasonable time, however we were unable to give an approximation bound. We tested the algorithms experimentally to assess the utility of the flow diagram representation in a sports analysis context, and also analysed the performance of the algorithms of inputs of varying parameterisations. References 1. S. P. A. Alewijnse, K. Buchin, M. Buchin, A. Kolzsch, H. Kruckenberg, and M. Westenberg. A framework for trajectory segmentation by stable criteria. In Proc. 22nd ACM SIGSPATIAL/GIS, pages 351 -- 360. ACM, 2014. 2. B. Aronov, A. Driemel, M. J. van Kreveld, M. Loffler, and F. Staals. Segmentation of trajectories for non-monotone criteria. In Proc. 24th ACM-SIAM SODA, pages 1897 -- 1911, 2013. 3. A. Bialkowski, P. Lucey, G. P. K. Carr, Y. Yue, S. Sridharan, and I. Matthews. Identifying team style in soccer using formations learned from spatiotemporal tracking data. In ICDM Workshops, pages 9 -- 14. IEEE, 2014. 4. A. Bialkowski, P. Lucey, P. Carr, Y. Yue, and I. Matthews. Win at home and draw away: automatic formation analysis highlighting the differences in home and away team behaviors. In Proc. 8th Annual MIT Sloan Sports Analytics Conference, 2014. 17 2468101214161820Criteria Set Size k10-410-310-210-1100101102103104Execution time in sec (log)2468101214161820Number of State Sequences m10-410-310-210-1100101102103104Execution time in sec (log)12345678910State Sequence Length n10-410-310-210-1100101102103104Execution time in sec (log)General CriteriaMonotone Decreasing and Independent CriteriaSegment HeuristicTimestep Heuristic212223242526272829210Criteria Set Size k (log2)10121416182022Flow Diagram Complexity212223242526272829210Number of State Sequences m (log2)020406080100120140160Flow Diagram Complexity212223242526272829210State Sequence Length n (log2)05001000150020002500Flow Diagram Complexity 5. K. Buchin, M. Buchin, J. Gudmundsson, M. Loffler, and J. Luo. Detecting com- muting patterns by clustering subtrajectories. Int. J. Comput. Geometry Appl., 21(3):253 -- 282, 2011. 6. K. Buchin, M. Buchin, M. J. van Kreveld, B. Speckmann, and F. Staals. Trajectory grouping structure. In Proc. 13th WADS, pages 219 -- 230, 2013. 7. M. Buchin, A. Driemel, M. van Kreveld, and V. Sacristan. Segmenting trajectories: A framework and algorithms using spatiotemporal criteria. Journal of Spatial Information Science, 3:33 -- 63, 2011. 8. M. Buchin, H. Kruckenberg, and A. Kolzsch. Segmenting trajectories based on movement states. In Proc. 15th SDH, pages 15 -- 25. Springer-Verlag, 2012. 9. H. Cao, O. Wolfson, and G. Trajcevski. Spatio-temporal data reduction with deterministic error bounds. The VLDB Journal, 15(3):211 -- 228, 2006. 10. C. B. Fraser and R. W. Irving. Approximation algorithms for the shortest common supersequence. Nordic Journal of Computing, 2(3):303 -- 325, 1995. 11. J. Gudmundsson and T. Wolle. Football analysis using spatio-temporal tools. Computers, Environment and Urban Systems, 47:16 -- 27, 2014. 12. C.-S. Han, S.-X. Jia, L. Zhang, and C.-C. Shu. Sub-trajectory clustering algorithm based on speed restriction. Computer Engineering, 37(7), 2011. 13. H.-C. Kim, O. Kwon, and K.-J. Li. Spatial and spatiotemporal analysis of soccer. In Proc. 19th ACM SIGSPATIAL/GIS, pages 385 -- 388. ACM, 2011. 14. P. Lucey, A. Bialkowski, G. P. K. Carr, S. Morgan, I. Matthews, and Y. Sheikh. Representing and Discovering Adversarial Team Behaviors Using Player Roles. In Proc. IEEE Conference on Computer Vision and Pattern Recognition (CVPR'13), pages 2706 -- 2713, Portland, OR, jun 2013. IEEE. 15. C. Lund and M. Yannakakis. On the hardness of approximating minimization problems. In Proc. 25th ACM STOC, pages 286 -- 293. ACM, 1993. 16. K. Pietrzak. On the parameterized complexity of the fixed alphabet shortest common supersequence and longest common subsequence problems. Journal of Computer and System Sciences, 67(4):757 -- 771, 2003. 17. Prozone Sports Ltd. Prozone Sports - Our technology. http://prozonesports. stats.com/about/technology/, 2015. 18. K.-J. Raiha and E. Ukkonen. The shortest common supersequence problem over binary alphabet is NP-complete. Theoretical Computer Sci., 16(2):187 -- 198, 1981. 19. J. Van Haaren, V. Dzyuba, S. Hannosset, and J. Davis. Automatically Discovering Offensive Patterns in Soccer Match Data. In Advances in Intelligent Data Analysis XIV - 14th International Symposium, IDA 2015, volume 9385 of Lecture Notes in Computer Science, pages 286 -- 297, Saint Etienne, oct 2015. Springer. 20. Q. Wang, H. Zhu, W. Hu, Z. Shen, and Y. Yao. Discerning Tactical Patterns for Professional Soccer Teams. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining - KDD '15, pages 2197 -- 2206, Sydney, aug 2015. ACM Press. 21. X. Wei, L. Sha, P. Lucey, S. Morgan, and S. Sridharan. Large-Scale Analysis In 2013 International Conference on Digital Image of Formations in Soccer. Computing: Techniques and Applications (DICTA), pages 1 -- 8, Hobart, nov 2013. IEEE. 18
1408.0596
3
1408
2015-10-31T14:58:04
Approximation Bounds For Minimum Degree Matching
[ "cs.DS" ]
We consider the MINGREEDY strategy for Maximum Cardinality Matching. MINGREEDY repeatedly selects an edge incident with a node of minimum degree. For graphs of degree at most $\Delta$ we show that MINGREEDY achieves approximation ratio at least $ \frac{\Delta-1}{2\Delta-3} $ in the worst case and that this performance is optimal among adaptive priority algorithms in the vertex model, which include many prominent greedy matching heuristics. Even when considering expected approximation ratios of randomized greedy strategies, no better worst case bounds are known for graphs of small degrees.
cs.DS
cs
Approximation Bounds For Minimum Degree Matching Bert Besser⋆ Institut für Informatik, Goethe-Universität Frankfurt am Main, Germany Abstract. We consider the MinGreedy strategy for Maximum Cardi- nality Matching. MinGreedy repeatedly selects an edge incident with a node of minimum degree. For graphs of degree at most ∆ we show that MinGreedy achieves approximation ratio at least ∆−1 2∆−3 in the worst case and that this performance is optimal among adaptive priority al- gorithms in the vertex model, which include many prominent greedy matching heuristics. Even when considering expected approximation ratios of randomized greedy strategies, no better worst case bounds are known for graphs of small degrees. Keywords: matching, greedy, approximation, priority algorithm. 1 Introduction In the Maximum Cardinality Matching Problem a node disjoint subset of edges of maximum size is to be determined. Matching problems have many applications, e.g. image feature matching in computer vision or protein structure comparison in computational biology. A maximum matching can be found in polynomial time, e.g. by the algorithm of Micali and Vazirani [MV80] running in time O(pV · E · α(E,V )) where α(E,V ) is the inverse Ackermann function [Vaz12]. The algorithm of Mucha and Sankowski [MS04] runs asymptotically faster on dense graphs, its runtime is O(V ω) where ω < 2.38 is the exponent needed to perform matrix multiplication. However, there are much faster greedy algorithms that in practice compute very large matchings, even near optimal ones. Very good approximate solutions may already be satisfactory in some applications. If maximum matchings are needed, one can save lots of runtime when feeding large greedy matchings into optimal algorithms which iteratively improve an initial solution. MinGreedy. The (randomized) MinGreedy algorithm computes a match- ing M by repeatedly picking edges incident to nodes of currently minimum de- gree, see Figure 1. MinGreedy can be implemented in linear time O(V +E). The experimentally observed approximation performance is quite impres- sive. Tinhofer [Tin84] observed that on random graphs of varying density Min- Greedy performed superior to Greedy (which randomly selects an edge) and to MRG (which randomly selects a node and subsequently an incident edge). In experiments of Frieze et al. [FRS93] on random cubic graphs MinGreedy left only about 10 out of 106 nodes unmatched. On random graphs of small constant ⋆ Partially supported by DFG SCHN 503/6-1. M = ∅ repeat until all edges removed from input graph: select (random) node u of minimum non-zero degree select (random) neighbor v of u pick edge {u, v}, i.e. set M = M ∪ {{u, v}} remove all edges incident with u and v from input graph return M Fig. 1. The (randomized) MinGreedy algorithm average degree Magun [Mag97] observed that MinGreedy produces extremely few "lost edges" in comparison with an optimal solution. 1 In an involved argument, Frieze et al. [FRS93] showed that c1 · n 5 ≤ λn ≤ c2 · n 5 · ln(n) holds (c1, c2 being constants) for the expected number λn of nodes not being matched by MinGreedy on random n-node cubic graphs. Whereas the performance of MinGreedy on random instances is very good, its worst case performance is poor. Poloczek [Pol12] constructed hard input instances on which MinGreedy (and common variations of the algorithm) achieves approximation ratio at most 1 2 + o(1) w.h.p. 1 MRG, Greedy & Shuffle. The Modified Random Greedy algorithm, abbreviated MRG in literature, ignores node degrees and repeatedly selects a node and then a neighbor uniformly at random. The expected approximation ratio was shown to be at least 1 400.000 by Aronson et al. [ADFS95]. 2 + 1 The random edge algorithm Greedy repeatedly selects an edge uniformly at random. For graphs with degrees bounded by ∆ an expected lower bound on the approximation ratio of ∆ 2∆−1 was shown by Dyer and Frieze [DF91] and later improved by Miller and Pritikin [MP97] to 1 prefers edges of degree-1 nodes, the KarpSipser algorithm is obtained, which is asymptotically optimal w.h.p. on large sparse random graphs [KS81]. 2 (p(∆ − 1)2 + 1−∆+2). If Greedy The Shuffle algorithm, proposed by Goel and Tripathi [GT12], is an adap- tation of the Ranking algorithm of Karp et al. [KVV90] to non-bipartite graphs. Shuffle selects a random permutation π of the nodes and repeatedly matches the, according to π, first non-isolated node to its first unmatched neighbor. Chan et al. [CCWZ14] showed that Shuffle achieves an approximation ratio of at least 2 · (5 − √7)/9 ≈ 0.523. Inapproximability. To show performance bounds for greedy algorithms, Borodin et al. [BNR02] proposed the model of adaptive priority algorithms. The model formalizes the greedy nature of an algorithm: while gathering knowledge about the input, irrevocable decisions have to be made to construct a solution. Davis and Impagliazzo [DI04] introduced the vertex model to study adaptive priority algorithms for graph problems. Adaptive priority algorithms in the ver- tex model for the matching problem, which we call APV-algorithms, implement powerful node and edge selection routines. In particular, in each step a node v and an incident edge is not picked arbitrarily but based on all knowledge already gathered about v and its neighbors, e.g. is a neighbor matched or unmatched, 2 what is the degree of a neighbor, what are the neighbors of a neighbor, etc. APV-algorithms include Greedy, KarpSipser, MRG, MinGreedy, Shuf- fle and all vertex iterative algorithms, a class of algorithms defined in [GT12] as a generalization of Shuffle. Despite the strength of APV-algorithms, Poloczek [Pol12] constructed rather simple graphs with worst case approximation ratio at most 2 3 . (He also showed an inapproximability bound of 5 6 for randomized priority algorithms.) Presented in the same thesis, for graphs with arbitrarily large degree Besser and Poloczek showed that no APV-algorithm achieves worst case approximation ratio better than 1 2 + o(1). Contributions. From now on we reserve the name MinGreedy for the deterministic version of MinGreedy in which a node of minimum degree and an incident edge is picked by a worst case adversary. We show that MinGreedy approximates an optimal matching within a fac- tor of ∆−1 2∆−3 for graphs in which degrees are bounded by at most ∆. In the proof we analyze a variant of MinGreedy which is also related with the KarpSipser algorithm. We also show that the worst case approximation performance of MinGreedy is optimal for (deterministic) APV-algorithms. In particular, we improve the construction of Besser and Poloczek given in [Pol12] and present hard input in- stances of degree at most ∆ for which any APV-algorithm computes a matching of size at most ∆−1 2∆−3 + o(1) times optimal. Our worst case performance guarantees are stronger than the best known 400.000 resp. bounds on the expected performance of MRG and Shuffle ( 1 ≈0.523), for small ∆, and of Greedy (≈0.618 for ∆=3), for all ∆. 2 + 1 Techniques. For our performance guarantees for MinGreedy we study the matching graph composed of the edges of a matching M , computed by MinGreedy, and of a maximum matching M ∗. The connected components are alternating paths and cycles. Only paths of length three have poor "local" approximation ratio (of M -edges to M ∗-edges). To obtain a global performance guarantee, we balance local approximation ratios by transferring "M -funds" from rich to poor components using edges of the input graph. Incorporating the properties of MinGreedy within an amortized analysis is our technical contribution. Overview. In Section 2 we present the charging scheme used to prove the performance guarantees for MinGreedy. In Section 3 we show our 2 3 bound for graphs of degree at most ∆ = 3. For graphs of degree at most ∆ ≥ 4 we present in Section 4 our performance guarantee of ∆−1 2∆−3 . Our inapproximability results for APV-algorithms are given in Section 5. 3 2 The Charging Scheme The Matching Graph. Let G = (V, E) be a connected graph, M ∗ a maximum matching in G and M a matching computed by MinGreedy when applied to input G. To analyze the worst case approximation ratio of MinGreedy we investigate the graph H = (V, M ∪ M ∗) . The connected components of H are paths and cycles composed of edges of M and M ∗. For example, H contains so-called (M -)augmenting paths, or paths for short: an augmenting path X has mX edges of M and m∗ X = mX + 1 edges of M ∗ and starts and ends with an M ∗-edge: We call the two nodes of a path X which do not have an incident M -edge the endpoints of X (the leftmost and the rightmost node in the figure). Other connected components of H are edges of M ∩ M ∗ , which we call singletons. For a singleton X we have mX = m∗ focus on these two component types: X = 1. We may Lemma 1. There is a maximum matching M ∗ in G such that each connected component of H is a singleton or an augmenting path. Proof. Let M ′ be a maximum matching in G = (V, E) and let MinGreedy com- pute the matching M . We show how to transform M ′ into M ∗. The connected components of the graph (V, M ∪ M ′) are singletons and alternating paths and cycles, where a path starts and ends with an M -edge or M ′-edge and a cycle does not have path endpoints. To prove the statement we eliminate paths start- ing and ending both with an M -edge, paths starting and ending with different types of edges, and cycles. There is no path X of the first type, since if there was, then we could replace the m′ X + 1 many M -edges of X to obtain a matching larger than M ′. In a component X of the latter types we replace the M ′-edges of X with the M -edges of X: component ⊓⊔ X is replaced by mX many singletons. X many M ′-edges of X with the m′ Local Approximation Ratios. To bound the approximation ratio of MinGreedy, our approach is to bound local approximation ratios α = M/M ∗ of components X of H. Observe that a 1 2 -path X αX = mX /m∗ X , , 4 X = 2 edges of M ∗, i.e. an augmenting path with mX = 1 edge of M and m∗ has local approximation ratio αX = 1 2 , while all other components have local approximation ratios at least 2 3 . In particular, a singleton X has optimal local approximation ratio αX = 1. Thus we have to balance local approximation ratios. For any component X, we say that X has M -funds mX and we introduce a change tX to the M -funds of X such that the changed local approximation ratio of X is lower bounded by αX = mX + tX m∗ X ! ≥ β for appropriately chosen β. IfPX tX = 0 holds, then the total M -fundsPX mX + tX = PX mX = M are unchanged and hence MinGreedy achieves approxi- mation ratio at least α = M/M ∗ = XX mX + tX! /M ∗ ≥ XX βm∗ X! /M ∗ = β . w Fig. 2. An augmenting path with transfers to its path endpoints and from its M - covered nodes. Not all F -edges are used to move M -funds. Transferring M -Funds. The idea is to transfer M -funds from rich com- ponents to poor components: as an example, we could transfer M -funds from a singleton to a 1 2 -path. But which components should be involved in a transfer? Observe that an augmenting path endpoint w is detrimental to its augment- ing path X, since w decreases the local approximation ratio of X. So a transfer should push M -funds towards poor w from a rich M -covered node. Since the G-neighbors of w are M -covered (otherwise M would not be maxi- mal), our approach is to move M -funds to w from G-neighbors of w which belong to other components: M -funds are moved over certain edges in F := E \ (M ∪ M ∗) which connect the components of H, see Figure 2 for an illustration. We verify that a poor component, in particular a 1 2 -path, is able to receive M -funds: 5 Lemma 2. An augmenting path endpoint w is incident with F -edge, since the degree of w in G is at least dG(w) ≥ 2 . Proof. When MinGreedy picks the first M -edge of the augmenting path of w, a node of degree at least two is selected (with an incident M -edge and M ∗-edge). So w also has degree at least two and is incident not only with its M ∗-edge. ⊓⊔ When transferring M -funds over all F -edges we face the danger of augment- ing path endpoints having large degree and drawing very large amounts of M - funds: rich components might become poor and now have too small local ap- proximation ratio. The following definition prevents high degree path endpoints from wasting M -funds. Definition 1. Let w be an augmenting path endpoint. Edge {v, w} ∈ F is a transfer if in the step of MinGreedy matching v the degree of w drops to at most d(w) ≤ 1. A transfer moves one coin with value θ from the component of v to the component of w. We frequently denote a transfer {v, w} as (v, w) to stress its direction. In order to refer to transfers from/to a given component X, we also call (v, w) a debit from v and a credit to w. I.e., debits from a component are transfers directed from its M -covered nodes, credits to an augmenting path are transfers directed to its path endpoints. Bounding Local Approximation Ratios. Let X be a component of H and denote the numbers of debits and credits of nodes of X by dX respectively cX . We call cX −dX the balance of X.1 Given an upper bound on the debits from X and a lower bound on the credits to X, we obtain a bound on the balance of X of at least cX − dX ≥ TX . Whenever we move M -funds over an edge {v, w} ∈ F , we transfer an amount θ of M -funds to the augmenting path endpoint w using one coin. Hence the local approximation ratio of X is at least αX = mX + θcX − θdX m∗ X ≥ mX + θTX m∗ X . In the analysis we find TX and θ such that αX ≥ β for all components. Hence MinGreedy computes matchings of size at least β times optimal. 1 Previous versions of this work use the notion of total debits of a component X, which are defined as dX −cX . This notion is equivalent to the notion of the balance of X. 6 2.1 Balance Bounds For each path X we demand the following: both nodes of each M -edge {x, x′} of X pay at most coins and X receives at least d{x,x′} ≤ 2(∆ − 2) (−Edge) cX ≥ 2 (+Endpoints) coins. Therefore, the minimum balance of path X is 2− DX for DX := 2mX (∆− 2). In particular, bounds (−Edge) and (+Endpoints) are bounds on numbers of coins and not on numbers of transfers: we demand that both hold w.r.t. transfers as well as donations, the latter of which are another way to move coins that we introduce later. To show that all components have local approximation ratio at least ∆−1 2∆−3 we will verify balance bounds −dX ≥ −2(∆ − 1) + 2 for any singleton X and (±Singleton) (±Path) cX − dX ≥ 2 − DX Lemma 3. If balance bounds (±Singleton) and (±Path) hold then all compo- nents have local approximation ratio at least ∆−1 2∆−3 . + 2(∆ − 2) for any path X. Proof. Choose θ = of a singleton X is at least 1+θ(cX −dX ) 1 2(2∆−3) . Using (±Singleton), the local approximation ratio ≥ 1 − 2θ(∆ − 2), which in turn equals 2(∆ − 2) 2(2∆ − 3) ∆ − 1 2∆ − 3 1−2θ(∆ − 2) = 1− (1) 1 = . Therefore each singleton has local approximation ratio at least ∆−1 2∆−3 . Using (±Path), we get that the local approximation ratio of a path X is at least mX + θ(cX − dX ) m∗ X ≥ mX − 2θmX(∆ − 2) + 2κ(∆ − 1) mX + 1 = 1 − 2θ(∆ − 2) + = 1 − 2θ(∆ − 2) , 2θ(2∆ − 3) − 1 mX + 1 which by (1) is bounded by at least ∆−1 proximation ratio at least ∆−1 2∆−3 . 2∆−3 as well, i.e. all paths have local ap- ⊓⊔ 7 2.2 Organisation of the Proof of (±Singleton) and (±Path) Consider the 1-2-MinGreedy algorithm given in Figure 3. Observe that a se- quence of edges picked by the (deterministic) MinGreedy algorithm is a valid sequence of edges to be picked by 1-2-MinGreedy. Therefore 1-2-MinGreedy achieves no better worst case approximation ratio than MinGreedy and obtain- ing performance guarantees for 1-2-MinGreedy implies the same approxima- tion performance for MinGreedy. Note that 1-2-MinGreedy can also be understood as a refined variant of the (deterministic) KarpSipser algorithm, which selects an arbitrary edge when- ever all degrees are at least two and otherwise selects an arbitrary node of min- imum degree, i.e. of degree one, and matches it with an arbitrary neighbor. M = ∅ repeat until all edges removed from input graph: if each node has degree at least 3: select (arbitrary) edge {u, v} else: select (arbitrary) node u of minimum non-zero degree select (arbitrary) neighbor v of u pick edge {u, v}, i.e. set M = M ∪ {{u, v}} remove all edges incident with u and v from input graph return M Fig. 3. The (deterministic) 1-2-MinGreedy algorithm We prepare the proof with some basic observations in Section 2.3. Then, for 1-2-MinGreedy we verify bounds (−Edge), (+Endpoints), (±Singleton), and (±Path) for graphs of maximum degree ∆ = 3 in Section 3, where our argument will rely on transfers only. In Section 4 we analyze graphs of maximum degree ∆ ≥ 4, where we will introduce donations as an additional way to move coins. 2.3 Preparations Since transfers move coins from M -covered nodes over F -edges to adjacent path endpoints, the following bounds on the number of outgoing and incoming trans- fers are an immediate consequence. In particular, the following bounds imply (−Edge) as well as (+Endpoints) in case coins are moved only in transfers but not in donations. Lemma 4. Let an M -edge {u, v} be given. If {u, v} is the edge of a singleton, then both nodes pay at most 2(∆ − 1) debits. If {u, v} is a path M -edge, then both nodes pay at most 2(∆ − 2) debits. 8 Proof. Since only F -edges can be transfers, it suffices to bound the number of F -edges incident with each of u and v. Each M -covered node of a singleton is incident with at most ∆ − 1 many F -edges. Each M -covered node of a path is incident with at most ∆ − 2 many F -edges. ⊓⊔ Lemma 5. Let w be an endpoint of path X. Endpoint w receives at least one credit. Path X receives at least cX ≥ 2 credits. Proof. Let dG(w) denote the degree of w in G and denote the current degree of w by d(w). By Lemma 2 we have dG(w) ≥ 2. when the degree of w drops from d(w) to 0, where d(w) ∈ {1, 2}. obtain cw ≥ 1. If d(w) = 1 holds, then either an F -edge incident with w gets removed and we have cw ≥ 1, or the M ∗-edge of w gets removed. In the latter case the degree of w dropped from dG(w) ≥ 2 to d(w) = 1 when an F -edge incident with w was removed, and again we have cw ≥ 1. Finally, observe that since path X has two endpoints, path X receives at ⊓⊔ least cX ≥ 2 credits. Since w is a path endpoint, node w never gets matched. Consider the step If d(w) = 2 holds, then an F -edge incident with w gets removed and we 3 Maximum Degree ∆ = 3 In this section we show Theorem 1. The 1-2-MinGreedy algorithm achieves approximation ratio at least ∆−1 3 for graphs of maximum degree ∆ = 3. 2∆−3 = 2 −dX ≥ −2 In the proof we verify (±Singleton) and (±Path), which for ∆ = 3 reduce to (±Singleton3) (±Path3) Coins will be moved using transfers only. Therefore (−Edge) and (+Endpoints) hold: in case only transfers are used, we have already verified both bounds in Lemmas 4 and 5. for each singleton X and for each path X. cX − dX ≥ 2 − 2mX + 2 3.1 Two Debits are Missing Recall that the minimum balance of a singleton X is −2(∆ − 1)= − 4, i.e. sin- gleton X pays at most four debits. Our plan to verify (±Singleton3) is to show that X pays two debits less than maximum: we say that two debits are missing. Similarly, the minimum balance of a path X is 2− DX = 2− 2mX, where DX is the maximum number of debits payed by X. Again, if X has two missing debits then X is balanced as required in (±Path3). However, it might be the case that X has less than two missing debits. In this case the balance of X will be increased by additional credits. 9 Organization of the Proof. We start with the proof of two missing debits for singletons in Lemma 6 (in Lemma 6 c), in particular); this result concludes the proof of (±Singleton3). More generally, Lemma 6 also applies to paths and identifies those cases in which paths have two missing debits as well. Lemma 6 also prepares the analysis of the special case in which a path X has less than two missing debits: we will argue that X has exactly one missing debit and in Lemma 7 in Section 3.2 we prove that the extra debit is compensated by an additional credit to X. Hence Lemmas 6 and 7 conclude the proof of (±Path3). Lemma 6. Assume that degrees are bounded by at most ∆ = 3. Consider the creation step of component X, and assume that the 1-2-MinGreedy algorithm selects node u with current degree d(u). Component X has two missing debits if a) we have d(u) = 1 b) we have d(u) = ∆ = 3 c) component X is a singleton. Proof. Let X be created in step s when u is matched with, say, node v. If neither u nor v pays a debit, then two debits are missing and we are done. Hence in the rest of the proof we may assume that at least one of u and v pays a debit, which we denote by (x, w) for x∈{u, v}. We prove a). If d(u) = 1 holds at step s, then no F -edges are incident with u. Hence u has two missing debits by Definition 1. We prove b). Since (x, w) is a transfer, step s removes edge {x, w} from G and after step s the degree of w is d′(w) ≤ 1. Observe that in step s at most two edges incident with w are removed. Since the degree of w is at least d(w) ≥ d(u) = 3 before step s, we have d′(w) = 1 at step s + 1. But since endpoint w is never selected, another degree-1 node y 6= w is selected next in step s + 1. Observe that the degree of y also drops from d(y) = 3 to d′(y) = 1 in step s, namely when incident edges {u, y} and {v, y} are removed. -- If y belongs to a component Y 6= X other than X, then both {u, y} and {v, y} are F -edges. But {u, y} and {v, y} are not debits, since u, v and y are M -covered. Hence we have found a missing debit for each of u and v. -- If y is a node of X (note that in this case X must be a path), then nodes u, v, and y form a triangle and one of {u, y} and {v, y}, say {u, y}, is an F -edge. Since both u and y are M -covered, edge {u, y} is not a transfer and hence both u and y have a missing debit. We prove c). We may assume that d(u) = 2 holds at creation of singleton X, since a) and b) apply in particular to singletons. Observe that a debit is missing from node u. In order to obtain a contradiction, we assume that this is the only missing debit from X. Consequently, node u pays exactly one debit, say to wu, and v pays exactly two debits, say to wv and w′ v. 10 Since at creation of X node u has degree d(u) = 2 and is adjacent to v, v. Since edges {u, wu}, {v, wv}, v} are transfers, Definition 1 implies that the degrees of wu, wv and, w′ node u is adjacent to at most one of wv and w′ and {v, w′ are at most 1 after step s. We distinguish two cases. v -- If u is adjacent to neither wv nor w′ v, then wu, wv, and w′ v have de- gree exactly 1 after step s: their degrees were at least the minimum degree of d(u) = 2 before {u, v} was picked, and their degrees dropped to at most one afterwards. v, say wu = wv holds. v drops by at most one when edge {u, v} is picked, and -- Now consider the case that u is adjacent to wv or w′ Then the degree of w′ hence w′ v has degree exactly 1 afterwards. In both cases, no other degrees than those of wu, wv, and w′ v dropped in step s. Since in step s+1 one of these endpoints has degree exactly one, one of wu, wv, or w′ v is selected and matched next. A contradiction, since path endpoints are ⊓⊔ never matched by 1-2-MinGreedy. 3.2 One Missing Debit and an Additional Credit To finish the proof of Theorem 1 it remains to verify (±Path3) for any given path X. Recall that the balance of X is at least cX − dX ≥ 2 − DX = 2 − 2mX . ≥ 2 − 2mX + 2 it suffices to show that To prove a balance of at least cX − dX two debits are missing for X. ! Since by Lemma 2 path X is created in a step selecting a node u of cur- rent degree d(u) ≥ 2, we analyze the cases that in the creation step of X we have d(u) = 2 or d(u) = 3. In the latter case, two debits are missing by Lemma 6 b). Hence, for the rest of the proof we may assume that d(u) = 2 holds. Observe that no F -edge is incident with u when being selected, hence a debit is missing for u. If an additional debit is missing for X, then we are done once again. So assume from here on that the only missing debit for X is missing for u. Then dX = DX − 1 = 2mX − 1 holds. Rather than proving a contradiction, in Lemma 7 we show that X receives at least three credits: we obtain cX − dX ≥ 3 − 2mX + 1, as required in (±Path3). Lemma 7. Assume that degrees are bounded by at most ∆ = 3. Let X be a path which pays dX = 2mX − 1 debits. Then X receives at least cX ≥ 3 credits. Proof. We assume that cX < 3 holds and show a contradiction. By assumption and as a consequence of Lemma 5, each endpoint of X receives exactly one credit. Moreover, we have already argued before Lemma 7 that the node u selected to create X has degree d(u) = 2 at creation, and that u has the only missing debit of X. Consequently, all other M -covered nodes of X have exactly one debit, since dX = 2mX − 1 holds. Let u be matched with node v. 11 First we consider the case that X is a 1 2 -path with mX = 1. Let wu and wv be the endpoints of X such that we have {u, wu},{v, wv} ∈ M ∗. Note that this implies wu 6= wv. Node v pays the only debit, say to the path endpoint y. Observe that in the creation step of X the degrees of wu, wv, and y all drop, and no other degrees drop. If the degree of wv is still at least two after X was created, then wv receives two credits over two still incident F -edges. A contradiction to our assumption that cX < 3 holds. Hence we may assume from here on that after creation of X the degree of wv is at most d′(w) ≤ 1. But when {u, v} is picked we have d(u) = 2, i.e. endpoint wv is not incident with u and the degree of wv drops by at most one. Consequently, endpoint wv has degree exactly d′(w) = 1 after creation, which is the new minimum degree in the graph. But since only the degrees of wu, wv, and y dropped in the creation step, one of wu, wv and y is matched in the next step. A contradiction is obtained since path endpoints are never matched. The possible configurations are depicted in Figure 4. y v wu u wv wu u v wv Fig. 4. Creating a 1 2 -path which pays one debit and receives exactly two credits: dashed endpoints have degree one after u and v are matched (not all edges are drawn) Now consider the case that path X has mX ≥ 2 edges of M . After edge {u, v} is picked in the creation step of X, at least one path endpoint w of X is still connected with its unique M ∗-neighbor, call it x. We consider the step when x becomes matched, say with its M -neighbor x′. In this step, we denote the current degree of a node z as d(z). Recall that x pays a debit, say to endpoint y. Since w and y are endpoints and are thus never matched, both w and y are not yet isolated. Thus node x is still connected with x′, w, and y and has degree at least d(x) ≥ 3. Also, we may assume that w has degree at most d(w) ≤ 2. To see this, assume that the degree of w is still ∆ = 3 and observe that the two F -edges incident with w become credits, which contradicts our assumption that cX < 3 holds. Moreover, we argue that the degree of w is exactly d(w) = 2. Why? Recall that u has the only missing debit from X. Hence x′ pays a debit, i.e. node x′ is adjacent to an endpoint of an path. Since x′ is also adjacent to x, node x′ has degree at least d(x′) ≥ 2. But the degree of x′ is not larger than the de- gree d(w) of w, i.e. it is at most d(x′) ≤ d(w) ≤ 2. Therefore the degree of x′ is exactly d(x′) = 2. Consequently, endpoint w has degree exactly d(w) = 2 as well. 12 All still present neighbors of x and x′ are endpoints of paths, and only their degrees drop when edge {x′, x} is picked. The possible configurations are depicted in Figure 5. We distinguish two cases. -- If x′ is not adjacent to w, then the degree of w drops by exactly one to exactly (the three leftmost configurations in Figure 5). Hence either w or another path endpoint is selected in the next step. A contradiction, since a path endpoint is never matched. -- Lastly, assume that x′ and w are adjacent (the rightmost configuration in Figure 5). Then w becomes isolated in that step. We consider the recip- ient y of the debit from x. Since x′ is adjacent to w and x and has degree exactly d(x′) = 2, endpoint y is not adjacent to x′. Therefore the degree of y drops by exactly one. Since the degree of y drops from at least d(y) ≥ 2 to at most 1, by Definition 1 we get that the degree of y is exactly 1 in the next step. Furthermore, endpoint y is now the only degree-1 node. Hence y is selected and matched next. A contradiction, since y is a path endpoint. ⊓⊔ w′ w′ w′ w′ x′ x w x′ x w x′ x w x′ x w Fig. 5. Removing the last M ∗-edge at an end of a path: dashed endpoints have degree one after x and x′ are matched (not all edges are drawn) 4 Maximum Degree ∆ ≥ 4 In this section we show Theorem 2. The 1-2-MinGreedy algorithm achieves approximation ratio at least ∆−1 2∆−3 for graphs of maximum degree ∆ ≥ 4. In the proof we have to verify bounds (−Edge), (+Endpoints), (±Singleton), and (±Path). First, we recall these bounds in an overview of how we refine the analysis applied for ∆ = 3. In particular, the overview is structured so as to highlight the two main concepts used in our analysis. -- Canceling Transfers Since ∆ is now larger than 3, a path endpoint might receive more credits than for ∆ = 3. However, extra transfers degrade the balance of their source components. To annihilate this drawback we cancel extra transfers: certain transfers as per Definition 1 will no longer move coins. The discussion is found in Section 4.1. 13 In particular, we carefully cancel transfers such that Lemma 5 still applies: each endpoint of a path X still receives at least one credit. Consequently, bound (+Endpoints) of at least cX ≥ 2 (+Endpoints) credits to X will be satisfied. -- Donations We discuss how to make a path X balanced. Assuming that (+Endpoints) and (−Edge) hold, i.e. that the minimum balance of X is cX − dX ≥ 2− DX, observe that cX − dX ≥ 2 − DX + 2(∆ − 2) (±Path) holds if X has at least 2(∆− 2) missing debits. However, we will see that the number of missing debits from X might smaller, even as small as a constant. To increase the balance of X we introduce a donation to X, which will compensate excessively payed debits from X. Summing up, path X will have to pay 2(∆ − 2) debits less than maximum, as desired. Like transfers, donations are edges in F . The discussion is found in Section 4.2. The balance of the source component Y of a donation is reduced, since coins have to be payed. Is Y balanced? If Y is a singleton, then we show that both nodes of Y pay at most (±Singleton) coins even if a donation must be payed. For a path Y we have to verify (−Edge) for each M -edge {y, y′} of Y , i.e. we have to show that nodes y and y′ pay at most dY ≤ 2(∆ − 2) coins even if a donation must be payed. 2(∆ − 2) (−Edge) Organization of the Proof. In Section 4.1 we introduce transfer cancellations and verify bound (+Endpoints). Thereafter we discuss donations in Section 4.2. In Section 4.3 we develop bounds on the number of coins payed by edges with an outgoing donation. Finally, in Section 4.4 we show that all components are balanced by proving (−Edge), (±Singleton), and (±Path). 4.1 Canceling Extra Transfers Unlike for ∆ = 3 where each path endpoint has at most two incident F -edges and therefore receives at most two credits, for ∆ ≥ 4 we will see that a path endpoint might receive up to three credits. But extra credits decrease the balances of their source components. In order to push up their balances, we show how to cancel extra credits in Definition 2. Thereafter we verify (+Endpoints) in Lemma 9. 14 Example. We prepare an example of an endpoint w which receives an extra credit. Assume that w receives k credits from nodes matched in steps 1, . . . , s: in any step s + l with l ≥ 1 we say that w already receives k credits. Consider Figure 6, where 1-2-MinGreedy begins by creating the ∆ − 5 many 1 2 -paths drawn above path X, then proceeds to pick the two edges of X in steps ∆−4 and ∆−3, and eventually picks the two singletons drawn left and right of X. Endpoint w receives three credits in total: in step ∆ − 3 node w already receives two credits from the nodes matched to create path X, and afterwards w receives an additional credit. 1 ∆ − 5 . . . w 2 − ∆ ... . . . ... ∆−4 ∆−3 1 − ∆ X Fig. 6. Endpoint w receives three credits from path X (M -edges are numbered to indicate the order in which they are picked, where 1-2-MinGreedy selects fat nodes) However, path X is not balanced. Why? Path X pays three debits to each of the ∆−5 topmost 1 2 -paths, and receives only four credits from the two singletons. Hence the balance of X is as small as cX − dX = 4 − 3(∆ − 5), whereas balance at least cX − dX ≥ 2 − 2mX (∆ − 2) + 2(∆ − 2) = 2 − 2(∆ − 2) is required by (±Path). The Definition. Therefore we cancel an extra credit to w, thereby limiting the number of credits to w to at most two (like for ∆ = 3). To prepare the definition we first analyze the exact "configuration" of a path endpoint with more than two credits. 15 Lemma 8. As a consequence of Definition 1 of transfers, a) each path endpoint receives at most three credits, and b) path endpoint w receives three credits if and only if the the following holds: the degree of w drops i. from d(w) = 3 to d(w) = 1 when two incident F -edges are removed and ii. from d(w) = 1 to d(w) = 0 when the last incident F -edge is removed. Proof. First we argue that an endpoint w receives less than three credits if there is a step s when the current degree of w is d(w) = 2. By Definition 1, no F - edge of w removed before step s is a credit to w. Moreover, in step s at most two F -edges are still incident with w. Consequently, if endpoint w receives at least three credits, then w never has current degree d(w) = 2. This implies the following two facts. First, the degree of w in G is dG(w) ≥ 3, since the degree of w in G is dG(w) ≥ 2 by Lemma 2. Secondly, there is a step when the current degree of w is d(w) = 3: the degree d(w) of w never equals two, hence we get that d(w) drops from larger than d(w) > 2 to below d(w) < 2, which is only possible if d(w) drops from exactly d(w) = 3, since in each step at most two edges incident with w are removed. a) In the step when d(w) = 3 holds, by Definition 1 of transfers endpoint w still has zero credits. Hence only the remaining three incident edges can be transfer F -edges. Thus w receives at most 3 credits. b) In the step when d(w) = 3 holds, all remaining edges incident with w must be F -edges, since otherwise w would receive less than three credits. The statement follows, since we have already argued that w never has degree d(w)=2. ⊓⊔ If endpoint w receives the maximum of three credits, then we cancel the "third" credit, i.e. the one coming from a node getting matched in the step when the degree of w drops from one to zero, cf. Lemma 8 b) ii. (Observe that path X in Figure 6 is now balanced, since the debits from its rightmost M -covered node are canceled and therefore the balance cX − dX ≥ 4 − 2(∆ − 5) > 2 − 2(∆ − 2) is now strictly larger than (±Path) requires.) Definition 2. Let w be a path endpoint with current degree d(w) = 1 and one incident F -edge {v, w}. If w already receives two credits, then we cancel trans- fer (v, w), i.e. edge {v, w} does not move coins. The final set of transfers is given by Definitions 1 and 2. We are now ready to prove (+Endpoints). Lemma 9. a) Each path endpoint w receives at most two credits. An endpoint for which a credit was canceled receives exactly two credits. b) Each path endpoint w receives at least one credit. Therefore (+Endpoints) holds. 16 Proof. a) is a direct consequence of Lemma 8 and Definition 2, since w receives at most three credits, and if so then the third credit is canceled. To prove b) we only have to consider path endpoints with less than two credits. In particular, we only have to study an endpoint w for which no credit was canceled, since by a) only such an endpoint can have less than two credits. Now observe that Lemma 5 applies to w, no matter if a credit was canceled for w or not: by ⊓⊔ Lemma 5 endpoint w receives at least one credit. 4.2 Moving Coins to Paths in Donations We prepare the discussion and introduce some notation, which will also be used in the remainder of Section 4. Let X be a path and consider the creation step of X. We denote the current degree of a node x as d(x). The nodes matched in the creation step are called u and v, where we assume that 1-2-MinGreedy selects u and matches u with neighbor v. In the next step, we denote the current degree of x as d′(x), and we call the matched nodes u′ and v′, where we assume that u′ is selected and matched with neighbor v′. Organization of this Section. We begin this section with an example of a path which pays many debits from nodes u and v. Thereafter, we sketch that nodes u′ and v′ are good candidates to compensate for the excessively payed debits from u and v. We conclude with the definition of donations -- which move coins over F - edges -- and a discussion of donation steps, i.e. the steps matching source nodes of donations. Example. Recall that to verify (±Path) we would like to show that for each path at least 2(∆ − 2) debits are missing. However, even after canceling transfers a path might pay too many debits. In particular, the example in Figure 6 can be changed slightly as follows, see Figure 7: like in Figure 6 the 1-2-MinGreedy algorithm first creates the topmost ∆ − 5 many 1 2 -path end creates the left and right singletons in the last two steps; however, in steps ∆ − 4 and ∆ − 3 the algorithm creates a 1 2 -path X and another singleton. Path X receives cX = 4 credits and pays dX = 2(∆− 5) debits, i.e. its balance is cX − dX = 4− 2(∆− 5), whereas balance at least cX − dX ≥ 2 − 2mX (∆ − 2) + 2(∆ − 2) = 2 is required by (±Path). Sketch. Hence we have to provide more coins to an unbalanced path X. Therefore we focus on the creation step of X as well as on the following step. Recall that (±Path) holds if nodes u and v pay k = 0 debits, since then at least 2(∆−2) debits are missing in total. If nodes u and v pay k > 0 coins over debits, then it will turn out that u′ and v′ have missing debits, which can be used to compensate for excessively payed debits from u and v. Depending on whether u′ and v′ belong to X or not we proceed as follows: 17 1 . . . ∆ − 5 2 − ∆ ... . . . ∆−4 . . . ∆−3 X 1 − ∆ Fig. 7. A 1 the order in which they are picked, where 1-2-MinGreedy selects fat nodes) 2 -path X which pays too many debits (M -edges are numbered to indicate -- If u′ and v′ belong to X, then the numbers of missing debits for u, v, u′ and v′ will add up to at least 2(∆ − 2): the balance of X is cX − dX ≥ 2 − DX + 2(∆ − 2), as required in (±Path). -- If otherwise u′ and v′ belong to another component Y 6= X, then without Y becoming unbalanced component Y will be able to donate k coins to u and v: the k debits payed by u and v are compensated and again the balance of X is increased by at least 2(∆ − 2) over 2 − DX. We call the step in which u′ and v′ are matched the donation step of X. Degree-1 Endpoints After Creation. We argue that debits are missing for u′ and v′. Recall that we need only consider the case that a debit leaves u or v, say to endpoint w, since otherwise we have found sufficiently many missing debits for (±Path) to hold. Definition 1 of transfers requires that w has degree at most d′(w) ≤ 1 after the creation step of X. The key to our proof is: endpoint w might have degree exactly d′(w) = 1 after creation of X. Definition 3. Let X be a path being created when 1-2-MinGreedy selects node u and matches it with v. Assume that u or v pays a debit, say to end- point w. If after creation of X endpoint w has degree exactly d′(w) = 1, then we say that a degree-1 endpoint exists after creation of X. 18 Assume that a degree-1 endpoint exists after creation of X, call it w. Since end- point w will never be matched, the 1-2-MinGreedy algorithm selects another degree-1 node, namely node u′, next. As desired, we have found missing debits for u′: since u′ has degree d′(u′) = 1 when being selected, node u′ pays zero debits by Definition 1. In Lemma 10 we identify the "configurations" in which a degree-1 endpoint exists after creation of a path. In particular, in Lemma 10 b) we identify the exact configurations in which no degree-1 endpoint exists after creation. Lemma 10. Consider the creation step of path X, where nodes u and v are matched and 1-2-MinGreedy selects u with current degree d(u). Assume that one of u or v pays a debit t, say to node w. a) If d(u)≥3 holds, then a degree-1 endpoint exists after creation of X. b) If d(u)=2 holds, then a degree-1 endpoint exists after creation of X, unless the following holds (see Figure 8 for an illustration of this exception): i. after creation of X endpoint w has degree d′(w) = 0, ii. at creation of X endpoint w has degree d(w) = 2, iii. no debit leaves u, iv. debit t leaves v, i.e. we have t = (v, w), v. we have {u, w} ∈ M ∗, vi. at creation of X all other endpoints w1, . . . , wk neighboring v (i.e. we have w /∈ {w1, . . . , wk}) have degree at least three, and vii. node v pays no other debits besides t. . . . . . . w1 . . . wk v . . . w u X Fig. 8. No degree-1 endpoint exists after creation of path X (the M ∗-neighbor of v could be one of the wi) Proof. By Definition 1, endpoint w has degree at most d′(w) ≤ 1 in the step after creation of X. Observe that before creation of X endpoint w is not isolated, since t is an incoming transfer and hence edge t is still incident with w. a) If d(u) ≥ 3 holds, then the degree of w drops from at least d(w) ≥ 3 to at least d′(w) ≥ 1, since at most two edges incident with w are removed. Hence w has degree exactly d′(w) = 1 after creation of X. 19 b) Now assume that d(u) = 2 holds. Since we have d′(w) ≤ 1 after creation of X, to prove the statement we only need to study the case that no degree-1 endpoint exists after creation, i.e. that endpoint w has degree d′(w) = 0 after creation. Observe that i. holds and it remains to verify ii. to vii. ii. Endpoint w has degree d(w) = 2 at creation, since the degree is d(w) ≥ 2 by Lemma 2 and if the degree was at least d(w) ≥ 3 then it could not drop to d′(w) = 0 after creation, as is fact by i. iii. Since u has degree d(u) = 2 at creation of X, node u is not incident with an F -edge, as would be required in order to pay a debit. iv. Since debit t does not leave u by iii., debit t leaves v. v. Since in the creation step of X the degree of w drops by two, an edge con- necting w with each of u and v is removed, and one of both edges must be the M ∗-edge incident with w. But we have t = (v, w), i.e. edge {v, w} is an F -edge. We obtain {u, w} ∈ M ∗. vi. Observe that for each wi we have d′(wi) ≥ 1 after creation of X, since before creation of X we have d(wi) ≥ d(u) = 2 and wi is not connected with u. Since we assumed that no degree-1 endpoint exists after creation of X and wi is not isolated then, we obtain d′(wi) ≥ 2. But an edge incident with wi is removed in the creation step of X. Hence we get d(wi) ≥ 3. vii. This follows from vi. Why? If all wi have degree at least three at creation of X, then no wi receives a transfer from v, since the degree of each wi drops by exactly one (recall that u is adjacent only with v and w). Consequently, ⊓⊔ endpoint w receives the only transfer from v. The Definition of Donations. Donations will only be needed to move coins to paths for which a degree-1 endpoint exists after creation. Hence in the rest of this section we focus on this case. (In Lemma 18 we analyze the case that no degree-1 endpoint exists after creation.) Assume that a degree-1 endpoint exists after creation of path X. Since u′ is selected with current degree d′(u′) = 1 and hence pays zero debits, node u′ is a preferred candidate to compensate the debits payed by u and v. To prepare the definition of donations, in Lemma 11 we show that an edge e connecting u′ with u or v is removed in the creation step of X. In particular, if a donation needs to be given to X from another component Y 6= X, then e is an edge in F . Lemma 11. Assume that a degree-1 endpoint exists after creation of path X. The node u′ selected next by 1-2-MinGreedy is a) an M ∗-neighbor of u or v in X or b) an F -neighbor of u or v in a component Y 6= X. Proof. After creation of X let w be a degree-1 endpoint. Since at creation of X all degrees are at least two, thereafter both degree-1 nodes w and u′ lost an edge connecting to u or v. Hence node u′ was connected to u or v by an M ∗-edge or by an F -edge. If u′ was connected by an M ∗-edge, then node u′ belongs to X. This proves a). 20 To prove b), assume that u′ is not an M ∗-neighbor of u or v. Then u′ was connected only by an F -edge with u or v. It remains to show that u′ is not a node of X. To see this, observe that after creation of X all M -covered nodes of X (other than the M ∗-neighbors of u and v) have degree at least two and recall that u′ is selected when it has degree d′(u′) = 1. ⊓⊔ Definition 4. Let nodes u and v be matched in the creation step of path X, where 1-2-MinGreedy selects node u with current degree d(u). Assume that u and v pay k > 0 debits. Let nodes u′ and v′ of component Y 6= X be matched in the donation step of X, where 1-2-MinGreedy selects u′ with current de- gree d′(u′)=1. Denote the F -edge connecting u′ with u or v as {u′, x} for x ∈ {u, v}. -- If d(u) = 2 holds, then edge {u′, x} = {u′, v} is called a static donation and -- If d(u) ≥ 3 holds, then edge {u′, x} is called a dynamic donation and moves k moves ∆−3 coins to v. coins to x. Donation {u′, x} is denoted as a bold directed edge (u′, x) from the paying node u′ of Y to the receiving node x of X. Soundness of the Definition. Recall that our proof of (±Path) crucially relies on bound (−Edge), i.e. on the (yet unproven) fact that each M -edge of path X pays at most 2(∆−2) coins over outgoing debits and donations: in total, all M -edges of X pay at most DX = mX · 2(∆ − 2) coins. Since the endpoints of X receive at least cX ≥ 2 credits by (+Endpoints), the balance of X is at least cX − dX ≥ 2 − DX . Our approach to use a donation to compensate all coins payed by nodes u and v implies that the balance of X is increased by at least 2(∆ − 2): the balance is at least cX − dX ≥ 2 − DX + 2(∆ − 2), as required in (±Path). But to develop our Definition 4 of donations we only considered coins payed by u and v over debits: if u or v pays a donation whose coins are not compensated, then our approach to verify (±Path) fails. However, Lemma 12 a) implies that neither u nor v pays a donation, i.e. our Definition 4 of donations is consistent with our approach to analyze the creation step of X. Moreover, Lemma 12 b) shows that coins donated to X need not be shared with another path. Lemma 12. Let set C = {s1, s2, . . .} with s1 < s2 < . . . be the set of path creation steps, and set D = {s1+1, s2+1, . . .} the set of donation steps. a) We have C ∩ D = ∅. b) The node selected in donation step si+1 donates coins to exactly one node, which was matched in the creation step si. Proof. a) Consider an arbitrary donation step si+1. Assume that 1-2-MinGreedy selects node u′ i) = 1. How- ever, Lemma 2 shows that in each path creation step sj a node uj of current degree at least d(uj) ≥ 2 is selected. We get si+1 /∈ C and the statement follows. i is selected with current degree d′(u′ i, and recall that u′ 21 b) It suffices to show that si−1+1 < si holds, since then creation step si is the only creation step between donation step si+1 and the previous donation step si−1+1. The previous donation step si−1+1 selects a node of degree one, whereas step si selects a node of degree at least two in order to create a path. Therefore si−1+1 6= si holds. Using si−1 < si we obtain si−1+1 < si. ⊓⊔ 4.3 Combined Coins of Transfers and Donations In this section we prove the following result, which will be applied in Section 4.4 to verify bounds (±Path), (±Singleton), and (−Edge). Lemma 13. Let X be a path for which a degree-1 endpoint exists after creation, and assume that nodes u and v are matched in the creation step of X and nodes u′ and v′ are matched in the next step. Denote by du,v the number of debits payed by u and v, and by dv′ the numbers of debits payed by v′ (recall that u′ pays no debits since u′ is selected with current degree one). There exist (non-negative) integers k and l with such that du,v ≤ k and dv′ ≤ l k + l ≤ 2(∆ − 2) holds. In particular, if u′ belongs to another component Y 6= X and pays a donation to X, then we may choose k as the number of donated coins. Organization of the Proof. To verify Lemma 13 we distinguish the following cases. Assume that path X is created when u is selected with current de- gree d(u)=2. Then we bound k + l whether u′ is a node of X or of another component Y 6= X, where by Definition 4 the analysis of the latter case involves the use of a static donation. Assuming that path X is created when u is selected with current degree d(u) ≥ 3, then again we bound k + l whether u′ belongs to X or not, where by Definition 4 in the latter case we have to take into account a dynamic donation. Cases d(u) = 2 and d(u) ≥ 3 are analyzed in Lemma 14 resp. Lemma 15. In the proof of Lemma 14 it suffices to analyze (the number of debits leaving) each of nodes u, v, u′, and v′ individually. However, in order to show Lemma 15 we have to take into account that the bound l depends"dynamically" on the num- ber k of debits payed by u and v. Consequently, the proof is more involved than that of Lemma 14. In particular, we study the endpoints neighboring nodes u and v as well as nodes u′ and v′ (in G). Therefore we introduce some helpful notation in Definition 5. 22 Lemma 14. Lemma 13 holds in case 1-2-MinGreedy selects u with current degree d(u) = 2. In particular, we have the following: a) If u′ is an M ∗-neighbor of u or v, i.e. node u′ belongs to X, then we may choose k and l such that we have du,v = k ≤ ∆−2 as well as dv′ = l ≤ ∆−2. b) If u′ belongs to component Y 6= X, then we may choose k and l such that we have du,v ≤ k = ∆ − 3 as well as dv′ = l ≤ ∆ − 1. In both cases we have k + l ≤ 2(∆ − 2). Proof. To prepare the proof, consider the creation step of X. Observe that u is not incident with an F -edge, since we have d(u) = 2. Hence u pays zero debits. Recall that also u′ pays no debits since 1-2-MinGreedy selects u′ with current degree d′(u′) = 1. We prove a). At creation of X node v is incident with at most ∆ − 2 edges of F , since v is also incident with its M -edge and M ∗-edge. Hence v pays at most ∆− 2 debits. We obtain du,v ≤ ∆− 2, since u pays no debits. Analogously, after creation of X node v′ is incident with at most ∆ − 2 edges of F , since v′ is also a node of path X. Here we get dv′ ≤ ∆−2. Now choose k = du,v and l = dv′ . We prove b). Since u′ does not belong to X and is selected with degree d′(u′) = 1, an F -edge e incident with u′ is removed in the creation step of X. Edge e connects u′ with v, since u is not incident with any F -edges when being selected by 1-2-MinGreedy. In particular, edge e is a static donation from u′ to v by Definition 4. But both u′ and v are M -covered, thus e is not a debit from v and at most ∆− 3 debits leave v. We get du,v ≤ ∆− 3. Now observe that the M -edge incident with v′ is not a debit from v′. Hence we have dv′ ≤ ∆− 1. Now choose k ⊓⊔ as the number of donated coins k = ∆ − 3 as well as l = dv′ . Definition 5. Consider the creation step of path X, when 1-2-MinGreedy selects node u with current degree d(u) ≥ 3 and matches u with v. We denote -- by W the set of path endpoints w with current degree at least d(w) ≥ 3, -- by W ⊆ W the set of W-endpoints neighboring u or v, -- by Wδ = {w ∈ W : d′(w) = δ} the set of W -endpoints which have degree δ -- by W≥3 = W \ (W1∪ W2) the set of W -endpoints which have degree at least 3 -- by W f 1 = {w ∈ W1 : {{w, u},{w, v}} ∩ F = f } the set of W1-endpoints -- by E(W ) = { {x, y} ∈ E : x ∈ {u, v}, y ∈ W } the set of edges connecting Note that W 1 1 form a partition of W1 and that W1, W2, and W≥3 form a partition of W , i.e. sets W \ W, W≥3, W2, W 2 1 are pairwise disjoint. Lemma 15. Lemma 13 holds in case 1-2-MinGreedy selects u with current degree d(u) ≥ 3. In particular, we may choose k and l such that we have connected to u and v by f edges of F for f ∈ {1, 2}, and nodes u and v with W -endpoints. after creation of X for δ ∈ {1, 2}, after creation of X, 1 and W 2 1 , and W 1 du,v = k = 2W 2 dv′ = l ≤ W 1 1 + W 1 1 1 + W2 and (a) (b) 23 as well as 1 + 2W 1 1 + W2 k + l ≤ 2W 2 ≤ E(W ) ≤ 2(∆ − 2) . (c) (d) Proof. We prove (a). Therefore we show that nodes u and v pay du,v = 2W 2 1 + W 1 1 debits. To prove that we may choose k = du,v we have to verify that if X receives a donation then this donation moves du,v coins. By Definition 4, path X receives a dynamic donation since u was selected with current degree d(u) ≥ 3. Now observe that a dynamic donation moves exactly du,v coins. To count the number of debits payed by u and v, we first study which endpoints do not receive a transfer from u or v. First, recall that each end- point w ∈ W has degree at least three before creation of X and observe that w has degree at least one thereafter, since degrees drop by at most two when X is created. Endpoints in W \ W , i.e. endpoints which are not adjacent to u or v, as well as endpoints in W≥3 still have degree at least three after creation of X and hence do not receive credits from u or v. Also, endpoints in W2 receive no credits from u or v, since their degree is at least two after creation. 1 debits. 1 + W 1 To show (b), we prove that node v′ pays at most dv′ ≤ W 1 Hence only endpoints in W1 might receive credits from u or v, since their degree is exactly one after creation. In the creation step of X, for each w ∈ W1, either two incident F -edges are removed, i.e. we have w ∈ W 2 1 , or one incident F - edge and an incident M ∗-edge is removed, i.e. we have w ∈ W 1 1 : since all these removed F -edges are transfers, we get that nodes u and v pay exactly du,v = 2W 2 1 +W2 debits and set l = dv′ . Which endpoints do not receive transfers from v′? (Recall that u′ pays no debits since u′ is selected when it has degree d′(u′) = 1.) Here, our Definition 2 of transfer cancellations is crucial: observe that v′ does not pay transfers to endpoints in W 2 1 , since each of these endpoints already receives two credits from u and v and any additional credit from v′ is canceled by Definition 2. Furthermore, endpoints in W \ W have degree at least three after creation of X and do not receive transfers from v′: when u′ and v′ are matched, node u′ is selected with current degree d′(u′) = 1, thus the degree of each endpoint in W \ W drops by at most one and to at least two. Analogously, no endpoint in W≥3 receives a transfer from v′. 1 and W2, and (b) follows. We note that, in particular, an endpoint w ∈ W 1 1 ∪ W2 receives less than two credits from u or v, i.e. further credits are not canceled, and we have d′(w) ≤ 2, i.e. the degree of w might drop to at most one when edge {v′, w} is removed. We prove (c), i.e. that k + l is bounded from above by the number E(W ) of edges connecting u or v with an endpoint before creation of X. First, we argue that Hence v′ might pay debits only to endpoints in W 1 W2 ≤ E(W ) − 2(W 1 1 + W 2 1 ) 24 1 as well as for each w ∈ W 2 holds: for each w ∈ W 1 1 two edges connecting w with u and v are removed when in the creation step of X the degree of w drops from at least d(w) ≥ 3 to at most d′(w) ≤ 1; moreover, each endpoint in W2 is connected with u or v by at least one of the remaining edges. Now we apply (a) and (b) to obtain k + l ≤ 2W 2 We prove (d), i.e. that E(W ) is bound from above by 2(∆ − 2). To see this, observe first that before creation of X two edges incident with u do not connect u with an endpoint: edge {u, v} is an M -edge and edge {u, u′} is removed when in the creation step of X the degree of u′ drops from at least d(u′) ≥ d(u) ≥ 3 to d′(u′) = 1. Analogously, edges {v, u} and {v, u′} do not connect v with an endpoint. Consequently, at most ∆ − 2 edges connect each of u and v with an ⊓⊔ endpoint. The statement follows. 1 + 2W 1 1 + W2 ≤ E(W ), as claimed. 4.4 All Components Are Balanced Recall that in order to prove Theorem 2 we have to verify (+Endpoints), (−Edge), (±Path), and (±Singleton). Recall also that in Lemma 9 we have already shown (+Endpoints), i.e. that each path receives at least two credits at its endpoints. In Lemma 16 we show (±Singleton) for each singleton. Also in Lemma 16, we show (−Edge) for path M -edges. Thereafter it remains to prove (±Path) for each path. In particular, we prove (±Path) for each path for which a degree-1 endpoint exists after creation as well as for each path for which there does not exist a degree-1 endpoint after creation: these proofs are provided in Lemma 17 resp. Lemma 18. In the proof of (±Path) we may assume that the nodes u and v matched to create a path X pay at least one debit, since otherwise at least 2(∆ − 2) debits are missing for X and as required in (±Path) the balance of X is at least cX − dX ≥ 2 − DX + 2(∆ − 2), by (+Endpoints) and (−Edge). We begin with the proof of (−Edge) and (±Singleton). Lemma 16. Bounds (−Edge) and (±Singleton) hold, since for each M -edge {y, y′} of a path or a singleton, nodes y and y′ pay at most 2(∆ − 2) coins. Proof. We have to verify that y and y′ pay at most 2(∆ − 2) coins whether a donation must be payed or not. Assume that 1-2-MinGreedy selects node y and matches y with neighbor y′. Hence a donation might be payed from y, but not from y′. Assume that y pays a donation. The following argument applies whether {y, y′} is a path M -edge or a singleton. By Definition 4 of donations, edge {y, y′} is picked in the donation step of a path X for which a degree-1 endpoint exists after creation. By Lemma 13, we have k + l ≤ 2(∆ − 2) for the number k of coins donated by y and the number l of debits payed by y′, i.e. both nodes pay at most 2(∆ − 2) coins. 25 From here on we assume that nodes y and y′ pay only debits. If {y, y′} is a path M -edge then observe that each of y and y′ is incident with at most ∆ − 2 edges of F and recall that only F -edges can be transfers. Thus y and y′ pay at most 2(∆ − 2) coins. If {y, y′} is the edge of a singleton Y , then each of y and y′ has at most ∆− 1 incident F -edges, i.e. we have dY ≤ 2(∆ − 1). In order to prove (±Singleton) with balance at least −dY ≥ −2(∆ − 2) it suffices to show that at least two debits are missing. Assume otherwise, i.e. that y and y′ pay at least 2(∆− 2) + 1 debits. Then each of y and y′ has degree at least ∆ − 1 when {y, y′} is picked, since otherwise one of y and y′ would have at most ∆ − 3 incident F -edges and hence at least two missing debits. But since both y and y′ have degree at least ∆ − 1 ≥ 3 before creation and a debit leaves y or y′, say to endpoint w, before creation endpoint w has degree at least d(w) ≥ 3 as well and we obtain that d′(w) = 1 holds after creation. Hence a node other than w is selected next after creation of Y , call it z. But z had degree at least 3 before creation of Y as well, hence z must be a degree-1 node after creation: two edges connecting y and y′ with z are removed from the graph in the creation step of Y . Both edges are not transfers, since y, y′, and z are M -covered. Consequently, each of y and y′ ⊓⊔ has a missing debit, a contradiction. To complete the proof of Theorem 2, it remains to verify (±Path). Lemma 17. Bound (±Path) holds for each path for which a degree-1 path end- point exists after creation. Proof. Let X be a path for which a degree-1 endpoint exists after creation. Since X receives at least cX ≥ 2 credits by (+Endpoints) and each M -edge of X pays at most 2(∆− 2) coins by (−Edge), to show (±Path) we have to prove that the balance of X is increased above 2 − DX by at least 2(∆ − 2). Let u′ be the node selected next after creation of X, and recall that u′ is selected with degree d′(u) = 1 since there is a degree-1 endpoint after creation of X. By Lemma 11, node u′ is the M ∗-neighbor of u or v, or u′ belongs to another component Y 6= X. We distinguish these two cases. Assume that u′ is the M ∗-neighbor of u or v, i.e. edge {u′, v′} is an M -edge of X. Observe that by (−Edge) the number of coins payed by nodes of the X- edges {u, v} and {u′, v′} is bounded from above by 4(∆ − 2). However, letting k be the number of debits payed by nodes u and v, and letting l be the number of debits payed by nodes u′ and v′, Lemma 13 shows that k + l ≤ 2(∆ − 2) holds, i.e. edges {u, v} and {u′, v′} pay at least 2(∆ − 2) coins less than maximum. Therefore we obtain dX ≤ DX − 2(∆ − 2) and hence the balance of X is at least cX − dX ≥ 2 − DX + 2(∆ − 2). Now assume that u′ belongs to another component Y 6= X. Hence X receives a donation from u′. Here, Lemma 13 shows that the number k of coins received by X over the donation satisfies k ≥ du,v for the number du,v of debits payed by u and v. Since we have du,v − k ≤ 0, we obtain dX ≤ (mX − 1) · 2(∆ − 2) + du,v−k ≤ (mX − 1) · 2(∆ − 2) = DX − 2(∆ − 2) and hence the balance of X is at least cX − dX ≥ 2 − DX + 2(∆ − 2) again. ⊓⊔ 26 No Degree-1 Endpoint Exists After Creation. By ¯X we denote path such that after creation of ¯X there does not exist a degree-1 endpoint. Assume that 1-2-MinGreedy selects node ¯u to create ¯X and matches ¯u with ¯v. Lemma 10 iii. shows that node ¯u pays no debits, Lemma 10 iv. and vii. show that node ¯v pays exactly one debit. Therefore we can only bound the number of missing debits from ¯u and ¯v by at least 2(∆ − 2) − 1. Thus the number of coins payed by ¯X is at most d ¯X ≤ D ¯X − ( 2(∆ − 2) − 1 ) , where D ¯X = m ¯X · 2(∆ − 2) is the maximum possible number of coins payed by ¯X, since each M -edge of ¯X pays at most 2(∆ − 2) coins by (−Edge). Can we find an additional missing debit However, unlike in the case that a degree-1 endpoint exists after creation, in order to find an additional missing debit for ¯X we cannot rely on the analysis of a degree-1 node matched after creation of ¯X. In particular, no coins are donated to ¯X. Therefore, using (+Endpoints) we obtain that the balance of ¯X is at least c ¯X − d ¯X ≥ 2 − (D ¯X − ( 2(∆ − 2) − 1 )) = 1 − D ¯X + 2(∆ − 2) , which fails to satisfy bound (±Path) by one coin. Thus, if we can find an addi- tional credit or an additional missing debit, then ¯X is balanced and we are done. Hence the following result completes the proof of Theorem 2. Lemma 18. Bound (±Path) holds for each path ¯X for which there does not exist a degree-1 path endpoint after creation, since ¯X receives c ¯X ≥ 3 credits or an M -edge {¯x, ¯x′} of ¯X pays at most 2(∆ − 2) − 1 coins, where {¯x, ¯x′} 6= {¯u, ¯v} is not the M -edge of ¯X picked in the creation step. Proof. To prepare the proof, observe that to show c ¯X ≥ 3 it suffices to identify an endpoint of ¯X which receives at least two credits, since by Lemma 5 the other endpoint of ¯X receives an additional credit. We distinguish cases by the number m ¯X of M -edges of ¯X. Assume that ¯X is a 1 2 -path with m ¯X = 1. We show that an endpoint of ¯X receives two credits, which proves c ¯X ≥ 3. First, we consider the creation step of ¯X and argue that in the subsequent step there is an endpoint of ¯X which is not isolated. Since after creation of ¯X there does not exist a degree-1 endpoint, by Lemma 10 b) the 1-2-MinGreedy algorithm selects a node ¯u of current degree exactly ¯d(¯u) = 2. Let ¯v denote the node matched with ¯u and observe that the M ∗-neighbor of ¯v, call it ¯w, has degree at least ¯d( ¯w) ≥ ¯d(¯u) = 2 as well. Since m ¯X = 1 holds, node ¯w must be an endpoint of ¯X, and since we have ¯d(¯u) = 2 endpoint ¯w is not adjacent to ¯u. Thus the degree of ¯w drops by at most one and to at least ¯d′( ¯w) ≥ 1 in the step after creation of ¯X. Moreover, after creation of ¯X all non-isolated path endpoints have degree at least two, since there does not exist a degree-1 endpoint. This holds in particular for ¯w. But since after creation of ¯X endpoint ¯w is incident with at least two F - edges, endpoint ¯w eventually receives at least two credits, namely over those two F -edges of ¯w which are removed last from the graph. 27 From here on, assume that ¯X has m ¯X ≥ 2 edges of M . We again denote the nodes matched to create ¯X by ¯u and ¯v, where we assume that 1-2-MinGreedy selects ¯u. Recall that since no degree-1 endpoint exists after creation of ¯X, by Lemma 10 b) an M ∗-edge of ¯X incident with an endpoint of ¯X is removed from the graph. We consider the step s when for the second time an M ∗-edge incident with an endpoint of ¯X is removed from the graph. Denote by ¯x the selected node and by ¯x′ the neighbor matched with ¯x. Since m¯x ≥ 2 holds we have {¯u, ¯v} 6= {¯x, ¯x′}. We distinguish the cases that ¯x and ¯x′ pay only debits, or ¯x pays a static or a dynamic donation. First, assume that ¯x and ¯x′ pay no donation but only debits. To show that edge {¯x, ¯x′} pays at most 2(∆ − 2) − 1 debits, assume the opposite. Then each of ¯x and ¯x′ pays ∆−2 debits, since each is incident with at most ∆−2 edges of F . Hence each of ¯x and ¯x′ has degree at least ∆− 1 at step s, since each is incident with ∆ − 2 edges of F as well as with edge {¯x, ¯x′}. But a debit leaves ¯x or ¯x′, say to endpoint w, hence by Definition 1 of transfers after step s endpoint w has degree at most one. In particular, endpoint w has degree exactly one after step s, since before step s node ¯x has degree at least ∆ − 1 ≥ 3 and hence endpoint w has degree at least 3 as well. Thus a node other than w is selected next, call it y. But node y had de- gree at least 3 before step s as well and since thereafter endpoint w has degree exactly one, node y is selected with current degree exactly one. Consequently, edges {¯x, y} and {¯x′, y} are removed from the graph in step s. Both {¯x, y} and {¯x′, y} are not transfers, since ¯x, ¯x′, and y are M -covered. Now observe that at most one of {¯x, y} and {¯x′, y} can be an M ∗-edge, since otherwise two M ∗- edges would be incident with y: at least one of {¯x, y} and {¯x′, y} is an F -edge, say {¯x, y}. Since edge {¯x, y} is not a transfer, there is a debit missing for ¯x and edge {¯x, ¯x′} pays at most 2(∆ − 2) − 1 debits, as claimed. Now assume that ¯x pays a static donation. By Definition 4, path ¯X pays ∆− 3 coins over the donation from ¯x. Furthermore, node ¯x′ pays at most ∆−2 debits, since at most ∆ − 2 many F -edges are incident with ¯x′ when 1-2-MinGreedy picks edge {¯x, ¯x′}. Again, the nodes in edge {¯x, ¯x′} pay at most 2(∆ − 2) − 1 coins. Lastly, assume that ¯x pays a dynamic donation (¯x, u) of k coins. By Def- inition 4 of donations, node u belongs to a path X 6= ¯X for which a degree-1 endpoint exists after creation, and 1-2-MinGreedy selects u with current de- gree d(u) ≥ 3 when creating X. Edge {¯x, ¯x′} is picked in the donation step of X when ¯x has current degree d′(¯x) = 1. Assume that u is matched with v, and recall the definition of the sets W, W1, 1 , W 2 W 1 1 , W2, and W≥3 of endpoints neighboring u and v, see Definition 5. By Lemmas 13 and 15 we have the following: nodes u and v pay du,v = k = 2W 2 1 + 1 debits, node ¯x donates k coins to u, node ¯x′ pays at most d¯x′ = l ≤ W 1 W 1 1 + W2 debits. Hence ¯x and ¯x′ pay at most k + l ≤ 2(∆ − 2) coins in total. If k + l < 2(∆ − 2) holds then an additional debit is missing from ¯x or ¯x′ and we are done. 28 So assume from here on that ¯x and ¯x′ pay k + l = 2(∆ − 2) coins. As a consequence of Lemma 15 (c) and (d) we get 1 + 2W 1 1 + W2 = E(W ) = 2(∆ − 2) . k + l = 2W 2 1 + W 1 Since k = 2W 2 1 holds, we get that ¯x′ pays exactly d¯x′ = l = W 1 1 + W2 debits. To which endpoints? Node ¯x′ pays zero debits to endpoints in W \ W or W≥3: in the step when 1-2-MinGreedy picks edge {¯x, ¯x′} these endpoints have degree at least three, and since these endpoints are not adjacent to ¯x when ¯x is selected with current degree d′(¯x) = 1 in the donation step of X, the degrees of these endpoints drop by at most one and to at least two, i.e. these endpoints do not receive transfers from ¯x′. Therefore ¯x′ might only pay debits to endpoints in W2 ∪ W1. But node ¯x′ also pays no debits to nodes in W 2 1 , since in the step when 1-2-MinGreedy picks edge {¯x, ¯x′} each endpoint in W 2 1 already receives two credits from nodes u and v and any further credits from ¯x′ are canceled. Consequently, node ¯x′ might pay debits only to nodes in W2 or W 1 1 . Since sets W \ W, W≥3, W2, W 2 1 are pairwise disjoint and since we 1 +W2, we obtain that ¯x′ pays exactly one debit to each endpoint have d¯x′ = W 1 in W 1 1 as well as to each endpoint in W2. 1 , and W 1 In the rest of the proof we proceed as follows. We show that either an end- point of ¯X receives at least two credits, which proves cX ≥ 3, or we show a contradiction to our assumption that nodes ¯x and ¯x′ pay k + l = 2(∆− 2) coins, which proves that edge {¯x, ¯x′} pays at most 2(∆ − 2) coins. Consider the step when 1-2-MinGreedy picks edge {¯x, ¯x′}. Recall that ¯x is selected with current degree d′(¯x) = 1, i.e. when the M ∗-edge of ¯x is already removed from the graph. Recall also that an M ∗-edge incident with a path endpoint of ¯X is removed in this step. This M ∗-edge must be incident with ¯x′ and we call it edge {¯x′, ¯w}. 1 , or W2 endpoint ¯w belongs to. (Recall that sets W 1 1 form a partition of W1 and sets W1, W2, and W≥3 form a partition of W .) Path X is created when the nodes u and v being matched have degree at least d(u) ≥ 3 resp. d(v) ≥ 3, and after creation of X the degree of ¯x is exactly d′(¯x) = 1. Thus two edges {u, ¯x} and {v, ¯x} are removed from the graph in the creation step of X. We conduct a case analysis based on which of W 1 1 and W 2 1 , W 2 ¯w ∈ W \ W or ¯w ∈ W≥3 : Here we show that ¯w receives at least two cred- its due to its large degree after creation of X. Since X receives a dynamic donation, by Definition 4 of donations the degrees of u and v are at least three in the creation step of X. Consequently, the degree of ¯w is at least d( ¯w) ≥ 3 as well. If we have ¯w ∈ W \ W , then ¯w is not adjacent to u or v and hence no edges incident with ¯w are removed in the creation step of X. Thus the degree of ¯w is at least d′(w) ≥ 3 after creation of X. If ¯w ∈ W≥3 29 holds, then the degree of ¯w is at least d′(w) ≥ 3 after creation of X by Definition 5. In the step after creation of X, i.e. in the donation step of X, when 1-2-MinGreedy picks edge {¯x, ¯x′}, the degree of endpoint ¯w drops by at most one, since ¯w is not adjacent with node ¯x which is selected with current degree d′(¯x) = 1. Consider the step after edge {¯x, ¯x′} is picked. The degree of ¯w is at least two and the M ∗-edge of ¯w is removed from the graph. Hence ¯w is incident with at least two F -edges. Now observe that ¯w eventually receives at least two credits, namely over the two of the F -edges of ¯w which are removed last from the graph. Consequently, path ¯X receives at least c ¯X ≥ 3 credits. 1 : We show a contradiction to our assumption that k + l = 2(∆ − 2) holds. Consider the step when path X is created. Recall by Definition 5 of W 1 1 , that at least two edges incident with ¯w are removed, since ¯w has degree at least d( ¯w) ≥ 3 before and degree at most d′( ¯w) ≤ 1 afterwards. Also by definition of W 1 1 , only one F -edge incident with ¯w is removed, hence the M ∗-edge incident with ¯w is removed as well. Consequently, endpoint ¯w belongs to X. We obtain a contradiction, since endpoint ¯w belongs to path ¯X and ¯X6=X holds by definition of the donation (¯x, u). 1 , two F -edges e1 and e2 incident with ¯w are removed when path X is created. In particular, since after creation of X the degree of ¯w is exactly one, edges e1 and e2 are credits to ¯w and both credits are never canceled. Hence path ¯X receives at least c ¯X ≥ 3 credits. 1 + W2 holds and that node ¯x′ pays a ¯w ∈ W2 : Recall that d¯x′ = l = W 1 debit to each endpoint in W 1 1 and to each endpoint in W2. Since we have ¯w ∈ W2, node ¯x′ pays a debit to ¯w. But only F -edges can be transfers, thus we have {¯x′, ¯w} ∈ F . A contradiction to endpoint ¯w being the M ∗-neighbor of ¯x′, i.e. to {¯x′, ¯w} ∈ M ∗. ⊓⊔ 1 : By Definition 5 of set W 2 ¯w ∈ W 1 ¯w ∈ W 2 5 Inapproximability Results MinGreedy does not exploit knowledge gathered about the input in previous steps: e.g. the neighbors of the selected node u are not remembered in order to "explore" the neighborhood of u later. In a step of MinGreedy, an arbitrary node of minimum degree, who is located in an unknown place in the graph, is matched to an arbitrary neighbor. A question arises naturally: are the worst case performance guarantees given above for MinGreedy optimal, i.e. is there a greedy matching algorithm which always computes larger matchings than proven for MinGreedy? In particular, a greedy matching algorithm in question may in each step utilize all previously gathered knowledge in very sophisticated node and edge selection routines. 30 Adaptive priority algorithms [BNR02] in the vertex model [DI04] define a large class of deterministic greedy matching algorithms, which we denote as APV. APV-algorithms do not have resource constraints and formalize the es- sential properties of greedy algorithms: to what extent can the input be unveiled in a single step, what are the possible irrevocable decisions for the constructed solution to be done after part of the input is revealed? An APV-algorithm may gather and process much data about its input instances and deduce knowledge to be used in clever future steps. Therefore APV-algorithms seem much stronger than MinGreedy. In particular, APV contains (the deterministic variants of) many prominent greedy matching algorithms, see Lemma 19. Nevertheless, we construct graphs with degrees bounded by ∆ for which a matching of size at most ∆−1 2∆−3 + o(1) times optimal is computed. So our 2 3 lower bound for ∆ = 3 and our ∆−1 2∆−3 lower bound for ∆-regular graphs are tight: the very simple MinGreedy algorithm has optimal worst case performance among APV-algorithms. For graphs of degree at most ∆ our ∆−1/2 2∆−2 lower bound shows that MinGreedy has good worst case performance. For an APV algorithm A the input graph is represented as a set of adjacency lists, e.g. {hu; v, wi,hv; u, wi,hw; u, vi} is the triangle on u, v, w (where an arbi- trarily ordered list of neighbors appears after a semicolon). An APV-algorithm A has a priori access to the number of nodes and starts with an empty matching. In each step, algorithm A selects a node by specifying a total priority order on all possible adjacency lists. From the given order, algorithm A receives the adjacency list which has highest priority and corresponds to a still non-isolated node u, say hu; v, w, . . .i. (A node is called isolated, if it, or each of its neighbors, is matched.) Lastly, algorithm A selects a non-isolated matching partner for u from the neighbor set {v, w, . . .} and then changes to the next step. Matched nodes are not removed from the adjacency lists in G: Observation 1 shows that if A remembers already matched nodes, then A can submit priority orders on adjacency lists w.r.t. the "reduced" graph, i.e. w.r.t. the set of nodes which are not yet isolated. Observation 1. If an APV-algorithm receives a data item hu; v, w, x, . . .i, then each neighbor v, w, x, . . . of u is either matched or not isolated. Proof. Let y ∈ {v, w, x, . . .} and assume that y is not matched but isolated. Each neighbor of y is matched and thus isolated. Since u is a neighbor of y and ⊓⊔ the data item of u is received, node u is not isolated. A contradiction. Leaving adjacency lists unchanged increases the power of A: a neighbor of an already matched node v may be requested and hence A is able to explore the neighborhood of v and is not oblivious to the parts of G being processed. 31 Lemma 19. The class APV contains (all deterministic variants of ) Greedy, KarpSipser, MRG, MinGreedy, Shuffle, and all vertex iterative algorithms. Proof. We have to implement any deterministic variant of one of the given al- gorithms as an APV-algorithm. In a given round of Greedy, a priority order e1, e2, e3, . . . on edges has to be built adaptively depending on previous computations. This list can be built edge by edge like this: The sub-list e2, e3, . . . is built under the assumption that e1 is not in the graph, the sub-list e3, . . . is built under the assumption that both e1, e2 are not in the graph, etc. After Greedy adds the highest priority edge in the graph to the solution, a new round starts and a new priority list is built adaptively like above. We have to translate e1, e2, e3, . . . into a priority order on adjacency lists. Therefore edge ei = {u, v} is replaced by a list containing an adjacency list hu; v, w, x, . . . i for each possible choice of w, x, . . . , making sure that if ei is in the graph it is picked before ei+1. If Greedy receives the adjacency list hu; v, w, x, . . .i, node u is matched with v. The argument for the other algorithms in analogous. In each round, a priority list is built recursively under the assumptions that high priority entries are not in the graph, and then translated to a list of adjacency lists. KarpSipser works like Greedy but prefers an edge incident with a degree- 1 node, if such an edge exists. So edges incident with degree-1 nodes are moved to the front of the priority order, i.e. the priority order on adjacency lists starts with adjacency lists hu; v, w, x, . . .i for all possible choices of u and v, w, x, . . . where only v is not already matched. To implement MRG, a priority list on nodes u1, u2, . . . has to be translated. Node ui is replaced by a list of adjacency lists hui; v, w, x, . . .i for each possi- ble choice of v, w, x, . . . If MRG receives an adjacency list, say for node u, an arbitrary non-isolated neighbor of u is to be matched with u. To implement MinGreedy, a priority list on node degrees 1, 2, . . . has to be translated. Degree i is replaced by a list of adjacency lists hu; v1, . . . , vi, w, x, . . . i for each possible combination of u and v1, . . . , vi, w, x, . . . where only v1, . . . , vi are not already matched. As for MRG, for a received adjacency list, say for node u, an arbitrary non-isolated neighbor of u is matched with u. Shuffle does not compute priority lists in each round, but a node permuta- tion u1, u2, . . . , un is computed once at the start, using the number n of nodes in the graph. A node ui is replaced by a list of adjacency lists hui; v, w, x, . . . i for each possible choice of v, w, x, . . . This priority order is used in each round. If Shuffle receives an adjacency list for a node ui, then from the still non-isolated neighbors of ui the first one in u1, u2, . . . , un is matched with ui. A vertex iterative algorithm [GT12] considers nodes one at a time, and probes each node u for neighbors. The probing for u ends after the first successful probe, say for neighbor v. Then nodes u and v are matched. The probing for u also ends after all possible neighbors have been tested without success. Furthermore, the probing for u ends if the algorithm decides to stop probing for further neighbors of u. Once the probing for u ends, node u is never considered again and u is never probed as the neighbor of any other node considered later. In a round of 32 of the algorithm, we denote by (a, b), (a, c), . . . , (a, d), (e, f ), (e, g), . . . , (e, h), . . . that node a is to be probed for neighbors b, c, . . . , d, then e is to be probed for neighbors f, g, . . . , h, etc. A pair (u, v) is translated to a list of adjacency lists hu; v, w, x, . . .i for each possible choice of w, x, . . . . If an adjacency list hu; v, w, x, . . .i is received, then node u is matched with v. ⊓⊔ To proof that no APV-algorithm can guarantee approximation ratio bet- ter than ∆−1 2∆−3 + o(1), we first present in Lemma 20 a construction for APV- algorithms without access to the number of nodes in the graph, and then adapt the construction in Theorem 3 to the full class of APV-algorithms. Lemma 20. Let A be an APV-algorithm without access to the number of nodes. There is an input graph of degree at most ∆ for which A computes a matching of size at most ∆−1 2∆−3 times optimal. Proof. We describe the construction of a hard input instance G for algorithm A as a game played between A and an adversary B. As A unveils G only bit by bit, adversary B may actually construct G on the fly, thereby reacting to the various moves of A such that G has a much larger matching than the solution of A. Of course, all adjacency lists presented by B during the whole game have to be consistent with the final graph G constructed by B. followed by the endgame, which has two steps. The game consists of the regular game, which lasts for s = ∆ − 3 steps, During the regular game, adversary B maintains the following invariant: each node v that is not yet isolated has an adjacency list of one of the following types. occur in a previously received adjacency list, and 3 ≤ d ≤ ∆. Type 1: hv; v1, . . . , vdi where v and v1, . . . , vd are unknown, i.e. they did not Type 2: hv; v1, v2i where v and v1, v2 are unknown. Type 3: hv; v1, v2, v3i where v and v1, v2 are unknown and v3 is known, i.e. node v3 was received by A in a previous adjacency list. Observe, that all nodes in G have degree at least two. Consider the very first step of A. Since all nodes are still unknown, all nodes have adjacency lists of type 1 or 2. Hence the invariant holds. Consider step i and assume that the invariant holds. Adversary B presents the highest ranked adjacency list that is of type 1, 2 or 3. Call that adjacency list ai. Case 1: ai = hv; v1, . . . , vdi is a type-1 adjacency list. Since all nodes in ai are unknown, we may w.l.o.g. assume that A matches v with v1. Adversary B constructs the connected component C depicted in Figure 9 which consists only of nodes of types 1 and 2. All nodes of C are isolated in the next step, hence the invariant is maintained. Observe that within C the maximum matching M ∗ scores two edges (the double edges {v, v2},{v1, vd} in Figure 9) whereas the matching M computed by A scores just one edge (the crossed edge {v, v1}). Since in Case 1 algorithm A requests only unknown nodes, adversary B is able to trick A into unveiling part of G from which A cannot gather knowledge about the rest of G. Can A act smarter? Assume that A has already received 33 v v1 v2 v3 . . . vd l1 ... lk m1 r1 u1 ... mk rk uk a c r e t n e c b d Fig. 9. A connected com- ponent of a hard instance Fig. 10. The core of a hard instance (Gray nodes are unknown, fat frontier nodes. The dashed edge is an ex- ample for {mi = v, rj = v3} in case 3.) the adjacency lists of the middle nodes m1, . . . , mk of the triangles {lj, mj, rj} of known nodes connected by frontier nodes rj and unknown nodes uj to the still unknown center of G, see Figure 10. If A requests an unknown node with two unknown neighbors, then B easily tricks A by constructing a new triangle {li, mi, ri}. Case 2: ai = hv; v1, v2i is a type-2 adjacency list. Again, all nodes of ai are unknown and we may assume that A matches v with v1. Adversary B constructs a triangle {li, mi, ri} with li = v2, mi = v, ri = v1 and inserts the edge {ri, ui}, with a new unknown node ui, to connect the triangle to the unknown center. Observe that before nodes mi, ri are matched, nodes mi, li are of type 2 and ri, ui are of type 1. After matching mi, ri, nodes li, mi, ri are isolated and ui turns into a type-3 node. Hence the invariant still holds. Again, M ∗ scores two edges, namely {li, mi},{ri, ui}, and M scores the edge {mi, ri}. Now assume that A tries to explore the neighborhood of known nodes. Ob- serve that the only adjacency lists with a known node are of type 3 and have exactly one unknown node: since the known nodes lj, mj, rj are already isolated, an unknown node can only be explored in the neighborhood of frontier nodes. Again, adversary B tricks A with a new triangle {li, mi, ri}. Case 3: ai = hv; v1, v2, v3i is a type-3 adjacency list. Since v3 is known, v3 occurred in a previously presented adjacency list. Observe that in our con- struction so far, the only type-3 nodes are unknown neighbors of known frontier nodes. So v is the neighbor of a frontier node rj = v3 with j < i. Is algorithm successful in exploring the unknown neighbor uj of rj, i.e. does v = uj hold? Not necessarily, since B may on the fly construct further neighbors of rj . Why? Since rj gets matched as soon as it becomes known, algorithm A never gets to see the adjacency list of rj and consequently A can never tell if it already knows all neighbors of rj. (Adversary B uses this trick here as well as in the end game.) Since v3 = rj is matched and v1, v2 are unknown, we may assume that A matches v with v1. Adversary B behaves exactly as in case 2 and constructs the triangle {li = v2, mi = v, ri = v1} and inserts the edge {ri, ui} where ui is a new unknown node. To complete the devious trick, adversary B also inserts the edge {mi = v, rj = v3} (see e.g. the dashed edge in Figure 10). Before mi, ri are matched, node li is of type 2, nodes ri, ui are of type 1 and mi = v is of type 34 3. After matching mi, ri, nodes li, mi, ri are isolated and ui turns into a type-3 node. uj is still of type 3. Hence the invariant still holds. As in case 2, M ∗ scores {li, mi},{ri, ui} and M scores {mi, ri}. This concludes the regular game. In the first step of the endgame adversary B makes algorithm A match a with b. Hence in the next and last step algorithm A matches c. So algorithm A scores two edges in the center, whereas three edges are optimal. As desired, we get M = s + 2 = ∆ − 1 and M ∗ = 2s + 3 = 2∆ − 3 . Observe that our invariant still holds in the first step of the endgame. Again, adversary B presents the highest ranked adjacency list of type 1, 2 or 3. Observe that a and c are the only type-1 nodes left, since the uj have known neighbors and are of type 3 and all other nodes have degree two and are of type 2. The degree of a and c is δ ≤ 3 + s, since both a, c have three center neighbors and each step of the regular game adds at most one neighbor to a respectively c. Let a∆−2 be the adjacency list received in step s + 1 = ∆ − 2. Case 4a: a∆−2 = hv; v1, . . . , vδi is a type-1 adjacency list. Since all nodes of a∆−2 are unknown we may assume that A matches v with v1. Adversary B chooses v = a, v1 = b and v2, . . . , vδ as the remaining neighbors of a. Case 4b: a∆−2 = hv; v1, v2i is a type-2 adjacency list. Since all nodes of a∆−2 are unknown we may assume that A matches v with v1. Adversary B sets v = b, v1 = a and v2 = d. Case 4c: a∆−2 = hv; v1, v2, v3i is a type-3 adjacency list. As in case 3, the known node v3 is some matched frontier node rj, j < ∆− 2 and we may assume that A matches v with v1, since v1, v2 are unknown. As in case 3, adversary B does not present the adjacency list of the unknown node uj. Instead, B makes b a neighbor of rj by inserting {v3=rj , b} -- now b has three neighbors -- and sets v=b, v1=a and v2=d. Adversary B does not violate degree constraints. Nodes introduced in case 1 have degree at most d ≤ ∆. All other degrees are at most three, but for a, c and frontier nodes rj. As discussed, nodes a, c have degree at most δ = 3 + s ≤ ∆. Frontier node have degree at most 3 + (s− 1) + 1 = ∆, since in each but the first step of the regular game and in step s+ 1 at most one incident edge is added. ⊓⊔ Theorem 3. Let A be an APV-algorithm. There is a graph G of degree at most ∆ for which A computes a matching of size at most ∆−1 2∆−3 + ε times optimal for any ε > 0. Proof. We modify the adversary B who constructs hard inputs in the proof of Lemma 20. First, the modified adversary B′ announces the number t∆ of nodes, where t is a large integer. Using so many nodes B′ constructs Ω(t) con- nected components, each with O(∆) nodes and approximation ratio no better than ∆−1 2∆−3 . A negligible portion of the graph might be solved optimally by A. In the proof we frequently refer to the adjacency list types and cases found in the proof of Lemma 20 (types 1, 2, and 3, and cases 1, 2, 3, and 4a-c). 35 Again, the game between A and B′ is split up into the regular game and the endgame. Like the adversary B from the proof of Lemma 20, in each round of the regular game the construction of B′ keeps up the invariant that all non-isolated nodes in the graph have adjacency lists of type 1, 2 or, 3 and B′ returns the high- est priority adjacency list having one of these types. However, depending on the requests of A, not only one but several centers C1, C2, . . . might be constructed, each in its own connected component of G. Each center Ci is defined as in the proof of Lemma 20, with nodes ai, bi, ci, di and two more nodes unique to Ci, see Figure 10. Each Ci will get attached to it a maximum number of triangles, which are not connected to any other center. Thereafter, the nodes of Ci are supposed to be matched in the same order as in the proof of Lemma 20, i.e. when no more triangles are attached, nodes ai and bi are matched to each other before ci is matched. Once ci is matched, all edges in the connected component of Ci are removed. Assume that B′ has already created the centers C1, . . . , Cl. Call Ci active if ai is not yet matched with bi, and inactive otherwise. The construction will ensure that C1, . . . , Cl−1 are inactive; Cl might still be active. (We note here that after center Cl becomes inactive, there are nodes in the rest of the connected component K of Cl which do not have adjacency lists of types 1, 2 or 3. However, all these nodes are neighbors of cl and adversary B′ adds no more nodes to K. Thus A scores at most one more edge in K. Therefore, the additional adjacency list types do not have effect on the rest of the construction and we do not discuss these types explicitly.) Assume that in the next round A receives a type-2 adjacency list of a node with two unknown neighbors. Assume that Cl is already inactive, then B′ creates the next center Cl+1 and connects a new type-2 triangle to al+1, cl+1 as described in case 2. If otherwise Cl is still active, let δ be the number of neighbors of al, cl constructed so far and recall that we demand δ ≤ ∆. If δ < ∆, then B′ connects a new type-2 triangle to al, cl as described in case 2. If δ = ∆, then B′ makes A match al with bl as described in case 4b, thereby inactivating Cl. Assume that in the next round A receives a type-3 adjacency list. By con- struction, the received node is unknown and among its three neighbors there is exactly one known node v3, where v3 = r is a frontier node r in the connected component of the still active center Cl. Let δ be the number of neighbors of al, cl constructed so far. If δ < ∆, then B′ connects a new type-3 triangle to al, cl as described in case 3. If δ = ∆, then B′ makes A match al with bl as described in case 4c, and inactivates Cl. Assume that in the next round A receives a type-1 adjacency list. If the degree of the received node is smaller than ∆, then B′ proceeds as in case 1 and creates a new type-1 connected component. Now assume that the received node has degree ∆. If nodes al, cl have degree less than ∆, then again B′ creates a new type-1 connected component. If nodes al, cl have degree δ = ∆, then B′ makes A match al with bl as described in case 4a, and thereby inactivates Cl. Why is Cl inactivated before B′ constructs the next active center? In type-2 and type-3 rounds an increasing number of triangles is connected to Cl until 36 the degrees of al, cl are ∆. (In intermediate type-1 rounds only type-1 connected components are constructed.) Thereafter, Cl is inactivated in the first type-2 or type-3 round or the first type-1 round in which an adjacency list of a degree-∆ node is received. (In intermediate type-1 rounds with nodes of degree less than ∆ only type-1 connected components are constructed.) The endgame begins as soon as B′ has constructed k ≥ t∆ − 6∆ nodes. Let ν = t∆ − k be the number of nodes still to be constructed. Observe that 6∆ ≥ ν ≥ 2∆ holds, since in each round no more than 4∆ additional nodes are introduced (e.g. if ∆ = 3 holds and a new triangle is connected to a new center). Since B′ has committed to a number of exactly t∆ nodes, in the first round of the endgame B′ utilizes all remaining ν nodes to create additional connected components Γ1, . . . , Γc, each being a complete bipartite graph with 2 nodes on the right side and between 2 and ∆ (both 2 and ∆ included) nodes on the left. The left sides are as large as possible such that c = O(1) is constant and all nodes in the Γi have degree at least two. All nodes in Γ1, . . . , Γc are still unknown, in particular all nodes have adjacency lists only of types 1 or 2. Since right sides have two nodes, each Γi has at most two edges in a maximum matching, making an additional constant number 2c of optimal edges in total. We assume that A performs optimally in all Γi, thereby scoring 2c edges. Also in the endgame, algorithm A matches still unmatched nodes in the already inactive centers C1, . . . , Cl−1. We assume that A performs optimally also in the connected component of the last center Cl. What is the approximation ratio of A? Observe that each type-1 component has O(∆) nodes. The same is true for each connected component with a (con- stant size) center Ci, since O(∆) triangles (of constant size) are attached to Ci. So as claimed, Ω(t) connected components are constructed. Recall that A scores only one out of two edges in each type-1 connected component. On the other hand, in the connected component of an inactive center A achieves approxima- tion ratio exactly ∆−1 2∆−3 . In all other components, algorithm A even performs optimally. Therefore, to bound the performance of A we may assume that no type-1 components are constructed. Since only Cl might be active at the end of the regular game, there are at least l − 1 = Ω(t) inactive centers, hence the approximation ratio of A is at most (l − 1) · (∆ − 1) + (2∆ − 3) + 2c (l − 1) · (2∆ − 3) + (2∆ − 3) + 2c , since A performs optimally in Cl and in Γ1, . . . , Γc. Letting t → ∞ we get l → ∞ and this ratio is dominated by (l−1)·(∆−1) ⊓⊔ (l−1)·(2∆−3) . The statement follows. 6 Conclusion We have analyzed the worst case approximation ratio of the well-known Min- Greedy algorithm on graphs of bounded degree. Our performance guarantees of 2 2∆−3 for ∆-regular graphs are tight. In particular, MinGreedy is optimal in the large class of APV-algorithms, 3 for graphs of degree at most three and of ∆−1 37 which contains many prominent greedy matching algorithms. We also proved a performance guarantee of ∆−1/2 2∆−2 for graphs of degree at most ∆, and we conjec- ture that also in this case MinGreedy is optimal among APV-algorithms and achieves a worst case approximation ratio of at least ∆−1 2∆−3 . Our worst case performance guarantees are stronger than the best known worst case bounds on the expected approximation ratio for the well-known greedy matching algorithms Greedy, MRG and Shuffle, if degrees are small. Open Questions. Is MinGreedy optimal among APV-algorithms on graphs What bounds for MinGreedy can be shown for more restricted graph classes, of degree at most ∆? e.g. bipartite graphs? Recall that the expected approximation ratio of the randomized MinGreedy algorithm is 1 2 + o(1) w.h.p. on graphs of arbitrarily large degree. Does random- ized MinGreedy have an expected approximation ratio strictly better than ∆−1 2∆−3 if degrees are bounded by ∆? Acknowledgements. I thank Georg Schnitger for many helpful discussions. References ADFS95. Jonathan Aronson, Martin Dyer, Alan Frieze, and Stephen Suen. Ran- domized greedy matching. ii. Random Structures & Algorithms, 6(1):55 -- 73, 1995. BNR02. Allan Borodin, Morten N. Nielsen, and Charles Rackoff. (incremental) pri- ority algorithms. In Proc. 13th SODA, pages 752 -- 761, 2002. DF91. CCWZ14. T.-H. Hubert Chan, Fei Chen, Xiaowei Wu, and Zhichao Zhao. Ranking on arbitrary graphs: Rematch via continuous lp with monotone and boundary condition constraints. In Chandra Chekuri, editor, SODA, pages 1112 -- 1122. SIAM, 2014. Martin E. Dyer and Alan M. Frieze. Randomized greedy matching. Random Structures & Algorithms, 2(1):29 -- 46, 1991. Sashka Davis and Russell Impagliazzo. Models of greedy algorithms for graph problems. In Proc. 15th SODA, pages 381 -- 390, 2004. Alan Frieze, A. J. Radcliffe, and Stephen Suen. Analysis of a simple greedy matching algorithm on random cubic graphs. In Proc. 4th SODA, pages 341 -- 351, 1993. Gagan Goel and Pushkar Tripathi. Matching with our eyes closed. In Proc. 53rd FOCS, pages 718 -- 727, 2012. Richard M. Karp and Michael Sipser. Maximum matchings in sparse ran- dom graphs. In Proc. 22nd FOCS, pages 364 -- 375, 1981. FRS93. DI04. GT12. KS81. KVV90. Richard M. Karp, Umesh V. Vazirani, and Vijay V. Vazirani. An optimal algorithm for on-line bipartite matching. In Proc. 22nd STOC, pages 352 -- 358, 1990. Jakob Magun. Greedy matching algorithms, an experimental study. In Proceedings of the 1st Workshop on Algorithm Engineering, volume 6, pages 22 -- 31, 1997. Mag97. 38 MP97. MS04. MV80. Pol12. Tin84. Vaz12. Zevi Miller and Dan Pritikin. On randomized greedy matchings. Random Struct. Algorithms, 10(3):353 -- 383, 1997. Marcin Mucha and Piotr Sankowski. Maximum matchings via gaussian elimination. In FOCS, pages 248 -- 255. IEEE Computer Society, 2004. Silvio Micali and Vijay V. Vazirani. An o(sqrt(v) e) algorithm for find- ing maximum matching in general graphs. In FOCS, pages 17 -- 27. IEEE Computer Society, 1980. Matthias Poloczek. Greedy algorithms for max sat and maximum matching : their power and limitations. PhD thesis, Institut für Informatik, Goethe- Universität Frankfurt am Main, 2012. http://d-nb.info/1036608425. G. Tinhofer. A probabilistic analysis of some greedy cardinality matching algorithms. Annals of Operations Research, 1(3):239 -- 254, 1984. Vijay V. Vazirani. An improved definition of blossoms and a simpler proof of the mv matching algorithm. CoRR, abs/1210.4594, 2012. 39
1209.5608
1
1209
2012-09-25T13:42:56
Faster Deterministic Fully-Dynamic Graph Connectivity
[ "cs.DS", "cs.DM" ]
We give new deterministic bounds for fully-dynamic graph connectivity. Our data structure supports updates (edge insertions/deletions) in $O(\log^2n/\log\log n)$ amortized time and connectivity queries in $O(\log n/\log\log n)$ worst-case time, where $n$ is the number of vertices of the graph. This improves the deterministic data structures of Holm, de Lichtenberg, and Thorup (STOC 1998, J.ACM 2001) and Thorup (STOC 2000) which both have $O(\log^2n)$ amortized update time and $O(\log n/\log\log n)$ worst-case query time. Our model of computation is the same as that of Thorup, i.e., a pointer machine with standard $AC^0$ instructions.
cs.DS
cs
Faster Deterministic Fully-Dynamic Graph Connectivity Christian Wulff-Nilsen ∗ Abstract We give new deterministic bounds for fully-dynamic graph connectivity. Our data structure supports updates (edge insertions/deletions) in O(log2 n/ log log n) amortized time and connectivity queries in O(log n/ log log n) worst-case time, where n is the number of vertices of the graph. This improves the deterministic data structures of Holm, de Lichtenberg, and Thorup (STOC 1998, J.ACM 2001) and Thorup (STOC 2000) which both have O(log2 n) amortized update time and O(log n/ log log n) worst-case query time. Our model of computation is the same as that of Thorup, i.e., a pointer machine with standard AC 0 instructions. 2 1 0 2 p e S 5 2 ] S D . s c [ 1 v 8 0 6 5 . 9 0 2 1 : v i X r a ∗Department of Computer Science, University of Copenhagen, [email protected], http://www.diku.dk/ e koolooz/. 1 1 Introduction The dynamic graph connectivity problem is perhaps the most fundamental dynamic graph problem and has received considerable attention from the algorithms community for decades. The goal is to build an efficient data structure that supports one or more of the following operations in a dynamic graph G: • connected(u, v): determines whether vertices u and v are connected in G, • insert(u, v): inserts edge (u, v) in G, • delete(u, v): deletes edge (u, v) from G. The fully-dynamic graph connectivity problem supports all three operations, whereas the simpler decremental and incremental variants do not support insert and delete, respectively. In the following, we refer to both insert and delete as update operations. The first non-trivial data structure for fully-dynamic graph connectivity is due to Fred- erickson [2] who showed how to support updates in O(√m) time and connectivity queries in O(1) time, where m is the number of edges of the graph. Using a general sparsification technique, Eppstein, Galil, Italiano, and Nissenzweig [1] improved update time to O(√n), where n is the number of vertices. Both of these data structures are deterministic and the time bounds are worst-case. Henzinger and King [3] significantly improved update time to O(log3 n) with only a small increase in query time to O(log n/ log log n). However, their bounds are randomized expected and update time is amortized. Using a clever sampling technique, Henzinger and Thorup [4] shaved off a factor of log n in the update time. A simple and elegant deterministic data structure with the same bounds as in [4] was given by Holm, de Lichtenberg, and Thorup [5]. Its space requirement was later improved to linear by Thorup [10] who also gave a randomized data structure with a faster update time of O(log n(log log n)3) and marginally slower query time of O(log n/ log log log n). A general cell-prove lower bound of Ω(log n) for fully-dynamic graph connectivity was provided by Patra¸scu and Demaine [6]. Hence, the data structures above are near-optimal. As shown by Tarjan [8], incremental connectivity is the union-find problem which can be solved in O(α(m, n)) time over m updates. Thorup [9] gave an O(log n) bound for decremental connectivity if the initial graph has Ω(n log5 n) edges. He also gave an O(1) bound if the initial graph is dense. Our contribution is a deterministic data structure that improves the update time of the deterministic data structures in [5, 10] by a factor of log log n. We use several ingredients of Thorup [10], including his structural forest (which we refer to as a cluster forest) as well as lazy local trees and shortcuts both of which we modify to suit our needs. We also introduce an additional system of shortcuts that allows us to more quickly walk up trees of the cluster forest. Together, these changes and additions give an order log log n speed-up in the update time. Table 1 summarizes the results for fully-dynamic graph connectivity. Our paper is organized as follows. In Section 2, we introduce basic definitions and notation. Section 3 gives a simple data structure with O(log2 n) update time and O(log n) query time. It is essentially the deterministic data structure of Thorup [10] but a slightly more minimalistic variant that does not need to maintain spanning trees of connected components. In Section 4, 2 Update time Query time Type Reference O(√m) O(√n) O(log3 n) O(log2 n) O(log2 n) O(1) O(1) deterministic; worst-case time deterministic; worst-case time O(log n/ log log n) randomized; amortized update time O(log n/ log log n) randomized; amortized update time [2] [1] [3] [4] O(log n/ log log n) deterministic; amortized update time [5, 10] O(log n(log log n)3) O(log n/ log log log n) randomized; amortized update time [10] O(log2 n/ log log n) O(log n/ log log n) deterministic; amortized update time This paper Table 1: Performance of data structures for fully-dynamic graph connectivity. we add two systems of shortcuts to our data structure that together improve both update and query time by a factor of log log n. The simplification given in Section 3 is not important in order to get our improvement in Section 4; indeed, our result can easily be extended to maintain a spanning forest. However, we believe that our approach gives a slightly cleaner analysis and it should give a small improvement in practice. For instance, Thorup's data structure needs to maintain two types of bitmaps for edges, one for tree edges and one for non-tree edges whereas our data structure only needs to maintain one type; see Section 3.5 for details. Finally, we give some concluding remarks in Section 5. 2 Preliminaries Let log denote the base 2 logarithm. We assume the same model of computation as in [10], i.e., a pointer machine with words (bitmaps) containing at least ⌊log n⌋ + 1 bits and with the following standard AC 0 instructions: addition, subtraction, bitwise 'and', 'or', and 'not', and bit shifts. Our data structure also needs to perform division x/y and multiplication xy which are not AC 0 instructions. To handle this, we assume that y is a power of 2 so that a bit shift operation can be used instead; we can always round y to the nearest such value and the constant multiplicative error introduced will not affect correctness or running time. For a bitmap m, we denote by m[i] the ith bit of m, i ≥ 0. We let G denote the input graph and it is assumed to contain no edges initially. To distin- guish between vertices of G and other vertices (such as those in trees of our data structure), we refer to the latter as nodes. For a path P and nodes a, b ∈ P , P [a, b] is the subpath of P between a and b. We abbreviate balanced binary search tree as BBST and depth-first search as DFS. 3 A Simple Data Structure We first give a simplified version of our data structure which is no better than the deterministic data structures in [5] and [10]. In fact, it has a slower query time of O(log n). In Section 4, we shall speed up both query and update time by a factor of log log n. 3 3.1 The cluster forest As in [10], we assign to each edge e of G a level ℓ(e) between 0 and ℓmax = ⌊log n⌋ and for 0 ≤ i ≤ lmax, we denote by Gi the subgraph of G induced by edges e with ℓ(e) ≥ i. We refer to the connected components of Gi as level i clusters or just clusters. The following invariant will be maintained by our data structure: Invariant: For each i, any level i cluster spans at most ⌊n/2i⌋ vertices. The cluster forest of G is a forest C of rooted trees where each node u corresponds to a cluster C(u). The level ℓ(u) of u is its depth in C (between 0 and ℓmax) and a level i node corresponds to a level i cluster. In particular, roots of C correspond to level 0 clusters and hence to the connected components of G0 = G. By the invariant, each leaf of C corresponds to a vertex of G; we often identify the two and our data structure keeps bidirected pointers between them. A node u at a level i < ℓmax has as children the level (i + 1) nodes v such that C(v) ⊆ C(u). number of leaves in the subtree of C rooted at u. vertices of G spanned by C(u). This completes the description of the cluster forest. Our data structure will maintain, for each node u of C, an integer n(u) denoting the In other words, n(u) is the number of Given C, we can determine whether two vertices u and v are connected in G in O(log n) time as follows. Traverse paths from u and v to roots ru and rv of trees of C containing u and v, respectively. Then u and v are connected iff ru = rv. 3.2 Handling insertions We need to maintain C as G changes. First we describe how to update C after an operation insert(u, v). We initialize ℓ(u, v) ← 0. Letting ru and rv be defined as above, if ru = rv, no update of C is required since u and v were already connected in G = G0. If ru 6= rv, we update C by merging ru and rv into ru, meaning that ru inherits the children of rv, n(ru) is increased by n(rv), and rv is deleted. This update corresponds to merging C(ru) and C(rv). Thus C is correctly updated and the invariant still holds. 3.3 Handling deletions Now consider the update delete(u, v). Let i = ℓ(u, v) and let Cu and Cv be the level (i + 1) clusters containing u and v, respectively. Assume that Cu 6= Cv since otherwise, the connectivity in Gi is not affected (there is a uv-path in Gi+1 ⊂ Gi connecting u and v). Let Mi be the multigraph with level (i + 1) clusters as vertices and with level i-edges of G as edges (so an edge of Mi connects two vertices if that edge connects the corresponding level (i + 1) clusters in Gi). Our algorithm will not actually keep Mi but it will help to simplify the description in this subsection. We now execute two standard search procedures (say, DFS) in Mi, one, Pu, starting from vertex Cu and another, Pv, starting from Cv. The two procedures are executed in "parallel" by alternating between the two, i.e., one unit of time is spent on Pu, then one unit on Pv, then one unit on Pu, and so on. We terminate both procedures as soon as we are in one of the following two cases (which must happen at some point): 1. a vertex of Mi is explored by both procedures, 2. one of the procedures has no more edges to explore and we are not in case 1. 4 In the following, we show how to deal with these two cases. n(C) and nv = PC∈Cv Case 1: Let Cuv be the vertex (level (i + 1) cluster) of Mi explored by both procedures. Assume w.l.o.g. that Pv was the last to explore Cuv. Let Cu be the set of level (i + 1) clusters explored by Pu and let Cv be the set of level (i+1) clusters explored by Pv, excluding Cuv. If we n(C) then since Cu ∩Cv = ∅, we have nu + nv ≤ ⌊n/2i⌋ let nu = PC∈Cu by our invariant and thus min{nu, nv} ≤ ⌊n/2i+1⌋. Assume first that nu ≤ nv. Then we can increase the level of every edge explored by Pu from i to i + 1 without violating the invariant. To see this, note that the level updates correspond to merging clusters of Cu into one level (i + 1) cluster spanning nu ≤ ⌊n/2i+1⌋ vertices. The idea is that the search performed by Pu is paid for by these level increases. As Pv spent the same amount of time as Pu (up to an additive O(1) term), the level increases also pay for the search by Pv. We need to update cluster forest C accordingly. When increasing the level of an edge e from i to i + 1, we identify the level (i + 1)-ancestors a and b of the endpoints of e. Clusters C(a) and C(b) need to be merged and we do this by merging a and b into b and updating n(a) ← n(a) + n(b). As we will see later, this update can also be paid for by the level increase of e. Note that the procedures have found a replacement path in Gi for deleted edge (u, v) so no further updates are required in C, and we terminate. We assumed above that nu ≤ nv. We do exactly the same for clusters in Cv when nv ≤ nu except that we do not increase the level of the last edge explored by Pv as it connects to a cluster in Cu. If this was the only edge explored, there are no edges to pay for it but in this case we have found a replacement path for edge (u, v) and the delete(u, v)-operation can pay. Case 2: Now assume that one of the procedures, say Pu, explores all edges in the connected component of Mi containing Cu and that we are not in case 1. Let us assume that nu ≤ ⌊n/2i+1⌋; if not, we fully explore the connected component of Mi containing Cv and update nv which will be at most ⌊n/2i+1⌋ by our invariant; the description below then applies if we swap the roles of u and v. We can conclude that no replacement path for (u, v) exists in Gi. All edges explored by Pu have their level increased to i + 1 and we update C accordingly by merging all level (i + 1) nodes explored by Pu into one, w, and setting n(w) to the sum of n(w′) for nodes w′ explored by Pu. These level increases pay for the two searches. Since Cu and the component of Mi containing Cv are no longer connected in Gi, we further update C as follows: let p be the parent of w in C. We remove w as a child of p, decrease n(p) by n(w), add w as a child of a new level i node p′, set n(p′) = n(w), and add p′ as a child of the parent of p. This correctly updates C and the invariant is maintained. If i > 0, it may still be possible to reconnect u and v in Gj for some j < i. We thus execute the above algorithm recursively with i ← i − 1, Cu ← C(p′), and Cv ← C(p). Should we end up in case 2 with i = 0, no replacement path in G between u and v could be found. Then p′ becomes a new root of C and we terminate. 3.4 Local trees We now extend our data structure to allow the search procedures to explore edges and vertices of multigraph Mi in a more efficient way. 5 First we shall convert C into a forest of binary trees by adding local trees as in [10]. Let u be a non-leaf node of C. We form a binary tree L(u) with u as root and with the children of u as leaves as follows. First assign a rank rank(v) ← ⌊log n(v)⌋ to each child v of u. Initially, each such v is regarded as a tree consisting just of v. While there are trees T and T ′ whose roots r and r′ have the same rank, we pair them by attaching r and r′ to a new root r′′ with rank(r′′) ← rank(r) + 1. We end up with at most log n trees T1, . . . , Tk, called rank trees, whose roots r1, . . . , rk have pairwise distinct ranks: rank(r1) > rank(r2) > ··· > rank(rk). We connect the rank trees into a single local tree L(u) rooted at u by adding a rank path v1v2 . . . vk−1 down from v1 = u and connecting ri as a child to vi for i = 1, . . . , k − 1 and rk as a child to vk−1. We define rank(u) ← ⌊log n(u)⌋. The edges in C from u to its children are replaced by local tree L(u); let CL be C after all local trees have been added. As shown by Thorup, for a child v of a node u in C, the depth of v in L(u) is at most log(n(u)/n(v)) + 1. Since any leaf of C has depth at most ℓmax = ⌊log n⌋, a telescoping sums argument implies that any leaf of CL has depth O(log n). Refer to nodes of CL that are also nodes of C as C-nodes. Our data structure will maintain CL as well as n(u) for each C-node u and rank(v) for each node v ∈ CL. 3.5 Searching for edges We shall use CL to search for edges in Mi. To facilitate this, we associate a bitmap edge(u) with each node u of CL where edge(u)[i] = 1 iff a level i-edge is incident to a leaf of the subtree of CL rooted at u.1 We can use these bitmaps to search for the edges of Mi. Consider one of the search procedures, say Pu, described above. At any point in the search, a set of vertices of Mi have been explored and these correspond to level (i + 1) nodes in CL that we mark as explored. With the bitmaps, we identify unexplored descendant leaves of marked nodes in CL that are incident to level i-edges and hence to edges of Mi that should be explored by Pu. At each leaf, we have all incident edges grouped according to their level. A BBST is kept which allows us to get down to a particular group in O(log ℓmax) = O(log log n) time. When a level i-edge (a, b) is explored in the direction from a to b, we determine the endpoint in Mi corresponding to b by moving up from leaf b to the ancestor level (i + 1) node in CL. Finally, we mark this level (i + 1) node as explored. Since CL has O(log n) height, we can execute Pu in O(log n) time per edge explored. 3.6 Maintaining CL We now describe how to maintain CL as C is updated. Let us consider the update in C of merging nodes u and v into u. In CL, this is done by first removing the rank paths in L(u) and L(v), leaving at most log n rank trees of distinct ranks for each of the nodes u and v. We may assume that rank trees are kept in two lists sorted by the ranks of their roots and we merge the two lists into one and start pairing up trees whose roots have the same rank, in the same way as above. We connect their roots with a new rank path, thereby creating the new L(u) and we identify its root with u. Total time for a merge is O(log n). We also need to update CL when a child b in C is added to or removed from a node a (we need this when failing to find a replacement path at some level). If b is to be added, we can 1Thorup's data structure needs two bitmaps in order to distinguish between tree edges and non-tree edges whereas we only need one; edge(u) can be regarded as the bitwise 'or' of his two bitmaps. 6 regard it as a trivial rank tree that should be added to L(a). This can be done in O(log n) time using the same approach as for merging. If b is to be removed, we first remove the rank path of L(a) and identify the rank tree Tb containing b. We delete the path from b to the root of Tb, thereby partitioning this rank tree into O(log n) smaller rank trees, sorted by ranks. We pair up rank trees as described above and add a new rank path to form the updated L(a). All of this can be done in O(log n) time. 3.7 Maintaining bitmaps Finally, we need to update integers n(u) for C-nodes u as well as the edge-bitmaps. The former is done exactly as in Sections 3.2 and 3.3 so let us focus on the bitmaps. If a level i-edge e is removed, we do the following for each of its endpoints a. In the leaf a of CL, we check in O(log log n) time if e was the only level i-edge incident to a. If so, we set edge(a)[i] ← 0 and we move up CL, updating the bitmap of the current node as the bitwise 'or' of its children. Since CL has O(log n) height, only O(log n) bitmaps need to be updated. Similarly, if e is added, we set edge(a)[i] ← 1 and update bitmaps for ancestors in the same way. For nodes of CL whose children change, we also update their bitmaps bottom up by taking the bitwise 'or' of their children. Only O(log n) nodes are affected in CL after an update in C so total time is O(log n). This completes the description of the first version of our data structure. Correctness follows since the data structure is a simple variation of that of Thorup where spanning trees of clusters are not kept; rather, our search procedures certify that a spanning tree exists for an explored component and this suffices to maintain the cluster forest. From the analysis above, our data structure handles updates in O(log2 n) amortized time and queries in O(log n) time. In the next section, we speed up both bounds by a factor of log log n. 4 An Improved Data Structure In this section, we give our improved data structure. Before going into details, let us highlight the main differences between this structure and that of the previous section. One ingredient is to add shortcuts to CL. Each shortcut skips O(log log n) nodes and this will allow our search procedures to walk up trees of CL in O(log n/ log log n) time per traversal when identifying visited nodes of a multigraph Mi. Adding these shortcuts essentially corresponds to turning the forest CL of binary trees into one consisting of trees with a branching factor of order log n, and reducing the height of the trees to order log n/ log log n. Furthermore, we will modify CL by using lazy local trees similar to those of Thorup [10] instead of the local trees presented in the previous section. This is done to maintain CL more efficiently during changes. Unfortunately, Thorup's lazy local trees increase the height of CL to O(log n log log n) so our shortcuts will not give any speed-up over the data structure in the previous section. Instead, we shall use a slightly more complicated type of lazy local tree which has the properties we need while keeping the height of CL bounded by O(log n). The idea is to partition the children of each node of C into so called heavy children and light children and construct the lazy local tree only for the light children and the local tree of the previous section for the heavy children. Balancing this in the right way will ensure a logarithmic depth of trees while still getting the speed-up from lazy local trees. Finally, we will need another system of shortcuts for quickly identifying edges to be explored by the search procedures; Thorup uses a similar system but it does not fit into our framework as our lazy local trees are different from his. As shown in 7 Th(u) u Tl(u) top tree Figure 1: Lazy local tree L(u). Rank trees are black, top and bottom trees are white, the buffer tree is grey, nodes of L(u) ∩ C are white, and nodes of L(u) \ C are grey. Lemma 6 in Section 4.7, with these shortcuts, the search procedures can visit edges in only O(log n/ log log n) time per edge plus an additive O(log n) if we are in case 1 in Section 3.3; note that the latter can be paid for by the delete operation since a replacement path for the deleted edge has been found. In Section 4.6, we define these shortcuts and in Section 4.7, we give an algorithm that uses these shortcuts to explore level i-edges; we refer to it as a level i-iterator or just iterator. 4.1 Lazy local trees Thorup [10] introduced lazy local trees and showed how they can be maintained more effi- ciently than the local trees in Section 3.4. Let u be a non-leaf node of C and let L be the set of children of u. To form the lazy local tree of u, L is divided into groups each of size at most 2(log n)α, where α is a constant that we may pick as large as we like. The nodes in each group are kept in a BBST ordered by n(v)-values. One of these trees is the buffer tree while the others are the bottom trees. The root of a bottom tree has rank equal to the maximum rank of its leaves. These bottom trees are paired up to form at most log n rank trees, as described in Section 3.4. The roots of the rank trees together with the root of the buffer tree are leaves of a BBST called the top tree where leaves are ordered according to rank (and the root of the buffer tree is regarded as, say, the smallest element). Together, these trees form the lazy local tree of u which is rooted at the root of the top tree. Note that bottom, buffer, and top trees have polylogarithmic size only. It is ensured by the data structure of Thorup that for each bottom tree B, new leaves are never added to B and ranks of leaves in B are not changed. This will also hold for our data structure. We shall use these lazy local trees to improve update time to O(log2 n/ log log n). However, it is easy to see that due to the BBSTs in lazy local trees, if we form CL with these trees, the depth of CL becomes O(log n log log n). If we use the same approach as in the previous section, we thus increase query and update time by a factor of log log n. Adding shortcuts to CL will avoid this slowdown but this gives a data structure with the same bounds as in the previous section. To handle this, we introduce a new type of lazy local trees. Let u be a non-leaf node of C. A child v of u in C is said to be heavy if n(v) ≥ n(u)/ logǫ n and otherwise it is light; here ǫ > 0 is a constant that we may pick as small as we like. It is rooted at u and has two children. One child is the root of a tree Th(u) having the heavy children of u as leaves and the other child is the root of a tree Tl(u) having the light children of u as leaves (to simplify Our lazy local tree L(u) of u is illustrated in Figure 1. 8 the description, we assume that u has both light and heavy children; if there were no light (resp. heavy) children, we would simply identify L(u) with Th(u) (resp. Tl(u))). We call Th(u) the heavy tree (of u) and it is defined as the local tree from the previous section over the heavy children of u; note that its size is asymptotically bounded by the number of heavy children of u which is at most logǫ n. The tree Tl(u) is called the light tree (of u) and it is Thorup's lazy local tree for the set of light children of u. The following lemma shows that when CL is formed from C by inserting these lazy local trees, the height of trees in CL is only a constant factor larger than that in Section 3. Lemma 1. The height of CL (with lazy local trees) is O(log n). Proof. Let u be a non-leaf node in C and let v be one of its children, also in C. If v is a heavy child of u then v ∈ Th(u) so its depth in L(u) is at most log(n(u)/n(v)) + 1. Now assume that v is a light child of u. Then v belongs to either a bottom tree or the buffer tree of L(u). In the latter case, the depth of v in L(u) is O(log log n). In the former case, let B be the bottom tree containing v and let w be a leaf of B maximizing n(w). By definition, the root of B has rank rank(w). Hence the depth of v in L(u) is at most log(n(u)/n(w)) + O(log log n) ≤ log(n(u)/n(v))+O(log log n). This is O(log(n(u)/n(v))) as n(v) < n(u)/ logǫ n implies log log n = O(log(n(u)/n(v))). It follows that in both cases, v has depth O(1 + log(n(u)/n(v))) in L(u). The height of C is at most log n so by a telescoping sums argument, CL has height O(log n), as desired. 4.2 Maintaining lazy local trees Now, let us describe how to maintain lazy local trees of CL corresponding to changes in C. For technical reasons, we assign ranks to rank path nodes in heavy trees by rank(vi) = rank(ri) for i = 1, . . . , k − 1, where vi and ri are defined as in Section 3.4. In the following, rank nodes are nodes that are assigned a rank. Note that every node of CL is a rank node except non-leaf nodes of a buffer or top tree and nodes of a bottom tree B that are neither leaves nor the root of B. 4.2.1 Merging We need to maintain lazy local trees when merging C-nodes and when adding and removing children from C-nodes. We start with merging. Consider two C-nodes u and v that are to be merged into u. Denote by u′ the updated u after the merge. Note that every heavy child of u′ must be a heavy child of either u or v. Hence, we can form Th(u′) by traversing every leaf w of Th(u) and Th(v) and adding it as a leaf of Th(u′) iff n(w) ≥ n(u′)/ logǫ n. Total time for this is O(Th(u) + Th(v)) = O(logǫ n). Forming Tl(u′) is done as in [10]. The two buffer trees are merged in time bounded by the smaller of the two trees. If the number of leaves of the merged buffer tree exceeds logα n, it is turned into a bottom tree for u′, leaving an empty buffer tree. The root of the new bottom tree is paired up with other rank nodes, if needed. We can pay for all buffer tree merges by giving a node (log log n)2 credits when it switches from not belonging to belonging to a buffer tree: every time it is moved to another buffer tree, we spend O(log log n) time for the node and the size of the buffer tree containing the node grows by a factor of at least 2; hence the node is moved at most O(log log n) times before either being deleted or being moved to a bottom tree. 9 We propose a different approach for merging top trees than that of Thorup; we feel ours is simpler as it avoids keeping a special bitmap associated with each top tree node. Assume w.l.o.g. that the top tree T (u) in Tl(u) is no bigger than the top tree T (v) in Tl(v). For each leaf of T (u) we binary search for a leaf with the same rank in T (v) in O(log log n) time. While there are roots with equal ranks, we pair them up as before, finally obtaining the top tree for Tl(w). The time for this is O(T (u) log log n) plus time bounded by the number of new rank nodes created. Below we will show how the creation of rank nodes are paid for when they are deleted. With an amortized analysis similar to that above for buffer trees, we can pay for all top tree updates if we assign (log log n)2 credits to a node when it switches from not appearing to appearing as a leaf in a top tree, and if we borrow (log log n)2 credits whenever we delete a leaf of a top tree (thereby borrowing from a new rank node) and distribute these borrowed credits evenly among the remaining leaves. Since n(u′) = n(u) + n(v), we may have some leaves w ∈ Th(u) ∪ Th(v) with n(w) < n(u′)/ logǫ n and hence w should belong to Tl(u′). All such nodes are added to the buffer tree; as before, this tree is turned into a bottom tree if it gets more than logα n leaves. Total time for this is O(logǫ n log log n) (plus time bounded by the number of new rank nodes created) since at most 2 logǫ n nodes need to be moved from Th(u) ∪ Th(v). Finally, let p be the parent of u and v in C; below we will add shortcuts that allow us to identify p from u (equivalently from v) in O(log n/ log log n) time (Lemma 3). We remove u and v as leaves of L(p) and then we add u′ as a leaf of Th(p) if n(u′) ≥ n(p)/ logǫ n and otherwise we add u′ as leaf of the buffer tree in Tl(p). This takes O(log log n) time since both the buffer tree and Th(p) have poly-logarithmic size and their roots have depth O(log log n) in L(p). 4.3 Removing a child Consider removing a C-node child v of a C-node u and adding it as a child of a new C-node w which is added as a child of the parent C-node p of u. We first focus on removing v and we let u′ denote u after this update. Assume first that v ∈ Th(u). After removing v from Th(u), we have n(u′) = n(u) − n(v) and hence some nodes may need to be moved from Tl(u) to Th(u) in order to form L(u′). Identifying such nodes in the buffer tree of Tl(u) can be done in O(log log n) time per node. Now suppose w is a leaf of a bottom tree B that needs to be moved to Th(u). Let b be the root of B and let a be the leaf of the top tree of Tl(u) having b as descendant. Since rank(b) ≥ rank(w) ≥ ⌊log(n(u′)/ logǫ n)⌋ > ⌊rank(a) − ǫ log log n⌋ and since ranks are strictly decreasing on the path from a to b, b has depth at most ⌈ǫ log log n⌉ in the subtree of Tl(u) rooted at a. A DFS from a identifies all bottom tree roots with at most this depth in O(logǫ n) time; let La be the set of leaves in these bottom trees that need to be moved to Th(u). Using binary search in the O(logǫ n) bottom trees, we identify La and move it to Th(u) in time O((logǫ n + La) log log n). Since all rank leaves of the top tree of Tl(u) have distinct ranks, there are only O(log log n) choices for a. Also, the maximum number of leaves to be moved is bounded by the number of leaves of Th(u′) which is at most logǫ n. Total time is thus O(logǫ n(log log n)2). We may also need to move u in L(p). If u belongs to a bottom tree in Tl(p), we move it to the buffer tree as we do not allow ranks of leaves in bottom trees to change. We also move u to the buffer tree if u ∈ Th(p) and n(u′) < n(p)/ logǫ n. As we saw for merge, the time for this is O(log n/ log log n). 10 As in [10], we need to do more global updates whenever removing a leaf from a bottom tree B of Tl(u) reduces the maximum rank of leaves in B and hence the rank of the root b of B. We use a similar approach and amortized analysis as Thorup here: first, delete all rank nodes from b to the ancestor leaf a of the top tree of Tl(u). Then pair nodes of equal rank as before. For the amortized analysis, we can assume that the graph G ends with no edges so all rank nodes end up being deleted and we can amortize creation of rank nodes in Tl(u) over deletion of rank nodes in Tl(u). A rank node is only deleted when a bottom tree root has its rank reduced. Since a rank is at most log n, a particular bottom tree can have its root rank reduced at most log n times (nodes are never added to a bottom tree and ranks of bottom tree leaves do not change) so in total it gives rise to at most log2 n rank node deletions for that bottom tree. But since a bottom tree starts out with (log n)α leaves that will all be deleted eventually, we can amortize each rank node deletion over (log n)α−2 deletions of bottom tree leaves. When removing child v, we delete at most logǫ n leaves from bottom trees of Tl(u) in order to form L(u′) so we can amortize each rank node deletion over (log n)α−2−ǫ deletions of children in C. Hence if we pick constant α ≥ 2 + ǫ, we can afford to pay for rank node deletions and also to pay for the (log log n)2 credits that may have been borrowed from a rank node during a merge. It remains to consider the case v ∈ Tl(u). Above we showed how to efficiently remove up to order logǫ n leaves from Tl(u) so clearly the single leaf v can also be removed efficiently. We then move additional leaves from Tl(u) to Th(u) and move u to Th(p) or to the buffer tree of Tl(p), as above. 4.4 Adding a child Now consider adding v as a child of w and w as a child of p. The former is trivial as w has no children before adding v. If n(v) ≥ n(p)/ logǫ n, we add w to Th(p) and otherwise we add it to the buffer tree of Tl(p). Given p, total time for this is O(log log n). 4.5 Shortcutting In order to get our log log n speed-up for updates and queries, we need to be able to traverse CL faster. Thorup [10] introduced a system of shortcuts for quickly identifying certain edges incident to clusters. This will not suffice in our approach since for our search procedures, we also need to move quickly from a leaf of CL to its ancestor level i node in order to identify the associated level i cluster, for some i. We therefore introduce a different system of shortcuts in the following. To avoid skipping past a level i node with these shortcuts, our data structure associates, for each node of a heavy tree Th(u), the level ℓ(u) of u. We can easily extend the data structure for lazy local trees to maintain these values within the same time bound since Th(u) has only size O(logǫ n). Let us color each node of CL either white or black. For the coloring below, we define a black-induced child of a node u ∈ CL to be a black descendant v of u such that all interior nodes on the path from u to v in CL are white. If u is black, we add a shortcut between u and each of its black-induced children. The shortcut is directed to u, allowing us to move quickly up in CL. The black-induced parent of a node is defined similarly. Note that the shortcuts (with directions reversed) form a forest of rooted trees over the black nodes. Now, let us define the coloring of nodes of CL. The following nodes are colored black: 1. every C-node u with ℓ(u) = i⌊ǫ log log n⌋ for some integer i, 11 2. every rank node u having a parent rank node v in CL such that rank(u) ≤ i⌊ǫ log log n⌋ < rank(v) for some integer i, 3. every leaf of CL and of every buffer, bottom, and top tree, and 4. every node of a buffer, bottom, and top tree whose depth in that tree is divisible by ⌊ǫ log log n⌋ (in particular, every root of such a tree is black). A black node is of type 1, 2, 3, and/or 4, depending on these four cases. All other nodes are colored white. For performance reasons, we shall only maintain edge-bitmaps for black nodes. Lemma 3 below shows that these shortcuts give a log log n speed-up when moving up a tree of CL. We first need the following result. Lemma 2. Ranks are non-decreasing along any simple leaf-to-root path in CL. Between any two consecutive C-nodes on such a path, there are at most two pairs of nodes of equal rank. Proof. The first part of the lemma will follow if we can show that ranks are non-decreasing along any simple leaf-to-u path P in a lazy local tree L(u). This is clearly the case for leaves in Th(u). A leaf v in Tl(u) either belongs to a bottom or buffer tree T . Assume the former since otherwise, u and v are the only rank nodes on the v-to-u path P and since both are C-nodes, rank(u) ≥ rank(v). Only the first node v and last node r of subpath P [v, r] = T ∩ P are rank nodes. Since r is the root of T , it has maximum rank among leaves in T so rank(v) ≤ rank(r). Let l be the leaf of the top tree of L(u) belonging to P . All nodes on P [r, l] belong to a rank tree so ranks are increasing along this subpath. For the subpath P [l, u], only l and u are rank nodes. Let L be the set of leaves of Tl(u) formed by picking one of maximum rank from each bottom tree descending from l. Then rank(l) ≤ ⌊log(Pu′∈L n(u′))⌋ ≤ ⌊log n(u)⌋ = rank(u). This shows the first part of the lemma. For the second part, let u and v be C-nodes where v is a child of u. Assume first that v is a leaf of Th(u). Ranks are strictly increasing on the path from v to the root r of the rank tree containing v. Ranks are also strictly increasing along the rank path in Th(u). Hence, there are at most two pairs of equal rank nodes in CL between u and v, namely r and its parent and the root of Th(u) and u. Now consider the case where v is a leaf of Tl(u) and again assume it belongs to a bottom tree B. Let r be the root of B and let l be the leaf of the top tree which is an ancestor of v. Then again, since ranks are strictly increasing along any leaf-to-root path in a rank tree, there can be at most two equal-rank pairs between u and v, namely (v, r) and (l, u). This completes the proof. Lemma 3. Given CL with shortcuts, given a level i, and given a C-node of CL with an ancestor level i node, we can identify this ancestor in O(log n/ log log n) time. Proof. Let v be the given node. To identify the ancestor level i node u of v, we start by traversing the v-to-root path of the tree in CL containing v and we stop if we reach u or a black node. Since v is a C-node and since light trees have black leaves, all nodes visited are rank nodes. Lemma 2 then implies that we visit at most O(log log n) nodes before stopping. Hence, the traversal takes O(log log n) time. Assume that we reach a black node b1 as we are done if we reach u. From b1 we traverse shortcuts until we get to the lowest-depth black node b2 having u as ancestor. Finally we traverse the b2-to-root path in CL until we reach u. The latter takes O(log log n) time by an argument similar to the above. 12 Next we show that there are O(log n/ log log n) shortcuts between b1 and b2. Since C has logarithmic height, there are only O(log n/ log log n) shortcut endpoints of type 1. Lemma 2 implies the same bound for shortcut endpoints of type 2. If a shortcut ends at a type 3 node b which is a leaf of a buffer or bottom tree, it means that we enter a light tree Tl(w). We encounter only one additional type 3 node in Tl(w), namely a leaf of a top tree. Since n(w) > n(b) logǫ n we have rank(w) > rank(b) +⌊ǫ log log n⌋ and since a rank is at most log n, Lemma 2 implies that we encounter no more than O(log n/ log log n) type 3 nodes between b1 and b2. Finally, this bound on the number of type 3 nodes and Lemma 1 give the same asymptotic bound on the number of type 4 nodes. What remains is to describe how to avoid jumping past u when traversing the shortcuts. Let (b2, b3) be the shortcut that jumps past u, if any. Since leaves of light trees are black, b3 must belong to some heavy tree Th(wb3 ). If b2 belongs to a light tree, it must belong to the root of the top tree in Tl(u) since that root is black. We can avoid this case as follows: whenever we reach the root of a top tree, its parent is a C-node and we compare its level with i to determine whether we should continue with the shortcuts. Now, consider the case where b2 belongs to a heavy tree Th(wb2 ). Recalling that for every node of a heavy tree Th(w) we keep the level ℓ(w) of w, we can check that ℓ(wb2) ≤ i < ℓ(wb3 ) to detect that a is the last node that we should visit with shortcuts. This completes the proof. 4.6 Induced shortcuts Lemma 3 allows us to speed up part of our search procedure, namely identifying the endpoints (level (i + 1) clusters) of an edge in a multigraph Mi from the endpoints of the corresponding edge in G; we can do this in O(log n/ log log n) time per endpoint. We also need a faster iterator for level i-edges incident to explored level (i + 1) clusters. We focus on this in the following. Define an i-induced forest Fi as in [10]: its i-induced leaves are the leaves of CL with an incident level i-edge. Its i-induced roots are the level (i + 1) nodes of CL having descendant Its i-induced branch nodes are the nodes of CL with both children have i-induced leaves. descending i-induced leaves. The i-induced parent of an i-induced node is its nearest i- induced ancestor. This defines Fi. A straightforward level i-iterator performs a DFS in a tree of Fi. However, maintaining the edges of Fi will be too expensive. Instead, we introduce a new system of shortcuts in CL that will allow the DFS to move between any two incident i-induced nodes of Fi in O(log n/ log log n) time. Since a tree of Fi is binary, the number of branch nodes of T is bounded by the number of leaves of T , so this will give a level i-iterator with O(log n/ log log n) amortized time per level i-edge. In the following, we define the new shortcuts. Refer to the following types of nodes of CL as special: 1. every C-node u with ℓ(u) = i⌊log log n⌋⌊ǫ log log n⌋ for some integer i, 2. every leaf of CL, and 3. every rank node u of a light tree with rank(u) = i⌊log log n⌋⌊ǫ log log n⌋ for some integer i. Note that every special node is black. Also note that we defined type 3 special nodes using equality rather than inequality as for type 2 black nodes. This suffices since ranks increase 13 by 1 as we move up rank nodes of a light tree; this is not the case in heavy trees where ranks can increase by larger values along a rank path. For a special node u, define a special child of u to be a descendant special node v such that all nodes between u and v are not special. Special parents are defined similarly. For any level i, if there is a unique special child v of u for which edge(v)[i] = 1, we add a shortcut (bidirected pointer) between u and v. To distinguish these shortcuts from those of Section 4.5, we refer to the former as i-induced shortcuts or just induced shortcuts and the latter as standard i-shortcuts or just standard shortcuts. Observe that for all i-induced shortcuts (a, b), where b is a special child of a, there is an edge in Fi from a or an ancestor of a to b or a descendant of b. For each special node u, we keep a BBST with a leaf for each i containing the i-induced shortcuts to a special child and/or parent (if they exist). 4.7 Faster iterator Now let us present the level i-iterator. It starts at the root v of a tree in Fi, i.e., v is a level (i + 1) node of CL. It performs a DFS of the subtree of CL rooted at v with the following if it visits a black node w for which edge(w)[i] = 0, it backtracks; if it visits modification: a special node w′ with an i-induced shortcut to a special child, it visits this special child instead of the children of w′ in CL. When it reaches a leaf l of CL, it identifies the group of incident level i-edges with a binary search in the BBST associated with l and then iterates over these edges. This completes the description of the level i-iterator. Lemma 6 below shows the performance of the level i-iterator. To prove it, we need two additional lemmas. Lemma 4. Any node of CL has only O((log n)3ǫ) black-induced children. Proof. Let u be a node of CL. If u is a non-leaf node of a bottom, buffer, or top tree, the lemma follows from the definition of type 3 and 4 black nodes. Otherwise, u is a rank node. For any black-induced child v of u, Lemma 2 and the definition of type 1 and 2 black nodes imply that v has depth at most 3ǫ log log n in the subtree of CL rooted at u. As CL is binary, the lemma follows. Lemma 5. For any i-induced shortcut (a, b), the simple a-to-b path in CL has length O((log log n)4). Proof. Let P be the simple a-to-b path in CL. Clearly, P contains only O((log log n)2) C- nodes. Let P ′ be a subpath of P containing no C-nodes. Then P ′ is either contained in a heavy or a light tree. In the former case, P ′ = O(log log n). In the latter case, we encounter at most O(log log n) nodes of buffer, bottom, and top trees on P ′. Since consecutive rank nodes of P ′ differ in rank by exactly 1 (as they all belong to a light tree and hence to a rank tree), we encounter at most O((log log n)2) rank nodes on P ′ so P ′ = O((log log n)2). Lemma 6. The level i-iterator above traverses a tree in Fi with k leaves in O(k log n/ log log n) time. The time to visit the first k′ leaves is O(k′ log n/ log log n + log n). Proof. Correctness follows easily from the definition of edge-bitmaps, i-induced shortcuts, and BBSTs associated with leaves of CL so let us focus on the time bound to traverse a k-leaf tree T in Fi. Let TL be the tree in CL obtained by replacing each edge (a, b) ∈ T with the corresponding simple path P in CL between a and b. By Lemmas 1 and 2, there can only be O(log n/(log log n)2) special nodes on such a path P . Hence, since T has no degree 2-vertices, the total number of special nodes and hence i-induced shortcuts traversed by the 14 level i-iterator in TL is O(k log n/(log log n)2). For each special node visited, O(log log n) time is spent on binary search to find the next i-induced shortcut, if it exists. Hence, the total time spent on visiting special nodes and traversing i-induced shortcuts is O(k log n/ log log n). We will now show that the number of additional nodes visited by the DFS is O(k(log n)3ǫ(log log n)4). Since only constant time is spent for each such node, this will show the first part of the lemma. First we bound the number of visited nodes of TL which are not special. Let (a, b) and P be as above. If we traverse P from a then it follows from Lemma 5 that after at most O((log log n)4) nodes, we will reach either b or a special node a′. Similarly, if we traverse P from b then after at most O((log log n)4) nodes, we will reach either a or a special node b′. If a′ and b′ exist then all nodes visited by the DFS on P [a′, b′] are special nodes connected by i-induced shortcuts. Summing over all such paths P , it follows that the total number of nodes visited on TL which are not special is O(k(log log n)4). Finally, let us bound the number of nodes of CL visited by the DFS which are not on TL. Consider a visited node u ∈ TL and let v /∈ TL be a visited node such that u is the nearest ancestor of v belonging to TL. Note that there is no i-induced shortcut from u to a special child since then the DFS would have traversed this shortcut instead of the children of u in CL. In particular, there are only O(k(log log n)4) choices for u. Furthermore, all interior nodes on the simple path from u to v in CL are white since any black node w would have edge(w)[i] = 0 (as w /∈ TL), meaning that the DFS would have backtracked before reaching v. By Lemma 4, there are only O((log n)3ǫ) choices for v for each u. Hence, the total number of nodes visited which are not on TL is O(k(log n)3ǫ(log log n)4). This shows the first part of the lemma. For the second part, consider a partially grown DFS tree T ′ which has visited k′ leaves. For every node of T ′ having two children, at least one of the two subtrees rooted at the children is fully explored. Hence, T ′ consists of a path P from the root of T to a leaf of T with fully explored subtrees attached to P . The same argument as above shows that the total time to explore these subtrees is O(k′ log n/ log log n). By Lemma 1, it takes O(log n) time to explore P (the number of special nodes on P is O(log n/(log log n)2) so we only spend a total of O(log n/ log log n) time on binary searches for these nodes). It follows from Lemma 6 that the level i-iterator spends O(log n/ log log n) amortized time per edge visited plus additional O(log n) time if a replacement path was found (if such a path is not found, an entire tree in Fi is traversed). The O(log n/ log log n) amortized time per edge is paid for by the increase in the level of the edge and the O(log n) time is paid for by the deletion of an edge in G since at most one replacement path is found for such an edge. It remains to describe how colors, shortcuts (standard and induced) and edge-bitmaps are maintained when C (and hence CL) is updated and when edges of G are added/removed or change level. First we deal with changes to C. The following lemma will prove useful. Lemma 7. Given edge-bitmaps of black nodes and given a special node u, we can find the induced shortcuts between u and its special parent (if any) in O(log n) time. For any i, we can find the i-induced shortcut from u to a special child or determine that no such shortcut exists in O((log n)3ǫ(log log n)4) time. Proof. We first walk up CL from u to identify its special parent p. By Lemma 5, this takes O((log log n)4) time. Then we perform a DFS in the subtree of CL rooted at p and backtrack if we encounter u or a black node which is not an ancestor of u. If any such black node is encountered for which the ith bit of its edge-bitmap is 1 then we know that there should not be an i-induced shortcut between u and p. Otherwise there should be iff edge(u)[i] = 1. 15 Let m be the bitmap obtained by taking the bitwise 'or' of the edge-bitmaps of visited black nodes not on the u-to-p path. By Lemmas 4 and 5, finding m takes O((log n)3ǫ(log log n)4) time. Now, there is an i-induced shortcut between u and p iff m[i] = 0 and edge(u)[i] = 1. Hence, all induced shortcuts between u and p can be found in O(log n) time. To find the i-induced shortcut (if any) to a special child of u, we make a DFS from u which backtracks when reaching a black node. Suppose exactly one visited black node w has edge(w)[i] = 1 (otherwise, there is no i-induced shortcut). If w is special, we have identified the i-induced shortcut (w, u). Otherwise, we recurse on w. As above, total time for this is O((log n)3ǫ(log log n)4). 4.8 Structural changes Let us now describe how shortcuts and edge-bitmaps are maintained after structural changes to CL. It follows from Lemma 4 that for each update to CL, we can update colors, standard shortcuts and edge-bitmaps in O((log n)3ǫ) time. From the results in Section 4.2, this will not affect the overall time bound (if we pick constant α sufficiently large). In the following, we thus only consider updating induced shortcuts. We shall restrict our attention to structural changes caused by a delete-operation as insert corresponds to merging two clusters (or none), a type of update that needs to be supported during a delete. Recall that after a delete-operation, C is updated as follows: some children of a node u are removed and merged into a single node; this node is either added as a child of u (if a replacement path was found) or it is added as a child of a new node u′ which is added as a child of the parent p of u and the process is repeated recursively on p (if a replacement path was not found). We observe that all C-nodes whose children are updated are contained in two leaf-to-root paths in C after the delete-operation has been executed. There are two types of induced shortcuts that need to be updated, those incident to a type 1 special node and those descending from a type 3 special node and not ascending from a type 1 special node (see definitions of types in Section 4.6). Below we show how to update the latter. For the former, it follows from the above that we only need to focus on type 1 special nodes on a leaf-to-root path P in CL (there are two paths but they are handled in the same manner). Let u1, . . . , uk be the sequence of special nodes as we move up P during the delete-operation (some of them may be new or merged nodes and hence do not exist before the delete-operation). By Lemma 7, we can find all induced shortcuts descending from u1 in O((log n)1+3ǫ(log log n)4) time. When we reach uj, j > 1, we compute induced shortcuts between uj−1 and uj. By Lemma 7, this takes O(log n log log n) time (including binary searches in the BBSTs of uj−1 and uj) for a total of O(log2 n/ log log n) over all j which the delete-operation can pay for. We also compute induced shortcuts descending from uj for those i for which edge(uj)[i] = 1 and edge(uj−1)[i] = 0. Total time over all j is O((log n)1+3ǫ(log log n)4) since if edge(uj)[i] = 1 then edge(uj ′)[i] = 1 for all j′ > j, implying that the second part of Lemma 7 is applied at most once for each i. Note that all i-induced shortcuts from uj to a special child which have not been identified by the second part of Lemma 7 must have edge(uj)[i] = edge(uj−1)[i] = 1 and hence must connect uj to uj−1 which we have computed above. Hence, we correctly compute all induced shortcuts incident to special nodes on P and we do so within the desired time bound. Now we show how to maintain induced shortcuts descending from a type 3 special node 16 p and not ascending from a type 1 special node. We may assume that p is not on one of the leaf-to-root paths considered above. Then the only structural changes to CL that may require such shortcuts to be updated are 1. a type 3 special node is created or deleted, or 2. a leaf is removed from a bottom tree in the light tree containing p. A type 3 special node can pay any polylogarithmic amount when it is created/deleted so consider updating induced shortcuts descending from p when a leaf u is removed from a bottom tree B in the light tree Tl(w) containing p. To handle this case, we will assume that each rank node of Tl(w) has log n/ log log n credits for each i for which it is an i-induced branch node. To see that this assumption can be made, first observe that when a buffer tree is turned into a bottom tree, it can pay any polylogarithmic amount if we pick α sufficiently big. This is also the case when a new rank node of Tl(w) is created/deleted. Since we never add but only remove leaves from bottom trees, the only other way a rank node of Tl(w) can become an i-induced branch node is if some edge of G has its level increased to i. Such an edge can only contribute with two i-induced branch nodes to Fi (one for each of its endpoints) so we may add log n/ log log n credits to the two new i-induced branch nodes which the level increase can pay for. This shows the desired. Let branch(u) be the bitmap where branch(u)[i] = 1 iff there is an i-induced branch node v 6= u on the path from u to p. By Lemmas 4 and 5, we can form branch(u) in O((log n)3ǫ(log log n)4) time which the removal of u from B can pay for. For each i for which branch(u)[i] = 1, the removal of u may require us to compute an i-induced shortcut descending from p. Since a branch node is removed in the process, we can spend its credits to pay for applying Lemma 7 to find this shortcut. We can binary search for each of the k 1-entries of branch(u) in O(k log log n) time; for instance, to determine whether the lower half of branch(u) has any 1-bits, we can take the bitwise 'and' of branch(u) and a precomputed bitmap having 1-bits in the lower half and 0-bits in the upper half. The 'and' is 1 iff there are 1-bits in the lower half of branch(u). Now consider an i for which branch(u)[i] = 0. We may assume that a bitmap induced(p) associated with p is maintained where induced(p)[j] = 1 iff p has a j-induced shortcut to a special child. If edge(u)[i] = 0 or induced(p)[i] = 0, nothing needs to be done for i so assume edge(u)[i] = 1 and induced(p)[i] = 1. Then we delete the i-induced shortcut descending from p. If there is an i-induced shortcut from p to its special parent p′, we remove it too and recurse on p′; the recursion stops when we reach a special node q without an i-induced shortcut to its special parent q′. Each induced shortcut can be removed in O(log log n) time using binary search in the associated BBSTs. By adding log log n credits to an induced shortcut when it is created, we can pay for all deletions of induced shortcuts. If q′ is a rank node of Tl(w), we may need to add an i-induced shortcut from q′ to a special child. This can only happen if an i-induced branch node between q and q′ disappears and as above, we can spend its credits to pay for finding this shortcut. 4.9 Non-structural changes Above we dealt with updates of shortcuts due to structural changes in CL. We now handle updates when leaves of Fi appear or disappear due to edge level changes. 17 Edge deletions: When a level i-edge e is deleted (possibly due to its level being increased to i + 1), edge(u)[i] might change from 1 to 0 for one of its endpoints u which will then no longer be an i-induced leaf of Fi. We describe how to update other edge-bitmaps accordingly and remove some of the i-induced shortcuts. The following is done for u. If there are still level i-edges incident to u then no updates are needed. Otherwise, all i-induced shortcuts on the simple path in CL from u to its i-induced parent p should be removed. Since u is a leaf of CL, it is a special node. We traverse i-induced shortcuts from u to ancestors until we reach a special node v without an i-induced shortcut to an ancestor. Since u is the only i-induced leaf below v, we delete all shortcuts traversed. We also set edge(v)[i] ← 0 for all black nodes v between u and v (including v) in O(log n/ log log n) time by traversing standard i-shortcuts between u and v. We then traverse black nodes up from v in CL and stop if we find a special node w. Whenever we visit a black node b, we perform a DFS in the subtree of CL rooted at b, backtracking at descending black nodes. If each black node b′ visited below b has edge(b′)[i] = 0, u was the only leaf of CL below b with an incident level i-edge so we set edge(b)[i] ← 0 and proceed up to the next black node. Conversely, if some black node b′ visited below b has edge(b′)[i] = 1, p must be below b and no more bitmaps need to be updated. Having updated the bitmaps and removed all i-induced shortcuts below v, we need to check if an i-induced shortcut should be added from w to one of its descendants. By Lemma 7, this takes O((log n)3ǫ(log log n)4) time which can be paid for by the deletion of e; here we can also afford to add log log n credits to the shortcut if it was added. Edge insertions Now suppose a level i-edge e is inserted. To update edge-bitmaps and add new i-induced shortcuts, we do the following for each endpoint u of e. If other level i-edges are incident to u then nothing needs to be done as u is already a leaf of Fi so assume otherwise. Inserting e corresponds to updating Fi by adding a new edge (u, p), where p is the i-induced parent of u. Hence, we need to add i-induced shortcuts between u and p. Suppose u has an ancestor black node v such that edge(v)[i] = 1. We traverse standard shortcuts up from u and stop when we identify the first such v. Let u1, . . . , uk be the ordered (possibly empty) sequence of special nodes visited from u to v. Since v already has a descending leaf incident to a level i-edge and uk does not, p must be on the uk-to-v path in CL. Hence, the new i-induced shortcuts to be added are (u1, u2), (u2, u3), . . . , (uk−1, uk). We also set to 1 the ith bit of the edge-bitmaps of all black nodes visited. By Lemmas 1 and 2, all of this can be done in O(log n/ log log n) time and we can also afford to add log log n credits to each of the O(log n/(log log n)2) new i-induced shortcuts. We assumed that a node v with edge(v)[i] = 1 was encountered. If this is not the case, it means that u should not be added to an existing tree in Fi. Rather, a new tree should be formed consisting of a single edge (u, p), where p is the level (i+1)-ancestor of u in CL. Clearly, the corresponding i-induced shortcuts can be added and edge-bitmaps updated within the same O(log n/ log log n) time bound. We can now conclude with the following theorem. Theorem 1. There is a deterministic data structure for fully dynamic graph connectivity which supports edge insertions/deletions in O(log2 n/ log log n) amortized time per update and connectivity queries in O(log n/ log log n) worst case time, where n is the number of vertices of the graph. 18 5 Concluding Remarks We gave a deterministic data structure for fully-dynamic graph connectivity that achieves an amortized update time of O(log2 n/ log log n) and a worst-case query time of O(log n/ log log n), where n is the number of vertices of the graph. This improves the update time of Holm, de Lichtenberg, and Thorup [5] and Thorup [10] by a factor of log log n. We believe our improve- ment may extend to fully-dynamic minimum spanning tree, 2-edge, and/or biconnectivity. There is still a small gap between upper and lower bounds. For instance, for O(log n/ log log n) query time, [6] gives an Ω((log n)1+ǫ) cell-probe lower bound for updates for constant ǫ > 0. Simultaneously getting O(log n) update and query time and improving the O(√n) worst-case update bound in [1] remain the main open problems for fully-dynamic graph connectivity. References [1] D. Eppstein, Z. Galil, G. F. Italiano, and A. Nissenzweig. Sparsification - a technique for speeding up dynamic graph algorithms. J. ACM, 44(5):669–696, 1997. See also FOCS'92. [2] G. N. Frederickson. Data structures for on-line updating of minimum spanning trees, with applications. SIAM J. Comput., 14(4):781–798, 1985. See also STOC'83. [3] M. R. Henzinger and V. King. Randomized dynamic graph algorithms with polyloga- rithmic time per operation. Proc. twenty-seventh annual ACM symposium on Theory of computing (STOC), 1995, pp. 519–527. [4] M. R. Henzinger and M. Thorup. Sampling to provide or to bound: With applications to fully dynamic graph algorithms. Random Structures and Algorithms, 11(4):369–379, 1997. See also ICALP'96. [5] 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. See also STOC'98. [6] M. Patra¸scu and E. Demaine. Logarithmic Lower Bounds in the Cell-Probe Model. SIAM J. Comput., 35(4): 2006. Special issue 36th ACM Symposium on Theory of Computing (STOC 2004). [7] D. Sleator and R. E. Tarjan. A data structure for dynamic trees. J. Comput. Syst. Sc., 26(3):362–391, 1983. See also STOC'81. [8] R. E. Tarjan. Efficiency of a good but not linear set union algorithms. J. ACM, 22:215– 225, 1975. [9] M. Thorup. Decremental dynamic connectivity. Proc. 8th SODA, pp. 305–313, 1997. [10] M. Thorup. Near-optimal fully-dynamic graph connectivity. Proc. thirty-second annual ACM symposium on Theory of computing (STOC), 2000, pp. 343–350. 19
0812.2291
7
0812
2013-06-03T21:03:36
Characterizing Truthful Multi-Armed Bandit Mechanisms
[ "cs.DS", "cs.GT", "cs.LG" ]
We consider a multi-round auction setting motivated by pay-per-click auctions for Internet advertising. In each round the auctioneer selects an advertiser and shows her ad, which is then either clicked or not. An advertiser derives value from clicks; the value of a click is her private information. Initially, neither the auctioneer nor the advertisers have any information about the likelihood of clicks on the advertisements. The auctioneer's goal is to design a (dominant strategies) truthful mechanism that (approximately) maximizes the social welfare. If the advertisers bid their true private values, our problem is equivalent to the "multi-armed bandit problem", and thus can be viewed as a strategic version of the latter. In particular, for both problems the quality of an algorithm can be characterized by "regret", the difference in social welfare between the algorithm and the benchmark which always selects the same "best" advertisement. We investigate how the design of multi-armed bandit algorithms is affected by the restriction that the resulting mechanism must be truthful. We find that truthful mechanisms have certain strong structural properties -- essentially, they must separate exploration from exploitation -- and they incur much higher regret than the optimal multi-armed bandit algorithms. Moreover, we provide a truthful mechanism which (essentially) matches our lower bound on regret.
cs.DS
cs
Characterizing Truthful Multi-Armed Bandit Mechanisms∗ Moshe Babaioff Microsoft Research Silicon Valley Mountain View, CA 94043, USA [email protected] Yogeshwer Sharma† Facebook Palo Alto, CA 94301, USA [email protected] Aleksandrs Slivkins Microsoft Research Silicon Valley Mountain View, CA 94043, USA [email protected] December 2008 This version: May 2013 Abstract We consider a multi-round auction setting motivated by pay-per-click auctions for Internet advertis- ing. In each round the auctioneer selects an advertiser and shows her ad, which is then either clicked or not. An advertiser derives value from clicks; the value of a click is her private information. Ini- tially, neither the auctioneer nor the advertisers have any information about the likelihood of clicks on the advertisements. The auctioneer’s goal is to design a (dominant strategies) truthful mechanism that (approximately) maximizes the social welfare. If the advertisers bid their true private values, our problem is equivalent to the multi-armed bandit problem, and thus can be viewed as a strategic version of the latter. In particular, for both problems the quality of an algorithm can be characterized by regret, the difference in social welfare between the algorithm and the benchmark which always selects the same “best” advertisement. We investigate how the design of multi-armed bandit algorithms is affected by the restriction that the resulting mechanism must be truthful. We find that deterministic truthful mechanisms have certain strong structural properties – essentially, they must separate exploration from exploitation – and they incur much higher regret than the optimal multi-armed bandit algorithms. Moreover, we provide a truthful mechanism which (essentially) matches our lower bound on regret. ACM Categories and subject descriptors: F.2.2 [Analysis of Algorithms and Problem Complexity]: Nonnumerical Algorithms and Problems; K.4.4 [Computers and Society]: Electronic Commerce; F.1.2 [Computation by Abstract Devices]: Modes of Computation—Online computation; J.4 [Social and Be- havioral Sciences]: Economics General Terms: theory, algorithms, economics. Keywords: mechanism design, truthful mechanisms, single-parameter auctions, pay-per-click auctions, multi-armed bandits, regret. ∗This is a full version of a conference paper published in 10th ACM Conf. on Electronic Commerce (EC), 2009. Apart from the revised presentation, this version is updated to reflect the follow-up work [9, 56, 22, 48] and the current snapshot of open questions. †This research was done while Y. Sharma was a student at Cornell University and an intern at Microsoft Research Silicon Valley. 1 1 Introduction In recent years there has been much interest in understanding the implication of strategic behavior on the performance of algorithms whose input is distributed among selfish agents. This study was mainly moti- vated by the Internet, the main arena of large scale interaction of agents with conflicting goals. The field of Algorithmic Mechanism Design [40] studies the design of mechanisms in computational settings (for background see the recent book [41] and survey [47]). Much attention has been drawn to the market for sponsored search (e.g. [31, 19, 55, 36, 2]), a multi- billion dollar market with numerous auctions running every second. Research on sponsored search mostly focus on equilibria of the Generalized Second Price (GSP) auction [19, 55], the auction that is most com- monly used in practice (e.g. by Google and Bing), or on the design of truthful auctions [1]. All these auctions rely on knowing the rates at which users click on the different advertisements (a.k.a. click-through rates, or CTRs), and do not consider the process in which these CTRs are learned or refined over time by observing users’ behavior. We argue that strategic agents would take this process into account, as it influences their utility. While prior work [24] focused on the influence of click fraud on methods for learning CTRs, we are interested in the implications of the strategic bidding by the agents. Thus, we consider the problem of designing truthful sponsored search auctions when the process of learning the CTRs is a part of the game. We are mainly interested in the interplay between the online learning and the strategic bidding. To isolate this issue, we consider the following setting, which is a natural strategic version of the multi-armed bandit (MAB) problem. In this setting, there are k ≥ 2 agents. Each agent i has a single advertisement, and a private value vi > 0 for every click she gets. The mechanism is an online algorithm that first solicits bids from the agents, and then runs for T rounds. In each round the mechanism picks an agent (using the bids and the clicks observed in the past rounds), displays her advertisement, and receives a feedback – if there was a click or not. Payments are charged after round T . Each agent tries to maximize her own utility: the value that she derives from clicks minus the payment she pays. We assume that initially no information is known about the likelihood of each agent to be clicked, and in particular there are no Bayesian priors. We are interested in designing mechanisms which are truthful (in dominant strategies): every agent maximizes her utility by bidding truthfully, for any bids of the others and for any clicks that would have been received (that is, for any realization of the clicks an agent never regrets being truthful in retrospect). The goal is to maximize the social welfare.1 Since the payments cancel out, this is equivalent to maximizing the total value derived from clicks, where an agent’s contribution to that total is her private value times the number of clicks she receives. We call this setting the MAB mechanism design problem. In the absence of strategic behavior this problem reduces to a standard MAB formulation in which an the algorithm repeatedly chooses one of the k alternatives (“arms”) and observes the associated payoff: value-per-click of the corresponding ad if the ad is clicked, and 0 otherwise. The crucial aspect in MAB problems is the tradeoff between acquiring more information (exploration) and using the current information to choose a good agent (exploitation). MAB problems have been studied intensively for the past three decades. In particular, the above formulation is well-understood [6, 7, 16] in terms of regret relative to the benchmark which always chooses the same “best” alternative (time-invariant benchmark). This notion of regret naturally extends to the strategic setting outlined above, the total payoff being exactly equal to the social welfare, and the regret being exactly the loss in social welfare relative to the time-invariant benchmark. Thus one can directly compare MAB algorithms and MAB mechanisms in terms of welfare loss (regret). Broadly, we ask how the design of MAB algorithms is affected by the restriction of truthfulness: what is the difference between the best algorithms and the best truthful mechanisms? We are interested both in terms of the structural properties and the gap in performance (in terms of regret). In short, we establish that the 1Social welfare includes both the auctioneer’s revenue and the agents’ utility. Since in practice different sponsored search plat- forms compete against one another, taking into account the agents’ utility increases the platform’s attractiveness to the advertisers. 2 additional constraints imposed by truthfulness severely limit the structure and performance of online learn- ing algorithms. We are not aware of any prior work that characterizes truthful online learning algorithms or proves negative results on their performance. Discussion. We believe that the fundamental limitations of truthfulness are best studied in simple models such as the one defined above. We did not attempt to incorporate many additional aspects of pay-per-click ad auctions such as information that is revealed to and by agents over time, multiple ad slots, user contexts, ad features, etc. However, intuition from our impossibility results applies to richer models, and for some of these models it is not difficult to produce precise corollaries. The key idea in the simple truthful mechanism that we present (separating exploration and exploitation) can be easily extended as well. We consider a strong notion of truthfulness: bidding truthfully is optimal for every possible click real- ization (and bids of others). This notion is attractive as it does not require the agents to be risk neutral with respect to the randomness inherent in clicks, or consider their beliefs about the CTRs. It allows for the CTRs to change over time, and still incentivizes agents to be truthful. Moreover, an agent never regrets truthful bidding in retrospect. It is desirable to understand what can be achieved with this notion before moving to weaker notions, and thus we focus on this notion in this paper. 1.1 Our contributions We present two main contributions: structural characterizations of (dominant-strategy) deterministic truthful mechanisms, and lower bounds on the regret that such mechanisms must suffer. The regret suffered by truthful mechanisms is significantly larger than the regret of the best MAB algorithms. We emphasize that our characterization results hold regardless of whether the mechanism’s goal is to maximize welfare, revenue, or any other objective. Formally, a mechanism for the MAB mechanism design problem is a pair (A,P), where A is the al- location rule (essentially, an MAB algorithm which also gets the bids as input), and P is the payment rule that determines how much to charge each agent. Both rules can depend only on the observable quantities: submitted bids and click events (clicks or non-clicks) for ads that have been displayed by the algorithm. Since the allocation rule is an online algorithm, its decision in a given round can only depend on the click events observed in the past. The distinction between an allocation rule and a payment rule is essential in prior work on Mechanism Design, and it is also essential for this paper. In particular, social welfare (and therefore regret) is completely determined by the allocation rule. This is because welfare includes each payment twice, with opposite signs: amount paid by an advertiser and amount received by the mechanism, and the two cancel out. Characterization. The MAB mechanisms setting is a single-parameter auction, the most studied and well-understood type of auctions. For such settings truthful mechanisms are fully characterized [38, 3]: a mechanism is truthful if and only if the allocation rule is monotone (by increasing her bid an agent cannot cause a decrease in the number of clicks she gets), and the payment rule is defined in a specific and, essen- tially, unique way. Yet, we observe that this characterization is not the right characterization for the MAB setting! The main problem is that if an agent is not chosen in a given round then the corresponding click event is not observed by the mechanism, in the sense that the mechanism does not know whether this agent would have received a click had it been selected in this round. Therefore the payment cannot depend on any such unobserved click events. This is a non-trivial restriction because the naive payment computation according to the formula mandated by [38, 3] requires simulating the run of the allocation rule for bids different than the ones actually submitted, which in turn may depend on unobserved click events. We show that this restriction has severe implications on the structure of truthful mechanisms. 3 The first notable necessary property of a truthful MAB mechanism is a much stronger version of mono- tonicity which we call “pointwise monotonicity”: Definition 1.1. A click realization consists of click information for all agents and all rounds: it specifies whether a given agent receives a click if it is selected in a given round.2 An allocation rule is pointwise monotone if for each click realization, each bid profile and each round, if an agent is selected at this round, then she is also selected after increasing her bid (fixing everything else). We first consider the case of two agents and show that truthful MAB mechanisms must have a strict separation between exploration and exploitation, in the following sense. A crucial feature of exploration is the ability to influence the allocation in forthcoming rounds. To make this point more concrete, we call a round t influential for a given click realization, with influenced agent j, if for some bid profile changing the click realization for this round can affect the allocation of agent j in some future round. We show that in any influential round, the allocation can not depend on the bids. Thus, we show that influential rounds are essentially useless for exploitation. Definition 1.2. An MAB allocation rule A is called exploration-separated if for any click realization, the allocation in any influential round does not depend on the bids. In our model, agents derive value from clicks. In particular, an agent with zero value per click receives no value. We focus on mechanisms in which a truthfully bidding agent with zero value-per-click pays exactly zero; we call such mechanisms normalized. Among truthful single-parameter mechanisms, normalized mechanisms are precisely the ones that satisfy two desirable properties: voluntary participation (truthfully bidding agents never lose from participating), and no positive transfers (advertisers are charged, not paid). We also make a mild assumption that an allocation rule is scale-free: invariant under multiplying all bids by the same positive number, i.e. does not depend on the choice of the currency unit. Many MAB algorithms from prior work can be easily converted into scale-free MAB allocation rules via some generic ways to incorporate bids into algorithms’ specification.3 We are now ready to present our main structural result for two agents. Theorem 1.3. Consider the MAB mechanism design problemwith two agents. Let A be a non-degenerate,4 deterministic, scale-free allocation rule. Then a mechanism (A,P) is normalized and truthful for some payment rule P if and only if A is pointwise monotone and exploration-separated. The case of more than two agents requires slightly more refined notions. Definition 1.4. For a given realization and bid profile, a round is secured from an agent if that agent cannot change the allocation at that round by increasing his bid. A deterministic MAB allocation rule is called weakly separated if for every click realization and bid profile, if a round is influential for this realization and bid profile, then it is secured from every agent that this round influences. 2Note that an MAB mechanism does not observe the entire click realization: it only observes click information for one agent per round, the agent that was selected in this round. 3Many algorithms from prior work on stochastic MAB maintain an estimate νi of the expected reward for each arm i, such as an upper confidence bound in UCB1 [6] or an independent sample from Bayesian posterior in Thompson’s Heuristic [54], so that the algorithms’ decisions depend only on these estimates. An allocation rule can interpret νi as an estimate of the CTR, and use i = bi νi instead of νi for all decisions. Moreover, any MAB algorithm can be converted to a scale-free MAB allocation rule by ν ′ assigning a reward of bi/(maxj bj) to each agent i for each click on her ad. We use both approaches in this paper, in Section 5 and Section 6.1, respectively. 4Non-degeneracy is a mild technical assumption, formally defined in “preliminaries”, which ensures that (essentially) if a given allocation happens for some bid profile (bi, b−i) then the same allocation happens for all bid profiles (x, b−i), where x ranges over some non-degenerate interval. Without this assumption, all structural results hold (essentially) almost surely w.r.t the k-dimensional Lebesgue measure on the bid vectors. Exposition becomes significantly more cumbersome, yet leads to the same lower bounds on regret. For clarity, we assume non-degeneracy throughout this paper. 4 The “weakly separated” condition is weaker than “exploration-separated”: while the latter ensures that all agents cannot change the allocation at any given influential round t, the former only requires this for each agent that is influenced by round t, fixing the bids of all other agents. For two agents and a scale-free MAB allocation rule, the two conditions are equivalent. Our complete characterization for any number of agents follows. Theorem 1.5. Consider the MAB mechanism design problem. Let A be a non-degenerate deterministic allocation rule. Then a mechanism (A,P) is normalized and truthful for some payment rule P if and only if A is pointwise monotone and weakly separated. Note that the general characterization does not require the allocation rule to be scale-free. In the special case of two agents and scale-free allocation rules it implies Theorem 1.3. We also investigate under which assumptions a weakly separated MAB allocation rule is exploration- separated, as the latter condition is sufficient for proving performance limitations (bounds on regret). To this end, we adapt a well-known notion from the literature on Social Choice, called Independence of Irrelevant Alternatives (IIA, for short): an MAB allocation rule is IIA if for any given click realization, bid profile and round, a change of bid of agent i cannot transfer the allocation in this round from agent j to agent l, where these are three distinct agents. Note that the IIA condition trivially holds if there are only two agents. We prove that for a non-degenerate deterministic allocation rule which is scalefree, pointwise monotone, and satisfies IIA it holds that the rule is exploration-separated if and only if it is weakly separated. Technically, assuming IIA allows us to extend our performance limitations results to more than two agents.5 Lower bounds on regret. In view of the characterizations of truthful mechanisms, we present a lower bound on the performance of exploration-separated algorithms. We consider a setting, termed the stochastic MAB mechanism design problem, in which each click on a given advertisement is an independent random event which happens with a fixed probability, a.k.a. the CTR. The expected “payoff” from choosing a given agent is her private value times her CTR. For the ease of exposition, assume that the bids lie in the interval [0, 1]. Then the non-strategic version is the stochastic MAB problem in which the payoff from choosing a given arm i is an independent sample in [0, 1] with a fixed mean µi. In both versions, we compete with the best-fixed-arm benchmark: the hypothetical allocation rule (resp. algorithm) that always chooses an arm with the maximal expected payoff. This benchmark is standard in the literature on stochastic MAB; it is optimal among all MAB algorithms that are given the expected rewards for each arms (resp., among all MAB allocation rules that are given the bids and the CTRs). We define regret as the expected difference between the social welfare (resp. total payoff) of the benchmark and that of the allocation rule (resp. algorithm). The algorithm’s goal is to minimize R(T ), worst-case regret over all problem instances on T rounds. We show that the worst-case regret of any exploration-separated algorithm is larger than that of the optimal MAB algorithm [7]: Ω(T 2/3) vs. O(√T ) for a fixed number of agents. We obtain an even more pronounced difference if we restrict our attention to the δ-gap problem instances: instances for which the best agent is better than the second-best by a (comparatively large) amount δ, that is µ1v1 − µ2v2 = δ · (maxi vi), where arms are arranged such that µ1v1 ≥ µ2v2 ≥ ··· ≥ µkvk. Such problem instances are known to be easy for the MAB algorithms. Namely, an MAB algorithm can concurrently achieve the optimal worst-case regret O(√kT log T ) and regret O( k δ log T ) on δ-gap instances [32, 6]. However, we show 5Since prior work on MAB algorithms did not address strategic issues, these algorithms were not designed to satisfy properties like (pointwise) monotonicity and IIA (and besides, these properties are not even well-defined for MAB algorithms, only for MAB allocation rules). So it is not yet clear how limiting are these properties. The simple pointwise monotone MAB allocation rule described later in the Introduction does satisfy IIA, but suffers from high regret. Designing better-performing MAB allocation rules that are (pointwise) monotone appears quite challenging. For instance, such allocation rule is one of the main results in the follow-up paper [9]. We leave open the question of existence of low-regret MAB allocation rules that are both pointwise-monotone and IIA. 5 that for exploration-separated allocation algorithms the worst-case regret Rδ(T ) over the δ-gap instances is polynomial in T (rather than poly-logarithmic in T ) as long as worst-case regret is even remotely non- trivial (i.e., sublinear). Thus, for the δ-gap instances the gap in the worst-case regret between unrestricted algorithms and exploration-separated algorithms is exponential in T . Theorem 1.6. Consider the stochastic MAB mechanism design problem with k ≥ 2 agents. Let A be a deter- ministic allocation rule that is exploration-separated. Then A has worst-case regret R(T ) = Ω(k1/3 T 2/3). Moreover, if R(T ) = O(T γ) for some γ < 1 then for every fixed δ ≤ 1 4 and any ǫ > 0 the worst-case regret over the δ-gap instances is Rδ(T ) = Ω(δ T 2(1−γ)−ǫ). For two agents, Theorem 1.6 implies a significant gap in performance between truthful MAB mecha- nisms and the best MAB algorithms, since truthful MAB mechanisms are necessarily exploration-separated.6 For example, while truthful MAB mechanisms suffer regret of Ω(T 2/3), the best algorithms have regret of only O(√T ); as we described above, for δ-gap distances the difference in regret is even more pronounced. For more than two agents, Theorem 1.6 does not immediately imply any regret bounds for truthful MAB mechanisms. This is because the theorem requires the “exploration-separated” condition, whereas the corresponding characterization result in Theorem 1.5 only guarantees the “weakly separated” condition. Recall that one way to guarantee the “exploration-separated” condition (and therefore the regret bound) is to furthermore assume IIA. It is an open question whether one can prove similar regret bounds for weakly separated MAB allocation rules without assuming IIA. We note that our lower bounds hold for a more general setting in which the values-per-click can change over time, and the advertisers are allowed to change their bids at every time step. Somewhat counter-intuitively, the lower bound on regret for k = 2 agents does not immediately imply the same lower bound for any constant k > 2. This is, essentially, because our setting requires a mechanism to show an ad in each round. A seemingly obvious approach to extend the lower bound from k = 2 to (say) k = 3 is to assume, for the sake of contradiction, that there exists a truthful MAB mechanism M for 3 agents whose regret is less than the lower bound for two agents, and use M construct a truthful MAB mechanism M′ for two agents with the same regret. (This would yield a contradiction, and hence prove the lower bound for three agents.) The derived two-agent mechanism M′ adds a fictitious third agent (a dummy) that never receives any clicks, and runs the original three-agent mechanism M. However, when M picks the dummy agent, the two-agent mechanism must pick one of the two real agents. These additional allocations may distort the agents’ incentives, so M′ is not guaranteed to be truthful. Hence, this reduction is not guaranteed to work. Likewise, the allocation rule of M′ is not guaranteed to be weakly separated even if the allocation rule of M is exploration-separated. Thus, we cannot immediately obtain a lower bound on regret for more than two agents simply by combining the two-agent characterization in Theorem 1.3 and the two-agent regret bound of Theorem 1.6. Tightness: a positive result. To complete the picture for exploration-separated MAB allocation rules, we present a very simple deterministic mechanism that is truthful and normalized, and matches the lower bound R(T ) = Ω(k1/3 T 2/3) up to logarithmic factors. The allocation rule in this mechanism is exploration- separated; it consists of two phases: an exploration phase in which agents are chosen in a round-robin fashion, followed by an exploitation phase which allocates all rounds to the agent with the best empirical performance in the exploration phase. Crucially, the duration of the exploration phase is fixed in advance (and optimized given k and T ). 6Formally, this holds for truthful MAB allocation rules with allocation rules that satisfy the mild assumptions of non-degeneracy and scale-freeness. We remove the latter assumption in one of the extensions. 6 Extensions. We extend our main results in several directions. 1. We derive a lower bound on regret for deterministic truthful mechanisms without assuming that the allocations are scale-free. In particular, for two agents there are no assumptions. This lower bound holds for any k (the number of agents) assuming IIA. However, the value of the lower bound does not increase with k; in this sense this lower bound is weaker than the one in Theorem 1.6. 2. We consider randomized MAB mechanisms that are universally truthful, i.e. truthful for each realiza- tion of the internal random seed. We extend the Ω(k1/3 T 2/3) lower bounds on regret to mechanisms that randomize over exploration-separated deterministic MAB allocation rules. 3. We consider randomized MAB mechanisms under a weaker (less restrictive) version of truthfulness: a mechanism is weakly truthful if for each click realization, it is truthful in expectation over its random seed. We show that any randomized allocation that is pointwise monotone and satisfies a certain stong notion of “separation between exploration and exploitation” can be turned into a mechanism that is weakly truthful and normalized. We apply this result to the version of the MAB mechanism design problem in which the clicks are chosen by an oblivious adversary.7 (The corresponding algorithmic version is the adversarial MAB problem [7, 14].) Using an MAB algorithm from the literature [8, 28], we obtain a weakly truthful MAB mechanism for this problem with regret O((k log k)1/3 · T 2/3). This matches our lower bound for deterministic MAB mechanisms up to (log k)1/3 factor. 4. The stochastic MAB mechanism design problem admits a very reasonable notion of truthfulness that is even weaker: truthfulness in expectation, where for each vector of CTRs the expectation is taken over clicks (and the internal randomness in the mechanism, if the latter is not deterministic).8 Following our line of investigation, we ask whether restricting a mechanism to be truthful in expectation has any implications on the structure and regret thereof. Given our negative results on mechanisms that are truthful and normalized, it is tempting to seek similar results for mechanisms that are truthful in expectation and normalized in expectation. We show that such approach is not likely to be fruitful. Surprisingly, we prove that any monotone-in-expectation MAB allocation rule gives rise to an MAB mechanism that is truthful in expectation and normalized in expectation, with a very minor increase in regret. The key idea is to view the expected payments as multivariate polynomials over the CTRs, and argue that any such polynomial can be “implemented” by a suitable payment rule. While this result is purely theoretical, e.g. because the payments have very high variance, it implies that any impossibility result for truthful-in-expectation MAB mechanisms must either follow directly from monotonicity-in- expectation of the allocation rule, or requires bounds on the variability of the payments. Informational obstacle. Our paper exposes a new kind of obstacle which might stands in the way of designing truthful mechanisms: insufficient observable information to compute payments; we will term it “informational obstacle” from here on. Interestingly, this obstacle appears more general than the current setting. First, it would still feature prominently in any mechanism design setting which can be modeled as one of the numerous MAB settings studied in the literature. Second, and perhaps more importantly, we conjecture that it can be extended to a very general class of mechanisms that interact with the environment. The follow-up work [56, 48] provides some evidence to this conjecture, see Section 1.3 for more details. 7An oblivious adversary chooses the entire click realization in advance, without observing algorithm’s behavior. 8Normalized-in-expectation and monotone-in-expectation properties are defined similarly. 7 1.2 Additional related work Mechanism Design. The question of how the performance of a truthful mechanism compares to that of the optimal algorithm for the corresponding non-strategic problem is one of the central themes in Algorithmic Mechanism Design. Performance gaps have been shown for various scheduling problems [3, 40, 18] and for online auction for expiring goods [35]. Other papers presented approximation gaps due to computational constraints, e.g. for combinatorial auctions [34, 18] and combinatorial public projects [43], showing a gap via a structural result for truthful mechanisms. The intersection of Machine Learning and Mechanism Design is an active research area which includes work in various topics such as online mechanisms [35], dynamic auctions [13, 4], dynamic pricing [46], secretary problems [21], offline learning from self-interested data sources [10, 37] and a number of others. A more detailed review of this area, or any of the topics listed above, is beyond the scope of this paper. MAB mechanisms. MAB algorithms were used in the design of Cost-Per-Action sponsored search auc- tions in Nazerzadeh et al. [39], where the authors construct a mechanism with approximate (asymptotic) properties of truthfulness and individual rationality. However, even if the gains from lying are small, it may still be rational for the agents to deviate from being truthful, perhaps significantly. Moreover, as truthful bidding is not a Nash equilibrium, an agent may speculate that other agents will deviate, which in turn may increase her own incentives to deviate. All of that may result in unpredictable, and possibly highly subopti- mal outcomes. On the other hand, approximate truthfulness guarantees suffice whenever it is reasonable to assume that the agents would not lie unless it leads to significant gains. In a concurrent and independent work with respect to this paper, Devanur and Kakade [17] considered the same setting: deterministic truthful MAB mechanisms. They focus on maximizing the revenue of the mechanism (as opposed to the social welfare). They present an impossibility result for the two-agent case: a lower bound of Ω(T 2/3) on the loss in revenue with respect to the VCG payments; this bound is extended to deterministic MAB mechanisms that are truthful with high probability. They also provide a deterministic truthful mechanism which matches the above lower bound, and is almost identical to our simple two-phase mechanism described in Section 1.1.9 A closely related line of work on dynamic auctions [13, 4, 44, 25] considers a more general setting in which private information is revealed to agents over time. The mechanism needs to create the right incentives for the agents to reveal all the information they receive over time, and to stay in the auction after every round; these challenges do not exist in our setting, in which all private information is known to the agents upfront. On the other hand, these papers study fully Bayesian settings in which Bayesian priors on CTRs are known and VCG-like social welfare-maximizing mechanisms are therefore feasible. In our setting – with no priors on CTRs – VCG-style mechanisms cannot be applied as such mechanisms require the allocation to exactly maximize the expected social welfare, which is impossible (and even not well-defined) without a prior. Moreover, even if applied to MAB mechanisms with Baeysian priors over CTRs, the techniques from this line of work can only guarantee truthfulness in expectation over the Bayesian prior, which is a much weaker notion compared to the “prior-independent” notions of truthfulness that are studied in this paper. Multi-armed bandits (MAB). Absent the strategic constraint, our problem fits into the framework of MAB algorithms. MAB has a rich literature in Statistics, Operations Research, Computer Science and Economics; a reader can refer to [14, 12] for background. Most relevant to the present paper is the work on stochastic MAB [32, 6] and adversarial MAB [7]. Both directions have spawned vast amounts of follow-up research. Results used in this paper come from [6, 32, 7, 5, 8, 28]. 9This mechanism is for a more general setting in which values-per-click change over time and the agents are allowed to submit a different bid at every round. Instead of assigning all impressions to the same agent in the exploitation phase, their mechanism runs the same allocation and payment procedure for each exploitation round separately, with the bids submitted in this round. 8 Our lower bounds on regret use (a novel application of) the relative entropy technique from [32, 7], see [29] for an account. This is the technique typically used to prove lower bound on regret for MAB and related problems. For other application of this technique, see e.g. [16, 26, 30, 11]. The prior work on MAB algorithms considered numerous MAB settings with various assumptions on payoff evolution over time (e.g., [7, 51, 23]), dependencies between arms (e.g., [20, 42, 30, 52]), side information available to an algorithm (e.g., [30, 33, 49]), etc. Many of these settings are motivated by pay-per-click ad auctions. For every such MAB setting one could define the corresponding version of the MAB mechanism design problem. 1.3 Follow-up work The conference publication of this paper gave rise to a several follow-up papers [9, 56, 22, 48] which have addressed some of the questions left open by this paper and posed some new ones. Below we present the current snapshot of this line of work. One direction concerns weakly truthful, randomized MAB mechanisms. Informally, the main question here is whether they are significantly more powerful than their deterministic counterparts. Babaioff, Klein- berg and Slivkins [9] resolve this question in the affirmative: they prove that there exist weakly truthful randomized MAB mechanisms whose regret bounds for the stochastic MAB setting are optimal for MAB algorithms, both in the worst case and for δ-gap instances. A major component of this result, henceforth called the BKS reduction, reduces designing weakly truthful MAB mechanisms to designing MAB alloca- tion rules that satisfy the appropriate notion of monotonicity called weak monotonicity: an MAB allocation is weakly monotone if for each click realization, it is monotone in expectation over its random seed.10 The BKS reduction subsumes and generalizes our result on truthfulness in expectation (using a very different technique). Moreover, it is not specific to the stochastic MAB setting: it extends beyond MAB mechanisms to arbitrary single-parameter domains (see [41] for more background). In particular, the BKS reduction applies to MAB mechanisms with clicks chosen by an oblivious adversary, and to MAB mechanism design problems based on most other settings studied in the vast literature on MAB algorithms. Our truthful-in-expectation construction and the BKS reduction suffer from a very high variance in payments. Both results include an explicit tradeoff between the variance in payments and the loss in perfor- mance. Very recently, Wilkens and Sivan [56] have proved that the tradeoff in the BKS reduction is optimal in a certain worst-case sense: the BKS reduction achieves the optimal worst-case variance in payments for any given worst-case loss in performance, where the worst case is over all monotone MAB allocation rules. (More generally, the optimality result in [56] applies to any given single-parameter problem.) Additional developments in [9] concern MAB allocation rules. First, they prove that an MAB allocation rule based on UCB1 satisfies monotonicity-in-expectation, and therefore can be transformed (using our result from Section 7 or the BKS reduction) to a truthful-in-expectation MAB mechanism with essentially the same regret. Second, they provide a new deterministic MAB allocation rule called NewCB which has optimal regret and is monotone. In conjunction with the BKS reduction, NewCB yields the weakly truthful MAB mechanism discussed above. The analysis in this paper provides a strong intuition that the crucial obstacle for deterministic MAB mechanisms is not the monotonicity of an allocation rule but instead the “informational obstacle”: insuffi- cient observable information to compute payments. The analysis of NewCB in [9] makes this point rigorous. Moreover, [56, 48] describe some additional settings, different from MAB mechanisms, where this “infor- mational obstacle” arises. Wilkens and Sivan [56] provide two variants of offline pay-per-click ad auctions with multiple ad slots. Shneider et al. [48] describe a packet scheduling problem in a network router, where the potentially non-observable information is the packet arrival times (rather than the click events). They 10[9] uses a somewhat different (and perhaps more systematic) terminology regarding the different notions of truthfulness, mono- tonicity and normalization. We discuss the results from [9] using the terminology of the present paper. 9 observe that in the network router setting information about packet arrival times may be missing not only because it is not observed by the router but also because the router does not have much space to store it. Finally, a very recent paper by Gatti, Lazaric and Trovo [22] considers multi-slot MAB mechanisms, i.e. pay-per-click ad auctions with multiple ad slots and unknown CTRs. This setting combines multi-slot pay- per-click ad auctions [55, 19] on the mechanism design side, and multi-slot MAB [45, 53] on the learning side. The authors provide truthful multi-slot MAB mechanisms based on the simple MAB mechanism presented in this paper and (independently) in Devanur and Kakade [17]. Despite all these exciting development, MAB mechanisms are not well-understood; see Section 8 for the current snapshot of open questions. 1.4 Map of the paper Section 2 is preliminaries. Truthfulness characterization is developed and proved in Section 3 and Section A. The lower bounds on regret are presented in Section 4. The simple mechanism that matches these lower bounds is in Section 5. Weakly truthful randomized allocations for adversarial clicks are derived in Section 6. Truthfulness in expectation is discussed in Section 7. Open questions are in Section 8. 2 Definitions and preliminaries In the MAB mechanism design problem, there is a set K of k agents numbered from 1 to k. Each agent i has a value vi > 0 for every click she gets; this value is known only to agent i. Initially, each agent i submits a bid bi > 0, possibly different from vi. 11 12 The “game” lasts for T rounds, where T is the given time horizon. A click realization represents the click information for all agents and all rounds. Formally, it is a tuple ρ = (ρ1 , . . . , ρk) such that for every agent i and round t, the bit ρi(t) ∈ {0, 1} indicates whether i gets a click if selected at round t. An instance of the MAB mechanism design problem consists of the number of agents k, time horizon T , a vector of private values v = (v1, . . . , vk), a vector of bids (bid profile) b = (b1, . . . , bk), and click realization ρ. A mechanism is a pair (A,P), where A is allocation rule and P is the payment rule. An allocation rule is represented by a function A that maps bid profile b, click realization ρ and a round t to the agent i that is chosen (receives an impression) in this round: A(b; ρ; t) = i. We also denote Ai(b; ρ; t) = 1{A(b;ρ;t)=i}. The allocation is online in the sense that at each round it can only depend on clicks observed prior to that round. Moreover, it does not know the click realization in advance; in every round it only observes the click realization for the agent that is shown in that round. A payment rule is a tuple P = (P1 , . . . ,Pk), where Pi(b; ρ) ∈ R denotes the payment charged to agent i when the bids are b and the click realization is ρ. 13 Again, the payment can only depend on observed clicks. A mechanism is called normalized if for any agent i, bids b−i of the other agents, and click realization ρ it holds that Pi(bi, b−i; ρ) → 0 as bi → 0. For any single-parameter, truthful mechanism, this limit exists and is independent of bi [38, 3]; further, this limit is always 0, for a given agent i, if and only if the payment per click is between 0 and bi. 11One can also consider a more realistic and general model in which the value-per-click of an agent changes over time and the agents are allowed to change their bid at every round. The case that the value-per-click of each agent does not change over time is a special case. In that case truthfulness implies that each agent basically submits one bid as in our model (the same bid at every round), thus our main results (necessary conditions for truthfulness and regret lower bounds) also hold for the more general model. 12Since private values vi are strictly positive, there is no need to allow zero bids. Also, this avoids some technical complications in the proofs. Accordingly, we define “normalized mechanisms” in terms of the payment as bi → 0. 13We allow the mechanism to determine the payments at the end of the T rounds, and not after every round. This makes that task of designing a truthful mechanism easier and thus strengthen our necessary condition for truthfulness (the condition used to derive the lower bounds on regret.) 10 (2.1) For given click realization ρ and bid profile b, the number of clicks received by agent i is denoted Ci(b; ρ). Call C = (C1 , . . . ,Ck) the click-allocation for A. The utility that agent i with value vi gets from the mechanism (A,P) when the bids are b and the click realization is ρ is Ui(vi; b; ρ) = vi·Ci(b; ρ)−Pi(b; ρ) (quasi-linear utility). The mechanism is truthful if for any agent i, value vi, bid profile b and click realization ρ it is the case that Ui(vi; vi, b−i; ρ) ≥ Ui(vi; bi, b−i; ρ). In the stochastic MAB mechanism design problem, an adversary specifies a vector µ = (µ1 , . . . , µk) of CTRs (concealed from A), then for each agent i and round t, click realization ρi(t) is chosen independently with mean µi. Thus, an instance of the problem includes µ rather than a fixed click realization. For a given problem instance I, let i∗ ∈ argmaxi µi vi, then regret on this instance is defined as i=1 µi vi Ai(b; ρ; t)i . RI(T ) = T vi∗µi∗ − EhPT t=1Pk For a given parameter vmax, the worst-case regret14 R(T ; vmax) denotes the supremum of RI(T ) over all problem instances I in which all private values are at most vmax. Similarly, we define Rδ(T ; vmax), the worst-case δ-regret, by taking the supremum only on instances with δ-gap. Most of our results are stated for non-degenerate allocation rules, defined as follows. An interval is called non-degenerate if it has positive length. Fix bid profile b, click realization ρ, and rounds t and t′ with t ≤ t′. Let i = A(b; ρ; t) and ρ′ be the allocation obtained from ρ by flipping the bit ρi(t). An allocation rule A is non-degenerate w.r.t. (b, ρ, t, t′) if there exists a non-degenerate interval I containing bi such that Ai(x, b−i; ϕ; s) = Ai(b; ϕ; s) for each ϕ ∈ {ρ, ρ′}, each s ∈ {t, t′}, and all x ∈ I. An allocation rule is non-degenerate if it is non-degenerate w.r.t. each tuple (b, ρ, t, t′). 3 Truthfulness characterization Before presenting our characterization we begin by describing some related background. The click alloca- tion C is non-decreasing if for each agent i, increasing her bid (and keeping everything else fixed) does not decrease Ci. Prior work has established a characterization of truthful mechanisms for single-parameter do- mains (domains in which the private information of each agent is one-dimensional), relating click allocation monotonicity and truthfulness (see below). For our problem, this result is a characterization of MAB algo- rithms that are truthful for a given click realization ρ, assuming that the entire click realization ρ can be used to compute payments (when computing payments one can use click information for every round and every agent, even if the agent was not shown at that round.) One of our main contributions is a characterization of MAB allocation rules that can be truthfully implemented when payment computation is restricted to only use clicks information of the actual impressions assigned by the allocation rule. 3.1 Monotonicity An MAB allocation rule A is truthful with unrestricted payment computation if it is truthful with a payment rule that can use the entire click realization ρ in it computation. We next present the prior result character- izing truthful mechanisms with unrestricted payment computation. Theorem 3.1 (Myerson [38], Archer and Tardos [3]). Let (A,P) be a normalized mechanism for the MAB mechanism design problem. It is truthful with unrestricted payment computation if and only if for any given click realization ρ the corresponding click-allocation C is non-decreasing and the payment rule is given by (3.1) Pi(bi, b−i; ρ) = bi · Ci(bi, b−i; ρ) −R bi 0 Ci(x, b−i; ρ) dx. 14By abuse of notation, when clear from the context, the “worst-case regret” is sometimes simply called “regret”. 11 We can now move to characterize truthful MAB mechanisms when the payment computation is re- stricted. The following notation will be useful: for a given click realization ρ, let ρ ⊕ 1(i, t), be the click realization that coincides with ρ everywhere, except that the bit ρi(t) is flipped. The first notable property of truthful mechanisms is a stronger version of monotonicity. Recall (see Definition 1.1) that an allocation rule A is pointwise monotone if for each click realization ρ, bid profile b, round t and agent i, if Ai(bi, b−i; ρ; t) = 1 then Ai(b+ i > bi. In words, increasing a bid cannot cause a loss of an impression. Lemma 3.2. Consider the MAB mechanism design problem. Let (A,P) be a normalized truthful mechanism such that A is a non-degenerate deterministic allocation rule. Then A is pointwise-monotone. Proof. For a contradiction, assume not. Then there is a click realization ρ, a bid profile b, a round t and agent i such that agent i loses an impression in round t by increasing her bid from bi to some larger value b+ i . In other words, we have Ai(b+ i , b−i; ρ; t) < Ai(bi, b−i; ρ; t). Without loss of generality, let us assume that there are no clicks after round t, that is ρj(t′) = 0 for any agent j and any round t′ > t (since changes in ρ after round t does not affect anything before round t). i , b−i; ρ; t) = 1 for any b+ Let ρ′ = ρ ⊕ 1(i, t). The allocation in round t cannot depend on this bit, so it must be the same for both click realizations. Now, for each click realization ϕ ∈ {ρ, ρ′} the mechanism must be able to compute the price for agent i when bids are (b+ i , b−i). That involves computing the integral Ii(ϕ) = Rx≤b+ i Ci(x, b−i; ϕ) dx from (3.1). We claim that Ii(ρ) 6= Ii(ρ′). However, the mechanism cannot dis- tinguish between ρ and ρ′ since they only differ in bit (i, t) and agent i does not get an impression in round t. This is a contradiction. It remains to prove the claim. Without loss of generality, assume that ρi(t) = 0 (otherwise interchange the role of ρ and ρ′). We first note that Ci(x, b−i; ρ) ≤ Ci(x, b−i; ρ′) for every x. This is because everything is same in ρ and ρ′ until round t (so the impressions are same too), there are no clicks after round t, and in round t the behavior of A on the two click realizations can be different only if that agent i gets an impression, in which case she is clicked under ρ′ and not clicked under ρ. Since A is non-degenerate, there exists a non-degenerate interval I containing bi such that changing bid of agent i to any value in this interval does not change the allocation at round t (both for ρ and for ρ′). For any x ∈ I we have Ci(x, b−i; ρ) < Ci(x, b−i; ρ′), where the difference is due to the click in round t. It follows that Ii(ρ) < Ii(ρ′). Claim proved. Hence, the mechanism cannot be implemented truthfully. 3.2 Structural definitions Let us restate the structural definitions from the Introduction in a more detailed fashion. Definition 3.3. Fix click realization ρ, bid vector b, and round t. (a) Round t is called (b; ρ)-secured from agent i if A(b+ (b) Round t is called bid-independent w.r.t. ρ if the allocation A(b; ρ; t) is a constant function of b. (c) Round t is called (b; ρ)-influential if for some round t′ > t it holds that A(b; ρ; t′) 6= A(b; ρ′; t′) for click realization ρ′ = ρ ⊕ 1(j, t) such that j = A(b; ρ; t). 15 In words: changing the relevant part of the click realization at round t affects the allocation in some future round t′. i , b−i; ρ; t) = A(bi, b−i; ρ; t) for any b+ i > bi. (d) In part (c), round t′ is called the influenced round and j is called the influencing agent of round t. The agent i is called an influenced agent of round t if i ∈ {A(b; ρ; t′), A(b; ρ′; t′)}. 15Note that click realizations ρ and ρ′ are interchangeable. 12 (e) Round t is called influential w.r.t. click realization ρ if and only if it is (b, ρ)-influential for some b. Definition 3.4. Let A be a deterministic MAB allocation rule. • A is called exploration-separated if for every click realization ρ and round t that is influential for ρ, it holds that A(b; ρ; t) = A(b′; ρ; t) for any two bid vectors b, b′ (in words: allocation at round t does not depend on the bids). • A is called weakly separated if for every click realization ρ and bid vector b, it holds that if round t is (b; ρ)-influential with influenced agent i then it is (b; ρ)-secured from i. Observation 3.5. Any deterministic, exploration-separated MAB allocation rule is weakly separated. Proof. It follows from the definitions. Fix click realization ρ and bid vector b, let t be a (b; ρ)-influential round with influenced agent i. We need to show that t is (b; ρ)-secured from i. Round t is (b; ρ)-influential, thus influential w.r.t. ρ, thus (since the allocation is exploration-separated) it is bid-independent w.r.t. ρ, thus agent i cannot change allocation in round t by increasing her bid. Observation 3.6. Let A be a scale-free, weakly separated MAB allocation rule for two agents. Then A is exploration-separated. The proof of this observation is fairly straightforward, but it requires to carefully unwind the definitions. To provide some intuition with these definitions, we write it out in detail. Proof of Observation 3.6. Fix a click realization ρ and round t that is influential for ρ. Let b, b′ be two bid vectors. We need to conclude that A(b; ρ; t) = A(b′; ρ; t). By definition of “influential round”, there exists some bid vector b∗ such that t is (b∗, ρ)-influential with influenced agent i. Since there are only two agents, the other agent is influenced, too. By definition of “weakly separated”, round t is (b∗, ρ)-secured from both agents. By definition of “secured”, we have: A(b∗; ρ; t) = A(b+ = A(b∗ 2; ρ; t) for any b+ 2 ; ρ; t) for any b+ Let us prove that A(b; ρ; t) = A(b∗; ρ; t). We consider two cases. • Suppose b1/b2 ≥ b∗ 1 , b∗ 1, b+ 2; ρ; t). Since λb1 > b∗ 1, then we are done by taking b+ A(λb1, b∗ 1/b∗ 2. Then by definition of “scale-free”, letting λ = b∗ 1 > b∗ 1 2 > b∗ 2. (3.2) (3.3) 2/b2 we have A(b; ρ; t) = 1 = λb1 and using (3.2). • Suppose b1/b2 < b∗ A(b∗ 1/b∗ 2. Then by definition of “scale-free”, letting λ = b∗ 1, λb2; ρ; t). Since λb2 > b∗ 2, then we are done by taking b+ 2 = λb2 and using (3.3). 1/b1 we have A(b; ρ; t) = Claim proved. Similarly, A(b′; ρ; t) = A(b∗; ρ; t). 3.3 The two agents case (Theorem 1.3) The two-agent structural characterization in Theorem 1.3 follows from the general characterization in The- orem 1.5. More precisely, the “if” direction of Theorem 1.3 follows from the “if” direction of Theorem 1.5 and Observation 3.5; the “only if” direction of Theorem 1.3 follows from the “only if” direction of Theo- rem 1.5 and Observation 3.6. The main structural implication in both theorems is that truthfulness implies the corresponding structural condition (either that the allocation rule is exploration separated or that it is weakly separated.) To illustrate the ideas behind this implication, we prove the two-agent case directly. 13 Proposition 3.7. Consider the MAB mechanism design problem with two agents. Let A be a non-degenerate scale-free deterministic allocation rule. If (A,P) is a normalized truthful mechanism for some P, then it is exploration separated. Proof. Assume A is not exploration-separated. Then there is a counterexample (ρ, t): a click realization ρ and a round t such that round t is influential and allocation in round t depends on bids. We want to prove that this leads to a contradiction. Let us pick a counterexample (ρ, t) with some useful properties. Since round t is influential, there exists a click realization ρ and bid profile b such that the allocation at some round t′ > t (the influenced round) is different under click realization ρ and another click realization ρ′ = ρ ⊕ 1(j, t), where j = A(b; ρ; t) is the agent chosen at round t under ρ. Without loss of generality, let us pick a counterexample with minimum value of t′ over all choices of (b, ρ, t). For ease of exposition, from this point on let us assume that j = 2. For the counterexample we can also assume that ρ1(t′) = 1, and that there are no clicks after round t′, that is ρl(t′′) = ρ′ l(t′′) = 0 for all t′′ > t′ and for all l ∈ {1, 2}. We know that the allocation in round t depends on bids. This means that agent 1 gets an impression in round t for some bid profile b = (b1, b2) under click realization ρ, that is A(b; ρ; t) = 1. As the mechanism is scale-free this means that, denoting b+ 1 , b2; ρ; t) = 1. Since A(b1, b2; ρ; t) = 2 and A(b+ 1 > b1. We conclude that there exists a bid b+ 1 , b2; ρ; t) = 1, pointwise monotonicity (Lemma 3.2) implies that b+ 1 = b1 b2/b2 we have A(b+ 1 , b2; ρ; t) = 1. 1 , b2; ρ) and P1(b+ Now, the mechanism needs to compute prices for agent 1 for bids (b+ 1 , b2) under click realizations ρ i , b2; ρ′). Therefore, the mechanism needs to compute the integral 1 C1(x, b2; ϕ) dx for both click realizations ϕ ∈ {ρ, ρ′}. and ρ′, that is P1(b+ I1(ϕ) =Rx≤b+ First of all, for all x ≤ b+ 1 and for all t′′ < t′, A(x, b2; ρ; t′′) = A(x, b2; ρ′; t′′), since otherwise the Let us assume A1(b1, b2; ρ; t′) < A1(b1, b2; ρ′, t′) (otherwise, we can swap ρ and ρ′). We make the minimality of t′ will be violated. The only difference in the allocation can occur in round t′. 1 > b1 for agent 1 such that A(b+ claim that for all bids x ≤ b+ 1 of agent 1, the influence of round t on round t′ is in the same “direction”: A1(x, b2; ρ; t′) ≤ A1(x, b2; ρ′; t′) for all x ≤ b+ 1 . (3.4) Suppose (3.4) does not hold. Then there is an x < b+ 1 such that 1 = A1(x, b2; ρ; t′) > A1(x, b2; ρ′; t′) = 0. (Note that we have used the fact that the mechanism is deterministic.) If x < b1 then pointwise monotonicity is violated under click realization ρ, since A1(x, b2; ρ; t′) > A1(b1, b2; ρ; t′); otherwise it is violated under click realization ρ′, giving a contradiction in both cases. The claim (3.4) follows. Since A is non-degenerate, there exists a non-degenerate interval I containing bi such that if agent 1 bids any value x ∈ I then A1(x, b2; ρ; t′) < A1(x, b2; ρ′; t′). Now by (3.4) it follows that I1(ρ) < I2(ρ′). However, the mechanism cannot distinguish between ρ and ρ′ when the bid of agent 1 is b+ 1 , since the differing bit ρ2(t) is not observed. Therefore the mechanism cannot compute prices, contradiction. 3.4 The general case (Theorem 1.5) Let us prove the general characterization (Theorem 1.5). We restate it here for convenience. Theorem (Theorem 1.5, restated). Consider the MAB mechanism design problem. Let A be a non-degenerate deterministic allocation rule. Then a mechanism (A,P) is normalized and truthful for some payment rule P if and only if A is pointwise monotone and weakly separated. Proof of Theorem 1.5: the “only if” direction. Suppose (A,P) be a normalized truthful mechanism, for some payment rule P. Then A is pointwise-monotone by Lemma 3.2. The fact that A is weakly sepa- rated is proved similarly to Proposition 3.7, albeit with a few extra details. 14 Assume A is not weakly separated. Then there is a counterexample (ρ, b, t, t′, i): a click realization ρ, bid vector b, rounds t, t′ and agent i such that round t is (b; ρ)-influential with influenced agent i and influenced round t′ and it does not holds that round t is (b; ρ)-secured from i. We prove that this leads to a contradiction.. there exists a bid b+ i , b−i; ρ; t) 6= j. Let us pick a counterexample (ρ, b, t, t′, i) with a minimum value of t′ over all choices of (ρ, b, t, i). Without loss of generality, let us assume that ρi(t′) = 1 and ρj(t′′) = 0 for all t′′ > t′ and for all agents j. Let j = A(b; ρ; t). As it does not holds that round t is (b; ρ)-secured from i, this means that j 6= i, and i > bi such that A(b+ Let ρ′ = ρ ⊕ 1(j, t). The mechanism needs to compute prices for agent i when her bid is b+ i under click realizations ρ and ρ′, that is to compute Pi(b+ i , b−i; ρ′). Therefore, the mechanism needs to compute the integral Ii(ϕ) =Rx≤b+ 1 Ci(x, b−i; ϕ) dx for both click realizations ϕ ∈ {ρ, ρ′}. First of all, for all x ≤ b+ i and for all t′′ < t′, Ai(x, b−i; ρ; t′′) = Ai(x, b−i; ρ′; t′′). If not,then the minimality of t′ will be violated. This is because, if there were such an x and t′′ < t′ with Ai(x, b−i; ρ; t′′) 6= Ai(x, b−i; ρ′; t′′), then round t will still be (b, ρ)-influential with influenced agent i, and influenced round t′′ < t′, violating the minimality of t′′. Therefore, when we decrease the bid of agent i, the only difference in the allocation can occur at time round t′. i , b−i; ρ) and Pi(b+ As i is the influenced agent at round t′ it must hold that Ai(bi, b−i; ρ; t′) 6= Ai(bi, b−i; ρ′, t′). Let us assume 0 = Ai(bi, b−i; ρ; t′) < Ai(bi, b−i; ρ′, t′) = 1 (otherwise, we can swap ρ and ρ′). Note that we have made use of the fact that the mechanism is deterministic. Let us make the the claim that for all bids x ≤ b+ the influence of round t on round t′ is in the same “direction.” i Ai(x, b−i; ρ; t′) ≤ Ai(x, b−i; ρ′; t′) for all x ≤ b+ i . (3.5) Suppose (3.5) does not hold. Then there is an x ≤ b+ i such that 1 = Ai(x, b−i; ρ; t′) > Ai(x, b−i; ρ′; t′) = 0. (Note that we have used the fact that the mechanism is deterministic.) If x > bi, then pointwise monotonicity is violated in ρ′, since 0 = Ai(x, b−i; ρ′; t′) < Ai(bi, b−i; ρ′; t′) = 1. If x < bi on the other hand, then the pointwise-monotonicity is violated in ρ, since 1 = Ai(x, b−i; ρ; t′) > Ai(bi, b−i; ρ; t′) = 0, giving a contradiction in both cases. The claim (3.5) follows. By the non-degeneracy of A, there exists a non-degenerate interval I containing bi such that Ai(x, b−i; ρ; t′) < Ai(x, b−i; ρ′; t′) for all x ∈ I. (3.6) i , since the differing bit ρj(t) is not seen. Contradiction. By (3.5) and (3.6) it follows that Ii(ρ) < Ii(ρ′). However, the mechanism cannot distinguish between ρ and ρ′ when agent i’s bid is b+ Proof of Theorem 1.5: the “if” direction. Let A be a deterministic allocation rule which is pointwise mono- tone and weakly separated. We need to provide a payment rule P such that the resulting mechanism (A,P) is truthful and normalized. Since A is pointwise monotone, it immediately follows that it is monotone (i.e., as an agent increases her bid, the number of clicks that she gets cannot decrease). Therefore it follows from Theorem 3.1 that mechanism (A,P) is truthful and normalized if and only if P is given by (3.1). We need to show that P can be computed using only the knowledge of the clicks (bits from the click realization) that were revealed during the execution of A. Assume we want to compute the payment for agent i in bid profile (bi, b−i) and click realization ρ. We will prove that we can compute Ci(x) := Ci(x, b−i; ρ) for all x ≤ bi. To compute Ci(x), we show that it is possible to simulate the execution of the mechanism with bidi = x. In some rounds, the agent i loses an impression, and in others it retains the impression (pointwise monotonicity ensures that agent i cannot gain an impression when decreasing her bid). In rounds that it loses an impression, the mechanism does not observe the bits of ρ in those rounds, so we prove that those bits are irrelevant while computing Ci(x). In other words, while running with bidi = x, if mechanism needs to observe the bit that was not revealed 15 when running with bidi = bi, we arbitrarily put that bit equal to 1 and simulate the execution of A. We want to prove that this computes Ci(x) correctly. Let t1 < t2 < ··· < tn be the rounds in which agent i did not get an impression while bidding x, but did get an impression while bidding bi. Let ρ0 := ρ, and let us define click realization ρl inductively for every l ∈ [n] by setting ρl := ρl−1 ⊕ 1(jl, tl), where jl = A(x, b−i; ρl−1; tl) is the agent that got the impression at round tl with click realization ρl−1 and bids (x, b−i). First, we claim that jl 6= i for any l. Indeed, suppose not, and pick the smallest l such that jl+1 = i. Then tl is a (x, b−i; ρl)-influential round, with influenced agent jl+1 = i. Thus tl is (x, b−i; ρl)-secured from i. Since A(x, b−i; ρl; tl) = A(x, b−i; ρl−1; tl) = jl 6= i by minimality of l, agent i does not get an impression in round tl if she raises her bid to bi. That is, A(b; ρl; tl) 6= i. However, the changes in click realizations ρ0 , . . . , ρl−1 only concern the rounds in which agent i is chosen, so they are not seen by the allocation if the bid profile is b (to prove this formally, use induction). Thus, A(b; ρl; tl) = A(b; ρ; tl) = i, contradiction. Claim proved. It follows that A(b; ρ; tl) = i for each l. (This is because by induction, the change from ρl−1 to ρl is not seen by the allocation if the bid profile is b.) We claim that Ai(x, b−i; ρ; t′) = Ai(x, b−i; ρn; t′) for every round t′, which will prove the theorem. If not, then there exists l such that Ai(x, b−i; ρl; t′) 6= Ai(x, b−i; ρl−1; t′) for some t′ (and of course t′ > tl). Round tl is thus (x, b−i; ρl)-influential with influenced round t′ and influenced agent i. Moreover, the influencing agent of that round is jl, and we already proved that jl 6= i. Since round tl is (x, b−i; ρl)-secured from agent i due to the “weakly separated” condition, it follows that agent i does not get an impression in round tl if she raises her bid to bi. That is, A(b; ρl; tl) 6= i, contradiction. Let us argue that the non-degeneracy assumption in Theorem 1.5 is indeed necessary. Claim 3.8. There exists a deterministic mechanism (A,P) for two agents that is truthful and normalized, such that the allocation rule A is pointwise monotone, scale-free and yet not weakly separated. Proof. There are only two rounds. Agent 1 allocated at round 1 if and only if b1 ≥ b2. Agent 1 allocated at round 2 if b1 > b2 or if b1 = b2 and ρ1(1) = 1; otherwise agent 2 is shown. This completes the description of the allocation rule. To obtain a payment rule P which makes the mechanism normalized and truthful, consider an alternate allocation rule A′ which in each round selects agent 1 if and only if b1 ≥ b2. (Note that A′ = A except when b1 = b2.) Use Theorem 1.5 for A′ to obtain a normalized truthful mechanism (A′,P ′), and set P = P ′. The payment rule P is well-defined since the observed clicks for P and P ′ coincide unless b1 = b2, in which case both payment rules charge 0 to both agents. The resulting mechanism (A,P) is normalized and truthful because the integral in (3.1) remains the same even if we change the value at a single point. It is easy to see that the allocation rule A has all the claimed properties; it fails to be non- degenerate because round t is influential only when b1 = b2. 3.5 Scalefree and IIA allocation rules We show that under the right assumptions, an MAB allocation rule is exploration-separated if and only if it is weakly separated. Lemma 3.9. Consider the MAB mechanism design problem. Let A be a non-degenerate deterministic allocation rule which is scalefree, pointwise monotone, and satisfies IIA. Then it is exploration-separated if and only if it is weakly separated. The proof of Lemma 3.9 is very technical. We precede it with a proof sketch. To preserve the flow, we place the full proof in Appendix A. 16 t ∗ (b+ i′ , b−i′ ) ∗ (b+ i , b−i) (b− l , b−l) . . . 2 bi′ ↑ 3 bi ↑ or bl ↓ ρ ρ′ 4 ∗ (b; ρ) (b; ρ′) 11 Time rounds t′ . . . . . . i′ i j 8 8 i = b+ρ′ b+ρ i ∗ (b+ρ i ; ρ) ∗ (b+ρ′ i ; ρ′) 7 in ρ, bi ↑ 6 ∗ (b; ρ) in ρ′, bi ↑ ∗ (b; ρ′) l = j ′ 5 Figure 1: This figure explains all the steps in the proof of Lemma 3.9. The rows correspond to agents (whose identity is shown on the right side), and columns correspond to time rounds. The asterisks show the impressions. The arrows show how the impressions get transferred, and labels on the arrows show what causes the transfer. In labels, “in ρ, bi ↑” denotes that a particular transfer of impression is caused in click realization ρ when bid bi in increased. Proof Sketch. We sketch the proof of Lemma 3.9 at a very high level. The “only if” direction was observed in Observation 3.5; we focus on the “if” direction. Let A be a weakly-separated mechanism. We prove by a contradiction that it is exploration-separated. If not, then there is a click realization ρ and a round t such that t is influencial w.r.t. ρ as well as not bid-dependent w.r.t. ρ. Let round t be influencial with bid vector b, influencing agent l, and influenced agents j and j′ 6= j in influenced round t′ (see 1 in Figure 1; all boxed numbers in this sketch will refer to this figure). From the assumption, t is not bid-dependent w.r.t. ρ, which means that there exists a bid profile b′ such 6= l is selected in round t with bids b′. Using scalefreeness, IIA, and pointwise-monotonicity, we that i′ can prove that there exists a sufficiently large bid b+ i′ of agent i′ such that she gets an impression in round t with bids (b+ i′ , b−i′) (see 2 ). Using the properties of the mechanism, it can further be proved that there is an agent i such that she gets the impression in round t when either i increases her bid, or l decreases her bid (see 3 ). When i increases her bid to b+ i , she also gets an impression in round t′, since impressions cannot differ in round t′ in the case when l is not selected in round t and they must get transferred from j and j′ to somebody in round t′, and IIA implies that this somebody should be i. Recall that two different agents j and j′ get the impression in round t′ under ρ and ρ′ respectively (see 4 ). We prove that either agent j′ or agent j must be equal to l (this is done by looking at how the allocation in round t′ changes when l decreases her bid). Let us break the symmetry and assume j′ = l (see box 5 ). It is also easy to see that when i increases her bid, impression in round t′ get transferred to her in ρ (at some minimum value b+ρ , see 6 ), and impression in round t′ gets transferred to her also in ρ′ (as some possibly different minimum value b+ρ′ , see 7 ). Using the assumptions of weakly-separatedness, we prove that b+ρ }, and then using weakly-separatedness of A. Since these two bids were at a “threshold value” (these were the minimum (see 8 ). This can be proved by observing that b+ i ≥ max{b+ρ i = b+ρ′ i i i , b+ρ′ i i 17 values of bids to have transferred the impression in ρ and ρ′ from j and l respectively), we are able to prove that the ratio of bj/bl must be some fixed number dependent on ρ, ρ′, and t′. In particular, it follows that bl belongs to a finite set S(b−l) which depends only on b−l. However, by non-degeneracy of A there must be infinitely many such bl’s, which leads to a contradiction. 4 Lower bounds on regret In this section we use structural results from the previous section to derive lower bounds on regret. Theorem 4.1. Consider the stochastic MAB mechanism design problem with k agents. Let A be an exploration-separated deterministic allocation rule. Then its regret is R(T ; vmax) = Ω(vmax k1/3 T 2/3). 2 , . . . , 1 Let ~µ0 = ( 1 2 ) ∈ [0, 1]k be the vector of CTRs in which for each agent the CTR is 1 2. For each agent i, let ~µi = (µi1, . . . , µik) ∈ [0, 1]k be the vector of CTRs in which agent i has CTR µii = 1 2 + ǫ, ǫ = k1/3 T −1/3, and every other agent j 6= i has CTR µij = 1 2 . As a notational convention, denote by Pi[·] and Ei[·] respectively the probability and expectation induced by the algorithm when clicks are given by ~µi. Let Ii be the problem instance in which CTRs are given by ~µi and all bids are vmax. For each agent i, let Ji be the problem instance in which CTRs are given by ~µ0, the bid of agent i is vmax, and the bids of all other agents are vmax/2. We will show that for any exploration-separated deterministic allocation rule A, one of these 2k instances causes high regret. Let Ni be the number of bid-independent rounds in which agent i is selected. Note that Ni does not depend on the bids. It is a random variable in the probability space induced by the clicks; its distribution is completely specified by the CTRs. We show that (in a certain sense) the allocation cannot distinguish between ~µ0 and ~µi if Ni is too small. Specifically, let At be the allocation in round t. Once the bids are fixed, this is a random variable in the probability space induced by the clicks. For a given set S of agents, we consider the event {At ∈ S} for some fixed round t, and upper-bound the difference between the probability of this event under ~µ0 and ~µi in terms of Ei[Ni], in the following crucial claim, which is proved in Section 4.1 via relative entropy techniques. Claim 4.2. For any fixed vector of bids, each round t, each agent i and each set of agents S, we have P0[At ∈ S] − Pi[At ∈ S] ≤ O(ǫ2 E0[Ni]). (4.1) 2. Then Pi[At 6= i] ≥ 1 Proof of Theorem 4.1: Fix a positive constant β to be specified later. Consider the case k = 2 first. If E0[Ni] > β T 2/3 for some agent i, then on the problem instance Ji, regret is Ω(T 2/3). So without loss of generality let us assume E0[Ni] ≤ β T 2/3 for each agent i. Then, plugging in the values for ǫ and E0[Ni], the right-hand side of (4.1) is at most O(β). Take β so that the right-hand side of (4.1) is at most 1 4. For each round t there is an agent i such that P0[At 6= i] ≥ 1 4 by Claim 4.2, and therefore in this round algorithm A incurs regret Ω(ǫ vmax) under problem instance Ii. By Pigeonhole Principle there exists an i such that this happens for at least half of the rounds t, which gives the desired lower-bound. Case k ≥ 3 requires a different (and somewhat more complicated) argument. Let R = β k1/3 T 2/3 and N be the number of bid-independent rounds. Assume E0[N ] > R. Then E0[Ni] ≤ 1 E0[N ] for some agent i. For the problem instance Ji there are, in expectation, E[N − Ni] = Ω(R) bid-independent rounds in which agent i is not selected; each of which contributes Ω(vmax) to regret, so the total regret is Ω(vmax R). 2 agents 5 for more than 2 good agents. Suppose not. If agent i is not good i such that E0[Ni] ≤ 2R/k. Furthermore, let us say that an agent i is good if P0[At = i] ≤ 4 T /6 different rounds t. We claim that there are more than k then P0[At = i] > 4 From now on assume that E0[N ] ≤ R. Note that by Pigeonhole Principle, there are more than k 6 T different rounds t, so if there are at least k/2 such agents then 5 for at least 5 k T =PT t=1Pk i=1 2 × ( 5 6 T ) × 4 5 ≥ kT /3 ≥ T, P0[At = i] > k 18 contradiction. Claim proved. It follows that there exists a good agent i such that E0[Ni] ≤ 2R/k. Therefore the right-hand side of (4.1) is at most O(β). Pick β so that the right-hand side of (4.1) is at most 1 10. Then by Claim 4.2 for at least T /6 different rounds t we have Pi[At = i] ≤ 9 10 . In each such round, if agent i is not selected then algorithm A incurs regret Ω(ǫ vmax) on problem instance Ii. Therefore, the (total) regret of A on problem instance Ii is Ω(ǫ vmax T ) = Ω(vmax k1/3 T 2/3). Theorem 4.3. In the setting of Theorem 4.1, fix k and vmax and assume that R(T ; vmax) = O(vmax T γ) for some γ < 1. Then for every fixed δ ≤ 1 Proof. Fix λ ∈ (0, 2(1 − γ)). Redefine ~µi’s with respect to a different ǫ, namely ǫ = T −λ/2. Define the problem instances Ii in the same way as before: all bids are vmax, the CTRs are given by ~µi. Let us focus on agents 1 and 2. We claim that E1[N1] + E2[N2] ≥ β T λ, where β > 0 is a constant to be defined later. Suppose not. Fix all bids to be vmax. For each round t, consider event St = {At = 1}. Then by Claim 4.2 we have 4 and λ < 2(1 − γ) we have Rδ(T ; vmax) = Ω(δ vmax T λ). (cid:12)(cid:12)P1[St] − P2[St](cid:12)(cid:12) ≤(cid:12)(cid:12)P0[St] − P1[St](cid:12)(cid:12) +(cid:12)(cid:12)P0[St] − P2[St](cid:12)(cid:12) ≤ O(cid:0)ǫ2(cid:1) (E1[N1] + E2[N2]) ≤ 1 for a sufficiently small β. Now, P1[St] ≥ 1 2 for at least T /2 rounds t. This is because otherwise on problem instance Ii regret would be R(T ) ≥ Ω(ǫ T vmax) = Ω(vmax T 1−λ/2), which contradicts the assumption R(T ) = O(vmax T γ). Therefore P2[St] ≥ 1 4 for at least T /2 rounds t, hence on problem instance I2 regret is at least Ω(ǫ T vmax), contradiction. Claim proved. 2 T λ. Consider the problem instance in which CTRs given by ~µ1, bid of agent 2 is vmax, and all other bids are vmax(1 − 2δ)/(1 + 2ǫ). It is easy to see that this problem instance has δ-gap. Each time agent 1 is selected, algorithm incurs regret Ω(δvmax). Thus the total regret is at least Ω(δN1 vmax) = Ω(δ vmax T λ). Now without loss of generality let us assume that E1[N1] ≥ β 4 4.1 Relative entropy technique: proof of Claim 4.2 We extend the relative entropy technique from [7]. All relevant facts about relative entropy are summarized in the theorem below. We will need the following definition: given a random variable X on a probability space (Ω,F, P), let PX be the distribution of X, i.e. a measure on R defined by PX(x) = P[X = x]. Theorem 4.4 (Some standard facts about relative entropy, e.g. [15, 27, 29]). Let p and q be two probability measures on a finite set U, and let Y and Z be functions on U. There exists a function F (p; qY ) : U → R with the following properties: (i) Ep F (p; qY ) = Ep F (p; q(Y, Z)) + Ep F (pZ; qZY ) (chain rule), 2D(pkq) for any event U ′ ⊂ U, where D(pkq) = Ep F (p; q1) (ii) (cid:12)(cid:12)p(U ′) − q(U ′)(cid:12)(cid:12) ≤q 1 (iii) for each x ∈ U, if conditional on the event {Z = Z(x)} p coincides with q, then F (p; qZ)(x) = 0. (iv) for each x ∈ U, if conditional on the event {Z = Z(x)} p and q are fair and ( 1 2 + ǫ)-biased coins, respectively, then it is the case that F (p; qZ)(x) ≤ 4ǫ2. Remark. This theorem summarizes several well-known facts about relative entropy, albeit in a somewhat non-standard notation. For the proofs, see [15, 27, 29]. In the proofs, one defines F = F (p; qY ) as a function F : U → R which is specified by F (x) = Px′∈U p(x′Ux) lg p(x′Ux) q(x′Ux) , where Ux is the event {Y = Y (x)}.16 Note that the quantity Ep F (p; q1) is precisely the relative entropy (a.k.a. KL-divergence), commonly denoted D(pkq), and Ep F (p; qY ) is the corresponding conditional relative entropy. 16We use the convention that p(x) log(p(x)/q(x)) is 0 when p(x) = 0, and +∞ when p(x) > 0 and q(x) = 0. 19 be considered a random variable under p or q. pletely determines whether round t is bid-independent, and if so, which arm is chosen in this round. In what follows we use Theorem 4.4 to prove Claim 4.2. For simplicity we will prove (4.1) for i = 1. The history up to round t is Ht = (h1, h2 , . . . , ht) where hs ∈ {0, 1} is the click or no click event re- ceived by the algorithm at round s. Let Ct be the indicator function of the event “round t is bid-independent”. Define the bid-independent history as bHt = (bh1,bh2 , . . . ,bht), where bht = htCt. For any exploration- separated deterministic allocation rule and each round t, the bid-independent history bHt−1 and the bids completely determine which arm is chosen in this round. Moreover, bHt−1 alone (without the bids) com- Recall the CTR vectors ~µi as defined in Section 4. Let p and q be the distributions induced on bHT by ~µ0 and ~µ1, respectively. Let pt and qt be the distributions induced onbht by ~µ0 and ~µ1, respectively. Let Ht the support of bHt, i.e. the set of all t-bit vectors. In the forthcoming applications of Theorem 4.4, the universe will be U = HT . By abuse of notation, we will treat bHt as a projection HT → Ht, so that it can Claim 4.5. D(pkq) = Ep F (p; q bHt) + Pt Proof. Use induction on t ≥ 0 (set bH0 = 1). In order to obtain the claim for a given t assuming that it holds for t − 1, apply Theorem 4.4(i) with Y = bHt−1 and Z =bht. Claim 4.6. F (pt; qt bHt−1) ≤ 4ǫ2 Ct 1{At=1} for each round t. Proof. We are interested in the function F = F (pt; qt bHt−1) : HT → R. Given bHt−1, one of the following • round t is not bid-independent. Thenbht = 0, hence F (·) = 0 by Theorem 4.4(iii), • round t is bid-independent and arm 1 is not selected. Thenbht is distributed as a fair coin under both p and q, so again F (·) = 0. • round t is bid-independent and arm 1 is selected. Then F (·) ≤ 4ǫ2 by Theorem 4.4(iv). Given the full bid-independent history bHT , p and q become (the same) point measure, so by Theo- rem 4.4(iii) Ep F (p; q bHT ) = 0. Therefore taking Claim 4.5 with t = T we obtain s=1 Ep F (ps; qs bHs−1) for any t > 1. three cases occurs: D(pkq) = TXt=1 Ep F (pt; qt bHt−1) = 4ǫ2 TXt=1 Ep [Ct 1{At=1}] = 4ǫ2 Ep[N1]. (4.2) For a given round t and fixed bids, the allocation at round t is completely determined by the bid-independent history bHt−1. Thus, we can treat {At ∈ S} as an event in HT . Now (4.1) follows from (4.2) via an application of Theorem 4.4(ii) with U ′ = {At ∈ S}. 4.2 Lower bound for non-scalefree allocations In this subsection we derive a regret lower bound for deterministic truthful mechanisms without assuming that the allocations are scale-free. In particular, for two agents there are no assumptions. This lower bound holds for any k (the number of agents) assuming that the allocation satisfies IIA, but unlike the one in Theorem 4.1 it does not depend on k. Theorem 4.7. Consider the stochastic MAB mechanism design problem with k agents. Let (A,P) be a normalized truthful mechanism such that A is a non-degenerate deterministic allocation rule. Suppose A satisfies IIA. Then its regret is R(T ; vmax) = Ω(vmax T 2/3) for any sufficiently large vmax. Let us sketch the proof. Fix an allocation A. In Definition 3.3, if round t is (b, ρ) influential, for some click realization ρ and bid vector b, an agent i is called strongly influenced by round t if it is one of the 20 two agents that are “influenced” by round t but is not the “influencing agent” of round t. In particular, it holds that A(b, ρ, t) 6= i. For each click realization ρ, round t and agent i, if there exists a bid vector b such that round t is (b, ρ)-influential with strongly influenced agent i, then fix any one such b, and define b∗ i = b∗ i (ρ, t), where the maximum is taken over all click realizations ρ, all rounds t, and all agents i. Let us say that round t is B∗-free from agent i w.r.t click realization ρ, if for this click realization the following property holds: agent i is not selected in round t as long as each bid is at least B∗. i (ρ, t) := maxj6=i bj. Let us define B∗ A = maxρ,t,i b∗ Lemma 4.8. In the setting of Theorem 4.7, for any click realization ρ, any influential round t is B∗ from some agent w.r.t. ρ. A-free i (ρ, t) ≤ B∗ Suppose round t is not B∗ Proof. Fix click realization ρ. Since round t is influential, for some bid profile b and agent i it is (b, ρ)- influential with a strongly influenced agent i. By definition of b∗ i (ρ, t), without loss of generality each bid in b (other than i’s bid) is at most b∗ A. Then A(b, ρ, t) 6= i, and round t is (b, ρ)-secured from agent i. A-free from agent i w.r.t ρ. Then there exists a bid profile b′ in which each bid (other than i’s bid) is at least B∗ A such that A(b′, ρ, t) = i. To derive a contradiction, let us transform b to b′ by adjusting first the bid of agent i and then bids of agents j 6= i one agent at a time. Initially agent i is not chosen in round t, and after the last step of this transformation agent i is chosen. Thus it is chosen at some step, say when we adjust the bid of agent i or some agent j 6= i. This transfer of impression to agent i cannot happen when bid of agent i is adjusted from bi to b′ i (since round t is (b; ρ)-secured from i), and it cannot happen when bid of agent j 6= i is adjusted from bj to b′ j ≥ bj (this is because, the transfer to i cannot happen from j because of pointwise-monotonicity and the transfer to i cannot happen from l 6= j because of IIA). This is a contradiction. let ~µ0 be the vector of CTRs in which all CTRs are 1 A. Let N (ρ) be the number of influential rounds w.r.t click realization ρ. Let Ni(ρ) be the number of influential rounds w.r.t. click realization ρ that are B∗ A-free from agent i w.r.t. ρ. Then N and the Ni’s are random variables in the probability space induced by the Let T be the time horizon. Assume vmax ≥ 2B∗ clicks. By Lemma 4.8 we have thatPi Ni(ρ) is at least the number of influential rounds. As in Section 4, Fix a constant β > 0 to be specified later. If E0[N ] ≥ βk T 2/3 then E0[Ni] ≥ β T 2/3 for some agent i, so the allocation incurs expected regret R(T ; vmax) ≥ Ω(vmax T 2/3) on any problem instance Jj, j 6= i. (In this problem instance, CTRs given by ~µ0, the bid of agent j is vmax, and all other bids are vmax/2.) Now suppose E0[N ] ≤ βk T 2/3. Then the desired regret bound follows by an argument very similar to the one in the last paragraph of the proof of Theorem 4.1. 2 , and let E0[·] denote expectation w.r.t. ~µ0. 4.3 Universally truthful randomized MAB mechanisms Consider randomized mechanisms that are universally truthful, i.e. truthful for each realization of the inter- nal random seed. Our goal here is to extend the Ω(vmax T 2/3) regret bounds for deterministic mechanisms to universally truthful randomized mechanisms, under relatively mild assumptions. Note that lower bounds on regret for universally truthful MAB mechanisms do not immediately follow from those for deterministic truthful MAB mechanisms. To see this, consider a randomized MAB mecha- nism A that randomizes over some deterministic truthful mechanisms, each with regret at least R. Then for each deterministic mechanism A′ in the support of A there is a problem instance on which A′ has regret at least R; it could be a different problem instance for different A′. Whereas to lower-bound the regret of A we need to provide one problem instance with high regret in expectation over all A′. We consider mechanisms that randomize over exploration-separated deterministic allocation rules. As per the discussion above, it does not suffice to quote Theorem 4.1; instead, we need to extend its proof. 21 Lemma 4.9. Consider the MAB mechanism design problem. Let D be a distribution over exploration- separated deterministic allocation rules. Then EA∈D [RA(T ; vmax)] = Ω(vmax k1/3 T 2/3). Proof. Recall that in the proof of Theorem 4.1 we define a family F of 2k problem instances, and show that if A is an exploration-separated deterministic allocation rule, then on one of these instances its regret In fact, we can extend this analysis to show that the regret is “high”, that is at least R∗ = is “high”. Ω(vmax k1/3 T 2/3), on an instance I ∈ F chosen uniformly at random from F; here regret is in expectation over the choice of I. 17 Once this is proved, it follows that regret is R∗/2 for any distribution over such A, in expectation over both the choice of A and the choice of I. Thus there exists a single (deterministic) instance I such that EA∈D [RA,I (T )] ≥ R∗/2. Theorem 4.3 can be extended similarly. 5 A matching upper bound Let us describe a very simple mechanism, called the naive MAB mechanism, which matches the lower bound from Theorem 4.1 up to polylogarithmic factors (and also the lower bound from Theorem 4.3, for γ = λ = 2 3 and constant δ). Fix the number of agents k, the time horizon T , and the bid vector b. The mechanism has two phases. In the exploration phase, each agent is selected for T0 := k−2/3 T 2/3(log T )1/3 rounds, in a round robin fashion. Let ci be the number of clicks on agent i in the exploration phase. In the exploitation phase, an agent i∗ ∈ argmaxi cibi is chosen and selected in all remaining rounds. Payments are defined as follows: agent i∗ pays maxi∈[k]\{i∗} cibi/ci∗ for every click she gets in exploitation phase, and all others pay 0. (Exploration rounds are free for every agent.) This completes the description of the mechanism. Lemma 5.1. Consider the stochastic MAB mechanism design problem with k agents. The naive mechanism is normalized, truthful and has worst-case regret R(T ; vmax) = O(vmax k1/3 T 2/3 log2/3 T ). Proof. The mechanism is truthful by a simple second-price argument.18 Recall that ci is the number of clicks i got in the exploration phase. Let pi = maxj6=i cjbj/ci be the price paid (per click) by agent i if she wins (all) rounds in exploitation phase. If vi ≥ pi, then by bidding anything greater than pi agent i gains vi − pi utility each click irrespective of her bid, and bidding less than vi, she gains 0, so bidding vi is weakly dominant. Similarly, if vi < pi, then by bidding anything less than pi she gains 0, while bidding bi > pi, she loses bi − pi each click. So bidding vi is weakly dominant in this case too. By Chernoff bounds, for each agent i we have Pr [¯µi − µi > r] ≤ T −4, for r = p8 log(T )/T0. If in For the regret bound, let (µ1 , . . . , µk) be the vector of CTRs, and let ¯µi = ci/T0 be the sample CTRs. a given run of the mechanism all estimates ¯µi lie in the intervals specified above, call the run clean. The expected regret from the runs that are not clean is at most O(vmax), and can thus be ignored. From now on let us assume that the run is clean. The regret in the exploration phase is at most k T0 vmax = O(vmax k1/3 T 2/3 log1/3 T ). For the ex- ploitation phase, let j = argmaxi µibi. Then (since we assume that the run is clean) we have (µi∗ + r) bi∗ ≥ ¯µi∗ bi∗ ≥ ¯µj bj ≥ (µj − r) bj, 17This extension requires but minor modifications to the proof of Theorem 4.1. For instance, for the case k ≥ 3 we argue that 2 agents i (and so on), and if E0[N ] ≤ R then (omitting some details) 18Alternatively, one can use Theorem 1.5 since all exploration rounds are bid-independent, and only exploration rounds are first, if E0[N ] > R then E0[Ni] ≤ 2 there are Ω(k) good agents i such that E0[Ni] ≤ 2R/k (and so on). k E0[N ] for at least k influential, and the payments are exactly as defined in Theorem 3.1. 22 which implies µjvj − µi∗vi∗ ≤ r(vj + vi∗) ≤ 2r vmax. Therefore, the regret in exploitation phase is at most 2r vmax T = O(vmax k1/3 T 2/3 log2/3 T ). Therefore the total regret is as claimed. 6 Randomized allocations and adversarially chosen clicks In this section we discuss randomized allocations. We apply them to a version of the MAB mechanism design problem in which clicks are generated adversarially.19 The objective is to optimize the worst-case regret over all values v = (v1 , . . . , vk) such that vi ∈ [0, vmax] for each i, and all click realizations ρ: R(T ; v; ρ) =hmaxi viPT R(T ; vmax) = max{R(T ; v; ρ) : all click realizations ρ, all v such that vi ∈ [0, vmax] for each i}. t=1ρi(t)i −PT t=1Pk i=1 vi ρi(t) E [Ai(v; ρ; t)] (6.1) The first term in (6.1) is the social welfare from the best time-invariant allocation, the second term is the social welfare generated by A. Let us make a few definitions related to truthfulness. Recall that a mechanism is called weakly truthful if for each click realization, it is truthful in expectation over its random seed. A randomized allocation is pointwise monotone if for each click realization and each bid profile, increasing the bid of any one agent does not decrease the probability of this agent being allocated in any given round. For a set S of rounds and a function σ : S → {agents}, an allocation is (S, σ)-separated if (i) it coincides with σ on S, (ii) the clicks from the rounds not in S are discarded (not reported to the algorithm). An allocation is strongly separated if before round 1, without looking at the bids, it randomly chooses a set S of rounds and a function σ : S → {agents}, and then runs a pointwise monotone (S, σ)-separated allocation. Note that the choice of S and σ is independent of the clicks, by definition. We obtain a structural result: for any (randomized) strongly separated allocation rule A there exists a mechanism that is normalized and weakly truthful. Lemma 6.1. Consider the MAB mechanism design problem. Let A be a (randomized) strongly separated allocation rule. Then there exists a payment rule P such that the resulting mechanism (A,P) is normalized and weakly truthful. We consider PSIM [8, 28], a randomized MAB algorithm from the literature which we here interpret as an MAB allocation rule. It follows from [8, 28], that PSIM has strong regret guarantees for the adver- sarial MAB mechanism design problem: it obtains regret R(T, vmax) = O(vmax k1/3 (log k)1/3 T 2/3). In Section 6.1 we state PSIM and show that it is strongly separated. Thus, we obtain the following result. Theorem 6.2. There exists a weakly truthful normalized mechanism for the adversarial MAB problem (against oblivious adversary) whose regret grows as O((k log k)1/3 · T 2/3 · vmax). Remark. For the adversarial MAB problem (i.e., without the restriction of truthfulness), the regret bound can be improved to O(√kT · vmax) [7, 5]. However, the algorithms that achieve this bound do not immediately yield MAB allocation rules that are strongly separated. It is an open question whether the regret bound in Corollary 6.2 can be improved. Proof of Lemma 6.1: Throughout the proof, let us fix a click realization ρ, time horizon T , bid vector b, and agent i. We will consider the payment of agent i. We will vary the bid of agent i on the interval [0, bi]; the bids b−i of all other agents always stay the same. 19We focus on the oblivious adversary which (unlike the more difficult “adaptive adversary”) specifies all clicks in advance. 23 Let ci(x) be the number of clicks received by agent i given that her bid is x. Then by (the appropriate version of) Theorem 3.1 the payment of agent i must be Pi(b) such that EA[Pi(b)] = EAhbi ci(bi) −R bi x=0 ci(x) dxi , (6.2) where the expectation is taken over the internal randomness in the algorithm. Recall that initially A randomly selects, without looking at the bids, a set S of rounds and a function σ : S → {agents}, and then runs some pointwise monotone (S, σ)-separated allocation A(S,σ). In what follows, let us fix S and σ, and denote A∗ = A(S,σ). We will refer to the rounds in S as exploration rounds, and to the rounds not in S as exploitation rounds. Let γ∗ i (x, t) be the probability that algorithm A∗ allocates agent i in round t given that agent i bids x. Note that for fixed value of internal random seed of A∗ this probability can only depend on the clicks observed in exploration rounds, which are known to the mechanism. Therefore, abstracting away the computational issues, we can assume that it is known to the mechanism. Define the payment rule as follows: in each exploitation round t in which agent i is chosen and clicked, charge P ∗ i (b, t) = bi − Then the total payment assigned to agent i is 1 i (bi, t)Z bi 0 γ∗ γ∗ i (x, t) dx. (6.3) i (b) =Pt6∈S ρi(t) A∗ P ∗ i (b; ρ; t) P ∗ Since allocation A∗ is pointwise monotone, the probability γ∗ i (x, t) is non-decreasing in x. Therefore P ∗ i (b, t) ∈ [0, bi] for each round t. It follows that the mechanism is normalized (for any realization of the random seed of allocation A). It remains to check that the payment rule (6.3) results in (6.2). Let c∗ i (x) be the number of clicks allocated to agent i by allocation A∗ given that her bid is x. Let c (x) be the corresponding number of clicks in exploitation rounds only. Since A∗ is (S, σ)-separated, we have i (b, t). (6.4) expl i E[c∗ i (x) − c expl i (x)] =Pt∈S ρσ(t)(t) = const(x). Taking expectations in (6.4) over the random seed of AS and using (6.5), we obtain (6.5) E[P ∗ i (b, t) i (b)] =Pt6∈S ρi(t) γ∗ =Pt6∈S ρi(t) hbi γ∗ = bihPt6∈S ρi(t) γ∗ (bi)] −R bi = Ehbi c∗ i (bi) −R bi i (bi, t) P ∗ i (bi, t) −R bi i (bi, t)i −R bi i (x) dxi . = bi E [cexpl 0 0 c∗ E[cexpl i i 0 γ∗ i (x, t) dxi 0 hPt6∈S ρi(t) γ∗ (x)] dx i (x, t)i dx Finally, taking expectations over the choice of S and σ, we obtain (6.2). 6.1 Algorithm PSIM is strongly separated In this subsection we interpret PSIM [8, 28] as an MAB allocation rule and show that it is strongly separated (which implies Theorem 6.2). For the sake of completeness, we present PSIM below. As usual, k denotes the number of agents; let [k] denote the set of agents. 24 Input: Time horizon T , bid vector b. Let vmax = maxi bi. Output: For each round t ≤ T , a distribution on [k]. 1. Divide the time horizon into P phases of T /P consecutive rounds each. 2. From rounds of each phase p, pick without replacement k rounds at random (called the exploration rounds) and assign them randomly to k arms. Let S denote the set of all exploration rounds (of all phases). Let f : S → [k] be the function which tells which arm is assigned to an exploration round in S. The rounds in [T ] \ S are called the exploitation rounds. 3. Let wi(0) = 1 for all i ∈ [k]. 4. For each phase p = 1, 2, . . . , P (a) For each round t in phase p i. If t ∈ S and f (t) = i, then define the distribution γ(b; t; S, f ) such that γi(b; t; S, f ) = 1. Pick an agent according to this distribution (equivalently, pick agent i), observe the click ρi(t), and update wi(p) multiplicatively, wi(p) = wi(p − 1) · (1 + ǫ)ρi(t)bi/vmax. ii. If t 6∈ S, then define the distribution γ(b; t; S, f ) such that γi(b; t; S, f ) = wi(p−1) an agent according to γ(b; t; S, f ), observe the feedback, and discard the feedback. Pj wj(p−1) . Pick If we pick the values ǫ = (k log k/T )1/3 and P = (log k)1/3(T /k)2/3, then the regret of PSIM is Regret. bounded by O((k log k)1/3T 2/3vmax) against any oblivious adversary (see [8, 28]). Claim 6.3. PSIM is strongly-separated. Proof. It is clear from the structure of PSIM above that it chooses a set S of exploration rounds and a function f : S → [k] in the beginning without looking at the bids and then runs an (S, f )-separated allocation. We need to prove that the (S, f )-separated allocation is pointwise monotone. For this we need prove that the probability γi(b; t; S, f ) is monotone in the bid of agent i, where γi(b; t; S, f ) denotes the probability of picking agent i in round t when bids are b given the choice of S and f . If t ∈ S, the γi(b; t; S, f ) is independent of bids, and hence is monotone in bi. Let t 6∈ S and t is a round in phase p. Let us denote by f −1(i, p) the (unique) exploration round in phase p assigned to agent i. We then have γi(b; t; S, f ) = (1 + ǫ) bi vmax Pp−1 q=1 ρi(f −1(i,q)) (cid:30)Xj (1 + ǫ) bj vmax Pp−1 q=1 ρj (f −1(j,q)). We split the denominator into the term for agent i and all other terms. It is then not hard to see that this is a non-decreasing function of bi. 7 Truthfulness in expectation over CTRs We consider the stochastic MAB mechanism design problem under a more relaxed notion of truthfulness: truthfulness in expectation, where for each vector of CTRs the expectation is taken over clicks (and the internal randomness in the mechanism, if the latter is not deterministic).20 We show that any MAB allocation A∗ that is monotone in expectation, can be converted to an MAB mechanism that is truthful in expectation and normalized in expectation, with minor changes and a very minor increase in regret. As discussed in the Introduction, this result rules out a natural lower-bounding approach. 20 Normalized-in-expectation and monotone-in-expectation properties are defined similarly. An allocation rule is monotone in expectation if for each agent i and fixed bid profile b−i, the corresponding expected click-allocation is a non-decreasing function of bi. A mechanism is normalized in expectation if in expectation each agent is charged an amount between 0 and her bid for each click she receives. In both cases, the expectation is taken over the clicks and possibly the allocation’s random seed. 25 Remark. The follow-up work [9] has established that there exist MAB allocations that are monotone in expectation whose regret matches the optimal upper bounds for MAB algorithms. In fact, [9] defined a rather natural class of “well-formed MAB algorithms” that, e.g., includes (a version of) algorithm UCB1 [6], and proved that any algorithm in this class gives rise to a monotone-in-expectation MAB allocation. We will show that for any allocation A∗ that is monotone in expectation, any time horizon T , and any parameter γ ∈ (0, 1) there exists a mechanism (A,P) such that the mechanism is truthful in expectation and normalized in expectation, and allocation A initially makes a random choice between A∗ and some other allocation, choosing A∗ with probability at least γ. We call such allocation A a γ-approximation of A∗. Clearly, on any problem instance we have RA(T ) ≤ γ RA∗(T ) + (1 − γ)T . The extra additive factor of (1 − γ)T is not significant if e.g. γ = 1 − 1 T . The problem with this mechanism is that it is not ex-post normalized; moreover, in some click realizations payments may be very large in absolute value. Theorem 7.1. Consider the stochastic MAB mechanism design problem with k agents and a fixed time horizon T . For each γ ∈ (0, 1) and each allocation rule A∗ that is monotone in expectation, there exists a mechanism (A,P) such that A is a γ-approximation of A∗, and the mechanism is truthful in expectation and normalized in expectation. Remark. The key idea is to view the Myerson payments (see Theorem 3.1) as multivariate polynomials over the CTRs, and argue that any such polynomial can be “implemented” by a suitable payment rule. The payment rule P will be well-defined as a mapping from histories to numbers; we do not make any claims on the efficient computability thereof. Proof. Let Aexpl be the allocation rule where in each round an agent is chosen independently and uniformly at random. Allocation A is defined as follows: use A∗ with probability γ; otherwise use Aexpl. Fix an instance (b, µ) of the stochastic MAB mechanism design problem, where b = (b1 , . . . , bk) and µ = (µ1 , . . . , µk) are vectors of bids and CTRs, respectively. Let Ci = Ci(bi; b−i) be the expected number of clicks for agent i under the original allocation A∗. Then by Myerson [38] the expected payment of agent i must be i = γhbi Ci(bi; b−i) −R bi PM 0 Ci(x; b−i) dxi . i We treat the expected payment as a multivariate polynomial over µ1 , . . . , µk. Claim 7.2. PM Proof. Fix the bid profile. Let Xt be allocation of algorithm A∗. Let poly(T ) be the set of all polynomials over µ1 , . . . , µk of degree at most T . Consider a fixed history h = (x1, y1; . . . ; xT , yT ), and let ht be the corresponding history up to (and including) round t. Then is a polynomial of degree ≤ T in variables µ1 , . . . , µk. (7.1) (7.2) (7.3) P[h] =QT Ci(bi; b−i) =Ph∈H t=1 Pr[Xt = xt ht−1] µyt xt (1 − µxt)1−yt ∈ poly(T ) P[h] #clicksi(h) ∈ poly(T ). Therefore PM monomial of Ci(x; b−i). i ∈ poly(T ), since one can take an integral in (7.1) separately over the coefficient of each Fix time horizon T . For a given run of an allocation rule, the history is defined as h = (x1, y1; . . . ; xT , yT ), where xt is the allocation in round t, and yt ∈ {0, 1} is the corresponding click. Let H be the set of all possible histories. 26 i Our payment rule P is a deterministic function of history. For each agent i, we define the payment Pi = Pi(h) for each history h such that Eh[Pi(h)] = PM for any choice of CTRs, and hence Eh[Pi(h)] ≡ PM i , where ≡ denotes an equality between polynomials over µ1 , . . . , µk. Fix the bid vector and fix agent i. We define the payment Pi as follows. Charge nothing if allocation A∗ is used. If allocation Aexpl is used, charge per monomial. Specifically, let mono(T ) be the set of all monomials over µ1 , . . . , µk of degree at most T . For each monomial Q ∈ mono(T ) we define a subset of relevant histories Hi(Q) ⊂ H. (We defer the definition till later in the proof.) For a given history h ∈ H we charge a (possibly negative) amount Pi(h) = 1 i (Q), (7.4) where deg(Q) is the degree of Q, and PM histories induced by Aexpl. Then the expected payment is 1−γ PQ∈mono(T ): h∈Hi(Q) kdeg(Q) PM i (Q) is the coefficient of Q in PM Eh[Pi(h)] =PQ∈mono(T ) kdeg(Q) Pexpl[Hi(Q)] PM Therefore in order to guarantee that Eh[Pi(h)] ≡ PM i it suffices to choose Hi(Q) for each Q so that (7.5) Consider a monomial Q = µα1 k . Let Hi(Q) consist of all histories such that first agent 1 is selected 1 α1 times in a row, and clicked every time, then agent 2 is selected α2 times in a row, and clicked every time, and so on till agent k. In the remaining T − deg(Q) rounds, any agent can be chosen, and any outcome (click or no click) can be received. It is clear that (7.5) holds. kdeg(Q) Pexpl[Hi(Q)] ≡ Q. . . . µαk i . Let Pexpl be the distribution on i (Q). 8 Open questions Despite the exciting developments in the follow-up work [9, 56, 22, 48] (discussed in Section 1.3), MAB mechanisms are not well-understood. Below is a snapshot of the open questions, current as of this writing. Impossibility results for deterministic MAB mechanisms. 1. For deterministic MAB mechanisms with k > 2 agents, is it possible to obtain lower bounds on regret for weakly separated MAB allocation rules, without assuming IIA? 2. We conjecture that the “informational obstacle” – insufficient observable information to compute payments – can be meaningfully extended to a very general class of mechanisms in which an alloca- tion rule interacts with the environment. As mentioned in Section 1.3, the follow-up work [56, 48] suggested settings other than MAB mechanisms in which this obstacle arises. To conclude that the “informational obstacle” is prominent in a given setting, one needs to prove that unrestricted payment computation makes truthful mechanisms strictly more powerful. 3. Surprisingly, we still do not understand the limitations of deterministic truthful-in-expectation mecha- nisms. While, according to [9], there exist regret-optimal MAB allocation rules that are deterministic and monotone-in-expectation (e.g., the allocation rule based on UCB1), it is not clear whether any such allocation rule can be extended to a deterministic truthful-in-expectation MAB mechanism. 4. It would be interesting to analyze a slightly more permissive model in which an MAB mechanism can decide to “skip” a round without displaying an ad. In particular, in such model we could trivially extend the lower bounds on regret from the special case of k = 2 agents to k > 2 agents. However, our negative results for two agents do not immediately extend to this new model, and moreover the structural results for k > 2 agents do not immediately follow either. 27 Randomized MAB mechanisms. 1. Recall that the “BKS reduction” from Babaioff, Kleinberg and Slivkins [9] exhibits a tradeoff between variance in payments and loss in performance. Since the variance in payments can be very high, optimizing this tradeoff is crucial. This question is not resolved by the worst-case optimality result in Wilkens and Sivan [56]. While no other reduction can achieve a better tradeoff for all monotone MAB allocation rules simultaneously, the result in [56] does not rule out a reduction with better tradeoff for some monotone MAB allocation rules, and therefore it does not rule out an MAB mechanism with better tradeoff. Furthermore, it is possible that an MAB mechanism with optimal tradeoff cannot be represented as a reduction from a regret-optimal allocation rule, in which case results about reductions simply do not apply. 2. Consider weakly truthful MAB mechanisms in the setting with adversarially chosen clicks.21 The weakly truthful MAB mechanism in the present paper achieves regret O(k1/3 T 2/3), whereas the best known MAB algorithms achieve regret O(√kT ) [7, 5]. It is not clear what should be the tight regret bound. In particular, neither our reduction in Section 6 nor the BKS reduction from [9] immediately apply to the algorithms in [7, 5]. 3. More generally, as discussed in Section 1.2, pay-per-click ad auctions motivate many other versions of the MAB mechanism design problem, corresponding to the various MAB settings studied in the literature. For every such version one could compare the performance of weakly truthful MAB mech- anisms with that of the best MAB algorithms. The positive direction here reduces (using the BKS reduction) to designing weakly monotone MAB allocations. This type of question is a new angle in the MAB literature, see [50] for a self-contained account. Multi-slot MAB mechanisms: pay-per-click auctions with multiple ad slots and unknown CTRs. 1. Intuitively it seems that the negative results from this paper should extend to the setting with two or more ad slots. However, the precise characterization results and regret bounds remain elusive. Also, such results would probably depend on the specific multi-slot model, i.e. on on how clicks in different slots are correlated, and how CTRs of the same ad in different slots are related to one another. 2. Recall that Gatti, Lazaric and Trovo [22] provide truthful multi-slot MAB mechanisms based on the simple MAB mechanism presented in this paper and (independently) in Devanur and Kakade [17]. It remains to be seen if one can obtain weakly truthful mechanisms with better regret, e.g. using a more efficient multi-slot MAB algorithm with an extension of the BKS reduction. Note that even the algorithmic (i.e., non-strategic) version of multi-slot MAB is not fully understood. Acknowledgements We thank Jason Hartline, Robert Kleinberg and Ilya Segal for helpful discussions. References [1] Gagan Aggarwal, Ashish Goel, and Rajeev Motwani. Truthful auctions for pricing search keywords. In ACM Conf. on Electronic Commerce (EC), pages 1–7, 2006. 21Recall that an MAB mechanism is weakly truthful if for each click realization, it is truthful in expectation over its random seed. Weakly monotone MAB allocation rules are defined similarly. 28 [2] Gagan Aggarwal and S. Muthukrishnan. Tutorial on theory of sponsored search auctions. In IEEE Symp. on Foundations of Computer Science (FOCS), 2008. [3] Aaron Archer and ´Eva Tardos. Truthful mechanisms for one-parameter agents. In IEEE Symp. on Foundations of Computer Science (FOCS), pages 482–491, 2001. [4] Susan Athey and Ilya Segal. An efficient dynamic mechanism. Available from http://www.stanford.edu/isegal/agv.pdf, March 2007. [5] J.Y. Audibert and S. Bubeck. Regret Bounds and Minimax Policies under Partial Monitoring. J. of Machine Learning Research (JMLR), 11:2785–2836, 2010. A preliminary version has been published in COLT 2009. [6] Peter Auer, Nicol`o Cesa-Bianchi, and Paul Fischer. Finite-time analysis of the multiarmed bandit problem. Machine Learning, 47(2-3):235–256, 2002. Preliminary version in 15th ICML, 1998. [7] Peter Auer, Nicol`o Cesa-Bianchi, Yoav Freund, and Robert E. Schapire. The nonstochastic multiarmed bandit problem. SIAM J. Comput., 32(1):48–77, 2002. Preliminary version in 36th IEEE FOCS, 1995. [8] Baruch Awerbuch and Robert Kleinberg. Online linear optimization and adaptive routing. J. of Computer and System Sciences, 74(1):97–114, February 2008. Preliminary version in 36th ACM STOC, 2004. [9] Moshe Babaioff, Robert Kleinberg, and Aleksandrs Slivkins. Truthful mechanisms with implicit payment com- putation. In 11th ACM Conf. on Electronic Commerce (EC), pages 43–52, 2010. Best Paper Award. [10] Maria-Florina Balcan, Avrim Blum, Jason D. Hartline, and Yishay Mansour. Reducing mechanism design to al- gorithm design via machine learning. J. of Computer and System Sciences, 74(8):1245–1270, 2008. Preliminary version in IEEE FOCS 2005. [11] Michael Ben-Or and Avinatan Hassidim. The Bayesian Learner is Optimal for Noisy Binary Search (and Pretty Good for Quantum as Well). In IEEE Symp. on Foundations of Computer Science (FOCS), 2008. [12] Dirk Bergemann and Juuso Valimaki. Bandit Problems. In Steven Durlauf and Larry Blume, editors, The New Palgrave Dictionary of Economics, 2nd ed. Macmillan Press, 2006. [13] Dirk Bergemann and dynamic cowles.econ.yale.edu/P/cd/d15b/d1584.pdf, October 2006. Juuso Valimaki. Efficient auctions. Available from [14] Nicol`o Cesa-Bianchi and G´abor Lugosi. Prediction, learning, and games. Cambridge Univ. Press, 2006. [15] Thomas M. Cover and Joy A. Thomas. Elements of Information Theory. John Wiley & Sons, New York, 1991. [16] Varsha Dani and Thomas P. Hayes. Robbing the bandit: less regret in online geometric optimization against an adaptive adversary. In 17th ACM-SIAM Symp. on Discrete Algorithms (SODA), pages 937–943, 2006. [17] Nikhil Devanur and Sham M. Kakade. The price of truthfulness for pay-per-click auctions. In 10th ACM Conf. on Electronic Commerce (EC), pages 99–106, 2009. [18] Shahar Dobzinski and Mukund Sundararajan. On characterizations of truthful mechanisms for combinatorial auctions and scheduling. In ACM Conf. on Electronic Commerce (EC), pages 38–47, 2008. [19] Benjamin Edelman, Michael Ostrovsky, and Michael Schwarz. Internet advertising and the generalized second- price auction: Selling billions of dollars worth of keywords. American Economic Review, 97(1):242–259, March 2007. [20] Abraham Flaxman, Adam Kalai, and H. Brendan McMahan. Online Convex Optimization in the Bandit Setting: Gradient Descent without a Gradient. In 16th ACM-SIAM Symp. on Discrete Algorithms (SODA), pages 385–394, 2005. [21] P.R. Freeman. The secretary problem and its extensions: a review. Intl. Statistics Review, 51(2):189–206, 1983. [22] Nicola Gatti, Alessandro Lazaric, and Francesco Trovo. A Truthful Learning Mechanism for Contextual Multi- Slot Sponsored Search Auctions with Externalities. In 13th ACM Conf. on Electronic Commerce (EC), 2012. [23] Elad Hazan and Satyen Kale. Better algorithms for benign bandits. In 20th ACM-SIAM Symp. on Discrete Algorithms (SODA), pages 38–47, 2009. 29 [24] Nicole Immorlica, Kamal Jain, Mohammad Mahdian, and Kunal Talwar. Click fraud resistant methods for learning click-through rates. In Workshop on Internet & Network Economics (WINE), pages 34–45, 2005. [25] Sham M. Kakade, Ilan Lobel, and Hamid Nazerzadeh. Optimal Dynamic Mechanism Design and the Virtual Pivot Mechanism. SSRN Report, SSRN ID 1782211, 2011. [26] Richard Karp and Robert Kleinberg. Noisy binary search and its applications. In 18th ACM-SIAM Symp. on Discrete Algorithms (SODA), pages 881–890, 2007. [27] Robert Kleinberg. Online Decision Problems with Large Strategy Sets. PhD thesis, MIT, 2005. [28] Robert Kleinberg. Lecture notes: CS683: Learning, Games, and Electronic Markets (week 8), Spring 2007. Available at http://www.cs.cornell.edu/courses/cs683/2007sp/lecnotes/week8.pdf. [29] Robert Kleinberg. Lecture notes: CS683: Learning, Games, and Electronic Markets (week 9), Spring 2007. Available at http://www.cs.cornell.edu/courses/cs683/2007sp/lecnotes/week9.pdf. [30] Robert Kleinberg, Aleksandrs Slivkins, and Eli Upfal. Multi-Armed Bandits in Metric Spaces. In 40th ACM Symp. on Theory of Computing (STOC), pages 681–690, 2008. [31] Sebastien Lahaie, David M. Pennock, Amin Saberi, and Rakesh V. Vohra. In N. Nisan, T. Roughgarden, E. Tardos, and V. Vazirani (eds.) Chapter 28, Sponsored search auctions. Cambridge University Press., 2007. [32] Tze Leung Lai and Herbert Robbins. Asymptotically efficient Adaptive Allocation Rules. Advances in Applied Mathematics, 6:4–22, 1985. [33] John Langford and Tong Zhang. The Epoch-Greedy Algorithm for Contextual Multi-armed Bandits. In 21st Advances in Neural Information Processing Systems (NIPS), 2007. [34] Ron Lavi, Ahuva Mu’alem, and Noam Nisan. Towards a characterization of truthful combinatorial auctions. In IEEE Symp. on Foundations of Computer Science (FOCS), page 574, 2003. [35] Ron Lavi and Noam Nisan. Online ascending auctions for gradually expiring items. In 16th ACM-SIAM Symp. on Discrete Algorithms (SODA), pages 1146–1155, 2005. [36] Aranyak Mehta, Amin Saberi, Umesh Vazirani, and Vijay Vazirani. Adwords and generalized online matching. J. ACM, 54(5):22, 2007. [37] Reshef Meir, Ariel D. Procaccia, and Jeffrey S. Rosenschein. Algorithms for Strategyproof Classification. Arti- ficial Intelligence, 186:123–156, 2012. [38] Roger B. Myerson. Optimal Auction Design. Mathematics of Operations Research, 6:58–73, 1981. [39] Hamid Nazerzadeh, Amin Saberi, and Rakesh Vohra. Dynamic cost-per-action mechanisms and applications to online advertising. In 17th Intl. World Wide Web Conf. (WWW), 2008. [40] N. Nisan and A. Ronen. Algorithmic Mechanism Design. Games and Economic Behavior, 35(1-2):166–196, 2001. [41] N. Nisan, T. Roughgarden, E. Tardos, and V. Vazirani (eds.). Algorithmic Game Theory. Cambridge University Press., 2007. [42] Sandeep Pandey, Deepayan Chakrabarti, and Deepak Agarwal. Multi-armed Bandit Problems with Dependent Arms. In 24th Intl. Conf. on Machine Learning (ICML), 2007. [43] Christos Papadimitriou, Michael Schapira, and Yaron Singer. On the hardness of being truthful. In IEEE Symp. on Foundations of Computer Science (FOCS), 2008. [44] Alessandro Pavan, Ilya Segal, and Juuso Toikka. Dynamic Mechanism Design: Revenue Equivalence, Profit Maximization, and Information Disclosure. Working paper, 2011. [45] Filip Radlinski, Robert Kleinberg, and Thorsten Joachims. Learning diverse rankings with multi-armed bandits. In 25th Intl. Conf. on Machine Learning (ICML), pages 784–791, 2008. [46] Michael Rothschild. A two-armed bandit theory of market pricing. Journal of Economic Theory, 9:185–202, 1974. 30 [47] Tim Roughgarden. An algorithmic game theory primer. IFIP International Conference on Theoretical Computer Science (TCS). An invited survey., 2008. [48] Victor Shnayder, Jeremy Hoon, David Parkes, and Vikas Kawadia. Truthful Prioritization Schemes for Spectrum Sharing. In 7th Workshop on the Economics of Networks, Systems and Computation (NetEcon), 2012. [49] Aleksandrs Slivkins. Contextual Bandits with Similarity Information. In 24th Conf. on Learning Theory (COLT), 2011. [50] Aleksandrs Slivkins. Monotone multi-armed bandit allocations. Open Problem Session at COLT 2011 (Conf. on Learning Theory), 2011. [51] Aleksandrs Slivkins and Eli Upfal. Adapting to a Changing Environment: the Brownian Restless Bandits. In 21st Conf. on Learning Theory (COLT), pages 343–354, 2008. [52] Niranjan Srinivas, Andreas Krause, Sham Kakade, and Matthias Seeger. Gaussian Process Optimization in the Bandit Setting: No Regret and Experimental Design. In 27th Intl. Conf. on Machine Learning (ICML), pages 1015–1022, 2010. [53] Matthew Streeter and Daniel Golovin. An online algorithm for maximizing submodular functions. In Advances in Neural Information Processing Systems (NIPS), pages 1577–1584, 2008. [54] William R. Thompson. On the likelihood that one unknown probability exceeds another in view of the evidence of two samples. Biometrika, 25(3-4):285294, 1933. [55] Hal R. Varian. Position auctions. International Journal of Industrial Organization, 25(6):1163–1178, December 2007. [56] Chris Wilkens and Balasubramanian Sivan. Single-call mechanisms. In 13th ACM Conf. on Electronic Commerce (EC), 2012. Appendix A: Proof of Lemma 3.9 In this section we present the full proof of Lemma 3.9. Recall that the “only if” direction is a conse- quence of Observation 3.5. We focus on the “if” direction. For bid profile b, click realization ρ, agent l and round t, the tuple (b; ρ; l; t) is called an influence-tuple if round t is (b, ρ)-influential with influencing agent l. Suppose allocation A is weakly separated but not exploration-separated. Then there is a counterexample: an influence-tuple (b; ρ; l; t) such that round t is not bid-independent w.r.t. click realization ρ. We prove that such counterexample can occur only if bl ∈ Sl(b−l), for some finite set Sl(b−l) ⊂ R that depends only on b−l. Proposition A.1. Let A be as in Lemma 3.9. Assume A is weakly separated. Then for each agent l and each bid profile b−l there exists a finite set Sl(b−l) ⊂ R with the following property: for each counterexample (bl, b−l; ρ; l; t) it is the case that bl ∈ Sl(b−l). Once this proposition is proved, we obtain a contradiction with the non-degeneracy of A. Indeed, sup- pose (b; ρ; l; t) is a counterexample. Then (b; ρ; l; t) is an influence-tuple. Since A is non-degenerate, there exists a non-degenerate interval I such that for each x ∈ I it holds that (x, b−l; ρ; l; t) is an influence-tuple, and therefore a counterexample. Thus the set Sl(b−l) in Proposition A.1 cannot be finite, contradiction. In the rest of this section we prove Proposition A.1. Fix a counterexample (b; ρ; l; t); let t′ > t be the influenced round. In particular, A(b; ρ; t) = l (see 1 in Figure 1 on page 17; all boxed numbers will refer to this figure). Then by the assumption there exist bids b′ such that A(b′; ρ; t) = i′ 6= l. We claim that this implies that there exists a bid b+ i′ , b−i′; ρ; t) = i′ (see 2 ). This is proven in Lemma A.3 below, and in order to prove it we first present the following lemma, which essentially states that if the mechanism makes a choice between i and j of who to be show, then it can only depend on the ratio of their bids bidi/bidj, and not on the bids of other agents. i′ > bi′ such that A(b+ 31 Lemma A.2. Let A be an MAB (deterministic) allocation rule that is pointwise-monotone, scalefree, and satisfies IIA. Let there be two bid profiles α and β such that A(α; ρ; t) ∈ {i, j}, A(β; ρ; t) ∈ {i, j}, and αi/αj = βi/βj. Then it must be the case that A(α; ρ; t) = A(β; ρ; t). Proof. As A is scalefree we assume that αi = βi and αj = βj by scaling bids in β by a factor of αi/βi (or a factor of αj/βj), without changing the allocation. Assume for the sake of a contradiction that A(β; ρ; t) 6= A(α; ρ; t). Let us number the agents as follows. Agents i and j are numbered 1 and 2, respectively. The rest of the agents are arbitrarily numbered 3 to k. Consider the following sequence of bid vectors. α(1) = α(2) = α and α(m) = (βm, α(m − 1)−m) for m ∈ {3, . . . , k}. As α(1) = α and α(k) = β, A(α(1); ρ; t) = A(α; ρ; t) and A(α(k); ρ; t) = A(β; ρ; t). Since A(α(k); ρ; t) = A(β; ρ; t) 6= A(α; ρ; t) = A(α(1); ρ; t) there exists m ∈ {3, . . . , k} such that A(α(m − 1); ρ; t) = A(α; ρ; t) ∈ {i, j} while A(α(m); ρ; t) 6= A(α(m − 1); ρ; t). As m 6= i and m 6= j, IIA implies that A(α(m); ρ; t) = m and given that, IIA also implies that A(α(k); ρ; t) ∈ {m, m + 1, . . . k} (note that i, j are not in this set). But as A(α(k); ρ; t) = A(β; ρ; t) ∈ {i, j} this yields a contradiction. Lemma A.3. Let A be an MAB (deterministic) allocation rule that is pointwise-monotone, scalefree, and satisfies IIA. Let there be two bid profiles α and β such that A(α; ρ; t) = i and A(β; ρ; t) = j 6= i. Then there exists β+ In other words, if it is possible for i to get the impression in round t at all, then it is possible for her to i > βi such that A(β+ i , β−i; ρ; t) = i. get the impression starting from any bid profile and raising her bid high enough. βj βj αj ≥ βi . In the bid profile (α+ Proof. We first note that αi αj · βi contradiction to Lemma A.2, since A(α+ but A(α+ i , α−i; ρ; t) 6= A(β; ρ; t). < βi βj . If not, then αi αj . Consider a raised bid of i from αi to α+ i = i , α−i), i must get the impression (by pointwise monotonicity). This gives a = βi , βj i , α−i; ρ; t) = i ∈ {i, j}, A(β; ρ; t) = j ∈ {i, j}, and α+ i αj αj αj = β+ i βj A(β+ A(β+ i = βj · αi . Now, A(α; ρ; t) = i ∈ {i, j}, . We can apply Lemma A.2 to deduce that A(α; ρ; t) = Now, consider i increasing her bid in profile β to β+ i , β−i; ρ; t) ∈ {i, j} (from IIA), and αi i , β−i; ρ; t) and both are equal to i since the first allocation is equal to i. From the lemma above, it follows that agent i′ can increase her bid (in bid profile b) and get the im- pression in click realization ρ, round t. To quantify by how much agent i′ needs to raise her bid to get the impression, we introduce the notion of threshold Θi,j(ρ; t) in the next lemma. Lemma A.4. Let A be an MAB (deterministic) allocation rule that is pointwise monotone, scalefree and satisfies IIA. For click realization ρ, round t, two agents i and j 6= i, let bids b−i−j be such that there exist x0 and y satisfying A(x0, y, b−i−j; ρ; t) = j, and there exists x (possibly dependent on y) satisfying A(x, y, b−i−j; ρ; t) = i. Let us fix such a y and define22 Θb−i−j i,j (ρ, t) = 1 y inf x (cid:8)x(cid:12)(cid:12) A(x, y, b−i; ρ; t) = i(cid:9). (ρ, t) is well defined and satisfies Θ b′ −i−j i,j (ρ, t) = Θb−i−j i,j (ρ, t). We denote it Then for any bids b′ by Θi,j(ρ, t), as Θ −i−j, Θ b−i−j i,j b′ −i−j i,j (ρ, t) is independent of b−i−j. 22Note that if there are no values of bids of i (x0 and x) and j (equal to y) such that j can get an impression with small enough (ρ; t) at all. We will be careful bid (x0) of agent i and i can get an impression by raising her bid (to x), then we don’t define Θ not to use such undefined Θ’s. It is not hard to see that if bids are nonzero, then Θi,j(ρ; t) is defined if and only if Θj,i(ρ; t) is. Moreover 0 < Θi,j(ρ; t) < ∞, and Θj,i(ρ; t) = (Θi,j(ρ; t))−1. b−i−j i,j 32 −i−j; ρ; t) = j then existence of y′ is proved for b′ Proof. We first prove that if the conditions of the definition of Θb−i−j (ρ; t) are satisfied for b−i−j, then are also satisfied for any other b′ −i−j. Let us say they are satisfied for b−i−j, that is there exists x0, x and y, such that A(x0, y, b−i−j; ρ; t) = j and A(x, y, b−i; ρ; t) = i. We want to prove existence of x′ and y′ for b′ −i−j. If A(x0, y, b′ −i−j too, since y′ = y works. If not, −i−j; ρ; t) = j′ 6= j and A(x0, y, b−i−j; ρ; t) = j, and by Lemma A.3, there exists a y′ > y then A(x0, y, b′ such that A(x0, y′, b′ −i−j; ρ; t) = j. Once the existence of y′ is proved, we now prove the existence of x′. Let x′ = x · y′ y ≥ x. We have A(x, y, b−i−j; ρ; t) = i ∈ {i, j} and A(x′, y′, b′ −i−j; ρ; t) ∈ {i, j} by IIA (i can only transfer impression to her by changing her bid) and x′/y′ = x/y. From Lemma A.2, we get i = A(x, y, b−i−j; ρ; t) = A(x′, y′, b′ −i−j; ρ; t). Hence the existence of x′ is proved too. For the sake of contradiction, let us assume that θ := Θb−i−j (ρ; t) =: θ′. Let us scale −i−j) by a factor such that the factor times y′ is equal to y. We can hence assume that the bids in (x′, y′, b′ y′ = y. Let us pick a bid x′′ ∈ (θy, θ′y). We have A(x′′, y, b−i−j; ρ; t) = i (since x′′/y is past the threshold θ), A(x′′, y′ = y, b′ −i−j; ρ; t) = j (x′′/y′ is yet not past the threshold θ′), and x′′/y = x′′/y′. This is a contradiction to the Lemma A.2. Therefore, θ = θ′. (ρ; t) < Θ b′ −i−j i,j i,j i,j We conclude that if b+ i′ > bl · Θi′,l(ρ, t) then A(b+ i′ , b−i′; ρ; t) = i′ 6= l (see 2 again). Note that we are using Θi′,l(ρ; t) since this is well-defined. Define ρ′ = ρ ⊕ 1(l, t). Let us think about decreasing the bid of agent l from bl (it is positive, since all bids are assumed to be positive). When the bid of agent l is bl, she gets the impression in round t, but when her bid is small enough (in particular as low as bi′/Θi′,l(ρ; t)), then she must not get the impression in round t (see Lemma A.2). When the bid of l decreases, some other agent gets the impression in round t, let us call that agent i (note that this agent may not be the same as agent i′ above). See 3 . i > blΘi,l(ρ; t), agent i gets the impression in round t (see 3 again). Note that A(b+ Now, starting from bid profile b, let us increase the bid of agent i. When the bid of agent i is large enough (in particular as large as biΘi′,l(ρ; t)bl/bi′), then l can no longer get the impression in round t (see Lemma A.2). From IIA, the impression must get transferred to i. Therefore we can define Θi,l(ρ; t), and when b+ i , b−i; ρ; t) = A(b+ i , b−i; ρ′; t) = i (click information for l at round t cannot influence the impression decision at round t). Recall that t′ is the influenced round. Let A(b; ρ; t′) = j and let A(b; ρ′; t′) = j′ 6= j (see 4 ). As A is pointwise monotone and IIA, A(b+ i , b−i; ρ′; t′) ∈ {i, j′}. It must be the case that A(b+ i , b−i; ρ′; t′), as l does not get an impression at round t (and the algorithm does not see the difference between ρ and ρ′). As j′ 6= j we conclude that i , b−i; ρ; t′) ∈ {i, j} and A(b+ i , b−i; ρ; t′) = A(b+ A(b+ i , b−i; ρ; t′) = A(b+ i , b−i; ρ′; t′) = i. Next we note that i 6= j and i 6= j′. This is because if i = j (respectively i = j′), then round t would be (b; ρ)-influential (respectively (b; ρ′)-influential) with influenced agent i but it is not (b; ρ)-secured (respectively (b; ρ′)-secured) from i, in contradiction to the assumption. l , b−l; ρ; t) = A(b− We also note that l ∈ {j, j′} (see 5 ). Assume for the sake of contradiction that l 6= j and l 6= j′. For l < bi · Θl,i(ρ, t) it holds that A(b− b− l , b−l; ρ′; t) = i (since i was defined such that i l , b−l; ρ; t′) = A(b− gets the impression in round t when l decreases her bid) thus A(b− l , b−l; ρ′; t′) (as click information for l at round t is not observed). (Also, as a side note, observe that b− l < bl by pointwise- monotonicity since agent l was getting an impression in round t with bid bl and lost it when her bid is b− l .) Let A(b− 6= l, since otherwise, Al(x, b−l; ρ; t′) is not a monotone function of x: it is 0 when x = bl (since j gets an impression), and 1 when x = b− l < bl, a contradiction to pointwise-monotonicity. Now, note that the impression in ρ′ at time t′ transfers from j′ to l′, and impression in ρ at time t′ transfers from j to l′, none of which ({j, j′, l′}) are equal to l and j 6= j′. Let us write this in equations: l , b−l; ρ′; t′) = l′. Note that l′ l , b−l; ρ; t′) = A(b− A(bl, b−l; ρ; t′) = j A(b− l , b−l; ρ; t′) = l′ 33 A(bl, b−l; ρ′; t′) = j′ A(b− l , b−l; ρ′; t′) = l′. It must be the case that either j 6= l′ or j′ 6= l′ (since j 6= j′). If j 6= l′, then in ρ at time t′, reducing the bid of l transfers impression from j to l′ (both of them are different from l), thus violating IIA. Similarly, if j′ 6= l′, then in ρ′ at time t′, reducing the bid of l transfers impression from j′ to l′ (both of them are different from l), thus violating IIA. We thus have l ∈ {j, j′}. Let l = j′ (since otherwise, we can swap the roles of ρ and ρ′). To summarize what we have proved so far: there are 3 distinct agents i, j, l such that A(b; ρ; t) = A(b; ρ′; t) = A(b; ρ′; t′) = l A(b; ρ; t′) = j A(b+ i , b−i; ρ; t) = A(b+ and i , b−i; ρ; t′) = A(b+ i , b−i; ρ′; t) = A(b+ i , b−i; ρ′; t′) = i. (since A(b; ρ′; t′) = j′ = l), Observe also that Θi,l(ρ, t) = Θi,l(ρ′, t) as ρ and ρ′ only differ at a click at round t, and such a click cannot determine the allocation decision at round t. Also, max{Θi,j(ρ, t′) · bj, Θi,l(ρ′, t′) · bl} ≤ Θi,l(ρ, t) · bl as the allocation at round t′, which is different for ρ and ρ′ (at b), depends on l getting the impression at round t.23 Finally we prove that Θi,j(ρ, t′) · bj= Θi,l(ρ′, t′) · bl (see 8 ). Claim A.5. Θi,j(ρ, t′) · bj = Θi,l(ρ′, t′) · bl Proof. First of all, note that Θi,j(ρ; t′) and Θi,l(ρ′, t′) are well-defined. Let ¯bi = (Θi,j(ρ, t′)·bj +Θi,l(ρ′, t′)· bl)/2. Consider the following two cases. If Θi,j(ρ, t′) · bj < Θi,l(ρ′, t′) · bl then round t is (¯bi, b−i; ρ)-influential (as A(¯bi, b−i; ρ; t′) = i and A(¯bi, b−i; ρ′; t′) = l) with influencing agent l (A(¯bi, b−i; ρ; t) = A(¯bi, b−i; ρ′; t) = l since ¯bi < Θi,l(ρ, t)·bl) and influenced agent i. Additionally, t it is not (¯bi, b−i; ρ)-secured from i (as A(b+ i , b−i; ρ; t) = A(b+ i , b−i; ρ′; t) = i). A contradiction to first condition in the theorem. Similarly, if Θi,j(ρ, t′)·bj > Θi,l(ρ′, t′)·bl then round t is (¯bi, b−i; ρ)-influential (as now A(¯bi, b−i; ρ; t′) = j and A(¯bi, b−i; ρ′; t′) = i) with influencing agent l and influenced agent i. Additionally, t it is not (¯bi, b−i; ρ)-secured from i. Again, a contradiction to the first condition in the theorem. The lemma implies that bl ∈ Sl(b−l), where a finite set Sl(b−l) is defined by Sl(b−l) =(cid:26)bj : all agents i, j 6= l, all click realizations ρ, ρ′ and all t′ s.t. Θi,j(ρ, t′) Θi,l(ρ′, t′) Θi,j(ρ, t′) Θi,l(ρ′, t′) is well-defined(cid:27) . This completes the proof of Proposition A.1. 23In Figure 1 we defined b+ρ := Θi,j (ρ; t′)bj and b+ρ′ i := Θi,l(ρ′; t′)bl. These are the bids of agent i at which impression transfers to her in round t′ in ρ and ρ′ respectively. See 6 and 7 in the figure. i 34
1010.5717
1
1010
2010-10-27T15:38:24
PPZ For More Than Two Truth Values - An Algorithm for Constraint Satisfaction Problems
[ "cs.DS" ]
We analyze the so-called ppz algorithm for (d,k)-CSP problems for general values of d (number of values a variable can take) and k (number of literals per constraint). To analyze its success probability, we prove a correlation inequality for submodular functions.
cs.DS
cs
PPZ For More Than Two Truth Values -- An Algorithm for Constraint Satisfaction Problems Dominik Scheder Theoretical Computer Science, ETH Zurich CH-8092 Zurich, Switzerland [email protected] November 5, 2018 Abstract. We analyze the so-called ppz algorithm for (d, k)-CSP prob- lems for general values of d (number of values a variable can take) and k (number of literals per constraint). To analyze its success probability, we prove a correlation inequality for submodular functions. 1 Introduction Consider the following extremely simple randomized algorithm for k-SAT: Pick a variable uniformly at random and call it x. If the formula F contains the unit clause (x), set x to 1. If it contains (¯x), set it to 0. It if contains neither, set x uniformly at random (and if it contains both unit clauses, give up). This algorithm has been proposed and analyzed by Paturi, Pudl´ak, and Zane [4] and is called ppz. The idea behind analyzing its success probability can be illustrated nicely if we assume, for the moment, that F has a unique satisfying assignment α setting all variables to 1. Switching a variable it from 1 to 0 makes the formula unsatisfied. Therefore, there is a clause Cx = (x∨¯y1∨· · ·∨¯yk−1). With probability 1/k, the algorithm picks and sets y1, . . . , yk−1 before picking x. Supposed they yj have been set correctly (i.e., to 1), the clause Cx is now reduced to (x), and therefore x is also set correctly. Intuitively, this shows that on average, the algorithm has to guess (1 − 1/k)n variables correctly and can infer the correct values of the remaining n/k variables. This increases the success probability of the algorithm from 2−n (simple stupid guessing) to 2−n(1−1/k). In this paper we generalize the sketched algorithm to general constraint satis- faction problems, short CSPs. These are a generalization of boolean satisfiability to problems involving more than two truth values. A set of n variables x1, . . . , xn is given, each of which can take a value from [d] := {1, . . . , d}. Each assignment to the n variables can be represented as an element of [d]n. A literal is an ex- pression of the form (xi 6= c) for some c ∈ [d]. A CSP formula consists of a conjunction (AND) of constraints, where a constraint is a disjunction (OR) of literals. We speak of (d, k)-CSP formula if each constraint consists of at most 2 k literals. Finally, (d, k)-CSP is the problem of deciding whether a given (d, k)- CSP formula has a satisfying assignment. Note that (2, k)-CSP is the same as k-SAT. Also (d, k)-CSP is well-known to be NP-complete, unless d = 1, k = 1, or d = k = 2. We can manipulate a CSP formula F by permanently substituting a value c for a variable x. This means we remove all satisfied constraints, i.e., those containing a literal (x 6= c′) for some c′ 6= c, and from the remaining constraints remove the literal (x 6= c), if present. We denote the resulting formula by F [x7→c]. It is obvious how to generalize the algorithm to (d, k)-CSP problems. Again we process the variables in a random order. When picking x, we collect all unit constraints of the form (x 6= c) and call the value c forbidden. Values in [d] which are not forbidden are called allowed, and we set x to a value that we choose uniformly at random from all allowed values. How can one analyze the success probability? Let us demonstrate this for d = k = 3. Suppose F has exactly one satisfying assignment α = (1, . . . , 1). Since changing the value of a variable x from 1 to 2 or to 3 makes F unsatisfied, we find critical constraints (x 6= 2 ∨ y 6= 1 ∨ z 6= 1) (x 6= 3 ∨ u 6= 1 ∨ v 6= 1) If all variables y, z, u, v are picked before x, then there is only one allowed value for x left, namely 1, and with probability 1, the algorithm picks the correct values. If y, z come before x, but at least one of u or v come after x, then it is possible that the values 1 and 3 are allowed, and the algorithm picks the correct value with probability 1/2. In theory, we could list all possible cases and compute their probability. But here comes the difficulty: The probability of all variables y, z, u, v being picked before x depends on whether these variables are distinct! Maybe y = u, or z = v... For general d and k, we get d − 1 critical constraints C2 := (x 6= 2 ∨ y(2) 1 C3 := (x 6= 3 ∨ y(3) 1 6= 1 ∨ · · · ∨ y(2) 6= 1 ∨ · · · ∨ y(3) k−1 6= 1) k−1 6= 1) . . . Cd := (x 6= d ∨ y(d) 1 6= 1 ∨ · · · ∨ y(d) k−1 6= 1) . (1) We are interested in the distribution of the number of allowed values for x. However, the above constraints can intersect in complicated ways, since we have no guarantee that the variables y(c) j are distinct. Our main technical contribution is a sort of correlation lemma showing that in the worst case, the y(c) are indeed distinct, and therefore we can focus on that case, which we are able to analyze. j Previous Work Feder and Motwani [1] were the first to generalize the ppz-algorithm to CSP problems. In their paper, they consider (d, 2)-CSP problem, i.e., each variable can take on d values, and every constraint has at most two literals. In this case, the clauses C2, . . . , Cd cannot form complex patterns. Feder and Motwani 3 show that the worst case happens if (i) the variables y(2) are pairwise distinct and (ii) the CSP formula has a unique satisfying assignment. However, their proofs do not directly generalize to higher values of k. 1 , . . . , y(d) 1 Recently, Li, Li, Liu, and Xu [2] analyzed ppz for general CSP problems (i.e., d, k ≥ 3). Their analysis is overly pessimistic, though, since they distinguish only the following two cases, for each variable x: When ppz processes x, then either (i) all d values are allowed, or (ii) at least one value is forbidden. In case (ii), ppz chooses one value randomly from at most d − 1 values. Since case (ii) happens with some reasonable probability, this gives a better success probability than the trivial d−n. However, the authors ignore the case that two, three, or more values are forbidden and lump it together with case (ii). Therefore, their analysis does not capture the full power of ppz. Our Contribution Our contribution is to show that "everything works as expected", i.e., that in the worst case all variables y(c) in (1) are distinct and the formula has a unique satisfying assignment. For this case, we can compute (or at least, bound from below) the success probability of the algorithm. j Theorem 1.1. For d, k ≥ 1, define G(d, k) := d−1 Xj=0 log2(1 + j)(cid:18)d − 1 j (cid:19)Z 1 0 (1 − rk−1)j(rk−1)d−1−jdr . Then there is a randomized algorithm running in polynomial time which, given a (d, k)-CSP formula over n variables, returns a satisfying assignment with prob- ability at least 2−nG(d,k). The algorithm we analyze in this paper is not novel. It is a straightforward generalization of the ppz algorithm to CSP problems with more than two truth values. However, its analysis is significantly more difficult than for d = 2 (and also more difficult than for large d and k = 2, the case Feder and Motwani [1] investigated). Comparison We compare the success probability of Schoning's random walk algorithm with that of ppz. For ppz, we state the bound given by Li, Li, Liu, and Xu [2] and by this paper. All bounds are approximate and ignore polynomial factors. 1.334−n (d, k) Schoning [5] Li, Li, Liu, and Xu [2] this paper 1.588−n (2, 3) 2.077−n (3, 3) 3.672−n (5, 4) 4.33−n (6, 4) 1.588−n 2.62−n 4.73 5.73−n 3.75−n 4.5−n 2−n 4 For small values of d, in particular for the boolean case d = 2, Schoning's random walk algorithm is much faster than ppz, but ppz overtakes Schoning already for moderately large values of d and thus is, to our knowledge, the currently fastest algorithm for (d, k)-CSP. 2 The Algorithm The algorithm itself is simple. It processes the variables x1, . . . , xn according to some random permutation π. When the algorithm processes the variable x, it collects all unit constraints of the form (x 6= c) and calls c forbidden. A truth value c that is not forbidden is called allowed. If the formula is satisfiable when the algorithm processes x, there is obviously at least one allowed value. The algorithm chooses uniformly at random an allowed value c and sets x to c, reducing the formula. Then it proceeds to the next variable. For technical reasons, we think of the permutation π as part of the input to the algorithm, and sampling π uniformly at random from all n! permutations before calling the algorithm. The algorithm is described formally in Algorithm 1. To analyze x := xπ(i) S(x, π) := {c ∈ [d] (x 6= c) 6∈ F } if S(x, π) = ∅ then return failure Algorithm 1 ppz(F : a (d, k)-CSP formula over variables V := {x1, . . . , xn}, π: a permutation of V ) 1: α := the empty assignment 2: for i = 1, . . . , n do 3: 4: 5: 6: 7: 8: 9: 10: 11: end for 12: if α satisfies F then 13: 14: else 15: 16: end if end if b ←u.a.r. S(x, π) α := α ∪ [x 7→ b] F := F [x7→b] return α return failure the success probability of the algorithm, we can assume that F is satisfiable, i.e. the set sat(F ) of satisfying assignments is nonempty. This is because if F is unsatisfiable, the algorithm always correctly returns failure. For a fixed satisfying assignment, we will bound the probability Pr[ppz(F, π) returns α] , (2) 5 where the probability is over the choice of π and over the randomness used by ppz. The overall success probability is given by Pr[ppz(F, π) is successful] = Xα∈satV (F ) Pr[ppz(F, π) returns α] . (3) In the next section, we will bound (2) from below. The bound depends on the level of isolatedness of α: If α has many satisfying neighbors, its probability to be returned by ppz decreases. However, the existence of many satisfying assignments will in turn increase the sum in (3). In the end, it turns out that the worst case happens if F has a unique satisfying assignment. Observe that for the ppz- algorithm in the boolean case [4], the unique satisfiable case is also the worst case, whereas for the improved version ppsz [3], it is not, or at least not known to be. 3 Analyzing the Success Probability 3.1 Preliminaries In this section, fix a satisfying assignment α. For simplicity, assume that α = (1, . . . , 1), i.e. it sets every variable to 1. What is the probability that ppz returns α? For a permutation π and a variable x, let β be the partial truth assignment obtained by restricting α to the variables that come before x in π, and define S(x, π, α) := {c ∈ [d] (x 6= c) 6∈ F [β]} . In words, we process the variables according to π and set them according to α, but stop before processing x. We check which truth values are not forbidden for x by a unit constraint, and collect theses truth values in the set S(x, π, α). Let us give an example: Example. Let d = 3, k = 2, and α = (1, . . . , 1). We consider F = (x 6= 2 ∨ y 6= 1) ∧ (x 6= 3 ∧ z 6= 1) . For π = (x, y, z), no value is forbidden when processing x, thus S(x, π, α) = {1, 2, 3}. For π′ = (y, x, z), then we consider the partial assignment that sets y to 1, obtaining F [y7→1] = (x 6= 2) ∧ (x 6= 3 ∨ z 6= 1) , and S(x, π′, α) = {1, 3}. Last, for π′′ = (y, z, x), then we set y and z to 1, obtaining F [y7→1,z7→1] = (x 6= 2) ∧ (x 6= 3) , thus S(x, π′′, α) = {1}. (cid:3) Observe that S(x, π, α) is non-empty, since α(x) ∈ S(x, π, α), i.e. the value α assigns to x is always allowed. What has to happen in order for the algorithm 6 to return α? In every step of ppz, the value b selected in Line 8 for variable x must be α(x). Assume now that this was the case in each of the first i steps of the algorithm, i.e., the variables xπ(1), . . . , xπ(i) have been set to their respective values under α. Let x = xπ(i+1) be the variable processed in step i + 1. The set S(x, π, α) coincides with the set S(x, π) of the algorithm, and therefore x is set to α(x) with probability 1/S(x, π, α). Since this holds in every step of the algorithm, we conclude that for a fixed permutation π, Pr[ppz(F, π) returns α] = Yx∈V 1 S(x, π, α) . For π being chosen uniformly at random, we obtain Pr[ppz(F, π) returns α] = Eπ" n Yx∈V 1 S(x, π, α)# . The expectation of a product is an uncomfortable term if the factors are not independent. The usual trick in this context is to apply Jensen's inequality, hoping that we do not lose too much. Lemma 3.1 (Jensen's Inequality). Let X be a random variable and f : R → R a convex function. Then E[f (X)] ≥ f (E[X]), provided both expectations exist. We apply Jensen's inequality with the convex function being f : x 7→ 2−x and the random variable being X =Px∈V log2 S(x, π, α). With this notation, f (X) =Qn S(x,π,α) , the expectation of which we want to bound from below. x∈V 1 E"Yx∈V 1 S(x, π, α)# = Eh2− Px∈V log2 S(x,π,α)i ≥ 2E[− Px∈V log2 S(x,π,α)] = 2− Px∈V E[log2 S(x,π,α)] . (4) Proposition 3.2. Pr[ppz(F, π) returns α] ≥ 2− Px∈V E[log2 S(x,π,α)]. Example: The boolean case. In the boolean case, the set S(x, π, α) is either {1} or {0, 1}, and thus the logarithm is either 0 or 1. Therefore, the term E[log2 S(x, π, α)] is the probability that the value of x is not determined by a unit clause, and thus has to be guessed. So far the calculations are exactly as in the boolean ppz. This will not stay that way for long. In the boolean case, there are only two cases: Either the value of x is determined by a unit clause (in which we call x forced), or it is not. For d ≥ 3, there are more cases: The set of potential values for x can be the full range [d], it can be just the singleton {1}, but it can also be anything in between, and even if the algorithm cannot determine the value of x by looking at unit clauses, it will still be happy if at least, say, d/2 values are forbidden by unit clauses. 7 3.2 Analyzing E[log2 S(x, π, α)] In this section we prove an upper bound on E[log2 S(x, π, α)]. We assume without loss of generality that α = (1, . . . , 1). There are d truth assignments α1, . . . , αd agreeing with α on the variables V \ {x}: For a value c ∈ [d] we define αc := α[x 7→ c], i.e., we change the value it assignment to x to c, but keep all other variables fixed. Clearly, α1 = α. The number of assignments among α1, . . . , αd that satisfy F is called the looseness of α at x, denoted by ℓ(α, x) . Since α1 = α satisfies F , the looseness of α at x is at least 1, and since there are d possible values for x, the looseness is at most d. Thus 1 ≤ ℓ(α, x) ≤ d. If α is the unique satisfying assignment, then ℓ(α, x) = 1 for every x. Note that α being unique is sufficient, but not necessary: Suppose α = (1, . . . , 1) and α′ = (2, 2, 1, 1, . . . , 1) are the only two satisfying assignments. Then ℓ(α, x) = ℓ(α′, x) = 1 for every variable x. Why are we considering the looseness ℓ of α at x? Suppose without loss of generality that the assignments α1, . . . , αℓ satisfy F , whereas αℓ+1, . . . , αd do not. The set S(x, π, α) is a random object depending on π, but one thing is sure: for all c = 1, . . . , ℓ(α, x) : c ∈ S(x, π, α) . For ℓ(α, x) < c ≤ d, what is the probability that c ∈ S(x, π, α)? Since αc does not satisfy F , there must be a constraint in F that is satisfied by α but not by αc. Since α and αc disagree on x only, that constraint must be of the following form: (x 6= c ∨ y2 6= 1 ∨ y3 6= 1 ∨ · · · ∨ yk 6= 1) . (5) For some k − 1 variables y2, . . . , yk. We do not rule out constraints with fewer than k − 1 literals, but we capture this by not insisting on the yj in (5) being distinct. In any case, if the variables y2, . . . , yk come before x in the permutation π, then c 6∈ S(x, π, α): This is because after setting to 1 the variables that come before x, the constraint in (5) has been reduced to (x 6= c). Note that y2, . . . , yk coming before x is sufficient for c 6∈ S(x, π, α), but not necessary, since there could be multiple constraints of the form (5). With probability at least 1/k, all variables y2, . . . , yk come before x, and we conclude: Proposition 3.3. If αc does not satisfy F , then Pr[c ∈ S(x, c, α)] ≤ 1 − 1/k. This proposition is nice, but not yet useful on its own. We can use it to finish the analysis of the running time, however we will end up with a suboptimal estimate. 3.3 A suboptimal analysis of ppz The function t 7→ log2(t) is concave. We apply Jensen's inequality to conclude that E[log2 S(x, π, α)] ≤ log2 (E[S(x, π, α)]) = log2 n Xc=1 Pr[c ∈ S(x, π, α)]! (6) 8 We apply what we have learned above: For c = 1, . . . , ℓ(α, x), it always holds that c ∈ S(x, π, α), and for c = ℓ(α, x) + 1, . . . , d, we have computed that Pr[c ∈ S(x, π, α)] ≤ 1 − 1/k. Therefore E[log2 S(x, π, α)] ≤ log2(cid:18)ℓ(α, x) + (d − ℓ(α, x))(cid:18)1 − 1 k(cid:19)(cid:19) . The unique case. If α is the unique satisfying assignment, then ℓ(α, x) = 1 for every variable x in our CSP formula F , and the above term becomes log2(cid:18)1 + (d − 1)(k − 1) k (cid:19) = log2(cid:18) d(k − 1) + 1 k (cid:19) . We plug this into the bound of Proposition 3.2: Pr[ppz returns α] ≥ 2− Pn i=1 E[log2 S(xi,π,α)] ≥ 2−n log2( d(k−1)+1 k ) =(cid:18) d(k − 1) + 1 k (cid:19)−n . k (cid:17)n The success probability of Schoning's algorithm for (d, k)-CSP problems is(cid:16) d(k−1) and we see that even for the unique case, our analysis of ppz does not yield any- thing better than Schoning. Discouraged by this failure, we do not continue this suboptimal analysis for the non-unique case. , 3.4 Detour: Jensen's Inequality Here, There, and Everywhere The main culprit behind the poor performance of our analysis is Jensen's inequal- ity in (6). To improve our analysis, we refrain from applying Jensen's inequality there and instead try to analyze the term E[log2 S(x, π, α)] directly. However, recall that we have used Jensen's inequality before, in (4). Is it safe to apply it there? How can we tell when applying it makes sense and when it definitely does not? To discuss this issue, we restate the two applications of Jensen's inequality: Eh2− Px∈V log2 S(x,π,α)i ≥ 2E[− Px∈V log2 S(x,π,α)] E[log2 S(x, π, α)] ≤ log2 (E[S(x, π, α)]) (7) (8) Formally, Jensen's inequality states that for a random variable X and a convex function f , it holds that E[f (X)] ≥ f (E[X]) , (9) and by multiplying (9) by −1 one obtains a similar inequality for concave func- tions. As a rule of thumb, Jensen's inequality is pretty tight if X is very concen- trated around its expectation: In the most extreme case, X is a constant, and (9) holds with equality. On the other extreme, suppose X is a random variable tak- ing on values −m and m, each with probability 1/2, and let f : t 7→ t2, which is a convex function. The left-hand side of (9) evaluates to E[f (X)] = E[X 2] = m2, whereas the right-hand side evaluates to f (E[X]) = f (0) = 0, and Jensen's in- equality is very loose indeed. What random variables are we dealing with in (7) and (8)? These are 9 log2 S(x, π, α) and X := Xx∈V Y := S(x, π, α) , and the corresponding functions are f : t 7→ 2−t, which is convex, and g : t 7→ log2 t, which is concave. In both cases, the underlying probability space is the set of all permutations of V , endowed with the uniform distribution. We see that Y is not concentrated at all: Suppose x comes first in π: If our CSP formula F contains no unit constraints, then S(x, π, α) = d, i.e., no truth value is forbidden by a unit constraints. On the other hand, if x comes last in π, then S(x, π, α) = ℓ(α, x). Either case happens with probability 1/n, which is not very small. Thus, the random variable S(x, π, α) does not seem to be very concentrated. Contrary to Y , the random variable X can be very concentrated, in fact for certain CSP formulas it can be a constant: Suppose d = 2, i.e., the boolean case. Here X simply counts the number of non-forced variables. Consider the 2-CNF formula ∧n/2 i=1 (xi ∨ yi) ∧ (xi ∨ ¯yi) ∧ (¯xi ∨ yi) . (10) This formula has n variables, and α = (1, . . . , 1) is the unique satisfying assign- ment. Observe that if xi comes before yi in π, then S(xi, π, α) = {0, 1} and S(yi, π, α) = {1}. If yi comes before xi, then S(xi, π, α) = {1} and S(yi, π, α) = {0, 1}. Hence X ≡ n/2 is a constant. Readers who balk at the idea of supplying a 2-CNF formula as an example for an exponential-time algorithm may try to generalize (10) for values of k ≥ 3. 3.5 A Better Analysis After this interlude on Jensen's inequality, let us try to bound E[log2 S(x, π, α)] directly. In this context, x is some variable, α is a satisfying assignment, for sim- plicity α = (1, . . . , 1), and π is a permutation of the variables sampled uniformly at random. Again think of the d truth assignments α1, . . . , αd obtained by setting αc := α[x 7→ c] for c = 1, . . . , d. Among them, ℓ := ℓ(α, x) satisfy the formula F . We assume without loss of generality that those are α1, . . . , αℓ. Thus, for each ℓ < c ≤ d, there is a constraint Cc satisfied by α but not by αc. Let us write 10 down these constraints: Cℓ+1 := (x 6= ℓ + 1 ∨ y(ℓ+1) Cℓ+2 := (x 6= ℓ + 2 ∨ y(ℓ+2) 1 1 6= 1 ∨ · · · ∨ y(ℓ+1) k−1 6= 1 ∨ · · · ∨ y(ℓ+2) k−1 6= 1) 6= 1) . . . (11) Cd := (x 6= d ∨ y(d) 1 6= 1 ∨ · · · ∨ y(d) k−1 6= 1) We define binary random variables Y (c) follows: j for 1 ≤ j ≤ k − 1 and ℓ + 1 ≤ c ≤ d as Y (c) j :=(cid:26) 1 if y(c) j 0 otherwise . comes after x in the permutation π , 1 ∨ · · · ∨ Y (c) We define Y (c) := Y (c) variables Y (1), . . . , Y (ℓ) that are constant 1. Finally, we define Y := Pd Observe that Y (c) = 0 if and only if all variables yc the permutation, in which case c 6∈ S(x, π, α). Therefore, k−1. For convenience we also introduce random c=1 Y (c). k−1 come before x in 1, . . . , yc S(x, π, α) ≤ Y (12) The variables Y (1), . . . , Y (ℓ) are constant 1, whereas each of the Y (c+1), . . . , Y (d) is 0 with probability at least 1/k. Since 1 ≤ ℓ ≤ d, the random variable Y can take values from 1 to d. We want to bound E[log2 S(x, α, π)] ≤ E[log2(Y )] = E"log2 ℓ + d Xc=ℓ+1 Y (c)!# . (13) For this, we must bound the probability Pr[Y = j] for j = 1, . . . , d. This is difficult, since the Y (c) are not independent: For example, conditioning on x coming very early in π increases the expectation of each Y (c), and conditioning on x coming late decreases it. We use a standard trick, also used by Paturi, Pud´ak, Saks and Zane [3] to overcome these dependencies: Instead of viewing π as a permutation of V , we think of it as a function V → [0, 1] where for each x ∈ V , its value π(x) is chosen uniformly at random from [0, 1]. With probability 1, all values π(x) are distinct and therefore give rise to a permutation. The trick is that for x, y, and z being three distinct variables, the events "y comes before x" and "z comes before x" are independent when conditioning on π(x) = r: Pr[π(y) < π(x) π(x) = r] = r Pr[π(z) < π(x) π(x) = r] = r Pr[π(x) < π(x) and π(z) < π(x) π(x) = r] = r2 11 Compare this to the unconditional probabilities: Pr[π(y) < π(x)] = Pr[π(z) < π(x) π(x) = r] = Pr[π(x) < π(x) and π(z) < π(x) π(x) = r] = 1 2 1 2 1 3 j j j is 1 if and only if the boolean variable y(c) We want to compute E[Y (c) π(x) = r]. We know that E[Y (c) since Y (c) comes after x. Since we are dealing with constraints of size at most k, there are, for each ℓ + 1 ≤ c ≤ d, at most k − 1 distinct variables y(c) k−1, and the probability that all come before x, conditioned on π(x) = r, is at least rk−1. Therefore π(x) = r] = 1−r, 1 , . . . , y(c) E[Y (c)] ≤ 1 − rk−1 . Still, a variable y(c) j might occur in several constraints among Cℓ+1, . . . , Cd, and therefore the Y c are not independent. The main technical tool of our analysis is a lemma stating that the worst case is achieved exactly if they in fact are independent, i.e., if all variables y(c) for c = ℓ + 1, . . . , d and k = 1, . . . , k − 1 are distinct. Lemma 3.4 (Independence is Worst Case). Let r, k, ℓ and Y (c) be de- fined as above. Let Z (ℓ+1), . . . , Z (d) be independent binary random variables with E[Zi] = 1 − rk−1. Then j E"log2 ℓ + d Xc=ℓ+1 Y (c)! π(x) = r# ≤ E"log2 ℓ + d Xc=ℓ+1 Z (c)!# . Before we prove the lemma in the next section, we first finish the analysis of the algorithm. We apply a somewhat peculiar estimate: Let a ≥ 1 and b ≥ 0 be integers. Then log2(a + b) ≤ log2(a · (b + 1)) = log2(a) + log2(b + 1). Applying c=ℓ+1 Z (c) and combining it with the lemma and this with a := ℓ and b := Pd with (13), we obtain E[log2 S(x, α, π) π(x) = r] ≤ log2(ℓ) + E"log2 1 + d Xc=ℓ+1 Z (c)!# . (14) This estimate looks wasteful, but consider the case where F has a unique sat- isfying assignment α: There, ℓ(α, x) = 1 for every variable x, and (14) holds with equality. In addition to Z (ℓ+1), . . . , Z (d), we introduce ℓ − 1 new indepen- dent binary random variables Z (2), . . . , Z (ℓ), each with expectation 1 − rk−1, and define g(d, k, r) := E"log2 1 + Z (c)!# . d Xc=2 12 The only difference between the expectation in (14) and here is that here, we sum over c = 2, . . . , d, whereas in (14) we sum only overc = ℓ + 1, . . . , d. We get the following version of (14): E[log2 S(x, α, π) (cid:12)(cid:12) π(x) = r] ≤ log2(ℓ) + g(d, k, r) . We want to get rid of the condition π(x) = r. This is done by integrating (15) for r from 0 to 1. (15) E[log2 S(x, α, π)] ≤ log2(ℓ) +Z 1 0 g(d, k, r)dr =: log2(ℓ) + G(d, k) . (16) This G(d, k) is indeed the same G(d, k) as in Theorem 1.1, and below we will do a detailed calculation showing this. Lemma 3.5 (Lemma 1 in Feder, Motwani [1]). Let F be a satisfiable CSP formula over variable set V . Then Xα∈satV (F ) Yx∈V 1 ℓ(α, x) ≥ 1 . (17) This lemma is a quantitative version of the intuitive statement that if a set S ⊆ [d]n is small, then there must be rather isolated points in S. We now put everything together: Pr[ppsz(F, π) is successful] = Xα∈satV (F ) ≥ Xα∈satV (F ) Pr[ppsz(F, π) returns α] 2− Px∈V E[log2 S(x,α,π)] , where the inequality follows from (4). Together with (16), we see that 2− Px∈V Xα∈satV (F ) E[log2 S(x,α,π)] ≥ Xα∈satV (F ) 2− Px∈V (log2(ℓ(α,x))+G(d,k)) 2− Px∈V log2(ℓ(α,x)) = 2−nG(d,k) Xα∈satV (F ) = 2−nG(d,k) Xα∈satV (F ) Yx∈V ≥ 2−nG(d,k) , 1 ℓ(α, x) with expectation 1 − rk−1 each. For 0 ≤ j ≤ d − 1, it holds that where the last inequality follows from Lemma 3.5. To prove Theorem 1.1, we eval- 0 g(d, k, r)dr, where g(d, k, r) = uate the term G(d, k). Recall that G(d, k) = R 1 Ehlog2(cid:16)1 +Pd Pr" d Xc=2 c=2 Z (c)(cid:17)i, and Z (2), . . . , Z (d) are independent binary variables Z (c) = j# =(cid:18)d − 1 j (cid:19)(1 − rk−1)j(rk−1)(d − 1 − j) . (18) 13 By the definition of expectation, it holds that g(d, k, r) = d−1 Xj=0 log2(1 + j) Pr" d Xc=2 Z (c) = j# . Combining this with (18) and integrating over r from 0 to 1 yields the expressions Theorem 1.1. This finishes the proof. 4 A Correlation Inequality The goal of this section to prove Lemma 3.4. We will prove a more general statement. Definition 4.1. A function f : {0, 1}n → R is called monotonically increasing, or simply monotone, if for all x, y ∈ {0, 1}n it holds that x ≤ y ⇒ f (x) ≤ f (y) , (19) where x ≤ y is understood pointwise, i.e., xi ≤ yi for all 1 ≤ i ≤ n. For example, the functions ∧ and ∨, seen as functions from {0, 1}n to R, are monotone, whereas the parity function ⊕ is not. Definition 4.2. A function f : {0, 1}n → R is called submodular if for all x, y ∈ {0, 1}, it holds that f (x) + f (y) ≥ f (x ∧ y) + f (x ∨ z) , (20) where ∨ and ∧ are understood pointwise, i.e. (x1, . . . , xn) ∨ (y1, . . . , yn) = (x1 ∨ y1, . . . , xn ∨ yn). Example. The OR-function f : (x1, . . . , xn) 7→ x1 ∨ · · · ∨ xn is monotone and submodular: It is pretty clear that it is monotone, so let us try to show sub- modularity. There are two cases: First, suppose at least one of x and y is 0, say y = 0. Then the left-hand side of (20) evaluates to f (x), and the right-hand side to f (0) + f (x) = f (x). If neither x = 0 nor y = 0, then the left-hand side is 2, and the right-hand side is obviously at most 2. Example. The AND-function g : (x1, . . . , xn) 7→ x1 ∧ · · · ∧ xn is monotone, but not submodular. It is clearly monotone, so let us show that it is not submodu- lar. Consider n = 2. Set x = (0, 1) and y = (1, 0). Then f (x) + f (y) = 0, but f (x ∧ y) + f (x ∨ y) = f (0, 0) + f (1, 1) = 1. We define the notion of glued restrictions of functions. Let A, B be two ar- bitrary sets, and let f : An → B be a function. We define a new function f ′ by 14 f g f X1X2X3X4X5X6X7 Fig. 1. A 7-ary function f and a gluing restriction g. X1X2X3X4X5X6X7 "gluing together" two input coordinates of f . Formally, for 1 ≤ i ≤ j ≤ n, we define the function f ′ : (a1, . . . , an) 7→ f (a1, . . . , aj−1, ai, aj+1, . . . , an) . The function f ′ can be viewed as a restriction of f to inputs (a1, . . . , an) for which ai = aj. Thus, f ′ can be seen as a function An−1 → B. We prefer, however, to define it as a function An → B that simply ignores the jth coordinate of its input. We say f ′ is obtained from f by a gluing step. A function g : An → B is a glued restriction of f if it can be obtained from f by a sequence of gluing steps. See Figure 1 for an intuition. Consider a function f : {0, 1}n → R and think of feeding f with random input bits. Formally, let X1, . . . , Xn be n independent binary random variables, each with expectation p. We are interested in the term E[f (X1, . . . , Xn)]. In a sec- ond scenario, we introduce dependencies between the Xi by gluing some of them together: For example, instead of choosing X1, . . . , Xn independently, we use the same bit for X1, X2, and Xn, thus computing E[f (X1, X1, X3, X4, . . . , Xn−1, X1)] instead of E[f (X1, . . . , Xn)]. With the terminology introduced above, we want to compare E[f (X1, . . . , Xn)] to E[g(X1, . . . , Xn)], where g is a glued restriction of f . For general functions f , we cannot say anything about how E[f (X1, . . . , Xn)] compares to E[g(X1, . . . , Xn)]. However, if f is submodular, we can. To get an intuition, consider the boolean lattice {0, 1}n with 0 at the bottom and 1 at the top. In that lattice, x ∧ y is below x and y, and x ∨ y is above them. Thus, in some sense, the points x and y lie between x ∧ y and x ∨ y. See Figure 2 for an illustration. On the left-hand side of (20), we evaluate f at points that lie more to the middle of the lattice, whereas on the right-hand side we evaluate f at points that lie more to the bottom or top of it. The random vector (X1, . . . , Xn) tends to lie around the pnth level of the lattice, whereas (X1, X1, X3, X4, . . . , Xn−1, X1) is less concentrated and more often visits the 15 1 x ∨ y y x x ∧ y 0 Fig. 2. The boolean lattice with four points x, y, x ∧ y and x ∨ y. extremes of the lattice. In the light of (20), we expect that biasing points towards the extremes will decrease E[f ]. The following lemma formalizes this intuition. Lemma 4.3. Let f : {0, 1}n → R be a submodular function and g be a glued restriction of it. Let X1, . . . , Xn be independent binary random variables, each with expectation p. Then E[f (X1, . . . , Xn)] ≥ E[g(X1, . . . , Xn)]. Proof. It is easy to see that applying a gluing step to a submodular function results in a submodular function: After all, a gluing step simply means restricting the function to a subset of its domain. Therefore, it suffices to prove the lemma for a function g that has been obtained from f by a single gluing step. Without loss of generality, we can assume that Xn−1 and Xn have been glued together. We have to show that E[f (X1, . . . , Xn)] ≥ E[f (X1, . . . , Xn−1, Xn−1)] . It suffices to show this inequality for every fixed (n − 2)-tuple of values for (X1, . . . , Xn−2). Formally, for b1, . . . , bn−2 ∈ {0, 1}, let g : (x, y) 7→ f (b1, . . . , bn−2, x, y) . The function g is also submodular. Let X, Y be two independent binary ran- dom variables, each with expectation p. We have to show that E[g(X, Y )] ≥ E[g(X, X)]. This is not difficult: E[g(X, Y )] = (1 − p)2 · g(0, 0) + p(1 − p) · g(1, 0) + +(1 − p)p · g(0, 1) + p2 · g(1, 1) = (1 − p)2 · g(0, 0) + p(1 − p) · (g(1, 0) + g(0, 1)) + p2 · g(1, 1) ≥ (1 − p)2 · g(0, 0) + p(1 − p) · (g(0, 0) + g(1, 1)) + p2 · g(1, 1) = ((1 − p)2 + p(1 − p)) · g(0, 0) + (p(1 − p) + p2) · g(1, 1) = (1 − p) · g(0, 0) + p · g(1, 1) = E[g(X, X)] , 16 where the inequality comes from the submodularity of g. ⊓⊔ Lemma 4.4. Let I ⊆ R be an interval, and let f : {0, 1}n → I be monotone and submodular, and h : I → R be non-decreasing and concave. Then h ◦ f : {0, 1}n → R is also monotone and submodular. Proof. It is clear that h ◦ f , being the composition of two monotone functions, is again monotone. To show submodularity, consider x, y ∈ {0, 1}n. Without loss of generality, f (x) ≤ f (y). Using monotonicity, we see that f (x ∧ y) ≤ f (x) ≤ f (y) ≤ f (x ∨ y) . Claim. If s ≤ t are in I, and a ≥ b ≥ 0 are such that s − a ∈ I and t + b ∈ I, then h(s) + h(t) ≥ h(s − a) + h(t + b). See Figure 3 for an illustration. To prove the claim, compare the line from h s − a s t t + b Fig. 3. A monotone concave function f and two line segments. (s, h(s)) to (t, h(t)) to the line from (s − a, h(s − a)) to (t + b, h(t + b)). The midpoints of those lines have the coordinates (cid:18) s + t 2 , h(s) + h(t) 2 (cid:19) and (cid:18) s − a + t + b 2 , h(s − a) + h(t + b) 2 (cid:19) , respectively. Since a ≥ b, the first midpoint lies to the right of the second mid- point. Since both lines have positive slope (by monotonicity of h) and the first line lies above the second, we conclude that also the first midpoint lies above the second. Therefore (h(s − a) + h(t + b))/2 ≤ (h(s) + h(t))/2, as claimed. We apply the above claim with s = f (x), t = f (y), a = f (x) − f (x ∧ y) and b = f (x ∨ y) − f (y). Note that s, t, s − a, t + b ∈ I and a, b ≥ 0. To apply the claim we need that a ≥ b, i.e., f (x) − f (x ∧ y) ≥ f (x ∨ y) − f (y) , 17 which follows from submodularity. The claim implies that h(s) + h(t) ≥ h(s − a) + h(t + b), which with these particular values of s,t,a, and b yields h(f (x)) + ⊓⊔ h(f (y)) ≥ h(f (x ∧ y)) + h(f (x ∨ y)). Proof (Proof of Lemma 3.4). We define (d − ℓ)(k − 1) random variables Z (c) for 1 ≤ j ≤ k − 1 and ℓ < c ≤ d. These random variables are all independent and each has expectation 1 − r. We define the function f : {0, 1}(d−ℓ)(k−1) by j f (x(ℓ+1) 1 , . . . , x(d) k−1) = log2 ℓ + d Xc=ℓ+1 OR(x(c) 1 ∨ · · · ∨ x(c) k−1)! . (21) This function is clearly monotone. We claim that it is submodular: The OR- function is submodular, and it is easy to check that a sum of submodular func- tions is again submodular. Finally, the function t 7→ log2(ℓ + t) is concave. We apply Lemma 4.4 with the interval I = [0, ∞), the submodular function k−1), which has domain I, and the concave function t 7→ log2(ℓ + t). Thus f is submodular and monotone. To prove Lemma 3.4, we have to show that 1 ∨ · · · ∨ x(c) c=ℓ+1 OR(x(c) Pd E"log2 ℓ + d Xc=ℓ+1 Y (c)! π(x) = r# ≤ E"log2 ℓ + d Xc=ℓ+1 Z (c)!# , (22) where the Z (c) are independent binary random variables with expectation 1 − rk−1 and Y (c) := OR(Y (c) , . . . , Y (c) k−1), with 1 Y (c) j :=(cid:26) 1 if y(c) j 0 otherwise . comes after x in the permutation π , The left-hand side of (22) thus reads as E[f (Y (ℓ+1) 1 , . . . , Y (d) k−1 π(x) = r] for f as defined in (21). Since the Z (c) are independent binary random variables with expectation 1 − rk−1, their distribution is identical to the distribution of OR(Z (c) k−1), and the right-hand side of (22) is equal to 1 , . . . , Z (c) E[f (Z (ℓ+1) 1 , . . . , Z (d) k−1] . We have to show that E[f (Y (ℓ+1) 1 , . . . , Y (d) k−1 π(x) = r] ≤ E[f (Z (ℓ+1) 1 , . . . , Z (d) k−1] (23) Conditioned on π(x) = r, the distribution of each Y (c) are "glued together", since the underlying variables y(c) but some Y (c) formula need not be distinct. We can, however, assemble the Y (c) is identical to that of Z (c) , j of our CSP into groups j j j j 18 according to their underlying variables y(c) such that (i) random variables from the same group have the same underlying y(c) j and thus are identical, (ii) random variables from different groups are independent. Thus, f (Y (ℓ+1) k−1 is a glued restriction of f (Z (ℓ+1) k−1 or rather can be coupled with a glued restriction thereof, and thus by Lemma 4.3, the expectation of the former is at ⊓⊔ most the expectation of the latter. Therefore (23) holds. , . . . , Y (d) 1 j , . . . , Z (d) 1 References 1. T. Feder and R. Motwani. Worst-case time bounds for coloring and satisfiability problems. J. Algorithms, 45(2):192 -- 201, 2002. 2. L. Li, X. Li, T. Liu, and K. Xu. From k-SAT to k-CSP: Two generalized algorithms. CoRR, abs/0801.3147, 2008. 3. R. Paturi, P. Pudl´ak, M. E. Saks, and F. Zane. An improved exponential-time algorithm for k-SAT. J. ACM, 52(3):337 -- 364, 2005. 4. R. Paturi, P. Pudl´ak, and F. Zane. Satisfiability coding lemma. Chicago J. Theoret. Comput. Sci., pages Article 11, 19 pp. (electronic), 1999. 5. U. Schoning. A probabilistic algorithm for k-SAT and constraint satisfaction prob- lems. In FOCS '99: Proceedings of the 40th Annual Symposium on Foundations of Computer Science, page 410, Washington, DC, USA, 1999. IEEE Computer Society.
1806.04310
1
1806
2018-06-12T03:03:13
MISSION: Ultra Large-Scale Feature Selection using Count-Sketches
[ "cs.DS", "cs.LG", "stat.ML" ]
Feature selection is an important challenge in machine learning. It plays a crucial role in the explainability of machine-driven decisions that are rapidly permeating throughout modern society. Unfortunately, the explosion in the size and dimensionality of real-world datasets poses a severe challenge to standard feature selection algorithms. Today, it is not uncommon for datasets to have billions of dimensions. At such scale, even storing the feature vector is impossible, causing most existing feature selection methods to fail. Workarounds like feature hashing, a standard approach to large-scale machine learning, helps with the computational feasibility, but at the cost of losing the interpretability of features. In this paper, we present MISSION, a novel framework for ultra large-scale feature selection that performs stochastic gradient descent while maintaining an efficient representation of the features in memory using a Count-Sketch data structure. MISSION retains the simplicity of feature hashing without sacrificing the interpretability of the features while using only O(log^2(p)) working memory. We demonstrate that MISSION accurately and efficiently performs feature selection on real-world, large-scale datasets with billions of dimensions.
cs.DS
cs
MISSION: Ultra Large-Scale Feature Selection using Count-Sketches Amirali Aghazadeh * 1 Ryan Spring * 2 Daniel LeJeune 3 Gautam Dasarathy 3 Anshumali Shrivastava 2 Richard G. Baraniuk 3 8 1 0 2 n u J 2 1 ] S D . s c [ 1 v 0 1 3 4 0 . 6 0 8 1 : v i X r a Abstract Feature selection is an important challenge in ma- chine learning. It plays a crucial role in the ex- plainability of machine-driven decisions that are rapidly permeating throughout modern society. Unfortunately, the explosion in the size and di- mensionality of real-world datasets poses a se- vere challenge to standard feature selection algo- rithms. Today, it is not uncommon for datasets to have billions of dimensions. At such scale, even storing the feature vector is impossible, causing most existing feature selection methods to fail. Workarounds like feature hashing, a standard ap- proach to large-scale machine learning, helps with the computational feasibility, but at the cost of los- ing the interpretability of features. In this paper, we present MISSION, a novel framework for ultra large-scale feature selection that performs stochas- tic gradient descent while maintaining an efficient representation of the features in memory using a Count-Sketch data structure. MISSION retains the simplicity of feature hashing without sacrificing the interpretability of the features while using only O(log2 p) working memory. We demonstrate that MISSION accurately and efficiently performs fea- ture selection on real-world, large-scale datasets with billions of dimensions. 1. Introduction Feature selection is an important step in extracting inter- pretable patterns from data. It has numerous applications in a wide range of areas, including natural-language process- ing, genomics, and chemistry. Suppose that there are n or- dered pairs (Xi, yi)i∈[n], where Xi ∈ Rp are p-dimensional *These authors contributed equally and are listed alphabeti- cally 1Department of Electrical Engineering, Stanford University, Stanford, California 2Department of Computer Science, Rice Uni- versity, Houston, Texas 3Department of Electrical and Computer Engineering, Rice University, Houston, Texas. Correspondence to: Anshumali Shrivastava <[email protected]>. feature vectors, and yi ∈ R are scalar outputs. Feature selec- tion aims to identify a small subset of features (coordinates of the p-dimensional feature vector) that best models the relationship between the data Xi and the output yi. A significant complication that is common in modern engi- neering and scientific applications is that the feature space p is ultra high-dimensional. For example, Weinberger intro- duced a dataset with 16 trillion (p = 1013) unique features (Weinberger et al., 2009). A 16 trillion dimensional fea- ture vector (of double 8 bytes) requires 128 terabytes of working memory. Problems from modern genetics are even more challenging. A particularly useful way to represent a long DNA sequence is by a feature vector that counts the occurrence frequency of all length-K sub-strings called K-mers. This representation plays an important role in large-scale regression problems in computational biology (Wood & Salzberg, 2014; Bray et al., 2015; Vervier et al., 2016; Aghazadeh et al., 2016). Typically, K is chosen to be larger than 12, and these strings are composed of all possible combinations of 16 characters ({A, T, C, G} in ad- dition to 12 wild card characters). In this case, the feature vector dimension is p = 1612 = 248. A vector of size 248 single-precision variables requires approximately 1 petabyte of space! For ultra large-scale feature selection problems, it is impos- sible to run standard explicit regularization-based methods like (cid:96)1 regularization (Shalev-Shwartz & Tewari, 2011; Tan et al., 2014) or to select hyperparameters with a constrained amount of memory (Langford et al., 2009). This is not sur- prising, because these methods are not scalable in terms of memory and computational time (Duchi et al., 2008). Another important operational concern is that most datasets represent features in the form of strings or tokens. For exam- ple, with DNA or n-gram datasets, features are represented by strings of characters. Even in click-through data (McMa- han et al., 2013), features are indexed by textual tokens. Observe that mapping each of these strings to a vector com- ponent requires maintaining a dictionary whose size equals the length of the feature vector. As a result, one does not even have the capability to create a numerical exact vector representation of the features. Typically, when faced with such large machine learning MISSION: Feature Selection via Sketching is that tasks, the practitioner chooses to do feature hashing (Wein- berger et al., 2009). Consider a 3-gram string "abc". With feature hashing, one uses a lossy, random hash function h : strings → {0, 1, 2, . . . , R} to map "abc" to a feature number h(abc) in the range {0, 1, 2, . . . , R}. This is ex- tremely convenient because it enables one to avoid creating a large look-up dictionary. Furthermore, this serves as a dimensionality reduction technique, reducing the problem dimension to R. Unfortunately, this convenience comes at a cost. Given that useful dimensionality reduction is strictly surjective (i.e., R < p), we lose the identity of the original features. This is not a viable option if one cares about both feature selection and interpretability. One reason to remain hopeful in such high- dimensional problems, the data vectors Xi are extremely sparse (Wood & Salzberg, 2014). For instance, the DNA sequence of an organism contains only a small fraction (at most the length of the DNA sequence) of p = 1612 features. The situation is similar whether we are predicting click- through rates of users on a website or if we seek n-gram representations of text documents (Mikolov et al., 2013). In practice, ultra high-dimensional data is almost always ultra- sparse. Thus, loading a sparse data vector into memory is usually not a concern. The problem arises in the intermedi- ate stages of traditional methods, where dense iterates need to be tracked in the main memory. One popular approach is to use greedy thresholding methods (Maleki, 2009; Mikolov et al., 2013; Jain et al., 2014; 2017) combined with stochas- tic gradient descent (SGD) to prevent the feature vector β from becoming too dense and blowing up in memory. In these methods, the intermediate iterates are regularized at each step, and a full gradient update is never stored nor computed (since this is memory and computation intensive). However, it is well known that greedy thresholding can be myopic and can result in poor convergence. We clearly ob- serve this phenomenon in our evaluations. See Section 5 for details. In this paper we tackle the ultra large-scale feature selec- tion problem, i.e., feature selection with billions or more dimensions. We propose a novel feature selection algorithm called MISSION, a Memory-efficient, Iterative Sketching al- gorithm for Sparse feature selectION. MISSION, that takes on all the concerns outlined above. MISSION matches the accuracy performance of existing large-scale machine learn- ing frameworks like Vowpal Wabbit (VW) (Agarwal et al., 2014) on real-world datasets. However, in contrast to VW, MISSION can perform feature selection exceptionally well. Furthermore, MISSION significantly surpasses the perfor- mance of classical algorithms such as Iterative Hard Thresh- olding (IHT), which is currently the popular feature selec- tion alternative concerning the problem sizes we consider. Contributions: In this work, we show that the two-decade Figure 1. Schematic of the MISSION algorithm. MISSION itera- tively adds the stochastic gradient term gi ∈ Rp into a Count- Sketch and queries back the top-k heavy hitters from the Count- Sketch. The Count-Sketch requires O(log2p) memory to store a sketch of the O(p)-dimensional feature vector β. old Count-Sketch data structure (Charikar et al., 2002) from the streaming algorithms literature is ideally suited for ul- tra large-scale feature selection. The Count-Sketch data structure enables us to retain the convenience of feature hashing along with the identity of important features. More- over, Count-Sketch can accumulate gradients updates over several iterations because of linear aggregation. This aggre- gation eliminates the problem of myopia associated with existing greedy thresholding approaches. In particular, we force the parameters (or feature vector) to reside in a memory-efficient Count-Sketch data struc- ture (Charikar et al., 2002). SGD gradient updates are eas- ily applied to the Count-Sketch. Instead of moving in the gradient direction and then greedily projecting into a sub- space defined by the regularizer (e.g., in the case of LASSO- based methods), MISSION adds the gradient directly into the Count-Sketch data structure, where it aggregates with all the past updates. See Fig. 1 for the schematic. At any point of time in the iteration, this data structure stores a compressed, randomized, and noisy sketch of the sum of all the gradient updates, while preserving the information of the heavy- hitters-the coordinates that accumulate the highest amount of energy. In order to find an estimate of the feature vec- tor, MISSION queries the Count-Sketch. The Count-Sketch is used in conjunction with a top-k heap, which explicitly stores the features with the heaviest weights. Only the fea- tures in the top-k heap are considered active, and the rest are set to zero. However, a representation for every weight is stored, in compressed form, inside the Count-Sketch. We demonstrate that MISSION surpasses the sparse recov- ery performance of classical algorithms such as Iterative Hard Thresholding (IHT), which is the only other method we could run at our scale. In addition, experiments suggest that the memory requirements of MISSION scale well with the dimensionality p of the problem. MISSION matches the accuracy of existing large-scale machine learning frame- works like Vowpal Wabbit (VW) on real-world, large-scale datasets. Moreover, MISSION achieves comparable or even MISSION: Feature Selection via Sketching better accuracy while using significantly fewer features. 2. Review: Streaming Setting and the Count-Sketch Algorithm In the streaming setting, we are given a very high- dimensional vector β ∈ Rp that is too costly to store in memory. We see only a very long sequence of updates over time. The only information available at time t is of the form (i, ∆), which means that coordinate i is incre- mented (or decremented) by the amount ∆. We are given a limited amount of storage, on the order of O(log p), which means that we can never store the entire sequence of updates. Sketching algorithms aim to estimate the value of current item i, after any number of updates using only O(log p) memory. Accurate estimation of heavy coordinates is desir- able. Count-Sketch is a popular algorithm for estimation in the streaming setting. Count-Sketch keeps a matrix of counters (or bins) S of size d × w ∼ O(log p), where d and w are chosen based on the accuracy guarantees. The algorithm uses d random hash functions hj j ∈ {1, 2, ..., d} to map the vector's components to bins w. hj : {1, 2, ..., p} → {1, 2, ..., w} Every component i of the vector is hashed to d different bins. In particular, for any row j of sketch S, component i is hashed into bin S(j, hj(i)). In addition to hj, Count-Sketch uses d random sign functions to map the components of the vectors randomly to {+1, −1}. i.e., si : {1, 2, ..., D} → {+1,−1} A picture of this sketch data structure with three hash functions in shown inside Fig. 1. The Count-Sketch supports two operations: UPDATE(item i, increment ∆) and QUERY(item i). The UPDATE operation updates the sketch with any observed increment. More for- mally, for an increment ∆ to an item i, the sketch is updated by adding sj(i)∆ to the cell S(j, hj(i)) ∀j ∈ {1, 2, ..., d}. The QUERY operation returns an estimate for component i, the median of all the d different associated counters. It has been shown that, for any sequence of streaming up- dates (addition or subtraction) to the vector β, Count-Sketch provides an unbiased estimate of any component i, (cid:98)βi such that the following holds with high probability, βi − β2 ≤ (cid:98)βi ≤ βi + β2. (1) It can be shown that the Eq. (1) is sufficient to achieve near-optimal guarantees for sparse recovery with the given space budget. Furthermore, these guarantees also meet the best compressed sensing lower bounds in terms of the number of counters (or measurements) needed for sparse recovery (Indyk, 2013). 3. Problem Formulation Consider the feature selection problem in the ultra high- dimensional setting: We are given the dataset (Xi, yi) for i ∈ [n] = {1, 2, . . . , n}, where Xi ∈ Rp and yi ∈ R denote the ith measured and response variables. We are interested in finding the k-sparse (k non-zero entries) feature vector (or regressor) β ∈ Rp from the optimization problem (cid:107)y − Xβ(cid:107)2, min (cid:107)β(cid:107)0=k (2) where X = {X1, X2, . . . , Xn} and y = [y1, y1, . . . , yn] denote the data matrix and response vector and the (cid:96)0-norm (cid:107)β(cid:107)0 counts the number of non-zero entries in β. We are interested in solving the feature selection problem for ultra high-dimensional datasets where the number of features p is so large that a dense vector (or matrix) of size p cannot be stored explicitly in memory. 3.1. Hard Thresholding Algorithms Among the menagerie of feature selection algorithms, the class of hard thresholding algorithms have the smallest mem- ory footprint: Hard thresholding algorithms retain only the top-k values and indices of the entire feature vector us- ing O(klog(p)) memory (Jain et al., 2014; Blumensath & Davies, 2009). The iterative hard thresholding (IHT) algo- rithm generates the following iterates for the ith variable in an stochastic gradient descent (SGD) framework βt+1 ← Hk(βt − 2λ(cid:0)yi − Xiβt(cid:1)T Xi) (3) The sparsity of the feature vector βt, enforced by the hard thresholding operator Hk, alleviates the need to store a vector of size O(p) in the memory in order to keep track of the changes of the features over the iterates. Unfortunately, because it only retains the top-k elements of β, the hard thresholding procedure greedily discards the information of the non top-k coordinates from the previous iteration. In particular, it clips off coordinates that might add to the support set in later iterations. This drastically affects the performance of hard thresholding algorithms, especially in real-world scenarios where the design matrix X is not ran- dom, normalized, or well-conditioned. In this regime, the gradient terms corresponding to the true support typically arrive in lagging order and are prematurely clipped in early iterations by Hk. The effect of these lagging gradients is present even in the SGD framework, because the gradients are quite noisy, and only a small fraction of the energy of the true gradient is expressed in each iteration. It is not difficult to see that these small energy, high noise signals can easily cause the greedy hard thresholding operator to make sub-optimal or incorrect decisions. Ideally, we want to accumulate the gradients to get enough confidence in MISSION: Feature Selection via Sketching Algorithm 1 MISSION (cid:16) (cid:17) Initialize: β0 = 0, S (Count-Sketch), λ (Learning Rate) while not stopping criteria do 2 (yi − Xiβt) T Xi Find the gradient update gi = λ Add the gradient update to the sketch gi → S Get the top-k heavy-hitters from the sketch βt+1 ← S end while Return: The top-k heavy-hitters from the Count-Sketch signal and to average out any noise. However, accumulating gradients will make the gradient vector dense, blowing up the memory requirements. This aforementioned problem is in fact symptomatic of all other thresholding variants in- cluding the Iterative algorithm with inversion (ITI) (Maleki, 2009) and the Partial hard thresholding (PHT) algorithm (Jain et al., 2017). 4. The MISSION Algorithm We now describe the MISSION algorithm. First, we initialize the Count-Sketch S and the feature vector βt=0 with zeros entries. The Count-Sketch hashes a p-dimensional vector into O(log2p) buckets (Recall Fig. 1). We discuss this particular choice for the size of the Count-Sketch and the memory-accuracy trade offs of MISSION in Sections 5.3 and 6.1. At iteration t, MISSION selects a random row Xi from the data matrix X and computes the stochastic gradient update term using the learning rate λ. gi = 2λ (yi − Xiβt) T Xi the usual gradient update that minimizes the uncon- i.e. strained quadratic loss (cid:107)y − Xβ(cid:107)2 2. The data vector Xi and the corresponding stochastic gradient term are sparse. We then add the non-zero entries of the stochastic gradient term {gij : ∀j gij > 0} to the Count-Sketch S. Next, MIS- SION queries the top-k values of the sketch to form βt+1. We repeat the same procedure until convergence. MISSION returns the top-k values of the Count-Sketch as the final output of the algorithm. The MISSION algorithm is detailed in Alg. 1. MISSION easily extends to other loss functions such as the hinge loss and logistic loss. MISSION is Different from Greedy Thresholding: De- note the gradient vector update at any iteration t as ut. It is not difficult to see that starting with an all-zero vector β0, at any point of time t, the Count-Sketch state is equivalent to i=1 ut. In other words, the sketch aggregates the compressed aggregated vector. Thus, even if an individual SGD update is noisy and contains small signal energy, thresholding the Count-Sketch is based on the average update over time. This averaging produces a robust signal that cancels out the noise. We can therefore expect MISSION to be superior over thresholding. the sketch of the vector(cid:80)t In the supplementary materials, we present initial theoretical results on the convergence of MISSION. Our results show that, under certain assumptions, the full-gradient-descent version of MISSION converges geometrically to the true parameter β ∈ Rp up to some additive constants. The exploration of these assumptions and the extension to the SGD version of MISSION are exciting avenues for future work. Feature Selection with the Ease of Feature Hashing: As argued earlier, the features are usually represented with strings, and we do not have the capability to map each string to a unique index in a vector without spending O(p) memory. Feature hashing is convenient, because we can directly ac- cess every feature using hashes. We can use any lossy hash function for strings. MISSION only needs a few independent hash functions (3 in our Count-Sketch implementation) to access any component. The top-k estimation is done effi- ciently using a heap data structure of size k. Overall, we only access the data using efficient hash functions, which can be easily implemented in large-scale systems. 5. Simulations We designed a set of simulations to evaluate MISSION in a controlled setting. In contrast to the ultra large-scale, real-world experiments of Section 6, in the section the data matrices are drawn from a random Gaussian distribution and the ground truth features are known. 5.1. Phase Transition We first demonstrate the advantage of MISSION over greedy thresholding in feature selection. For this experiment, we modify MISSION slightly to find the root of the algorithmic advantage of MISSION: we replace the Count-Sketch with an "identity" sketch, or a sketch with a single hash func- tion, h(i) = i. In doing so, we eliminate the complexity that Count-Sketch adds to the algorithm, so that the main difference between MISSION and IHT is that MISSION ac- cumulates the gradients. To improve stability, we scale the non top-k elements of S by a factor γ ∈ (0, 1) that begins very near 1 and is gradually decreased until the algorithm converges. Note: it is also possible to do this scaling in the Count-Sketch version of MISSION efficiently by exploiting the linearity of the sketch. Fig. 2 illustrates the empirical phase transition curves for sparse recovery using MISSION and the hard thresholding algorithms. The phase transition curves show the points where the algorithm successfully recovers the features in > 50% of the random trails. MISSION shows a better phase transition curve compared to IHT by a considerable gap. MISSION: Feature Selection via Sketching Table 1. Comparison of MISSION against hard thresholding algorithms in subset selection under adversarial effects. We first report the percentage of instances in which the algorithms accurately find the solution (ACC) with no attenuation (α = 1) over 100 random trials. We then report the mean of the maximum level of attenuation α applied to the columns of design X before the algorithms fail to recover the support of β (over the trials that all algorithms can find the solution with α = 1). (n, k) (100, 2) (100, 3) (100, 4) (200, 5) (200, 6) (200, 7) ACCα=1 100% 100% 100% 100% 100% 100% MISSION α 2.68 ± 0.37 2.52 ± 0.36 2.53 ± 0.23 4.07 ± 0.36 4.17 ± 0.24 4.07 ± 0.11 ACCα=1 100% 92% 72% 99% 97% 83% α IHT 1.49 ± 0.33 1.36 ± 0.46 1.92 ± 0.91 2.34 ± 1.12 2.64 ± 1.14 1.64 ± 1.01 ACCα=1 91% 70% 37% 37% 23% 14% α ITI 1.33 ± 0.23 1.15 ± 0.20 1.03 ± 0.09 1.15 ± 0.22 1.11 ± 0.12 1.11 ± 0.12 ACCα=1 64% 42% 39% 83% 73% 75% PHT α 2.42 ± 0.87 2.05 ± 0.93 2.13 ± 1.07 2.75 ± 1.30 2.26 ± 1.33 3.39 ± 1.36 columns (coordinates) with smaller energy typically lag and are thresholded by IHT. To this end, we first construct a random Gaussian data matrix X ∈ R900×1000, pick a sparse vector β that is supported on an index set I, and then attenuate the energy of the columns of X supported by the indices in I by an attenuation fac- tor of α = {1, 1.25, 1.5, 1.75, 2, . . . , 5}. Note that α = 1 implies that no attenuation is applied to the matrix. In Ta- ble 1, we report the maximum attenuation level applied to a column of data matrix X before the algorithms fail to fully recover the support set I from y = βX. We observe that MISSION is consistently and up to three times more robust against adversarial attenuation of the columns of the data matrix in various design settings. The robustness of MISSION to the attenuation of the columns of X in sparse recovery task suggests that the Count-Sketch data structure enables gradient-based opti- mization methods such as IHT to store a footprint (or sketch) of all the gradients from the previous iterations and deliver them back when they become prominent. 5.3. Logarithmic Scaling of the Count-Sketch Memory in MISSION In this section we demonstrate that the memory require- ments of MISSION grows polylogarithmically in the dimen- sion of the problem p. We conduct a feature selection ex- periment with a data matrix X ∈ R100×p whose entries are drawn from i.i.d. random Gaussian distributions with zero mean and unit variance. We run MISSION and IHT to re- cover the feature vector β from the output vector y = Xβ, where the feature vector β is a k = 5-sparse vector with random support. We repeat the same experiment 1000 times with different realizations for the sparse feature vector β and report the results in Fig. 3. The left plot illustrates the feature selection accuracy of the algorithms as the dimen- sion of the problem p grows. The right plot illustrates the minimum memory requirements of the algorithms to recover the features with 100% accuracy. Figure 2. Empirical phase transition in recovering a binary feature vector β in p = 1000-dimensional space with a Gaussian data matrix X. We illustrate the empirical 50% probability of success curves averaged over T = 20 trials. MISSION outperforms the thresholding algorithms by a large margin. 5.2. Lagging Gradient: Superiority of Count-Sketches over Greedy Thresholding A major problem with the IHT algorithm, especially in large- scale SGD settings, is with thresholding the coordinates with small gradients in the earlier iterations. IHT misses these coordinates, since they become prominent only after the gradients accumulate with the progression of the algorithm. The problem is amplified with noisy gradient updates such as SGD, which is unavoidable for large datasets. This phenomenon occurs frequently in sparse recovery prob- lems. For example, when the coordinates that correspond to the columns of the data matrix with smaller energy lag in the iterations of gradient descent algorithm, IHT thresholds these lagging-gradient coordinates in first few iterations, and they never show up again in the support. In contrast, MISSION retains a footprint of the gradients of all the pre- vious iterations in the Count-Sketch. When the total sum of the gradient of a coordinate becomes prominent, the co- ordinate joins the support after querying the top-k heavy hitters from the Count-Sketch. We illustrate this phenom- ena in sparse recovery using synthetic experiments. We re- cover sparse vector β from its random linear measurements y = Xβ, where the energy of X is imbalanced across its columns. In this case, the gradients corresponding to the 0.00.20.40.60.81.0n/p0.00.20.40.60.81.0s/nMISSIONIHTITIPHT MISSION: Feature Selection via Sketching 6.1. Large-scale Feature Extraction Datasets: We used four datasets in the experiments: 1) KDD2012, 2) RCV1, 3) Webspam–Trigram, 4) DNA 2. The statistics of these datasets are summarized in Table 2. Table 2. Feature extraction dataset statistics. Dataset KDD 2012 RCV1 Webspam DNA (Tiny) Dim (p) 54,686,452 47,236 16,609,143 14,890,408 Train Size (n) Test Size 119,705,032 20,242 280,000 1,590,000 29,934,073 677,399 70,000 207,468 The DNA metagenomics dataset is a multi-class classifica- tion task where the model must classify 15 different bacteria species using DNA K-mers. We sub-sampled the first 15 species from the original dataset containing 193 species. We use all of the species in the DNA Metagenomics dataset for the large-scale experiments (See Section 6.2). Following standard procedures, each bacterial species is associated with a reference genome. Fragments are sampled from the reference genome until each nucleotide is covered c times on average. The fragments are then divided into K-mer sub-strings. We used fragments of length 200 and K-mers of length 12. Each model was trained and tested with mean coverage c = {0.1, 1} respectively. For more details, see (Vervier et al., 2016). The feature extraction task is to find the DNA K-mers that best represent each bacteria class. We implemented the following approaches to compare and contrast against our approach: For all methods, we used the logistic loss for binary classification and the cross-entropy loss for multi-class classification. MISSION: As described in Section 4. Iterative Hard Thresholding (IHT): An algorithm where, after each gradient update, a hard threshold is applied to the features. Only the top-k features are kept active, while the rest are set to zero. Since the features are strings or integers, we used a sorted heap to store and manipulate the top-k ele- ments. This was the only algorithm we could successfully run over the large datasets on our single machine. Batch IHT: A modification to IHT that uses mini-batches such that the gradient sparsity is the same as the number of elements in the count-sketch. We accumulate features and then sort and prune to find the top-k features. This accumulate, sort, prune process is repeated several times during training. Note: This setup requires significantly more memory than MISSION, because it explicitly stores the feature strings. The memory cost of maintaining a set of string features can be orders of magnitude more than the flat array used by MISSION. See Bloom Filters (Broder & Mitzenmacher, 2004) and related literature. This setup is not scalable to large-scale datasets. 2http://projects.cbio.mines-paristech.fr/ largescalemetagenomics/ Figure 3. Feature selection accuracy and memory requirements of MISSION and Hard Thresholding. The memory requirements of MISSION grows polylogarithmcially ∼ O(log2(p)) (dotted line illustrates quadratic fit) in p. With only a logarithmic factor more memory, MISSION has significant advantage over Hard Threshold- ing in terms of feature selection accuracy. The plots reveal an interesting phenomenon. The size of the Count-Sketch in MISSION scales only polylogarithmi- cally with the dimension of the problem. This is surprising since the aggregate gradient in a classical SGD framework becomes typically dense in early iterations and thus requires a memory of order O(p). MISSION, however, stores only the essential information of the features in the sketch using a poly-logarithmic sketch size. Note that IHT sacrifices accuracy to achieve a small memory footprint. At every iteration IHT eliminates all the information except for the top-k features. We observe that, using only a logarithmic factor more memory, MISSION has a significant advantage over IHT in recovering the ground truth features. 6. Experiments All experiments were performed on a single machine, 2x Intel Xeon E5-2660 v4 processors (28 cores / 56 threads) with 512 GB of memory. The code 1 for training and running our randomized-hashing approach is available online. We designed the experiments to answer these questions: 1. Does MISSION outperform IHT in terms of classifica- tion accuracy? In particular, how much does myopic thresholding affect IHT in practice? 2. How well does MISSION match the speed and accuracy of feature hashing (FH)? 3. How does changing the number of top-k features affect the accuracy and behaviour of the different methods? 4. What is the effect of changing the memory size of the Count-Sketch data structure on the classification accuracy of MISSION in read-world datasets? 5. Does MISSION scale well in comparison to the differ- ent methods on the ultra large-scale datasets (> 350 GB in size)? 1https://github.com/rdspring1/MISSION 23456log10(p)020406080100Average Accuracy23456log10(p)0100200300400500600MemeoryMISSIONHard Tresholding MISSION: Feature Selection via Sketching Feature Hashing (FH): A standard machine learning algo- rithm for dimensionality reduction that reduces the memory cost associated with large datasets. FH is not a feature se- lection algorithm and cannot identify important features. (Agarwal et al., 2014) Experimental Settings: The MISSION and IHT algorithms searched for the same number of top-k features. To ensure fair comparisons, the size of the Count-Sketch and the fea- ture vector allocated for the FH model were equal. The size of the MISSION and FH models were set to the near- est power of 2 greater than the number of features in the dataset. For all the experiments, the Count-Sketch data structure used 3 hash functions, and the model weights were divided equally among the hash arrays. For example, with the (Tiny) DNA metagenomics dataset, we allocated 24 bits or 16,777,216 weights for the FH model. Given 3 hash functions and 15 classes, roughly 372,827 elements were allocated for each class in the Count-Sketch. MISSION, IHT, FH Comparison: Fig. 4 shows that MIS- SION surpasses IHT in classification accuracy in all four datasets, regardless of the number of features. In addition, MISSION closely matches FH, which is significant because FH is allowed to model a much larger set of features than MISSION or IHT. MISSION is 2–4× slower than FH, which is expected given that MISSION has the extra overhead of using a heap to track the top-k features. MISSION's accuracy rapidly rises with respect to the num- ber of top-k features, while IHT's accuracy plateaus and then grows slowly to match MISSION. This observation corroborates our insight that the greedy nature of IHT hurts performance. When the number of top-k elements is small, the capacity of IHT is limited, so it picks the first set of features that provides good performance, ignoring the rest. On the other hand, MISSION decouples the memory from the top-k ranking, which is based on the aggregated gradi- ents in the compressed sketch. By the linear property of the count-sketch, this ensures that the heavier entries occur in the top-k features with high probability. Count-Sketch Memory Trade-Off: Fig. 5 shows how MISSION's accuracy degrades gracefully, as the size of the Count-Sketch decreases. In this experiment, MISSION only used the top 500K features for classifying the Tiny DNA metagenomics dataset. When the top-k to Count-Sketch ratio is 1, then 500K weights were allocated for each class and hash array in the Count-Sketch data structure. The Batch IHT baseline was given 8,388,608 memory elements per class, enabling it to accumulate a significant number of features before thresholding to find the top-k features. This experiment shows that MISSION immediately outperforms IHT and Batch IHT, once the top-k to Count-Sketch ratio is 1:1. Thus, MISSION provides a unique memory-accuracy knob at any given value of top-k. 6.2. Ultra Large-Scale Feature Selection Here we demonstrate that MISSION can extract features from three large-scale datasets: Criteo 1TB, Splice-Site, and DNA Metagenomics. Table 3. Ultra Large-Scale dataset statistics Dataset Criteo Splice-Site DNA Dim (p) Train Size (n) 1M 4,195,197,692 11.7M 50,000,000 17.3M 13,792,260 Test Size 178,274,637 4,627,840 354,285 Criteo 1TB: The Criteo 1TB 3 dataset represents 24 days of click-through logs-23 days (training) + 1 day (testing). The task for this dataset is click-through rate (CTR) prediction- How likely is a user to click an ad? The dataset contains over 4 billion (training) and 175 million (testing) examples (2.5 TB of disk space). The performance metric is Area Under the ROC Curve (AUC). The VW baseline 4 achieved 0.7570 AUC score. MISSION and IHT scored close to the VW baseline with 0.751 AUC using only the top 250K features. Table 4. Criteo 1TB. Top-K Features: 250K Metric MISSION AUC 0.751 IHT 0.752 VW 0.757 Splice-Site: The task for this dataset is to distinguish be- tween true and fake splice sites using the local context around the splice site in-question. The dataset is highly skewed (few positive, many negative values), and so the performance metric is average precision (AP). Average pre- cision is the precision score averaged over all recall scores ranging from 0 to 1. The dataset contains over 50 million (training) and 4.6 million (testing) examples (3.2 TB of disk space). All the methods were trained for a single epoch with a learning rate of 0.5. MISSION, Batch IHT, and SGD IHT tracked the top 16,384 features. FH, MISSION, and Batch IHT used 786,432 extra memory elements. MISSION significantly outperforms Batch IHT and SGD IHT by 2.3%. Also, unlike in Fig. 5, the extra memory did not help Batch IHT, since it performed the same as SGD IHT. MISSION (17.5 hours) is 15% slower than FH (15 hours) in wall-clock running time. Table 5. Splice-Site: Top-k features: 16,384. Memory elements: 786,432. MISSION outperforms Batch IHT and SGD IHT. Metric AP FH 0.522 MISSION Batch IHT SGD IHT 0.510 0.498 0.498 DNA Metagenomics: This experiment evaluates MIS- SION's performance on a medium-sized metagenomics dataset. The parameters from the Tiny (15 species) dataset in Section 6.1 are shared with this experiment, except the 3https://www.kaggle.com/c/criteo-display-ad-challenge 4https://github.com/rambler-digital-solutions/ criteo-1tb-benchmark MISSION: Feature Selection via Sketching Figure 4. Feature selection on the KDD-2012, RCV1, Webspam, and DNA Metagenomic (Tiny) datasets. FH is not a feature selection baseline. It is marked by a dashed black line, indicating that its performance is invariant to the number of top-k features. Figure 5. Count-Sketch Memory/Accuracy Trade-off using the DNA Metagenomics (Tiny) dataset. The x-axis is the ratio of Count-Sketch memory per class and hash-array to the # top-k features per class. Memory Elements for Batch IHT: 8,388,608. number of species is increased to 193. The size of a sample batch with mean coverage c = 1 increased from 7 GB (Tiny) to 68 GB (Medium). Each round (mean coverage c = 0.25) contains 3.45 million examples and about 16.93 million unique non-zero features (p). MISSION and IHT tracked the top 2.5 million features per class. The FH baseline used 231 weights, about 11.1 million weights per class, and we allocated the same amount of space for the Count-Sketch. Each model was trained on a dataset with coverage c = 5. Fig. 6 shows the evolution of classification accuracy over time for MISSION, IHT, and the FH baseline. After 5 epochs, MISSION closely matches the FH baseline. Note: MISSION converges faster than IHT such that MISSION is 1–4 rounds ahead of IHT, with the gap gradually increasing over time. On average, the running time of MISSION is 1–2× slower than IHT. However, this experiment demonstrates that since MISSION converges faster, it actually needs less time to reach a certain accuracy level. Therefore, MISSION is effec- tively faster and more accurate than IHT. 7. Implementation Details and Discussion Scalability and Parallelism: IHT finds the top-k features after each gradient update, which requires sorting the fea- tures based on their weights before thresholding. The speed of the sorting process is improved by using a heap data structure, but it is still costly per update. MISSION also uses Table 6. Ultra Large-Scale Feature Selection for the DNA Metage- nomics (Medium) Dataset (193 species), Mean Coverage c = 5. a heap to store its top-k elements, but it achieves the same accuracy as IHT with far fewer top-k elements because of the Count-Sketch. (Recall Section 4) Another suggested improvement for the top-k heap is to use lazy updates. Updating the weight of a feature does not change its position in the heap very often, but still requires an O(log n) operation. With lazy updates, the heap is up- dated only if it the change is significant. xt − x0 ≥ , i.e. the new weight at time t exceeds the original value by some threshold. This tweak significantly reduces the number of heap updates at the cost of slightly distorting the heap. 8. Conclusion and Future Work In this paper, we presented MISSION, a new framework for ultra large-scale feature selection that performs hard thresh- olding and SGD while maintaining an efficient, approximate representation for all features using a Count-Sketch data structure. MISSION retains the simplicity of feature hashing without sacrificing the interpretability of the features. Interaction features are important for scientific discovery with DNA Metagenomics (Basu et al., 2018). Tradition- ally, the polynomial kernel trick enabled machine learning algorithms to explore this feature space implicitly without the exponential increase in dimensionality. However, this exponential cost is unavoidable with feature extraction. Go- ing forward, we are interested in leveraging our MISSION framework to explore pairwise or higher interaction features. 0.650.680.700.730.750.780.8002000004000006000008000001000000AUC#FeaturesKDD 2012MISSIONIHTFH0.500.550.600.650.700.750.800.850.900.951.000200040006000800010000AUC#FeaturesRCV10.900.910.920.930.940.950.960.970.980.991.00010002000300040005000AUC#FeaturesWebspam -Trigram00.10.20.30.40.50.60.70.80.9101000000200000030000004000000Accuracy#FeaturesDNA -Tiny (15 Species) -14,890,408 Features0.550.600.650.700.750.800246810AccuracyTopK : CMS Ratio (%)DNA -Tiny (15 Species) -Top-K: 500KMissionIHTBatch IHT00.10.20.30.40.50.60.70.80.9105101520AccuracyEpochsDNA -Medium (193 Species) -Top-K: 2.5MMissionIHTFH MISSION: Feature Selection via Sketching Acknowledgements AAA, DL, GD, and RB were supported by the DOD Van- nevar Bush Faculty Fellowship grant N00014-18-1-2047, NSF grant CCF-1527501, ARO grant W911NF-15-1-0316, AFOSR grant FA9550-14-1-0088, ONR grant N00014-17-1- 2551, DARPA REVEAL grant HR0011-16-C-0028, and an ONR BRC grant for Randomized Numerical Linear Algebra. RS and AS were supported by NSF-1652131, AFOSR-YIP FA9550-18-1-0152, and ONR BRC grant for Randomized Numerical Linear Algebra. The authors would also like to thank NVIDIA and Amazon for gifting computing re- sources. References Agarwal, A., Chapelle, O., Dud´ık, M., and Langford, J. A reliable effective terascale linear learning system. Journal of Machine Learning Research, 15(1):1111–1133, 2014. Aghazadeh, A., Lin, A. Y., Sheikh, M. A., Chen, A. L., Atkins, L. M., Johnson, C. L., Petrosino, J. F., Drezek, R. A., and Baraniuk, R. G. Universal microbial diagnos- tics using random dna probes. Science advances, 2(9): e1600025, 2016. Basu, S., Kumbier, K., Brown, J. B., and Yu, B. Iterative random forests to discover predictive and stable high- order interactions. Proceedings of the National Academy of Sciences, 2018. ISSN 0027-8424. doi: 10.1073/pnas. 1711236115. URL http://www.pnas.org/content/early/2018/ 01/17/1711236115. Blumensath, T. and Davies, M. E. Iterative hard thresholding for compressed sensing. Applied and Computational Harmonic Analysis, 27(3):265–274, 2009. Bray, N., Pimentel, H., Melsted, P., and Pachter, L. Near-optimal RNA-Seq quantification. arXiv preprint arXiv:1505.02710, 2015. Broder, A. and Mitzenmacher, M. Network applications of bloom filters: A survey. Internet mathematics, 1(4): 485–509, 2004. Charikar, M., Chen, K., and Farach-Colton, M. Finding frequent items in data streams. In International Collo- quium on Automata, Languages, and Programming, pp. 693–703. Springer, 2002. Duchi, J., Shalev-Shwartz, S., Singer, Y., and Chandra, T. Efficient projections onto the (cid:96)1-ball for learning in high In Proceedings of the 25th International dimensions. Conference on Machine Learning, pp. 272–279. ACM, 2008. Indyk, P. Sketching via hashing: From heavy hitters to compressed sensing to sparse fourier transform. In Pro- ceedings of the 32nd ACM SIGMOD-SIGACT-SIGAI Sym- posium on Principles of Database Systems, pp. 87–90. ACM, 2013. Jain, P., Tewari, A., and Kar, P. On iterative hard thresh- olding methods for high-dimensional m-estimation. In Advances in Neural Information Processing Systems, pp. 685–693, 2014. Jain, P., Tewari, A., and Dhillon, I. S. Partial hard thresh- olding. IEEE Transactions on Information Theory, 63(5): 3029–3038, 2017. Langford, J., Li, L., and Zhang, T. Sparse online learning via truncated gradient. Journal of Machine Learning Research, 10(Mar):777–801, 2009. Maleki, A. Coherence analysis of iterative thresholding algorithms. In Communication, Control, and Computing, 2009. Allerton 2009. 47th Annual Allerton Conference on, pp. 236–243. IEEE, 2009. McMahan, H. B., Holt, G., Sculley, D., Young, M., Ebner, D., Grady, J., Nie, L., Phillips, T., Davydov, E., Golovin, D., et al. Ad click prediction: A view from the trenches. In Proceedings of the 19th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1222–1230. ACM, 2013. Mikolov, T., Chen, K., Corrado, G., and Dean, J. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013. Shalev-Shwartz, S. and Tewari, A. Stochastic methods for (cid:96)1-regularized loss minimization. Journal of Machine Learning Research, 12(6):1865–1892, 2011. Tan, M., Tsang, I. W., and Wang, L. Towards ultrahigh dimensional feature selection for big data. Journal of Machine Learning Research, 15(1):1371–1429, 2014. Vervier, K., Mah´e, P., Tournoud, M., Veyrieras, J.-B., and Vert, J.-P. Large-scale machine learning for metage- nomics sequence classification. Bioinformatics, 32(7): 1023–1032, 2016. Weinberger, K., Dasgupta, A., Langford, J., Smola, A., and Attenberg, J. Feature hashing for large scale multitask learning. In Proceedings of the 26th Annual International Conference on Machine Learning, pp. 1113–1120. ACM, 2009. Wood, D. E. and Salzberg, S. L. Kraken: Ultrafast metage- nomic sequence classification using exact alignments. Genome Biology, 15(3):1, 2014. MISSION: Feature Selection via Sketching with probability at least 1 − 3δ (cid:13)(cid:13)βt+1 − β ∗(cid:13)(cid:13)2 ≤ 2ρ(cid:13)(cid:13)βt − β ∗(cid:13)(cid:13)2 + 2 (cid:114) + 2ε1 + 3ε2, σ2 w(1 + µ)k log p n (6) provided that n > Ck log p, m > Ck log2 p, and that Assumption 1 holds. Notice that since ρ < 0.5, the above theorem guarantees geometric convergence. This implies that the overall error is of the order of the additive constants ε1 and ε2. Before we prove this theorem, we will collect some lemmas that will help us prove our result. Lemma 2. Suppose X ∈ Rn×p has i.i.d N (0, 1 n ) en- tries. Then for constants ρ, δ2 > 0, there exists a constant C2(δ) > 0 such that if n ≥ C2k log p such that for any pair of unit-norm k−sparse vectors β1, β2 ∈ Sp−1, the following holds with probability at least 1 − δ2. (cid:104)Xβ1, Xβ2(cid:105) − (cid:104)β1, β2(cid:105) ≤ ρ. (7) Proof. Note that E[(cid:104)Xβ1, Xβ2(cid:105)] = (cid:104)β1, β2(cid:105). For a fixed pair of β1, β2, the proof follows from a standard Chernoff bound argument after observing that (cid:104)Xβ1, Xβ2(cid:105) can be written as a sum of products of independent Gaussian ran- dom variables. The rest of the proof follows from a standard covering argument, which gives the requirement on n. Lemma 3. Suppose X has i.i.d entries drawn according to N (0, n−1), and w ∼ N (0, σ2 wIn) is drawn independently of X. Then, for any constant δ3 > 0, there are constants C3, µ > 0 such that for all unit norm k−sparse β ∈ Sp−1, the following holds with probability at least 1 − δ3: (cid:114) 9. Appenix In this appendix, we present some preliminary results on the convergence of MISSION. For the sake of exposition, we will consider the full-gradient descent version of MISSION, and we will prove that the iterates converge geometrically upto a small additive error. In order to establish this proof, we make an assumption (Assumption 1) about the hashing scheme; see Section 9.1 for more on this. We begin by establishing some notation. We will assume that the data satisfies the following linear model: ∗ + w, y = Xβ (4) where y ∈ Rn is the vector of observation, X ∈ Rn×p is the data matrix, w ∈ Rn is the noise vector, and β∗ ∈ Rp is the unknown k−sparse regression vector. We will let ψ and ϕ respectively denote the hashing and the (top-k) heavy-hitters operation. We will let βt denote the output of MISSION in step t. In general, we will let the vector h ∈ Rm denote the hash table. Finally, as before, we will let Hk denote the projection operation onto the set of all k−sparse vectors. We will make the following assumption about the hashing mechanism: Assumption 1. For any h ∈ Rm, there exists an βh ∈ Rp such that the following hold 1. ψ(βh) = h, that is, the hash table contents can be set to h by hashing the vector βh. 2. (cid:107)βh − Hk(βh)(cid:107)2 ≤ ε1 This assumption requires the hashing algorithm to be such that there exists a nearly sparse vector that can reproduce any state of the hash table exactly. This is reasonable since the hash table is a near optimal "code" for sparse vectors in Rp. See Section 9.1 for more on this. We will next state a straightforward lemma about the sketch- ing procedure Lemma 1. There exist constants ε2, C1 > 0 such that provided that the size m of the hash table satisfies m ≥ C1k log2 p, the following holds for any β ∈ Rp with proba- bility at least 1 − δ1: (cid:107)ϕ(ψ(β)) − Hk(β)(cid:107)2 ≤ ε2 (5) This lemma follows directly from the definition of the Count- Sketch, and we will not prove here. We next state the main theorem that we will show. Theorem 1. For any δ ∈(cid:0)0, 1 (cid:1) and ρ ∈ (0, 0.5), there is a constant C > 0 such that the following statement holds 3 n σ2 (8) w(1 + µ)k log p (cid:104)β, X T w(cid:105) ≤ provided n ≥ C3k log p. Proof. Notice that for a fixed β, (cid:104)β, X T w(cid:105) = (cid:104)Xβ, w(cid:105) n (cid:107)w(cid:107)2 (cid:104)β, w2(cid:105), where w2 ∼ has the same distribution as 1√ N (0, In) is independent of w. Now, we can use concentra- tion inequalities of chi-squared random variables to show that there is a constant C(cid:48) 2 ≥ σ2 3 > 0 −C(cid:48) 3n. (9) w(1 + µ1)n P(cid:104)(cid:107)w(cid:107)2 P(cid:104)(cid:104)β, w2(cid:105)2 ≥ 1 + µ2 (cid:105) ≤ e (cid:105) ≤ e Similarly, from chi-squared concentration, there is a con- stant C(cid:48)(cid:48) 3 > 0 −C(cid:48)(cid:48) 3 (10) MISSION: Feature Selection via Sketching Now, with a standard covering argument, we know that there is a constant C(cid:48)(cid:48)(cid:48) 3 k log p, the following holds for at least 1 − δ3 for any k−sparse β: 3 > 0 such that provided n > C(cid:48)(cid:48)(cid:48) (cid:104)β, AT w(cid:105) = (cid:104)Aβ, w(cid:105) (cid:114) ≤ σ2 w(1 + µ)nk log p n . Proof of Theorem 1 If we let ht denote the contents of the hash table at round t, notice that we have the following: xt+1 = ϕ(ht+1). The (full gradient descent version of the) MISSION algorithm proceeds by updating the hash table with hashes of the gradient updates. Therefore, we have the following relationship: ht+1 = ht + ψ(cid:0)ηX T X(β ∗ − βt) + X T w(cid:1) , (11) where βt is the output of the algorithm at round t. Notice that βt = ϕ(ht). According to Assumption 1, we know that there exists a vector βt such that ψ( βt) = ht. We will use this observation next. Notice that the output of round t + 1 maybe written as follows: βt+1 = ϕ(cid:0)ht + ψ(cid:0)ηX T X(β (cid:16) βt + ηX T X(β (cid:16) = ϕ ∗ − βt) + X T w(cid:1)(cid:1) (cid:17)(cid:17) ∗ − βt) + X T w ψ . Now, we will estimate how close the output of the algorithm gets to β∗ in round t + 1 in terms of how close the algorithm got in round t. Notice that (cid:13)(cid:13)βt+1 − β (cid:13)(cid:13)(cid:13)ϕ (cid:16) ≤(cid:13)(cid:13)(cid:13)Hk ∗(cid:13)(cid:13)2 (cid:16) βt + ηX T X(β (cid:16) βt + ηX T X(β = ψ ∗ − βt) + X T w ∗ − βt) + X T w ∗(cid:13)(cid:13)(cid:13)2 (cid:17)(cid:17) − β ∗(cid:13)(cid:13)(cid:13)2 (cid:17) − β + ε2, (12) which follows from Lemma 1. We will next consider the first term from above. For notational ease, we will set γt+1 (cid:44) βt + ηX T X(β∗ − βt) + X T w. Observe that Hk is an orthogonal projection operator, and that β∗ is k−sparse, therefore we have that (cid:0)γt+1(cid:1) − γt+1(cid:13)(cid:13)2 2 ≤(cid:13)(cid:13)γt+1 − β ∗(cid:13)(cid:13)2 (13) Adding and subtracting β∗ on the left side and cancelling out the common terms, we have the following. 2 . (cid:13)(cid:13)Hk (cid:13)(cid:13)Hk(γt+1) − β ∗(cid:13)(cid:13)2 2 ≤ 2(cid:104)Hk(γt+1) − β = 2(cid:104)Hk(γt+1) − β = 2(cid:104)Hk(γt+1) − β ∗ ∗ ∗ ∗(cid:105) , γt+1 − β , βt + ηX T X(β , βt + ηX T X(β ∗ − βt) + X T w − β ∗ − βt) + X T w − β ∗(cid:105) ∗(cid:105) (a)≤ 2(cid:104)Hk(γt+1) − β ≤ 2(cid:104)Hk(γt+1) − β + 2(cid:104)Hk(γt+1) − β ∗ , βt − βt(cid:105) , βt + ηX T X(β , βt + ηX T X(β ∗ ∗ + 2 (cid:13)(cid:13)Hk(γt+1) − β ∗(cid:13)(cid:13)2 + 2(cid:13)(cid:13)Hk(γt+1) − β + 2(cid:13)(cid:13)Hk(γt+1) − β ∗ ∗ − βt) + X T w − β ∗ − βt) + X T w − β (cid:13)(cid:13)(cid:13)ϕ(ψ( βt)) − βt(cid:13)(cid:13)(cid:13)2 ∗(cid:13)(cid:13)2 (cid:16)(cid:13)(cid:13)(cid:13)Hk( βt) − βt(cid:13)(cid:13)(cid:13)2 (cid:13)(cid:13)(cid:13)2 (cid:13)(cid:13)(cid:13)Hk( βt) − ϕ(ψ( βt)) ∗(cid:13)(cid:13)2 (ε1 + ε2) , ∗ − βt) + X T w − β (14) (cid:17) + , βt + ηX T X(β ∗(cid:105) ∗(cid:105) ∗(cid:105) (b)≤ 2(cid:104)Hk(γt+1) − β , βt + ηX T X(β ∗ − βt) + X T w − β where (a) follows form the Cauchy-Schwarz inequality and from the definition of βt, (b) follows from Assumption 1 and Lemma 1. We will now turn our attention to the first inner-product in (14). With some rearrangement of terms, one can see that (cid:104)Hk(γt+1) − β ∗ = (cid:104)Hk(γt+1) − β ∗ X(βt − β ∗(cid:105) − η(cid:104)X(cid:0)Hk(γt+1) − β ∗(cid:13)(cid:13)2 (cid:13)(cid:13)βt − β ∗(cid:13)(cid:13)2 (a)≤ ρ(cid:13)(cid:13)Hk(γt+1) − β (cid:13)(cid:13)βt − β (cid:13)(cid:13)Hk(γt+1) − β ∗(cid:13)(cid:13)2 ∗(cid:13)(cid:13)2 (cid:114) +(cid:13)(cid:13)Hk(γt+1) − β ∗(cid:13)(cid:13)2 , βt − β )(cid:105) + η(cid:104)Hk(γt+1) − β ∗ + (cid:104)Hk(γt+1) − β w(1 + µ)k log p ∗(cid:1) , , X T w(cid:105) , X T w(cid:105) (b)≤ ρ ∗(cid:105) σ2 ∗ ∗ n (15) where (a) follows from Lemma 2 and setting η = 1. (b) follows from Lemma 3. Putting (14) and (15), we get (cid:0)γt+1(cid:1) − γt(cid:13)(cid:13)2 ≤ 2ρ(cid:13)(cid:13)βt − β ∗(cid:13)(cid:13)2 (cid:13)(cid:13)Hk (cid:114) + 2 σ2 w(1 + µ)k log p n + 2 (ε1 + ε2) . (16) Putting this together with (12) gives us the desired result. 9.1. On Assumption 1 In the full-gradient version of the MISSION algorithm, one might modify the algorithm explicitly to ensure that As- sumption 1. Towards this end, one would simply ensure that the gradients vector is attenuated on all but its top k entries at each step. MISSION: Feature Selection via Sketching It is not hard to see that this clean-up step will ensure that Assumption 1 holds and the rest of the proof simply goes through. In MISSION as presented in the manuscript, we employ stochastic gradient descent (SGD). While the above proof needs to be modified for it to be applicable to this case, our simulations suggest that this clean-up step is un- necessary here. We suspect that this is due to random can- cellations that are introduced by the SGD. This is indeed an exciting avenue for future work.
1609.07650
3
1609
2016-12-18T13:05:20
Popularity in the generalized Hospital Residents Setting
[ "cs.DS" ]
We consider the problem of computing popular matchings in a bipartite graph G = (R U H, E) where R and H denote a set of residents and a set of hospitals respectively. Each hospital h has a positive capacity denoting the number of residents that can be matched to h. The residents and the hospitals specify strict preferences over each other. This is the well-studied Hospital Residents (HR) problem which is a generalization of the Stable Marriage (SM) problem. The goal is to assign residents to hospitals optimally while respecting the capacities of the hospitals. Stability is a well-accepted notion of optimality in such problems. However, motivated by the need for larger cardinality matchings, alternative notions of optimality like popularity have been investigated in the SM setting. In this paper, we consider a generalized HR setting -- namely the Laminar Classified Stable Matchings (LCSM+) problem. Here, additionally, hospitals can specify classifications over residents in their preference lists and classes have upper quotas. We show the following new results: We define a notion of popularity and give a structural characterization of popular matchings for the LCSM+ problem. Assume n = |R| + |H| and m = |E|. We give an O(mn) time algorithm for computing a maximum cardinality popular matching in an LCSM+ instance. We give an O(mn^2) time algorithm for computing a matching that is popular amongst the maximum cardinality matchings in an LCSM+ instance.
cs.DS
cs
Popularity in the generalized Hospital Residents setting Meghana Nasre and Amit Rawat Indian Institute of Technology Madras, India Abstract. We consider the problem of computing popular matchings in a bipartite graph G = (R ∪ H, E) where R and H denote a set of residents and a set of hospitals respectively. Each hospital h has a positive capacity denoting the number of residents that can be matched to h. The residents and the hospitals specify strict preferences over each other. This is the well-studied Hospital Residents (HR) problem which is a generalization of the Stable Marriage (SM) problem. The goal is to assign residents to hospitals optimally while respecting the capacities of the hospitals. Stability is a well-accepted notion of optimality in such problems. However, motivated by the need for larger cardinality matchings, alternative notions of optimality like popularity have been investigated in the SM setting. In this paper, we consider a generalized HR setting -- namely the Laminar Classified Stable Matchings (LCSM+) problem. Here, additionally, hospitals can specify classifications over residents in their preference lists and classes have upper quotas. We show the following new results: We define a notion of popularity and give a structural characterization of popular matchings for the LCSM+ problem. Assume n = R+H and m = E. We give an O(mn) time algorithm for computing a maximum cardinality popular matching in an LCSM+ instance. We give an O(mn2) time algorithm for computing a matching that is popular amongst the maximum cardinality matchings in an LCSM+ instance. 1 Introduction Consider an academic institution where students credit an elective course from a set of available courses. Every student and every course rank a subset of elements from the other set in a strict order of preference. Each course has a quota denoting the maximum number of students it can accommodate. The goal is to allocate to every student at most one course respecting the preferences. This is the well-studied Hospital Residents problem [7]. We consider its generalization where, in addition, a course can classify students -- for example, the students may be classified as under-graduates and post-graduates and department-wise and so on. Depending on the classifications, a student may belong to multiple classes. Apart from the total quota, each course now has a quota for every class. An allocation, in this setting, has to additionally respect the class quotas. This is the Classified Stable Matching problem introduced by Huang [10]. Stability is a de-facto notion of optimality in settings where both set of participants have preferences. Informally, an allocation of students to courses is stable if no unallocated student-course pair has incentive to deviate from the allocation. Stability is appealing for several reasons -- stable allocations are guaranteed to exist, they are efficiently computable and all stable allocations leave the same set of students unallo- cated [9]. However, it is known [13] that the cardinality of a stable allocation can be half the size of the largest sized allocation possible. Furthermore, in applications like student-course allocation, leaving a large number of students unallocated is undesirable. Thus, it is interesting to consider notions of optimality which respect preferences but possibly compromise stability in the favor of cardinality. Kavitha and Huang [11,13] investigated this in the Stable Marriage (SM) setting where they considered popularity as an alternative to stability. At a high level, an allocation of students to courses is popular if no majority wishes to deviate from the allocation. Here, we consider popularity in the context of two-sided preferences and one-sided capacities with classifications. We formally define our problem now -- we use the familiar hospital residents notation. Let G = (R∪H, E) be a bipartite graph where R ∪ H = n and E = m. Here R denotes the set of residents, H denotes the set of hospitals and every hospital h ∈ H has an upper quota q(h) denoting the maximum number of residents h can occupy. A pair (r, h) ∈ E denotes that r and h are mutually acceptable to each other. Each resident (resp. hospital) has a strict ordering of a subset of the hospitals (resp. residents) that are acceptable to him or her (resp. it). This ordering is called the preference list of a vertex. An assignment (or a matching) M in G is a subset of E such that every resident is assigned to at most one hospital and a hospital h is assigned at most q(h) residents. Let M (r) (resp. M (h)) denote the hospital (resp. the set of residents) which are assigned to r (resp. h) in M . A hospital h is under-subscribed if M (h) < q(h). A matching M is stable if no unassigned pair (r, h) wishes to deviate from M . The goal is to compute a stable matching in G. We denote it by HR+ throughout the paper 1. The celebrated deferred acceptance algorithm by Gale and Shapley [7] proves that every instance of the HR+ problem admits a stable matching. k ) denoting the maximum number of residents that can be matched to h in C h A generalization of the HR+ problem is the Laminar Classified Stable Matching (LCSM) problem in- troduced by Huang [10]. An instance of the LCSM+ problem is an instance of the HR+ problem where additionally, each hospital h is allowed to specify a classification over the set of residents in its preference list. A class C h k of a hospital h is a subset of residents in its preference list and has an associated upper quota q(C h k . (In the LCSM problem [10], classes can have lower quotas as well.) We assume that the classes of a hospital form a laminar set. That is, for any two classes C h k = ∅), or one is con- tained inside the other (C h j ). Huang suitably modified the classical definition of stability to account for the presence of these classifications. He showed that every instance of the LCSM+ problem admits a stable matching which can be computed in O(mn) time [10]. A restriction of the LCSM+ problem, denoted by Partition Classified Stable Matching (PCSM+), is where the classes of every hospital partition the residents in its preference list. k , either the two classes are disjoint (C h j and C h j ⊂ C h k or C h k ⊂ C h j ∩ C h Motivated by the need to output larger cardinality matchings, we consider computing popular matchings in the LCSM+ problem. The notion of popularity uses votes to compare two matchings. Before we can define voting in the LCSM+ setting, it is useful to discuss voting in the context of the SM problem. Voting in the SM setting: Let G = (R ∪ H, E) be an instance of the SM problem and let M and M ′ be any two matchings in G. A vertex u ∈ R ∪ H (where each hospital h has q(h) = 1) prefers M over M ′ and therefore votes for M over M ′ if either (i) u is matched in M and unmatched in M ′ or (ii) u is matched in both M and M ′ and prefers M (u) over M ′(u). A matching M is more popular than M ′ if the number of votes that M gets as compared to M ′ is greater than the number of votes that M ′ gets as compared to M . A matching M is popular if there does not exist any matching that is more popular than M . In the SM setting it is known that a stable matching is popular, however it was shown to be minimum cardinality popular matching [11]. Huang and Kavitha [11,13] gave efficient algorithms for computing a max-cardinality popular matching and a popular matching amongst max-cardinality matchings in an SM instance. Voting in the capacitated setting: To extend voting in the capacitated setting, we assign a hospital h as many votes as its upper quota q(h). This models the scenario in which hospitals with larger capacity get a larger share of votes. For the HR+ problem, a hospital h compares the most preferred resident in M (h) \ M ′(h) to the most preferred resident in M ′(h) \ M (h) (and votes for M or M ′ as far as those two residents are concerned) and so on. For this voting scheme, we can obtain analogous results for computing popular matchings in the HR+ problem via the standard technique of cloning (that is, creating q(h) copies of a hospital h and appropriately modifying preference lists of the residents and hospitals 2). However, our interest is in the LCSM+ problem, for which we are not aware of any reduction to the SM problem. Furthermore, we show that the straightforward voting scheme as defined in the HR+ does not suffice for the LCSM+ problem. Therefore, we define a voting scheme for a hospital which takes into consideration the classifications as well as ensures that every stable matching in the LCSM+ instance is popular. We show the following results: -- We define a notion of popularity for the LCSM+ problem. Since our definition ensures that stable matchings are popular -- this guarantees the existence of popular matchings in the LCSM+ problem. -- We give a characterization of popular matchings for the LCSM+ problem, which is a natural extension of the characterization of popular matchings in SM setting [11]. 1 2 We use HR+ instead of HR for consistency with other problems discussed in the paper. For every hospital in the cloned graph, its preference list is the same as in the original instance. For every hospital h, fix an ordering of its clones. The preference list of a resident r in the cloned instance is obtained by replacing the occurrence of h by the fixed ordering of its clones. We refer the reader to [4,14] for details. 2 -- We obtain the following algorithmic results. An O(m + n) (resp. O(mn)) time algorithm for computing a maximum cardinality popular matching in a PCSM+ (resp. LCSM+) instance. An O(mn) (resp. O(mn2)) time algorithm for computing a popular matching amongst maximum cardinality matchings in a PCSM+ (resp. LCSM+) instance. Very recently, independent of our work, two different groups [4,12] have considered popular matchings in the one-to-many setting. Brandl and Kavitha [4] have considered computing popular matchings in the HR+ problem. In their work as well as ours, a hospital h is assigned as many votes as its capacity to compare two matchings M and M ′. In contrast, by the definition of popularity in [4], a hospital h chooses the most adversarial ordering of residents in M (h) \ M ′(h) and M ′(h) \ M (h) for comparing M and M ′. However, it is interesting to note that in an HR+ instance the same matching is output by both our algorithms. On the other hand, we remark that the model considered in our paper is a more general one than the one considered in [4]. Kamiyama [12] has generalized our work and the results in [4] using a matroid based approach. We finally remark that one can consider voting schemes where a hospital is given a single vote instead of capacity many votes. In one such scheme, a hospital compares the set of residents in M (h) and M ′(h) in lexicographic order and votes accordingly. However, when such a voting is used, it is possible to construct instances where a stable matching is not popular. The techniques in this paper use the fact that stable matchings are popular, therefore it is unclear if our techniques will apply for such voting schemes. Related Work: The notion of popularity was introduced by Gardenfors [8] in the context of stable match- ings. In [1] Abraham et al. studied popularity in the one-sided preference list model. As mentioned earlier, our work is inspired by a series of papers where popularity is considered as an alternative to stability in the stable marriage setting by Huang, Kavitha and Cseh [5,11,13]. Bir´o et al. [3] give several practical scenarios where stability may be compromised in the favor of size. The PCSM+ problem is a special case of the Stu- dent Project Allocation (SPA) problem studied by Abraham et al. [2]. They gave a linear time algorithm to compute a stable matching in an instance of the SPA problem. In this paper, we use the algorithms of Abraham et al. [2] and Huang [10] for computing stable matchings in the PCSM+ and LCSM+ problems. Both these algorithms follow the standard deferred acceptance algorithm of Gale and Shapley with problem specific modifications. We refer the reader to [2] and [10] for details. Organization: In Section 2 we define the notion of popularity, in Section 3 we present the structural charac- terization of popular matchings. In Section 4 we describe our algorithms to compute a maximum cardinality popular matching, and a popular matching amongst maximum cardinality matchings. We conclude with a short discussion about popular matchings in the LCSM problem. 2 Stability and popularity in the LCSM+ problem Consider an instance G = (R ∪ H, E) of the LCSM+ problem. As done in [10], assume that for every h ∈ H there is a class C h ∗ ) = q(h). For a hospital h, let T (h) denote the tree of classes corresponding to h where C h ∗ is the root of T (h). The leaf classes in T (h) denote the most refined classifications for a resident whereas as we move up in the tree from a leaf node to the root, the classifications gets coarser. ∗ containing all the residents in the preference list of h and q(C h To define stable matchings in the LCSM problem, Huang introduced the notion of a blocking group w.r.t. a matching. Later, Fleiner and Kamiyama [6] defined a blocking pair which is equivalent to a blocking group of Huang. We use the definition of stability from [6] which we recall below. A set S = {r1, . . . , rl} is feasible for a hospital h if S ≤ q(h) and for every class C h j ). A matching M in G is feasible if every resident is matched to at most one hospital, and M (h) is feasible for every hospital h ∈ H. A pair (r, h) /∈ M blocks M iff both the conditions below hold: j of h (including the root class C h ∗ ), we have C h j ∩ S ≤ q(C h -- r is unmatched in M , or r prefers h over M (r), and -- either the set M (h) ∪ {r} is feasible for h, or there exists a resident r′ ∈ M (h), such that h prefers r over r′, and (M (h) \ {r′}) ∪ {r} is feasible for h. A feasible matching M in G is stable if M does not admit any blocking pair. 3 2.1 Popularity To define popularity, we need to specify how a hospital compares two sets M (h) and M ′(h) in an LCSM+ setting, where M and M ′ are two feasible matchings in the instance. Illustrative example Consider the following LCSM+ instance where R = {r1, . . . , r4} and H = {h1, . . . , h3} and the preference lists of the residents and hospitals are as given in Figure 1(a) and (b) respectively. The preferences can be read as follows: resident r1 has h1 as his top choice hospital. Resident r2 has h2 as its top choice hospital followed by h1 which is his second choice hospital and so on. For h ∈ {h2, h3} we have q(h) = 1 and both these hospitals have a single class C h ∗ containing all the residents in the prefer- ence list of h and q(C h ∗ ) = q(h). For hospital h1 we have q(h1) = 2 and the classes provided by h1 are C h1 2 ) = 1 and ∗ ) = 2. We remark that the example in Figure 1 is also a PCSM+ instance. Figure 1(c) shows the tree q(C h1 T (h1). ∗ = {r1, r2, r3, r4} with quotas as follows: q(C h1 1 ) = q(C h1 1 = {r1, r2}, C h1 2 = {r3, r4}, C h1 r1 : h1 r2 : h2, h1, h3 r3 : h1, h2 r4 : h1 (a) h1 : r2, r3, r4, r1 h2 : r3, r2 h3 : r2 r1, r2, r3, r4 C h1 ∗ r1, r2 C h1 1 r3, r4 C h1 2 (b) (c) Fig. 1. (a) Resident preferences, (b) Hospital preferences, (c) T (h1). The matchings M = {(r1, h1), (r2, h2), (r3, h1)}, M ′ = {(r2, h1), (r3, h2), (r4, h1)}, and M ′′ = {(r1, h1), (r2, h3), (r3, h2), (r4, h1)} are all feasible in the instance. Consider the two feasible matchings M and M ′ defined in Fig. 1. Note that M is stable in the instance whereas the edge (r3, h1) blocks M ′. While comparing M and M ′, the vote for every vertex u in the instance except h1 is clear -- u compares M (u) with M ′(u) and votes accordingly. In order for h1 to vote between M and M ′, the hospital compares between M (h1) = {r1, r3} and M ′(h1) = {r2, r4}. A straightforward way is to compare r3 with r2 (the most preferred resident in M (h1) to the most preferred resident in M ′(h1)) and then compare r1 with r4 (second most preferred resident in M (h1) to second most preferred resident in M ′(h1)). Thus, both the votes of h1 are in favor of M ′ when compared with M . Such a comparison has two issues -- (i) it ignores the classifications given by h1, and (ii) the number of votes that M ′ gets when compared with M is more than the number of votes that M gets as compared to M ′. Therefore M ′ is more popular than M which implies that M (a stable matching) is not popular. We propose a comparison scheme for hospitals which addresses both the issues. In the above example, we note that r1 ∈ M (h) has a corresponding resident r2 ∈ M ′(h) to be compared to in one of the most refined classes C h1 (see Figure 1(c)). Thus, we compare r1 with r2. The resident r3 ∈ M (h) is compared to 1 r4 ∈ M (h) another leaf class C h1 2 . According to this comparison, h1 is indifferent between M and M ′ and M ′ is no longer more popular than M . Note that, although in the example, both the comparisons happen in a leaf class, this may not be the case in a general instance. Finally, we note that the matching M ′′ is a popular matching in the instance and is strictly larger in size than the stable matching M . We formalize the above observations in the rest of the section. To take into account the classifications, for a hospital h and the matchings M and M ′, we set up a correspondence between residents in M (h) \ M ′(h) and the residents in M ′(h) \ M (h). That is, we define: corr : M (h) ⊕ M ′(h) → M (h) ⊕ M ′(h) ∪ {⊥} For a resident r ∈ M (h) ⊕ M ′(h) we denote by corr(r) the corresponding resident to which r gets compared when the hospital h casts its votes. We let corr(r) = ⊥ if r does not have a corresponding resident to be compared to from the other matching. The pseudo-code for the algorithm to compute the corr function is given below. 4 Algorithm 1 Correspondence between residents of M (h) and M ′(h) 1: procedure Find-Correspondence(h, M, M ′) 2: 3: 4: 5: 6: 7: 8: let T (h) be the classification tree associated with h set corr(r) = ⊥ for each r ∈ M (h) ⊕ M ′(h) Y = M (h) \ M ′(h); Y ′ = M ′(h) \ M (h) while Y 6= ∅ and Y ′ 6= ∅ do Xj = C h j = C h X ′ Let C h f be one of the most refined classes for which Xf 6= ∅ and X ′ for k = 1, . . . , min(Xf , X ′ for each class C h j ∩ Y j ∩ Y ′ j in T (h) do f ) do f 6= ∅. let r be the k-th most preferred resident in Xf let r′ be the k-th most preferred resident in X ′ f set corr(r) = r′, and corr(r′) = r Y = Y \ {r}; Y ′ = Y ′ \ {r′} 9: 10: 11: 12: 13: 14: The algorithm begins by setting corr for every r ∈ M (h) ⊕ M ′(h) to ⊥. The algorithm maintains two sets of residents Y = M (h) \ M ′(h) and Y ′ = M ′(h) \ M (h) for whom corr needs to be set. As long as the sets Y and Y ′ are both non-empty, the algorithm repeatedly computes for every class C h j (including j ∩ Y ′. The algorithm then chooses one of the most the root class C h f are both non-empty. Finally, residents in Xf and X ′ refined classes, say C h f are sorted according to the preference ordering of h and the corr of the k-th most preferred resident in Xf is set to the k-th most preferred resident in X ′ f in T (h), for whom Xf and X ′ ∗ ) the sets Xj = C h f , where k = 1, . . . , min{Xf , X ′ j ∩ Y and X ′ j = C h f }. For r ∈ R, and any feasible matching M in G, if r is unmatched in M then, M (r) = ⊥. A vertex prefers any of its neighbours over ⊥. For a vertex u ∈ R ∪ H, let x, y ∈ N (u) ∪ {⊥}, where N (u) denotes the neighbours of u in G. voteu(x, y) = +1 = −1 = 0 if u prefers x over y if u prefers y over x if x = y Using the above notation, the vote of a resident is easy to define -- a resident r prefers M ′ over M iff the term Vr > 0, where Vr = voter(M ′(r), M (r)). Recall that a hospital h uses q(h) votes to compare M and M ′. Let q1(h) = M (h) ∩ M ′(h) (number of common residents assigned to h in M and M ′) and q2(h) = q(h) − max{M (h), M ′(h)} (number of unfilled positions of h in both M and M ′). Our voting scheme ensures that q1(h) + q2(h) votes of h remain unused when comparing M and M ′. A hospital h prefers M ′ over M iff the term Vh > 0, where Vh is defined as follows: Vh = (M ′(h) − M (h)) + X r∈M ′(h)\M(h) voteh(r, corr(r)) && corr(r)6=⊥ The first term in the definition of Vh counts the votes of h w.r.t. the residents from either M or M ′ that did not find correspondence. The second term counts the votes of h w.r.t. the residents each of which has a corresponding resident from the other matching. We note that in the SM setting, corr(r) will simply be M (h). Thus, our definition of votes in the presence of capacities is a natural generalization of the voting scheme in the SM problem. Let us define the term ∆(M ′, M ) as the difference between the votes that M ′ gets over M and the votes that M gets over M ′. ∆(M ′, M ) = X r∈R Vr + X h∈H Vh 5 Definition 1. A matching M is popular in G iff for every feasible matching M ′, we have ∆(M ′, M ) ≤ 0. 2.2 Decomposing M ⊕ M ′ Here, we present a simple algorithm which allows us to decompose edges of components of M ⊕ M ′ in an instance into alternating paths and cycles. Consider the graph G = (R ∪ H, M ⊕ M ′), for any two feasible matchings M and M ′ in G. We note that the degree of every resident in G is at most 2 and the degree of every hospital in G is at most 2 · q(h). Consider any connected component C of G and let e be any edge in C. We observe that it is possible to construct a unique maximal M alternating path or cycle ρ containing e using the following simple procedure. Initially ρ contains only the edge e. 1. Let r ∈ R be one of the end points of the path ρ, and assume that (r, M (r)) ∈ ρ. We grow ρ by adding the edge (r, M ′(r)). Similarly if an edge from M ′ is incident on r in ρ, we grow the path by adding the edge (r, M (r)) if it exists. 2. Let h ∈ H be one of the end points of the path ρ, and assume that (r, h) ∈ M \ M ′ belongs to ρ. We extend ρ by adding (corr(r), h) if corr(r) is not equal to ⊥. A similar step is performed if the last edge on ρ is (r, h) ∈ M ′ \ M . 3. We stop the procedure when we complete a cycle (ensuring that the two adjacent residents of a hospital are corr for each other according to the hospital), or the path can no longer be extended. Otherwise we go to Step 1 or Step 2 as applicable and repeat. The above procedure gives us a unique decomposition of a connected component in G into alternating paths and cycles. Note that a hospital may appear multiple times in a single path or a cycle and also can belong to more than one alternating paths and cycles. Figure 2 gives an example of the decomposition of the two feasible matchings in the instance in Figure 1. h1 h2 r1 r2 r3 r4 r1 r2 r3 r4 h1 h2 h1 (a) (b) Fig. 2. M and M ′ are feasible matchings in the example as defined in Fig. 1. (a) G = (R ∪ H, M ⊕ M ′); bold edges belong to M , dashed edges belong to M ′. (b) shows the decomposition of the edges of the component of G into a single path. Let YM⊕M ′ denote the collection of alternating paths and alternating cycles obtained by decomposing every component of G. We now state a useful property about any alternating path or cycle in YM⊕M ′ . Lemma 1. If ρ is an alternating path or an alternating cycle in YM⊕M ′ , then M ⊕ ρ is a feasible matching in G. Proof. Let hr′, h, ri be any sub-path of ρ, where r′ = corr(r), and (r, h) ∈ M . We prove that (M (h) \ {r}) ∪ {r′} is feasible for h. Let C h j ) be the unique leaf class of T (h) containing r (resp. r′). See Figure 3. We consider the following two cases: i (resp. C h 6 C h k C h ∗ C h t .., r′, .. C h j .., r, .. C h i Fig. 3. The classification tree T(h) for a hospital h. -- r and r′ belong to the same leaf class in T (h), i.e. C h (M (h) \ {r}) ∪ {r′} is feasible for h. -- r and r′ belong to different leaf classes of T (h), i.e. C h i i = C h j . In this case, it is easy to note that 6= C h violate the upper quota only for those classes of T (h) which contain r′ but do not contain r. Let C h the least common ancestor of C h path from C h and r /∈ C h that r′ did not find a corresponding resident in the set (M (h) \ M ′(h)) ∩ C h because M ′ is feasible. Thus, (M (h) ∩ C h (M (h) \ {r}) ∪ {r′} is feasible for h. j . Observe that (M (h) \ {r}) ∪ {r′} can k be t which lies in the t ). As r′ = corr(r) t ). The first inequality is due to the fact t . The second inequality is t . Therefore t ) ∪ {r′} does not violate the upper quota for C h i and C h j excluding the class C h j in T (h). It suffices to look at any class C h t ) ∪ {r′} ≤ q(C h k and show that (M (h) ∩ C h k to C h t , we claim that M (h) ∩ C h t < M ′(h) ∩ C h t ≤ q(C h We note that the hospital h may occur multiple times on ρ. Let M (h)ρ denote the set of residents matched to h restricted to ρ. To complete the proof of the Lemma, we need to prove that (M (h) \ M (h)ρ) ∪ M ′(h)ρ ⊓⊔ is feasible for h. The arguments for this follow from the arguments given above. As was done in [13], it is convenient to label the edges of M ′ \ M and use these labels to compute ∆(M ′, M ). Let (r, h) ∈ M ′ \ M ; the label on (r, h) is a tuple: (voter(h, M (r)), voteh(r, corr(r))) Note that since we are labeling edges of M ′ \ M , both entries of the tuple come from the set {−1, 1}. With these definitions in place, we are ready to give the structural characterization of popular matchings in an LCSM+ instance. 3 Structural characterization of popular matchings Let G = (R ∪ H, E) be an LCSM+ instance and let M and M ′ be two feasible matchings in G. Using the corr function, we obtain a correspondence of residents in M (h) ⊕ M ′(h) for every hospital h in G. Let G = (R ∪ H, M ⊕ M ′) and let YM⊕M ′ denote the collection of alternating paths and cycles obtained by decomposing every component of G. Finally, we label the edges of M ′ \ M using appropriate votes. The goal of these steps is to is to rewrite the term ∆(M ′, M ) as a sum of labels on edges. We note that the only vertices for whom their vote does not get captured on the edges of M ′ \ M are vertices that are matched in M but not matched in M ′. Let U denote the multi-set of vertices that are end points of paths in YM⊕M ′ such that there is no M ′ edge incident on them. Note that the same hospital can belong to multiple alternating paths and cycles in YM⊕M ′ , therefore we need a multi-set. All vertices in U 7 prefer M over M ′ and hence we add a −1 while capturing their vote in ∆(M ′, M ). We can write ∆(M ′, M ) as: ∆(M ′, M ) = X x∈U −1 + X ρ∈YM ⊕M ′   X (r,h)∈(M ′∩ρ) {voter(h, M (r)) + voteh(r, corr(r))}  We now delete the edges labeled (−1, −1) from all paths and cycles ρ in YM⊕M ′ . This simply breaks paths and cycles into one or more paths. Let this new collection of paths and cycles be denoted by YM⊕M ′ . Let U denote the multi-set of vertices that are end points of paths in YM⊕M ′ such that there is no M ′ edge incident on them. We rewrite ∆(M ′, M ) as: ∆(M ′, M ) = X x∈ U −1 + X ρ∈ YM ⊕M ′   X (r,h)∈(M ′∩ρ) {voter(h, M (r)) + voteh(r, corr(r))}  Theorem below characterizes a popular matching. Theorem 1. A feasible matching M in G is popular iff for any feasible matching M ′ in G, the set YM⊕M ′ does not contain any of the following: 1. An alternating cycle with a (1, 1) edge, 2. An alternating path which has a (1, 1) edge and starts with an unmatched resident in M or a hospital which is under-subscribed in M . 3. An alternating path which has both its ends matched in M and has two or more (1, 1) edges. Proof. We show that if M is a feasible matching such that for any M ′ the set YM⊕M ′ does not contain (1), (2), (3) as in Theorem 1, then M is popular in G. Assume for the sake of contradiction that M satisfies the conditions of Theorem 1, and yet M is not popular. Therefore there exists a feasible matching M ∗ such that ∆(M ∗, M ) > 0. Consider the set YM ∗⊕M . Recall that this set is a collection of paths and cycles and the edges of M ∗ \ M are labeled. Let ρ be any path or cycle in YM ∗⊕M and let ∆(M ∗, M )ρ denote the difference between the votes of M ∗ and M when restricted to the residents and hospitals in ρ. Since ∆(M ∗, M ) > 0, there exists a ρ such that ∆(M ∗, M )ρ > 0. Note that ρ is present in YM ∗⊕M ; using the presence of ρ we establish the existence of a ρ′ ∈ YM ∗⊕M of the form (1), (2) or (3) which contradicts our assumption. We consider three cases depending on the structure of ρ. 1. ρ is an alternating cycle or ρ is an alternating path which starts and ends in an M edge: Since ρ ∈ YM ∗⊕M , and ∆(M ∗, M )ρ > 0, it implies that there are more edges in ρ labeled (1, 1) than the number of edges labeled (−1, −1). We now delete the edges labeled (−1, −1) from ρ; this breaks ρ in to multiple alternating paths. Note that each of these paths (say ρ′) start and end with an M edge and are also present in YM ∗⊕M . Furthermore, since ρ contained more number of edges labeled (1, 1) than the number of edges labeled (−1, −1), it is clear that there exists at least one ρ′ which has two edges labeled (1, 1). This is a path of type (3) from the theorem statement and therefore contradicts our assumption that M satisfied the conditions of the theorem. 2. ρ is an alternating path which starts or ends in an M ∗ edge: The proof is similar to the previous case except that when we delete from ρ the edges labeled (−1, −1) we get paths ρ′ ∈ YM ∗⊕M which are paths of type (2) or type (3) from the theorem statement. This contradicts the assumption that M satisfied the conditions of the theorem. This completes the proof of one direction of the Theorem. To prove the other direction, we prove the contrapositive of the statement. That is, if for any feasible matching M ′, YM⊕M ′ contains (1), (2) or (3), then M is not popular in G. We first assume that ρ ∈ YM⊕M ′ satisfying (1), (2), or (3) is also present in YM⊕M ′ . Under this condition, it is possible to get a more popular matching than M by the following three cases. 8 -- Let M2 = M ⊕ ρ be a matching in G; by Lemma 1 we know that M2 is feasible in G. Comparing M2 to M yields two more votes for M2. Hence, M2 is more popular than M . -- If ρ is an alternating path in YM⊕M ′ , which has both its endpoints matched in M , and contains more than one edge labeled (1, 1). Then similar to the case above M2 = M ⊕ ρ is more popular than M . -- If ρ is an alternating path in YM⊕M ′ , which has exactly one of its endpoints matched in M , and contains an edge labeled (1, 1), then again M2 = M ⊕ ρ is more popular than M . Now let us assume that ρ ∈ YM⊕M ′ is not present in YM⊕M ′ . In such a case, ρ is contained in a larger path or a cycle ρ′ ∈ YM⊕M ′ obtained by combining ρ with other paths in YM⊕M ′ and adding the deleted (−1, −1) edges. Using the larger path or cycle ρ′ we can construct a matching that is more popular than M . Note that we need to use paths or cycles in YM⊕M ′ to obtain another matching, since we have to ensure that the ⊓⊔ matching obtained is indeed feasible in the instance and the correspondences are maintained. We now prove that every stable matching in an LCSM+ instance is popular. Theorem 2. Every stable matching in an LCSM+ instance G is popular. Proof. Let M be a stable matching in G. For any feasible matching M ′ in G consider the set YM⊕M ′ . To prove that M is stable, it suffices to show that there does not exist a path or cycle ρ ∈ YM⊕M ′ such that an edge of ρ is labeled (1, 1). For the sake of contradiction, assume that ρ is such a path or cycle, which has an edge (r′, h) ∈ M ′ \ M labeled (1, 1). Let r = corr(r′), where (r, h) ∈ M ∩ ρ. From the proof of Lemma 1 we observe that (M (h) \ {r}) ∪ {r′} is feasible for h, therefore the edge (r′, h) blocks M contradicting the ⊓⊔ stability of M . 4 Popular matchings in LCSM+ problem In this section we present efficient algorithms for computing (i) a maximum cardinality popular matching, and (ii) a matching that is popular amongst all the maximum cardinality matchings in a given LCSM+ instance. Our algorithms are inspired by the reductions of Kavitha and Cseh [5] where they work with a stable marriage instance. We describe a general reduction from an LCSM+ instance G to another LCSM+ instance Gs. Here s = 2, . . . , R. The algorithms for the two problems are obtained by choosing an appropriate value of s. The graph Gs: Let G = (R ∪ H, E) be the input LCSM+ instance. The graph Gs = (Rs ∪ Hs, Es) is constructed as follows: Corresponding to every resident r ∈ R, we have s copies of r, call them r0, . . . , rs−1 in Rs. The hospitals in H and their capacities remain unchanged; however we have additional dummy hospitals each of capacity 1. Corresponding to every resident r ∈ R, we have (s − 1) dummy hospitals d0 r, . . . , ds−2 in Hs. Thus, r Rs = { r0, . . . , rs−1 ∀r ∈ R}; Hs = H ∪ { d0 r, . . . , ds−2 r ∀r ∈ R} We use the term level-i resident for a resident ri ∈ Rs for 0 ≤ i ≤ s − 1. The preference lists corresponding to s different residents of r in Gs are: -- For a level-0 resident r0, its preference list in Gs is the preference list of r in G, followed by the dummy hospital d0 r. of r in G, followed by di r. -- For a level-i resident ri, where 1 ≤ i ≤ s − 2, its preference list in Gs is di−1 followed by preference list r -- For a level-(s − 1) resident rs−1, its preference list in Gs is the dummy hospital ds−2 followed by the r preference list of r in G. The preference lists of hospitals in Gs are as follows. -- The preference list for a dummy hospital di -- For h ∈ H, its preference list in Gs, has level-(s − 1) residents followed by level-(s − 2) residents, so on r is ri followed by ri+1. upto the level-0 residents in the same order as in h's preference list in G. 9 Finally, we need to specify the classifications of the hospitals in Gs. For every class C h i we have a corresponding class ¯C h ¯C h (I1) Each di (I2) The above invariant implies that for every r ∈ R at most one of {r0, . . . , rs−1} is assigned to a non-dummy i . Let Ms be a stable matching in Gs. Then Ms satisfies the following properties: r ∈ Hs for 0 ≤ i ≤ s − 2, is matched to one of {ri, ri+1} in Ms. {r0, . . . , rs−1} in Gs, such that q( ¯C h in the instance G, i ). We note that i = Sr∈C h i = s · C h i ) = q(C h i hospital in Ms. (I3) For a resident r ∈ R, if ri is matched to a non-dummy hospital in Ms, then for all 0 ≤ j ≤ i − 1, . This also implies that in Ms all Ms(rj ) = dj residents r0, . . . , rs−2 are matched and only rs−1 can be left unmatched in Ms. r. Furthermore, for all i + 1 ≤ p ≤ s − 1, Ms(rp) = dp−1 r These invariants allow us to naturally map the stable matching Ms to a feasible matching M in G. We define a function map(Ms) as follows. M = map(Ms) = {(r, h) : h ∈ H and (ri, h) ∈ Ms for exactly one of 0 ≤ i ≤ s − 1} We outline an algorithm that computes a feasible matching in an LCSM+ instance G. Given G and s, construct the graph Gs from G. Compute a stable matching Ms in Gs. If G is an LCSM+ instance we use the algorithm of Huang [10] to compute a stable matching in G. If G is a PCSM+ instance, it is easy to observe that Gs is also a PCSM+ instance. In that case, we use the algorithm of Abraham et al.[2] to compute a stable matching. (The SPA instance is different from a PCSM+ instance, however, there is a easy reduction from the PCSM+ instance to SPA, we give the reduction (refer Appendix A.1) for the sake of completeness.). We output M = map(Ms) whose feasibility is guaranteed by the invariants mentioned earlier. The complexity of our algorithm depends on s and the time required to compute a stable matching in the problem instance. In the rest of the paper, we denote by M the matching obtained as map(Ms) where Ms is a stable matching in Gs. For any resident ri ∈ R, we define map−1(ri, Ms) = rji i = rs−1 i where 0 ≤ ji ≤ s − 1 and Ms(rji otherwise. i ) is a non-dummy hospital Recall by Invariant (I3), exactly one of the level copy of ri in Gs is matched to a non-dummy hospital in Ms. For any feasible matching M ′ in G consider the set YM⊕M ′ -- recall that this is a collection of M alternating paths and cycles in G. For any path or cycle ρ in YM⊕M ′ , let us denote by ρs = map−1(ρ, Ms) the path or cycle in Gs obtained by replacing every resident r in ρ by map−1(r, Ms). Recall that if a resident r is present j for i = 0, . . . , s − 1. The map−1 in the class C h function maps a resident r in G to a unique level-i copy in Gs. Using Lemma 1 and these observations we get the following corollary. j defined by a hospital h in G, then in the graph Gs, ri ∈ ¯C h Corollary 1. Let ρ be an alternating path or an alternating cycle in YM⊕M ′ , then Ms ⊕ ρs is a feasible matching in Gs, where ρs = map−1(ρ, Ms). The following technical lemma is useful in proving the properties of the matchings produced by our algo- rithms. Lemma 2. Let ρ be an alternating path or an alternating cycle in YM⊕M ′ , and ρs = map−1(ρ, Ms). 1. There cannot be any edge labeled (1, 1) in ρs. 2. Let hrja b i be a sub-path of ρs, where h = Ms(rjb a , h, rjb (1, 1), where j′ a < ja. b ). Then, the edge (rj′ a a , h) /∈ ρs cannot be labeled a , h, rjb Proof. Let hrja (Corollary 1), the set (Ms(h) \ {rjb the edge (rja (rj′ (Ms(h) \ {rjb b i be a sub-path of ρs, where h = Ms(rjb b ) (Figure 4). As Ms ⊕ ρs is feasible in Gs a , h) is labeled (1, 1), a , h) blocks Ms contradicting its stability. This proves (1). To prove (2), assume that the edge k ) in Gs, hence a } is feasible for h in Gs. Now since (rja a belong to the same class (say ¯C h a } is feasible for h. Thus the edge (rj′ a , h) /∈ ρs is labeled (1, 1). The residents rja a , h) blocks Ms contradicting its stability. a and rj′ b }) ∪ {rja a a a b }) ∪ {rj′ a 10 h rja a rjb b j′ a a r Fig. 4. The edges (rja a , h) and (rjb b , h) belong to ρ, while the edge (r j′ a , h) does not belong to ρ. a 4.1 Maximum cardinality popular matching Let G = (R∪H, E) be an instance of the LCSM+ problem where we are interested in computing a maximum cardinality popular matching. We use our generic reduction with the value of the parameter s = 2. Since G2 is linear in the size of G, and a stable matching in an LCSM+ instance can be computed in O(mn) time [10], we obtain an O(mn) time algorithm to compute a maximum cardinality popular matching in G. In case G is a PCSM+ instance, we use the linear time algorithm in [2] for computing a stable matching to get a linear time algorithm for our problem. The proof of correctness involves two things -- we first show that M is popular in G. We then argue that it is the largest size popular matching in G. We state the main theorem of this section below. Theorem 3. Let M = map(M2) where M2 is a stable matching in G2. Then M is a maximum cardinality popular matching in G. We break down the proof of Theorem 3 in two parts. Lemma 3 shows that the assignment M satisfies all the conditions of Theorem 1. Lemma 5 shows that the matching output is indeed the largest size pop- ular matching in the instance. Let M ′ be any assignment in G. Recall the definition of YM⊕M ′ -- this set contains M alternating paths and M alternating cycles in G and the edge labels on the M ′ edges belong to {(−1, 1), (1, −1), (1, 1)}. Lemma 3. Let M = map(M2) where M2 is a stable matching in G2 and let M ′ be any feasible assignment in G. Consider the set of alternating paths and alternating cycles YM⊕M ′ . Then, the following hold: 1. An alternating cycle C in YM⊕M ′ , does not contain any edge labeled (1, 1). 2. An alternating path P in YM⊕M ′ that starts or ends with an edge in M ′, does not contain any edge labeled (1, 1). 3. An alternating path P in YM⊕M ′ which starts and ends with an edge in M , contains at most one edge labeled (1, 1). Proof. We first prove the parts (1) and (2). Recall that M = map(M2) where M2 is a stable matching in G2. Assume that ρ = hu0, v1, u1, . . . , vk, uki where for each i = 0, . . . , k, vi = M (ui) (in case ui is a hospital, vi ∈ M (ui)). In case ρ is a cycle, all subscripts follow mod k arithmetic. The existence of ρ in YM⊕M ′ implies that there is an associated M2 alternating path or an M2 alternating cycle ρ2 = map−1(ρ, M2) in G2. Now assume for the sake of contradiction that ρ contains an edge e = (ra, hb) /∈ M labeled (1, 1) for some a = 0, . . . , k, and b = 0, . . . , k. We observe the following about preferences of ra and hb in G. (O1) ra prefers hb over ha = M (ra). (O2) hb prefers ra over rb ∈ M (hb), where rb = corr(ra). 11 Using the presence of an edge labeled (1, 1) in ρ, we will contradict the stability of M2 in G2. Consider b ), we observe that e′ /∈ M2. We consider the four cases that a , hb) in G2. Since hb = M2(rjb the edge e′ = (rja can arise depending on the values of ja and jb. 1. ja = jb = 0 2. ja = jb = 1 3. ja = 1 and jb = 0 4. ja = 0 and jb = 1 Recall observation (O1), and the fact that the residents do not change their preferences in G2 w.r.t. a prefers hb over a ). Using (O2) and the fact that a hospital h in G2 prefers level-1 residents over level-0 residents, b , which implies the hospitals originally in G. This implies in all the four cases above, the resident rja ha = M2(rja we can conclude the following. For the cases (1), (2) and (3), hospital hb prefers rja that the pair (rja a , hb) is labeled (1, 1), and thus forms a blocking pair w.r.t. M2 (using Lemma 2(1)). a over rjb We now consider the three different cases for ρ depending on whether ρ is a path or a cycle. When ρ is a path, we break down its proof in two cases -- (i) ρ starts or ends with a resident unmatched in M . (ii) ρ starts or ends with an under-subscribed hospital. In each of the different possibilities for ρ, we show that the stability of M2 can be contradicted even in case (4), i.e. when ja = 0 and jb = 1. 0 , h1, rj1 1 , . . . , hk−1, rjk−1 -- ρ = hr0, h1, r1, . . . , hk−1, rk−1i is an alternating path that starts or ends with a resident which is k−1 i and for t = 0, . . . , k − 1, unmatched in M . Here ρ2 = map−1(ρ, M2) = hrj0 jt ∈ {0, 1}. Using invariants (I1), (I2), and (I3), we conclude that a resident r remains unmatched in M2 when its level-0 copy is matched to the dummy hospital dr, and the level-1 copy is unmatched in M2. Therefore, the first resident on the path ρ2 is a level-1 resident. Furthermore, the second resident on the path r1 has to be a level-1 resident. Otherwise, as r1 0 is unmatched in M2 and h1 prefers a level-1 resident over a level-0 resident, the edge (r1 0, h1) will be labeled (1, 1), and thus forms a blocking pair w.r.t. M2 (using Lemma 2(1)). We consider an edge e ∈ ρ such that b = a + 1. In case (4), we observe that as j0 = j1 = 1, ja = 0, and a < b, there exists an index x in ρ2 such that there is a transition from a level-1 resident to a level-0 resident. That is, (r0 We enumerate the possible labels for the edge ex = (rx−1, hx) in G. x−1, hx) /∈ M2 both belong to ρ2. x, hx) ∈ M2 and (r1 • If ex is labeled (1, 1) or (1, −1), then the edge (r1 x−1, hx) is labeled (1, 1), and thus blocks M2 (using Lemma 2(1)). • If ex is labeled (−1, 1), then the edge (r0 x−1, hx) is labeled (1, 1), and thus blocks M2 (using Lemma 2(2)). -- ρ = hh0, r1, h1, . . . , rk−1, hk−1i is an alternating path that starts or ends with an under-subscribed 1 , h1, . . . , rjk−1 k−1 , hk−1i and for t = 1, . . . , k − 1, jt ∈ {0, 1}. 1, h0) is labeled (1, 1), as h0 is unmatched in M , and r0 hospital. Here ρ2 = map−1(ρ, M2) = hh0, rj1 Observe that if j1 = 1, then (r0 1 prefers h0 to dr1 (dr1 = M2(r0 1) using invariants (I1), (I2), and (I3)), contradicting the stability of Ms (using Lemma 2(1)). Thus, it must be the case that j0 = 0. Note that the edge (r1, h0) can not be labeled (1, 1) in G, as h0 being under-subscribed prefers being matched to r1, and residents do not change their votes, and thus the edge (r0 We consider an edge e ∈ ρ such that a = b + 1. In case (4), we observe that as j1 = 0, jb = 1, and a > b, there exists an index x in ρ2 such that there is a transition from a level-0 resident to a level-1 resident. That is, (r0 x+1, hx) /∈ M2 both belong to ρ2. Using an argument similar to in the case above, we can show that either the edge (r1 x+1, hx) is labeled (1, 1), and therefore forms a blocking pair w.r.t. M2. 1, h0) is labeled (1, 1), contradicting the stability of M2 (using Lemma 2(1)). x+1, hx) or the edge (r0 x, hx) ∈ M2 and (r1 -- ρ = hr0, h0, r1, h1, . . . , rk, hk, r0i is an alternating cycle. Here ρ2 = map−1(ρ, Ms) = hrj0 0 , h0, rj1 1 , h1, . . . , rjk k , hk, rj0 0 i and for t = 1, . . . , k − 1, jt ∈ {0, 1}. We consider an edge e ∈ ρ such that a = b + 1. As ja = 0 and jb = 1, and b < a, this is a transition from a level-1 resident to a level-0 resident in the cycle ρ2. To complete the cycle ρ2 there must exist an index x such that there is a transition from a level-0 resident to a level-1 resident. That is, (r0 x, hx) ∈ M2 and (r1 x+1, hx) /∈ M2 both belong to ρ2. Using an argument similar to as in the first case, we can show that either the edge (r1 x+1, hx) is labeled (1, 1), and therefore forms a blocking pair w.r.t. M2. x+1, hx) or the edge (r0 12 We now prove part (3) of the lemma. Consider P = hr0, h0, . . . , rk−1, hk−1i where for each i = 0, . . . , k−1, M (ri) = hi. The existence of P in YM⊕M ′ implies that there exists an M2 alternating path P2 in G2. Here P2 = hrj0 k−1 , hk−1i, and for t = 0, . . . , k − 1, jt ∈ {0, 1}. 0 , h0, . . . , rjk−1 For the sake of contradiction assume that P contains at least two edges, e1 = (rx, hx−1), e2 = (ry, hy−1) for some x, y = 1, . . . , k − 1, w.l.o.g. x 6= y, x < y and e1, e2 are labeled (1, 1). We observe the following about preferences of rx, ry and hx−1, hy−1 in G. (O1) rx prefers hx−1 over hx = M (rx). ry prefers hy−1 over hy = M (ry). (O2) hx−1 prefers rx over rx−1 ∈ M (hx−1). hy−1 prefers ry over ry−1 ∈ M (hy−1). Using the presence of the edges e1 and e2 labeled (1, 1) in P , we will contradict the stability of M2 ) and y , hy−1) in G2, and since hx−1 = M2(rjx−1 x , hx−1) and e′ 2 = (rjy 1 = (rjx x 2 /∈ M2. 1, e′ 1, and consider the four cases that can arise depending on the values of jx in G2. Consider the edges e′ hy−1 = M2(rjy−1 ), note that e′ y We first consider the edge e′ and jx−1. 1. jx−1 = jx = 0 2. jx−1 = jx = 1 3. jx−1 = 0 and jx = 1 4. jx−1 = 1 and jx = 0 hospitals originally in G. This implies that in all the four cases above, the resident rjx hx = M2(rjx we can conclude the following. For the cases (1), (2) and (3), hospital hx−1 prefers rjx implies that the pair (rjx Recall observation (O1), and the fact that the residents do not change their preferences in G2 w.r.t the x prefers hx−1 over x ). Using (O2) and the fact that a hospital h in G2 prefers level-1 residents over level-0 residents, x−1 , which x , hx−1) is labeled (1, 1), which contradicts the stability of Ms (using Lemma 2(1)). 2, we conclude that the first three cases do not arise. There is only one case left to consider, when jx−1 = 1, jx = 0 and jy−1 = 1, jy = 0. As x 6= y, x < y, and jx = 0, jy−1 = 1, there exists an index ℓ in P2 such that there is a transition from a level-0 resident to a level-1 resident. That is, (r0 With a similar analysis for the edge e′ ℓ , hℓ) ∈ M2 and (r1 We enumerate the possible labels for the edge eℓ = (rℓ+1, hℓ) in G. ℓ+1, hℓ) /∈ M2 both belong to P2. x over rjx−1 -- If eℓ is labeled (1, 1) or (1, −1), then the edge (r1 ℓ+1, hℓ) is labeled (1, 1), which contradicts the stability -- If eℓ is labeled (−1, 1), then the edge (r0 ℓ+1, hℓ) is labeled (1, 1), which contradicts the stability of Ms of Ms (using Lemma 2(1)). (using Lemma 2(2)). This completes the proof. ⊓⊔ Lemma 4. There is no augmenting path with respect to M in YM⊕M ′ . 1 , h2, . . . , hk−1, rjk−1 k−1 , hki in G2, and for t = 0, . . . , k − 1, jt ∈ {0, 1}. Proof. Let P = hr0, h1, r1, h2, . . . , hk−1, rk−1, hki be an augmenting path where for each i = 1, . . . , k − 1, M (ri) = hi. The existence of P in YM⊕M ′ implies that there exists an M2 augmenting path P2 = hrj0 0 , h1, rj1 Using invariants (I1), (I2), and (I3), we conclude that a resident r remains unmatched in M2 when its level-0 copy is matched to the dummy vertex dr, and the level-1 copy is unmatched in M2. Therefore the first resident on the path P2 is a level-1 resident. The second resident on the path r1 has to be a level-1 resident, otherwise the edge (r1 0, h1) will be labeled (1, 1), and thus contradict the stability of M2 (using Lemma 2(1)). This is because r1 0 prefers being matched to h1 than being unmatched in M2, and h1 prefers level-1 resident over a level-0 resident. Observe that jk−1 = 0, else the pair (r0 k−1 is matched to dr (by invariants (I1) and (I2)), which is at the end of its preference list, and hk is unmatched in M ′. k−1, hk) is labeled (1, 1), as r0 Therefore the path P2 is of the form hr1 k−1, hki. As j0 = j1 = 1 and jk−1 = 0, there exists an index x in P2 such that there is a transition from a level-1 resident to a level-0 resident. That is, (r0 x, hx) ∈ M2 and (r1 We enumerate the possible labels for the edge ex = (rx−1, hx) in G. x−1, hx) /∈ M2 both belong to P2. 1, h2, . . . , hk−1, r0 0, h1, r1 13 -- If ex is labeled (1, 1) or (1, −1), then the edge (r1 x−1, hx) is labeled (1, 1), which contradicts the stability of Ms (using Lemma 2(1)). -- If ex is labeled (−1, 1), then the edge (r0 x−1, hx) is labeled (1, 1), which contradicts the stability of Ms (using Lemma 2(2)). This contradicts our assumption that P is augmenting with respect to M in YM⊕M ′ . ⊓⊔ Lemma 5. There exists no popular matching M ∗ in G such that M ∗ > M . Proof. For contradiction, assume that such an assignment M ∗ exists in G. Consider the set YM⊕M ∗ ; recall that this set contains alternating paths and cycles possibly containing edges labeled (−1, −1). Since M ∗ > M there must exist an augmenting path P in YM⊕M ∗ . We first claim that the path P must contain at least one edge labeled (−1, −1). If not, then the path P is also contained in YM⊕M ∗ . However, by Lemma 4 there is no augmenting path with respect to M in YM⊕M ′ for any feasible matching M ′ in G. We now remove all edges from P which are labeled (−1, −1). This breaks the path into sub-paths say P1, P2, . . . , Pt for some t ≥ 1, where P1 and Pt have one endpoint unmatched in M . Consider the path P1; since P1 does not contain any (−1, −1) edge this implies that P1 ∈ YM⊕M ∗ . Without loss of generality, assume that P1 starts with a resident r which is unmatched in M . Thus using Lemma 3(2), P1 does not contain any edge labeled (1, 1). Let us denote by ∆(M ∗, M )P1 the difference between votes of M ∗ and M restricted to vertices of path P1. It is clear that ∆(M ∗, M )P1 < 0. Also, for each i = 2, . . . , t − 1, the alternating paths Pi have both of their endpoints matched in M . Thus we have ∆(M ∗, M )Pi ≤ 0 as there can be at most one (1, 1) edge (by Lemma 3(3)) in these paths, but the endpoints prefer M , as they are matched in M but not in M ′. If Pt exists, then a argument similar as given for P1, we have ∆(M ∗, M )Pt < 0. Using these observations, we conclude that M is more popular than M ∗, a contradiction to the assumption that M ∗ and M are both popular. Thus, for any given matching M ∗ such that M ∗ > M , we know that M is more popular than such a matching. This completes the proof of the lemma, and shows that the matching M = map(M2) is a maximum ⊓⊔ cardinality popular matching in G. 4.2 Popular matching amongst maximum cardinality matchings In this section we give an efficient algorithm for computing a matching which is popular amongst the set of maximum cardinality matchings. The matching M that we output cannot be beaten in terms of votes by any feasible maximum cardinality matching. Our algorithm uses the generic reduction with a value of s = R = n1 (say). Thus, Rn1 = n2 1). Furthermore, En1 = O(mn1) where m = E. Thus the running time of the generic algorithm presented earlier with s = n1 for an LCSM+ instance is O(mn · n1) = O(mn2) and for a PCSM+ instance is O(mn1) = O(mn). 1, and Hn1 = H + O(n2 To prove correctness, we show that the matching output by our algorithm is (i) maximum cardinality and (ii) popular amongst all maximum cardinality feasible matchings. Let M = map(Mn1) and M ∗ be any maximum cardinality feasible matching in G. Consider the set YM⊕M ∗ , and let ρ be an alternating path or an alternating cycle in YM⊕M ∗ . Let ρn1 = map−1(ρ, Mn1) denote the associated alternating path or cycle in Gn1 . We observe that every hospital on the path ρn1 is a non-dummy hospital since ρn1 was obtained using the inverse-map of ρ. We observe two useful properties about such a path or cycle ρn1 in Gn1 . We show that if for a hospital h ∈ ρn1, the level of the unmatched resident incident on h is greater than the level of the matched resident incident on h, then such a level change is gradual, and the associated edge in ρ has the label (−1, −1). Lemma 6, gives a proof of these. Lemma 6. Let ρn1 be an alternating path or an alternating cycle in Gn1 and let h be a hospital which has degree two in ρn1 . Let hrja b ) = h. If ja > jb , we claim the following: b i be the sub-path containing h where M (rjb a , h, rjb 1. ja = jb + 1. 2. The associated edge (ra, h) ∈ ρ is labeled (−1, −1). 14 Proof. We first prove that ja = jb + 1. For contradiction, assume that ja > jb + 1. Observe that h prefers all the level-ja residents over any level-jb resident. We consider the edge e = (ra, h) in the graph G. We claim that the label for the edge e cannot be (1, 1) or (1, −1), otherwise the edge (rja a , h) is labeled (1, 1) in Gn1 as the residents do not change their votes. Similarly, we claim that the label for the edge e cannot be (−1, 1) or (−1, −1), as rja−1 ) (by invariant (I3)), and prefers h to dja−1 , and h prefers all the level-(ja − 1) residents over any level-jb resident. In this case the edge (rja −1 is matched in Mn1 to the last dummy on its preference list, dja−1 , h) is labeled (1, 1) in Gn1 , and thus blocks Mn1 (by Lemma 2(2)). ra = Mn1 (rja−1 ra a a a To prove part (b), we assume ja = jb + 1. We enumerate the possible labels for the edge e = (ra, h) in G. -- If e is labeled (1, 1) or (1, −1), then the edge (rja a , h) is labeled (1, 1), as rja prefers any level-ja resident over a level-jb resident. Thus, the edge (rja -- If e is labeled (−1, 1), then the edge (rjb a , h) is labeled (1, 1), as rjb prefers rjb a over rjb b according to its preference list. Thus, the edge (rjb a prefers h over Mn1(rja a ), and h a , h) blocks Mn1 (by Lemma 2(1)). a ), and h a , h) blocks Mn1 (by Lemma 2(2)). ra = Mn1(rjb a prefers h over djb Thus, the only possible label for the edge (ra, h) is (−1, −1). ⊓⊔ We use Lemma 7 to prove that M is a maximum cardinality matching in G. Lemma 7. Let M ∗ be any feasible maximum cardinality matching in G. Then there is no augmenting path with respect to M in YM⊕M ∗ . i ). Proof. For the sake of contradiction assume that the path P = hr0, h1, r1, . . . , hk−1, rk−1, hki is an aug- menting path where for each i = 1, . . . , (k − 1), M (ri) = hi. Here r0 is unmatched in M , and hk is under-subscribed in M . The existence of P in YM⊕M ∗ implies that there exists an Mn1 augmenting path Pn1 = map−1(P, Mn1 ) = hrj0 k−1 , hki in Gn1 , and for t = 0, . . . , k −1, jt ∈ {0, . . . , n1 −1}, where hi = Mn1(rji 1 , . . . , hk−1, rjk−1 0 , h1, rj1 Since r0 is unmatched in M , by invariant (I3), it implies that for 0 ≤ i ≤ n1 − 2, Mn1(ri r0 , and is unmatched in Mn1 . This implies that the first resident in the path Pn1 is a level-(n1 − 1) resident . The second resident on the path Pn1 also has to be a level-(n1 − 1) resident. If not, then the edge , h1) is labeled (1, 1) since h1 prefers rn1−1 is k−1. If not, then the rk−1 ) on its preference list rn1−1 0 rn1−1 0 (rn1−1 unmatched in Mn1. The last resident in the path Pn1 is a level-0 resident i.e. rjk−1 edge (r0 k−1 is matched to the last dummy hospital (d0 (by invariant (I3)), and hk is under-subscribed in Mn1. to any resident at a level lower than n1 − 1 and rn1−1 k−1, hk) is labeled (1, 1), as r0 k−1 = r0 0) = di 0 0 0 Thus, in the path Pn1 , the first two residents are level-(n1 − 1), while the last resident is level-0. Recall that the path Pn1 was obtained as an inverse-map of the path P in G. Since the path P contains at most n1 residents (possibly all of the residents in G), the path Pn1 also contains at most n1 residents. From Lemma 6 we observe that the difference in the levels of two residents in a sub-path of Pn1 can be at most one. Thus, it must be the case that residents at all the levels n1 − 1 to 0 are present in Pn1 . However, since there are two residents at level-(n1 − 1) (first two residents) and one resident at level-0 (last resident), it is clear that residents at all levels from n1 − 1 to 0 cannot be accommodated in a path containing at most n1 residents. This contradicts the existence of such a path Pn1 in Gn1 which implies that the assumed augmenting path P with respect to M cannot exist. This proves that M = map(Mn1) is a max-cardinality matching in ⊓⊔ G. We can now conclude that the set YM⊕M ∗ is a set of alternating (and not augmenting) paths and alternating cycles. It remains to show that M is popular amongst all maximum cardinality feasible matchings in G. Let M ∗ be any feasible maximum cardinality matching in G. In Lemma 8 we show that if there is an edge (r, h) ∈ M ∗ \ M labeled (1, 1) in ρ, then in ρn1 , for the hospital h, the level of its unmatched neighbour (resident) is lower than the level of its matched neighbour (resident). Lemma 8. If an edge (ra, h) ∈ ρ is labeled (1, 1), then in ρn1 for the sub-path hrja h, we have ja < jb. a , h, rjb b i where Mn1(rjb b ) = 15 Proof. Let an edge e = (ra, h) be labeled (1, 1) in ρ. We observe the following about preferences of ra and h in G. (O1) ra prefers h over M (ra). (O2) h prefers ra over rb ∈ M (h), where rb = corr(ra). Consider the edge e′ = (rja a , h) in Gn1 , as h = Mn1(rjb b ) it implies e′ /∈ Mn1. Consider the three cases that can arise depending on the values of ja and jb. 1. ja = jb 2. ja > jb 3. ja < jb Recall observation (O1), and the fact that the residents do not change their preferences in Gn1 w.r.t. the hospitals originally in G. This implies in all the three cases above, the resident rja a ). Using (O2) and the fact that a hospital h in Gn1 prefers level-p residents over level-q residents, when p > q, we can conclude the following. For the cases (1) and (2), hospital h prefers rja b , which implies that the pair (rja a , h) is labeled (1, 1), which is a blocking pair for Mn1 (using Lemma 2(1)). This contradicts the ⊓⊔ stability of Mn1. We therefore conclude that ja < jb. a prefers h over Mn1(rja a over rjb Lemma 9 shows that in an alternating path in YM⊕M ∗ with exactly one endpoint unmatched in M or an alternating cycle, the number of edges labeled (1, 1) cannot exceed the number of edges labeled (−1, −1). Lemma 9. Let ρ be an alternating path or an alternating cycle in YM⊕M ∗ . Then the number of edges labeled (1, 1) in ρ is at most the number of edges labeled (−1, −1). Proof. Depending on the nature of ρ we have three different cases. -- ρ is an alternating path which starts with an unmatched resident in M . -- ρ is an alternating path which starts with a hospital which is under-subscribed in M . -- ρ is an alternating cycle. The proof idea is similar in all the three cases. In each of the above, we consider ρn1 = map−1(ρ, Mn1). For every edge labeled (1, 1) in ρ we show a change (increase / decrease) in the level of the residents which are neighbours of a particular hospital. We show that each such change must be complemented with another change (decrease / increase resp.) in the level of the residents which are neighbours to some other hospital. Finally, we show that the second type of change translates to a (−1, −1) edge in ρ. Let ρ be an alternating cycle. Consider a hospital hi ∈ ρ for which there is an edge (r, h) labeled (1, 1) incident on it in ρ. Consider the associated hospital hi ∈ ρn1 . W.l.o.g. let hrji−1 i i be a sub-path of ρ when traversing ρn1 in counter-clock-wise direction. By Lemma 8, we know that the level of the unmatched resident incident on hi is lower than the level of the matched resident incident on hi. Thus there is an increase in level of residents when at hi (while traversing ρn1 in counter-clockwise direction). This is true for any hk ∈ ρn1 where the associated hospital in ρ has a (1, 1) edge incident on it. We now recall from Lemma 6(2) that whenever a hospital hk ∈ ρn1 has a level decrease, the associated edge in ρ is labeled (−1, −1). Furthermore the decrease in levels at a hospital is gradual. Thus, it must be the case that the number of (1, 1) edges in ρ is at most the number of (−1, −1) edges in ρ. i−1 , hi, rji In case ρ is an alternating path starting at an unmatched resident, we show that in the path ρn1 the first two residents are level-(n1 − 1) residents (see Claim 1 below for a proof). Furthermore, consider the first edge (r, h) ∈ ρ that is labeled (1, 1). The associated hospital hi has a increase in the level of its two neighbouring residents. However, since ρn1 started with two level-(n1 − 1) residents (which is the highest level possible). Therefore, there must have been some hospital hk preceding hi in ρn1 which has a decrease in the levels of the two neighbours. Using these facts it is easy to prove the following: Number of (1, 1) edges in ρ ≤ Number of increases in ρn1 ≤ Number of decreases in ρn1 ≤ Number of (−1, −1) edges in ρ. This completes the proof in case ρ is a path starting at an unmatched resident. Finally, we are left with the case when ρ is an alternating path which starts with a hospital hi which is under-subscribed in M . We show that in the associated path ρn1 , the first resident is a level-0 resident (see 16 Claim 2 below for a proof). Note that in this case since the path starts at a hospital, whenever we have an edge labeled (1, 1) in ρ, the associated hospital hi in ρn1 has an increase in the levels of the two neighbouring residents. Now first resident in the path is at the lowest possible level, it must be the case that there is a hospital hk preceding hi in ρ for which there is a decrease in the level of the neighbouring residents. Now using arguments similar to those in the case of path starting at an unmatched resident, we conclude that the number of (1, 1) edges in ρ is at most the number of (−1, 1) edges in ρ. Claim 1: ρ = hr0, h1, r1, . . .i starts with an unmatched resident. As r0 is unmatched in M , by invariant (I3), it implies that for 0 ≤ i ≤ n1 − 2, Mn1(ri is unmatched in Mn1. Therefore the first resident rj0 0 on the path ρn1 is a level-(n1 − 1) resident, that is j0 = n1 − 1. Furthermore, the second resident on the path r1 has to be a level-(n1 − 1) resident. If not, then as rn1−1 is unmatched in Mn1 and h1 prefers a level-(n1 − 1) resident to a level-v resident (v < n1 − 1), the edge (rn1−1 , h1) will be labeled (1, 1), and thus blocks Mn1 contradicting its stability (using Lemma 2(1)). Claim 2: ρ = hh0, r1, h1, . . .i starts with an under-subscribed hospital. The first resident rj1 has to be a level-0 resident, that is j1 = 0. If not, i.e. if j1 = 1, then d0 Mn1, and prefers h1 to d0 matched to r0 (using Lemma 2(2)). 1 on the path ρn1 r0 in r0. The hospital h1 on the other hand is under-subscribed in Mn1 and prefers being 1, h1) is labeled (1, 1), and blocks Mn1 contradicting its stability ⊓⊔ 1 in Mn1. Thus, the edge (r0 r0 = Mn1 (r0 1) (by invariant (I3)) d0 0 0) = di r, and rn1−1 0 0 Thus, we get the following theorem: Theorem 4. Let M = map(Mn1) where Mn1 is a stable matching in Gn1 . Then M is a popular matching amongst all maximum cardinality matchings in G. Discussion: A natural question is to consider popular matchings in LCSM instances. An LCSM instance need not admit a stable matching. However we claim that restricted to LCSM instances which admit a stable matching, our results hold without any modification. To obtain the result, we claim that Lemma 1 holds in the presence of lower quotas on classes. Additionally, if the given LCSM instance G admits a stable matching, the graph Gs for s = 1, . . . , n1 also admits a stable matching. We thank Prajakta Nimbhorkar for pointing this to us. Acknowledgement: We thank the anonymous reviewers whose comments have improved the presentation. References 1. D. J. Abraham, R. W. Irving, T. Kavitha, and K. Mehlhorn. Popular Matchings. SIAM Journal on Computing, 37(4):1030 -- 1045, 2007. 2. D. J. Abraham, R. W. Irving, and D. F. Manlove. Two Algorithms for the Student-Project Allocation Problem. J. of Discrete Algorithms, 5(1):73 -- 90, 2007. 3. P. Bir´o, D. Manlove, and S. Mittal. Size Versus Stability in the Marriage Problem. Theoretical Computer Science, 411(16-18):1828 -- 1841, 2010. 4. F. Brandl and T. Kavitha. Popular Matchings with Multiple Partners. CoRR, abs/1609.07531, 2016. 5. ´A. Cseh and T. Kavitha. Popular Edges and Dominant Matchings. In Proceedings of the Eighteenth Conference on Integer Programming and Combinatorial Optimization, pages 138 -- 151, 2016. 6. T. Fleiner and N. Kamiyama. A Matroid Approach to Stable Matchings with Lower Quotas. In Proceedings of the Twenty-third Annual ACM-SIAM Symposium on Discrete Algorithms, pages 135 -- 142, 2012. 7. D. Gale and L. Shapley. College Admissions and the Stability of Marriage. American Mathematical Monthly, 69:9 -- 14, 1962. 8. P. Gardenfors. Match Making: assignments based on bilateral preferences. Behavioural Sciences, 20:166 -- 173, 1975. 9. D. Gusfield and R. W. Irving. The Stable Marriage Problem: Structure and Algorithms. MIT Press, 1989. 10. C.-C. Huang. Classified Stable Matching. In Proceedings of the Twenty-First Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1235 -- 1253, 2010. 11. C.-C. Huang and T. Kavitha. Popular Matchings in the Stable Marriage Problem. In Proceedings of 38th International Colloquium on Automata, Languages and Programming , pages 666 -- 677, 2011. 17 12. N. Kamiyama. Popular Matchings with Two-Sided Preference Lists and Matroid Constraints. Technical Report MI 2016-13, 2016. 13. T. Kavitha. A Size-Popularity Tradeoff in the Stable Marriage Problem. SIAM Journal on Computing, 43(1):52 -- 71, 2014. 14. Z. Kir´aly. Better and Simpler Approximation Algorithms for the Stable Marriage Problem. Algorithmica, 60(1):3 -- 20, 2011. A Appendix A.1 Reduction from a PCSM+ instance to an SPA instance An instance of SPA [2] consists of students, projects and lecturers. Each lecturer has an upper bound on the maximum number of students that he/she is willing to advise. Each project has an upper bound on the number of students it can accommodate. Each project is owned by exactly one lecturer. Each student has a preference ordering over a subset of the projects, and each lecturer has a preference over the students. We detail on the reduction from PCSM+ instance to an SPA instance here. For a resident r in the PCSM+ instance, a corresponding student sr is introduced in the SPA instance. For each hospital h, a lecturer lh with capacity q(h) is added in the SPA instance. For each class C h j in the classification provided by a hospital h, a project pj is associated with the lecturer lh, and the upper-bound of pj is equal to q(C h j ). The preference list of lh is obtained from its corresponding hospital h. If the resident r is the k-th most preferred resident in the preference list of h, then the student sr is the k-th most preferred student in the preference list of lh. Similarly, the preference list of a student sr is created from its corresponding resident r. Let C h j be the class that the resident r appears in the classification provided by the k-th most preferred hospital in its preference list, then pj is the k-th most preferred project in the preference list for sr. As the classifications associated with every hospital in the PCSM+ instance are a partition over its preference list, there is no ambiguity in describing the preference of the students. 18
1512.08555
1
1512
2015-12-28T23:15:12
Maximium Priority Matchings
[ "cs.DS" ]
Let $G=(V,E)$ be an undirected graph with $n$ vertices and $m$ edges, in which each vertex $u$ is assigned an integer priority in $[1,n]$, with 1 being the "highest" priority. Let $M$ be a matching of $G$. We define the priority score of $M$ to be an $n$-ary integer in which the $i$-th most-significant digit is the number of vertices with priority $i$ that are incident to an edge in $M$. We describe a variation of the augmenting path method (Edmonds' algorithm) that finds a matching with maximum priority score in $O(mn)$ time.
cs.DS
cs
Maximium Priority Matchings Jonathan Turner wucse-2015-06 Abstract Let G = (V, E) be an undirected graph with n vertices and m edges, in which each vertex u is assigned an integer priority in [1, n], with 1 being the "highest" priority. Let M be a matching of G. We define the priority score of M to be an n-ary integer in which the i-th most- significant digit is the number of vertices with priority i that are incident to an edge in M . We describe a variation of the augmenting path method (Edmonds' algorithm) that finds a matching with maximum priority score in O(mn) time. 2 1 5 1 : v i X r a 1 Introduction A matching in an undirected graph is a subset of its edges, no two of which share a common endpoint. In the maximum size matching problem, the objective is to find a matching with the largest possible number of edges. Edmonds showed how to solve the problem for general graphs [1] and more efficient implementations of his method are described in [2] and [5]. Hopcroft and Karp described a simpler algorithm for the case of bipartite graphs [4]. A matching is said to match a vertex u, if one of its edges is incident to u. Given a graph in which vertices are assigned integer priorities ρ(u), a maximum priority matching is one that maximizes the number of matched vertices in the highest priority class, then maximizes the number of matched vertices in the next priority class (without reducing the number matched in the highest priority class), and so forth. We define a matching's priority 1 Figure 1: Example showing the priority score for a matching score to be the n-ary number in which the i-th most-significant digit is the number of matched vertices with priority i. Figure 1 shows an example of a graph with a matching whose priority score is 2111000100. Adding the edge ac yields a matching with a score of 2211100100. A maximum priority matching is a matching that has a priority score with maximum value. This version of the matching problem arises as a subproblem in an approximation algorithm for an np-complete scheduling problem for crossbar switches used in internet routers [7]. In this paper, we show how Edmonds' algorithm for the ordinary match- ing problem can be extended to solve priority matching problems. In section 2, we focus on the special case of two priorities (ρ(u) ≤ 2 for all u). This problem is of independent interest and provides a useful introduction to the methods used in the more general case, which is discussed in section 3. 2 Two priority case The two priority case can be phrased more simply by defining a set S consist- ing of all vertices with priority 1. Our objective is then to find a maximum 2 a d f b c e g h j i 1 1 2 2 3 4 4 5 6 8 priority score: 2111000100 size matching that also matches the largest possible number of vertices in S. In Edmonds' algorithm for maximum size matching, augmenting paths are used to convert a matching to a larger one. Given a matching in a graph, an augmenting path is a simple path in which the edges alternate between matching edges and non-matching edges, with both endpoints unmatched. By reversing the status of the matching and non-matching edges on such a path, we can obtain a new matching with one more edge than the original. Thus, so long as we can find an augmenting path, we can expand a given matching. Edmonds showed that if a larger matching exists, the graph must contain an augmenting path. For the priority matching problem, we must adjust the definition of an augmenting path. Let M be a matching of a graph G that does not match all the vertices in the given set S. An augmenting path in G with respect to M is a path p = u0, . . . , ut in which every other edge belongs to M , u0 is unmatched, u0 ∈ S and if ut is matched, ut (cid:54)∈ S. Figure 2 shows examples of two such paths. Observe that in both cases, if one replaces the path edges in M with the path edges not in M , we get a new matching that matches at least one more vertex in S. Also, note that when we expand a matching in this way, all previously matched vertices in S remain matched. Figure 2: Augmenting paths for two priority case (shaded vertices are in S) Define the count of a two-priority matching to be the number of vertices in S that are incident to edges in the matching. Now consider two matchings M and M(cid:48), where M has a smaller count than M(cid:48). Let N be the graph defined by the edges that are in M or in M(cid:48), but not both. Note that N consists of a collection of disjoint paths and cycles with alternate edges in M and M(cid:48). Since M(cid:48) has a larger count than M , N must contain at least one path p in which M(cid:48) matches more elements of S than does M . Since all interior vertices of a path are matched by both M and M(cid:48), the path endpoints must 3 account for the difference in the matchings' counts. That means that at least one endpoint must be in S and unmatched by M . If the other endpoint is matched, it cannot also be in S. Hence, p satisfies the condtion for an augmenting path with respect to M . Thus, for any matching that does not have the largest possible count, there exists an augmenting path that can be used to obtain a new matching with a larger count. Observe that given a matching with the maximum possible count, but less than maximum size, the original augmenting path method can be used to obtain a matching with the same count, but one more more matching edge. Hence one can easily convert a maximum count matching to one that has both maximum count and size. Such a matching also maximizes the number of matched vertices that are not in S, hence it satisfies the definition of a maximum priority matching for the 2 priority case. To complete the description of the augmenting path method, we still need an algorithm to find an augmenting path. Our presentation is an adaptation of that given in [6] for the maximum size matching problem. We start with the special case of bipartite graphs. The algorithm finds an augmenting path by building a collection of trees rooted at unmatched vertices in S. Vertices that have not yet been added to a tree are called unreached, while a vertex u in a tree is called odd or even depending on the length of the tree path from u to the root of the tree. Initially, the unmatched vertices in S are the only tree vertices. The algorithm also maintains a list of eligible edges that initially contains all edges incident to tree roots. It then repeats the following step until it either finds an augmenting path or runs out of eligible edges. Select an eligible edge e = {u, v} for which u is even, remove it from the eligible list, then apply the applicable case from those listed below. • If v is unreached and matched, let {v, w} be the matching edge incident to v. Extend the tree containing u by making v a child of u and w a child of v. If w is not in S, then the path from w to the root of its tree is an augmenting path; otherwise, add all non-matching edges incident to w to the eligible list. 4 Figure 3: Example of bipartite algorithm at start of augmenting path search and after three steps (even vertices labelled +, odd vertices − and arrows point to parents in trees) • If v is unreached and unmatched then the path consisting of e plus the tree path from u to its tree root is an augmenting path. • If v is even then the path formed by combining e with the tree path from u to the root of its tree and the tree path from v to the root of its tree is an augmenting path. (Note that u and v are in different trees, since the graph is bipartite.) • If v is odd, ignore e and proceed to the next eligible edge. Figure 3 illustrates the operation of the algorithm. Note that if edge bf is selected next, the algorithm will ignore it, if fi is selected next, it will find the odd-length augmenting path acfi, and if edge jk is selected next, it will find the even-length augmenting path ghjkn. To establish the correctness of the algorithm, we show that if it halts without finding an augmenting path, then the graph must not contain one. We start by noting a few properties of the algorithm. 1. Every tree root is unmatched and in S and each tree has exactly one unmatched vertex. 5 a b h c d f g i j e k m n p + eligible: ab, ac, gh + a b h c d f g i j e k m n p + eligible: bf, fi, jk, jm + - + + + - - 2. Every matching edge either has both endpoints unreached, or one odd and one even. In the latter case, the even endpoint is the child of the odd endpoint in some tree. 3. Every edge joining two vertices in the same tree joins an odd vertex to an even vertex. 4. If the algorithm fails to find an augmenting path, then when it fails, every edge with an endpoint in some tree has at least one odd endpoint. 5. If the algorithm fails to find an augmenting path, then when it fails, every even vertex is in S. Properties 3 and 4 imply that if the algorithm fails to find an augmenting, any path u0, u1, . . . , ut with u1 a child of u0 that alternates between matching and non-matching edges, must also alternate between even and odd vertices. So in particular, if the algorithm fails to find an augmenting path, but the graph contains an augmenting path p = u0, . . . , ut with u0 unmatched and in S, all vertices in p must alternate between even and odd. If t is odd, this implies that ut is odd and unmatched, but this contradicts the fact that every odd vertex is matched. If t is even, then ut is even and matched, but this contradicts property 5, since the matched endpoint of an augmenting path cannot be in S. Before proceeding to the case of general graphs, we show that for the special case where S consists of all vertices of maximum degree, the algorithm finds a matching that covers all vertices in S. Assume, to the contrary, that the algorithm fails to find an augmenting path when there is some unmatched vertex in S. Consider the collection of trees at the time the algorithm halts and recall that by property 5, all the even vertices must be in S. Since every tree has one more even vertex than it has odd vertices, some even vertex must have an edge that connects it to an unreached vertex, but this contradicts property 4. Hence, the algorithm matches all vertices in S. Next, we show how to find augmenting paths in general graphs. As with ordinary matchings, the key issue is handling odd-length cycles, known as blossoms. Edmonds showed how to extend the ordinary augmenting path search to recognize blossoms and shrink each blossom down to a single vertex, 6 Figure 4: Example of general graph with blossoms producing a new graph which has an augmenting path if and only if the original graph does. This is illustrated in Figure 4, which shows a blossom B1 containing vertices c, d, e, f and g and a blossom B2 containing vertices j, k and m. In the "shrunken graph" on the right, we have two augmenting paths abB1h and abB1B2ih. The corresponding paths in the original graph are abcdegfh and abcfgkmjih. There is a straightforward procedure to obtain an augmenting path in the underlying unshrunken graph, given an augmenting path in the current shrunken graph. We say than a vertex is internal if it is contained in some blossom, other- wise it is external. The base of a blossom is the unique vertex in the blossom that has no incident matching edge with the other endpoint in the blossom. So, in Figure 4, the base of B1 is c and the base of B2 is j. Our algorithm modifies the blossom-shrinking procedure to accommodate our modified augmenting paths. As in the bipartite case, the algorithm finds an augmenting path by building a collection of trees rooted at unmatched vertices in S. For convenience, we let β(u) denote the largest blossom con- taining a vertex u (if u is external, β(u) = u). Initially, all edges incident 7 a d i f g h j e k m + + + b c + + + + - - - - - a d i f g h j e k m + + + b c + + + + - - - - - B1 B2 to tree roots are on the list of eligible edges. The algorithm then repeats the following step until it either finds an augmenting path in the current shrunken graph or runs out of eligible edges. Select an eligible edge e = {u, v} for which β(u) is even and remove it from the list of eligible edges. • If v is unreached and matched, let {v, w} be the matching edge incident to v; extend the tree by making v a child of u and w a child of v. If w is not in S, then the path from w to the root of its tree in the current shrunken graph is an augmenting path; otherwise, add all non-matching edges incident to w to the eligible list. • If v is unreached and unmatched, then the path consisting of e plus the tree path from β(u) to the root of its tree in the current shrunken graph is an augmenting path. • If β(v) is even and in a different tree than β(u), then the path formed by combining e with the tree path from β(u) to the root of its tree in the current shrunken graph and the tree path from β(v) to the root of its tree is an augmenting path. • If β(v) is even and in the same tree as β(u), then the cycle formed by combining e with the tree paths in the current shrunken graph from β(u) and β(v) to their nearest common ancestor forms a blossom. If some odd vertex x in the cycle is not in S, then there is an augmenting path in the current shrunken graph from x to the root of its tree that starts with the matching edge incident to x, proceeds around the new blossom to its base and then up the tree to the root. If there is no such vertex, add all non-tree edges incident to odd vertices in the blossom cycle to the eligible list and shrink the blossom. • If β(v) is odd, ignore e and proceed to the next iteration Figure 4 can be used to illustrate the operation of the algorithm (note that the shaded vertices are in S). When the algorithm reaches the state shown 8 on the left side of the figure, the eligible edges are hf, dg, gk, eg and jm. The algorithm ignores edges hf, dg and gk and forms one blossom when processing edge eg and the other when processing jm. At this point, edges hf and gk are again eligible. Processing either edge leads to the discovery of an augmenting path. Also, observe that if d were not a member of S, then when edge eg was processed, the algorithm would have found the augmenting path abcfged. We defer the correctness proof of the algorithm to the next section. 3 Unlimited priorities We can find a maximum priority matching for the general case using a gen- eralization of the algorithm for the two priority case. We first maximize the number of priority 1 vertices that are matched, then the number of prior- ity 2 vertices and so forth. At each step, we find an augmenting path that increases the number of matched priority i vertices without decreasing the number of priority j vertices, for all j < i. Define the i-score of a matching M as the n-ary integer with i digits in which the j-th most significant digit is the number of priority j vertices that are matched by M . For example, in Figure 1, the 2-score is 21 and the 5-score is 21110. Given a matching M with a maximum (i − 1)-score, an i-augmenting path is a path p = u0, . . . , ut in which edges alternate between matching edges and non-matching edges, u0 is unmatched, ρ(u0) = i, and if ut is matched, ρ(ut) > i. Observe that because M has a maximum (i − 1)- score, if ut is unmatched, it cannot have priority less than i. Consequently, if we exchange the non-matching edges and matching edges in p, we obtain a new matching with the same (i − 1)-score and a larger i-score than M . To justify the use of augmenting paths, we must show that if a matching M has a maximum (i− 1)-score but not a maximum i-score, then there must be an i-augmenting path for M . Let M be such a matching and let M(cid:48) be a matching with a larger i-score. Let N be the graph consisting of edges that are in M or M(cid:48) but not both. N consists of a collection of disjoint paths and even-length cycles. Since M(cid:48) has a larger i-count than M , there must be some path p in N , in which M(cid:48) has a larger i-count than M . If p is an odd-length path, its endpoints must be unmatched by M and at least one of 9 its endpoints must have priority i, making p an augmenting path for M . If p is an even length path, the endpoint that is unmatched by M must have priority i and the endpoint matched by M must have priority > i. Hence, p is an augmenting path in this case, as well. We summarize this argument in the following theorem. Theorem 1 Let G = (V, E) be an undirected graph with priorities ρ(u) and let M be a matching with a maximum (i − 1)-score. G contains an i- augmenting path with respect to M if and only if M does not have a maximum i-score. To find a matching with maximum overall priority score, we initialize i = 1, then repeat the following step until i > n. Search for an i-augmenting path; if one is found, augment the matching by reversing the status of the path edges, otherwise increment i. The heart of the method is the algorithm used to find an i-augmenting path. At the start of each path search, all unmatched priority i vertices are tree roots, and all edges incident to these vertices are in the eligible list. The algorithm then searches for an i-augmenting path by repeating the following step until it either finds a path or runs out of eligible edges. Select an eligible edge e = {u, v} for which β(u) is even and remove it from the list of eligible edges. • If v is unreached and matched, let {v, w} be the matching edge incident to v; extend the tree by making v a child of u and w a child of v. If ρ(w) > i then the path in the current shrunken graph from w to the root of its tree is an i-augmenting path; otherwise, add all non-matching edges incident to w to the eligible list and continue. • If v is unreached and unmatched, then the path consisting of e plus the tree path in the current shrunken graph from β(u) to the root of its tree is an i-augmenting path. 10 • If β(v) is even and in a different tree than β(u), then the path formed by combining e with the tree path from β(u) to the root of its tree in the current shrunken graph and the tree path from β(v) to the root of its tree is an i-augmenting path. • If β(v) is even and in the same tree as β(u), then the cycle formed by combining e with the tree paths in the current shrunken graph from β(u) and β(v) to their nearest common ancestor forms a blossom. If some odd vertex x on the blossom cycle has ρ(x) > i, then there is an i-augmenting path in the current shrunken graph from x to the root of the tree that starts with the matching edge incident to x, continues around the blossom cycle to its base and then up the tree to the root. If there is no such vertex, add all non-tree edges incident to odd vertices on the blossom cycle to the eligible list and shrink the blossom. • If β(v) is odd, ignore e and proceed to the next iteration. Once again, to establish the correctness of the algorithm, we need to show that if it halts without finding an i-augmenting path, then the graph must not contain one. Note the following properties of the algorithm. 1. Every tree root is unmatched and has priority i and each tree has exactly one unmatched vertex. 2. Every matching edge either has both endpoints unreached, or one odd and one even. In the latter case, the even endpoint is the child of the odd endpoint in some tree. 3. For every internal vertex x, β(x) is even, and if x is unmatched, then β(x) is unmatched. 4. If the algorithm fails to find an augmenting path, then when it fails, any edge that has endpoints that are both even or internal is contained within some blossom. 5. If the algorithm fails to find an augmenting path, then when it fails, every vertex x that is even or internal has ρ(x) ≤ i. 11 Now, suppose that the original graph contains an augmenting path p = u0, . . . , ut, but the algorithm halts without finding a path. If both endpoints of p are unmatched, then the endpoints cannot be in the same tree (by property 1). In this case, let {uk, uk+1} be an edge in p with uk and uk+1 in different trees. By property 5, at least one of uk and uk+1 must be odd and external. Assume, without loss of generality, that uk is odd and external. Since {uk−1, uk} is a matching edge, k is even. If just one endpoint (u0) of p is unmatched, then t is even, ρ(ut) > i and hence ut odd and external (by property 4). Thus, in both cases, p contains an odd external vertex uk with k even. Let j be the smallest even integer for which uj is odd and external. Since uj is external, there must some vertex in {u0, . . . , uj−1} that is odd (If not, all vertices in {u0, . . . , uj−1} must be contained in and external. a common blossom (property 5), and since u0 is unmatched, the blossom must be also (property 3), hence must include the matching edge {uj−1, uj}, contradicting the fact that uj is external.) Let i be the largest integer < j for which ui is odd and external and note that i must be odd. This implies that all vertices in {ui+1, . . . , uj−1} are in a common blossom and that blossom is incident to two matching edges {ui, ui+1} and {uj−1, uj}. This contradiction implies the correctness of the algorithm. (This argument was adapted from [6].) Each augmenting path search can be implemented to run in O(m log n) time using the method described in [2] to represent the current shrunken graph. This can be reduced to O(m) time using the data structure described in [3]. Theorem 2 The augmenting path algorithm for priority matching computes a matching with maximum priority score. It can be implemented to run in O(mn) time. We close by noting that the maximum priority matching is also a max- imum size matching. If it were not, we could find an ordinary augmenting path in the graph that would match two more vertices, giving it higher pri- ority score. 12 4 Closing remarks The maximum size matching problem can be solved in O(mn1/2) time using the algorithms described in [4] for the bipartite case and [5] for the general case. It is possible that one or both of these algorithms could be adapted to handle maximum priority matching. It might also be interesting to consider a weighted version of the problem. In the maximum weight matching problem, we seek a matching that maxi- mizes the sum of the edge weights of the edges in the matching. While one cannot simultaneously maximize the weight and priority score of a matching, one could conceivably maximize the weight of a matching with a specified minimum priority score, or maximize the priority score of a matching with a specified minimum weight. Alternatively, one might associate weights with vertices and find matchings that maximize the weight of matched vertices. References [1] Edmonds, Jack. "Paths, trees and flowers," Canadian Journal of Math- ematics, 1965, pp. 449 -- 467. [2] Gabow, Harold N. "An efficient implementation of Edmonds' algorithm for maximum matching on graphs," Journal of the Association for Com- puting Machinery, 1976, pp. 221 -- 234. [3] Gabow, Harold N and Robert E. Tarjan. "A linear time algorithm for a special case of disjoint set union," ACM Symposium on the Theory of Computing (STOC), 1983, pp. 246-251. [4] Hopcroft, John E. and Richard M Karp. "An O(n5/2 algorithm for maxi- mum matching in bipartite graphs," SIAM Journal on Computing, 1973, pp 225 -- 231. [5] Micali, Silvio. and V. V. Vazirani. "An O((cid:112)V · E) algorithm for finding maximum matchings in general graphs," IEEE Symposium on the Foundations of Computer Science (FOCS), 1980, pp. 17-27. 13 [6] Tarjan, Robert E. Data structures and network algorithms. Society for Industrial and Applied Mathematics, 1983. [7] Turner, Jonathan S. "The bounded edge coloring problem and offline crossbar scheduling," Washington University Computer Science and En- gineering Department technical report, wucs-2015-07, 2015. 14
1611.06589
2
1611
2018-02-25T19:16:36
Fair Division via Social Comparison
[ "cs.DS", "cs.AI", "cs.GT", "math.CO" ]
In the classical cake cutting problem, a resource must be divided among agents with different utilities so that each agent believes they have received a fair share of the resource relative to the other agents. We introduce a variant of the problem in which we model an underlying social network on the agents with a graph, and agents only evaluate their shares relative to their neighbors' in the network. This formulation captures many situations in which it is unrealistic to assume a global view, and also exposes interesting phenomena in the original problem. Specifically, we say an allocation is locally envy-free if no agent envies a neighbor's allocation and locally proportional if each agent values her own allocation as much as the average value of her neighbor's allocations, with the former implying the latter. While global envy-freeness implies local envy-freeness, global proportionality does not imply local proportionality, or vice versa. A general result is that for any two distinct graphs on the same set of nodes and an allocation, there exists a set of valuation functions such that the allocation is locally proportional on one but not the other. We fully characterize the set of graphs for which an oblivious single-cutter protocol-- a protocol that uses a single agent to cut the cake into pieces --admits a bounded protocol with $O(n^2)$ query complexity for locally envy-free allocations in the Robertson-Webb model. We also consider the price of envy-freeness, which compares the total utility of an optimal allocation to the best utility of an allocation that is envy-free. We show that a lower bound of $\Omega(\sqrt{n})$ on the price of envy-freeness for global allocations in fact holds for local envy-freeness in any connected undirected graph. Thus, sparse graphs surprisingly do not provide more flexibility with respect to the quality of envy-free allocations.
cs.DS
cs
Fair Division via Social Comparison Rediet Abebe, Jon Kleinberg, and David C. Parkes Abstract In the classical problem of cake cutting (also known as fair division), a resource must be divided among agents with different utilities so that each agent believes they have received a fair share of the resource relative to the other agents. We introduce a variant of the problem in which there is a graph on the agents modeling an underlying social network, and agents only evaluate their shares relative to their neighbors' in the network. This formulation captures many situations in which it is unrealistic to assume a global view by the agents, and we also find that it exposes interesting phenomena in the original problem. Specifically, we say that an allocation is locally envy-free if no agent envies a neighbor's allocation and locally proportional if each agent values her own allocation as much as the average value of her neighbor's allocations, with the former implying the latter. While global envy-freeness implies local envy-freeness, global proportionality does not imply local proportionaity, or vice versa. A general result is that for any two distinct graphs on the same set of nodes and an allocation, there exists a set of valuation functions such that the allocation is locally proportional on one but not the other. We fully characterize the set of graphs for which an oblivious single-cutter protocol- a protocol that uses a single agent to cut the cake into pieces -admits a bounded protocol for locally envy-free allocations in the Robertson-Webb model, and we give a protocol with O(n2) query complexity. We also consider the price of envy-freeness, which compares the total utility of an optimal allocation to the best utility of an allocation that is envy-free. We show that a lower bound of Ω(√n) on the price of envy-freeness for global allocations [10] in fact holds for local envy-freeness in any connected undirected graph. In this sense, sparse graphs surprisingly do not provide more flexibility with respect to the quality of envy-free allocations. 1 Introduction The fair allocation of resources is a fundamental problem for interacting collections of agents. A central issue in fair allocation is the process by which each agent compares her allotment to those of others'. While theoretical models have tended to focus on global comparisons - in which an agent makes comparisons to the full population - a rich line of empirical work with its origins in the social sciences has suggested that in practice, individuals often focus their comparisons on their social network neighbors. This literature, known as social comparison theory, dates back to work of Festinger [15], and has been explored extensively by economists and sociologists since; for example, see Akerlof [2] and Burt [9]. The primary argument is that in many contexts, an individual's view of their subjective well-being is based on a comparison with peers, defined through an underlying social network structure, rather than through comparison with the overall population [20]. In this work, we find that the perspective of social comparison theory motivates a rich set of novel theoretical questions in classical resource allocation problems. In particular, we consider the cake cutting problem, which refers to the challenge of allocating a single divisible, continuous, 1 good in a fair and efficient manner. The "cake" is intended to stand for a good over which different agents have different preferences for difference pieces. This problem has a wide range of applications including international border settlements, divorce and inheritance settlements, and allocating shared computational resources. Agent preferences are modeled through functions that map subintervals of the [0, 1] interval, which represents the entire cake, to real numbers according to the value the agent assigns to that piece. We normalize these valuations so that each agent's value for the whole cake is 1. The entire cake is to be allocated, but agents need not receive a single, continguous interval (and valuations are additive across pieces). Following our goal of understanding the properties of local comparisons to network neighbors, we study cake cutting in a setting where there is an underlying network on the agents, and fairness considerations are defined locally to an agent's neighbors' in the network. Given a graph G and a cake [0, 1] to be allocated, we define a locally proportional allocation to be one where each agent values her allocation at least as much as the average value from the allocations given to her neighbors in G. We define a locally envy-free allocation to be one where no agent envies the allocation of any neighbor in G. Analogous to graphical games [16], it seems quite plausible that agents may care about fairness within a local part of the population rather than with respect to the population as a whole. As in the global case, it is straightforward to see that a locally envy-free allocation for G is also locally proportional for G. It is also clear that if H is a subgraph of G on the same node set (i.e. if it contains a subset of the edges of G), then a locally envy-free allocation for G must also be locally envy-free for H, since the constraints defining local envy-freeness for G are a superset of the constraints defining local envy-freeness for H. For local proportionality, however, the constraints for different graphs G and H (even when one is a subgraph of the other) can operate quite differently, and so as a first question we ask: Problem 1 For graphs G and H, what is the relationship between the set of locally proportional allocations for G and the set of locally proportional allocations for H? Network topology plays a crucial role in our results. Note that if the network under consider- ation is the complete graph Kn, then the local definitions coincide with their global analogues; in this sense, the local formulations contain the standard definitions as special cases. At the other extreme, if the network is the empty graph In, then any allocation satisfies local envy-freeness and proportionality. In light of this, we can pose the following problem: Problem 2 Are there non-trivial classes of graphs for which we can give efficient protocols for locally envy-free or at least locally proportional allocations? We believe that, in addition to capturing real-world contexts, posing the cake cutting problem on a network will give further insight into the structure of the original problem. We also consider the effect of fairness on welfare as measured through the price of fairness [10]. The price of fairness is defined as the worst case ratio over all inputs between the social welfare of the optimal allocation (the allocation maximizing the sum of agent valuations) and the social welfare of the optimal fair allocation- the envy-free or proportional allocation that maximizes the sum of agent valuations. We will refer to this ratio in the case of envy-free allocations as the price of envy-freeness, and the ratio in the case of proportional allocations as the price of proportionality. When there is an underlying graph G governing the comparisons, these ratios become the price of local envy-freeness and the price of local proportionality for G. We pose the following question: 2 Problem 3 How do the achievable lower and upper bounds on the price of local envy-freeness and local proportionality depend on the structure of the graph G? Caragiannis et al. [10] give an Ω(√n) lower bound for the price of global envy-freeness and proportionality, a matching upper bound of O(√n) for the price of global proportionality, and a loose upper bound of n − 1/2 for the price of global envy-freeness. Overview of Results. With respect to Problem 1, we show that in fact the set of locally proportional allocations do not satisfy any natural containment relations. In particular, for any two distinct connected graphs G and H on the same set of nodes, there exists a set of valuations for the agents and an allocation that is locally proportional for G but not for H. Note that this includes the case where G is the complete graph, and so global proportionality does not imply local proportionality on any other connected graph H. For Problem 2, we start from the structure of the classical Cut-and-Choose solution for two agents: one agent divides the cake and the other selects a piece. This solution does not provide any guarantees for global allocations with more than two agents, but with other underlying graphs G it turns out to have a natural and non-trivial generalization. Specifically, we fully characterize the family of graphs G for which a locally envy-free allocation can be produced a by a protocol in which a single designated node performs all the cuts at the outset, based only on its valuation function. Finally, for Problem 3, we start from the Ω(√n) lower bound on the price of global envy- freeness, which provides a lower bound for the price of local envy-freeness in complete graphs. We show that this Ω(√n) lower bound on the price of local envy-freeness holds in any connected, undirected graph G. We consider this to be surprising, because one might think that sparse graphs provide more flexibility with respect to the quality of envy-free allocations. The known upper bound for the price of global envy-freeness serves as a loose upper bound for the price of local proportionality and the price of local envy-freeness. In outline, Section 2 defines local envy-freeness and local proportionality, and shows that the former implies the latter, and that both are implied by global envy-freeness. This section also establishes a lack of equivalence between global proportionality and either of the two local fairness concepts. Section 3 considers the notion of protocols with a single cutter as described above, and it characterizes the family of graphs (formally, cones of directed acyclic graphs and their subgraphs) for which such a protocol can yield a locally envy-free allocation. Section 4 turns to the price of fairness. We conclude by giving a list of open directions that we hope Problems 1, 2, and 3 will inspire. 1.1 Background on the Cake Cutting Problem Cake cutting algorithms can be traced back to the Hebrew Bible. In the Book of Genesis, when Abraham and Lot decided to separate, they were presented with the challenge of dividing up the land. Abraham suggested to mark the place on which they stand as the cutting point and asks Lot to pick a side. Lot chose the side that is well-watered and Abraham went in the opposite direction. This is precisely the Cut-and-Choose Protocol from above, which has been shown to give envy-free allocations for two agents. The cake cutting problem has a wide range of applications including international border settlements, divorce and inheritance settlements, and allocating shared computational resources. The formal study of the cake cutting problem was initiated in the 1940s due to Banach et al. [7, 17, 26]. Later, Steinhaus observed that the Cut-and-Choose protocol could be extended to three players, and asked whether it can be generalized for any number of agents [7]. This was resolved 3 affirmatively for proportional allocations by Banach et al. [26] and initiated an interesting line of research for envy-free allocations; see Brams and Taylor [7]. See Procaccia [22, 23] for a recent survey from a computer science perspective. A central problem has been finding envy-free protocols. In 1988, Garfunkel [5] even called this among the most important problems in 20th century mathematics. An envy-free protocol for any number of agents was proposed by Brams and Taylor [6], but may need an unbounded number of queries even for four agents. They thus posed the question whether there are bounded, envy-free protocols for n ≥ 4. Aziz and Mackenize [3] recently provided a bounded protocol for n = 4. The case for n > 4 remained open until recently when Aziz and Mackenize announced a discrete and bounded protocol [4]. Although bounded, their solution has a very high multiple- exponential query complexity and it remains an open question whether there are more efficient protocols. The query model was formalized by Roberton and Webb [24]. The focus in this model has been to minimize the number of cut and eval queries. The cut query, formally cut(x, y, α), asks an agent for a cut point x such that the subinterval [x, y] has value α to that agent and the eval query, formally eval(x, y) asks the agent for her ver valuation of the subinterval [x, y]. It is possible to encode all (decentralized) cake cutting protocols using this model. Note that these queries do not result in an allocation themselves but rather provide information about the agents' valuations in order to compute an allocation. The query complexity of a cake cutting problem is thus the worst case number of queries required in order to output an allocation satisfying the desired fairness criteria. Procaccia [21] gives a lower bound of Ω(n2) for envy-free cake cutting, which shows a gap between this and the Θ(n log n) bound known for the proportional cake cutting problem [19]. Special cases of the problem have also received attention. Kurokawa et al. [18] for example establish that an algorithm that computes an envy-free allocation for n agents with piecewise uniform functions using f (n) queries would also be able to compute an envy-free allocation with general valuation functions using at most f (n) queries. Considering only contiguous allocations, Stromquist [27] shows that for any n ≥ 3, there are no finite envy-free cake cutting algorithms, even with an unbounded number of queries. A positive result has been achieved by considering approximately envy-free allocations [22]. An allocation is said to be ǫ-envy-free if each agent values the allocation of any other agent to be at most ǫ more than their own. This relaxation provides a simple algorithm for any n using n⌈1/ǫ⌉ cut queries, as shown in [23]. Alon [1] and Dubins and Spanier [13] also study allocations under alternate notions of fairness. Due to the difficult nature of the envy-free cake cutting problem, researchers have imposed restrictions on different aspects in order to give useful protocols and gain insight into the problem. A few examples are: restricting valuation functions to be only piecewise constant or uniform [18], relaxing envy-freeness to approximate envy-freeness [23], considering partial allocations that simultaneously satisfy envy-freeness and proportionality [11], and limiting allocations to be con- tiguous pieces [27]. Incentive compatibility is not a standard consideration in the cake cutting literature. One important exception is the work of Chen et al. [11], who give a polynomial time algorithm outside of the Robertson-Webb model for finding proportional and envy-free allocations for piecewise uniform valuation functions and any n, while also achieving strategyproofness. To the best of our knowledge, there is no preexisting work on the cake cutting problem in which fairness is determined via comparisons defined by an underlying graph. In perhaps the most closely related paper, Chevaleyre et al. [12] analyze how the network topology of negotiation affects the convergence to an envy-free allocation for multiple indivisible goods. In their setting, agents are only able to negotiate with, and also envy agents that are in their neighborhood. They ask under what conditions a sequence of negotiations can lead to a state where there is 4 no envy. There are a number of differences between this work and ours: first, they consider indivisible goods, which leads to a different set of questions; and second, in their setting the network constrains not just the comparisons that are made in determining fairness, but also the allowable interactions in the division protocol. 2 Relating Global and Local Properties Let N = {1, 2,··· , n} denote the set of agents. The cake is represented using the interval [0, 1] and a piece of cake is a finite union of non-overlapping (interior disjoint) subintervals of [0, 1]. Allocated pieces are a finite union of subintervals. Each agent i has a valuation function Vi that maps subintervals to values in R. Given subinterval [x, y] ⊆ [0, 1], we write Vi(x, y) instead of Vi([x, y]) for simplicity. We assume that valuation functions are additive, non-atomic, and non-negative. Non-atomicity gives us Vi(x, x) = 0 for all x ∈ [0, 1], so we can ignore boundaries when defining cut-points. We normalize valuations so that Vi(0, 1) = 1 for each agent i. Definition 1 (Allocation) An allocation is a partition of the [0, 1] interval into n pieces {A1, A2, . . . , An} such that ∪iAi = [0, 1] and the pieces are pairwise disjoint. Each agent i is assigned the corre- sponding piece Ai. As is standard, this ensures that the entire cake is allocated. If we remove this constraint, then we can have trivial solutions that satisfy fairness, such as assigning each agent nothing in the case of envy-freeness. This assumption is a natural one to make since the valuation functions are assumed to be non-negative and additive and thus satisfy free-disposal. A feasible allocation is one where no subinterval is assigned to more than one agent. In order to avoid direct revelation of valuation functions, which may be cumbersome, cake cutting procedures are typically given as protocols that interact with the agents in order to output a feasible allocation. The Robertson-Webb query model, which is typically used for cake cutting protocols is defined with the following two types of queries: • evali(x, y); this asks agent i for the valuation Vi(x, y). • cuti(x, y, α): given y, α ∈ [0, 1], this asks agent i to pick x ∈ [0, 1] such that Vi(x, y) = α. These queries are used to gather information regarding the valuations of the agents and need not directly determine an allocation. Rather, a cake cutting protocol can use other steps for determining allocations. Definition 2 (Query complexity) The query complexity of a cake cutting protocol is the worst case number of queries that the protocol requires to output an allocation over all possi- ble valuation functions. The query complexity of a cake cutting problem is the minimum query complexity over all known protocols for computing the desired allocation. 2.1 Global and Local Fairness Given a set of agents and an allocation A = (A1, A2,··· , An), we formally define two global fairness criteria: Definition 3 (Proportional, Envy-free) An allocation A is proportional if Vi(Ai) ≥ 1/n, for all i ∈ N , and is envy-free if Vi(Ai) ≥ Vi(Aj ), for all i, j ∈ N . 5 Suppose we are given a directed graph G = (V, E), where the nodes correspond to agents and edges signify relations between the agents. In particular, we assume that given a directed edge (i, j), agent i can view agent j's allocation. Agent i's neighborhood is the set of all nodes to which it has directed edges (i, j), and we denote this set of nodes by Ni. We define i's degree to be di = Ni. We define local analogues for fairness concepts: Definition 4 (Local proportional, local envy free) Given a graph G, an allocation A is for all i and j ∈ Ni and locally envy-free if locally proportional if Vi(Ai) ≥ Vi(Ai) ≥ Vi(Aj ). Pj∈Ni Vi(Aj ) Ni In a locally proportional allocation, each agent assigns as much value to her allocation as the average value she has for a neighbors' allocation. In a locally envy-free allocation, each agent values her allocation at least as much as her neighbors' allocation. When G = Kn, the complete graph on n vertices, these local fairness definitions coincide with their global analogues. Whereas, if G = In, the empty graph on n nodes, then any allocation is trivially locally envy-free. So, the graph topology plays a significant role in computing locally fair allocations. Lemma 2.1 A locally envy-free allocation A on some graph G is also locally envy-free on all subgraphs G′ ⊆ G. Proof We want to show that given a node u and v ∈ Nu, u does not envy v's allocation in G′. This follows from the fact that A is a locally envy-free allocation on G, and if (u, v) is an edge in G′, then it is also an edge in G. One consequence of this lemma is that local envy-freeness is implied by global envy-freeness. Since globally envy-free allocations exist for all sets of agent valuations [1], a locally envy-free allocation exists for every graph G and every set of agent valuations. Lemma 2.2 If an allocation A is locally envy-free on a graph G, then it is also locally propor- tional on the same graph. Proof If an allocation A = (A1, A2, . . . , An) is locally envy-free, then for any i ∈ V , Vi(Ai) ≥ Vi(Aj ),∀j ∈ Ni. Therefore, Vi(Ai) ≥ (Pj∈Ni Vi(Aj))/Ni. Therefore, locally proportional allocations also exist. By considering G = Kn, we also recover that global envy-freeness implies global proportionality. While global envy-freeness implies local envy-freeness, global proportionality does not necessarily imply local proportionality, or vice versa, the former of which violates intuition. We provide a counter example. Example 1 Let n = 4 and G = C4, the cycle graph on 4 nodes, where the nodes are labeled clockwise. Assume agents 2, 3, and 4 have the uniform valuation function Vi(x, y) = y − x for any subinterval (x, y) ⊆ [0, 1]. Let agent 1 have the piecewise uniform valuation function where V1 (0, 1/4) = 1/2 and V1 (3/4, 1) = 1/2, and no value for the remaining subinterval. It is easy to verify that the following allocation is locally proportional on K4, A = ([0, 1/8), [1/8, 3/8), [3/8, 5/8), [5/8, 1]) . In particular, Vi(Ai) = 1/4 for i ∈ {1, 2, 3} and V4(A4) = 3/8. This allocation is however not locally proportional on C4 since V1(A1 ∪ A2 ∪ A4) = 1, but V1(0, 1/8) = 1/4 < 1/3. It is also not locally envy-free since V1(A4) > V1(A1). 6 Global Envy-freeness Local Envy-freeness Global Proportionality Local Proportionality Figure 1: Relationship Between Fairness Concepts We prove a stronger result regarding any pair of distinct graphs. Note by Ni(H) we mean agent i's neighborhood set in graph H. Theorem 2.3 Given any pair of distinct, connected graphs G, H on the same set of nodes, there exists a valuation profile of the agents and an allocation A such that A is locally proportional on G but not on H. Proof First, consider the case where H is a strict subgraph of G. Pick a node i such that Ni(H) < Ni(G). Let Ni(G) = {i1, i2,··· , ik} and Ni(H) = {i1, i2,··· , iℓ} for some ℓ < k. Assume that all other nodes besides i have a uniform valuation function over the entire cake. Then, the allocation Aj = ((j − 1)/n, j/n) is locally proportional from the perspective of every other agent j ∈ N on both H and G. Now, define i's valuation function to be the piecewise uniform valuation function where, Vi ((i − 1)/n, i/n) = 1/(Ni(G) + 1) and Vi(Ai1 ∪ Ai2 ··· ∪ Aiℓ ) = 1 − 1/(Ni(G) + 1). Agent i's valuation for the allocation of nodes {iℓ+1, iℓ+2,··· , ik} as well as V (G)\Ni(G) is 0. This allocation A is therefore locally proportional on G. For A to be locally proportional on H, we need Vi(Ai) ≥ 1/Ni(H). However, since Ni(H) < Ni(G), and Vi(Ai ∪ Ai1 ∪ Ai2 ∪ ··· ∪ Aiℓ ) = 1, we only have that Vi(Ai) < 1/(Ni(H) + 1). Now, suppose H * G. Then, there exists an edge (i, j) in the edge-set of H that is not in the edge-set of G. Assume that all nodes k 6= i have a uniform valuation over the entire cake. Suppose further that we have the allocation where each k is assigned the piece Ak = ((k − 1)/n, k/n). As above, this allocation is locally proportional from the perspective of each agent k on both G and H. Define i's valuation function to be Vi ((j − 1)/n, j/n) = 1 and 0 on the remainder of the cake. Then, Vi(Ai) = 0 and Vi(Ak) = 0 for all k 6= j. Since j /∈ Ni(G), this allocation is locally proportional on G. However, it is not locally proportional on H since Vi (∪ℓ∈NiAℓ) = 1, but Vi(Ai) = 0. 3 Envy-Free Network Allocations In this section, we consider the question of finding efficient protocols for computing locally envy- free allocations. We assume that graphs G are directed, unless specified otherwise. When we mean the component of a directed graph, we will instead take the graph obtained by replacing each directed edge with an undirected one, and a component in the directed graph is the corresponding subgraph to the connected component in the undirected analogue. We will use strongly connected component when we mean to take directed reachability into account. Lemma 3.1 Suppose we have a bounded protocol for computing locally envy-free allocations on G. The same protocol can be used to compute locally envy-free allocations on the following two 7 classes of graphs: (i) H = G ∪ G′ where G and G′ are disjoint components, and (ii) when H is a graph with a directed cut such that every edge across the cut goes from a node in G to a node in H\G = G′. Proof In both instances, we simply apply the protocol on G and allocate agents in G′ the empty allocation. This is a locally envy-free allocation on H, since no two agents in G envy one another by the assumption on the protocol, and no agent envies the allocation of another agent in G′. A few consequences of this lemma are that: given a graph G with more than one connected component, we can reduce the search for a bounded protocol on G to any one of the connected components. Furthermore, if G is a directed acyclic graph (DAG), then there exists at least one node with no incoming edges. Therefore, the allocation where such a node gets the entire cake- or where it is divided among a set of such nodes -is locally envy-free. 3.1 Directed Acyclic Graphs and Their Cones We consider a conceptually useful class of graphs for which we can give a protocol with query complexity of O(n2). Definition Given a graph G = (V, E), we say that G′ is a cone of G if it is the join of G and a single node c, which we call the apex. That is, G′ has node set V ∪ {c}, and edge set consisting of the edges of G, together with undirected edges (u, c) for all u ∈ V . We denote the cone G′ of G by G ⋆ c. We consider cones of DAGs. These are the class of graphs where there is a single node c that lies on all cycles. We now show how to compute a locally envy-free allocation on any graph that is the cone of a DAG. c 2 3 n-1 n Figure 2: Cone of a Directed Acyclic Graph Protocol 1: Cone of DAGs 1: Agent c cuts the cake into n pieces that she values equally. 2: Topologically sort and label the nodes N\{c} such that for every edge (i, j), i ≤ j. 3: Nodes N\{c} pick a piece they prefer most in increasing order of their index. 4: Agent c takes the remaining piece. Theorem 3.2 Given a graph G that is a cone of a DAG, Protocol 1 computes a locally envy-free allocation on G using a bounded number of queries. Proof We first show that the allocation is locally envy-free. First, there is no envy between agent c and any other agent since agent c cuts the cake into n pieces she values equally. Therefore, her 8 valuation for all the allocated pieces is 1/n. Each of the other agents picks a piece before c, and so are able to pick a piece that they value at least as much as the remaining piece that agent c is assigned. Finally, given any directed edge (i, j) such that i, j 6= c, note that Vi(Ai) ≥ Vi(Aj ), since if such an edge exists, then i < j and thus i selects a piece before j. To count the number of queries, the first step requires n − 1 cut queries by agent c. Then, each agent i must perform n − i + 2 eval queries to determine the piece for which they have the highest value. Therefore, the protocol above uses (n2 + 3n − 4)/2 queries. The importance of cones of DAGs can be seen in the following result, which shows that they emerge naturally as the characterization of graphs on which a particular fundamental kind of protocol succeeds. Definition 5 An oblivious single-cutter protocol is one in which a single agent i first divides up the cake into a set of pieces P1, P2, . . . , Pt (potentially t > n), and then all remaining operations consist of agents choosing from among these pieces. The classical Cut-and-Choose protocol is an oblivious single-cutter protocol that works for all sets of valuation functions on the complete, two-node graph K2. Protocol 1 is an oblivious single- cutter protocol which works for any graph that is the cone of a DAG. We show that subgraphs of cones of DAGs are in fact precisely the graphs on which oblivious single-cutter protocols are guaranteed to produce a locally envy-free allocation. Theorem 3.3 If G is a graph for which an oblivious single-cutter protocol produces a locally envy-free allocation for all sets of valuation functions, then G is a subgraph of the cone of a DAG. Proof Suppose, by way of contradiction, that G is not a subgraph of the cone of a DAG, but that there is an oblivious single-cutter protocol on G, in which a node i starts by dividing the cake into pieces using only knowledge of her own valuation function. Since G is not a subgraph of the cone of a DAG, the graph Gi = G\{i} is not acyclic, so there is a cycle C = (c1, c2,··· , cm, c1) in Gv. Let i have a valuation function such that she produces a partition of the cake into pieces P1, P2, . . . , Pt. Because agent i produces these pieces without knowledge of the valuation func- tions of the other agents, we can imagine that we adversarially choose the valuations of the other agents after these pieces have been produced. In particular, consider the valuation functions in which each node cj on the cycle C values piece Pr (for r < t) at 2 · 3−r, and the last piece Pt with the remaining value. These valuations have the property that for each r, the piece Pr is more valuable than the union of all pieces Pr+1 ∪ Pr+2 ∪ ··· ∪ Pt. After the protocol is run, each agent cj on C will get a subset of the pieces produced by i. Let s be the minimum index of any piece allocated to an agent cj on C. Then, the agent cj−1 who has a directed edge to cj will have a union of pieces that she values less than she would value Ps, and hence envies cj. This contradicts the assumption that the protocol produces a locally envy-free allocation on G. We highlight an important connection between computing locally envy-free allocations on graphs and what is known in the literature as irrevocable advantage. Given a partial allocation, an agent i is said to have irrevocable advantage over agent j (or dominate j) if agent i remains unenvious of agent j's allocation even if the entire remaining piece of the cake (the residue) is added to agent j's allocation. With the additional guarantee that each agent dominates some number of other agents, this concept is often used to extend partial globally envy-free allocations to complete ones. For 9 instance, it is a key concept in the Aziz-Mackenize protocol for K4. Their protocol can be decomposed to three subprotocols: Core, Permutation, and Post-Double Domination Protocols, in order. The Core Protocol computes partial envy-free allocation where each agent dominates at least two other agents, while the Post Double Domination Protocol extends this to a complete allocation. We will use Protocol 1 to show that given a partial envy-free allocation on Kn where each agent dominates at least n − 2 other agents, we can extend the allocation to a complete one, thereby generalizing the Post Double Domination Protocol [3] for any n. This is presented in Appendix A. 4 Price of Fairness Finally, we consider the efficiency of allocation from the perspective of local fairness. We follow the approach introduced by Caragiannis et al. [10] of studying the price of envy-freeness, and for this we begin with the following definitions. Recall that for an allocation A into pieces {A1, A2, . . . , An} for the n agents, we use Vi(Ai) to denote agent i's valuation for its piece. Definition 6 (Optimality) An allocation A, is said to be optimal if Pi Vi(Ai) ≥ Pi Vi(Bi) for any allocation B. We denote this optimal allocation by A∗. We define the optimal locally envy-free (resp. optimal locally proportional ) allocations, de- ), analogously by imposing the constraint that A and B be locally noted by ALEF∗ envy-free (resp. locally proportional) and maximizing sum of the values across all agents. (resp. ALP∗ Definition 7 (Price of Local Envy-Freeness, Proportionality) Given an instance of a cake cutting problem on a graph G, the price of local envy-freeness is the ratio, Pi Vi(A∗i ) Pi Vi (cid:0)ALEF∗ i , (cid:1) where the sum is over all agents i ∈ N. We likewise define the price of proportionality by taking the denominator to be Pi Vi (cid:0)ALP∗ (cid:1). i We are measuring the degradation in efficiency when considering allocations that maximize the welfare in both instances under the given constraints. To quantify the loss of efficiency, we are interested in giving a tight lower and upper bound. More specifically, given a graph G and a fairness concept in consideration, say local envy-freeness, we seek to find an input (i.e., a valuation profile) for which the price of local envy-freeness is high. This corresponds to a lower bound on the price of fairness. On the other hand, the upper bound will be given via an argument that shows, for any valuation profile, the price of fairness cannot exceed that stated. The main result on global envy-freeness, due to Caragiannis et al. [10] is an Ω(√n) lower bound on the price of (global) fairness: there exist valuation functions for which the ratio is Ω(√n). (Very little is know about the upper bound for the price of envy-freeness: an upper bound of n is immediate, and the best known upper bound is n − 1/2 [10].) These existing results are for the standard model in which each agent can envy every other agent. Using our graph-theoretic formulation, we can study the price of local fairness. As defined in Section 2, this is the ratio of the total welfare of the optimal allocation to the maximum total welfare of any allocation that is locally envy-free. The numerator of this ratio- based on the optimal allocation -is independent of G, while the denominator is a maximum over a set of allocations that is constrained by G. Now, if we imagine reducing the set of edges in G, the set of allocations eligible for the maximum in the 10 denominator becomes less constrained; consequently, we would expect that the price of fairness may become significantly smaller as G becomes sparser. Is this in fact the case? We show that it is not. Our main result is that the lower bound for global envy-freeness also applies to local envy-freeness on any connected undirected graph. Theorem 4.1 For any connected undirected graph G, there exist valuation functions for which the price of local envy-freeness on G is Ω(√n). To prove this theorem, we start by adapting a set of valuation functions that Caragiannis et al [10] used in their lower bound for global envy-freeness. To argue about their effect on allocations in an arbitrary graph G, we need to reason about the paths connecting agents in G to others with different valuation functions. This, in turn, requires a delicate graph-theoretic definition and argument: we introduce a structure that we term a (k, ε)-linked partition; we show that if G contains this structure, then we can carry out the lower bound argument in G; and finally we show that every connected undirected graph contains a (k, ε)-linked partition. Definition For a connected graph G = (V, E), a natural number k ≥ 1, and a real number 0 < ε ≤ 1, we define a (k, ε)-linked partition as follows. It consists of a set L ⊆ V of size k, and a partition of S = V − L into sets {Si : i ∈ L} each of size at least (εn/k) − 1, such that for each j ∈ Si, there is an i-j path in S ∪ {i}. That is, each j ∈ Si can reach i ∈ L without passing through any other nodes of L. We next show that if a connected undirected graph G has such a structure, with appropriate values of k and ε, then we obtain a lower bound on the price of local envy-freeness on G. Lemma 4.2 If a connected undirected graph G has a (k, ε)-linked partition with k = ⌊√n⌋ and ε, a constant, then there exist valuation functions on the nodes of G for which the price of local envy-freeness is Ω(√n). Proof Suppose G has a (k, ε)-linked partition consisting of L and {Si : i ∈ L}, where k = √n. Thus, each Si has size at least ε√n − 1. (We will assume for the sake of exposition that √n is an integer, although it is straightforward to slightly modify the argument if it is not.) We now use a valuation function adapted from the construction of Caragiannis et al [10], who considered the price of global envy-freeness. We partition the full resource to be allocated, the interval [0, 1], into √n disjoint intervals I1, . . . , I√n. We will give each i ∈ L a valuation vi that places all value on distinct interval Ii, and each j ∈ S a valuation that is uniform on [0, 1]. The optimal allocation for this set of valuations has total welfare of √n, which is achieved by giving each i ∈ L the entire interval where it places value. Now let us consider any envy-free allocation A = {Ai : i ∈ V }. Let µi be a real number denoting the Lebesgue measure of the set Ai assigned to node i. If j ∈ S, then j's valuation for its set, vj (Aj) is equal to µj. If i ∈ L, then i's valuation vi(Ai) is √n times the measure of Ai ∩ Ii; hence vi(Ai) ≤ µi√n. For each i ∈ L, each j ∈ Si has a path Pj to i entirely through nodes of S; let the nodes on this path, beginning at i, be Pj = i, j1, j2, . . . , jd = j. The immediate neighbor j1 of i on Pj must satisfy µj1 ≥ µi, since j1 is in S and hence has a uniform valuation on intervals. For each successive jt on P , we must have µjt = µjt−1 , since jt and jt−1 have the same valuation on all sets, and the allocation is locally envy-free. Thus, by induction we have µjt ≥ µi for all t, and hence µj ≥ µi. We can now derive a set of inequalities that establishes the lower bound. First we have, X j∈Si vj(Aj ) = X j∈Si µj ≥ X j∈Si µi ≥ µi(ε√n − 1). 11 Let us assume n is large enough that ε√n − 1 ≥ ε√n/2, so we have, vj(Aj) ≥ µi(ε√n/2). X j∈Si Since vi(Ai) ≤ µi√n for i ∈ L, we have, X j∈Si vj(Aj ) ≥ εvi(Ai)/2. (1) Thus, the total welfare of the allocation is, X h∈V vj(Aj ) vj(Aj )] vi(Ai) + X j∈S [vi(Ai) + X j∈Si vh(Ah) = X i∈L = X i∈L ≤ X i∈L = (2ε−1 + 1) X i∈L = (2ε−1 + 1) X j∈S vj(Aj )] [(2ε−1 + 1) X j∈Si X j∈Si vj(Aj ) ≤ (2ε−1 + 1), vj(Aj) where the first inequality is by (1) and the second since X j∈S vj (Aj) = X j∈S µj ≤ 1, because all agents in S get disjoint intervals. Since (2ε−1 + 1) is a constant, while the optimal allocation has total welfare √n, this implies an Ω(√n) lower bound for the price of envy-freeness on G. Finally, we establish that every connected undirected graph G has a (k, ε)-linked partition for appropriate values of k and ε. We begin by showing that it is enough to find a structure satisfying a slightly more relaxed definition, in which the set L can have more than k elements, and we do not need to include all the nodes of G. Specifically, we have the following definition: Definition For a connected graph G = (V, E), a natural number k ≥ 1, and a real number 0 < ε ≤ 1, we define a (k, ε)-linked subpartition as follows. It consists of a set L ⊆ V of size ℓ ≥ k, together with disjoint subsets S1, S2, . . . , Sℓ ⊆ S = V − L, each of size of size at least (εn/k) − 1, such that for each j ∈ Si, there is an i-j path in S ∪ {i}. The following lemma says that it is sufficient to find a (k, ε)-linked subpartition. Lemma 4.3 If a connected undirected graph G contains a (k, ε)-linked subpartition, then it con- tains a (k, ε)-linked partition. Proof We start with a (k, ε)-linked subpartition of G, with disjoint sets L of size ℓ ≥ k, and S1, S2, . . . , Sℓ ⊆ S = V − L. First, for every node v 6∈ L∪ S, we assign it to a subset Si as follows: we find the shortest path from v to any node in L; suppose it is to i ∈ L. We add v to Si. Note 12 that this preserves the property that all Si are disjoint, and v has a path to i that does not meet any other node of L, since if h ∈ L were to lie on this path, it would be closer to v than i is. At this point, every node of G belongs to L∪ S. We now must remove nodes from L to reduce its size to exactly k while preserving the properties of a (k, ε)-linked partition. To do this, we choose a node i ∈ L arbitrary, remove i from L, and remove the set Si from the collection of subsets. We then assign each node in Si ∪{i} to an existing subset Sh exactly as in the previous paragraph. After this process, the size of L has been reduced by 1, and we still have a partition of V − L into subsets Si with the desired properties. Continuing in this way, we can reduce the size of L to exactly k, at which point we have a (k, ε)-linked partition. Finally, we prove the following graph-theoretic result, which together with Lemma 4.2 estab- lishes Theorem 4.1. Theorem 4.4 For every k ≥ 2 and with ε = 1/2, every connected undirected graph has a (k, ε)- linked subpartition. Proof It is enough to find the required structure on a spanning tree T of G, since if the paths required by the definition exist in T , then they also exist in G. Thus, it is sufficient to prove the result for an arbitrary tree T . We root T at an arbitrary node, and let X be the set of leaves of T . If X ≥ k, then we can choose any k leaves of T and partition the remaining nodes of T arbitrarily into sets of size (n − k)/k to satisfy the definition. Otherwise, X < k. In this case, we begin by including all nodes of X in L. Now, we process the nodes of T , working upward from the leaves, so that when we get to a node v in T , we have already processed all descendents of v. Each node is processed once, and at that point we decide whether to add it to L, and if not which set Si to place it in, given the current set L. For a node v, we say that w is downward-reachable from v if w is a descendent of v, and if the v-w path in T does not contain any internal nodes belonging to L. When we process a node v, we do one of two things: (i) We label v with the name of a node in L that is downward-reachable from v; or (ii) We place v in L. Let b = (εn/k) − 1. We perform action (i) if there is any w ∈ L that is downward-reachable from v, such that there are not yet b nodes labeled with w. In this case, we label v arbitrarily with one such w. Since v and all its descendents are now processed, v will continue to have a path to w that does not pass through any other nodes of L. Otherwise suppose there is no such w; that is, all w ∈ L that are downward-reachable from v have b nodes labeled with w. In this case, we perform action (ii). Note that at this point, every w ∈ L that is a descendent of v has a set Sw of exactly b nodes, and these nodes can all reach w without passing through any other node of L. Our procedure comes to an end when we process the root node v∗. There are three cases to consider, the first two of which are straightforward. First, if we place v∗ into L, then T − v∗ is partitioned into L and sets {Sw : w ∈ L} such that Sw = b for each w. Thus, if we remove v∗ from L, we have a (k, ε)-linked subpartition, since the sets Sw are disjoint and of size at least b, and L = (n − 1)/((εn/k) − 1) ≥ (n/(εn/k)) = k/ε > k. Otherwise, v∗ is labeled with some downward-reachable u ∈ L. Our second case, which is also straightforward, is that after this labeling of the root, all sets Sw for w ∈ L have size exactly b, then we have a (k, ε)-linked subpartition. 13 L1 + X w∈L1 Sw < k + kb = k(b + 1) = kn/(2k) = n/2. If not, then we are in the third case: v∗ is labeled with some downward-reachable u ∈ L, and after this labeling there still exist downward-reachable nodes w that we have placed in L that do not have associated sets Sw of size b. We therefore need to prune our set L to a smaller set that has Sw ≥ b for each w ∈ L. The goal is to show that the smaller L we end up with still has enough elements; if that holds, then we have a (k, ε)-linked subpartition. To show this, we proceed as follows. We say that w ∈ L is active if Sw < b. We first observe that any active w must be downward-reachable from the root v∗. Indeed, if w is active and not downward-reachable from the root, then there is a v ∈ L such that w is a descendent of v. But in the step when we placed v in L, it was not possible to label v with w, and hence we must have had Sw = b at that point. Next we claim that there are < k active w ∈ L. To prove this, for each active w, we associate w with a leaf that is a descendent of w. (This can be w itself if w is a leaf.) Observe that the same leaf x cannot be associated with two distinct active w, w′, for then on the path from v∗ to x, one of w or w′ would be closer to v∗, and the other would not be downward-reachable from v∗. Given that we can associate a distinct leaf to each active w, and there are < k leaves, there are < k active w ∈ L. inactive nodes of L and L1 be the active nodes of L. We have We say that a node w ∈ L is inactive if it is not active; that is, if Sw = b. Let L0 be the L0 + X w∈L0 Sw + L1 + X w∈L1 Sw = n. We know that L1 < k and Sw < b for each w ∈ L1; hence, using the fact that ε = 1/2, we have It follows that L0 + Pw∈L0 Sw > n/2. But since Sw = b for each w ∈ L0, we have n/2 < L0 + X w∈L0 Sw = L0(1 + b) = L0n/(2k), from which it follows that L0 > k. We now conclude the construction by declaring L to be L0; since the sets Sw for w ∈ L0 are all pairwise disjoint and each has size at least b, we have the desired (k, ε)-linked subpartition. 5 Conclusion and Future Work We have introduced a new line of inquiry for the envy-free and proportional cake cutting problems by considering local notions of fairness. We show interesting relations between these local fairness concepts and their global analogues. Besides introducing this new model, our main contribution has been to fully classify the class of graphs for which there is an oblivious single-cutter protocol for computing locally envy-free allocations. Furthermore, we quantify the degredation in welfare resulting from adding the local envy-freeness constraint on the allocations; in particular, we show that the known Ω(√n) lower-bound for the (global) price of envy-freeness continues to hold even for sparse graphs. It is of interest to give efficient protocols for computing locally envy-free allocations on rich classes of graphs without the single-cutter constraint. Since local envy-freeness is a stronger condition than local proportionality, the same problem can also be considered for locally propor- tional allocations. Finally, whether there is a similar lower bound of Ω(√n) for the price of local proportionality is an open question. Currently, the upper bound for both local fairness concepts is the loose n − 1/2 bound, and giving tighter bounds is another direction. 14 Acknowledgements The first author would like to thank Felix Fischer for the introduction to the cake cutting problem. We would also like to thank Rahmtin Rotabi for insights for the proof of Theorem 4.4 as well as Barabra Grosz, Radhika Nagpal, Ariel Procaccia, Ofra Amir, and Adam Brauer for helpful discussions and references. References [1] Noga Alon. Splitting necklaces. Advances in Mathematics, 63(3):247–53, 1987. [2] George Akerlof. Social distance and social decisions. Econometrica, 65(2):1005-1028, 1997. [3] Haris Aziz and Simon Mackenzie. A discrete and bounded envy-free cake cutting protocol for four agents. CoRR, abs/1508.05143, August 2015. [4] Haris Aziz and Simon Mackenzie. A discrete and bounded envy-free cake cutting protocol for any agents. CoRR, abs/1604.03655, April 2016. [5] Joseph Blatt, Stephanie Stewart, and Sol Garfunkel. More equal than others: Weighted voting ; zero sum games: Games of conflict. Technical report, Annenberg/CPB Project, 1986. [6] Steven Brams and Alan Taylor. An envy-free cake division protocol. American Mathematical Monthly, 102(1):9–18, 1995. [7] Steven Brams and Alan Taylor. Fair Division: From Cake Cutting to Dispute Resolution. Cambridge University Press, Cambridge, 1996. [8] Simina Brazei, Ariel Procaccia, and Jie Zhang. Externalities in cake cutting. Proceedings of the 23rd International Joint Conference on Artificial Intelligence, IJCAI'12, pages 55–61, Beiging, China, 2013. [9] Ronald Burt.The shadow of other people: socialization and social comparison in marketing. In S. Wuyt, M. Dekimpe, E. Gijsbrechts, and R. Peters, editors, The Connected Customer. Taylor and Francis, 2010. [10] Ioannis Caragiannis, Christis Kaklamanis, Panagiotis Kanellopoulos, and Maria Kyropoulou. The efficiency of fair division. Theory of Computing Systems, 50, May 2012. [11] Yiling Chen, John Lai, David Parkes, and Ariel Procaccia. Truth, justice, and cake cutting. Games and Economic Behavior, 77, January 2013. [12] Yann Chevaleyre, Ulle Endriss, and Nicolas Maudet. Allocating goods on a graph to elimi- nate envy. In In Proceedings of AAAI-07, pages 700–705, 2007. [13] Lester Dubins and E.H. Spanier. how to cut a cake fairly. American Mathematical Monthly, 68(1):1–17, 1961. [14] S. Evan and A. Paz. A note on cake cutting. Discrete Applied Mathematics, 7(3):285–96, 1984. [15] Leon Festinger. A theory of social comparison process. Human Relations,7(2), 1954. 15 [16] Michael Kearns. Graphical games. In Noam Nisan, Tim Roughgarden, ´Eva Tardos, and Vijay Vazirani, editors, Algorithmic Game Theory, chapter 7. Cambridge University Press, 2007. [17] B. Knaster. Sur le probleme du partage pragmatique de h. steinhaus. Annales de la Societe Polonaise de Mathematique, 19:228–230, 1946. [18] David Kurokawa, John Lai, and Ariel Procaccia. How to cut a cake before the party ends. In AAAI Conference on Artificial Intelligence, 2013. [19] Malik Magdon-Ismail, Costas Busch, and Mukkai Krishnamoorthy. Cake-cutting is not a piece of cake. In Proc. 20th Annual Symposium on Theoretical Aspects of Computer Science, pages 596–607, 2003. [20] Michael McBridge.Relative-income effects on subjective well-being in the cross section.Jour- nal of Economic Behavior and Organization, 45(3): 251-278, 2001. [21] Ariel Procaccia. Thou shalt covet thy neighbor's cake. In Proceedings of the 21st Interna- tional Joint Conference on Artifical Intelligence, IJCAI'09, pages 239–244, San Francisco, CA, USA, 2009. Morgan Kaufmann Publishers Inc. [22] Ariel Procaccia. Cake cutting. Communications of the ACM, 56(7), 2013. [23] Ariel Procaccia. Cake cutting algorithms. In F. Brandt, V. Conitzer, U. Endriss, J. Lang, and A.D. Procaccia, editors, Handbook of Computational Social Choice. Cambridge University Press, 2016. [24] Jack Robertson and William Webb. Cake Cutting Algorithms: Be Fair If You Can. A.K. Peters Ltd., London, 1998. [25] Erel Segal-Halevi, Avinatan Hassidim, and Yonatan Aumann. Waste makes haste: bounded time algorithms for envy-free cake cutting with free disposal. CoRR, abs/1511.02599, De- cember 2015. [26] Hugo Steinhaus. The problem of fair division. Econometrica, 16:101–104, 1948. [27] Walter Stromquist. Envy-free cake divisions cannot be found by finite protocols. The Electronic Journal of Combinatorics, 15(R11), 2008. 16 A Taking Advantage of Irrevocable Advantage Given a partial envy-free allocation, an agent i is said to dominate an agent j, if i remains envy-free of j even if the entire residue (the remaining subinterval of the cake) is allocated to j. We can thus define: Definition 8 A domination graph on n is a graph where V is the set of agents and there is a directed edge (i, j) if i has irrevocable advantage over j. Constraints on the number of agents each agent must dominate at a certain stage in the protocol can be used to extend partial envy-free allocations to complete ones. One salient example is the Aziz-Mackenzie protocol for K4, where they obtain a partial envy-free allocation using what they call the Core Protocol and the Permutation Protocol such that each agent is guaranteed to dominate at least two other agents. They then use the Post-Double Domination Protocol to extend this to a complete envy-free allocation. We generalize this protocol to any n. That is, given a partial envy-free allocation such that each agent dominates n − 2 other agents, we can apply Protocol 1 to extend the allocation to a complete allocation. This provides an alternate proof to a recent paper by Segal-Halevi et al. [25]. We first define a special class of graphs. Definition 9 A pseudoforest is a graph where each vertex has at most one outgoing edge. Each component of a pseudoforest is a subgraph of a cone of a DAG; since each node has at most one outgoing edge, there are at most n edges. If there are fewer than n, then it is a DAG. If there are exactly n, then there exists a cycle. Find this cycle and remove an edge e = (u, v) from the cycle. The resulting graph will be a DAG, and we can therefore Protocol 1 by setting u = c. This makes the protocol key to extending partial envy-free allocations to complete ones under particular domination criteria. Lemma A.1 We can extend a partial globally envy-free allocation in which each agent dominates at least n − 2 other agents to a complete, envy-free allocation. Proof Suppose we have a partial globally envy-free allocation (P1, P2,··· , Pn), with residue R. If each agent dominates at least n−2 other agents, then the complement of the domination graph, denoted by Gc, is a pseudoforest. We apply Protocol 1 on Gc using residue R and denote this allocation by (R1, R2,··· , Rn). We want to show that (P1∪R1, P2∪R2,··· , Pn∪Rn) is a globally envy-free allocation. Suppose it is not. Then, there exists i, j such that Vi(Pi∪Ri) < Vi(Pj ∪Rj ), but this is only possible if either Vi(Pi) < Vi(Pj ) or Vi(Ri) < Vi(Rj ). The assumption that each agent dominates at least n − 2 agents is necessary. In particular, suppose that there exists one agent that dominates only n− 3 other agents, such as in Example 2. 1 2 3 n-2 n-1 n Figure 3: Counterexample to the extension lemma. 17 Example 2 Suppose that each agent i 6= 2 dominates every other agent but agents i + 1 mod n and that agent 2 dominates agents {4, 5,··· , n}. The domination graph is given in Figure 3. The complement of the domination graph is the cycle graph (1, 2, 3,··· , n, 1) plus the edge (2, 1). It therefore consists of more than one simple cycle, and hence a direct application of Protocol 1 to the complement of the domination graph will not extend a partial allocation to a complete allocation. 18
1102.1273
1
1102
2011-02-07T11:09:34
One to Rule Them All: a General Randomized Algorithm for Buffer Management with Bounded Delay
[ "cs.DS" ]
We give a memoryless scale-invariant randomized algorithm for the Buffer Management with Bounded Delay problem that is e/(e-1)-competitive against an adaptive adversary, together with better performance guarantees for many restricted variants, including the s-bounded instances. In particular, our algorithm attains the optimum competitive ratio of 4/3 on 2-bounded instances. Both the algorithm and its analysis are applicable to a more general problem, called Collecting Items, in which only the relative order between packets' deadlines is known. Our algorithm is the optimal randomized memoryless algorithm against adaptive adversary for that problem in a strong sense. While some of provided upper bounds were already known, in general, they were attained by several different algorithms.
cs.DS
cs
One to Rule Them All: A General Randomized Algorithm for Buffer Management with Bounded Delay Lukasz Jez∗ August 28, 2018 Abstract We give a memoryless scale-invariant randomized algorithm Mix-R for buffer management with bounded delay that is e/(e − 1)-competitive against an adaptive adversary, together with better performance guar- antees for many restricted variants, including the s-bounded instances. In particular, Mix-R attains the optimum competitive ratio of 4/3 on 2-bounded instances. Both Mix-R and its analysis are applicable to a more general problem, called Collecting Items, in which only the relative order between packets' deadlines is known. Mix-R is the optimal memoryless randomized algo- rithm against adaptive adversary for that problem in a strong sense. While some of provided upper bounds were already known, in general, they were attained by several different algorithms. 1 Introduction In this paper, we consider the problem of buffer management with bounded delay, introduced by Kesselman et al. [16]. This problem models the behavior of a single network switch responsible for scheduling packet transmissions along an outgoing link as follows. We assume that time is divided into unit-length steps. At the beginning of a time step, any number of packets may arrive at a switch and be stored in its buffer. Each packet has a positive weight, corresponding to the packets priority, and a deadline, which specifies the latest time when the packet can be transmitted. Only one packet from the buffer can be transmitted in a single step. A packet is removed from the buffer upon transmission or expiration, i.e., reaching its deadline. The goal is to maximize the gain, defined as the total weight of the packets transmitted. We note that buffer management with bounded delay is equivalent to a schedul- ing problem in which packets are represented as jobs of unit length, with given release times, deadlines and weights; release times and deadlines are restricted to integer values. In this setting, the goal is to maximize the total weight of jobs completed before their respective deadlines. ∗University of Wroc law. Work supported by MNiSW grant N N206 490638, 2010 -- 2011. 1 As the process of managing packet queue is inherently a real-time task, we model it as an online problem. This means that the algorithm, when deciding which packets to transmit, has to base its decision solely on the packets which have already arrived at a switch, without the knowledge of the future. 1.1 Competitive Analysis To measure the performance of an online algorithm, we use the standard notion of competitive analysis [6], which, roughly speaking, compares the gain of the algorithm to the gain of the optimal solution on the same instance. For any algorithm Alg, we denote its gain on instance I by GAlg(I). The optimal offline algorithm is denoted by Opt. We say that a deterministic algorithm Alg is R-competitive if on any instance I it holds that GAlg(I) ≥ 1 R · GOpt(I). When analyzing the performance of an online algorithm Alg, we view the process as a game between Alg and an adversary. The adversary controls what packets are injected into the buffer and chooses which of them to send. The goal is then to show that the adversary's gain is at most R times Alg's gain. If the algorithm is randomized, we consider its expected gain, E[GAlg(I)], where the expectation is taken over all possible random choices made by Alg. However, in the randomized case, the power of the adversary has to be further specified. Following Ben-David et al. [3], we distinguish between an oblivious and an adaptive-online adversary, which from now on we will call adaptive, for short. An oblivious adversary has to construct the whole instance in advance. This instance may depend on Alg but not on the random bits used by Alg dur- ing the computation. The expected gain of Alg is compared to the gain of the optimal offline solution on I. In contrast, in case of an adaptive adversary, the choice of packets to be injected into the buffer may depend on the algorithm's behavior up to the given time step. This adversary must also provide an an- swering entity Adv, which creates a solution in parallel to Alg. This solution may not be changed afterwards. We say that Alg is R-competitive against an adaptive adversary if for any adaptively created instance I and any answering algorithm Adv, it holds that E[GAlg(I)] ≥ 1 R · E[GAdv(I)]. We note that Adv is (wlog) deterministic, but as Alg is randomized, so is the instance I. In the literature on online algorithms [6], the definition of the competitive ratio sometimes allows an additive constant, i.e., a deterministic algorithm is then called R-competitive if there exists a constant α ≥ 0 such that for any instance I it holds that GAlg(I) ≥ 1 R · GOpt(I) − α. An analogous definition applies to the randomized case. For our algorithm Mix-R the bound holds for α = 0, which is the best possible. 1.2 Basic Definitions We denote a packet with weight w and relative deadline d by (w, d), where the relative deadline of a packet is, at any time, the number of steps after which it expires. The packet's absolute deadline, on the other hand, is the exact point in time at which the packet expires. a packet that is in the buffer, i.e., has already been released and has neither expired nor been transmitted by an algorithm, is called pending for the algorithm. The lifespan of a packet is its relative deadline value upon injection, or in other words the difference between its absolute deadline and release time. 2 The goal is to maximize the weighted throughput, i.e., the total weight of transmitted packets. We assume that time is slotted in the following way. We distinguish between points in time and time intervals, called steps. In step t, corresponding to the interval (t, t + 1), Adv and the algorithm choose, inde- pendently, a packet from their buffers and transmit it. The packet transmitted by the algorithm (Adv) is immediately removed from the buffer and no longer pending. Afterwards, at time t + 1, the relative deadlines of all remaining pack- ets are decremented by 1, and the packets whose relative deadlines reach 0 expire and are removed from both Adv's and the algorithm's buffers. Next, the adversary injects any set of packets. At this point, we proceed to step t + 1. To no surprise, all known algorithms are scale-invariant, which means that they make the same decisions if all the weights of packets in an instance are scaled by a positive constant. a class of further restricted algorithms is of special interest for their simplicity. An algorithm is memoryless if in every step its decision depends only on the set of packets pending at that step. An algorithm that is both memoryless and scale-invariant is called memoryless scale-invariant. 1.3 Previous and Related Work, Restricted Variants The currently best, 1.828-competitive, deterministic algorithm for general in- stances was given by Englert and Westermann [10]. Their algorithm is scale- invariant, but it is not memoryless. However, in the same article Englert and Westermann provide another, 1.893-competitive, deterministic algorithm that is memoryless scale-invariant. The best known randomized algorithm is the 1.582- competitive memoryless scale-invariant RMix, proposed by Chin et al. [7]. For reasons explained in Section 2.1 the original analysis by Chin et al. is only appli- cable in the oblivious adversary model. However, a refined analysis shows that the algorithm remains 1.582-competitive in the adaptive adversary model [14]. Consider a (memoryless scale-invariant) greedy algorithm that always trans- mits the heaviest pending packet. It is not hard to observe that it is 2-competitive, and actually no better than that. But for a few years no better deterministic algorithm for the general case was known. This naturally led to a study of many restricted variants. Below we present some of them, together with known results. The most relevant bounds known are summarized in Table 1. Note that the majority of algorithms are memoryless scale-invariant. For a general overview of techniques and results on buffer management, see the surveys by Azar [2], Epstein and Van Stee [11] and Goldwasser [12]. Uniform Sequences An instance is s-uniform if the lifespan of each packet is exactly s. Such instances have been considered for two reasons. Firstly, there is a certain connection between them and the FIFO model of buffer management, also considered by Kesselmann et al. [16]. Secondly, the 2-uniform instances are among the most elementary restrictions that do not make the problem trivial. However, analyzing these sequences is not easy: while a simple deterministic 1.414-competitive algorithm for 2-uniform instances [18] is known to be optimal among memoryless scale-invariant algorithms [7], for unrestricted algorithms a sophisticated analysis shows the optimum competitive ratio is 1.377 [9]. Bounded Sequences An instance is s-bounded if the lifespan of each packet is at most s; therefore every s-uniform instances is also s-bounded. This class of in- 3 general s-bounded 2-bounded upper lower upper lower upper lower deterministic (rand.) adaptive (rand.) oblivious 1.828 [10], 1.893∗ [10] 1.618 1.582∗ [14] 1.333 1.582∗ [7] 1.25 s + o( 1 s )∗ [7] 2 − 2 1.618 1.618∗ [16] 1.618 [1, 8, 13] 1/(cid:0)1 − (1 − 1.333 1 s )s(cid:1)∗ 1.333∗ [5] 1.333 [5] 1/(cid:0)1 − (1 − 1 1.25 s )s(cid:1)∗ 1.25∗ [7] 1.25 [8] Table 1: Comparison of known and new results. The results of this paper are shown in boldface; a reference next to such entry means that this particular bound was already known. The results without citations are implied by other entries of the table. An asterisk denotes that the algorithm attaining the bound is memoryless scale-invariant. stances is important, because the strongest lower bounds on the competitive ra- tio known for the problem employ 2-bounded instances. These are φ ≈ 1.618 for deterministic algorithms [1, 8, 13], 1.25 for randomized algorithms in the obliv- ious adversary model [8], and 4/3 in the adaptive adversary model [5]. For 2- bounded instances algorithms matching these bounds are known [16, 7, 5]. A φ- competitive deterministic algorithm is also known for 3-bounded instances [7], but in general the best algorithms for s-bounded instances are only known to be 2 − 2/s + o(1/s)-competitive [7]. Similarly Ordered Sequences An instance is similarly ordered or has agree- able deadlines if for every two packets i and j their spanning intervals are not properly contained in one another, i.e., if ri < rj implies di ≤ dj. Note that every 2-bounded instance is similarly ordered, as is every s-uniform instance, for any s. An optimal deterministic φ-competitive algorithm [17] and a ran- domized 4/3-competitive algorithm for the oblivious adversary model [15] are known. With the exception of 3-bounded instances, this is the most general class of instances for which a φ-competitive deterministic algorithm is known. Other restrictions Among other possible restrictions, let us mention one for which our algorithm provides some bounds. Motivated by certain trans- mission protocols, which usually specify only several priorities for packets, one might bound the number of different packet weights. In fact, Kesselmann et al. considered deterministic algorithms for instances with only two distinct packet weights [16]. Generalization: Collecting Weighted Items from a Dynamic Queue Bienkowski et al. [4] studied a generalization of buffer management with bounded delay, in which the algorithm knows only the relative order between packets' deadlines rather than their exact values; after Bienkowski et al. we dub the generalized problem Collecting Items. Their paper focuses on deterministic al- gorithms but it does provide certain lower bounds for memoryless algorithms, matched by our algorithm. See Appendix A for details. 4 1.4 Our Contribution We consider randomized algorithms against an adaptive adversary, motivated by the following observation. In reality, traffic through a switch is not at all independent of the packet scheduling algorithm. For example, lost packets are typically resent, and throughput through a node affects the choice of routes for data streams in a network. These phenomena can be captured by the adaptive adversary model but not by the oblivious one. The adaptive adversary model is also of its own theoretical interest and has been studied in numerous other settings [6]. The main contribution of this paper is a simple memoryless scale-invariant algorithm Mix-R, which may be viewed as RMix, proposed by Chin et al. [7], with a different probability distribution over pending packets. The competitive ratio of Mix-R is at most e/(e − 1) on the one hand, but on the other it is provably better than that for many restricted variants of the problem. Some of the upper bounds we provide were known before (cf. Table 1), but in general they were achieved by several different algorithms. versary, where N is the maximum, over steps, number of packets that have Specifically, Mix-R is 1/(cid:0)1 − (1 − 1 positive probability of transmission in the step. Note that 1/(cid:0)1 − (1 − 1 N )N(cid:1)-competitive against adaptive ad- N )N(cid:1) tends to e/(e − 1) from below. The number N can be bounded a priori in certain restricted variants of the problem, thus giving better bounds for them, as we discuss in detail in Section 2.4. For now let us mention that N ≤ s in s-bounded instances and instances with at most s different packet weights. The particular upper bound of 4/3 that we obtain for 2-bounded instances is tight in the adaptive adversary model [5]. As is the case with RMix, both Mix-R and its analysis rely only on the rel- ative order between the packets' deadlines. Therefore our upper bound(s) apply to the Collecting Items problem [4]. In fact, Mix-R is the optimum randomized memoryless algorithm for that problem in a strong sense, cf. Appendix A. 2 General Upper Bound 2.1 Analysis technique In our analysis, we follow the paradigm of modifying the adversary's buffer, introduced by Li et al. [17]. Namely, we assume that in each step the algorithm and the adversary have precisely the same pending packets in their buffers. Once they both transmit a packet, we modify the adversary's buffer judiciously to make it identical with that of the algorithm. This amortized analysis technique leads to a streamlined and intuitive proof. When modifying the buffer, we may have to let the adversary transmit an- other packet, inject an extra packet to his buffer, or upgrade one of the packets in its buffer by increasing its weight or deadline. We will ensure that these changes will be advantageous to the adversary in the following sense: for any adversary strategy Adv, starting with the current step and buffer content, there is an adversary strategy Adv that continues computation with the modified buffer, such that the total gain of Adv from the current step on (inclusive), on any instance, is at least as large as that of Adv. 5 To prove R-competitiveness, we show that in each step the expected amor- tized gain of the adversary is at most R times the expected gain of the algorithm, where the former is the total weight of the packets that Adv eventually trans- mitted in this step. Both expected values are taken over random choices of the algorithm. We are going to assume that Adv never transmits a packet a if there is another pending packet b such that transmitting b is always advantageous to Adv. Formally, we introduce a dominance relation among the pending packets and assume that Adv never transmits a dominated packet. We say that a packet a = (wa, da) is dominated by a packet b = (wb, db) at time t if at time t both a and b are pending, wa ≤ wb and da ≥ db. If one of these inequalities is strict, we say that a is strictly dominated by b. We say that packet a is (strictly) dominated whenever there exists a packet b that (strictly) dominates it. Then the following fact can be shown by a standard exchange argument. Fact 1. For any adversary strategy Adv, there is a strategy Adv with the following properties: 1. the gain of Adv on every sequence is at least the gain of Adv, 2. in every step t, Adv does not transmit a strictly dominated packet at time t. Proof. Adv can be transformed into Adv iteratively: take the minimum t0 such that Adv first violates the second property in step t0, and transform Adv into an algorithm Adv′ with gain no smaller than that of Adv, which satisfies the second property up to step t0, possibly violating it in further steps. Let t0 be the first step in which the second property is violated. Let y = (w, d) be the packet transmitted by Adv and x = (w′, d′) be the packet that dominates y; then w′ ≥ w and d′ ≤ d. Let Adv′ transmit the same packets as Adv up to step t0 − 1, but in step t0 let it transmit x, and in the remaining steps let it try to transmit the same packets as Adv. It is impossible in one case only: when Adv transmits x in some step t. But then d ≥ d′ > t, so let Adv′ transmit y, still pending at t. Clearly, the gain of Adv′ is at least as large as the gain of Adv. Let us stress that Fact 1 holds for the adaptive adversary model. Now we give an example of another simplifying assumption, often assumed in the oblivious adversary model, which seems to break down in the adaptive adversary model. In the oblivious adversary model the instance is fixed in advance by the adversary, so Adv may precompute the optimum schedule to the instance and follow it. Moreover, by standard exchange argument for the fixed set of packets to be transmitted, Adv may always send the packet with the smallest deadline from that set -- this is usually called the earliest deadline first (EDF) property or order. This assumption not only simplifies analyses of algorithms but is often crucial for them to yields desired bounds [7, 9, 17, 15]. In the adaptive adversary model, however, the following phenomenon occurs: as the instance I is randomized, Adv does not know for sure which packets it will transmit in the future. Consequently, deprived of that knowledge, it cannot ensure any specific order of packet transmissions. 6 2.2 The Algorithm We describe the algorithm's behavior in a single step. Algorithm 1 Mix-R (single step) do nothing and proceed to the next step 1: if there are no pending packets then 2: 3: end if 4: m ← 0 5: n ← 0 6: r ← 1 7: H0 ← pending packets 8: h0 = (w0, d0) ← heaviest packet from H0 9: while Hm 6= ∅ do 10: ⊲ counts packets that are not strictly dominated ⊲ counts packets with positive probability assigned ⊲ unassigned probability 11: 12: 13: 14: 15: 16: m ← m + 1 hm = (wm, dm) ← heaviest not strictly dominated packet from Hm−1 pm−1 ← min{1 − wm wm−1 r ← r − pm−1 if r > 0 then n ← n + 1 , r} end if Hm ← {x ∈ Hm−1 x is not dominated by hm} 17: 18: end while 19: pm ← r 20: transmit h chosen from h1, . . . , hn with probability distribution p1, . . . , pn 21: proceed to the next step We introduce the packet h0 to shorten Mix-R's pseudocode by making it possible to set the value of p1 in the first iteration of the loop. The packet itself is chosen in such a way that p0 = 0, to make it clear that it is not considered for transmission (unless h0 = h1). The while loop itself could be terminated as soon as r = 0, because afterwards Mix-R does not assign positive probability to any packet. However, letting it construct the whole sequence h1, h2, . . . hm such that Hm = ∅ simplifies our analysis. Before proceeding with the analysis, we note a few facts about Mix-R. Fact 2. The sequence of packets h0, h1, . . . , hm selected by Mix-R satisfies w0 = w1 > w2 > · · · > wm , d1 > d2 > · · · > dm . Furthermore, every pending packet is dominated by one of h1, . . . , hm. Fact 3. The numbers p1, p2, . . . , pm form a probability distribution such that pi ≤ 1 − wi+1 wi for all i < m . Furthermore, the bound is tight for i < n, while pi = 0 for i > n, i.e., pi =(1 − wi+1 0, wi for i < n for i > n , 7 (1) (2) Theorem 4. Mix-R is 1/(cid:0)1 − (1 − 1 versary, where N is the maximum, over steps, number of packets that are as- signed positive probability in a step. N )N(cid:1)-competitive against an adaptive ad- Proof. For a given step, we describe the changes to Adv's scheduling decisions and modifications to its buffer that make it the same as Mix-R's buffer. Then, to prove our claim, we will show that E [GAdv] ≤ w1 , E [GMix-R] ≥ w1(cid:18)1 − (1 − 1 n )n(cid:19) , (3) (4) where n is the number of packets assigned positive probability in the step. The theorem follows by summation over all steps. Recall that, by Fact 1, Adv (wlog) sends a packet that is not strictly dom- inated. By Fact 2, the packets h1, h2, . . . hm dominate all pending packets, so the one sent by Adv, say p is (wlog) one of h1, h2, . . . hm: if p is dominated by hi, but not strictly dominated, then p has the same weight and deadline as hi. We begin by describing modifications to Adv's buffer and estimate Adv's amortized gain. To this end we need to fix the packet sent by Mix-R, so let us assume it is hf = (wf , df ). Assume that Adv transmits a packet hz = (wz, dz). We will denote the adversary's amortized gain given the latter assumption by G(z) Adv. We consider two cases. Case 1: df ≤ dz. Then wf ≤ wz, since hz is not dominated. After both Adv and Mix-R transmit their packets, we replace hf in the buffer of Adv by a copy of hz. This way their buffers remain the same afterwards, and the change is advantageous to Adv: this is essentially an upgrade of the packet hf in its buffer, as both df ≤ dz and wf ≤ wz hold. Case 2: df > dz. After both Adv and Mix-R transmit their packets, we let Adv additionally transmit hf , and we inject a copy of hz into its buffer, both of which are clearly advantageous to Adv. This makes the buffers of Adv and Mix-R identical afterwards. We start by proving (3), the bound on the adversary's expected amortized gain. Note that Adv always gains wz, and if dz < df (z > f ), it additionally gains wf . Thus, when Adv transmits hz, its expected amortized gain is (5) (6) EhG(z) Advi = wz +Xi<z piwi . As the adversary's expected amortized gain satisfies E [GAdv] ≤ max 1≤i≤mnEhG(i) Advio , to establish (3), we will prove that max 1≤i≤mnEhG(i) Advio ≤ G(1) Adv = w1 . The equality in (6) follows trivially from (5). To see that the inequality in (6) holds as well, observe that, by (5), for all j < m, EhG(i) Advi − EhG(i+1) Adv i = wi − wi+1 − piwi ≥ 0 , (7) 8 where the inequality follows from (1). Now we turn to (4), the bound on the expected gain of Mix-R in a single step. Obviously, n E [GMix-R] = piwi . (8) Xi=1 By (2), piwi = wi − wi+1 for all i < n. Also, pn = 1 −Pi<n pi, by Fact 3. Making corresponding substitutions in (8) yields E [GMix-R] = n−1 Xi=1 = w1 − wn (wi − wi+1)! + 1 − Xi=1 pi . n−1 pi! wn n−1 Xi=1 As (2) implies wi = wi−1(1 − pi−1) for all i ≤ n, we can express wn as n−1 wn = w1 Yi=1 (1 − pi) . Substituting (10) for wn in (9), we obtain (9) (10) (11) Note that pi! . E [GMix-R] = w1 1 − n−1 n−1 (1 − pi) Xi=1 Yi=1 (1 − pi) + n−1 pi! = n − 1 , Xi=1 n−1 Xi=1 and therefore the inequality between arithmetic and geometric means yields n−1 (1 − pi) Yi=1 n−1 Xi=1 pi ≤ (1 − 1 n )n . Plugging (12) into (11) yields E [GMix-R] ≥ w1(cid:18)1 − (1 − 1 n )n(cid:19) , which proves (4), and together with (3), the whole theorem. 2.3 Rationale behind the probability distribution Recall that the upper bound on the competitive ratio of Mix-R is max1≤z≤m{EhG(z) Advi} E [GMix-R] , irrespective of the choice of p1, . . . , pm. (12) (13) 9 The particular probability distribution used in Mix-R is chosen to (heuristi- cally) minimize above ratio by maximizing E [GMix-R], while keeping (6) satisfied, i.e., keeping E [GAdv] ≤ G(1) Adv = w1. The first goal is trivially achieved by setting p1 ← 1. This however makes ferred to p2, p3, . . . in the following way. To keep E [GMix-R] as large as possible, p2 is greedily set to its maximum, if there is any unassigned probability left, p3 Advi > w1 for all z > 1. Therefore, some of the probability mass is trans- Advi does not depend on pi for i ≥ z, Advi can be equalized with w1 sequentially, with z increasing, un- Adv i Advi with EhG(j−1) EhG(z) is set to its maximum, and so on. As EhG(z) the values EhG(z) til there is no unassigned probability left. Equalizing EhG(j) Advi cannot be equalized, they are only smaller than w1. EhG(z) consists in setting pj−1 ← 1 − wj , as shown in (7). The same inequality shows wj−1 what is intuitively clear: once there is no probability left and further values The lower bound for the Collecting Items problem [4], presented in Ap- pendix A, proves that this heuristic does minimize (13). 2.4 Implications for Restricted Variants We have already mentioned that for s-bounded instances or those with at most s different packet weights, N ≤ m ≤ s in Theorem 4, which trivially follows from Fact 2. Thus for either kind of instances Mix-R is 1/(cid:0)1 − (1 − 1 competitive. In particular, on 2-bounded instances Mix-R coincides with the previously known optimal 4/3-competitive algorithm Rand [5] for the adaptive adversary model. s )s(cid:1)- Sometimes it may be possible to give more sophisticated bounds on N , and consequently on the competitive ratio for particular variant of the problem, as we now explain. The reason for considering only the packets h0, h1, . . . , hm is clear: by Fact 1 and Fact 2, Adv (wlog) transmits one of them. Therefore, Mix-R tries to mimic Adv's behavior by adopting a probability distribution over these packets (recall that in the analysis the packets pending for Mix-R and Adv are exactly the same) that keeps the maximum, over Adv's choices, expected amortized gain of Adv and its own expected gain as close as possible (cf. Section 2.3). Now, if for whatever reason we know that Adv is going to transmit a packet from some set S, then H0 can be initialized to S rather than all pending packets, and Theorem 4 will still hold. And as the upper bound guaranteed by Theorem 4 depends on N , it might improve if the cardinality of S is small. While it seems unlikely that bounds for any restricted variant other than s-bounded instances or instances with at most s different packet weights can be obtained this way, there is one interesting example that shows it is possi- ble. For similarly ordered instances (aka instances with agreeable deadlines) and oblivious adversary one can always find such set S of cardinality at most 2 [15, Lemma 2.7]; while not explicitly stated, this fact was proved before by Li et al. [17]. Roughly, the set S contains the earliest-deadline and the heaviest packet from any optimal provisional schedule. The latter is the optimal schedule under the assumption that no further packets are ever injected, and as such can be found in any step. 10 3 Conclusion and Open Problems While Mix-R is very simple to analyze, it subsumes almost all previously known randomized algorithms for packet scheduling and provides new bounds for sev- eral restricted variants of the problem. One notable exception is the optimum algorithm against oblivious adversary for 2-bounded instances [7]. This exposes that the strength of our analysis, i.e., applicability to adaptive adversary model, is most likely a weakness at the same time. The strongest lower bounds on com- petitive ratio for oblivious and adaptive adversary differ. And as both are tight for 2-bounded instances, it seems impossible to obtain an upper bound smaller than 4/3 on the competitive ratio of Mix-R for any non-trivial restriction of the problem in the oblivious adversary model. In both the algorithm and its analysis it is the respective order of packets' deadlines rather than their exact values that matter. Therefore, our results are also applicable to the Collecting Items problem [4], briefly described in Section 1.3. As mentioned in Section 1.4, Mix-R is the optimum randomized memoryless algorithm for Collecting Items, cf. Appendix A. Therefore, to beat either the general bound of e/(e − 1), or any of the 1/(cid:0)1 − (1 − 1 s )s(cid:1) bounds for s-bounded instances for buffer management with bounded delay, one either needs to consider algorithms that are not memory- less scale-invariant, or better utilize the knowledge of exact deadlines -- in the analysis at least, if not in the algorithm itself. Last but not least, let us remark again that Mix-R and its analysis might au- tomatically provide better bounds for further restricted variants of the problem, provided that some insight allows to confine the adversary's choice of packets for transmission in a step, while knowing which packets are pending for it -- one such example is the algorithm for similarly ordered instances (aka instances with agreeable deadlines) [15], as we discussed in Section 2.4. References [1] N. Andelman, Y. Mansour, and A. Zhu. Competitive queueing policies for qos switches. In Proc. of the 14th ACM-SIAM Symp. on Discrete Algo- rithms (SODA), pages 761 -- 770, 2003. [2] Y. Azar. Online packet switching. In Proc. of the 2nd Workshop on Ap- proximation and Online Algorithms (WAOA), pages 1 -- 5, 2004. [3] S. Ben-David, A. Borodin, R. M. Karp, G. Tardos, and A. Wigderson. On the power of randomization in online algorithms. Algorithmica, 11(1):2 -- 14, 1994. Also appeared in Proc. of the 22nd STOC, pages 379 -- 386, 1990. [4] M. Bienkowski, M. Chrobak, C. Durr, M. Hurand, A. Jez, L. Jez, and G. Stachowiak. Collecting weighted items from a dynamic queue. In Proc. of the 20th ACM-SIAM Symp. on Discrete Algorithms (SODA), pages 1126 -- 1135, 2009. [5] M. Bienkowski, M. Chrobak, and L. Jez. Randomized algorithms for buffer management with 2-bounded delay. In Proc. of the 6th Workshop on Ap- proximation and Online Algorithms (WAOA), pages 92 -- 104, 2008. 11 [6] A. Borodin and R. El-Yaniv. Online Computation and Competitive Anal- ysis. Cambridge University Press, 1998. [7] F. Y. L. Chin, M. Chrobak, S. P. Y. Fung, W. Jawor, J. Sgall, and T. Tich´y. Online competitive algorithms for maximizing weighted throughput of unit jobs. Journal of Discrete Algorithms, 4:255 -- 276, 2006. [8] F. Y. L. Chin and S. P. Y. Fung. Online scheduling for partial job values: Does timesharing or randomization help? Algorithmica, 37:149 -- 164, 2003. [9] M. Chrobak, W. Jawor, J. Sgall, and T. Tich´y. Improved online algorithms for buffer management in QoS switches. ACM Transactions on Algorithms, 3(4), 2007. Also appeared in Proc. of the 12th ESA, pages 204 -- 215, 2004. [10] M. Englert and M. Westermann. Considering suppressed packets improves buffer management in QoS switches. In Proc. of the 18th ACM-SIAM Symp. on Discrete Algorithms (SODA), pages 209 -- 218, 2007. [11] L. Epstein and R. van Stee. Buffer management problems. Sigact News, 35:58 -- 66, 2004. [12] M. Goldwasser. A survey of buffer management policies for packet switches. SIGACT News, 41(1):100 -- 128, 2010. [13] B. Hajek. On the competitiveness of online scheduling of unit-length pack- ets with hard deadlines in slotted time. In Conference in Information Sci- ences and Systems, pages 434 -- 438, 2001. [14] L. Jez. Randomised buffer management with bounded delay against adap- tive adversary. CoRR, abs/0907.2050, 2009. [15] L. Jez. Randomized algorithm for agreeable deadlines packet scheduling. In Proc. of the 27th Symp. on Theoretical Aspects of Computer Science (STACS), pages 489 -- 500, 2010. [16] A. Kesselman, Z. Lotker, Y. Mansour, B. Patt-Shamir, B. Schieber, and M. Sviridenko. Buffer overflow management in QoS switches. SIAM Journal on Computing, 33(3):563 -- 583, 2004. Also appeared in Proc. of the 33rd STOC, pages 520 -- 529, 2001. [17] F. Li, J. Sethuraman, and C. Stein. An optimal online algorithm for packet scheduling with agreeable deadlines. In Proc. of the 16th ACM-SIAM Symp. on Discrete Algorithms (SODA), pages 801 -- 802, 2005. [18] A. Zhu. Analysis of queueing policies in QoS switches. Journal of Algo- rithms, 53(2):137 -- 168, 2004. 12 A Lower Bound for Collecting Items In this section, for completeness, we evoke the lower bound on the Collecting Items problem [4]. As the proof is omitted in the original article due to space constraints, and the original theorem statement therein is not parametrized by N , we restate the theorem. Theorem 5 (Theorem 6.3 of [4]). For every randomized memoryless algorithm for the Collecting Items problem, there is an adaptive adversary's strategy using at most N different packet weights such that the algorithm's competitive ratio against the strategy is at least 1/(cid:0)1 − (1 − 1 has at most N packets in its queue. N )N(cid:1), and at every step the algorithm Below we present the original proof from [4]. Proof. Fix some online memoryless randomized algorithm A, and consider the following scheme. Let a > 1 be a constant, which we specify later, and let n = N − 1 At the beginning, the adversary inserts items a0, a1, . . . , an into the queue, in this order. (To simplify notation, in this proof we identify items with their weights.) In our construction we maintain the invariant that in each step, the list of items pending for A is equal to a0, a1, . . . , an. Since A is memoryless, in each step it uses the same probability distribution (qj)n j=0, where qj is the i=0 qi = 1, as without loss of probability of collecting item aj. Moreover, Pn generality the algorithm always makes a move. We consider n+1 strategies for an adversary, numbered 0, 1, . . . , n. The k-th in each step collect ak, delete items a0, a1, . . . , ak, and strategy is as follows: then issue new copies of these items. Additionally, if A collected aj for some j > k, then the adversary issues a new copy of aj as well. This way, in each step exactly one copy of each aj is pending for A, while the adversary accumulates in its pending set copies of the items aj, for j > k, that were collected by A. This step is repeated T ≫ n times, and after the last step both the adversary and the algorithm collect all their pending items. Since T ≫ n, we only need to focus on the expected amortized profits (defined below) in a single step. We look at the gains of A and the adversary in a single step. If the adversary chooses strategy k, then it gains ak. Additionally, at the end it collects the item collected by the algorithm if this item is greater than ak. Thus, its amortized expected gain in a single step is ak + Pi>k qiai. The expected gain of A is Pi qiai. j=0 of the algorithm, the adversary chooses a strategy k which maximizes the competitive ratio. Thus, the compet- itive ratio of A is is at least For any probability distribution (qj)n R = max k ( ak +Pj>k qj aj Pj qjaj for any coefficients v0, . . . , vn ≥ 0 such thatPk vk = 1. Let M = an+1−n(a−1). For k = 0, 1, ..., n, we choose ) ≥ Xk vk ak +Pj>k qjaj Pj qjaj , (14) vk = ( 1 M an−k(a − 1), 1 M (a − n(a − 1), ) if k < n , if k = n . 13 The choice of these values may seem somewhat mysterious, but it's in fact quite simple -- it is obtained by considering A's distributions where qj = 1 for some j (and thus when A is deterministic), assuming that the resulting lower bounds on the right-hand side of (14) are equal, and solving the resulting system of equations. For these values of vk we obtain M vkak + n Xk=0 M R n Xj=0 qjaj ≥ = n n−1 Xk=0 Xk=0 M vkak + M vnan + M vk qjaj M vkXj>k Xj=0 n qjajXk<j Xj=0 n n = n(a − 1)an + [a − n(a − 1)]an + qj(aj − 1)an+1 = an+1 + an+1 = an+1 + an+1 qjaj − an+1 qj Xj=0 qjaj − an+1 n n Xj=0 Xj=0 = an+1 n Xj=0 qjaj . Therefore, R ≥ an+1/M . This bound is maximized for a = 1 + 1/n, in which case we get n(cid:1)n+1 R ≥ (cid:0)1 + 1 n(cid:1)n+1 (cid:0)1 + 1 − 1 completing the proof. 1 1 −(cid:0)1 − 1 N(cid:1)N , N −1(cid:17)N = (cid:16)1 + 1 N −1(cid:17)N (cid:16)1 + 1 − 1 = 14
1110.1079
1
1110
2011-10-05T19:27:57
A Near-Optimal Sublinear-Time Algorithm for Approximating the Minimum Vertex Cover Size
[ "cs.DS" ]
We give a nearly optimal sublinear-time algorithm for approximating the size of a minimum vertex cover in a graph G. The algorithm may query the degree deg(v) of any vertex v of its choice, and for each 1 <= i <= deg(v), it may ask for the i-th neighbor of v. Letting VC_opt(G) denote the minimum size of vertex cover in G, the algorithm outputs, with high constant success probability, an estimate VC_estimate(G) such that VC_opt(G) <= VC_estimate(G) <= 2 * VC_opt(G) + epsilon*n, where epsilon is a given additive approximation parameter. We refer to such an estimate as a (2,epsilon)-estimate. The query complexity and running time of the algorithm are ~O(avg_deg * poly(1/epsilon)), where avg_deg denotes the average vertex degree in the graph. The best previously known sublinear algorithm, of Yoshida et al. (STOC 2009), has query complexity and running time O(d^4/epsilon^2), where d is the maximum degree in the graph. Given the lower bound of Omega(avg_deg) (for constant epsilon) for obtaining such an estimate (with any constant multiplicative factor) due to Parnas and Ron (TCS 2007), our result is nearly optimal. In the case that the graph is dense, that is, the number of edges is Theta(n^2), we consider another model, in which the algorithm may ask, for any pair of vertices u and v, whether there is an edge between u and v. We show how to adapt the algorithm that uses neighbor queries to this model and obtain an algorithm that outputs a (2,epsilon)-estimate of the size of a minimum vertex cover whose query complexity and running time are ~O(n) * poly(1/epsilon).
cs.DS
cs
A Near-Optimal Sublinear-Time Algorithm for Approximating the Minimum Vertex Cover Size Krzysztof Onak∗ Dana Ron † Michal Rosen ‡ Ronitt Rubinfeld§ October 29, 2018 Abstract We give a nearly optimal sublinear-time algorithm for approximating the size of a minimum vertex cover in a graph G. The algorithm may query the degree deg(v) of any vertex v of its choice, and for each 1 ≤ i ≤ deg(v), it may ask for the ith neighbor of v. Letting VCopt(G) denote the minimum size of vertex cover in G, the algorithm outputs, with high constant success probability, an estimate cVC(G) such that VCopt(G) ≤ cVC(G) ≤ 2VCopt(G) + ǫn, where ǫ is a given additive approximation parameter. We refer to such an estimate as a (2, ǫ)-estimate. The query complexity and running time of the algorithm are O( ¯d · poly(1/ǫ)), where ¯d denotes the average vertex degree in the graph. The best previously known sublinear algorithm, of Yoshida et al. (STOC 2009), has query complexity and running time O(d4/ǫ2), where d is the maximum degree in the graph. Given the lower bound of Ω( ¯d) (for constant ǫ) for obtaining such an estimate (with any constant multiplicative factor) due to Parnas and Ron (TCS 2007), our result is nearly optimal. In the case that the graph is dense, that is, the number of edges is Θ(n2), we consider another model, in which the algorithm may ask, for any pair of vertices u and v, whether there is an edge between u and v. We show how to adapt the algorithm that uses neighbor queries to this model and obtain an algorithm that outputs a (2, ǫ)-estimate of the size of a minimum vertex cover whose query complexity and running time are O(n) · poly(1/ǫ). 1 1 0 2 t c O 5 ] S D . s c [ 1 v 9 7 0 1 . 0 1 1 1 : v i X r a ∗School of Computer Science, Carnegie Mellon University, E-mail: [email protected]. Research supported by a Simons Postdoctoral Fellowship and the NSF grant 0728645. †School of Electrical Engineering, Tel Aviv University. E-mail: [email protected]. Research supported by the Israel Science Foundation grant number 246/08. ‡Blavatnik School of Computer Science, Tel Aviv University, E-mail: [email protected] §CSAIL, MIT, Cambridge MA 02139 and the Blavatnik School of Computer Science, Tel Aviv University. E-mail: [email protected]. Research supported by NSF awards CCF-1065125 and CCF-0728645, Marie Curie Reintegration grant PIRG03-GA-2008-231077 and the Israel Science Foundation grant nos. 1147/09 and 1675/09. 1 Introduction Computing the size of a minimum vertex cover in a graph is a classic NP-hard problem. However, one can approximate the optimal value of the solution to within a multiplicative factor of two, via a neat and simple algorithm whose running time is linear in the size of the graph (this algorithm was independently discovered by Gavril and Yanakakis, see e.g. [PS98]). A natural question is whether it is possible to obtain a good approximation for the size of the optimal vertex cover in time that is sublinear in the size of the graph G. Since achieving a pure multiplicative 0 ≤ ǫ < 1, where VCopt(G) denotes the minimum size of a vertex cover in G. We refer to such an estimate approximation is easily seen to require linear time, we focus on algorithms that compute an estimate cVC(G) such that with high constant probability, VCopt(G) ≤ cVC(G) ≤ α · VCopt(G) + ǫn, for α ≥ 1 and cVC(G) as an (α, ǫ)-estimate of VCopt(G). Observe that in the special case when the vertex cover is very large, namely VCopt(G) = Θ(n) (which happens for example when the maximum degree and the average degree are of the same order), then an (α, ǫ)-estimate yields an (α + O(ǫ))-multiplicative approximation. Since an algorithm with complexity sublinear in the size of the graph cannot even read the entire graph, it must have query access to the graph. In this work we consider two standard models of queries. In the first model, the algorithm may query the degree deg(v) of any vertex v of its choice, and it may also query the ith neighbor of v (where the the order on the neighbors is arbitrary). In the second model, more appropriate when the graph is stored as an adjacency matrix, the algorithm can check in a single query whether there is an edge between two vertices v and w chosen by the algorithm. We focus on the first model, but we eventually show that our algorithm can be modified to work in the second model as well. Previous work. The aforementioned question was first posed by Parnas and Ron [PR07], who showed how to obtain a (2, ǫ)-estimate (for any given additive approximation parameter ǫ) in time dO(log d/ǫ3), where d is the maximum degree in the graph. The dependence on the maximum degree d can actually be replaced by a dependence on ¯d/ǫ, where ¯d is the average degree in the graph [PR07]. The upper bound of dO(log d/ǫ3) was significantly improved in a sequence of papers [MR09, NO08, YYI09], where the best result due to Yoshida, Yamamoto, and Ito [YYI09] (who analyze an algorithm proposed by Nguyen and Onak [NO08]) is an upper bound of O(d4/ǫ2). Their analysis can also easily be adapted to give an upper bound of O( ¯d4/ǫ4) for graphs with bounded average vertex degree ¯d. On the negative side, it was also proved in [PR07] that at least a linear dependence on the average degree, ¯d, is necessary. Namely, Ω( ¯d) queries are necessary for obtaining an (α, ǫ)-estimate for any α ≥ 1 and ǫ < 1/4, provided that ¯d = O(n/α), and in particular this is true for α = 2. We also mention that obtaining a (2 − γ, ǫ)-estimate for any constant γ requires a number of queries that grows at least as the square root of the number of vertices [PR07, due to Trevisan]. Our Result. In this work we describe and analyze an algorithm that computes a (2, ǫ)-estimate of VCopt(G) in time O( ¯d) · poly(1/ǫ). Note that since the graph contains ¯dn/2 edges, our running time is sublinear for all values of ¯d. In particular, for graphs of constant average degree, the running time is inde- pendent of the number of nodes and edges in the graph, whereas for general graphs it is bounded by at most the square root of the number of edges. In view of the aforementioned lower bound of Ω( ¯d), our algorithm is optimal in terms of the dependence on the average degree up to a polylogarithmic factor. Since our algo- rithm builds on previous work, and in particular on the algorithm proposed and analyzed in [NO08, YYI09], 1 we describe the latter algorithm first.1 We refer to this algorithm as Approx-VC-I. The Algorithm Approx-VC-I. Recall that the size of a minimum vertex cover is lower-bounded by the size of any (maximal) matching in the graph, and is upper-bounded by twice the size of any maximal match- ing. This is indeed the basis of the aforementioned factor-two approximation algorithm, which runs in linear-time. To estimate the size of an arbitrary such maximal matching, the algorithm follows the sampling paradigm of Parnas and Ron [PR07]. That is, the algorithm Approx-VC-I selects, uniformly, independently and at random, Θ(d2/ǫ2) edges. For each edge selected, it calls a maximal matching oracle, which we describe momentarily, where the oracle's answers indicate whether or not the edge is in the maximal match- ing M, for some arbitrary maximal matching M (that is not a function of the queries to the oracle). The algorithm then outputs an estimate of the size of the maximal matching M (and hence of a minimum vertex cover) based on the fraction of sampled edges for which the maximal matching oracle returned a positive answer. The number of sampled edges ensures that with high constant probability, the additive error of the estimate is O((ǫ/d)m) ≤ ǫn, where m is the number of edges in the graph. The main idea of the algorithm follows the idea suggested in [NO08] which is to simulate the answers of the standard sequential greedy algorithm. The greedy algorithm supposes a fixed ranking (ordering) of the edges in G, which uniquely determines a maximal matching as follows: proceeding along the edges according to the order determined by the ranking, add to the matching each edge that does not share an end- point with any edge previously placed in the matching. The maximal matching oracle essentially emulates this procedure while selecting a random ranking "on the fly", but is able to achieve great savings in running time by noting that to determine whether an edge is placed in the matching, it is only necessary to know whether or not adjacent edges that are ranked lower than the current edge have been placed in the matching. Namely, given an edge (u, v), it considers all edges that share an endpoint with (u, v) and whose (randomly assigned) ranking is lower than that of (u, v). If there are no such edges, then the oracle returns TRUE. Otherwise it performs recursive calls to these edges, where the order of the calls is according to their ranking. If any recursive call is answered TRUE, then the answer on (u, v) is FALSE, while if all answers (on the incident edges with a lower rank) is answered FALSE, then the answer on (u, v) is TRUE. Though the correctness of the above algorithm follows directly from the correctness of the greedy al- gorithm, the query and runtime analysis are more difficult. The analysis of [NO08] is based on a counting argument that shows that it is unlikely that there is a long path of recursive calls with a monotone decreas- ing set of ranks. Their bound gives a runtime that is independent of the size of the graph, but exponential in the degree d. However, using that the algorithm recurses according to the smallest ranked neighbor, [YYI09] give an ingenious analysis that bounds by O(d) the total number of expected recursive calls when selecting an edge uniformly at random, and when selecting a ranking uniformly at random. This is what allows [YYI09] to obtain an algorithm whose query complexity and running time are O(d4/ǫ2). Our Algorithm. In what follows we describe an algorithm that has almost linear dependence on the max- imum degree d. The transformation to an algorithm whose complexity depends on the average degree ¯d is done on a high level along the lines described in [PR07]. We first depart from Approx-VC-I by performing the following variation. Rather than sampling edges and approximating the size of a maximal matching by 1Yoshida et al. [YYI09] actually analyze an algorithm for approximating the size of a maximal independent set. They then apply it to the line graph of a given graph G, so as to obtain an estimate of the size of a maximal matching, and hence of a minimum vertex cover (with a multiplicative cost of 2 in the quality of the estimate). For the sake of simplicity, we describe their algorithm directly for a maximal matching (minimum vertex cover). 2 calling the maximal matching oracle on the sampled edges, we sample vertices (as in [PR07]), and we call a vertex cover oracle on each selected vertex v. The vertex cover oracle calls the maximal matching oracle on the edges incident to v according to the order induced by their ranking (where the ranking is selected randomly). Once some edge returns TRUE, the vertex cover oracle returns TRUE, and if all incident edges return FALSE, the vertex cover oracle returns FALSE. By performing this variation we can take a sample of vertices that has size Θ(1/ǫ2) rather than2 Θ(d2/ǫ2). Unfortunately, the analysis of [YYI09] is no longer applicable as is. Recall that their analysis bounds the expected number of recursive calls to the maximal matching oracle, for a random ranking, and for a randomly selected edge. In contrast, we select a random vertex and call the maximal matching oracle on its (at most d) incident edges. Nonetheless, we are able to adapt the analysis of [YYI09] and give a bound of O(d) on the expected number of recursive calls to the maximal matching oracle, when selecting a vertex uniformly at random.3 As a direct corollary of the above we can get an algorithm whose query complexity and running time grow quadratically with d. Namely, whenever the maximal matching oracle is called on a new edge (u, v), the algorithm needs to perform recursive calls on the edges incident to u and v, in an order determined by their ranking. To this end it can query the O(d) neighbors of u and v, assign them (random) rankings, and continue in a manner consistent with the assigned rankings. To reduce the complexity of the algorithm further, we show a method that for most of the edges that we visit, allows us to query only a small subset of adjacent edges. Ideally, we would like to make only k queries when k recursive calls are made. One of the problems that we encounter here is that if we do not query all adjacent edges, then for some edge (u, v), we could visit a different edge incident to u and a different edge incident to v and make conflicting decisions about the ranking of (u, v) from the point of view of these edges. This could result in an inconsistent execution of the algorithm with results that are hard to predict. Instead, we devise a probabilistic procedure, that, together with appropriate data structures, allows us to perform queries almost "only when needed" (we elaborate on this in the next paragraph). By this we mean that we perform queries only on a number of edges that is a poly(log(d/ǫ)) factor larger than the total number of recursive calls made to the maximal matching oracle. We next discuss our general approach. As in previous work, we implement the random ranking by assigning numbers to edges independently, uniformly at random from (0, 1] (or, more precisely, from an appropriate discretization of (0, 1]). For each vertex we keep a copy of a data structure that is responsible for generating and assigning random numbers to incident edges. For each vertex, we can ask the corresponding data structure for the incident edge with the ith lowest number. How does the data structure work? Conceptually, the edges attached to each vertex are grouped into "layers", where the edges in the first layer have random numbers that are at most 1/d, the edges in layer i > 1 have random numbers in the range 2i−1/d to 2i/d. The algorithm randomly chooses edges to be in a layer for each vertex, one layer at a time, starting with the lowest layer. Each successive layer is processed only as needed by the algorithm. If the algorithm decides that an edge is in the current layer, then it picks a random number for the edge uniformly from the range associated with the layer. In particular, it is possible to ensure that the final random number comes from the uniform distribution on (0, 1]. In order to make sure that the same decision is made at both endpoints of an edge (u, v), the data structures for u and v communicate whenever they want to assign a specific random number to the edge. The algorithm 2We note that it is actually possible to save one factor of d without changing the algorithm Approx-VC-I by slightly refining the probabilistic analysis. This would reduce the complexity of Approx-VC-I to cubic in d. 3To be more precise, we first give a bound that depends on the ratio between the maximum and minimum degrees as well as on the average degree, and later we show how to obtain a dependence on d (at an extra cost of 1/ǫ) by slightly modifying the input graph. 3 works in such a way so that vertices need query their incident edges only when a communication regarding the specific edge occurs. Our final algorithm is obtained by minimizing the amount of communication between different data structures, and therefore, making them discover not many more edges than necessary for recursive calls in the graph exploration. Other Related Work. For some restricted classes of graphs it is possible to obtain a (1, ǫ)-estimate of the size of the minimum vertex cover in time that is a function of only ǫ. Elek shows that this is the case for graphs of subexponential growth [Ele10]. For minor-free graphs, one obtains this result by applying the generic reduction of Parnas and Ron [PR07] to local distributed algorithm of Czygrinow, Ha´n´ckowiak, and Wawrzyniak [CHW08]. Both of these results are generalized by Hassidim et al. [HKNO09] to any class of hyperfinite graphs. In particular, for planar graphs, they give an algorithm that computes a (1, ǫ)-estimate in 2poly(1/ǫ) time. While the running time must be exponential in 1/ǫ, unless there exists a randomized subexponential algorithm for SAT, it remains a neat open question whether the query complexity can be reduced to polynomial in 1/ǫ. For bipartite graphs, a (1, ǫn)-estimate can be computed in dO(1/ǫ2) time. This follows from the relation between the maximum matching size and the minimum vertex size captured by Konig's theorem and fast approximation algorithms for the maximum matching size [NO08, YYI09]. Ideas similar to those discussed in this paper are used to construct sublinear time estimations of other parameters of sparse combinatorial objects, such as maximum matching, set cover, constraint satisfaction [NO08, YYI09, Yos11]. In the related setting of property testing, sublinear time algorithms are given for testing any class of graphs with a fixed excluded minor and any property of graphs with a fixed excluded minor [CSS09, BSS08, Ele10, HKNO09, NS11]. There are also other works on sublinear algorithms for various other graph measures such as the mini- mum weight spanning tree [CRT05, CS09, CEF+05], the average degree [Fei06, GR08], and the number of stars [GRS10]. 2 The Oracle-Based Algorithm Let G = (V, E) be an undirected graph with n vertices and m edges, where we allow G to contain parallel edges and self-loops. Let d denote the maximum degree in the graph, and let ¯d denote the average degree. Consider a ranking π : E → [m] of the edges in G = (V, E). As noted in the introduction, such a ranking determines a maximal matching Mπ(G). Given Mπ(G), we define a vertex cover Cπ(G) as the set of all endpoints of edges in Mπ(G). Therefore, VCopt ≤ Cπ(G) ≤ 2VCopt, where VCopt is the minimum size of a vertex cover in G. We assume without loss of generality that there are no isolated vertices in G, since such vertices need not belong to any vertex cover. We shall use the shorthand Mπ and Cπ for Mπ(G) and Cπ(G), respectively, when G is clear from the context. Assume we have an oracle VOπ for a vertex cover based on a ranking π of the edges, where VOπ(v) = TRUE if v ∈ Cπ(G), VOπ(v) = FALSE otherwise. The next lemma follows by applying an additive Chernoff bound. Lemma 2.1 For any fixed choice of π, let C = Cπ(G). Suppose that we uniformly and independently select s = Θ( 1 ǫ2 ) vertices v from V . Let t be a random variable equal to the number of selected vertices that 4 belong to C. With high constant probability, C − ǫn ≤ t s · n ≤ C + ǫn . Algorithm 1, provided below, implements an oracle VOπ, that given a vertex v, decides whether v ∈ Cπ. This oracle uses another oracle, MOπ (described in Algorithm 2) that given an edge e, decides whether e ∈ Mπ. Both oracles can determine π(e) for any edge e of their choice. The oracle MOπ essentially emulates the greedy algorithm for finding a maximal matching (based on the ranking π). We assume that once the oracle for the maximal matching decides whether an edge e belongs to Mπ or not, it records this information in a data structure that allows to retrieve it later. By Lemma 2.1, if we perform Θ(1/ǫ2) calls to VOπ, we can get an estimate of the size of the vertex cover Cπ up to an additive error of (ǫ/2)n, and hence we can obtain a (2, ǫ)-estimate (as defined in the introduction) of the size of a minimum vertex cover in G. Hence our focus is on upper bounding the query complexity and running time of the resulting approximation algorithm when π is selected uniformly at random. Algorithm 1: An oracle VOπ(v) for a vertex cover based on a ranking π of the edges. Given a vertex v, the oracle returns TRUE if v ∈ Cπ and it returns FALSE otherwise. 1 Let e1, . . . , et be the edges incident to the vertex v in order of increasing rank (that is, π(ei+1) > π(ei)). for i = 1, . . . , t do if MOπ(ei) = TRUE then return TRUE return FALSE 2 3 4 5 1 2 3 4 5 6 7 8 9 Algorithm 2: An oracle MOπ(e) for a maximal matching based on a ranking π of the edges. Given an edge e, the oracle returns TRUE if e ∈ Mπ and it returns FALSE otherwise. if MOπ(e) has already been computed then return the computed answer. Let e1, . . . , et be the edges that share an endpoint with e, in order of increasing rank (that is, π(ei+1) > π(ei)). i ← 1. while π(ei) < π(e) do if MOπ(ei) = TRUE then return FALSE else i ← i + 1. 10 return TRUE We start (in Section 3) by bounding the expected number of calls made to the maximal-matching oracle MOπ in the course of the execution of a call to the vertex-cover oracle VOπ. This bound depends on the average degree in the graph and on the ratio between the maximum degree and the minimum degree. A straightforward implementation of the oracles would give us an upper bound on the complexity of the 5 In Section 4 we describe a algorithm that is a factor of d larger than our final near-optimal algorithm. sophisticated method of simulating the behavior of the oracle MOπ for randomly selected ranking π, which is selected "on the fly". Using this method we obtain an algorithm with only a polylogarithmic overhead (as a function of d) over the number of recursive calls. Thus, for graphs that are close to being regular, we get an algorithm whose complexity is O(d/ǫ2). In Section 5 we address the issue of variable degrees, and in particular, show how to get a nearly-linear dependence on the average degree. 3 Bounding the Expected Number of Calls to the Maximal-Matching Oracle For a ranking π of the edges of a graph G and a vertex v ∈ V , let N (π, v) = NG(π, v) denote the number of different edges e such that a call MOπ(e) was made to the maximal matching oracle in the course of the computation of VOπ(v). Let Π denote the set of all rankings π over the edges of G. Our goal is to bound the expected value of N (π, v) (taken over a uniformly selected ranking π and vertex v). We next state our first main theorem. Theorem 3.1 Let G be a graph with m edges and average degree ¯d, and let the ratio between the maximum degree and the minimum degree in G be denoted by ρ. The average value of N (π, v) taken over all rankings π and vertices v is O(ρ · ¯d). That is: 1 m! · 1 n ·Xπ∈ΠXv∈V N (π, v) = O(ρ · ¯d) . (1) If the graph is (close to) regular, then the bound we get in Theorem 3.1 is O( ¯d) = O(d). However, for graphs with varying degrees the bound can be Θ(d2). As noted previously, we later show how to deal with variable degree graphs without having to pay a quadratic cost in the maximum degree. As noted in the introduction, our analysis builds on the work of Yoshida et al. [YYI09]. While our analysis does not reduce to theirs4, it uses many of their ideas. We start by making a very simple but useful observation about the maximal matching oracle MOπ (Algorithm 2), which follows immediately from the definition of the oracle. Observation 3.2 For any edge e, consider the execution of MOπ on e. If in the course of this execution, a recursive call is made to MOπ on another edge e′, then necessarily π(e′) < π(e). Therefore, for any consecutive sequence of (recursive) calls to edges eℓ, . . . , e1, π(eℓ) > π(eℓ−1) > . . . > π(e1). In order to prove Theorem 3.1 we introduce more notation. For any edge e ∈ E, we arbitrarily label its endpoints by va(e) and vb(e) (where if e is a self-loop then va(e) = vb(e), and if e and e′ are parallel edges, then va(e) = va(e′) and vb(e) = vb(e′)). For a ranking π and an index k, let πk denote the edge e such that π(e) = k. We say that an edge e is visited if a call is made on e either in the course of an oracle computation of VOπ(va(e)) or VOπ(vb(e)) (that is, as a non-recursive call), or in the course of an oracle computation of 4Indeed, we initially tried to find such a reduction. The main difficulty we encountered is that the vertex cover oracle, when executed on a vertex v, performs calls to the maximal matching oracle on the edges incident to v until it gets a positive answer (or all the incident edges return a negative answer). While the analysis of [YYI09] gives us an upper bound on the expected number of recursive calls for a given edge, it is not clear how to use such a bound without incurring an additional multiplicative cost that depends on the degree of the vertices. 6 MOπ(e′) for an edge e′ that shares an endpoint with e (as a recursive call). For a vertex v and an edge e, let G(v, e) equal 1 if e is visited in the course of the execution of VOπ(v). Using the notation X π(v, e) = X π just introduced, we have that X π(v, e) . (2) N (π, v) = Xe∈E Observation 3.3 Let e = (v, u). If X π(v, e) = 1, then for each edge e′ that shares the endpoint v with e and for which π(e′) < π(e) we have that MOπ(e′) = FALSE. To verify Observation 3.3, assume, contrary to the claim, that there exists an edge e′ as described in the observation and MOπ(e′) = TRUE. We first note that by Observation 3.2, the edge e cannot be visited in the course of an execution of MOπ on any edge e′′ = (v, w) such that π(e′′) < π(e) (and in particular this is true for e′′ = e′). Since VOπ(v) performs calls to the edges incident to v in order of increasing rank, if MOπ(e′) = TRUE, then VOπ(v) returns TRUE without making a call to MOπ(e). This contradicts the premise of the observation that X π(v, e) = 1. The next notation is central to our analysis. For k ∈ [m] and a fixed edge e: Xk(e) def = Xπ∈Π(cid:16)X π(va(πk), e) + X π(vb(πk), e)(cid:17) . (3) That is, Xk(e) is the total number of calls made to the maximal matching oracle on the edge e when summing over all rankings π, and performing an oracle call to the vertex-cover oracle from one of the endpoints of πk. Observe that where deg(v) denotes the degree of v in the graph, and for simplicity of the presenation we count each self-loop as contributing 2 to the degree of the vertex. We next give an upper bound on Xk(e). Lemma 3.4 For every edge e and every k ∈ [m]: Xk(e) ≤ 2(m − 1)! + (k − 1) · (m − 2)! · d . In order to prove Lemma 3.4, we establish the following lemma. Lemma 3.5 For every edge e and every k ∈ [m − 1]: Xk+1(e) − Xk(e) ≤ (m − 2)! · d . Before proving Lemma 3.5, we show how Lemma 3.4 easily follows from it. Proof of Lemma 3.4: We prove the lemma by induction on k. For the base case, k = 1, X1(e) =Xπ (cid:16)X π(va(π1), e) + X π(vb(π1), e)(cid:17) . (5) (6) (7) By the definition of the vertex-cover oracle, when starting from either va(π1) or from vb(π1), only a single call is made to the maximal matching oracle. This call is on the edge π1, which returns TRUE without making 7 mXk=1 Xk(e) = Xπ∈ΠXv∈V deg(v) · X π(v, e) (4) any further calls, because all edges (that share an endpoint with π1) have a larger rank. This implies that if e = π1, then X π(va(π1), e) = X π(vb(π1), e) = 1, and otherwise X π(va(π1), e) = X π(vb(π1), e) = 0. For any fixed e, the number of rankings π such that e = π1 is simply (m − 1)! and so X1(e) = 2(m − 1)!, as required. We now turn to the induction step. Assuming the induction hypothesis holds for k − 1 ≥ 1, we prove it for k > 1. This follows directly from Lemma 3.5 (and the induction hypothesis): Xk(e) ≤ Xk−1(e) + (m − 2)! · d ≤ 2(m − 1)! + (k − 2) · (m − 2)! · d + (m − 2)! · d = 2(m − 1)! + (k − 1) · (m − 2)! · d , (8) (9) (10) and the lemma is established. Proof of Lemma 3.5: Throughout the proof we fix k and e. For a ranking π, let π′ be defined as follows: π′ k+1 = πk, π′ j = πj for every j /∈ {k, k + 1}. k = πk+1 and π′ Observation 3.6 If π and π′ are as defined above, then for each edge e where π(e) < k (and therefore, π′(e) < k): MOπ(e) = MOπ′ (e). Observation 3.6 is true due to the fact that if π(e) < k then by the definition of π′, we have that π′(e) = π(e). Since in a recursive call we only go to an edge with a lower rank (see Observation 3.2), we get that the execution of MOπ(e) is equivalent to the execution of MOπ′ (e). We shall use the notation Πk for those rankings π in which πk and πk+1 share a common endpoint. Note that if π ∈ Πk, then π′ ∈ Πk as well (and if π /∈ Πk, then π′ /∈ Πk). For two edges e = (v1, v2) and e′ = (v2, v3) (which share a common endpoint v2), we let vc(e, e′) = vc(e′, e) = v2 ('c' for 'common') and vd(e, e′) = v1, vd(e′, e) = v3 ('d' for 'different'). If e and e′ are parallel edges, then we let vd(e, e′) = vd(e′, e) be va(e) = va(e′) and vc(e, e′) = vc(e′, e) be vb(e) = vb(e′). If e is a self-loop on a vertex v1 that is also an endpoint of e′ (so that v2 = v1), then vd(e, e′) = vc(e, e′) = v1. For any edge e and for 1 ≤ k ≤ m − 1, Xk+1(e) − Xk(e) = Xπ (cid:16)X π(va(πk+1), e) + X π(vb(πk+1), e)(cid:17) −Xπ (cid:16)X π(va(πk), e) + X π(vb(πk), e)(cid:17) = Xπ∈Πk(cid:16)X π(va(πk+1), e) + X π(vb(πk+1), e)(cid:17) − Xπ∈Πk(cid:16)X π(va(πk), e) + X π(vb(πk), e)(cid:17) + Xπ /∈Πk(cid:16)X π(va(πk+1), e) + X π(vb(πk+1), e)(cid:17) − Xπ /∈Πk(cid:16)X π(va(πk), e) + X π(vb(πk), e)(cid:17) (12) = Xπ∈Πk + Xπ∈Πk + Xπ /∈Πk(cid:16)X π(va(πk+1), e) + X π(vb(πk+1), e)(cid:17) − Xπ /∈Πk(cid:16)X π(va(πk), e) + X π(vb(πk), e)(cid:17).(15) X π(vc(πk+1, πk), e) − Xπ∈Πk X π(vd(πk+1, πk), e) − Xπ∈Πk X π(vd(πk, πk+1), e) X π(vc(πk, πk+1), e) (11) (13) (14) 8 By the definition of vc(·, ·), for every π ∈ Πk we have that vc(πk+1, πk) = vc(πk, πk+1) and so X π(vc(πk+1, πk), e) = X π(vc(πk, πk+1), e) , (16) implying that the expression in Equation (13) evaluates to 0. Since π′ ∈ Πk if and only if π ∈ Πk, we get (17) (18) (19) (20) and X π′ (vd(π′ k+1, π′ X π(vd(πk+1, πk), e) = Xπ′∈Πk that Xπ∈Πk Xπ /∈Πk(cid:16)X π(va(πk+1), e) + X π(vb(πk+1), e)] = Xπ′ /∈Πk(cid:16)X π′ = Xπ /∈Πk(cid:16)X π′ k), e) = Xπ∈Πk X π′ (vd(π′ k+1, π′ k), e) , (va(π′ k+1), e) + X π′ (vb(π′ (va(π′ k+1), e) + X π′ (vb(π′ k+1), e)(cid:17) k+1), e)(cid:17) . Therefore, Xk+1(e) − Xk(e) = Xπ∈Πk k), e) − Xπ∈Πk X π′ (vd(π′ k+1, π′ X π(vd(πk, πk+1), e) (va(π′ k+1), e) + X π′ + Xπ /∈Πk(cid:16)X π′ k+1), e)(cid:17) − Xπ /∈Πk(cid:16)X π(va(πk), e) + X π(vb(πk), e)(cid:17) . (vb(π′ The next useful observation is that for every π /∈ Πk (and for every e and j ∈ {a, b}), X π′ (vj(π′ k+1), e) = X π(vj(πk), e) . This follows by combining the fact that vj(π′ k+1) = vj(πk) with Observations 3.2 and 3.6. By combining Equation (19) with Equation (20) we obtain that Xk+1(e) − Xk(e) = Xπ∈Πk X π′ (vd(π′ k+1, π′ k), e) − Xπ∈Πk X π(vd(πk, πk+1), e) . (21) Therefore, we need only consider executions in which the underlying rankings π and π′ belong to Πk, k) = vd(πk, πk+1). We shall use the shorthand k+1) = vd(πk+1, πk). For an and the execution starts from the vertex v1(π′) = vd(π′ notation v2(π′) = vc(π′ illustration, see Figure 1. We shall make use of the following simple observation. k) = vc(πk, πk+1), and v3(π′) = vd(π′ k+1, π′ k+1, π′ k, π′ Observation 3.7 Let e be a self-loop. For any vertex v and ranking π, if in the course of the execution of VOπ(v) a call is made to MOπ(e), then MOπ(e) = TRUE. Observation 3.7 is true since if a call is made to MOπ(e) where e is a self-loop, i.e., e = (v, v) for some vertex v, then from Observation 3.3 we know that all other edges incident to v with ranks smaller than π(e) return FALSE. Therefore, by the definition of MOπ we get that MOπ(e) = TRUE. We would like to understand when X π′(v1(π′), e) = 1 while X π(v1(π′), e) = 0. We consider three possible cases (for an illustration see Figure 2) : 9 (a) v1(π ′) π ′ k+1 = πk π ′ k = πk+1 v2(π ′) π ′ k+1 = πk v3(π ′) (b) π ′ k = πk+1 v1(π ′) v2(π ′) (c) v1(π ′) v2(π ′) π ′ k+1 = πk (d) v1(π ′) π ′ k+1 = πk v2(π ′) π ′ k = πk+1 π ′ k = πk+1 π ′ k+1 = πk (e) v1(π ′) v2(π ′) π ′ k = πk+1 π ′ k+1 = πk (f) v1(π ′) π ′ k = πk+1 Figure 1: An illustration for the various cases in which π ∈ Πk (i.e., π′ need to compare the executions of VOπ(v1(π′)) and VOπ′ We refer to the different cases (a) -- (f) in the analysis. (v1(π′)) (where v1(π′) = vd(π′ k and π′ k+1 share at least one endpoint) and we k) = vd(πk, πk+1)). k+1, π′ 1. e = (v1(π′), v2(π′)) (so that π′(e) = k + 1 and π(e) = k). In this case, if X π′(v1(π′), e) = 1, then X π(v1(π′), e) = 1. To verify this, note that if X π′ (v1(π′), e) = 1 then by Observation 3.3, MOπ′ (e′) = FALSE for each edge e′ where v1(π′) is one of its endpoints and π′(e′) < k + 1. By applying Observation 3.6 we get that for each edge e′ such that π(e′) < k we have that MOπ(e′) = MOπ′ (e′). Therefore, for each edge e′ such that π(e′) < k and v1(π′) is one of its endpoints we have that MOπ(e′) = MOπ′ We note that if π′ that MOπ′ the course of the execution of VOπ′ k is a self-loop (see cases (c) and (f) in Figure 1), then by Observation 3.7 we have k+1 = e will not be visited in k) = TRUE. By the definition of VOπ′ this implies that π′ (e′) = FALSE. Hence X π(v1(π′), e) = 1. (v1(π′), e) is necessarily 0. (v1(π′)), so that X π′ (π′ 2. e = (v2(π′), v3(π′)), (so that π(e) = k + 1 and π′(e) = k). In this case it is possible (though not necessary) that X π′(v1(π′), e) = 1 and X π(v1(π′), e) = 0. 3. e /∈ {(v1(π′), v2(π′)), (v2(π′), v3(π′))}. In this case it is also possible (though not necessary) that (v1(π′), e) = 1 and X π(v1(π′), e) = 0. X π′ Out of all cases illustrated in Figure 1, this is possible only in cases (a) and (b). We next explain why it is not possible in all other cases. • Case (c). If VOπ′ (v1(π′)) visits e before it visits π′ (v1(π′)) visits π′ k, then so does VOπ(v1(π′)) (from Observa- k first, but since it is a self-loop, from Observation 3.7 tion 3.6). Otherwise, VOπ′ we have that MOπ′ • Case (d). If VOπ′ k) = TRUE. By the definition of VOπ′ we get that X π′(v1(π′), e) = 0. (π′ (v1(π′)) visits e before it visits π′ (v1(π′)) visits π′ servation 3.6). Otherwise, if VOπ′ sive calls without visiting π′ VOπ′ (v1(π′)) will visit π′ k+1 and π′ k+1, then so does VOπ(v1(π′)) (from Ob- k+1 and e in the same sequence of recur- k, then so does VOπ(v1(π′)). If there is no such sequence, then k is a self-loop, from Observation 3.7 we have that k. Since π′ 10 (π′ k) = TRUE, implying that MOπ′ MOπ′ k+1) = f alse. Therefore, the sequence of recur- sive calls that visits e in the execution of VOπ′ (v1(π′)), starts from an edge incident to v1(π′) whose rank is greater than k + 1, and the same sequence of calls is made in the execution of VOπ(v1(π′)). (π′ • Case (e). Since the edges are parallel, if there is a sequence of recursive calls that visits e in (v1(π′)), then there is such a sequence in the execution of VOπ(v1(π′)), k while the second includes πk the execution of VOπ′ where the only difference is that the first sequence includes π′ (which are parallel edges). • Case (f). If VOπ′ (v1(π′)) visits e in a sequence of recursive calls that starts with an edge having k is a k), then it returns TRUE, causing the (v1(π′)) to terminate without visiting any additional edges (so that e cannot rank smaller than k, then from Observation 3.6 so will VOπ(v1(π′)). Otherwise, since π′ self-loop, by Observation 3.7, if a call is made to MOπ′ execution of VOπ′ be visited in a sequence of recursive calls that starts with an edge having rank at least k). (π′ 1. 2. 3. π ′ k+1 = πk v1(π ′) e π ′ k = πk+1 v2(π ′) v3(π ′) π ′ k+1 = πk v1(π ′) v2(π ′) π ′ k = πk+1 e v3(π ′) π ′ k+1 = πk v1(π ′) v2(π ′) π ′ k = πk+1 v3(π ′) e Figure 2: An illustration for the three possible (sub-)cases when π′ ∈ Πk: 1. e = (v1(π′), v2(π′)); 2. e = (v2(π′), v3(π′)); 3. e /∈ {(v1(π′), v2(π′)), (v2(π′), v3(π′))}. This illustration corresponds to Case (a) in Figure 1 (i.e., no self-loops and no parallel edges). For a fixed edge e we shall use the following notation for the sets of rankings that correspond to the last two cases described above. Specifically: • Let Πe,1 = Πe,1 k denote the set of all rankings π′ ∈ Πk where e = (v2(π′), v3(π′)) and X π′ (v1(π′), e) = 1. (Here we shall make the worst case assumption that X π(v1(π′), e) = 0). • Let Π¬e = Π¬e k denote the set of all rankings π′ ∈ Πk where e /∈ {(v1(π′), v2(π′)), (v2(π′), v3(π′))} and X π′(v1(π′), e) = 1 while X π(v1(π′), e) = 0. Thus, Xk+1(e) − Xk(e) ≤ Πe,1 + Π¬e. In order to upper bound Πe,1 + Π¬e, we consider another set of rankings: 11 • Let Πe,0 = Πe,0 k (v1(π′), e) = 0. X π′ denote the set of all rankings π′ ∈ Πk such that e = (v2(π′), v3(π′)) and By the definition of Πe,1 and Πe,0, we have that Πe,1 + Πe,0 ≤ (m − 2)! · d . (22) This is true since each ranking π′ ∈ Πe,1 ∪ Πe,0 is determined by first setting π′(e) = k, then selecting another edge incident to the endpoint v2(π′) of e (if e is a self-loop then v2(π′) = v1(π′)) and giving it rank k + 1 (where there are at most deg(v2(π′)) − 1 ≤ d − 1 such edges), and finally selecting one of the possible (m − 2)! rankings for the remaining edges. We next prove that Π¬e ≤ Πe,0, from which Lemma 3.5 follows. To this end we prove the next claim. Claim 3.8 There is an injection from Π¬e to Πe,0. The proof of Claim 3.8 is very similar to a proof of a corresponding claim in [YYI09], but due to our need to extend the proof to a graph with self-loops and parallel edges, and also due to several additional differences, we include it here for completeness. Proof: We start by making the following observations: Observation 3.9 If π′ ∈ Π¬e and we are in Case (a) as illustrated in Figure 1, then in the course of the execution of VOπ′ k and e at the end. That is, there is a sequence of recursive calls corresponding to a path of edges (eℓ, eℓ−1 . . . e1) such that eℓ = π′ (v1(π′)) there is a consecutive sequence of recursive calls that includes π′ k+1, π′ k+1, eℓ−1 = π′ k and e1 = e. To verify Observation 3.9, note that since π′ ∈ Π¬e we know that X π′ 0. The only difference between the execution of VOπ′ call MOπ′ that VOπ′ calls MOπ′ the other, since by Observation 3.2, the ranks can only decrease in a sequence of recursive calls. (π′ (v1(π′)) and VOπ(v1(π′)) will create different sequences of recursive calls is when VOπ′ (π′ (v1(π′), e) = 1 and X π(v1(π′), e) = k+1) can k) = MOπ(πk+1). Thus, the only way (v1(π′)) k). Furthermore, these two calls have to be one after k+1) = MOπ(πk) cannot call MOπ(π′ (v1(π′)) and VOπ(v1(π′)) is that MOπ′ k+1) and then MOπ′ k+1) calls MOπ′ k) but MOπ(π′ (π′ (π′ (π′ Observation 3.10 If π′ ∈ Π¬e and we are in Case (b) as illustrated in Figure 1, then in the course of the execution of VOπ′ k, and ends with e (so that, in particular, it does not include π′ k+1). That is, there is a sequence of recursive calls corresponding to a path of edges (eℓ−1 . . . e1) such that eℓ−1 = π′ (v1(π′)) there is a consecutive sequence of recursive calls that starts with π′ k and e1 = e. To verify Observation 3.10, note that since π′ ∈ Π¬e we know that X π′ (v1(π′), e) = 1 and X π(v1(π′), e) = 0. The execution of VOπ′ (v1(π′)) cannot visit e in the course of a sequence of recursive calls starting from an edge incident to v1(π′) where the edge has ranking smaller k. Otherwise, from Observation 3.6 we would get that VOπ(v1(π′)) also visits e which contradicts the premise that π′ ∈ Π¬e. We also know that VOπ′ k+1. If it would have, then since it is a self-loop, from Observa- tion 3.7, MOπ′ (v1(π′)) to terminate without visiting e, which contradicts X π′ (v1(π′)) cannot visit π′ k+1) = TRUE, causing VOπ′ (π′ (v1(π′), e) = 1. 12 k+1, eℓ−1 = π1 We shall now prove Claim 3.8. Let π1 be a ranking in Π¬e (so that π1(e) /∈ {k, k + 1}). By the definition of Π¬e and by Observations 3.9 and 3.10, we have the following. In Case (a), the execution of VOπ1 (v1(π1)) induces a sequence of (recursive) calls to the maximal matching oracle, where this sequence corresponds to a path P = (eℓ, . . . , e1) such that eℓ = π1 k, and e1 = e. In Case (b), the execution of VOπ1 (v1(π1)) induces a sequence of (recursive) calls to the maximal matching oracle, where this sequence corresponds to a path P ′ = (eℓ−1, . . . , e1) such that eℓ−1 = π1 k, and e1 = e. Since in Case (b) P is also a path in the graph, we may refer to the path P in both cases (and take into account, if needed, that in Case (b) eℓ = π1 k−1 is a self-loop and is not part of the sequence of recursive calls that reaches e). While we do not know the rankings of the edges eℓ−2, . . . e1, we know from Observation 3.2 that they are in monotonically decreasing order, and that they are all smaller than k. We also know that the path does not include any parallel edges. This is true since if et and et−1 are adjacent edges in the path P and they are parallel edges, then from Observation 3.11 π′(et−1) < π′(et). But since they are parallel, they have the same endpoints, therefore, by the definition of VOπ′ and of MOπ′, the vertex/edge from which the call MOπ′ k+1 in Case (b), the the only edge along the path P that might be a self-loop is e. Otherwise, from Observation 3.7, the self-loop will return true, and thus path P will not visit e. (et−1). Furthermore, with the exception of π′ (et) was made, would have called MOπ′ σ(ℓ), . . . π1 We can write P as P = (π1 σ(1)) where σ(i) = π1(ei), so that σ(ℓ) = k + 1 and σ(ℓ − 1) = k. We next define a mapping ϕ between rankings, such that ϕ(π1) = π0, where we shall show that π0 ∈ Πe,0, and that ϕ is one-to-one. The ranking π0 is defined as follows by "rotating" the ranks of the edges on P (and leaving the ranks of all other edges as in π1). Namely, π0(e2) = k + 1, π0(e1) = k, and π0(ej) = σ(j − 2) for every 3 ≤ j ≤ ℓ. For an illustration, see Table 1. We first verify that ϕ is a projection from Π¬e to Πe,0. eℓ eℓ−1 Rank in π1 σ(ℓ) = k + 1 σ(ℓ − 1) = k Rank in π0 σ(ℓ − 2) σ(ℓ − 3) e2 e3 . . . . . . σ(3) σ(2) . . . σ(1) σ(ℓ) = k + 1 σ(ℓ − 1) = k e1 = e σ(1) Table 1: Ranking of P = (eℓ, . . . , e1) in π1 and in π0 Namely, we need to show that: • π0 ∈ Πk, i.e., π0 k+1 and π0 k share an endpoint v2(π0), and e = (v2(π0), v3(π0)). • X π0 (v1(π0), e) = 0 (that is, the execution of VOπ0 (v1(π0)) does not create a call to MOπ0 (e)). In other words, (the execution of) VOπ0 (v1(π0)) does not visit e. The first item directly follows from the definition of π0. We thus turn to the second item. Recall that by our notational convention, v1(π0) = vd(π0 k) = vd(e2, e1) (i.e, it is the endpoint that e2 does not share with e1) so that it is the common endpoint of e2 and e3, i.e., vc(e2, e3). Since k+1, π0 π0(e3) = σ(1) < σ(ℓ) = k + 1 = π0(e2) , (23) the execution of VOπ0 VOπ0 (v1(π0)), the call to MOπ0 (v1(π0)) will visit e3 before visiting e2. Since π0(e) = k, during the execution of (e3) will not cause a recursive call to MOπ0 (e). Observe that in the execution of VOπ1 (e3) creates a recursive call on e2 (since e2 follows e3 on the path P ). Therefore, it must be the case that MOπ1 (e′)=FALSE for every e′ that has a common endpoint with e3 and such that π1(e′) < σ(2). By the definition of ϕ, all edges that are not (v1(π1)), the call to MOπ1 13 on the path P have the same ranks in π0 and in π1. Therefore, all edges with rank lower than σ(1) have the same rank in π1 and in π0. It follows that for every e′ that has a common endpoint with e3 and such that π1(e′) < σ(2), MOπ0 (v1(π0)) returns TRUE without visiting e1 = e, as required. (e′) = FALSE. We can conclude that MOπ0 (e3) = TRUE and so VOπ0 ℓ2 , e2 ℓ2−1 . . . e2 ℓ1, e1 ℓ1−1 . . . e1 1) and P 2 = (e2 It remains to show that ϕ is an injection from Π¬e to Πe,0. Assume, contrary to the claim, that ϕ is not an injection. That is, there are two different rankings π1 6= π2 ∈ Π¬e where ϕ(π1) = ϕ(π2). Let P 1 = (e1 1) be the paths that correspond to the sequence of recursive calls to the maximal matching oracle, in the executions of VOπ1 (v1(π2)) respectively, where ℓ2−1) = k (recall that if π1 corresponds to e1 1 = e2 ℓ1) = π2(e2 Case (b), then e1 is a self-loop and is not actually part of the sequence of recursive calls that reaches e, and an ℓ1 s−1 . . . e2 analogous statement holds for π2). Let s be the largest index such that (e1 1). We denote this common subsequence by (es, es−1 . . . e1). Observe that s ≥ 2. This is true since: (1) By the definitions of the paths, e1 2) = k +1, it holds that e1 1 = e, and (2) given that ϕ(π1) = ϕ(π2) = π0 and π0(e1 ℓ2) = k + 1 and π1(e1 (v1(π1)) and VOπ2 ℓ1−1) = π2(e2 1 = e, π1(e1 2) = π0(e2 s, e1 s−1 . . . e1 1) = (e2 s, e2 1 = e2 2 = e2 2. By the definitions of ϕ and s we have that π1(ei) = π2(ei) for each i ∈ [s − 2]. Thus, σ1(i) = σ2(i) for each i ∈ [s − 2], where we shall sometimes use the shorthand σ(i) for this common value. For an illustration, see Table 2. π0(e1) π0(e2) π0(e3) ... π0(es−1) σ1(s − 3) π0(es) σ1(s − 2) Rank from ϕ(π1) Rank from ϕ(π2) σ1(ℓ1 − 1) = k σ1(ℓ1) = k + 1 σ1(1) ... σ2(ℓ2 − 1) = k σ2(ℓ2) = k + 1 σ2(1) ... σ2(s − 3) σ2(s − 2) Table 2: Ranks of edges e1 1 = e2 1 . . . e1 s−2 = e2 s−2 are equal in π1 and π2 . The next observation will be useful. Observation 3.11 For every edge e′, if π1(e′) < min{σ1(s − 1), σ2(s − 1)} or π2(e′) < min{σ1(s − 1), σ2(s − 1)}, then π1(e′) = π2(e′). Therefore, MOπ1 (e′) for e′ such that π1(e′) = π2(e′) < min{σ1(s − 1), σ2(s − 1)}. (e′) = MOπ2 We consider two cases: 1. P 2 is a suffix of P 1 or P 1 is a suffix of P 2. Without loss of generality, assume that P 2 is a suffix of P 1, so that s = ℓ2. 2. Otherwise (neither path is a suffix of the other), assume without loss of generality that σ1(s − 1) < σ2(s − 1). In both cases, since e1 π0(e1 s+1) = π2(e1 s+1 is not on P 2, ϕ, when applied to π2 does not change the ranking of e1 s+1. That is, s+1). Since (by the definition of ϕ) π0(e1 s+1) = σ1(s − 1), we get that π2(e1 s+1) = σ1(s − 1) = π1(e1 s−1) . (24) 14 In the first case (where P 2 is a suffix of P 1), we have that σ2(s − 1) = k, while σ1(s − 1) < k, and so σ1(s − 1) < σ2(s − 1) (= π2(e2 s−1)) . (25) In the second case, this inequality was made as an explicit assumption. (a) v1(π ′) π ′ k+1 = πk π ′ k = πk+1 v2(π ′) π ′ k+1 = πk v3(π ′) (b) π ′ k = πk+1 v1(π ′) v2(π ′) (c) v1(π ′) v2(π ′) π ′ k+1 = πk (d) v1(π ′) π ′ k+1 = πk v2(π ′) π ′ k = πk+1 π ′ k = πk+1 π ′ k+1 = πk (e) v1(π ′) v2(π ′) π ′ k = πk+1 π ′ k+1 = πk (f) v1(π ′) π ′ k = πk+1 Figure 3: An illustration for the proof of Claim 3.8. s+1 = π1 (e2 s) visits e1 (e1 We thus have that the execution of MOπ2 k+1 is a self-loop, from Observation 3.7, MOπ2 s+1 before visiting e2 s+1). If we are in Case (b) and P 1 = (π1 s−1. We would like to under- stand what occurs in the call to MOπ2 k+1, π1 k, e), i.e., s = k, then, s = e1 since e1 s) s−1 = e, but this stands in contradiction to the definition of P 2. If we are in returns FALSE without visiting e2 Case (a), then since the path P 1 corresponds to a sequence of recursive calls to the maximal-matching oracle, s+1 and such that π1(e′) < σ1(s) = π1(e1 we have that for every edge e′ that shares an end-point with e1 s), the call to MOπ1 (e′) returns FALSE. Combining this with Observation 3.11, we get that for every edge e′ that shares an end-point with e1 (e′) returns FALSE. By Equation (24) we get that MOπ2 s) returns FALSE without s−1, but this stands in contradiction to the definition of P 2. visiting e2 Having established Claim 3.8, the proof of Lemma 3.5 is completed. s+1 and such that π2(e′) < σ1(s), the call to MOπ2 s+1) returns TRUE. Hence, MOπ2 (e1 s+1) = TRUE. Hence MOπ2 (e2 (e1 s = e1 (e2 (Claim 3.8) We are now ready to prove Theorem 3.1. Proof of Theorem 3.1: Recall that d denotes the maximum degree, ¯d denotes the average degree and ρ denotes the ratio between the maximum degree and the minimum degree, which is denoted by dmin (where the latter is at least 1 since we assumed without loss of generality that there are no isolated vertices). By combining Equations (2) and (4) and applying Lemma 3.4 (as well as recalling that we counted each self- 15 loop as contributing 2 to the degree of a vertex), we get that: 1 m! · 1 n ·Xπ∈ΠXv∈V N (π, v) ≤ ≤ 1 m! 1 m! · · 1 n 1 n = O(cid:18) m n · · · 1 1 Xk(e) mXk=1 · m ·(cid:18)m · 2(m − 1)! + 2dminXe∈E dmin(cid:19) = O(ρ · ¯d) , 2dmin d m · m − 1 2 · (m − 2)! · d(cid:19) (26) (27) (28) and we obtain the bound claimed. 4 Limiting the Exploration of Neighbor Sets The analysis in the previous section suffices to show an algorithm whose query complexity and running time are a factor of d larger than the number of oracle calls that it makes. The factor of d in this expression is due to querying all edges that are incident to the endpoints of each edge for which a call to the maximal matching oracle is made (where, as we explain momentarily, a random ranking can be selected in an online fashion). This section is devoted to a method for selecting incident edges of low rank efficiently without querying entire neighborhoods of relevant vertices. By applying the method, we reduce the query complexity and the running time by a factor of almost d. The main challenges here are to ensure that the ranks of encountered edges indeed come from the uniform distribution over all permutations and that the same decision with respect to a rank of an edge is made at both endpoints of the edges. Replacing a random ranking with random numbers. The oracle construction described as Algorithm 1 and Algorithm 2 uses a random ranking π : E → [m] of edges. We start by replacing a random ranking of edges with random real numbers in (0, 1] selected uniformly and independently for every edge e ∈ E, yielding a vector σ : E → (0, 1] which we use in the same way as the ranking π. Since the probability that two edges are assigned the same real number is 0, whenever the oracle compares the ranks of two edges e and e′, it can check whether σ(e) < σ(e′), instead of whether π(e) < π(e′), effectively yielding a random ranking of edges. Since each σ(e) is independent, this small conceptual shift allows one to generate σ(e) at random in an easier manner and to simplify the analysis. Though it is not possible to generate and store real numbers in (0, 1], we later introduce a proper discretization. 4.1 A Data Structure for Accessing Neighbors The oracle described as Algorithms 1 and 2 always collects all edges around the vertex or edge being considered and sorts them to explore them recursively in increasing order of their random numbers. In this section we introduce a data structure that is responsible for generating the random numbers and providing edges for further exploration in the desired order. For every vertex v ∈ V , we have a copy neighbors[v] of the data structure. (In fact, a copy for a given vertex is created when it is accessed for the very first time.) From the point of view of the exploration 16 algorithm, the data structure exposes only one operation: lowest(k), where k is a positive integer. The operation neighbors[v].lowest(k) lists edges incident to v in order of the random numbers assigned to them, omitting all appearances of parallel edges or self-loops except the first one, which has been assigned the lowest number. For each positive k, the operation returns a pair hw, ri, where w is a vertex and r is a number in (0, 1] ∪ {∞}. If r 6= ∞, then (v, w) is the edge with the kth lowest number in the above order, and r is the number assigned to it. Otherwise, the list is shorter than k and r = ∞ indicates the query concerned a non-existing edge. We present the implementation of the data structure in Section 4.4. We rewrite Algorithms 1 and 2 to use the data structure, and present them as the oracle VOσ(v) in Algorithm 3 and the oracle MOσ(e) in Algorithm 4, respectively. Algorithm 3: An oracle VOσ(v) for a vertex cover based on the input from the data structures neighbors, which assigns edges e random numbers σ(e) (online). Given a vertex v, the oracle returns TRUE if v belongs to the corresponding vertex cover and it returns FALSE otherwise. 1 2 3 4 5 6 7 8 i:=1 hw, ri := neighbors[v].lowest(i) while r 6= ∞ do if MOσ((v, w)) = TRUE then return TRUE i := i + 1 hw, ri := neighbors[v].lowest(i) return FALSE Algorithm 4: An oracle MOσ((u, v)) for a maximal matching based on the input from the data structures neighbors, which assigns edges e random numbers σ(e) (online). Given an edge (u, v), the oracle returns TRUE if (u, v) belongs to the corresponding matching and it returns FALSE, otherwise. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 if MOσ((u, v)) has already been computed then return the computed answer k1 := 1 and k2 := 1 hw1, r1i := neighbors[u].lowest(k1) hw2, r2i := neighbors[v].lowest(k2) while w1 6= v or w2 6= u do if r1 < r2 then if MOσ((u, w1)) = TRUE then return FALSE k1 := k1 + 1 hw1, r1i :=neighbors[u].lowest(k1) else if MOσ((v, w2)) = TRUE then return FALSE k2 := k2 + 1 hw2, r2i := neighbors[v].lowest(k2) 15 return TRUE 17 Claim 4.1 Let σ be an injection from E to (0, 1]. Let π : E → [E] be the corresponding ranking defined in such a way that for every edge e, σ(e) is the π(e)th lowest number in the set {σ(e′) : e′ ∈ E}. For every vertex v, the answer returned by VOσ(v) (Algorithm 3) is the same as the answer returned by VOπ(v) (Algorithm 1) provided the operation lowest works as specified and gives answers consistent with σ. This that the easy to verify It is is claim holds when true because when there are no parallel edges, Proof: parallel to edges. neighbors[v].lowest(1), . . . , neighbors[v].lowest(k) simply returns the first k edges inci- dent to v in order of increasing rank. Furthermore, when called on an edge (u, v), Algorithm 4 effectively merges the two corresponding lists of adjacent edges (i.e., those incident to u and those incident to v) to obtain a single list sorted according to rank, and makes recursive calls in the order dictated by the list. are there a sequence of calls no It remains to verify that the same is true when there are parallel edges. For a fixed choice of σ and the induced ranking π consider the two trees of recursive calls when calling VOπ(v) (Algorithm 1) and VOσ(v) (Algorithm 3), where the former calls the oracle Mπ (Algorithm 2), and the latter calls the oracle Mσ (Algorithm 4). When we refer to an edge in in the tree we actually mean an occurence of an edge in G on a path of recursive calls. These trees are both rooted at v, and with each edge there is an associated rank (number) and an asso- ciated answer computed by the corresponding maximal matching oracle. Recall that each path of recursive calls from the root to a leaf passes through edges with decreasing ranks (numbers). Furthermore, in both trees, if an edge (u, v) in the tree is associated with the answer FALSE, then there must be an edge (u, w) (or (v, w)) adjacent to it in the tree with lower rank (a "child" of this edge) that is associated with the answer TRUE, and it is the highest ranking child that (u, v) has. If (u, v) is associated with the answer TRUE, then all the children of (u, v) in the tree are associated with the answer FALSE. It will actually be convenient to consider the full recursion trees without the "memoization" rule that we employ (which says that once an answer is determined for an edge it is not computed again). This in particular implies that for each edge that is the last edge on a path of recursive calls, the answer associated with it must be TRUE. By the definition of VOσ(v) and the operation lowest, the tree corresponding to VOσ(v) contains only edges that have minimal ranking among each set of parallel edges that connect a pair of vertices. We claim that this tree is a "pruned" version of the tree that corresponds to VOπ(v), in the sense that all subtrees containing non-minimally ranked parallel edges are removed, and the answers associated with the remaining edges (and hence with the root v) are exactly the same. Let T π(v) denote the tree of recursive calls for VOπ(v), and let h be the height of T π(v). Starting from ℓ = h and going up the tree, we show that we can remove all non-minimally ranked parallel edges in level ℓ of T π(v) without altering the answer for their parent edges. For ℓ = h, we claim that there are no non-minimally ranked parallel edges in the last level of T π(v), so that no pruning needs to be performed. To verify this, assume in contradiction that e is a non-minimally ranked parallel edge between vertices u and w where e is at the end of a recursive path of length h in T π(v). Since e is not minimally ranked, there should be a "sibling" of e in the tree which correspond to the minimally ranked edge e′ between u and w. Since π(e′) < π(e), it must be the case that the answer associated with e′, that is, Mπ(e′), is FALSE. But e′ also belongs to level h, so that e′ is the last edge on a path of recursive calls, and hence cannot be answered FALSE. Assuming we have performed the pruning successfully for all levels ℓ < ℓ′ ≤ h, we show that we can perform it for level ℓ. Consider a non-minimally ranked parallel edge e between vertices u and v in level ℓ of T π(v). As argued above, there is a "sibling" of e in the tree which correspond to the minimally ranked 18 edge e′ between u and w. Since π(e′) < π(e), it must be the case that the answer associated with e′, that is, Mπ(e′), is FALSE. This implies that e′ has a child e′′ in the tree resulting from pruning all non-minimal parallel edges from levels ℓ′ > ℓ, such that Mπ(e′′) = TRUE. But since π(e′′) < π(e′) < π(e), and e′′ is also adjacent to e, we get that Mπ(e) is FALSE as well. Hence, it is possible to prune e from the tree without altering the answer obtained for its parent. 4.2 Implementing lowest: The High-Level Idea The pseudo-code for the procedure lowest as well as the data structure that it uses, are given in full detail in Subsection 4.4. Here we give a high-level description. For the sake of simplicity of the presentation, in this description we assume that there are no parallel edges. Roughly speaking, the procedure lowest for a vertex v is implemented in "batches". Namely, con- sidering intervals of (0, 1] of the form (2−i, 2−i+1] (for i ∈ [d⋆], where d⋆ = ⌈log d⌉, as well as the interval (0, 2−d⋆ ]), the procedure does the following. It first decides which edges incident to v should be assigned a value in the current interval (2−i, 2−i+1]. In this stage each edge is identified with its label (in {1, . . . , deg(v)}). The procedure then determines the identity of the other endpoint of each of these edges by performing a neighbor query, and it assigns the edge a value σ((v, w)), selected uniformly at random from the interval. This assignment is performed unless a certain constraint is discovered due to information held in neighbors[w], as we explain subsequently. Once σ((v, w)) is determined, the other endpoint of the edge, w, is "notified". That is, the data structure neighbors[w] is updated with this new information. The procedure "opens" a new interval (2−i+1, 2−i+2] if the index k it is called with is such that the number of neighbors w of v whose identity has been revealed and such that σ((v, w)) ≤ 2−i+1 is strictly less than k. Thus, the procedure performs queries and assigns valued to edges "on demand", but it does so for "batches" of edges. More precise details follow. The data structure neighbors maintains two values for each vertex v: lb, and next lb (where the latter is always twice the former). When a vertex is first encountered, lb is set to 0 and next lb is set to 2−d⋆. Second, the data structure maintains a dictionary assigned number, which holds, for those vertices w that are known to be neighbors of v, the value σ((v, w)) that was assigned to the edge between them (initially, the dictionary is empty). The subset of indices in {1, . . . , deg(v)} that correspond to edges for which the other endpoint has not been revealed (and do not yet have an associated value), are considered unassigned. Third, the data structure maintains a list of pairs hw, ri, where w is a (known) neighbor of v and r = σ((v, w)). This list is sorted in ascending order of r's, and it contains exactly those w for which the corresponding r is at most lb. If a call is made to neighbors[v].lowest(k) with k > deg(v) then it returns5 hv, ∞i. Otherwise, the procedure does the following until the length of sorted is at least k. It first considers those edges (v, w) incident to v that were already assigned a value r and this value belongs to the interval (lb, next lb] (that is, assigned number[w] ∈ (lb, next lb]). The setting of the value r for each such edge (v, w) was performed previously in the course of call to neighbors[w].lowest(·). Let the corresponding subset of pairs hw, ri be denoted S. The procedure next selects a subset T of {1, . . . , deg(v)} containing the labels of those (additional) edges that it will (tentatively) assign a value in (lb,next lb]. Putting aside for now the issue of time- efficiency (which we return to later), this can be done by flipping a coin with bias next lb−lb indepen- 1−lb 5Recall that we assume that there are no parallel edges, or else hv, ∞i is returned if k exceeds the "effective" degree of v, that is, counting parallel edges as a single edge. 19 dently for each edge label in the subset of unassigned edge labels. For each t ∈ T , the procedure now performs a neighbor query to obtain the tth neighbor of v. Denoting this neighbor by w, let lb' denote the lower bound lb held by w, that is, in the data structure neighbors[w]. If lb′ ≤ lb, so that the lower bound constraint imposed by w is no larger than that imposed by v, then the following operations are performed. First, a random number r in the interval (lb,next lb] is selected uniformly at random, and assigned number[w] is set to r. In addition, assigned number[v] is set to r in the data struc- ture neighbors[w] (so that w is "notified" of the revealed edge (v, w) as well as the assignment r = σ((v, w))). Finally, the pair hw, ri is added to S. If lb′ > lb, which means that lb′ ≥ next lb (given the way the intervals are defined), then the lower bound constraint imposed by the end point w of the edge (v, w) does not allow the edge to be assigned a value in the interval (lb,next lb], and so effectively its selection to T is retracted. Note that since the decision whether an edge label is added to T is done independently for the different edges, the end effect (of not assigning (v, w) a value in (lb,next lb]) is exactly the same as the one we would get if we had the knowledge in advance (before selecting T ), that the corresponding edge label t should not be selected. After going over all labels t in T , the resulting set S of pairs hw, ri is sorted in ascending order of r's, and it is appended to the end of the list sorted. Thus, sorted now includes all pairs hw, ri such that w is a neighbor of v, the value assigned to this edge is r, and r ≤ next lb. The variables lb and next lb are then updated so that lb is set to next lb and next lb is set to 2 · next lb. Once the length of sorted is at least k, the procedure returns sorted[k]. In Subsection 4.4 we formally establish that the distribution of random numbers the data structures neighbors[v] provide access to via the operation lowest(k) is the same as assigning independently at random a number from the range (0, 1] to each edge. 4.3 Generating Random Numbers In this subsection we describe a random process that generates random numbers σ(e) for edges e ∈ E. The procedure lowest applies this process in the course of its executions. In the remainder of this section, I denotes the length of an arbitrary real interval I. We do not distinguish open and closed intervals here. For instance, (0, 1) = [0, 1] = (0, 1] = [0, 1) = 1. Let d be an upper bound on the maximum vertex degree. We set d⋆ = ⌈log d⌉. For every edge e, the number σ(e) should be selected independently, uniformly at random from the range (0, 1]. We partition this range into d⋆ + 1 intervals. We set Ii =((2−i, 2−i+1] (0, 2−d⋆ ] for i ∈ [d⋆], for i = d⋆ + 1. Algorithm 5: A Process for Selecting a Random Number Assigned to an Edge 1 2 3 for i ← d∗ + 1 downto 2 do Ii with probability terminate) P1≤j≤i Ij : return a number selected from Ii uniformly at random (and return a number selected from I1 uniformly at random We describe our process as Algorithm 5. The process first selects one of the intervals Ii, and then selects a number uniformly at random from this interval. The selection of the interval is conducted as follows. We 20 consider the intervals in reverse order, from Id⋆+1 to I1. For a considered interval, we decide that the number belongs to this interval with probability equal to the length of the interval over the sum of lengths of all the remaining intervals. The process selects each interval with probability proportional to its length, and since the lengths of all intervals sum up to 1, the number that the process returns is uniformly distributed on the entire interval (0, 1]. Corollary 4.2 Algorithm 5 selects a random number from the uniform distribution on (0, 1]. Note that by simulating a few iterations of the loop in the above process, one can decide that the number assigned to a given edge is either a specific number less than or equal to 2−i, or that it is greater than 2−i without specifying it further, for some i. Later, whenever more information about the number is needed, we may continue with consecutive iterations of the loop. As we see later, we use the process in our data structures neighbors[v] to lower the query and time complexity of the resulting vertex cover algorithm. 4.4 Data Structures We now describe the data structures neighbors[v]. Each data structure neighbors[v] simulates the random process described in Section 4.3 for all edges incident to v in the course of the executions of neighbors[v].lowest. The data structure simultaneously makes a single iteration of the loop in Al- gorithm 5 for all incident edges. It may be the case that for some edge (v, w), the random number has already been specified. In this case, the result of the iteration for this (v, w) is discarded. It may also be the case that this iteration of the loop has already been taken care of by neighbors[w], the data structure for the other endpoint of the edge. The data structures communicate to make sure that a second execution of a given iteration does not overrule the first. The data structures are designed to minimize the amount of necessary communication. Note that if a data structure does not have to communicate with a data structure at the other endpoint of a given neighbor, it does not even have to know the neighbor it is connected to with a given edge, which can be used to save a single query. By using this approach, we eventually save a factor of nearly d in the query complexity. Each data structure neighbors[v] supports the following operations: neighbors[v].lowest(k): As already mentioned, this is the only operation that is directly used by the oracles (Algorithm 3 and Algorithm 4). It returns a pair hw, ri, where (v, w) is the edge with the kth lowest random number assigned to edges incident to v, omitting a second and furher appearances for parallel edges, and r is the random value assigned to (v, w). If r = ∞, then k is greater than the length of such a defined list. neighbors[v].lower bound(): The operation returns the current lower bound the data structure im- poses on the edges that are incident to v and have not been assigned a specific random number yet. The set of possible values returned by the procedure is {0} ∪ {2i : −d⋆ ≤ i ≤ 0}. Let ℓv be the num- ber returned by the operation. It implies that the data structure simultaneously simulated the random process described in Section 4.3 for incident edges until it made sure that the random numbers that have not been fixed belong to (ℓv, 1]. Furthermore, let (v, w) be an edge in the graph. Let ℓv and ℓw be the numbers returned by the operation for neighbors[v] and neighbors[w], respectively. If no specific random number has been assigned to (v, w), then we know that the random number will eventually be selected uniformly at random from (max{ℓv, ℓw}, 1]. 21 neighbors[v].set value(w, r): It is used to notify the data structure neighbors[v] that the ran- dom value assigned to (v, w) has been set to r. This operation is used when the data structure neighbors[w] assigns a specific random number to (v, w). Before assigning r, the data struc- ture neighbors[w] has to make sure that r > neighbors[v].lower bound(), i.e., it has not been decided by the data structure neighbors[v] that the random number assigned to v is greater than r. To implement the above operations, each data structure neighbors[v] maintains the following infor- mation: lb: The variable specifies the lower bound on the incident edges that were not assigned a random number yet. This is the value returned by the operation neighbors[v].lower bound(). This is also the value at which the simulation of the process generating random number for edges incident to v has stopped. next lb: If specific random numbers assigned to more edges are necessary, the next considered range of random numbers will be (lb, next lb], and next lb will become the new lower bound for the edges that have not been assigned any random number. This variable is redundant, because its value is implied by the value of lb, but using it simplifies the pseudocode. assigned number: This is a dictionary that maps neighbors w of v to numbers in (0, 1]. Initially, the dic- tionary is empty. If assigned number[w] = NONE, i.e., there is no mapping for w, then no specific random number has been assigned to any of the edges (v, w) yet. Otherwise, assigned number[w] is the lowest random number that has been assigned to any parallel edge (v, w). sorted: This is a list consisting of pairs hw, ri, where w is a neighbor of v and r is the number assigned to the edge (v, w). It is sorted in ascending order of r's, and it contains exactly those w for which the edge (v, w) (with the lowest assigned random number) has an assigned random number less than or equal to lb. For all neighbors w that do not appear on the list, the lowest number assigned to any edge (v, w) is greater than lb. We give pseudocode for all data structure operations as Algorithms 6, 7, 8, and 9. We postpone all issues related to an efficient implementation of the data structure to Section 4.6. Three of them are straightforward, and we only elaborate on the operation neighbors[v].lowest(k) (see Algorithm 9). Algorithm 6: The procedure for initializing neighbors[v] 1 2 3 4 lb := 0 next lb := 2−d⋆ assigned number := {empty map} sorted := {empty list} Algorithm 7: The procedure neighbors[v].set value(w, r) 1 assigned number[w] := r 22 Algorithm 8: The procedure neighbors[v].lower bound() 1 return lb As long as not sufficiently many lowest random numbers assigned to edges incident to v have been determined, the operation lowest simulates the next iteration of the loop in the random process that we use for generating random numbers. Let I be the interval (lb, next lb]. The operation wants to determine all random numbers assigned to edges incident to v that lay in I. First, in Line 2, it determines the random numbers in I that have already been assigned by the other endpoints of corresponding edges. In Line 3, the operation simulates an iteration of the loop of the random process for all edges incident to v to determine a subset of them that will have numbers in I (unless it has already been decided for a given edge that its random number is not in I). In the loop in Line 4, the operation considers each of these edges. Let (v, w) be one of them, where w is its other endpoint, queried by the operation. In Line 6, the operation generates a prospective random number r ∈ I for the edge. First, the operation makes sure that this iteration of the has not been simulated by the other endpoint (the condition in Step 7). If this is the case, the operation considers two further cases. If r is lower than the lowest number assigned to any parallel edge (v, w) so far, the procedure updates the appropriate data structures with this information (Steps 8 -- 11). If no random number has ever been assigned to any edge (v, w), the procedure assigns it and updates the data structures appropriately (Step 12 -- 15). When the operation finishes going over the list of all potentially selected edges and eventually determines all incident edges with new lowest random numbers, it sorts them in order of their random number and appends them in this order to the list sorted. Finally, when sufficiently many edges with lowest numbers have been determined, the operation returns the identity of the edge with the kth smallest number. Lemma 4.3 The lists of incident edges that the data structures neighbors[v] provide access to via the operation lowest(k) are distributed in the same way as when each edge is assigned independently at random a number from the range (0, 1]. Proof: We know from Corollary 4.2 that the random process generates a random number from the distribu- tion (0, 1]. Each data structure neighbors[v] simulates consecutive iterations of the loop in this process for all edges incident to v. Consider a group of parallel edges (v, w). For each of these edges, the ran- dom process is simulated by both neighbors[v] and neighbors[w]. We have to show that until the lowest number assigned to the edges in this group is determined (which happens when it is added to the list sorted), then for each edge the decision made in the first simulation matters. Why is this the case? Recall that the random process considers intervals Id⋆+1, Id⋆, . . . , I1 as the sources of the random number in this order. As long as both neighbors[v] and neighbors[w] reject a given interval their decisions are the same, so the first decision is in effect. Now suppose without loss of generality that neighbors[w] simulates a consecutive iteration of the loop in the random process and decides to use Ii as the source of the random number for a given edge (v, w) in Step 9 of the operation lowest. If neighbors[v] has already simulated this iteration (the condition verified in Step 7), the operation does not proceed. Otherwise, the ran- dom number assigned to the edge is considered for a new minimum random number assigned to this group of parallel edges. Note that since the operation keeps simulating iterations even after a random number is assigned, it could be the case for a specific copy of (v, w) that a new, higher random number is considered, but it is ignored, because it is higher than the first decision, which is the only one that has impact on the list that the operation lowest provides access to. 23 Algorithm 9: The procedure neighbors[v].lowest(k) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 while length(sorted) < k and lb < 1 do S := set of pairs hw, ri such that assigned number[w] = r and r ∈ (lb, next lb] T := subset of {1, . . . , deg(v)} with each number included independently with probability next lb−lb 1−lb foreach t ∈ T do w := tth neighbor of v r := a number selected uniformly at random from (lb, next lb] if neighbors[w].lower bound() ≤ lb then if ∃hw, r′i ∈ S s.t. r < r′ then assigned number[w] := r neighbors[w].set value(v, r) replace hw, r′i with hw, ri in S if assigned number[w] = NONE then assigned number[w] := r neighbors[w].set value(v, r) S := S ∪ {hw, ri} Sort S in ascending order of their r, and append at the end of sorted lb := next lb next lb := 2 · next lb if length(sorted) < k then return hv, ∞i else return sorted[k] The correctness of the data structure follows from the fact that it extends the list sorted by always adding all edges with random numbers in a consecutive interval, and it always takes into consideration decisions already made by data structures for the other endpoints for these intervals. 4.5 Query Complexity We now show that the number of queries that the algorithm makes is not much higher than the number of recursive calls in the graph exploration procedures. The following simple lemma easily follows from the Chernoff bound and will help us analyze the behavior of the algorithm. Lemma 4.4 Let X1, . . . , Xs be independent random Bernoulli variables such that each Xi equals 1 with probability p. It holds: • For any δ ∈ (0, 1/2), with probability at least 1 − δ. Xi ≤ 6 · ln(1/δ) · max{1, ps}. Xi 24 • For any δ ∈ (0, 1/2), if ps > 8 ln(1/δ), then with probability at least 1 − δ. Xi ≥ ps 2 . Xi Proof: Let us first prove the first claim. Otherwise, there exist independent Bernoulli random variables Yi, 1 ≤ i ≤ s such that for each i, If 6 · ln(1/δ) · max{1, ps} ≥ s, the claim follows trivially. Pr[Yi = 1] = 3 · ln(1/δ) · max{1/s, p} > p since from the definition of δ: 3 · ln(1/δ) > 1. Therefore Pr[Xi = 1] < Pr[Yi = 1]. By this fact and by the Chernoff bound, Pr[X Xi > 2E[X Yi]] ≤ Pr[X Yi > 2E[X Yi]] ≤ exp(− ln(1/δ) · max{1, ps}) ≤ exp(− ln(1/δ)) ≤ δ. The second claim also directly follows from the Chernoff bound: Pr[X Xi < ps/2] ≤ exp(−(1/2)2 · ps/2) ≤ δ. Definition 4.5 Denote Ji = Sd⋆+1 (0, 1 d ]. We expect that the number of incident edges to v with random numbers in Ji to be deg(v) · Ji. j=i Ij, where 1 ≤ i ≤ d⋆ + 1. For example: J1 = (0, 1] and Jd⋆+1 = We now define a property of vertices that is useful in our analysis. Intuitively, we say that a vertex is "usual" if the numbers of incident edges with random numbers in specific subranges of (0, 1] are close to their expectations. Definition 4.6 Let α > 0. We say that a vertex v is α-usual if the random numbers assigned to edges incident to v have the following properties for all i ∈ {1, . . . , d⋆ + 1}: • Upper bound: The number of incident edges with random numbers in Ji is at most max{α, α · deg(v) · Ji}. • Lower bound: If deg(v) · Ji ≥ α, then the number of edges with random numbers in Ji is at least deg(v) · Ji/2. We now basically want to show that the relevant vertices are α-usual, and later on we will use it to prove a lower bound. We define an additional quantity that is useful later in bounding the total running time of the algorithm. 25 Definition 4.7 For an execution of Step 9 of Algorithm 9 where the number of neighbors is k and p ∈ [0, 1] is the probability of selecting each of them, we say that the toll for running it is kp. We now prove a bound on the query complexity of the algorithm and other quantities, which are useful later to bound the running time. We start by introducing the main Lemma (Lemma 4.8), followed by proving Lemma 4.9 which will help us prove Lemma 4.8. Lemma 4.8 Consider an algorithm A that queries the input graph only via the oracle described as Algo- rithm 1. Let t ≥ 1 be the expected resulting number of calls in A to the oracles described as Algorithm 1 and Algorithm 2. Let d be an upper bound on the maximum degree of the input graph. Suppose now that we run this algorithm replacing calls to Algorithm 1 with calls to Algorithm 3. The following events hold all at the same time with probability 1 − 1/20: 1. The total number of calls to Algorithms 3 and 4 is O(t) 2. The operation lowest in data structures neighbors[v] runs at most O(t) times. 3. The query complexity of A is O(t · log2(dt)). 4. The total toll for running Step 9 of Algorithm 9 is O(t · log(dt)). Before proving Lemma 4.8 we establish the following Lemma: Lemma 4.9 Assume the conditions of Lemma 4.8. Let t′ = 100t, δ = 1/(40000t(d + 1)(d⋆ + 1)), and α = 8 · ln(1/δ). The following three events happen with probability less than 1 100 for each: 1. The total number of calls to Algorithm 3 and Algorithm 4 is bounded by t′. 2. The first 2t′ vertices for which the operation lowest is called are α-usual. 3. For the first 2t′ vertices v for which the operation lowest is called, the size of the set T generated in the jth execution of Step 9 of the operation is bounded by α · max{1, deg(v) · 2j−d⋆}. Proof: For every group of parallel edges, the operation lowest lists only the edge with the lowest number. For the purpose of this analysis we assume that the operation lists in fact all occurences of a given parallel edge. The final complexity is only reduced because of the fact that some unnecessary calls are omitted. 1. Let us bound the probability that one of the above events does not occur. By Markov's inequality the probability that the first event does not occur is bounded by 1 100 . 2. We shall now prove that the first 2t′ vertices for which the operation lowest is called are α-usual. The total number of vertices that have an incident edge for which the process generating random numbers is simulated in the above calls is bounded by 2t′ · (d + 1). The property of being α-usual is a function of only random numbers assigned to incident edges. incident edges to v with random numbers in Ji. From Lemma 4.4 we get that: j=1 Xj where p = Pr[Xj = 1] = Ji, s = deg(v), i.e. X is the number of all For Ji let X = Ps Pr(cid:2)Xi Xi > α · max{1, Jideg(v)}(cid:3) = Pr(cid:2)Xi ≤ Pr[Xi Xi > 8 · ln(1/δ) · max{1, ps}(cid:3) Xi > 6 · ln(1/δ) · max{1, ps}] < δ 26 Also, from Lemma 4.4 we get that: Pr(cid:2)Xi Xi < deg(v) · Ji 2 (cid:3) = Pr(cid:2)Xi Xi < ps 2(cid:3) < δ i.e. v is not α-usual because of Ji with probability less than 2δ. From union bound on all all i ∈ [d⋆ + 1] we get that vertex v is not α-usual with probability less than 2δ(d⋆ + 1). Using the union bound again, this time over the vertices incident to edges for which the random process is run, the probability that any of them is not α-usual is bounded by 2t′ · (d + 1) · 2δ(d⋆ + 1) = 400tδ(d + 1)(d⋆ + 1) = 1 100 . 3. We need to prove that for the first 2t′ vertices v for which the operation lowest is called, the size of the set T generated in the jth execution of Step 9 of the operation is bounded by α · max{1, deg(v) · 2j−d⋆}. Let v be one of the first 2t′ vertices for which the operation neighbors[v].lowest is called. Ob- serve that in the jth iteration of the loop while, (next lb−lb)/(1−lb) is at most 2j−d⋆. Therefore, it follows from Lemma 4.4 that for each j ∈ {1, . . . , d⋆ + 1}, the size of the set T in Algorithm 9 selected in the jth execution of Step 9 is bounded by α · max{1, deg(v) · 2j−d⋆} with probability 1 − δ. By the union bound over all j and the first 2t′ vertices, the probability that the third event does not occur is bounded by 2t′(d⋆ + 1)δ = 200t(d⋆ + 1) · 1/(40000t(d + 1)(d⋆ + 1) < 1 100 Summarizing, the probability that at least one of the three events does not occur is bounded by 3 100 < 1 20 Let us now prove Lemma 4.8 assuming that the events in Lemma 4.9 occur. Proof of Lemma 4.8: 1. We need to prove that the total number of calls to Algorithms 3 and 4 is O(t). This follows directly from Lemma 4.9, we proved it there for t′ = O(t). 2. We need to show that the operation lowest in data structures neighbors[v] runs at most O(t) times. The total number of vertices v for which the operation neighbors[v].lowest is called is bounded by 2t′, because a call to one of the oracles (Algorithms 3 and 4) requires calling the operation lowest for at most two vertices. It follows from the implementation of the oracles that the op- eration neighbors[v].lowest is executed at most 3t′ = O(t) times if the number of oracle calls is bounded by t′ (which was proved in Lemma 4.9). This is true because in Algorithm 3 we call neighbors[v].lowest once and in Algorithm 4 we call neighbors[v].lowest twice. 27 3. We will now show that the query complexity of A is O(t · log2(dt)). For each vertex v, denote kv ∈ [0, deg(v)] the number of times we call neighbors[v].lowest(k) on v. We assume that if the operation is not executed for a given vertex, then kv = 0. It holds that: kv ≤ 3t′ Xv∈V We now attempt to bound the query complexity necessary to execute the operation neighbors[v].lowest for a given v such that kv > 0. Note that the expected number of edges with random numbers in a given Ji is deg(v)/2i−1. Recall that from Lemma 4.9 we know that the first 2t′ vertices for which the operation lowest is called are α-usual. From the lower bound of α-usual (Definition 4.5) we get that If deg(v) · Ji ≥ α, then the number of edges with random numbers in Ji is at least deg(v) · Ji/2. Therefore, if then the number of edges with random numbers in Ji is at least deg(v) · Ji = deg(v)/2i−1 ≥ max{2α, 2kv } max{2α, 2kv} 2 = max{α, kv} ≥ kv i.e. if i is such that deg(v)/2i−1 is at least max{2α, 2kv }, then at least kv edges incident to v have random numbers in Ji. This also holds for i such that deg(v)/2i−1 ≥ 2αkv. Let iv be the largest integer i such that 2i ≤ deg(v) (remember i = d⋆+1, d⋆ · · · ). Since iv is the maximum i that satisfies αkv this, then 2iv +1 > deg(v) αkv ⇒ 2iv > deg(v) 2αkv ⇒ 2−iv < 2αkv deg(v) The body of the loop while in Algorithm 9 is executed at most d⋆ + 2 − iv times for v (remember we start from i = d⋆+1), independently of how many times the operation is executed for v, because all relevant edges incident to v are discovered during these iterations. From Lemma 4.9 we know that the size of the set T in Algorithm 9 selected in the jth execution of this loop is bounded by α · max{1, deg(v) · 2j−d⋆}. Furthermore, the sum of sizes of all sets T generated for v is bounded by d⋆+2−ivXj=1 α · max{1, deg(v) · 2j−d⋆} ≤ α(d⋆ + 1) + 2α · deg(v) · 22−iv ≤ α(d⋆ + 1) + 16α2kv. This also bounds the number of neighbor queries for v. Since these are the only neighbor queries in the algorithm, by summing over all v with kv ≥ 0, the total number of neighbor queries is bounded by 16α2kv ≤ 200αt(d⋆ + 1) + 16α2 · 300t = O(αt(d⋆ + α)) = O(t · log2(dt)). 2t′ · α(d⋆ + 1) +Xv∈V (Recall t′ = 200t and thatPv∈V kv ≤ 3t′). Note that degree queries appear only in Step 9 of the operation neighbors[v].lowest with one query to discover the size of the set from which a subset is selected. The number of degree queries is in this case bounded by the total number of executions of Step 9, which is at most O(t · log d). Summarizing, the total query complexity is O(t · log2(dt)). 28 4. Finally, we need to prove that the total toll for running Step 9 of Algorithm 9 is O(t · log(dt)). Recall that the toll is defined as kp where k is the number of neighbors and p is the probability to selecting each of them in an execution of Step 9 of Algorithm 9. Using arguments as above, the toll for running Step 9 in the operation neighbors[v].lowest for a given v is bounded by d⋆+2−ivXj=1 deg(v) · 2j−d⋆ ≤ 2 · deg(v) · 22−iv ≤ 8 · deg(v) · 2αkv deg(v) = 16αkv By summing over all vertices v, we obtain a bound on the total toll: 16αkv ≤ 4800αt = O(t · log(dt)). Xv∈V 4.6 Efficient Implementation We have already introduced techniques that can be used to show an approximation algorithm whose query complexity has near-linear dependence on the maximum degree d. Unfortunately, a straightforward imple- mentation of the algorithm results in a running time with approximately quadratic dependence on d. The goal of this section is to remove a factor of approximately d from the running time of the algorithm. Our main problem is how to efficiently simulate Step 9 in the operation lowest. Note that Step 9 is sampling from a binomial distribution. First, in Lemma 4.11, we prove that there is an algorithm that can simulate a binomial distribution which runs in efficient time. Finally, in Theorem 4.13, we will show how to use it in our algorithms and how to bound the running time by O(t · log3(dt)). We start by defining the binomial distribution. Definition 4.10 We write B(k, p), where k is a positive integer and p ∈ [0, 1], to denote the binomial i=1 Xi, where each Xi, 1 ≤ i ≤ k, is an independent random variable that equals 1 with probability p, and 0 with probability 1 − p. distribution with success probability p on {0, 1, . . . , k} distributed asPk is(cid:0)k q(cid:1)pq(1 − p)k−q. We now show how to efficiently sample from this distribution. It is well known that the probability that a value drawn from the binomial distribution B(k, p) equals q Lemma 4.11 Let a, b, k, and Q be positive integers, where a ≤ b and Q > 1, that can be represented in the standard binary form, using a constant number of machine words. There is an algorithm that takes a, b, k, and Q as parameters, runs in O(max{ka/b, 1} · log Q) time, and outputs an integer selected from a distribution D on {0, 1, . . . , k} such that the total variation distance between D and B(k, a/b) is bounded by 1/Q. Proof: If a = b, then the algorithm can return the trivial answer in O(1) time, so we can safely assume for the rest of the proof that a < b. Let p = a/b and let qi = (cid:0)k i(cid:1)pi(1 − p)k−i be the probability of drawing i from B(k, p). Let s = min{6 · ln(2Q) · max{1, ka/b}, k}. For each i ≤ s, we compute a real number q′ i ∈ [0, 1] such that qi − q′ i are i = 1 (details about how to compute those q′ i=0 q′ i ≤ 1/2(k + 1)Q andPs 29 given in Lemma 4.12). Then we select the output of the algorithm from the distribution given by q′ write D to denote this distribution. i's. We Let us bound the total variation distance between this distribution and B(k, p). It suffices to show that for every subsets S of {0, . . . , k}, the probability of selecting an integer from S in B(k, p) is not greater by more than 1/Q, compared to the probability of selecting an integer in S from D. Consider an arbitrary such set S. Let S1 be the subset of S consisting of numbers at most s. Let S2 be the subset of S consisting of integers greater than s. We have Recall that Xi = 1 with probability p. If s = k then Xi∈S q′ i ≥Xi∈S1 q′ i ≥ Xi∈S1(cid:18)qi − 1 2(k + 1)Q(cid:19) ≥Xi∈S1 Xi > k(cid:3) = 0 Pr(cid:2) kXi=1 Xi > s(cid:3) =(cid:2) kXi=1 qi − 1 2Q . (29) If s = 6 · ln(2Q) · max{1, ka/b} then we define δ = 1 2Q , and from Lemma 4.4 we have that Pr(cid:2) kXi=1 Hence, In other words: the probability that a number greater than s is being selected from B(k, p) (i.e. s Xi's are 1) is bounded by 1 2Q . Therefore, > 6 · ln( 1 δ 1 2Q ) · max{1, pk}(cid:3) < δ Pr(cid:2) kXi=1 > s(cid:3) < Xi∈S2 qi < +Xi∈S2 qi − Xi∈S [qi − q′ 1 2Q 1 2Q 1 2Q i] ≤ 1 Q , ≥ Xi∈S From 29 and 30 we get: Xi∈S q′ i ≥Xi∈S1 qi − Therefore, (30) qi! − 1 Q , which proves our Lemma. Next, in Lemma 4.12 we will also show that the running time of the algorithm is O(s) = O(max{k a b , 1} log(Q)). We now describe how to compute values q′ i that are approximation to qi. Lemma 4.12 Recall: a < b, p = a/b and qi =(cid:0)k Let s = min{6 · ln(2Q) · max{1, ka/b}, k}. For each i ≤ s, we can compute a real number q′ that qi − q′ i = 1. The total running time is O(max{ka/b, 1} · log Q). i=0 q′ i(cid:1)pi(1 − p)k−i (probability of drawing i from B(k, p)). i ∈ [0, 1] such i ≤ 1/2(k + 1)Q andPs 30 Proof: Observe that for 1 ≤ i ≤ k: qi = qi−1 · k + 1 − i i · p 1 − p Let ti = qi q0 for 0 ≤ i ≤ s. It holds that for 1 ≤ i ≤ s: ti = ti−1 · k + 1 − i i · p 1 − p = ti−1 · k + 1 − i i · a b − a Note that for 0 ≤ i ≤ s: (31) (32) (33) (34) = tiPj≤s tj qi q0 1 q0Pj≤s qj ≥ qi t′ i ≥ ti − max0≤j≤s tj 4(k + 1)2Q Suppose now that instead of ti, we use t′ definition of t′ i we get: i ≥ 0, 0 ≤ i ≤ s, such that ti − t′ i ≤ max0≤j≤s tj 4(k+1)2Q . Then from the Also: t′ j ≤ s · Xj≤s We have (max0≤j≤s tj) 4(k + 1)2Q +Pj≤s tj ≤ max0≤j≤s tj 4(k + 1)Q +Pj≤s tj ≤(cid:0)1 + 1 4(k + 1)Q(cid:1) ·Xj≤s tj (From 32 and that max0≤j≤s tj ≤Pj≤s tj) ≥ ( Since 1 + 1 4(k+1)2Q ≥ 1) ≥ t′ iPj≤s t′ j ≥ (1 + ti − max0≤j≤s tj 4(k+1)2Q 1 1 4(k+1)Q )Pj≤s tj qi ·Pj≤s tj 4(k+1)Q ) ·Pj≤s tj 4(k + 1)Q(cid:1) − qi 4(k+1)Q ) 1 − 1 1 1 − (1 + (1 + ≥ qi(cid:0)1 − ≥ qi − 4(k + 1)2Q 1 4(k + 1)2Q 1 4(k + 1)Q 4(k + 1)2Q − (1 + Pj≤s tj 4(k+1)2Q 1 4(k+1)Q ) ·Pj≤s tj ≥ qi − 1 2(k + 1)Q . (35) So eventually we get that Also, note thatPs i=0 qi − t′ i j=0 t′ j Ps = 1. ≤ 1 2(k + 1)Q t′ iPj≤s t′ j Therefore, in our distribution D, we will define q′ It remains to show how we obtain t′ i with the desired properties. For this purpose, we use floating-point arithmetic. Each positive number that we obtain during the computation is stored as a pair hS, Ei repre- senting S · 2E. We require that 2α ≤ S < 2α+1 and E ≤ β, for some α and β to be set later. If we can Pj≤s t′ . j i = t′ i 31 perform all standard operations on these integers in O(1) time, then we can perform the operations on the represented positive real numbers in O(1) time as well. We call S a significand and E an exponent. In particular, to multiply two numbers hS1, E1i and hS2, E2i it suffices to multiply S1 and S2, truncate the least significant bits of the product, and set the new exponent accordingly. If these two numbers are multiplicative (1 ± δ1)- and (1 ± δ2)-approximations to some quantities X1 and X2, respectively, then the product of S1 and S2 in our arithmetic is a multiplicative (1 ± (δ1 + δ2 + δ1δ2 + 2−α))-approximation to X1X2. If δ1 < 1, then the product is a (1 ± (δ1 + 2δ2 + 2−α))-approximation. For each i of interest, one can easily compute a multiplicative (1±C ·2−α)-approximation for k+1−i · a b−a in our arithmetic, where C > 1 is a constant. We make the assumption that 3Ck2α ≤ 1, which we satisfy later by setting a sufficiently large α. Hence we use Equation 31 to obtain a sequence of multiplicative (1 ± 3Ck2−α)-approximations t′ i, which i, we no longer require that Si ≥ 2α and we modify their is represented as a pair hSi, Eii. For all other t′ representation hSi, Eii so that Ei is the same as in the representation of the maximum t′ i. In the process we i or even all non-zero bits. Assuming again that 3Ck2−α < 1, may lose least significant bits of the some t′ the maximum additive error ti − t′ i for ti, where 0 ≤ i ≤ s. At the end, we find the maximum t′ i i we get for each i for the modified representation is bounded by t′ j ≤ 3Ck2−α · ti + 2 · 2−α · max tj ≤ (3Ck + 2) · 2−α · max tj, 3Ck2−α · ti + 2−α · max j j j where the first error term comes from the multiplicative error we obtain approximating each ti and the second error term comes from making all exponents in the representation match the exponent of the largest t′ i. Finally, we set α = ⌈log((3Ck+2)·4(k+1)2Q)⌉. This meets the previous assumption that 3Ck2−α < 1 and the guarantee on the error we may make on each t′ i is as desired. Note that since k and Q can be represented using a constant number of words, so can integers of size at most 2α+1. To bound β, observe that every k+1−i a b−a lies in the range [1/kb, kb], which implies that all ti lie in [1/kbk, kbk], and the maximum absolute value of an exponent we need is of order O(k log(kb)), which can be stored using a constant number of machine words. · i sentation of t′ the algorithm is O(s). To generate a random number from D, we consider only the significands Si in the final modified repre- j. The total running time of i's, and select each i with probability Si/Pj<s Sj = t′ We are ready to prove that the entire algorithm can be implemented efficiently. We use the algorithm of i/Pj<s t′ Lemma 4.11 for efficiently simulating Step 9 in the operation lowest. Theorem 4.13 Consider an algorithm A that queries the input graph only via the oracle described as Algorithm 1. Let t ≥ 1 be a bound on the expected resulting number of calls in A to the oracles described as Algorithm 1 and Algorithm 2, and such that t fits into a constant number of machine words using the standard binary representation. Let d be an upper bound on the maximum degree of the input graph. Suppose that calls to Algorithm 1 are replaced with calls to Algorithm 3. The oracles described as Algorithm 3 and Algorithm 4 can be implemented in such a way that with probability 4/5 all of the following events hold: • The number of queries to the graph is O(t · log2(dt)). • The total time necessary to compute the answers for the queries to the oracles is O(t · log3(dt)). • The distribution of the answers that the oracle gives is D such that for some other distribution D′ over 5 · D′ is the distribution of answers of the oracle described 5 · D + 1 answers, the convex combination 4 as Algorithm 1. 32 Proof: Let a⋆ = d · O(t), where O(t) is the bound from Lemma 4.8 on the number of vertices for which the operation lowest is called. If the event specified in Lemma 4.8 occurs, then a⋆ is an upper bound on the number of edges for which the process for generating random numbers is simulated. Let b⋆ = O(t) · (d⋆ + 1) = O(t log d), where O(t) is the same bound as above. Then b⋆ bounds the number of times Step 9 in Algorithm 9 is run, provided the event specified in Lemma 4.8 occurs. Let Q = 20b⋆. Let c⋆ = max{d⋆, ⌈log(20a2 ⋆)⌉}. Since it is impossible to generate and store real numbers, we assign to edges uniform random numbers from the set {i/2c⋆ : 1 ≤ i ≤ 2c⋆}, instead of the set (0, 1]. This can be seen as selecting a random number from (0, 1] and then rounding it up to the next multiplicity of 1/2c⋆. In particular, for every i ∈ {1, . . . , 2c⋆}, all numbers in ((i − 1)/2c⋆ , i/2c⋆ ] become i/2c⋆. Observe also that each range Ij is a union of some number of sets ((i − 1)/2c⋆ , i/2c⋆ ], because c⋆ ≥ d⋆. This means that there is no need to modify the process for generating random numbers, except for selecting a random i/2c⋆ in a specific Ij, instead of an arbitrary real number from Ij. Observe also that as long we do not select the same number i/2c⋆ twice, the entire exploration procedure behaves in the same way as in the idealized algorithm, since the ordering of numbers remains the same. Note that due to the assumption in the lemma statement, t can be represented in the standard binary form, using a constant number of machine words. This is also the case for d, because of the standard assumption that we can address all neighbors of all vertices in neighbor queries. This implies that Q = O(t log d) also has this property. Finally, the probabilities next lb−lb can easily be expressed using fractions a/b, where a and b are of order O(d), and therefore, fit into a constant number of machine words as well. This implies that we can use the algorithm of Lemma 4.11. Instead of directly simulating Step 9, we proceed as follows. First, we run the algorithm of Lemma 4.11 with the error parameter Q to select a number t of edges in T . Then we select a random subset of edges of size t. This can be done in O(t log d) time. 1−lb We show that the algorithms and data structures can be implemented in such a way that the main claim of the theorem holds, provided the following events occur: • the events described in the statement of Lemma 4.8, • the rounded numbers assigned to the first a⋆ edges for which the process for generating random numbers is simulated are different, • the first b⋆ simulations of the algorithm described by Lemma 4.11 do not result in selecting a random number from the part on which the output distribution of the algorithm and the binomial distribution differ. The first of the events does not happen with probability at most 1/10. This follows from Lemma 4.8. Consider the second event. The probability that two random numbers i/2c⋆ are identical is bounded by 1/2c⋆ ≤ 1/(20a2 ⋆). Consider the first a⋆ edges for which the process generating random numbers is run. The expected number of pairs of the edges that have the same random number is bounded by a2 ⋆) = 1/20. By Markov's inequality, the probability that two of the edges have the same random number assigned is bounded by 1/20. Finally, the probability that the last event does not occur is bounded by 1/20 as well via the union bound. Summarizing, the events occur with probability at least 4/5. ⋆ ·1/(20a2 We now bound the running time, provided the above events occur. We assume that we use a standard data structure (say, balanced binary search trees) to maintain collections of items. The time necessary for each operation in these data structures is of order at most the logarithm of the maximum collection size. For instance, we keep a collection of data structures neighbors[v] for v that appear in our algorithm. We create neighbors[v] for a given v only when it is accessed for the first time. Observe that the number of 33 v for which we have to create neighbors[v] is bounded by the query complexity O(t log2(dt)), because of how we access vertices. Therefore, accessing each neighbors[v] requires at most O(τ ) time, where we write τ to denote the logarithm of the bound on the query complexity. That is, τ = O(log t + log log d). The time necessary to run Algorithm 3 is bounded by O(τ ), which we need to locate the data structure neighbors[v] for a given v, plus O(1) time per each call to Algorithm 4 (we do not include the cost of running Algorithm 4 or the operation lowest here; they are analyzed later). The amount of computation in Algorithm 3 without the resulting calls to other procedures is bounded by O(t · τ ). Consider now Algorithm 4. In every run, we first spend O(log t) time to check if we have already com- puted the answer for a given edge. Then locating the data structures neighbors[u] and neighbors[v] for the endpoints u and v costs at most O(τ ). The running time of the reminder of the algorithm requires time proportional to the number of recursive calls. Therefore, the total amount of time spent executing Algorithm 4 (without calls to other procedures) is bounded by O(t · τ ). We now bound the running time necessary to execute all operations of data structures neighbors. The initialization of neighbors[v] (Algorithm 6) for a given v can be done O(1) time plus O(τ ) time necessary for inserting the data structure into the collection of all neighbors[v]. Overall, since at most O(t log2(dt)) data structures are created, the total time necessary to initialize the data structures neighbors[v] is O(t · log2(dt) · τ ). Setting a value for some edge in Algorithm 7 takes at most O(log d) time to insert the value into the mapping. This operation is run at most once for every neighbor query, so the total amount of computation in this procedure is O(t · log2(dt) · log d). So far, the total computation time is bounded by O(t log3(dt)). Clearly, running the operation described by Algorithm 8 takes O(1) time, so overall the total amount of computation in all executions of Algorithm 8 is not greater than some constant times the total amount of computation in the operation lowest (Algorithm 9). Hence it suffices to bound the total amount of computation in Algorithm 9, which we do next. Recall that Algorithm 9 is run at most O(t) times. Therefore all operations in the loop while are run at most O(t log d) times. The total size of sets S in Step 2 is bounded by the query complexity, and dis- covering each element of S costs at most O(log d) time, if the data structure assigned number is properly implemented, using augmented balanced binary search trees. Therefore the total cost of running Step 2 is at most O(t · log d + t · log2(dt) · log d) = O(t · log2(dt) · log d). In Step 3, we use the algorithm of Lemma 4.11. The total toll for running the algorithm is O(t · log(dt)). Therefore, the total time necessary to simulate all executions of Step 2 is bounded by O((t · log d + t · log(dt)) · log Q) = O(t · log2(dt)). The total number of executions of the body of the loop foreach in Step 4 is bounded by the query complexity O(t · log2(dt)) times 2. The time required to execute the body of the loop is dominated by the following two kinds of operations. One kind is querying and modifying the data structure assigned number[w] and the data structure for S. With a proper implementation (say, augmented balanced binary search trees) these operations take at most O(log d) time each. The other kind of operation is locating neighbors[w] for the discovered neighbor w, which takes most O(τ ) time. The total computation time for all executions of the loop foreach is therefore bounded by O(t · log3(dt)). Finally sorting S never takes more than O(S log d) time, because S ≤ d, and each element of S can be added at the end of the list sorted in amortized O(1) time if the list is implemented using extendable arrays. This amounts to O(t · log2(dt) · log d) in all executions of Step 11. At the end of the operation, the requested kth adjacent edge can be returned in O(1) time. Summarizing, the computation of the answers of the oracles takes at most O(t · log3(dt)) time, if all the desired events occur, which happens with probability at least 4/5. Note that when these events occur, 34 then also despite rounding random numbers assigned to edges, the implementation does not diverge from the behavior of the idealized oracle. 5 The Near-Optimal Algorithms Theorem 3.1 gives a bound on the expected number of recursive calls to oracles, sufficient to compute an answer when the vertex cover oracle is called for a random vertex. The expected number of calls is O(ρ · ¯d), where ρ is the ratio between the maximum degree d and the minimum degree dmin, and ¯d is the average degree. (Recall that we assume without loss of generality that dmin ≥ 1. For isolated vertices, the oracle answers that they are not in the vertex cover in O(1) time, and therefore, it suffices to focus on the subgraph consisting of non-isolated vertices.) A straightforward application of Theorem 3.1 gives a bound of O(d2) for graphs with maximum degree bounded by d. We show a bound of O(d/ǫ) for a modified graph, which is preferable if 1/ǫ < d, and we also show how to use the modified graph to obtain an estimate for the minimum vertex cover size in the original input graph. We combine the obtained bound with Theorem 4.13 to get a fast and query-efficient algorithm. Next we show how to obtain an efficient algorithm for the case when only the average degree of the input graph is bounded. Finally, we show how to adapt the algorithm to the dense graph case, when only vertex-pair queries are allowed. 5.1 Bounded Maximum Degree As we have mentioned above, we can assume that 1/ǫ < d. We transform our graph into one with large minimum degree, so that the ratio of maximum to minimum degree is small. For a given graph G = (V, E) V ′ and E′ are defined as follows. The set V ′ contains a "shadow" vertex v′ for each vertex v ∈ V , and E′ contains ⌊ǫd⌋ parallel edges between v and v′, and 8d parallel self-loops for v′. with maximum degree d, consider a graph eG = (eV ,eE), such that eV = V ∪ V ′ and eE = E ∪ E′ where For a random ranking π over eE, for the output vertex cover Cπ(eG) on the new graph eG, we are interested in bounding the size of Cπ(eG) ∩ V as compared to VCopt(G) (the size of a minimum vertex cover of G). Since Cπ(eG) ∩ V is a vertex cover of G, we have that Cπ(eG) ∩ V ≥ VCopt(G), and so we focus on an upper bound for Cπ(eG) ∩ V . the construction of Cπ(eG) ∩ V , we have Consider an arbitrary ranking π of E. Observe that for each v ∈ V , the matching Mπ(eG) either includes rank of self-loops incident to v′ is lower than the lowest rank of edges (v, v′), then Mπ(eG) contains one most ǫd/8d = ǫ/8. Therefore, the expected number of edges in Mπ(eG) ∩ F is upper bounded by ǫn/8. probability 1 − 1/20, Mπ(eG) ∩ F ≤ ǫn/4. Cπ(eG) ∩ V ≤ 2Mπ(eG) ∩ E + Mπ(eG) ∩ F ≤ 2VCopt(G) + Mπ(eG) ∩ F . Without loss of generality, we can assume that ǫn > 72, since otherwise we can read the entire input with only O(1/ǫ2) queries and compute a maximal matching in it. It follows from the Chernoff bound that with Let F be the set of all parallel edges connecting each v with the corresponding v′. By the properties of a parallel edge between v and v′ or it includes a self-loop incident to v′. For every v′ ∈ V ′, if the lowest of the self-loops, and does not contain any parallel edge (v, v′). If the ranking π is selected uniformly at random, the above inequality on ranks does not hold for each vertex independently with probability at 35 in O(1) time, using O(1) queries to G. Therefore, we can simulate an execution of the vertex-cover and the Observe that given query access to G, we can provide query access to eG (in particular, the edges in E′ that are incident to each v ∈ V can be indexed starting from deg(v) + 1). Every query to eG can be answered maximal-matching oracles on eG. Note that the expected number of recursive calls to the maximal matching oracle is bounded for a random vertex v ∈ V by O(d/ǫ), because the maximum degree and the minimum degree are within a factor of O(1/ǫ). Also note that since V = V /2, this expectation for a random vertex v ∈ V is at most twice as much, i.e., it is still O(d/ǫ). For any ranking π of edges in eE, if we sample O(1/ǫ2) vertices from V with replacement, then the fraction of those in Cπ(eG) ∩ V is within an additive ǫ/8 of Cπ(eG) ∩ V /V with probability at least 1 − 1/20. Let µ be this fraction of vertices. Therefore, we have that VCopt(G) − ǫn/4 ≤ µ · n ≤ 2VCopt(G) + ǫn/2 with probability at least 1 − 1/10. Thus (µ + ǫ/4) · n is the desired (2, ǫn)-estimate. The expected number of calls to the vertex cover and maximal matching oracles is bounded by O(d/ǫ3). Note that without loss of generality, ǫ ≥ 1/4n, because any additive approximation to within an additive factor smaller than 1/4 yields in fact the exact value. Therefore the expected number of calls to the oracles is bounded by O(n4), which can be represented with a constant number of machine words in the standard binary representation, using the usual assumption that we can address all vertices of the input graph. By applying now Theo- rem 4.13, we obtain an implementation of the algorithm. It runs in O(d/ǫ3 · log3(d/ǫ)) time and makes O(d/ǫ3 · log2(d/ǫ)) queries. Moreover, the probability that the implementation diverges from the ideal algorithm is bounded by 1/5. Therefore, the implementation outputs a (2, ǫn)-estimate with probability 1 − 1/10 − 1/5 ≥ 2/3. Corollary 5.1 There is an algorithm that makes O( d log3 d ǫ ) time, and with probability 2/3, outputs a (2, ǫn)-estimate to the minimum vertex cover size. ǫ3 · log3 d ǫ ) neighbor and degree queries, runs in O( d ǫ3 · 5.2 Bounded Average Degree In this section, we assume an upper bound ¯d on the average graph degree and show an efficient algorithm in this case.6 To do this, we will transform the graph into a new graph for which the ratio of the maximum degree to the minimum degree is small. Our first transformation is to automatically add high degree vertices to the cover, and continue by finding a cover for the graph that is induced by the remaining vertices. Given a graph G = (V, E) with average degree ¯d, let L denote the subset of vertices in G whose degree is greater than 8 ¯d/ǫ. Hence, L ≤ ǫn/8. Let E(L) denote the subset of edges in G that are incident to vertices in L, and let G = (V , E) be defined by V = V \ L and E = E \ E(L), so that the maximum degree in G is at most 8 ¯d/ǫ. For any maximal matching M in G we have that VCopt(G) ≤ 2M + L ≤ 2VCopt(G) + ǫ 8 n . Thus, the first modification we make to the oracles is that if the vertex-cover oracle is called on a vertex v such that the degree of v is greater than (4/ǫ) ¯d, then it immediately returns TRUE. 6As shown in [PR07], we don't actually need to know ¯d for this purpose, but it suffices to get a bound that is not much higher than (4/ǫ) ¯d, and such that the number of vertices with a larger degree is O(ǫn), where such a bound can be obtained efficiently. 36 The remaining problem is that when we remove the high degree vertices, there are still edges incident to vertices with degree at most (4/ǫ) ¯d whose other endpoint is a high degree vertex, and this is not known until the appropriate neighbor query is performed. We deal with this by adding shadow vertices to replace the removed high degree vertices. At the same time, we increase the minimum degree as in the previous subsection. We now create a graph eG = (V ∪eV , E ∪ eE) as follows. For every v ∈ V , we add toeV a vertex i , where 1 ≤ i ≤ ⌈degG(v)/ ¯d⌉ and degG(v) is the degree of v in G. Each of these new v′ and vertices v′′ vertices has 32 ¯d/ǫ parallel self-loops. Moreover, we add ¯d parallel edges between v and v′. Finally, partition the edges incident to v in G into ⌈degG(v)/ ¯d⌉ groups, each of size at most ¯d. The first group corresponds to the first ¯d edges on the neighborhood list of v, the second group corresponds to the next ¯d edges, and so on. Let Ev,i ⊂ E be the set of edges in the i-th group. For every i of interest, we add Ev,i ∩ E(L) parallel edges between v and v′′ i . We add these edges so that we i and Ev,i \ E(L) parallel self-loops incident to v′′ are later able to simulate every query to eG using a constant number of queries to G. Let us bound the total number of vertices ineV . The number of vertices v′ is V . The number of vertices v′′ i is bounded by Xv∈V(cid:24) degG(v) ¯d (cid:25) ≤Xv∈V(cid:18) degG(v) ¯d + 1(cid:19) ≤ ¯d · V ¯d + V = 2V , i . We have We now repeat an argument from the previous section that despite the additional edges and vertices, because eV has been created by removing vertices with highest degrees in G, and the average degree of vertices in eV in G cannot be greater than ¯d, the initial average degree. This shows that eV ≤ 3V . Cπ(eG) ∩eV is likely to be a good approximation to VCopt(G) for a random ranking π. First, Cπ(eG) ∩eV is still a vertex cover for G, so VCopt(G) ≤ Cπ(eG) ∩eV . Let F be the set of edges connecting all v with the corresponding v′ and v′′ Cπ(eG) ∩ V ≤ 2Mπ(eG) ∩ E + Mπ(eG) ∩ F ≤ 2VCopt(G) + Mπ(eG) ∩ F . of the parallel edges connecting this vertex to the corresponding vertex in V , then one of the self-loops is selected for the maximal matching as opposed to the parallel edges. The inequality on ranks does not hold Observe that if for some of the vertices in eV , the lowest rank of self-loops is lower than the lowest rank with probability at most ¯d/(32 ¯d/ǫ) = ǫ/32 independently for each vertex in eV . It therefore follows from the Chernoff bound that the number of edges in Mπ(eG) ∩ F is not bounded by ǫeV /16 with probability at most exp(−ǫeV /32), which is less than 1/20 if eV > 100/ǫ, and we can assume that this is the case. (To circumvent the case of eV ≤ 100/ǫ, we can modify the algorithm as follows. If a sampled vertex belongs to a connected component in V of size at most 100/ǫ, then we can read its connected component in eG and deterministically find a maximal matching that uses only edges in E and self-loops in eE. This all takes at most O( ¯d/ǫ2) time, which as we see later, we are allowed to spend per each sampled vertex.) Therefore, we have with probability at least 1 − 1/20. Cπ(eG) ∩ V ≤ 2VCopt(G) + ǫV /4, Observe that given query access to G, we can efficiently provide query access to eG. Degrees of vertices in V are the same as in G. For associated vertices ineV it is easy to compute their degree in O(1) time, using the degree of the corresponding vertex in V . To answer neighbor queries for vertices v in V , except for the fixed connections to v′, it suffices to notice that if the corresponding edge in G is connected to a vertex in L, this connection is replaced by a connection to an appropriate vertex v′′ i . Otherwise, the edge remains in E. 37 For vertices v′′ i some number of connections can either be a connection to the corresponding v or a self-loop. This can be checked in O(1) time with a single query to the neighborhood list of v. All the other edges are fixed. Therefore, we can simulate an execution of the vertex-cover and the maximal-matching oracles on which we assume we can do. random vertex v ∈ V is at most twice as much, i.e., it is still O( ¯d/ǫ2). The expected number of recursive calls to the maximal matching oracle is bounded by O( ¯d/ǫ2) for a eG. Answering every query to eG requires O(1) time and O(1) queries to G. Sampling vertices uniformly at random from in V ∪eV is more involved, but in our algorithm, we only need to sample vertices from V , random vertex v ∈ V ∪ eV , because the maximum degree and the minimum degree are within a factor of O(1/ǫ) and the maximum degree is bounded by O( ¯d/ǫ). Note that since 3V ≥ eV , this expectation for a For any ranking π of edges in eG, if we sample O(1/ǫ2) vertices from V with replacement, then the fraction of those for which the oracle answers TRUE is within an additive error ǫ/8 of the total fraction of vertices for which the oracle answers TRUE. with probability 1 − 1/20. Let µ be the fraction of sampled vertices. We have VCopt(G) − ǫn/8 ≤ µ · n ≤ 2VCopt(G) + ǫn/4 + ǫn/8 + ǫn/8 with probability 1 − 1/10. Then (µ + ǫ/8)n is the desired (2, ǫn)-estimate. The expected number of calls to the vertex cover and maximal matching oracles is bounded by O(d/ǫ4). As before, without loss of generality, this quantity can be bounded by O(n5), which fits into a constant number of machine words. By applying now Theorem 4.13, we obtain an implementation of the algorithm. It runs in O(d/ǫ3 · log3(d/ǫ)) time and makes O(d/ǫ3 · log2(d/ǫ)) queries. Moreover, the probability that the implementation diverges from the ideal algorithm is bounded by 1/5. Therefore, the implementation outputs a (2, ǫn)-estimate with probability at least 1 − 1/5 − 1/10 ≥ 2/3. Corollary 5.2 There is an algorithm that makes O( log3 ¯d ǫ ) time, and with probability 2/3, outputs a (2, ǫn)-estimate to the minimum vertex cover size. ǫ4 · log2 ¯d ¯d ǫ ) neighbor and degree queries, runs in O( ¯d ǫ4 · 5.3 Adapting the Algorithm to the Vertex-Pair Query Model The focus of this paper was on designing a sublinear-time algorithm whose access to the graph is via degree queries and neighbor queries. In other words, we assumed that the graph was represented by adjacency lists (of known lengths). When a graph is dense (i.e., when the number of edges is Θ(n2)), then a natural alternative representation is by an adjacency matrix. This representation supports queries of the form: "Is there an edge between vertex u and vertex v?", which we refer to as vertex-pair queries. We next show how to adapt the algorithm described in the previous section to an algorithm that per- forms vertex-pair queries. The query complexity and running time of the algorithm are (with high constant probability) O(n/ǫ4), which is linear in the average degree for dense graphs. As in the previous section, the algorithm outputs (with high constant probability) a (2, ǫ)-estimate of the size of the minimum vertex cover. We recall that the linear lower bound in the average degree [PR07] also holds for the case that the average degree is Θ(n) and when vertex-pair queries are allowed. Given a graph G = (V, E), let eG = (eV ,eE) be a supergraph of G that is defined as follows. For every vertex v ∈ V whose degree in G is less than7 n, there exists a vertex v′ ∈ eV , where there are 7 If there are no self-loops in the original graph, then the bound is n − 1. 38 n − degG(v) parallel edges between v and v′, and there are (8/ǫ)n self-loops incident to v′. As shown in 2VCopt(G) + (ǫ/4)n. Subsection 5.1, with high probability over the choice of a ranking π over eG, we have that Cπ(eG) ∩ V ≤ Note that we can emulate neighbor queries to eG given access to vertex-pair queries in G as follows. Let degree and the minimum degree in eG is at most 1/ǫ, and the maximum and average degrees are O(n/ǫ), we the vertices in G be {1, . . . , n}. When the jth neighbor of vertex i is queried, then the answer to the query is j when (i, j) ∈ E, and it is i′ (the new auxiliary vertex adjacent to i) when (i, j) /∈ E. The degree of every vertex in V is n, so there is no need to perform degree queries. Since the ratio between the maximum obtain an algorithm whose complexity is O(n/ǫ4), as claimed. References [BSS08] Itai Benjamini, Oded Schramm, and Asaf Shapira. Every minor-closed property of sparse graphs is testable. In STOC, pages 393 -- 402, 2008. [CEF+05] Artut Czumaj, Funda Ergun, Lance Fortnow, Avner Magen, Ilan Newman, Ronitt Rubinfeld, and Christian Sohler. Approximating the weight of the euclidean minimum spanning tree in sublinear time. SIAM Journal on Computing, 35(1):91 -- 109, 2005. [CHW08] Andrzej Czygrinow, Michal Ha´n´ckowiak, and Wojciech Wawrzyniak. Fast distributed approx- imations in planar graphs. In DISC, pages 78 -- 92, 2008. [CRT05] Bernard Chazelle, Ronitt Rubinfeld, and Luca Trevisan. Approximating the minimum spanning tree weight in sublinear time. SIAM J. Comput., 34(6):1370 -- 1379, 2005. [CS09] Artur Czumaj and Christian Sohler. Estimating the weight of metric minimum spanning trees in sublinear time. SIAM Journal on Computing, 39(3):904 -- 922, 2009. [CSS09] Artur Czumaj, Asaf Shapira, and Christian Sohler. Testing hereditary properties of nonexpand- ing bounded-degree graphs. SIAM J. Comput., 38(6):2499 -- 2510, 2009. [Ele10] [Fei06] [GR08] G´abor Elek. Parameter testing in bounded degree graphs of subexponential growth. Random Struct. Algorithms, 37(2):248 -- 270, 2010. Uriel Feige. On sums of independent random variables with unbounded variance, and estimat- ing the average degree in a graph. SIAM Journal on Computing, 35(4):964 -- 984, 2006. Oded Goldreich and Dana Ron. Approximating average parameters of graphs. Random Struc- tures and Algorithms, 32(4):473 -- 493, 2008. [GRS10] Mira Gonen, Dana Ron, and Yuval Shavitt. Counting stars and other small subgraphs in sub- linear time. In SODA, pages 99 -- 116, 2010. [HKNO09] Avinatan Hassidim, Jonathan A. Kelner, Huy N. Nguyen, and Krzysztof Onak. Local graph partitions for approximation and testing. In FOCS, pages 22 -- 31, 2009. [MR09] Sharon Marko and Dana Ron. Approximating the distance to properties in bounded-degree and general sparse graphs. ACM Transactions on Algorithms, 5(2), 2009. 39 [NO08] [NS11] [PR07] [PS98] [Yos11] [YYI09] Huy N. Nguyen and Krzysztof Onak. Constant-time approximation algorithms via local im- provements. In FOCS, pages 327 -- 336, 2008. Ilan Newman and Christian Sohler. Every property of hyperfinite graphs is testable. In STOC, 2011. To appear. Michal Parnas and Dana Ron. Approximating the minimum vertex cover in sublinear time and a connection to distributed algorithms. Theor. Comput. Sci., 381(1-3):183 -- 196, 2007. Christos Papadimitriou and Kenneth Steiglitz. Combinatorial Optimization: Algorithms and Complexity. Dover publications, 1998. Yuichi Yoshida. Optimal constant-time approximation algorithms and (unconditional) inap- proximability results for every bounded-degree CSP. In STOC, 2011. Yuichi Yoshida, Masaki Yamamoto, and Hiro Ito. An improved constant-time approximation algorithm for maximum matchings. In STOC, pages 225 -- 234, 2009. 40
1008.3546
1
1008
2010-08-20T17:58:00
Homogeneous and Non Homogeneous Algorithms
[ "cs.DS", "cs.CC" ]
Motivated by recent best case analyses for some sorting algorithms and based on the type of complexity we partition the algorithms into two classes: homogeneous and non homogeneous algorithms. Although both classes contain algorithms with worst and best cases, homogeneous algorithms behave uniformly on all instances. This partition clarifies in a completely mathematical way the previously mentioned terms and reveals that in classifying an algorithm as homogeneous or not best case analysis is equally important with worst case analysis.
cs.DS
cs
Homogeneous and Non Homogeneous Algorithms Paparrizos K. Ioannis Department of Informatics Aristotle University of Thessaloniki 54124 Thessaloniki, Greece E-mail: [email protected] Abstract Motivated by recent best case analyses for some sorting algorithms and based on the type of complexity we partition the algorithms into two classes: homogeneous and non homogeneous algorithms. Although both classes contain algorithms with worst and best cases, homogeneous algorithms behave uniformly on all instances. This partition clarifies in a completely mathematical way the previously mentioned terms and reveals that in classifying an algorithm as homogeneous or not best case analysis is equally important with worst case analysis. Keywords: Algorithm analysis, Algorithm complexity, Algorithm classification. 1. Introduction In the 70s and 80s a lot of discussion was going on regarding the right use of the asymptotic symbols O, Θ and Ω used to analyze algorithms and compare their theoretical efficiency. Some researchers use these symbols to denote the rate of growth of functions and others to denote sets of functions; see relevant comments in [Brassard (1985)], [Gurevich (1986)] and [Knuth (1976)]. Following the approach of using the asymptotic symbols as sets of functions we partition the class of algorithms into two non empty subclasses: homogeneous and non homogeneous algorithms. Both classes are wide. They contain iterative and recursive algorithms. Although both classes contain algorithms with worst and best cases, homogeneous algorithms behave uniformly on all instances of the problem being solved. The partition clarifies in a completely mathematical way the terms of algorithm, worst and best case complexity, the only difference between them being the sets of instances they referred to. This classification of algorithms was triggered by recent theoretical result concerning best case analysis of some heapsort algorithms [Bollobas et.al (1996)], [Ding et.al (1992)], [Dutton (1993)], [Edelkamp (2000)], [Edelkamp (2002)], [Fleischer (1994)] [Schaffer et.al (1993)] and [Wang et.al (2007)]. Also, computational results indicate that best case analysis might have practical value too, see for example [Edelkamp (2002)] and [Wang et.al (2007)]. Our results indicate that in order to classify an algorithm as homogeneous or not the complexity of the exact, up to a set of functions defined by the asymptotic symbol Θ, best case and worst case must be computed. When the classification is accomplished the analysis of the complexity of the algorithm is complete, indicating, from a theoretical point of view, that best case analysis is equally important with the worst case analysis. The term inhomogeneity has been used by Nadel B.A. [Nadel (1993)] who characterises the imprecision of an analysis of an algorithm in terms of the difference ΔC = cw - cb between the worst and best case complexity, where C is a proper measure of complexity. In particular, for the sorting problem C is the number of comparisons. Using various combinations of disorder parameters, Nadel [Nadel (1993)] partitions the set of instances in big, medium, small, tiny and singleton subclasses and computes the inhomogeneity in each subclass. Other relevant results for other problems are presented in [Haralick et.al (1980)],[Nadel (1986)],[Nadel (1990)] and [Nudel (1983)]. Our approach is different in the sense that the set of algorithms is partitioned and not the set of instances of the problem. In the next section we formally describe the two classes of algorithms. Some details regarding the algorithm classification are presented in section 3. Recursive and divide and conquer homogeneous and non homogeneous algorithms are discussed and some side results are also presented in the last section. 2. Description of the two classes. We derive our results using the Random Access Machine (RAM) model in which every elementary operation such as addition, subtraction, multiplication and division of two numbers, comparison of two numbers, reading and writing a number in the memory, calling a function, etc., is executed in constant time. It is well known that all constant functions belong to the set Θ(1). Recall that Θ(g(n)) denotes a set of functions defined as follows: Definition 1. Given a function g(n) we denote by Θ(g(n)) the set of functions t(n) for which there exists constants a > 0 and b > 0 and a positive integer n0 such that b g(n) ≤ t (n) ≤ a g(n) (1) for every n ≥ n0. All functions used in this paper denote time and therefore they are positive. The argument n denotes the dimension of the problem and, hence, it is a positive integer. The sets of functions O(g(n)) and Ω(g(n)) are similarly defined. Simply, in the definition of O(g(n)) the left inequality of (1) is missing while in the definition of Ω(g(n)) the right. Observe that Θ(g(n)) is strictly contained in the sets O(g(n)) and Ω(g(n)). As a result the assumption that the basic operations are executed in Θ(1) time (instead of O(1) or Ω(1) time) provides a more precise algorithm analysis. It is well known that the symbol Θ considered as a binary relation between functions is reflexive, symmetric and transitive and therefore it partitions the set of functions into disjoined classes. In other words, if f(n) and g(n) are two different functions, then either Θ(f(n)) = Θ(g(n)) or Θ(f(n)) ∩ Θ(g(n)) = Ø. In particular the following two results are well known. Theorem 1. If f(n) ∈ Θ(g(n)), then Θ(f(n)) = Θ(g(n)). Theorem 2. The sets Θ(1) and Θ(n) are disjoint. Given a computational problem we denote the set of instances of dimension n by I(n). Consider now an algorithm A solving the problem under consideration. The time taken by algorithm A to solve instance i of dimension n is denoted by tA(i, n). In algorithm analysis we try to describe in a nice way the set of time functions Ѕ = { tA(i, n) : i∈ I(n) } One way to do this is via the sets of functions defined by the asymptotic symbols O, Θ, Ω. We are completely satisfied if we can determine a function g(n) such that (2) S ⊆ Θ(g(n)) Once again, observe that we use the set Θ(g(n)) which is strictly contained in the sets O(g(n)) and Ω(g(n)) and therefore the description of set S is more precise. This preference though leads us naturally to the following definition. Definition 2. An algorithm is homogeneous if there exists a function g(n) such that relation (2) holds. Otherwise, the algorithm is non homogeneous. Theorem 3. The class of algorithms is partitioned into two non empty and disjoined subclasses, the subclasses of homogeneous and non homogeneous algorithms. Proof. Let U be the class of all algorithms, H the class of homogeneous and NH the class of non homogeneous algorithms. It is obvious from Definition 2 that H ∩ NH = Ø and H ∪ NH = U. It remains to show that H ≠ Ø and NH ≠ Ø. This proof is done by providing a simple algorithm for each class. Firstly, consider the problem of finding the smallest among n given numbers stored as elements of an array T. The algorithm min whose pseudocode is the following a←T(1) for j = 2, 3,…, n if T(j) < a, a←T(j), solves this problem and is homogeneous. Indeed assuming that an element of an array is reached in constant time Θ(1) in the computational model of constant times, it is easy to conclude that tmin(i, n) ∈ Θ(n) for every instance i ∈ I(n). Hence, algorithm min is homogeneous and H ≠ Ø. Secondly, consider the following problem. Given an array T of n elements sorted in increasing order, i.e. T(j) ≤ T(j+1) for i = 1, 2,…, n-1, and a number x, sort all elements of T and the number x in increasing order. This problem is solved by the algorithm insert whose pseudocode is the following: j←n, T(n+1)←x while (j ≥ 1) and (T(j) > T(j+1)) temp←T(j), T(j)←T(j+1), T(j+1)←temp j←j-1 Denote by ib the instance T = [1 2 3 … n-1 n] and x = n+1. When algorithm insert is applied on instance ib, the while loop is executed once and hence, (3) tinsert(ib, n) ∈ Θ(1). Denote now by iw the instance T = [1 2 3 … n-1 n] and x = 0. When algorithm insert is applied on instance iw, the while loop is executed Θ(n) times and therefore (4) tinsert(iw, n) ∈ Θ(n). This is so because the first two assignments of the pseudo code insert are executed in Θ(1) time and each execution of the while loop takes Θ(1) time. We show now that there is no function g(n) such that relation (2) holds. This in turn shows that algorithm insert is non homogeneous. Suppose on the contrary that such a function g(n) does exist. By relation (2) we conclude that tinsert(ib, n) ∈ Θ(g(n)) and tinsert(iw, n) ∈ Θ(g(n)) By Theorem 1 and relations (3) and (4) we conclude that Θ(tinsert(ib, n)) = Θ(1) and Θ(tinsert(iw, n)) = Θ(n) Combining Theorem 1 and relations (5) we conclude that Θ(tinsert(ib, n)) = Θ(tinsert(iw, n)) = Θ(g(n)) (7) (5) (6) Finally, from relations (6) and (7) we conclude that Θ(1) = Θ(n), which contradicts Theorem 2. This completes the proof of the Theorem. In the proof of Theorem 3 we used two simple algorithms to show that the classes of homogeneous and non homogeneous algorithms are non empty. In fact both classes are wide and include recursive and iterative algorithms. The class of non homogeneous algorithms includes plenty of iterative algorithms. The great majority of recursive and divide and conquer algorithms are homogeneous. Among the exceptions is the well known recursive sorting algorithm quick sort [Hoare (1962)] and Euclid’s algorithm for computing the greatest common divisor of two numbers. 3. Algorithm classification The instances ib and iw used in Theorem 3 are the well known best and worst cases respectively. We call ib minimum time instance and iw maximum time instance. More precisely, we give the following definition. Definition 3. An instance i is a minimum (maximum) time instance for an algorithm A, if the total number of elementary operations executed when algorithm A is applied on it is the minimum (maximum) possible. The analysis so far and particularly algorithm min used in the proof of Theorem 3 might mislead someone to conclude that homogeneous algorithms do not contain minimum and maximum time instances. This is not correct. A striking example of an iterative homogeneous algorithm containing minimum and maximum time instances is the well known Floyd’s classical algorithm [Floyd (1964)] for building an initial heap. A heap is a data structure introduced in [Williams (1964)] to develop an efficient general iterative sorting algorithm known today as heapsort. A recursive homogeneous algorithm containing worst and best cases is the well known algorithm in [Blum et.al (1973)], which computes order statistics in linear time. Some algorithms are obviously homogeneous. If this is not clear for a new algorithm with unknown complexity, using Definition 3 we can set Sb = { ib: ib ∈ I(n) is a minimum time instance}, Sw = { iw: iw ∈ I(n) is a maximum time instance}. In the worst (best) case analysis of an algorithm we try to determine a set Θ(g(n)) (Θ(f(n))) containing the set Sw (Sb) and say that the worst (best) case complexity of the algorithm is Θ(g(n)) (Θf(n))). Observe the similarities among the worst and best case complexities of a non homogeneous algorithm and the complexity of a homogeneous algorithm. In particular, the only difference is the set of instances on which they are referred to. Therefore, all these complexities should be described by sets of the form Θ(g(n)). It is now of interest to determine the complexity of a non homogeneous algorithm, i.e, to find a set of functions including set S. Since a set of the form Θ(g(n)) does not exist, we generalize Definition 1 as follows. Definition 4. Given two (proper) functions f(n) and g(n) we denote by Θ(f(n), g(n)) the set of functions t(n) for which there exist constants a > 0 and b > 0 and a positive integer n0 such that bf(n) ≤ t(n) ≤ ag(n) for n ≥ n0. It is easy to see that Θ(f(n), g(n)) = Ω(f(n)) ∩ O(g(n)). It is also easy to see that the sets Θ(0, ∞) = Ω(0) = Ο(∞) include always set S. However, in order to be as precise as possible, we are always looking for a minimal set containing set S. In the case of non homogeneous algorithms we are seeking the minimal set Θ(f(n), g(n)) containing set S. Obviously, the set Θ(f(n), g(n)) is minimal if there exist worst and best case instances iw and ib such that t(iw, n) ∈ Θ(g(n)) and t(ib, n) ∈ Θ(f(n)), respectively. Recall that the set Θ(1, n) describing the complexity of algorithm insert in Theorem 3 is minimal. Observe also that the classification of an algorithm as homogeneous or not is not possible unless the set Θ(f(n), g(n)) describing its complexity is minimal. As the set Θ(f(n), g(n)) is described by best and worst case complexities, both complexities are equally important from the theoretical point of view. i , t ( n ) 4. Additional results and discussion We mentioned earlier that homogeneous algorithms contain worst and best cases. Hence, the average complexity of a homogeneous algorithm is easily defined. Clearly, the mean time of the algorithm on a random instance is = ∑ I ( n ) t ( i , n ) ∈ I ( n ) where I(n) denotes the number of elements of set I(n). If the complexity of the homogeneous algorithm is Θ(g(n)), it is natural to expect that t(n) ∈ Θ(g(n)). Indeed, this is the case. Theorem 4. The average complexity of a homogeneous algorithm of complexity Θ(g(n)), is also Θ(g(n)). Proof. Let t(n) be the expected time to solve a random instance. Then ∑ ∑ t ( i , n ) ( g ( n )) ∈ Θ i i I ( n ) I ( n ) ∈ I ( n ) I ( n ) I ( n ) (g ( n )) Θ I ( n ) = Θ (g ( n )) t ( n ) = ∈ = and the proof is complete. Observe that this result is independent of the distribution of the instances. So far we focused our attention on iterative algorithms. Recursive algorithm can be homogeneous and non homogeneous too. But how recursive homogeneous and non homogeneous algorithms look like? A recursive or divide and conquer algorithm makes a fixed number of calls to itself. Therefore, if each call is made on a problem with fixed dimension, the algorithm is homogeneous provided the work required to solve all sub-problems dominates the remaining work. On the contrary, if the dimensions of the sub problems on which calls are made are not fixed and depend on the instance, the algorithm might very well be non homogeneous. Recall that this is the case for the algorithm quicksort [Hoare (1962)]. A recursive or divide and conquer algorithm can be non homogeneous if the number of calls to sub problems is not fixed and depends on the instance. This is the case for Euclid’s algorithm computing the greatest common divisor. 5. Acknowledge We thank an anonymous referee for useful suggestions and for bringing to our attention the reference [Nadel (1993)] 6. References 1. Blum M., Floyd R., Pratt V., Rivest R. and Tarjan R. Time bounds for selection, Journal of Computer and System Sciences 7(4), 448-461, 1973 2. Bollobas B., Fenner T. I. and Frieze A. M. On best case of heapsort, Journal of Algorithms, 20, 205-217, 1996 3. Brassard G. Crusade for a better notation, ACM Sigact News, 17(1), 60-64, 1985 4. Ding Y. and Weiss M.A. Best case lower bounds for Heapsort, Computing 49, 1- 9, 1992 5. Dutton R. Weak-heapsort, BIT 33, 372-381, 1993 6. Edelkamp S. and Wegener I. On the performance of weak heasort, STACS, Lecture Notes in Computer Science, Springer – Verlag, 254-266, 2000 7. Edelkamp S. and Stiegeler P. Implementing heapsort with nlogn - 0.9n and quicksort with nlogn + 0.2n comparisons, ACM Journal of experimental algorithmics (JEA) 7(1), 1-20,2002 8. Fleischer R. A tied lower bound for the worst case of bottom – up heapsort, Algorithmica 11, 104 – 115, 1994 9. Floyd R. Algorithm 245: treesort 3, Communication of the ACM, 7, 701, 1964 10. Gurevich Y. What does O(n) mean?, ACM Sigact News, 17(4), 61-63, 1986 11. Hoare A. Quicksort, Computer Journal, 5, 10-15, 1962 12. Knuth D. Big omicron and big theta and big omega, ACM Sigact News, 8(2), 18-23, 1976 13. Schaffer R. and Sedgwick R. The analysis of heapsort, Journal of algorithms 15, 76 – 100, 1993 14. Wang X. D. and Wu Y. J. An improved heapsort algorithm with nlogn – 0.788928n comparisons in the worst case, Journal of Computer Science and Technology, 22, 6, 898 – 903, 2007 15. Williams J.W.J. Algorithm 232: heapsort, Communication of the ACM, 6, 347- 348, 1964 16. Nadel B.A., Precision Complexity Analysis: A Case Study using Insertion Sort, Information Sciences, 73, pp. 139-189, 1993. 17. Haralick R.M. and Elliot G.L., Increase tree search efficiency for constraint satisfaction problems, Artificial Intell. 14:263-313 (1980). 18. Nadel B.A., The consistent labeling problem and its algorithms: Towards exact- case complexities and theory-based heuristics, Ph.D. dissertation Dept. Computer Science, Rutgers Univ., New Brunswick, NJ, May 1986. 19. Nadel B.A., Representation selection for constrain satisfaction: A case study using n-queens, IEEE Expert 5(3):16-23 (June 1990). 20. Nadel B.A., The complexity of constraint satisfaction in Prolog, in Proc. 8th Nat. Conf. Artificial Intell. (AAAI`90), Boston, MA, Aug. 1990, pp. 33-39. An expanded version is available as Technical Report CSC-89-004, 1989, Dept. Computer Science, Wayne State Univ. Detroit, MI. 21. Nudel B.A., Sovling the general consistent labeling (or constraint satisfaction) problem: Two algorithms and their expected complexities, in Proc. 3rd Nat. Conf. Artificial Intell. (AAAI`83), Washington, DC, Aug. 1983, pp. 292-296.
1509.00930
1
1509
2015-09-03T03:27:55
Testing Properties of Functions on Finite Groups
[ "cs.DS" ]
We study testing properties of functions on finite groups. First we consider functions of the form $f:G \to \mathbb{C}$, where $G$ is a finite group. We show that conjugate invariance, homomorphism, and the property of being proportional to an irreducible character is testable with a constant number of queries to $f$, where a character is a crucial notion in representation theory. Our proof relies on representation theory and harmonic analysis on finite groups. Next we consider functions of the form $f: G \to M_d(\mathbb{C})$, where $d$ is a fixed constant and $M_d(\mathbb{C})$ is the family of $d$ by $d$ matrices with each element in $\mathbb{C}$. For a function $g:G \to M_d(\mathbb{C})$, we show that the unitary isomorphism to $g$ is testable with a constant number of queries to $f$, where we say that $f$ and $g$ are unitary isomorphic if there exists a unitary matrix $U$ such that $f(x) = Ug(x)U^{-1}$ for any $x \in G$.
cs.DS
cs
Testing Properties of Functions on Finite Groups Kenta Oono Yuichi Yoshida∗ Preferred Networks, Inc. National Institute of Informatics, and [email protected] Preferred Infrastructure, Inc. [email protected] September 4, 2015 Abstract We study testing properties of functions on finite groups. First we consider functions of the form f : G → C, where G is a finite group. We show that conjugate invariance, homomorphism, and the property of being proportional to an irreducible character is testable with a constant number of queries to f , where a character is a crucial notion in representation theory. Our proof relies on representation theory and harmonic analysis on finite groups. Next we consider functions of the form f : G → Md(C), where d is a fixed constant and Md(C) is the family of d by d matrices with each element in C. For a function g : G → Md(C), we show that the unitary isomorphism to g is testable with a constant number of queries to f , where we say that f and g are unitary isomorphic if there exists a unitary matrix U such that f (x) = U g(x)U −1 for any x ∈ G. 1 Introduction In property testing [27, 14], we want to decide whether the input function f satisfies a predetermined property P or “far” from it. More specifically, an algorithm is called a tester for a property P if, given a query access to the input function f and a parameter ǫ > 0, it accepts with probability at least 2/3 when f satisfies P, and rejects with probability at least 2/3 when f is ǫ-far from P. If a tester accepts with probability one when f satisfies P, then it is called a one-sided error tester. The definition of ǫ-farness depends on the model, but for the case of Boolean functions, we say that a function f : Fn 2 → {−1, 1} is ǫ-far from P if the distance dist(f, g) := Prx[f (x) 6= g(x)] of f and g is at least ǫ for any function g : Fn 2 → {−1, 1} satisfying P. Here −1 and 1 are corresponding to true and false, respectively. The efficiency of the tester is measured by the number of queries to f , called the query complexity. We say that a property P is constant-query testable if there is a tester with query complexity depending only on ǫ (and not on n at all). The study of testing properties of Boolean functions, or more generally, functions on finite fields was initiated by Rubinfeld and Sudan [27], and then subsequently many properties have been shown to be constant-query testable [14, 11, 16, 13]. To incorporate the algebraic structure of the finite field, Kaufman and Sudan [20] asked to study affine-invariant properties, that is, properties P such that, if f : Fn p → {0, 1} satisfies P, then f ◦ A also satisfies P for any bijective affine transformation ∗Supported by JSPS Grant-in-Aid for Young Scientists (B) (No. 26730009), MEXT Grant-in-Aid for Scientific Research on Innovative Areas (No. 24106001), and JST, ERATO, Kawarabayashi Large Graph Project. 1 A. A lot of progress has been made on the study of the constant-query testability of affine-invariant properties [10, 17], and finally (almost) complete characterizations of constant-query testability were achieved [9, 33]. For further details on function property testing, refer to [8, 25] for surveys. Besides finite fields, functions over finite groups such as the cyclic group and the permuta- tion group are also objects that naturally appear in various contexts, e.g., circuit complexity [1], computational learning [32], and machine learning [18]. Despite its importance, there are only a few works on testing properties on functions over finite groups [5, 14], and extending this line of research is the main focus of the present paper. More specifically, we consider testing properties of functions f of the form f : G → D, and more generally, f : G → D(d), where G is a finite group, D = {z ∈ C z ≤ 1} is the unit disk, and D(d) = {A ∈ Md(C) kAkF ≤ 1} is the set of d by d matrices with Frobenius norm at most one. Note that D(1) = D. We regard d as a constant. The reason that we use D and D(d) is that they are maximal sets closed under multiplication. Below, we get into the details of these two settings. Testing properties of functions of the form f : G → D: We define the distance between two 2kf − gk2, where kfk2 :=pEx∈G f (x)2 is the L2 norm. functions f, g : G → D as dist(f, g) = 1 Note that dist(f, g) is always in [0, 1]. We say that a function f : G → D is ǫ-far from a property P if dist(f, g) ≥ ǫ for any function g : G → D satisfying P. We note that, for {−1, 1}-valued functions f, g : G → {−1, 1}, we have Pr[f (x) 6= g(x)] = ǫ if and only if dist(f, g) = √ǫ holds. Hence, we have a quadratic gap between our definition and the standard definition using the Hamming distance. However, we adopt the L2 norm as it is more friendly with our analysis. We first show the following: • Conjugate invariance, that is, f (yxy−1) = f (x) for any x, y ∈ G, is one-sided error testable with O(1/ǫ2) queries. • Homomorphism, that is, f (x)f (y) = f (xy) for any x, y ∈ G, is one-sided error testable with O(1/ǫ2 log(1/ǫ)) queries. When G = Fn of property testing [4, 6, 14, 28]. Indeed in this case, a function f : Fn and only if f (x) = χS(x) := (−1)Pi∈S xi for some S ⊆ {1, . . . , n}. We show the constant-query testability of conjugate invariance by a simple combinatorial argument. 2 , then homomorphism is often called linearity and intensively studied in the area 2 → D is homomorphism if The case G = Sn, the permutation group of order n, is easy to understand. Let f : Sn → D be a function on the permutation group. If f is conjugate invariant, then the value of f (π) only depends on the cycle pattern of π. If f is homomorphism, then f is the all-zero function, the all-one function, or the function that returns the sign of the input permutation. We note that Ben-Or et al. [5] studied the constant-query testability of homomorphism from a finite group to another finite group. The query complexity of their algorithm is O(1/ǫ), where the distance is measured by the Hamming distance. Their algorithm and analysis by a combinatorial argument extends to our setting, in which the range is D and the distance is measured by the L2 norm, with query complexity O(1/ǫ2). In this sense, our result on homomorphism is not new. Nevertheless, we prove it again using harmonic analysis over finite groups. By doing so, we can generalize it for testing other properties. To describe our next result, we need to introduce the basic of representation theory. A rep- resentation of a group G is a homomorphism ϕ of the form ϕ : G → Md(C) for some integer d. In particular, we study the family of irreducible representations, where any representation can be 2 described as the direct sum of irreducible representations. We mention that irreducible representa- tions ϕ : G → Md(C) can be chosen as unitary, that is, ϕ(x) is unitary for all x ∈ G. The character of a representation ϕ is the function χϕ(x) = tr(ϕ(x)), where tr(·) denotes the trace of a ma- trix. The character carries the essential information about the representation in a more condensed form and is intensively studied in character theory. The character of an irreducible representation is called an irreducible character. For example, every irreducible character of Fn 2 is of the form χS(x) = (−1)Pi∈S xi for some S ⊆ {1, . . . , n}, which is often called a character in Fourier analysis of Boolean functions. If G is abelian, that is, commutative, then representations of G always map to one-dimensional matrices, and hence a representation and its corresponding character coincide. However, this is not the case when G is not abelian, which makes the analysis more involved. We show the following: • The property of being proportional to an irreducible character, that is, f = cχϕ for some c ∈ C and irreducible representation ϕ, is testable with O(1/ǫ8 log2(1/ǫ)) queries. When G = Fn The reason that we do not consider irreducible characters themselves is that irreducible characters may take values outside of D. In particular, χϕ(1) = d holds for the identity element 1 ∈ G and the dimension d of ϕ. 2 , then irreducible characters coincide with linear functions, that is, χS for some S ⊆ {1, . . . , n}. Hence, testing the property of being proportional to an irreducible character can be seen as another generalization of linearity testing. The form of irreducible characters is quite complicated in general. When G = Sn, however, its combinatorial interpretation via Young Tableau is well studied [12, 21, 29] (though still complicated to state here). Testing properties of functions of the form f : G → D(d): Since the representations of a group G are matrix-valued, it is natural to consider testing properties of functions of the form f : G → D(d). For two functions f, g : G → D(d), we define dist(f, g) = 1 F . Note that this is indeed a metric and matches the previous definition of distance when d = 1. 2qEx kf (x) − g(x)k2 Let U (d) be the set of d by d unitary matrices with each element in C. We show the following: • Unitary equivalence to g : G → D(d), that is, f = U gU −1 for some unitary matrix U ∈ U (d), is testable with (d3/2/ǫ)O(d2) queries. Here g is a parameter of the problem and not a part of the input. Unitary equivalence is an important notion when studying representations since the irreducibility of a representation ϕ is preserved by the transformation ϕ 7→ U ϕU −1 for a unitary matrix U . Our tester samples unitary matrices from the Haar measure, a fundamental tool in the repre- sentation theory of Lie Groups, and then checks whether g becomes close to f by applying these unitary matrices. Arguably the simplest property of matrix-valued functions is again homomorphism. However, homomorphism is known to be constant-query testable by a combinatorial argument [5], and the harmonic analysis does not facilitate the analysis. Therefore we do not study homomorphism of matrix-valued functions in this paper. 3 Related work: There are a number of works on testing whether a function on a finite group is a homomorphism. Blum et al. [14] gave a tester (the BLR tester ) for homomorphism of functions on a finite group. However, the number of queries depends on the number of generators of the group, which may depend on the size of the group in general. Ben-Or et al. [5] gave another algorithm without this dependency. Bellare et al. [4] gave a Fourier-analytic proof of the BLR tester when the domain and the range are Fn 2 and F2, respectively. Our tester for homomorphism can be seen as a generalization of their analysis to general groups. There has been an interest in improving various parameters of homomorphism testing results, due to their applications in the construction of probabilistically checkable proof (PCP) [3]. Bellare et al. [4] gave an almost tight connection between the distance to homomorphism and the rejection probability of the BLR tester. Ben- Sasson et al. [6] and Shpilka and Wigderson [28] reduced the number of random bits required by the test as it affects the efficiency of the proof system and in turn the hardness of approximation results that one can achieve using the proof system. Rubinfeld [26] studied properties of a function on a finite group that are defined by functional equations and gave a sufficient condition of constant- query testability. Using the Lp norm for p ≥ 1 as a distance measure in property testing is recently systematically studied by Berman et al. [7]. One of their motivations is exploring the connection of property testing with learning theory and approximation theory. For this purpose, the Lp norm is more favorable than the Hamming distance because, in learning theory and approximation theory, we typically measure errors in the Lp norm for p = 1 or 2. Indeed, several lower bounds and upper bounds for property testing in the Lp norm were shown using this connection. See [7] for more details. Representation theory is one of the most important areas in modern mathematics. Representa- tion theory itself is intensively studied and it is also used as an analytical tool in harmonic analysis, invariant theories, and modular theory. Representation theory have been used in various problems of theoretical computer science such as constructing pseudorandom objects [2, 19], circuit com- plexity [1], communication complexity [24], computational learning [32], machine learning [18], and quantum property testing [23]. In Section 2, we introduce representation theory, harmonic analysis on finite Organization: groups, and the Haar measure in more detail. We discuss the testability of conjugacy invariance in Section 3. We show that homomorphism and the property of a being proportional to an irreducible character are constant-query testable in Sections 4 and 5, respectively. Section 6 is devoted to testing unitary equivalence. 2 Preliminaries For an integer n ≥ 1, [n] denotes the set {1, 2, . . . , n}. Let δij be Kronecker’s delta, that is, δij = 1 if i = j and δij = 0 if i 6= j. For a matrix M , we denote its (i, j)-th element by Mij. We write the real and imginary part of a complex number z as ℜz and ℑz, respectively (hence z = ℜz +√−1ℑz). For a complex number z, z denotes its conjugate. We frequently use the following lemma. Lemma 2.1. Let f : G → D be a function for some finite group G. For any ǫ > 0, with probability at least 1 − δ, we can compute an estimate z of Ex∈G[f (x)] such that z − Ex∈G[f (x)] ≤ ǫ . The number of queries to f is O(1/ǫ2 log 1/δ). 4 O(1/ǫ2 log 1/δ). Proof. Let c = Ex∈G[f (x)]. To estimate c, we sample x1, . . . , xs uniformly at random from G, sPi∈[s] f (xx). Clearly, the query complexity is where s = Θ(1/ǫ2 log 1/δ). Then, we outputec := 1 We now show thatec is indeed a good approximation to c. Since ℜ(f (x)) ≤ 1, from Hoeffding’s inequality, we have ℜ(c) − ℜ(ec) ≤ ǫ/2 with probability at least 1 − δ/2 by choosing the hidden constant in s large enough. Similarly, we have ℑ(c)−ℑ(ec) ≤ ǫ/2 with probability at least 1− δ/2. By the union bound, we have c −ec ≤ ℜ(c) − ℜ(ec) + ℑ(c) − ℑ(ec) ≤ ǫ with probability at least 1 − δ. 2.1 Representation theory We introduce basic notions and facts in representation theory. See, e.g., [30] for more details. For a vector space V over a field F, GLF(V ) denotes the set of invertible linear transformations. We only consider the case F = C in this paper, and hence we omit the subscript for simplicity. A representation of G is a pair (ϕ, V ) of a finite-dimensional vector space V and a homomor- phism ϕ : G → GL(V ), that is, ϕ(xy) = ϕ(x)ϕ(y) for every x, y ∈ G and ϕ(1) is the identity transformation for the identity element 1 ∈ G. For a representation (ϕ, V ), V is called the repre- sentation space of it. When V is clear from the context, we simply call ϕ a representation. The dimension of a representation (ϕ, V ) is the dimension of V . When V is a finite-dimensional vector space, then we say that (ϕ, V ) is finite-dimensional representation. In our argument, we only need finite-dimensional representations. We describe the decomposition of a representation into irreducible representations, which is a fundamental tool used in representation theory. For a representation (ϕ, V ) and a subspace W of V , we say that W is G-invariant if ϕ(G)W ⊆ W . If W is a G-invariant space, then we can regard the range of ϕ as GL(W ), and hence we obtain a representation (ϕ, W ). Note that {0} and V are G-invariant from the definition. A representation (ϕ, V ) is called irreducible if {0} and V are the only G-invariant spaces. Note that a one-dimensional representation is always irreducible. When G is abelian, then we have the converse from Schur’s Lemma, that is, any irreducible representation is one-dimensional. When G is non-abelian, however, an irreducible representation might have dimension more than one. This fact makes the analysis of algorithms for functions on a non-abelian group more involved. Two representations (ϕ, V ) and (ψ, W ) of G are equivalent if there exists an invertible linear transformation T : V → W such that, for every x ∈ G, it holds that ψ(x)◦T = T ◦ϕ(x) . We identify representations. It is known that there is a one-to-one correspondence between conjugacy classes equivalent representations, and we denote by bG the family of equivalence classes of irreducible of G and bG. representations as a complete system of representatives of bG, and we identify it with bG. Since G is finite, so is bG. For ϕ ∈ bG, we denote the dimension of its representation space by dϕ. In A representation (ϕ, V ) is unitary if, for all x ∈ G, ϕ(x) is a unitary transformation. For any representation of G, there is an equivalent unitary representation. Hence, we can take unitary what follows, we fix a basis of the vector space of each representation (ϕ, V ), and we regard it as a homomorphism from G to Mdϕ(C), where dϕ is the dimension of V . 5 2.2 Fourier analysis on non-abelian finite groups We regard the space of C-valued functions of G as an inner product space by defining hf, gi = Ex∈G[f (x)g(x)] for f, g : G → C. The following fact is known. Lemma 2.2 ([30]). For a finite group G, the set(cid:8)pdϕϕij ϕ ∈ bG, i, j ∈ [dϕ](cid:9) forms an orthonor- mal basis of the space of C-valued functions of G. Hence, we can decompose f : G → C as f (x) =Xϕ∈ bG dϕ Xi,j∈[dϕ] hf, ϕijiϕij(x) = Xϕ∈ bG dϕ Xi,j∈[dϕ]bf (ϕ)ijϕij(x), where bf (ϕ) ∈ Mdϕ(C) is defined as bf (ϕ) = Ex∈G[f (x)ϕ(x)] and called the Fourier coefficient of ϕ. This decomposition is called the Fourier expansion of f . Note that Fourier coefficients are matrix-valued functions. The following is well known. Lemma 2.3 ([30]). Let f, g : G → C be functions. Then, we have hf, gi =Xϕ 2 =Xϕ kfk2 dϕ Xi,j∈[dϕ]bf (ϕ)ijbg(ϕ)ij, dϕ Xi,j∈[dϕ] bf (ϕ)ij2. (Plancherel’s identity) (Parseval’s identity) 2.3 Class functions and characters For a representation ϕ : G → Mdϕ(C), the character χϕ : G → C of ϕ is defined as χϕ(x) = tr(ϕ(x)) for x ∈ G. We say that a function f : G → C is conjugate invariant if f (x) = f (yxy−1) for all x, y ∈ G. A conjugate invariant function is sometimes called a class function. It is not hard to check that characters are conjugate invariant. Indeed, the following fact is known. Lemma 2.4. For a finite group G, the set (cid:8)χϕ ϕ ∈ bG(cid:9) forms an orthonormal basis of the space Note that if a representation is one-dimensional, its character is identical to the original repre- of C-valued class functions of G. sentation, hence is a homomorphism. This is not the case in general. The following lemma says that Fourier coefficients of a class function are always diagonal. Lemma 2.5. For any class function f : G → C, it holds that bf (ϕ) = hf,χϕi In order to prove Lemma 2.5, we need the following two auxiliary lemmas: dϕ Idϕ. Lemma 2.6. For a function f : G → C and an irreducible representation ϕ, we have Proof. hf, χϕi = tr(bf (ϕ)). ϕkk(x) =Xρ hf, χϕi = E dρXi,j bf (ρ)ijρij(x)Xk xXρ =Xk bf (ϕ)kk = tr(bf (ϕ)). 6 dρXi,j bf (ρ)ijXk hρij, ϕkki Lemma 2.7. Let f : G → C be a function and g : G → C be a class function. Then, Proof. Since g is a class function, we can represent g(x) =Pϕhg, χϕiχϕ(x). Now we have hf, gi =Xϕ tr(bf (ϕ))tr(bg(ϕ)). [ϕij(x)ϕ′ j ′j ′(x)] E x j ′j ′i ϕi E x [ϕij(x)χϕ′ (x)] dϕXi,j bf (ϕ)ijhg, χ′ hf, gi =Xϕ,ϕ′ dϕXi,j bf (ϕ)ijXi′ bg(ϕ′)i′i′Xj ′ =Xϕ,ϕ′ dϕXi,j bf (ϕ)ijXi′ bg(ϕ′)i′i′Xj ′ hϕij, ϕ′ =Xϕ,ϕ′ =Xϕ Xi bf (ϕ)iiXi′ bg(ϕ)i′i′ =Xϕ tr(bf (ϕ))tr(bg(ϕ)). 2 =Xϕ (cid:12)(cid:12)(cid:12)tr(bf (ϕ))(cid:12)(cid:12)(cid:12) =Xϕ (cid:12)(cid:12)(cid:12)Xi∈[dϕ]bf (ϕ)ii(cid:12)(cid:12)(cid:12) ≤Xϕ dϕ Xi,j∈[dϕ](cid:12)(cid:12)(cid:12)bf (ϕ)ij(cid:12)(cid:12)(cid:12) ≤Xϕ dϕ Xi∈[dϕ](cid:12)(cid:12)(cid:12)bf (ϕ)ii(cid:12)(cid:12)(cid:12) = kfk2 2. kfk2 2 2 2 2 Proof of Lemma 2.5. (from Lemma 2.6) (from Lemma 2.7) (by Cauchy-Schwarz) (by Parseval’s identity) Therefore, the equality holds for both inequalities in the formula above. In particular, bf (ϕ) is proportional to the identity matrix cIdϕ for some c ∈ C. By Lemma 2.6, hf, χϕi = tr(bf (ϕ)) = cdϕ. Hence, c = hf, χϕi/dϕ, and we have the lemma. 2.4 Introduction to the Haar measure In this section, we introduce Haar measure briefly. See, e.g., a textbook [22] for more details. A topological group is a group equipped with a topology and whose group operations are contin- uous in its topology. A finite group is a topological group if it is endowed with a discrete topology. Any subgroup of Md(C) is a topological group, in which we identify Md(C) with Cd2 and introduce the topology induced by Cd2 . We call a measure µ on a topological group G left invariant (resp., right invariant) if µ(xS) = µ(S) (resp., µ(S) = µ(Sx)) for any x ∈ G and Borel set S ⊆ G. Similarly, We call µ invariant under taking inverse if µ(S−1) = µ(S) for any Borel set S ⊆ G where S−1 = {x−1 x ∈ S}. For any compact topological group G, there exists a measure on G which is left invariant, right invariant, and invariant under taking inverse. Such a measure is unique up to scalar multiplication and called the Haar measure on G. For example, the Haar measure µ of a finite group G is (a scalar multiplication of) the counting measure, that is, µ(S) = S/G for subset S ⊆ G. Hence, the Haar measure of U (d) exists. We regard U (d) as a closed subgroup of Md(C) and regard it as a compact topological group. 7 Algorithm 1 (Tester for conjugate invariance) 1: for s := O(1/ǫ2) times do 2: Sample x and y ∈ G uniformly at random. if f (x) 6= f (yxy−1) then reject. 3: 4: Accept. 3 Conjugate Invariance In this section, we first show that conjugate-invariance is constant-query testable. Theorem 3.1. Conjugate invariance is one-sided error testable with O(1/ǫ2) queries. Then, we show the following lemma, which simplifies testing properties that imply conjugate invariance. Lemma 3.2. Let P be a property such that every f satisfying P is a class function. Suppose that there is a tester A for P with query complexity q(ǫ) if the input is restricted to be a class function. Then there is a tester A′ for P with query complexity O(1/ǫ2 + q(ǫ/2) log q(ǫ/2)). Moreover, if A is a one-sided error tester, then A′ is also a one-sided error tester. 3.1 Proof of Theorem 3.1 Our algorithm for testing conjugate invariance is described in Algorithm 1. It is easy to see that the query complexity of Algorithm 1 is O(1/ǫ2) and the tester always accepts when f is conjugate invariant. Thus, it suffices to show that Algorithm 1 rejects with probability at least 2/3 when f is ǫ-far from class functions. It is well known that conjugacy classes of G form a partition of G. We define G♯ as the set of conjugacy classes of G. Also, for an element x ∈ G, we define x♯ as the unique conjugacy class x belongs to. For y ∈ x♯, we define Nx,y = {z ∈ G zxz−1 = y}. Since we have Nx,y ∩ Nx,y′ = ∅ for y, y′ ∈ x♯ with y 6= y′, it holds that G =Fy∈x♯ Nx,y. Therefore, the following lemma guarantees that uniform sampling from a conjugacy class is executed by uniformly sampling from the whole group. Lemma 3.3. The number of elements in Nx,y depends only on the conjugacy class to which y belongs. −1 = y′ hold. We construct Proof. For y, y′ ∈ x♯, fix z0, z′ mappings Φy,y′ : Nx,y → Nx,y′ by z 7→ z′ 0. By a direct calculation, we can check that Φy,y′ ◦ Φy′,y = idNx,y , and Φy′,y ◦ Φy,y′ = idNx,y′ . Therefore Nx,y = Nx,y′ holds. 0z−1z0 and Φy′,y : Nx,y′ → Nx,y by z 7→ z0z−1z′ 0 ∈ G so that z0xz−1 0 = y and z′ 0xz′ 0 Fix a function f : G → D. For a conjugacy class C ∈ G♯ and z ∈ C, define pC(z) := ♯{x ∈ C f (x) = z}/C as the probability that f (x) = z if we sample x ∈ C uniformly at random. We define pC := maxz∈C pC(z) and zC := arg maxz∈C pC(z). Then, we define ef as ef (x) = zx♯. Note that ef is a class function such that ef (x) ∈ D for any x ∈ G. Lemma 3.4. Pr x,y∈G [f (x) 6= f (yxy−1)] ≥ dist(f,ef )2. 8 Proof. Since x − y ≤ 2 for any x, y ∈ D, we have 1 4 dist(f,ef )2 = E x f (x) − ef (x)2 ≤ Pr x [f (x) 6= ef (x)] = 1 G XC∈G♯ C(1 − pC). By Lemma 3.3, if we fix x ∈ G and sample y ∈ G uniformly at random, then yxy−1 forms a uniform distribution over elements in x♯. Thus, Pr x,y∈G 1 [f (x) 6= f (yxy−1)] ≥ G XC∈G♯ 1 G XC∈G♯ CZ pC(z)(1 − pC)dz = CZ pC(z)(1 − pC(z))dz G XC∈G♯ 1 ≥ C(1 − pC) ≥ dist(f,ef )2. Lemma 3.5. If f is ǫ-far from being conjugate invariant, then Algorithm 1 rejects with probability at least 2/3. Proof. Since ef : G → D is a class function, we have dist(f,ef ) ≥ ǫ. Hence, the probability we reject at Line 3 in each trial is at least ǫ2 by Lemma 3.4. Hence the tester rejects with probability 2/3 by choosing the hidden constant in s large enough. We establish Theorem 3.1 by Lemma 3.5. 3.2 Proof of Lemma 3.2 The following lemma shows that we can obtain a query access to a class function that is close to f . Lemma 3.6. Let f : G → D be a function that is ǫ-close to a class function. There exists a class function f ′ : G → D with the following property. • For any x ∈ G, with O(log 1/δ) queries to f , we can correctly compute f ′(x) or find a witness that f is not a class function with probability at least 1 − δ. Moreover, if f itself is a class function, then we can always compute f ′(x) correctly. • dist(f ′, f ) ≤ 3ǫ. In particular, f ′ = f when f itself is a class function. Proof. For a conjugacy class C, let z∗ We define f ∗ : G → D as f ∗(x) = z∗ We define f ′ : G → D as follows: x♯. Note that f ∗ is the class function closest to f . C ∈ D be the unique value that minimizesPx∈C f (x) − z∗ C2. f ′(x) =(z∗ if px♯ ≤ 1 2 , otherwise. x♯ zx♯ We first show the first claim. Our algorithm for computing f ′(x) is as follows. Given x ∈ G, ) for each j ) for some i 6= j, then we reject f and output the pair as the we pick y1, . . . , ys ∈ G for s := O(log 1/δ) uniformly at random, and compute f (yixy−1 i ∈ [s]. If f (yixy−1 witness that f is not a class function. If all of them are the same, we output the value as f ′(x). ) 6= f (yjxy−1 i i 9 i i at least 1 − δ, we have f (yixy−1 ) 6= f (yjxy−1 probability at least 1 − δ, the majority of {f (yixy−1 at least 1 − δ, either we output zC or reject. algorithm always outputs f (x) as f ′(x). Now we analyze the correctness of the algorithm above. If px♯ ≤ 1/2, then with probability j ) for some i 6= j, and we reject. If px♯ > 1/2, with )}i∈[s] is equal to zC. Hence, with probability Moreover, if f itself is a class function, then we have f ′(x) = f (x) for any x ∈ G, and our We turn to the second claim. For two functions g, h : G → C and a conjugacy class C, define distC(g, h) :=pPx∈C g(x) − h(x)2. We will show that, for each conjugacy class C ∈ G♯, distC(f, f ′) ≤ 3distC(f, f ∗), which implies dist(f, f ′) ≤ 3ǫ. If C satisfies pC ≤ 1/2, we have nothing to show. Thus suppose pC > 1/2. Then, we have distC(f, f ′) ≤ distC (f, f ∗) + distC(f ∗, f ′) =sXx∈C C − zC2 ≤Px∈C f (x) − f ∗(x)2. By pC > 1/2, we have Cz∗ Since a pC-fraction of values has moved from zC to z∗ C when constructing f ∗ from f , we have C − zC2 ≤ 2Px∈C f (x) − pCCz∗ f ∗(x)2. Combining this with the previous inequality, we have distC(f, f ′) ≤ (1 +√2)distC(f, f ∗) ≤ 3distC (f, f ∗). f (x) − f ∗(x)2 +qCz∗ C − zC2. Proof of Lemma 3.2. We first apply the ǫ/6-tester for conjugate invariance (Algorithm 1). If the tester rejects, we immediately reject f as it implies that f does not satisfy P . Otherwise, using Lemma 3.6, we construct a query access to a class function f ′ with δ = O(1/q(ǫ/2)). Then we apply the tester A to f ′ with the error parameter ǫ/2. The query complexity is clearly as stated. Suppose that f satisfies the property P . Then, we never reject when testing conjugate invari- ance. Also f ′(x) = f (x) holds for every x ∈ G and it follows that f ′ satisfies the property P . Hence, the tester A accepts f ′ with probability at least 2/3. Moreover if A is a one-sided error tester, then A accepts f ′ with probability one. Suppose that f is ǫ-far from the property P . If f is ǫ/6-far from conjugate invariance, then we reject f with probability at least 2/3. Thus assume that f is ǫ/6-close to conjugate invariance. In this case f ′ is a class function that is ǫ/2-close to f . Hence f ′ is still ǫ/2-far from the property P . Then the tester A on f ′ should reject with probability 2/3. 4 Testing Homomorphism In this section, we show the following: Theorem 4.1. Homomorphism is one-sided error testable with O(1/ǫ2 log(1/ǫ)) queries. We note that, if f : G → C is a homomorphism, then it is a one-dimensional representation and hence an irreducible representation. First we observe that homomorphism implies conjugate invariance. Lemma 4.2. If f : G → C is a homomorphism, then f is conjugate invariant. Proof. Since f is a homomorphism, we have for any x, y ∈ G, f (yxy−1) = f (y)f (x)f (y−1) = f (y)f (y−1)f (x) = f (yy−1)f (x) = f (1)f (x). By setting y = 1, we have f (x) = f (1)f (x), which means f (x) = 0 or f (1) = 1. 10 Algorithm 2 (Tester for homomorphism) Input: A class function f : G → D. 1: for s = O(1/ǫ2) times do 2: Sample x, y ∈ G uniformly at random. if f (x)f (y) 6= f (xy) then reject. 3: 4: Accept. If f (x) = 0 for all x ∈ G, then f is clearly conjugate invariant. If f (x) 6= 0 for some x ∈ G, then f (1) = 1. In this case, we have f (yxy−1) = f (1)f (x) = f (x) and f is again conjugate invariant. From Lemmas 3.2 and 4.2, to test homomorphism, it suffices to show that homomorphism is one-sided error testable with O(1/ǫ2) queries when the input function is a class function. Our tester is given in Algorithm 2. It is clear that the query complexity is O(1/ǫ2). We next see that Algorithm 2 always accepts homomorphisms: Lemma 4.3. If a class function f : G → D is a homomorphism, then Algorithm 2 always accepts. Proof. We always accept because f (x)f (y) = f (xy) for any x, y ∈ G Now we turn to the case that f is ǫ-far from homomorphisms. To show that Pr[f (x)f (y) 6= f (xy)] is much smaller than 1, we analyze the term f (x)f (y)f (xy). Lemma 4.4. For any function f : G → C, we have E x,y [f (x)f (y)f (xy)] =Xϕ dϕ Xi,j,k∈[dϕ]bf (ϕ)ijbf (ϕ)jkbf (ϕ)ik. Proof. The left hand side is equal to Xϕ,ϕ′,ϕ′′ dϕdϕ′dϕ′′ Xi,j∈[dϕ] Xi′,j ′∈[dϕ′ ] Xi′′,j ′′∈[dϕ′′ ]bf (ϕ)ijbf (ϕ′)i′j ′bf (ϕ′′)i′′j ′′ E x,y Now we analyze the expectation in (1). [ϕij(x)ϕ′ i′j ′(y)ϕ′′ i′′j ′′(xy)]. (1) [ϕij(x)ϕ′ i′j ′(y)ϕ′′ i′′j ′′(xy)] = E E x,y = Xk′′∈[dϕ′′ ] hϕij, ϕ′′ i′′k′′ihϕ′ i′j ′ϕ′′ x,yhϕij(x)ϕ′ k′′j ′′i =( 1 d2 ϕ 0 i′j ′(y) Xk′′∈[dϕ′′ ] ϕ′′ i′′k′′(x)ϕ′′ k′′j ′′(y)i if ϕ = ϕ′ = ϕ′′, i = i′′, j = i′ = k′′, and j′ = j′′, otherwise. Corollary 4.5. For any class function f : G → C, we have Hence (1) =Pϕ dϕPi,j,j ′∈[dϕ] bf (ϕ)ijbf (ϕ)jj ′bf (ϕ)ij ′. [f (x)f (y)f (xy)] =Xϕ E x,y dϕ Xi∈[dϕ]bf (ϕ)iibf (ϕ)ii2. 11 Proof. If f is a class function, then bf (ϕ)ij = 0 for any ϕ ∈ bG and i 6= j ∈ [dϕ] by Lemma 2.5. Hence, we have the corollary from Lemma 4.4. The following lemma completes the proof of Theorem 4.1. Lemma 4.6. If a class function f : G → D is ǫ-far from homomorphism, then Algorithm 2 rejects with probability at least 2/3. Proof. From Corollary 4.5, we have ℜ E x,y ≤ max dϕ Xi∈[dϕ]bf (ϕ)iibf (ϕ)ii2 [f (x)f (y)f (x + y)] = ℜXϕ dϕ Xi∈[dϕ] ϕ∈ bG,i∈[dϕ]ℜbf (ϕ)ii ·Xϕ bf (ϕ)ii2 ϕ∈ bG,i∈[dϕ]ℜbf (ϕ)ii. ϕ∈ bG,i∈[dϕ]ℜbf (ϕ)ii · kfk2 2 ≤ max = max For any ϕ with dimension more than one, bf (ϕ)ii ≤ 1/2 and hence ℜbf (ϕ)ii ≤ 1/2 (see Lemma 2.5). Now consider a one-dimensional irreducible representation ϕ. Since f is ǫ-far from homomorphism, we have ǫ ≤ dist(f, ϕ) = 2 + kϕk2 2 − 2ℜhf, ϕi ≤ 1 2qkfk2 1 2q2 − 2ℜbf (ϕ). 2 ≤ 1 and kϕk2 2 = 1 as ϕ is a (non-zero) homomorphism. Hence, ℜbf (ϕ) ≤ 1 − 2ǫ2. Note that kfk2 We have shown that ℜ Ex,y[f (x)f (y)f (x + y)] ≤ 1 − 2ǫ2. Since f (x)f (y)f (x + y) ≤ 1, at least an Ω(ǫ2)-fraction of pairs (x, y) satisfy f (x)f (y)f (x + y) 6= 1. Hence we have Prx,y[f (x)f (y) = f (x+ y)] ≤ 1− Ω(ǫ2). By choosing the hidden constant in s large enough, we reject with probability at least 2/3. 5 Testing the Property of Being Proportional to an Irreducible Character In this section, we show the following: Theorem 5.1. The property of being proportional to an irreducible character is testable with O(1/ǫ8 log2(1/ǫ)) queries. As any character is a class function, by Lemma 3.2, it suffices to give a tester with query complexity O(1/ǫ8 log(1/ǫ)) that works when the input function is a class function. The following fact is crucial for our algorithm. Lemma 5.2 ([31]). For a function f : G → C, the following are equivalent. 1. f (x) = f (1)eχϕ(x) for some irreducible representation ϕ, where eχϕ = χϕ/dϕ. 2. f (x)f (y) = f (1) Ez∈G[f (yzxz−1)] for any x, y ∈ G. 12 2 obtained by applying Lemma 2.1 with the error parameter Algorithm 3 (Tester for being proportional to an irreducible character) Input: A function f : G → D. 1: Let e1 be the estimation to kfk2 2: if e1 < ǫ2/2 then accept. 3: for each i = 1 to s := O(1/ǫ4) do 4: ǫ2/100 and the confidence parameter 1/100. 5: Sample x, y ∈ G uniformly at random. Let ei parameter ǫ2/10 and the confidence parameter 1/100s. Let ei if ei 7: 8: accept. 6 = f (x)f (y) − f (1)ei 6 > ǫ4/100 then reject. 52. 6: 5 be the estimation to Ez[f (yzxz−1)] obtained by applying Lemma 2.1 with the error As we can freely change the value of f (1) by multiplying a constant, the second condition is a necesary and sufficient condition of being proportional to an irreducible character. The most simple test based on Lemma 5.2 is checking whether f (x)f (y) ≈ f (1) Ez[f (yzxz−1)] (by estimating the latter by sampling z ∈ G a constant number of times). However, we were unable to handle the term Ex,y,z[f (x)f (y)f (yzxz−1)f (1)] that naturally arises when analyzing this test. Instead, we estimate f (x)f (y) − f (1) Ez[f (xyzxz−1)] and check whether it is small. The detail is given in Algorithm 3. It is clear that the query complexity of Algorithm 3 is O(1/ǫ8 log 1/ǫ). Lemma 5.3. If a function f : G → C is proportional to an irreducible character, then Algorithm 3 accepts with probability at least 2/3. Proof. By the union bound, all the estimations succeed with probability at least 2/3. Below we assume this indeed happens. Recall that f (x)f (y) − f (1) Ez[f (yzxz−1)] = 0 for any x, y ∈ G by Lemma 5.2. Then for each 6 = f (x)f (y) − f (1)ei 52 ≤ ǫ4/100 holds for every i ∈ [s]. 52 = f (1) Ez[f (yzxz−1)] − f (1)ei i, ei Hence, we accept with probability at least 2/3. Now we turn to the case that f is ǫ-far from being proportional to an irreducible character. We need the following auxiliary lemma. Lemma 5.4. For any function f : G → C, we have E x,yh(cid:12)(cid:12)f (x)f (y) − f (1) E z [f (yzxz−1)](cid:12)(cid:12)2i ≥ kfk2 2 min ϕ kf − f (1)eχϕk2 2. 13 Proof. We have dϕ Xi,j∈[dϕ]bf (ϕ)ijϕij(yzxz−1)i ϕik(y)ϕkl(z)ϕlm(x)ϕmj (z−1)i zhϕkl(z)ϕjm(z)i ϕik(y)ϕlm(x) E ϕik(y)ϕlm(x) δkjδlm dϕ E = E zhXϕ zhf (yzxz−1)i = E zhXϕ dϕ Xi,j∈[dϕ]bf (ϕ)ij Xk,l,m∈[dϕ] dϕ Xi,j∈[dϕ]bf (ϕ)ij Xk,l,m∈[dϕ] =Xϕ dϕ Xi,j∈[dϕ]bf (ϕ)ij Xk,l,m∈[dϕ] =Xϕ dϕ Xi,j∈[dϕ]bf (ϕ)ijϕij(y) Xk∈[dϕ] =Xϕ ϕkk(x) dϕ =Xϕ dϕeχϕ(x) Xi,j∈[dϕ]bf (ϕ)ijϕij(y) In the third equality, we used the fact that ϕmj(z−1) = ϕjm(z). This follows from the fact that ϕ(z−1)ϕ(z) = ϕ(1) = I and ϕ(z) is unitary. Therefore, E It follows that f (x)f (y) − f (1) E z dϕeχϕ Xi,j∈[dϕ]bf (ϕ)ijϕij(y) dϕ Xi,j∈[dϕ]bf (ϕ)ij ϕij(y) − f (1)Xϕ [f (yzxz−1)] = f (x)Xϕ dϕ(f (x) − f (1)eχϕ(x)) Xi,j∈[dϕ]bf (ϕ)ij ϕij(y) =Xϕ x,yh(cid:12)(cid:12)Xϕ [f (yzxz−1)](cid:12)(cid:12)2i = E x,yh(cid:12)(cid:12)f (x)f (y) − f (1) E =Xϕ,ϕ′ 2 Xi,j∈[dϕ](cid:12)(cid:12)(cid:12)bf (ϕ)ij(cid:12)(cid:12)(cid:12) =Xϕ ≥kfk2 In the third equality, we used the fact that Ey(cid:2)ϕij(y)ϕ′ x(cid:2)(f (x) − f (1)eχϕ(x))(f (x) − f (1)eχϕ′(x))(cid:3) Xi,j∈[dϕ] Xi′,j ′∈[dϕ′ ]bf (ϕ)ijbf (ϕ′)i′j ′ E dϕ Xi,j∈[dϕ](cid:12)(cid:12)(cid:12)bf (ϕ)ij(cid:12)(cid:12)(cid:12) dϕkf − f (1)eχϕk2 ϕ kf − f (1)eχϕk2 dϕ(f (x) − f (1)eχϕ(x)) Xi,j∈[dϕ]bf (ϕ)ij ϕ(y)ij(cid:12)(cid:12)2i y(cid:2)ϕij(y)ϕ′ 2Xϕ ϕ kf − f (1)eχϕk2 i′j ′(y)(cid:3) is equal to 1/dϕ if ϕ = ϕ′, i = i′, and j = j′, and is equal to zero otherwise. i′j ′(y)(cid:3) 2 ≥ min dϕdϕ′ E 2 min 2 2 z Lemma 5.5. If a function f : G → C with f (1) = 1 is ǫ-far from being proportional to an irreducible character, then Algorithm 3 rejects with probability at least 2/3. Proof. By the union bound, with probability at least 5/6, all the estimations succeed. Below we assume it indeed happens. From Lemma 5.4, when f is ǫ-far, the expectation of ei 6 is at least E x,yh(cid:12)(cid:12)f (x)f (y)− f (1)ei 5(cid:12)(cid:12)2i ≥ (1− 2ǫ2 10 )kfk2 2 min ϕ kf − f (1)eχϕk2 2− 14 ǫ4 100 ≥ (1− ǫ2 5 ) ǫ2 4 ·kfk2 2− ǫ4 100 ≥ ǫ4 25 . Algorithm 4 (Tester for unitary equivalence) Input: Functions f, g : G → D(d) 1: for s :=(cid:0)d3/2/ǫ(cid:1)Θ(d2) times do 2: 3: Sample U ∈ U (d) with respect to the (normalized) Haar measure of U (d). Let e be the estimation of dist(f, U gU ∗) obtained by applying Lemma 2.1 with the error parameter ǫ2/100 and the confidence parameter 1/6s. if e < ǫ2/10 then accept. 4: 5: Reject. 6 > ǫ4/100]. Then, we have 2· p + ǫ4/100· We also note that ei (1− p) ≥ ǫ4/25, and it follows that p ≥ ǫ4/100. By choosing the hidden constant in s large enough, we reject f with probability at least 2/3. 6 ≤ (1 + ǫ2/100)2 ≤ 2. Let p = Prx,y[ei 6 Testing Unitary Equivalence In this section, we prove the following: Theorem 6.1. The unitary equivalence to g : G → D(d) is testable with(cid:0)d3/2/ǫ(cid:1)O(d2) queries. Our algorithm is described in Algorithm 4. We use the Haar measure on U (d) to sample unitary matrices. We do not need the detailed definition of the Haar measure, and we only have to understand that it defines a probability distribution on U (d). See Section 2.4 for a brief introduction to the Haar measure. The basic idea of our algorithm and analysis is the following. Suppose that functions f, g : G → D(d) are unitary equivalent, that is, f = U0gU ∗ 0 for some unitary matrix U0 ∈ U (d). Then, by sampling a sufficient number of unitary matrices from the Haar measure, we get a unitary matrix U that is sufficiently close to U0 in the sense that the Frobenius norm of U − U0 is small (Lemma 6.3). Then, we can show that the Frobenius norm of f (x) − U g(x)U ∗ is also small for any x ∈ G (Lemma 6.5). On the other hand, if f and g are ǫ-far from being unitary equivalent, then the average Frobenius norm of f (x) − U g(x)U ∗ over x ∈ G is large for any unitary matrix U . Hence, by checking whether there is a unitary matrix U (in the sample) such that the average Frobenius norm is small, we can distinguish the case that f and g are unitary equivalent from the case that f and g are ǫ-far from being unitary equivalent. Let U ∈ U (d) be a random matrix sampled with respect to the Haar measure. We diagonalize U as U = W ΛW ∗ where W ∈ U (d) and Λ = diag(λ1, . . . λd). By the unitarity of U , the absolute value of each eigenvalue of U is 1. Therefore we can write λi = exp(√−1θi) for some θi ∈ [−π, π), which we call the phase of λi. We use the following proposition, which is Weyl’s integral formula applied to U (d). ZdQi>j λi − Proposition 6.2 ([15]). The distribution µ of the phases θ = (θ1, . . . , θd) is dµ(θ) = 1 λj2dθ, where Zd := (2π)dd! is a normalization constant and dθ is a standard Euclid measure. For ǫ > 0, we write BU (d)(ǫ) = {U ∈ U (d) kU − IdkF ≤ ǫ}. We need the following auxiliary lemma, which says that the set of a sufficiently large number of randomly chosen unitary matrices forms an “ǫ-net” of unitary matrices with respect to the Frobenius norm. 15 Lemma 6.3. Let U0 ∈ U (d) and U be a random matrix sampled with respect to the Haar measure of U (d). For sufficiently small ǫ > 0, the probability Pr[kU − U0kF ≤ ǫ] ≥ δ6.3(ǫ, d), where δ6.3(ǫ, d) =(cid:0) ǫ d3/2(cid:1)O(d2). i=1 λi − 12 = kθk2 Proof. Since the Haar measure is invariant under left multiplication, we can assume U0 = Id without loss of generality. Hence, we want to bound Pr[U ∈ BU (d)(ǫ)]. Let λ1, . . . , λd be eigenvalues of U and θ1, . . . , θd be corresponding phases. By the conjugate invariance of Frobenius norm, U ∈ BU (d)(ǫ) iffPd i=1 λi − 12 ≤ ǫ2. Suppose kθk2 ≤ 3ǫ/4. Since θi’s are sufficiently small, we can expand as λi = 1+√−1θi +O(θ2 i ). ThenPd 2 maxi θi < ǫ2. It implies the probability is bounded below by Pr[U ∈ BU (d)(ǫ)] ≥RBd(3ǫ/4) dµ where Bd(r) is the ball in Rd of radius r centered Let ǫ = ǫ d3/2 , θ0 = [0, ǫ, . . . , (d − 1)ǫ], and θ1 = [ǫ/3, 4ǫ/3, . . . , (d − 2/3)ǫ]. Note that kθ0k2 2 ≤ ǫ2/3 and kθ1k2 2 = ǫ2(6d2 − d + 2)/18d3 < ǫ2/2. Therefore, Bd(3ǫ/4) contains the d-dimensional hypercube V = {θ ∈ Rd θ0 ≤ θ ≤ θ1}, where we write x ≤ y if xi ≤ yi for each i. Note that if θ ∈ V , θi − θj ≥ ǫ/3 for any i 6= j. Therefore, we have 2 + O(Pd i ) = kθk2 2 +kθk2 at the origin. i=1 θ3 ZBd(3ǫ/4) dµ ≥ZV 1 dµ ≥ ZdZV Yi>j ZdZV Yi>j(cid:16) ǫ 3(cid:17)2 1 dθ = λi − λj2dθ ∼ 3(cid:17)d(d−1)ZV Zd(cid:16) ǫ 1 ≥ (By the fact that ǫ is small enough) 1 ZdZV Yi>j dθ = θi − θj2dθ Zd(cid:16) ǫ 3(cid:17)d2 1 . Let Skew(d) be the set of d-dimensional skew-Hermitian matrices, i.e., Skew(d) = {X ∈ Md(C) X ∗ = −X}. Although the following lemma is an almost immediate consequence of the fact that Skew(d) is the Lie algebra of U (d), we prove it for completeness. Lemma 6.4. If ǫ > 0 is small enough, then the image of the exponential map exp : Skew(d) → U (d) contains BU (d)(ǫ). Furthermore, if U ∈ BU (d)(ǫ), then we can choose X ∈ Skew(d) such that exp(X) = U and kXkF ≤ 2ǫ. Proof. We diagonalize U as W ΛW ∗, where W ∈ U (d) and Λ = diag(λ1, . . . , λd). Let λi = exp(√−1θi) for θi ∈ R and µi = 1 − λi. For z ∈ C, we define log(1 + z) =P∞ i=1(−1)n+1zn/n. This Taylor expansion converges for z ≤ 1. Note that log λi = √−1(θi + 2πmi) for some mi ∈ Z. Since kU − IdkF ≤ ǫ, we can define X = log U . Note that U = exp(X) as z = exp(log z). We have the following formulas: X = log U = log W ΛW ∗ = W (log Λ)W ∗, log Λ = diag(log λ1, . . . , log λd), log λi = √−1(θi + 2πmi) = −√−1(θi + 2πmi) = − log λi, (log Λ)∗ = diag(log λ1, . . . , log λd) = −diag(log λ1, . . . , log λd) = − log Λ. Combining these formulas, X ∗ = W (log Λ)∗W ∗ = −W (log Λ)W ∗ = −X, that is, X ∈ Skew(d). 16 i=1 µi2 + O(µ3 i ) ≤ 2ǫ2. F = k log Λk2 i ) and we can conclude kXk2 Next, we estimate the Frobenius norm of X. The condition kU − IdkF ≤ ǫ impliesPd ǫ2. It implies µi is small enough. So we can expand log λi = log(1 + µi) = µi + O(µ2 fore log λi2 = µi2 + O(µ3 Pd i=1 log λi2 =Pd Lemma 6.5. Let A ∈ D(d) be a matrix and U, V ∈ U (d) be unitary matrices. If kU − V kF ≤ ǫ for sufficiently small ǫ > 0, then kU AU ∗ − V AV ∗kF ≤ 3ǫ. Proof. Let U0 = V ∗U . By a direct calculation, kU − V kF = kU0 − IdkF and kU AU ∗ − V AV ∗kF = kU0AU ∗ 0 − AkF . Therefore, we can assume that V = Id. By Lemma 6.4, there exists X ∈ Skew(d) such that kXkF ≤ 1 and U = exp(2ǫX). Note that U ∗ = exp(−2ǫX). Then, i=1 µi2 ≤ i ). There- F = F = kW (log Λ)W ∗k2 U ∗AU − A = exp(−2ǫX)A exp(2ǫX) − A = (Id − 2ǫX + O(ǫ2)J)A(Id + 2ǫX + O(ǫ2)J) = 2ǫ(AX − XA) + O(ǫ2)J, where O(ǫ2)J denotes a matrix with each entry having absolute value O(ǫ2). We evaluate the Frobenius norm of the commutator as kAX − XAkF ≤ kAXkF + kXAkF = 2kXkF ≤ 2, where we use the triangle inequality of the Frobenius norm, and the assumption kAkF ≤ 1. There- fore, kU AU ∗ − Ak2 F ≤ 4ǫ2kAX − XAk2 F + O(ǫ3) ≤ 8ǫ2 + O(ǫ3) < 9ǫ2. Now, we prove Theorem 6.1. Proof of Theorem 6.1. We assume that the all the estimations have succeeded, which happens with probability at least 5/6 by the union bound. Suppose that f and g are unitary equivalent and U0 ∈ U (d) be the unitary matrix with f (x) = U0g(x)U ∗ 0 for any x ∈ G. From Lemma 6.3, we sample U such that kU0 − UkF ≤ ǫ/10 with F ] ≤ 9ǫ2/100. For such probability at least 5/6. From Lemma 6.5, we have Ex∈G[kf (x)− U g(x)U ∗k2 U , we obtain the estimation e satisfies e < ǫ2/10. By the union bound, we accept with probability at least 2/3. Suppose that f and g are ǫ-far from being unitary equivalent. For every U we sample, we have F ] ≥ 4ǫ2. Hence, the estimation e satisfies e > ǫ2/10 and we accept. To Ex∈G[kf (x) − U g(x)U ∗k2 summarize, we reject with probability at least 5/6 > 2/3. Acknowledgements We thank Mitsuru Kusumoto and anonymous referees for comments that greatly improved the manuscript. 17 References [1] E. Allender, J. Jiao, M. Mahajan, and V. Vinay. Non-commutative arithmetic circuits: depth reduction and size lower bounds. Theoretical Computer Science, 209(1-2):47–86, 1998. [2] N. Alon and S. Lovett. Almost k-wise vs. k-wise independent permutations, and uniformity for general group actions. Theory of Computing, 9(1):559–577, 2013. [3] S. Arora, C. Lund, R. Motwani, M. Sudan, and M. Szegedy. Proof verification and the hardness of approximation problems. Journal of the ACM, 45(3):501–555, 1998. [4] M. Bellare, D. Coppersmith, J. Hastad, M. Kiwi, and M. Sudan. Linearity testing in charac- teristic two. IEEE Transactions on Information Theory, 42(6):1781–1795, 1996. [5] M. Ben-Or, D. Coppersmith, M. Luby, and R. Rubinfeld. Non-abelian homomorphism testing, and distributions close to their self-convolutions. Random Structures & Algorithms, 32(1):49– 70, 2007. [6] E. Ben-Sasson, M. Sudan, S. Vadhan, and A. Wigderson. Randomness-efficient low degree tests and short PCPs via epsilon-biased sets. In Proceedings of the 35th annual ACM symposium on Theory of computing (STOC), pages 612–621, 2003. [7] P. Berman, S. Raskhodnikova, and G. Yaroslavtsev. Lp-testing. In Proceedings of the 46th Annual ACM Symposium on Theory of Computing (STOC), pages 164–173, 2014. [8] A. Bhattacharyya. Guest column: on testing affine-invariant properties over finite fields. ACM SIGACT News, 44(4):53–72, 2013. [9] A. Bhattacharyya, E. Fischer, H. Hatami, P. Hatami, and S. Lovett. Every locally characterized affine-invariant property is testable. In Proceedings of the 45th Annual ACM Symposium on Theory of Computing (STOC), pages 429–436, 2013. [10] A. Bhattacharyya, E. Fischer, and S. Lovett. Testing low complexity affine-invariant properties. Proceedings of the 24th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1337–1355, 2012. [11] A. Bhattacharyya, S. Kopparty, G. Schoenebeck, M. Sudan, and D. Zuckerman. Optimal test- ing of Reed-Muller codes. In Proceedings of the 51st Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 488–497, 2010. [12] P. Biane. Characters of symmetric groups and free cumulants. Asymptotic Combinatorics with Applications to Mathematical Physics, 1815:185–200, 2003. [13] E. Blais, A. Weinstein, and Y. Yoshida. Partially symmetric functions are efficiently isomorphism-testable. In Proceedings of the 53rd Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 551–560, 2012. [14] M. Blum, M. Luby, and R. Rubinfeld. Self-testing/correcting with applications to numerical problems. Journal of Computer and System Sciences, 47(3):549–595, 1993. 18 [15] T. Brocker and T. Dieck. Representations of Compact Lie Groups. Graduate Texts in Mathe- matics. Springer, 1985. [16] B. Green. A Szemer´edi-type regularity lemma in abelian groups, with applications. Geometric and Functional Analysis, 15(2):340–376, 2005. [17] H. Hatami and S. Lovett. Estimating the distance from testable affine-invariant properties. In Proceedings of the 54th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 237–242, 2013. [18] J. Huang, C. Guestrin, and L. Guibas. Fourier theoretic probabilistic inference over permuta- tions. The Journal of Machine Learning Research, 10:997–1070, 2009. [19] M. Kassabov. Symmetric groups and expander graphs. Inventiones Mathematicae, 170(2):327– 354, 2007. [20] T. Kaufman and M. Sudan. Algebraic property testing: the role of invariance. In Proceedings of the 40th Annual ACM Symposium on Theory of Computing (STOC), pages 403–412, 2008. [21] S. V. Kerov. Talk at IHP conference. 2000. [22] A. Kirillov. Introduction to Lie groups and Lie algebras. Cambridge University Press, 2008. [23] R. O’Donnell and J. Wright. Quantum spectrum testing. In Proceedings of the 47th ACM Symposium on Theory of Computing (STOC), 2015. [24] R. Raz and B. Spieker. On the “log rank”-conjecture in communication complexity. Combi- natorica, 15(4):567–588, 1995. [25] D. Ron. Algorithmic and analysis techniques in property testing. Foundations and Trends R(cid:13) in Theoretical Computer Science, 5(2):73–205, 2009. [26] R. Rubinfeld. On the robustness of functional equations. SIAM Journal on Computing, 28(6):1972–1997, 2006. [27] R. Rubinfeld and M. Sudan. Robust characterizations of polynomials with applications to program testing. SIAM Journal on Computing, 25(2):252–271, 1996. [28] A. Shpilka and A. Wigderson. Derandomizing homomorphism testing in general groups. SIAM Journal on Computing, 36(4):1215–1230, 2006. [29] R. P. Stanley. Irreducible symmetric group characters of rectangular shape. S´eminaire Lotharingien de Combinatoire, 50, 2003. [30] B. Steinberg. Representation Theory of Finite Groups: An Introductory Approach. Springer, 2011. [31] H. Weyl. Quantenmechanik und gruppentheorie. Zeitschrift fur Physik, 46(1-2):1–46, 1927. [32] K. Wimmer. Agnostically learning under permutation invariant distributions. In Proceedings of the 51st Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 113–122, 2010. 19 [33] Y. Yoshida. A characterization of locally testable affine-invariant properties via decomposi- tion theorems. In Proceedings of the 46th Annual ACM Symposium on Theory of Computing (STOC), pages 154–163, 2014. 20
1411.0960
2
1411
2015-01-14T12:22:14
Fully Dynamic Bin Packing Revisited
[ "cs.DS" ]
We consider the fully dynamic bin packing problem, where items arrive and depart in an online fashion and repacking of previously packed items is allowed. The goal is, of course, to minimize both the number of bins used as well as the amount of repacking. A recently introduced way of measuring the repacking costs at each timestep is the migration factor, defined as the total size of repacked items divided by the size of an arriving or departing item. Concerning the trade-off between number of bins and migration factor, if we wish to achieve an asymptotic competitive ration of $1 + \epsilon$ for the number of bins, a relatively simple argument proves a lower bound of $\Omega(\frac{1}{\epsilon})$ for the migration factor. We establish a nearly matching upper bound of $O(\frac{1}{\epsilon}^4 \log \frac{1}{\epsilon})$ using a new dynamic rounding technique and new ideas to handle small items in a dynamic setting such that no amortization is needed. The running time of our algorithm is polynomial in the number of items $n$ and in $\frac{1}{\epsilon}$. The previous best trade-off was for an asymptotic competitive ratio of $\frac{5}{4}$ for the bins (rather than $1+\epsilon$) and needed an amortized number of $O(\log n)$ repackings (while in our scheme the number of repackings is independent of $n$ and non-amortized).
cs.DS
cs
Fully Dynamic Bin Packing Revisited∗ Sebastian Berndt1, Klaus Jansen2 and Kim-Manuel Klein2 1Institute for Theoretical Computer Science, Universitat zu Lubeck, 2Department of Computer Science, Christian-Albrechts-University to [email protected] Kiel, {kj,kmk}@informatik.uni-kiel.de We consider the fully dynamic bin packing problem, where items arrive and depart in an online fashion and repacking of previously packed items is allowed. The goal is, of course, to minimize both the number of bins used as well as the amount of repacking. A recently introduced way of measuring the repacking costs at each timestep is the migration factor, defined as the total size of repacked items divided by the size of an arriving or departing item. Concerning the trade-off between number of bins and migration factor, if we wish to achieve an asymptotic competitive ration of 1 + ǫ for the number of bins, a relatively simple argument proves a lower bound of Ω(1/ǫ) for the migration factor. We establish a nearly matching upper bound of O(1/ǫ4 log 1/ǫ) using a new dynamic rounding technique and new ideas to handle small items in a dynamic setting such that no amortization is needed. The running time of our algorithm is polynomial in the number of items n and in 1/ǫ. The previous best trade-off was for an asymptotic competitive ratio of 5/4 for the bins (rather than 1 + ǫ) and needed an amortized number of O(log n) repackings (while in our scheme the number of repackings is independent of n and non-amortized). 1 Introduction For the classical bin packing problem, we are given a set I of items with a size function s : I → (0, 1] and need to pack them into as few unit sized bins as possible. In practice, the complete instance is often not known in advance, which has lead to the definition of a variety of online versions of the bin packing problem. First, in the classical online bin packing [Ull71], items arrive over time and have to be packed on arrival. Second, in dynamic bin packing [CGJ83], items may also depart over time. This dynamic bin packing model is often used for instance in • the placement and movement of virtual machines onto different servers for cloud computing • the development of guaranteed quality of service channels over certain multi-frequency [BB10, BKB07, SKZ08, VAN08, JJH+08, JJH+09], time division multiple access systems [PSC+00], ∗Supported by DFG Project, Entwicklung und Analyse von effizienten polynomiellen Approximationsschemata fur Scheduling- und verwandte Optimierungsprobleme, Ja 612/14-1. 1 [Sto13, SZ13], ters [DKL14, LTC14]. • the placement of processes, which require different resources, onto physical host machines • the resource allocation in a cloud network where the cost depends upon different parame- Third and fourth, we may allow already packed items to be slightly rearranged, leading to online bin packing with repacking (known as relaxed online bin packing) [GPT00] and dynamic bin packing with repacking (known as fully dynamic bin packing) [IL98]. See Figure 1 for a short overview on the different models. Deletion Repacking Name Online Bin Packing Relaxed Online Bin Packing Dynamic Bin Packing Fully Dynamic Bin Packing Figure 1: Overview of online models The amount of repacking can be measured in different ways. We can either count the total number of moved items at each timestep or the sum of the sizes of the moved items at each timestep. If one wants to count the number of moved items, one typically counts a group of tiny items as a single move. A shifting move [GPT00] thus involves either a single large item or a bundle of small items in the same bin of total size s with 1/10 ≤ s ≤ 1/5. Such a bundle may consists of up to Ω(n) (very small) items. If an algorithm measures the repacking by shifting moves, a new tiny item may lead to a large amount of repacking. In order to guarantee that a tiny item i with size s(i) only leads to a small amount of repacking, one may allow to repack items whose size adds up to at most β · s(i). The term β is called the migration factor [SSS09]. Note that shifting moves and migration factor are incomparable in the sense that a small migration factor does not imply a small number of shifting moves and vice versa. In order to measure the quality of an online algorithm, we compare the costs incurred by an online algorithm with the costs incurred by an optimal offline algorithm. An online algorithm receives as input a sequence of items I = (i1, i2, i3, . . .) and decides at each timestep t, where to place the item it without knowing future items it+1, it+2, . . .. We denote by I(t) = (i1, i2, . . . , it) the instance containing the first t items of the instance I and by opt(I(t)) the minimal number of bins needed to pack all items in I(t). Note that the packings corresponding to opt(I(t)) and opt(I(t + 1)) may differ significantly, as those packings do not need to be consistent. For an online algorithm A, we denote by A(I(t)) the number of bins generated by the algorithm on the input sequence I(t). Note that A must make its decision online, while opt(I(t)) is the optimal value of the offline instance. The quality of an algorithm for the online bin packing problem is typically measured by its asymptotic competitive ratio. An online algorithm A is called an asymptotic α-competitive algorithm, if there is a function f ∈ o(opt) such that A(I(t)) ≤ α opt(I(t)) + f (I(t)) for all instances I and all t ≤ I. The minimum α such that A is an asymptotic α-competitive algorithm is called the asymptotic competitive ratio of A, denoted by ron ∞ (A) = min{α A is an asymptotic α-competitive algorithm}. The online algorithm A thus has a double disadvantage: It does not know future items and we compare its quality to the optimal offline algorithm which may produce arbitrary different packings at time t and time t + 1. In order to remedy this situation, one may also compare the solution generated by A to a non-repacking optimal offline algorithm. This non-repacking optimal offline algorithm knows the complete instance, but is not allowed to repack. ∞ (A), i. e., the ratio is defined as ron 2 ✗ ✗ ✗ ✓ ✓ ✗ ✓ ✓ In this work, we present new results in fully dynamic bin packing where we measure the quality of an algorithm against a repacking optimal offline algorithm and achieve a asymptotic competitive ratio of 1 + ǫ. The amount of repacking is bounded by O(1/ǫ4 log(1/ǫ)). While we measure the amount of repacking in terms of the migration factor, we also prove that our algorithm uses at most O(1/ǫ4 log(1/ǫ)) shifting moves. Our algorithm runs in time polynomial in the instance size and in 1/ǫ. 1.1 Previous Results on Online Variants of Bin Packing Online Bin Packing The classical version of online bin packing problem was introduced by Ullman [Ull71]. In this classical model items arrive over time and have to be packed at their arrival, while one is not allowed to repack already packed items. Ullman gave the very first online algorithm FirstFit for the problem and proved that it its absolute competitive ratio is at most 2. The next algorithm NextFit was given by Johnson [Joh74], who proved that its absolute competitive is also at most 2. The analysis of the FirstFit algorithm was refined by Johnson, Demers, Ullman, Garey and Graham [JDU+74a], who proved that its asymptotic competitive ratio is at most 17/10. A revised version of FirstFit, called Revised FirstFit was shown to have asymptotic competitive ratio of at most 5/3 by Yao [Yao80]. A series of developments of so called harmonic algorithms for this problem was started by Lee and Lee [LL85] and the best known algorithm of this class which has asymptotic competitive ratio at most 1.58889 was given by Seiden [Sei02]. The lower bound on the absolute approximation ratio of 3/2 also holds for the asymptotic competitive ratio as shown by Yao [Yao80]. This lower bound was first improved independently by Brown [Bro79] and Liang [Lia80] to 1.53635 and subsequently to 1.54014 by van Vliet [Vli92] and finally to 1.54037 by Balogh, B´ek´esi and Galambos [BBG10]. Relaxed Online Bin Packing Model In contrast to the classical online bin packing problem, Gambosi, Postiglione and Talamo [GPT00] considered the online case where one is allowed to repack items. They called this model the relaxed online bin packing model and proved that the lower bound on the competi- tive ratio in the classical online bin packing model can be beaten. They presented an algorithm that uses 3 shifting moves and has an asymptotic competitive ratio of at most 3/2, and an al- gorithm that uses at most 7 shifting moves and has an asymptotic competitive ratio of 4/3. In another work, Ivkovi´c and Lloyd [IL97] gave an algorithm that uses O(log n) amortized shifting moves and achieves an asymptotic competitive ratio of 1 + ǫ. In this amortized setting, shifting moves can be saved up for later use and the algorithm may repack the whole instance sometimes. Epstein and Levin [EL09] used the measure of the migration factor to give an algorithm that has an asymptotic competitive ratio of 1 + ǫ and a migration factor of 2O((1/ǫ) log2(1/ǫ)). This result was improved by Jansen and Klein [JK13] who achieved polynomial migration. Their algorithm uses a migration factor of O(1/ǫ4) to achieve an asymptotic competitive ratio of 1 + ǫ. Concerning lower bounds on the migration factor, Epstein and Levin [EL09] showed that no optimal solution can be maintained while having a constant migration factor (independent of 1/ǫ). Furthermore, Balogh, B´ek´esi, Galambos and Reinelt [BBGR08] proved that a lower bound on the asymptotic competitive ratio of 1.3877 holds, if the amount of repacking is measured by the number of items and one is only allowed to repack a constant number of items. 3 Dynamic Bin Packing An extension to the classical online bin packing model was given by Coffman, Garey and Johnson [CGJ83], called the dynamic bin packing model. In addition to the insertion of items, items also depart over time. No repacking is allowed in this model. It is easily seen that no algorithm can achieve a constant asymptotic competitive ratio in this setting. In order to measure the performance of an online algorithm A in this case, they compared the maximum number of bins used by A with the maximum number of bins used by an optimal offline algorithm, i. e., an algorithm A in this dynamic model is called an asymptotic α-competitive algorithm, if there is a function f ∈ o(max-opt), where max-opt(I) = maxt opt(I(t)) such that maxt A(I(t)) ≤ α· maxt opt(I(t)) + f (I) for all instances I. The minimum of all such α is called the asymptotic competitive ratio of A. Coffman, Garey and Johnson modified the FirstFit algorithm and proved that its asymptotic competitive ratio is at most 2.897. Furthermore, they showed a lower bound of 2.5 on the asymptotic competitive ratio when the performance of the algorithm is compared to a repacking optimal offline algorith, i. e., maxt opt(I(t)). In the case that the performance of the algorithm is compared to an optimal non-repacking offline algorithm, Coffman, Garey and Johnson showed a lower bound of 2.388. This lower bound on the non-repacking optimum was later improved by Chan, Lam and Wong [CLW08] to 2.428 and even further in a later work by Chan, Wong and Yung [CWY09] to 2.5. Fully Dynamic Bin Packing We consider the dynamic bin packing when repacking of already packed items is allowed. This model was first investigated by Ivkovi´c and Lloyd [IL98] and is called fully dynamic bin packing. In this model, items arrive and depart in an online fashion and limited repacking is allowed. The quality of an algorithm is measured by the asymptotic competitive ratio as defined in the classical online model (no maximum is taken as in the dynamic bin packing model). Ivkovi´c and Lloyd developed an algorithm that uses amortized O(log n) many shifting moves (see definition above) to achieve an asymptotic competitive ratio of 5/4. Related Results on the Migration Factor Since the introduction of the migration factor, several problems were considered in this model and different robust algorithms for these problems have been developed. Following the termi- nology of Sanders, Sivadasan and Skutella [SSS09] we sometimes use the term (online) approx- imation ratio instead of competitive ratio. Hence, we also use the term asymptotic polynomial time approximation scheme (APTAS) and asymptotic fully polynomial time approximation scheme (AFPTAS) in the context of online algorithms. If the migration factor of an algorithm A only depends upon the approximation ratio ǫ and not on the size of the instance, we say that A is an robust algorithm. In the case of online bin packing, Epstein and Levin [EL09] developed the first robust APTAS for the problem using a migration factor of 2O((1/ǫ2) log(1/ǫ)). They also proved that there is no online algorithm for this problem that has a constant migration factor and that maintains an optimal solution. The APTAS by Epstein and Levin was later improved by Jansen and Klein [JK13], who developed a robust AFPTAS for the problem with migration factor O(1/ǫ4). In their paper, they developed new linear program (LP)/integer linear program (ILP) techniques, which we make use of to obtain polynomial migration. It was shown by Epstein and Levin [EL13] that their APTAS for bin packing can be generalized to packing d-dimensional cubes into unit cubes. Sanders, Sivadasan and Skutella [SSS09] developed a robust polynomial time approximation scheme (PTAS) for the scheduling problem on identical machines with a migration factor of 4 2O((1/ǫ) log2(1/ǫ)). Skutella and Verschae [SV10] studied the problem of maximizing the minimum load given n jobs and m identical machines. They also considered a dynamic setting, where jobs may also depart. They showed that there is no robust PTAS for this machine covering problem with constant migration. The main reason for the nonexistence is due to very small jobs. By using an amortized migration factor, they developed a PTAS for the problem with amortized migration of 2O((1/ǫ) log2(1/ǫ)). 1.2 Our Contributions Main Result In this work, we investigate the fully dynamic bin packing model. We measure the amount of repacking by the migration factor; but our algorithm uses a bounded number of shifting moves as well. Since the work of Ivkovi´c and Lloyd from 1998 [IL98], no progress was made on the fully dynamic bin packing problem concerning the asymptotic competitive ratio of 5/4. It was also unclear whether the number of shifting moves (respectively migration factor) must depend on the number of packed items n. In this paper we give positive answers for both of these concerns. We develop an algorithm that provides at each time step t an approximation guarantee of (1 + ǫ) opt(I(t)) + O(1/ǫ log(1/ǫ)). The algorithm uses a migration factor of O(1/ǫ4 · log(1/ǫ)) by repacking at most O(1/ǫ3 · log(1/ǫ)) bins. Hence, the generated solution can be arbitrarily close to the optimum solution, and for every fixed ǫ the provided migration factor is constant (it does not depend on the number of packed items). The running time is polynomial in n and 1/ǫ. In case that no deletions are used, the algorithm has a migration factor of O(1/ǫ3 · log(1/ǫ)), which beats the best known migration factor of O(1/ǫ4) by Jansen and Klein [JK13]. Since the number of repacked bins is bounded, so is the number of shifting moves as it requires at most O(1/ǫ) shifting moves to repack a single bin. Furthermore, we prove that there is no asymptotic approximation scheme for the online bin packing problem with a migration factor of o(1/ǫ) even in the case that no items depart (and even if P = NP). Technical Contributions We use the following techniques to achieve our results: • In order to obtain a lower bound on the migration factor in Section 2, we construct a series of instances that provably need a migration factor of Ω(1/ǫ) in order to have an asymptotic approximation ratio of 1 + ǫ. • In Section 3, we show how to handle large items in a fully dynamic setting. The fully dynamic setting involves more difficulties in the rounding procedure, in contrast to the setting where large items may not depart, treated in [JK13]. A simple adaption of the dynamic techniques developed in [JK13] does not work (see introduction of Section 3). We modify the offline rounding technique by Karmarkar and Karp [KK82] such that a feasible rounding structure can be maintained when items are inserted or removed. This way, we can make use of the LP-techniques developed in Jansen and Klein [JK13]. • In Section 4, we explain how to deal with small items in a dynamic setting. In contrast to the setting where departure of items is not allowed, the fully dynamic setting provides major challenges in the treatment of small items. An approach is thus developed where small items of similar size are packed near each other. We describe how this structure can be maintained as new items arrive or depart. Note that the algorithm of Ivkovi´c and Lloyd [IL98] relies on the ability to manipulate up to Ω(n) very small items in constant time. See also their updated work for a thorough discussion of this issue [IL09]. 5 2M {z } 2M (c+1) {z } • In order to unify the different approaches for small and large items, in Section 4.2, we develop an advanced structure for the packing. We give novel techniques and ideas to manage this mixed setting of small and large items. The advanced structure makes use of a potential function, which bounds the number of bins that need to be reserved for incoming items. 2 Lower Bound We start by showing that there is no robust (asymptotic) approximation scheme for bin packing with migration factor of o(1/ǫ), even if P = NP. This improves the lower bound given by Epstein and Levin [EL09], which states that no algorithm for bin packing, that maintains an optimal solution can have a constant migration factor. Previously it was not clear whether there exists a robust approximation algorithm for bin packing with sublinear migration factor or even a constant migration factor. Theorem 1. For a fixed migration factor γ > 0, there is no robust approximation algorithm for bin packing with asymptotic approximation ratio better than 1 + 1 6⌈γ⌉+5 . Proof. Let A be an approximation algorithm with migration factor γ > 0 and c = ⌈γ⌉. We will now construct an instance such that the asymptotic approximation ratio of A with migration factor c is at least 1 + 1 6c+5 . The instance contains only two types of items: An A-item has size a = 3/2 3c+2 and an B-item has size b = 1/2 − a/3. For a M ∈ N, let IM = [(b, Insert), (b, Insert), . . . , (b, Insert) ] , (a, Insert), (a, Insert), . . . , (a, Insert) be the instance consisting of 2M insertions of B-items, followed by 2M (c + 1) insertions of A-items. Denote by r(t) the approximation ratio of the algorithm at time t ∈ N. The approxi- mation ratio of the algorithm is thus r = maxt{r(t)}. The insertion of the B-items produces a packing with β1 bins containing a single B-item and β2 bins containing two B-items. These are the only possible packings and hence β1 + 2β2 = 2M . The optimal solution is reached if β1 = 0, β2 = M . We thus have an approximation ratio of r(2M ) =: r1 = β1 + β2 M = 2M − β2 M , which is strictly monotonically decreasing in β2. The A-items, which are inserted afterwards, may either be put into bins which only contain A-items or into bins which contain only one B-item. The choice of a, b implies 2 · b + a > 1 which shows that no A-item can be put into a bin containing two B-items. Denote by α the number of bins containing only A-items. The existing B-items may not be moved as the choice of a, b implies b > c· a > γ · a. At most 1/2+a/3 a = c + 1 items of type A may be put into the bins containing only one B-item. Note that this also implies that a bin which contains one B-item and c + 1 items of type A is filled completely. The optimal packing thus consists of 2M of those bins and the approximation ratio of the solution is given by r(2M (c + 2)) =: r2 = β1 + β2 + α 2M = 2M − 2β2 + β2 + α 2M = 2M − β2 + α 2M . There are at most β1 · (c + 1) items of type A which can be put into bins containing only one B-item. The remaining (2M − β1)(c + 1) items of type A therefore need to be put into bins 6 containing only A-items. We can thus conclude α ≥ (2M − β1)(c + 1)a = (2M − 2M + 2β2)(c + 1)a = 2β2(c + 1)a. As noted above, 1/2+a/3 a = c + 1 and thus (c + 1)a = 1/2 + a/3. Hence the approximation ratio is at least β1 + β2 + α r2 = 2M + β2(−1 + 1 + 2a/3) 2M ≥ 2M 2M − β2 + 2β2(1/2 + a/3) = 2M = 2M + β2 · 2a/3 2M , which is strictly monotonically increasing in β2. As r ≥ max{r1, r2}, a lower bound on the approximation ratio is thus given if r1 = r2 by M = 2M +β·2a/3 a/3+1 . The lower bound for a certain β. Solving this equation leads to β = M 2M −β 2M is thus given as 2M − β M r ≥ = 2 − 1 a/3 + 1 = 1 + 1 6c + 5 by the choice of a. Note that this lower bound is independent from M . Hence, r is also a lower bound on the asymptotic approximation ratio of any algorithm as the instance size grows with M . We obtain the following corollary: Corollary 1. There is no robust/dynamic (asymptotic) approximation scheme for bin packing with a migration factor γ ≤ 1/6(1/ǫ − 11) = Θ(1/ǫ). 3 Dynamic Rounding In the first subsection we present a general rounding structure. The goal of this section is to give a robust AFPTAS for the case that only large items arrive and depart. In the second subsection we give operations on how the rounding can be modified such that the general structure is preserved. We give the final algorithm in Section 3.3, which is performed, when large items arrive or depart. Finally, the correctness is proved by using the LP/ILP techniques developed in [JK13]. In [JK13], the last two authors developed a dynamic rounding technique based on an offline rounding technique from Fernandez de la Vega and Lueker [FdlVL81]. However, a simple adaption of these techniques does not work in the dynamic case where items may also depart. In the case of the offline rounding by Fernandez de la Vega and Lueker, items are sorted and then collected in groups of the same cardinality. As a new item arrives in an online fashion, this structure can be maintained by inserting the new item to its corresponding group. By shifting the largest item of each group to the left, the cardinality of each group (except for the first one) can be maintained. However, shifting items to the right whenever an item departs leads to difficulties in the LP/ILP techniques. As the rounding for a group may increase, patterns of the existing LP/ILP solution might become infeasible. We overcome these difficulties by developing a new dynamic rounding structure and operations based on the offline rounding technique by Karmarkar and Karp [KK82]. We felt that the dynamic rounding technique based on Karmarkar and Karp is easier to analyze since the structure can essentially be maintained by shifting items. A bin packing instance consists of a set of items I = {i1, i2, . . . , in} with size function s : I → [0, 1] ∩ Q. A feasible solution is a partition B1, . . . , Bk of I such that Pi∈Bj s(i) ≤ 1 for j = 1, . . . , k. We call a partition B1, . . . , Bk a packing and a single set Bj is called a bin. The 7 goal is to find a solution with a minimal number of bins. If the item i is packed into the bin Bj, we write B(i) = j. The smallest value of k ∈ N such that a packing with k bins exists is denoted by opt(I, s) or if the size function is clear by opt(I). A trivial lower bound is given by the value size(I, s) =Pi∈I s(i). 3.1 Rounding To obtain an LP formulation of fixed (independent of I) dimension, we use a rounding technique based on the offline AFPTAS by Karmarkar and Karp [KK82]. In order to use the technique for our dynamic setting, we give a more general rounding. This generalized rounding has a certain structure that is maintained throughout the algorithm and guarantees an approximate solution for the original instance. First, we divide the set of items into small ones and large ones. An item i is called small if s(i) < ǫ/14, otherwise it is called large. Instance I is partitioned accordingly into a set of large items IL and a set of small items IS. We treat small items and large items differently. Small items can be packed using an algorithm presented in Section 4.1 while large items will be assigned using an ILP. In this section we discuss how to handle large items. First, we characterize the set of large items more precisely by their sizes. We say that two large items i, i′ are in the same size category if there is a ℓ ∈ N such that s(i) ∈ (2−(ℓ+1), 2−ℓ] and s(i′) ∈ (2−(ℓ+1), 2−ℓ]. Denote the set of all size categories by W . As every large item has size at least ǫ/14, the number of size categories is bounded by log(1/ǫ) + 5. Next, items of the same size category are characterized by their block, which is either A or B and their position r ∈ N in this block. Therefore, we partition the set of large items into a set of groups G ⊆ W × {A, B} × N. A group g ∈ G consists of a triple (ℓ, X, r) with size category ℓ ∈ W , block X ∈ {A, B} and position r ∈ N. The rounding function is defined as a function R : IL 7→ G that maps each large item i ∈ IL to a group g ∈ G. By g[R] we denote the set of items being mapped to the group g, i. e., g[R] = {i ∈ IL R(i) = g}. Let q(ℓ, X) be the maximal r ∈ N such that (ℓ, X, r)[R] > 0. If (ℓ, X1, r1) and (ℓ, X2, r2) are two different groups, we say that (ℓ, X1, r1) is left of (ℓ, X2, r1), if X1 = A and X2 = B or X1 = X2 and r1 < r2. We say that (ℓ, X1, r1) is right of (ℓ, X2, r2) if it is not left of it. (ℓ, A, 0) . . . (ℓ, A, q(ℓ, A)) (ℓ, B, 0) . . . (ℓ, B, q(ℓ, B)) s ∈ [2−(ℓ+1), 2−ℓ) Figure 2: Grouping in (ℓ, A,·) and (ℓ, B,·) Given an instance (I, s) and a rounding function R, we define the rounded size function sR by rounding the size of every large item i ∈ g[R] up to the size of the largest item in its group, hence sR(i) = max {s(i′) R(i′) = R(i)}. We denote by opt(I, sR) the value of an optimal solution of the rounded instance (I, sR). Depending on a parameter k, we define the following properties for a rounding function R. (a) For each i ∈ (ℓ, X, r)[R] we have 2−(ℓ+1) < s(i) ≤ 2−ℓ. (b) For each i ∈ (ℓ, X, r)[R] and each i′ ∈ (ℓ, X, r′)[R] and r < r′, we have s(i) ≥ s(i′). (c) For each ℓ ∈ W and 1 ≤ r ≤ q(ℓ, A) we have (ℓ, A, r)[R] = 2ℓk and (ℓ, A, 0)[R] ≤ 2ℓk. (d) For each ℓ ∈ W and each 0 ≤ r ≤ q(ℓ, B) − 1 we have (ℓ, B, r)[R] = 2ℓ(k − 1) and Property (a) guarantees that the items are categorized correctly according to their sizes. Prop- erty (b) guarantees that items of the same size category are sorted by their size and properties (c) and (d) define the number of items in each group. furthermore (ℓ, B, q(ℓ, B))[R] ≤ 2ℓ(k − 1). 8 size(IL)·ǫ Lemma 1. For k = j above by O(1/ǫ log(1/ǫ)) assuming that size(IL) > 8/ǫ · (⌈log(1/ǫ)⌉ + 5). Proof. Using the definition of k and the assumption, we show 2 size(IL) have 2(⌊log(1/ǫ)⌋+5)k the number of non-empty groups in G is bounded from k−1 ≤ 8/ǫ(⌊log(1/ǫ)⌋ + 5). We 2 size(IL) k − 1 = 2 size(IL) size(IL)·ǫ 2(⌊log(1/ǫ)⌋+5)k − 1 ≤ j 2 size(IL) 2 size(IL) size(IL)·ǫ = 2(⌊log(1/ǫ)⌋+5) − 2 2 size(IL) · 2(⌊log(1/ǫ)⌋ + 5) size(IL) · ǫ − 4(⌊log(1/ǫ)⌋ + 5) = size(IL)·ǫ−4(⌊log(1/ǫ)⌋+5) 2(⌊log(1/ǫ)⌋+5) As size(IL) > 8/ǫ · (⌈log(1/ǫ)⌉ + 5), we have ǫ/2 size(IL) > 4(⌊log(1/ǫ)⌋ + 5). We can thus bound: 2 size(IL) · 2(⌊log(1/ǫ)⌋ + 5) size(IL) · ǫ − 4(⌊log(1/ǫ)⌋ + 5) ≤ 2 size(IL) · 2(⌊log(1/ǫ)⌋ + 5) = 2 size(IL) · 2(⌊log(1/ǫ)⌋ + 5) size(IL) · ǫ − ǫ/2 size(IL) + 1 = 4(⌊log(1/ǫ)⌋ + 5) 8(⌊log(1/ǫ)⌋ + 5) = ǫ/2 ǫ size(IL) · ǫ/2 Note that property (c) and property (d) imply I(ℓ) ≥ (q(ℓ, A) + q(ℓ, B)− 2)2ℓ(k− 1) . Hence property (a) implies that size(I(ℓ), s) ≥ I(ℓ)2−ℓ+1 ≥ (q(ℓ, A) + q(ℓ, B) − 2)(k − 1)/2 and therefore q(ℓ, A) + q(ℓ, B) ≤ 2 size(I(ℓ))/(k − 1) + 2. We can now bound the total number of used groups by + 2(cid:19) k − 1 2 size(IL) Xℓ∈W = 2W + q(ℓ, A) + q(ℓ, B) ≤ Xℓ∈W(cid:18) 2 size(I(ℓ)) k − 1 size(I(ℓ)) = 2W + 2 k − 1 Xℓ∈W (⌊log(1/ǫ)⌋ + 5) ≤ 8 ǫ ≤ 2W + 2 · (log(1/ǫ) + 5) + (8/ǫ + 2)(log(1/ǫ) + 5) ∈ O(1/ǫ log(1/ǫ)) (log(1/ǫ) + 5) = 8 ǫ The total number of used groups is therefore bounded by O(1/ǫ log(1/ǫ)). The following lemma shows that the rounding function does in fact yield a (1+ǫ)-approximation. Lemma 2. Given an instance (I, s) with items greater than ǫ/14 and a rounding function R fulfilling properties (a) to (d), then opt(I, sR) ≤ (1 + ǫ)OPT (I, s). Proof. As (I, s) only contains large items, IL = I. Define for every ℓ the instances Jℓ = Sq(ℓ,A) r=2 (ℓ, A, r)[R]∪Sq(ℓ,B) (ℓ, B, r)[R], J =Sℓ∈W Jℓ and K =Sℓ∈W (ℓ, A, 0)[R]∪ (ℓ, A, 1)[R]. We will now prove, that the error generated by this rounding is bounded by ǫ. As each solution to J∪K yields a solution to J and a solution to K, we get opt(J∪K, sR) ≤ opt(J, sR)+opt(K, sR). For i ∈ (ℓ, A, 0)[R] ∪ (ℓ, A, 1)[R], we have s(i) ≤ max {s(i′) i′ ∈ (ℓ, A, 0)[R]} ≤ 2−ℓ because of property (a). We can therefore pack at least 2ℓ items from (ℓ, A, 0)[R]∪ (ℓ, A, 1)[R] into a single bin. Hence, we get with property (c): r=0 opt((ℓ, A, 0)[R] ∪ (ℓ, A, 1)[R]), sR) ≤ ((ℓ, A, 0)[R] + (ℓ, A, 1)[R]) · 2−ℓ = 2k 9 We can therefore bound opt(K, sR) as follows: opt((ℓ, A, 0)[R] ∪ (ℓ, A, 1)[R]), sR) 2k opt(K, sR) ≤ Xℓ∈W ≤ Xℓ∈W ≤ 2(⌊log(1/ǫ)⌋ + 5)k = 2⌊ size(I)ǫ 2(⌊log(1/ǫ)⌋ + 5)⌋ · (⌊log(1/ǫ)⌋ + 5) 2(⌊log(1/ǫ)⌋ + 5) · (⌊log(1/ǫ)⌋ + 5) size(I)ǫ ≤ 2 = ǫ size(I) ≤ ǫ opt(I, s) Using property (b) for each item in ((ℓ, X, r + 1)[R]), sR) we find a unique larger item in (ℓ, X, r)[R]. Therefore we have for every item in the rounded instance (J, sR) an item with larger size in instance (I, s) and hence The optimal value of the rounded solution can be bounded by opt(J, sR) ≤ opt(I, s). opt(I, sR) ≤ opt(J, sR) + opt(K, sR) ≤ (1 + ǫ) opt(I, s). We therefore have a rounding function, which generates only O(1/ǫ log(1/ǫ)) different item sizes and the generated error is bounded by ǫ. 3.2 Rounding Operations Let us consider the case where large items arrive and depart in an online fashion. Formally this is described by a sequence of pairs (i1, A1), . . . , (in, An) where Ai ∈ {Insert, Delete}. At each time t ∈ {1, . . . , n} we need to pack the item it into the corresponding packing of i1, . . . , it−1 if Ai = Insert or remove the item it from the corresponding packing of i1, . . . , it−1 if Ai = Delete. We will denote the instance i1, . . . , it at time t by I(t) and the corresponding packing by Bt. We will also round our items and denote the rounding function at time t by Rt. The large items of I(t) are denoted by IL(t). At time t we are allowed to repack several items with a total size of β · s(it) but we intend to keep the migration factor β as small as possible. The term repack(t) = Pi,Bt−1(i)6=Bt(i) s(i) denotes the sum of the items which are moved at time t, the migration factor β of an algorithm is then defined as maxt {repack(t)/s(it)}. As the value of size will also change over the time, we define the value κ(t) as κ(t) = size(IL(t)) · ǫ 2(⌊log(1/ǫ)⌋ + 5) . As shown in Lemma 1, we will make use of the value k(t) := ⌊κ(t)⌋. We present operations that modify the current rounding Rt and packing Bt with its corre- sponding LP/ILP solutions to give a solution for the new instance I(t + 1). At every time t the rounding Rt maintains properties (a) to (d). Therefore the rounding provides an asymptotic 10 approximation ratio of 1 + ǫ (Lemma 2) while maintaining only O(1/ǫ log(1/ǫ)) many groups (Lemma 1). We will now present a way how to adapt this rounding to a dynamic setting, where items arrive or depart online. Our rounding Rt is manipulated by different operations, called the insert, delete, shiftA and shiftB operation. Some ideas behind the operations are inspired by Epstein and Levin [EL09]. The insert operation is performed whenever a large item arrives and the delete operation is performed whenever a large item departs. The shiftA/shiftB operations are used to modify the number of groups that are contained in the A and B block. As we often need to filter the largest items of a group g belonging to a rounding R, we denote this item by λ(g, R). • shift: A shift operation takes two groups (ℓ, X1, r1) and (ℓ, X2, r2), where (ℓ, X1, r1) is left of (ℓ, X2, r2), and a rounding function R and produces a new rounding function R′ and packing B′ by shifting the largest item from (ℓ, X2, r2) to (ℓ, X2, r2 − 1) and so on until (ℓ, X1, r1) is reached. – For all groups g left of (ℓ, X1, r1) or right of (ℓ, X2, r2) set g[R′] = g[R]. – As we move an items out of (ℓ, X2, r2), set (ℓ, X2, r2)[R′] = (ℓ, X2, r2)[R] \ λ((ℓ, X2, r2), R). – As we move an item into (ℓ, X1, r1), set (ℓ, X1, r1)[R′] = (ℓ, X1, r1)[R] ∪ λ(right(ℓ, X1, r1), R). Whenever a shift-operation on (ℓ, X1, r1) and (ℓ, X2, r2) is performed, the LP solution x and the corresponding ILP solution y is updated to x′ and y′. Let Ci be a configuration containing λ((ℓ, X2, r2), R) with xi ≥ 1. Let Cj = Ci \ s(λ((ℓ, X2, r2), R)) be the configu- i = xi − 1, y′ ration without λ((ℓ, X2, r2), R). Set x′ i = yi − 1. In order to add the new item in (ℓ, X1, r1), set x′ h = yh + 1 for the index h with Ch = {1 : s(λ((ℓ, X1, r1), R))}. The remaining configurations do not change. h = xh + 1 and y′ j = yj + 1 and x′ j = xj + 1, y′ . . . (ℓ, X1, r1) . . . (ℓ, A, q(ℓ, A)) (ℓ, B, 0) . . . (ℓ, X2, r2) . . . Figure 3: shift with parameters (ℓ, X1, r1) and (ℓ, X2, r2) • Insert: To insert item it, find the corresponding group (ℓ, X, r) with – s(it) ∈ [ℓ, 2ℓ), – min {s(i) i ∈ (ℓ, X, r − 1)} > s(it) and – s(λ((ℓ, X, r + 1), R)) ≤ s(it). We will then insert it into (ℓ, X, r) and get the rounding R′ by shifting the largest element of (ℓ, X, r) to (ℓ, X, r − 1) and the largest item of (ℓ, X, r − 1) to (ℓ, X, r − 2) and so on until (ℓ, A, 0) is reached. Formally, set R∗(it) = (ℓ, X, r) and R∗(ij) = R(ij) for j 6= t. The rounding function R′ is then obtained by applying the shift operation on R∗ i.e. the new rounding is R′ = shift((ℓ, A, 0), (ℓ, X, r), R∗). In order to pack the new item, let i be the index with Ci = {1 : s(λ((ℓ, X, r), R′))}, as it is rounded to the largest size in (ℓ, X, r)[R] after the shift. Place item it into a new bin by setting B′(it) = maxj B(ij) + 1 and x′ i = xi + 1 and y′ i = yi + 1. 11 If (ℓ, A, 0)[R′] = 2ℓ·k+1, we have to create a new rounding group (ℓ, A,−1). Additionally we shift the largest item in (ℓ, A, 0)[R′] to the new group (ℓ, A,−1)[R′]. The final rounding R′′ is then obtained by setting (ℓ, A, r)[R′′] = (ℓ, A, r−1)[R′] i.e. incrementing the number of each rounding group by 1. Note that the largest item in (ℓ, A, 0)[R′] is already packed into a bin of its own due to the shift operation. Hence, no change in the packing or the LP/ILP solution is needed. The insert operation thus yields a new packing B′ (or B′′) which uses two more bins than the packing B. (ℓ, A, 0) . . . (ℓ, X, r) . . . (ℓ, X, q(ℓ, X)) i Figure 4: Insert i into (ℓ, X,·) • Delete: To delete item it from the group (ℓ, X, r) with R(it) = (ℓ, X, r), we remove it from this group and move the largest item from (ℓ, X, r + 1) into (ℓ, X, r) and the largest item from (ℓ, X, r + 2) into (ℓ, X, r + 1) and so on until (ℓ, B, q(ℓ, B)). Formally the rounding R′ is described by the expression shift((ℓ, X, r), (ℓ, B, q(ℓ, B)), R∗) where g[R∗] =((ℓ, X, r)[R] \ {it} g = (ℓ, X, r) g[R] else . As a single shift operation is used, the delete operation yields a new packing B′ which uses one more bin than the packing B. For the LP/ ILP solution let Ci be a configuration containing λ((ℓ, B, q(ℓ, B)), R) with xi ≥ 1. Let Cj = Ci s(λ((ℓ, B, q(ℓ, B)), R)) be the configuration without the item λ((ℓ, B, q(ℓ, B)), R). Set x′ i = yi − 1. Set B′(ij) = B(ij) for all j 6= t in order to remove the item it from the packing. i = xi − 1, y′ j = yj + 1 and x′ j = xj + 1, y′ (ℓ, X, 0) . . . (ℓ, X, r) . . . (ℓ, B, q(ℓ, B)) i Figure 5: Delete i from (ℓ, X,·) To control the number of groups in A and B we introduce operations shiftA and shiftB that increase or decrease the number of groups in A respectively B. An operation shiftA increases the number of groups in A by 1 and decreases the number of groups in B by 1. Operations shiftB is doing the inverse of shiftA. • shiftA: In order to move a group from B to A we will perform exactly 2ℓ times the operation shift((ℓ, B, 0), (ℓ, B, q(ℓ, B)), R) to receive the rounding R∗. Instead of opening a new bin for each of those 2ℓ items in every shift operation, we rather open one bin containing all items. Since every item in the corresponding size category has size ≤ 2−ℓ, the items fit into a single bin. The group (ℓ, B, 0) has now the same size as the groups in (ℓ, A,·). We transfer (ℓ, B, 0) to block A. Hence we define for the final rounding R′ that 12 (ℓ, A, r)[R′] = (ℓ, A, r)[R∗] for r = 0, . . . , q(ℓ, A) and (ℓ, A, q(ℓ, A) + 1)[R′] = (ℓ, B, 0)[R∗] as well as (ℓ, B, r)[R′] = (ℓ, B, r + 1)[R∗] for r = 0, . . . , q(ℓ, B) − 1. The resulting packing B′ hence uses one more bin than the packing B. 2ℓ 2ℓ 2ℓ 2ℓ (ℓ, B, 0) . . . (ℓ, B, r) . . . (ℓ, B, q(ℓ, B)) Figure 6: shiftA • shiftB: In order to move a group from A to B we will perform exactly 2ℓ times the operation shift((ℓ, A, 0), (ℓ, A, q(ℓ, A)), R) to receive the rounding R∗. As before in shiftA, we open a single bin containing all of the 2ℓ items. The group (ℓ, A, q(ℓ, A)) has now the same size as the groups in (ℓ, B,·). We transfer (ℓ, A, q(ℓ, A)) to block B. Similar to shiftA we define for the final rounding R′ that (ℓ, A, r)[R′] = (ℓ, A, r)[R∗] for r = 0, . . . , q(ℓ, A) − 1 and (ℓ, B, 0)[R′] = (ℓ, A, q(ℓ, A))[R∗] as well as (ℓ, B, r + 1)[R′] = (ℓ, B, r)[R∗]. The resulting packing B′ hence uses one more bin than the packing B. Lemma 3. Let R be a rounding function fulfilling properties (a) to (d). Applying one of the operations insert, delete, shiftA or shiftB on R results in a rounding function R′ fulfilling properties (a) to (d). Proof. Property (a) is always fulfilled as no item is moved between different size categories and the insert operation inserts an item into its appropriate size category. As the order of items never changes and the insert operation inserts an item into the appro- priate place, property (b) also holds. For properties (c) and (d) we first note that the operation shift(g, g′, R) increases the number of items in g by 1 and decreases the number of items in g′ by 1. The insert operation consists of adding a new item to a group g followed by a shift((ℓ, A, 0), g, R) operation. Hence the number of items in every group except for (ℓ, A, 0) (which is increased by 1) remains the same. The delete operation consists of removing an item from a group g followed by a shift(g, (ℓ, B, q(ℓ, B)), R) operation. Therefore the number of items in all groups except for (ℓ, B, q(ℓ, B)) (which is decreased by 1) remains the same. As the number of items in (ℓ, A, 0) and (ℓ, B, q(ℓ, B)) are treated seperately and may be smaller than 2ℓ · k respectively 2ℓ · (k − 1), the properties (c) and (d) are always fulfilled for the insert and the delete operation. Concerning the shiftA operation we increase the number of items in a group (ℓ, B, 0) by 2ℓ. Therefore it now contains 2ℓ(k − 1) + 2ℓ = 2ℓ · k items, which equals the number of items in groups of block A. As this group is now moved to block A, the properties (c) and (d) are fulfilled. Symmetrically the shiftB operation decreases the number of items in a group (ℓ, A, q(ℓ, A)) by 2ℓ. Therefore the number of items in the group is now 2ℓ · k − 2ℓ = 2ℓ · (k − 1), which equals the number of items in the groups of block B. As this group is now moved to block B, the properties (c) and (d) are fulfilled. According to Lemma 1 the rounded instance (I, sR) has O(1/ǫ log(1/ǫ)) different item sizes (given a suitable k). Using the LP formulation of Eisemann [Eis57], the resulting LP called LP (I, sR) has m = O(1/ǫ log(1/ǫ)) constraints. We say a packing B corresponds to a rounding R and an integral solution y of the ILP if all items in (I, sR) are packed by B according to y. 13 Lemma 4. Applying any of the operations insert, delete, shiftA or shiftB on a rounding function R and ILP solution y with corresponding packing B defines a new rounding function R′ and a new integral solution y′. Solution y′ is a feasible solution of LP (I, sR′ ). ) changes in comparison to the LP Proof. We have to analyze how the LP for instance (I, sR′ for instance (I, sR). Shift Operation: A single shift(g1, g2, R) operation moves one item from each group g be- tween g1 and g2 into g and one item out of g. As no item is moved out of g1 and no item is moved into g2, the number of items in g1 is increased by 1 and the number of items in g2 is decreased by 1. The right hand side of the LP (I, sR) is defined by the cardinalities g[R] of the rounding groups g in R. As only the cardinalities of g1 and g2 change by ±1 the right hand side changes accordingly to ±1 in the corresponding components of y. The moved item from g2 is removed from the configuration and a new configuration containing the new item of g1 is added. The LP and ILP solutions x and y are being modified such that λ(g2, R) is removed from its configuration and a new configuration is added such that the enhanced right hand side of g1 is covered. Since the largest item λ(g, R) of every group g between g1 and g2 is shifted (i) of item i ∈ g[R] is defined by sR′ to its left group, the size sR′ (i) = s(ι(g, R)), where ι(g, R) is the second largest item of g[R]. Therefore each item in (I, sR′ ) is rounded to a smaller or equal value as s(ι(g, R)) ≤ s(λ(g, R)). All configurations of (I, sR) can thus be transformed into feasible configurations of (I, sR′ Insert Operation: The insert operation consists of inserting the new item into its correspond- ing group g followed by a shift operation. Inserting the new item into g increases the right hand side of the LP by 1. To cover the increased right hand side, we add a new configuration {1 : sR′ (i)} containing only the new item. In order to reflect the change in the LP solution, the new item is added into an additional bin. The remaining changes are due to the shift operation already treated above. Delete Operation: The delete operation consists of removing an item i from its corresponding group g followed by a shift operation. Removing the new item from g decreases the right hand side of the LP by 1. The current LP and ILP solutions x and y do not need to be changed to cover the new right hand side. The remaining changes are due to the shift operation already treated above. shiftA/shiftB Operation: As the shiftA and shiftB operations consist only of repeated use of the shift operation, the correspondence between the packing and the LP/ILP solution follow simply by induction. ). 3.3 Algorithm for Dynamic Bin Packing parameter k = ⌊κ⌋ = j size(IL)·ǫ We will use the operations from the previous section to obtain a dynamic algorithm for bin packing with respect to large items. The operations insert and delete are designed to process the input depending of whether an item is to be inserted or removed. Keep in mind that the 2(⌊log(1/ǫ)⌋+5)k changes over time as size(IL) may increase or decrease. In order to fulfill the properties (c) and (d), we need to adapt the number of items per group whenever k changes. The shiftA and shiftB operations are thus designed to manage the dynamic number of items in the groups as k changes. Note that a group in the A-block with parameter k has by definition the same number of items as a group in the B-block with parameter k − 1 assuming they are in the same size category. If k increases, the former A block is treated as the new B block in order to fulfill the properties (c) and (d) while a new empty A block is introduced. To be able to rename the blocks, the B block needs to be empty. Accordingly the A block needs to be empty if k decreases in order to treat the old B block as new A block. 14 Hence we need to make sure that there are no groups in the B-block if k increases and vice versa, that there are no groups in the A-block if k decreases. i i+1 We denote the number of all groups in the A-blocks at time t by A(t) and the number of groups in B-blocks at time t by B(t). To make sure that the B-block (respectively the A-block) A(t)+B(t) needs to correlate to the fractional is empty when k increases (decreases) the ratio digits of κ(t) at time t denoted by ∆(t). Hence we partition the interval [0, 1) into exactly A(t) A(t) A(t)+B(t)(cid:17). We will make sure that ∆(t) ∈ Ji iff A(t) + B(t) smaller intervals Ji = h A(t)+B(t) , A(t)+B(t) ∈ Ji. Note that the term A(t) A(t)+B(t) is 0 if the A-block is empty and the term is 1 if the B-block is empty. This way, we can make sure that as soon as k(t) increases, the number of B-blocks is close to 0 and as soon as k(t) decreases, the number of A-blocks is close to 0. Therefore, the A, B-block can be renamed whenever k(t) changes. The algorithm uses shiftA and shiftB operations to adjust the number of A- and B-blocks. Recall that a shiftA operation reduces the number of groups in the B-block by 1 and increases the number of groups in the A-block by 1 (shiftB works vice versa). Let d be the number of shiftA/shiftB operations that need to be performed to adjust A(t) A(t)+B(t) . J0 J1 . . . Jj . . . k(t − 1) k(t − 1) + 1 ∆(t − 1) k(t − 1) + 2 B(t − 1) 2% . . . . . . . . . k(t) + 1 k k(t − 1) + 2 A(t − 1) 98% (a) Before Insert Jj k J1 J0 k(t) k ∆(t) k(t − 1) + 1 B(t) 99% (b) After Insert k(t) − 1 k(t − 1) k A(t) 1% Figure 7: Comparison of the situation before and after an Insert Operation In the following algorithm we make use of an algorithm called improve, which was developed in [JK13] to reduce the number of used bins. Using improve(x) on a packing B with approx- imation guarantee maxi B(i) ≤ (1 + ¯ǫ) opt +C for some ¯ǫ = O(ǫ) and some additive term C yields a new packing B′ with approximation guarantee maxi B(i) ≤ (1 + ¯ǫ) opt +C − x. We use the operations in combination with the improve algorithm to obtain a fixed approximation guarantee. 15 Algorithm 1 (AFPTAS for large items). Algorithm: Insertion if SIZE(I(t)) < (m + 2)(1/δ + 2) or SIZE(I(t)) < 8(1/δ + 1) then use offline Bin Packing else A(t) improve(2); insert(i); // Shifting to the correct interval Let Ji be the interval containing ∆(t); Let Jj be the interval containing Set d = i − j; if k(t) > k(t − 1) then // Modulo A(t) + B(t) when k increases // Shifting d groups from B to A for p := 0 to d − 1 do Rename(A, B); if i+p = A(t) + B(t) then d = d + (A(t) + B(t)); A(t)+B(t) ; improve(1); shiftA; Algorithm: Deletion if SIZE(I(t)) < (m + 2)(1/δ + 2) or SIZE(I(t)) < 8(1/δ + 1) then use offline Bin Packing else // Departing item i improve(4); delete(i); ReduceComponents; // // Shifting to the correct interval Let Ji be the interval containing ∆(t); Let Jj be the interval containing Set d = i − j; if k(t) < k(t − 1) then // Modulo A(t) + B(t) when k decreases // Shifting d groups from A to B for p := 0 to d − 1 do Rename(A,B); d = d - (A(t)+B(t)); if i-p = 0 then A(t)+B(t) ; A(t) improve(3); shiftB; Note that as exactly d groups are shifted from A to B (or B to A) we have by definition that ∆(t) ∈h A(t) A(t)+B(t) , A(t)+1 A(t)+B(t)(cid:17) at the end of the algorithm. Note that d can be bounded by 11. Lemma 5. At most 11 groups are shifted from A to B (or B to A) in Algorithm 1. ǫ Proof. Since the value size(I(t − 1)) − size(I(t)) changes at most by 1 we can bound κ(t − 1) − κ(t) by log(1/ǫ)+5 to obtain the change in the fractional part. By Lemma 1 the number of intervals (=the number of groups) is bounded by ( 8 ǫ + 2)(log(1/ǫ) + 5). Using A(t−1)+B(t−1) ) and the fact that the number of groups A(t−1)+B(t−1) ∆(t−1) ∈ [ 2(⌊log(1/ǫ)⌋+5) ≤ A(t−1)+B(t−1) , A(t−1)+1 A(t−1) ǫ 16 increases or decreases at most by 1, we can give a bound for the parameter d in both cases by D ǫ d ≤ (cid:18)( interval length 8 ǫ log(1/ǫ) + 5 ) · ( + 1 = D · #intervals + 1 ≤ + 2) · (log(1/ǫ) + 5)(cid:19) + 1 = 8 + 2ǫ + 1 < 11 Hence, the number of shiftA/shiftB operations is bounded by 11. Lemma 6. Every rounding function Rt produced by Algorithm 1 fulfills properties (a) to (d) with parameter k(t) =j size(IL)·ǫ 2(⌊log(1/ǫ)⌋+5)k. Proof. Since Algorithm 1 uses only the operations insert, delete, shiftA and shiftB, the proper- ties (a)to(d) are always fulfilled by Lemma 3 and the LP/ILP solutions x, y correspond to the rounding function by Lemma 4. Furthermore, the algorithm is designed such that whenever k increases the B-block is empty and the A-block is renamed to be the new B-block. Whenever k decreases the A-block is empty and the B-block is renamed to be the new A-block. Therefore the number of items in the groups is dynamically adapted to match with the parameter k. 3.4 Large items In this section we prove that Algorithm 1 is a dynamic robust AFPTAS for the bin packing problem if all items have size at least ǫ/14. The treatment of small items is described in Section 4 and the general case is described in Section 4.2. We will prove that the migration between packings Bt and Bt+1 is bounded by O(1/ǫ3 log(1/ǫ)) and that we can guarantee an asymptotic approximation ratio such that max Bt(i) ≤ (1 + 2∆) opt(I(t), s) + poly(1/∆) for a parameter ∆ = O(ǫ) and for every t ∈ N. The Algorithm improve was developed in [JK13] to improve the objective value of an LP with integral solution y and corresponding fractional solution x. For a vector z ∈ Rn let V (z) be the set of all integral vectors v = (v1, . . . vn)T such that 0 ≤ vi ≤ zi. Let x be an approximate solution of the LP min{kxk1 Ax ≥ b, x ≥ 0} with m inequalities and let kxk1 ≤ (1 + δ) lin and kxk1 ≥ 2α(1/δ + 1), where lin denotes the fractional optimum of the LP and α ∈ N is part of the input of the algorithm (see Jansen and Klein [JK13]). Let y be an approximate integer solution of the LP with kyk1 ≤ lin +2C for some value C ≥ δ lin and with kyk1 ≥ (m + 2)(1/δ + 2). Suppose that both x and y have only ≤ C non-zero components. For every component i we suppose that yi ≥ xi. Furthermore we are given indices a1, . . . , aK , such that the non-zero components yaj are sorted in non-decreasing order, i. e., ya1 ≤ . . . ≤ yaK . Algorithm 2 (improve). 1. Set xvar := 2 α(1/δ+1) kxk x, xf ix := x − xvar and bvar = b − A(xf ix) 2. Compute an approximate solution x of the LP min{kxk1 Ax ≥ bvar, x ≥ 0} with ratio (1 + δ/2) 4. Choose the largest ℓ such that the sum of the smallest components y1, . . . , yℓ is bounded by 3. If (cid:13)(cid:13)(cid:13)xf ix + x(cid:13)(cid:13)(cid:13)1 ≥ kxk1 then set x′ = x, y = y and goto step 9 P1≤i≤ℓ yai ≤ (m + 2)(1/δ + 2) 17 5. For all i set ¯xf ix i =(0 xf ix i if i = aj, j ≤ ℓ else and ¯yi =(0 yi if i = aj, j ≤ ℓ else 6. Set ¯x = x + xℓ where xℓ is a vector consisting of the components xa1, . . . , xaℓ . Reduce the number of non-zero components to at most m + 1. 7. x′ = ¯xf ix + ¯x 8. For all non-zero components i set yi = max{⌈x′ 9. If possible choose d ∈ V (y− x′) such that kdk1 = α(1/δ + 1) otherwise choose d ∈ V (y− x′) i⌉, ¯yi} such that kdk1 < α(1/δ + 1) is maximal. 10. Return y′ = y − d In the following we prove that the algorithm improve applied to the bin packing ILP actually generates a new improved packing B′ from the packing B with corresponding LP and ILP solutions x′ and y′. We therefore use Theorem 2 and Corollary 2 that were proven in [JK13]. Theorem 2. Let x be a solution of the LP with kxk1 ≤ (1 + δ) lin and furthermore kxk1 ≥ 2α(1/δ + 1). Let y be an integral solution of the LP with ky′k1 ≤ lin +2C for some value C ≥ δ lin and with kyk1 ≥ (m + 2)(1/δ + 2). Solutions x and y have the same number of non- zero components and for each component we have xi ≤ yi. The Algorithm improve(α) then returns a fractional solution x′ with kx′k1 ≤ (1+δ) lin −α and an integral solution y′′ where one of the two properties hold: ky′k1 = kyk1 − α or ky′k1 = kx′k1 + C. Both, x′ and y′ have at most C non-zero components and the distance between y′ and y is bounded by ky′ − yk1 = O( m+α ). Corollary 2. Let kxk1 = (1 + δ′) lin for some δ′ ≥ δ and kxk1 ≥ 2α(1/δ + 1) and let kyk1 ≤ lin +2C for some C ≥ δ′ lin and kyk1 ≥ (m + 2)(1/δ + 2). Solutions x and y have the same number of non-zero components and for each component we have xi ≤ yi. Then Algorithm improve(α) returns a fractional solution x′ with kx′k1 ≤ kxk1−α = (1+δ′) lin −α and integral solution y′ where one of the two properties hold: ky′k1 = kyk1−α or ky′k1 = kxk1−α+C. Both, x′ and y′ have at most C non-zero components and the distance between y′ and y is bounded by ky′ − yk1 ∈ O( m+α ). δ δ Let ∆ = ǫ + δ + ǫδ and C = ∆ opt(I, s) + m. Theorem 3. Given a rounding function R and an LP defined for (I, sR), let x be a fractional so- lution of the LP with kxk1 ≤ (1+∆) opt(I, s), kxk1 ≥ 2α(1/δ +1) and kxk1 = (1+δ′) lin(I, sR) for some δ′ > 0. Let y be an integral solution of the LP with kyk1 ≥ (m + 2)(1/δ + 2) and corresponding packing B such that maxi B(i) = kyk1 ≤ (1 + 2∆) opt(I, s) + m. Suppose x and y have the same number ≤ C of non-zero components and for all components i we have yi ≥ xi. Then Algorithm improve(α) on x and y returns a new fractional solution x′ with kx′k1 ≤ (1 + ∆) opt(I, s)− α and also a new integral solution y′ with corresponding packing B′ such that i max B′(i) =(cid:13)(cid:13)y′(cid:13)(cid:13)1 ≤ (1 + 2∆) opt(I, s) + m − α. i ≤ y′ Further, both solutions x′ and y′ have the same number ≤ C of non-zero components and for each component we have x′ i. The number of changed bins from the packing B to the packing B′ is bounded by O( m δ ). 18 Proof. To use Theorem 2 and Corollary 2 we have to prove that certain conditions follow from the requisites of Theorem 3. We have maxi B(i) = kyk1 ≤ (1 + 2∆) opt(I, s) + m by condition. Since opt(I, s) ≤ opt(I, sR) we obtain for the integral solution y that kyk1 ≤ 2∆ opt(I, s) + m + opt(I, sR) ≤ 2∆ opt(I, s) + m + lin(I, sR) + m. Hence by definition of C we get kyk1 ≤ lin(I, sR) + 2C. This is one requirement to use Theorem 2 or Corollary 2. We distinguish the cases where δ′ ≤ δ and δ′ > δ and look at them separately. Case 1: δ′ ≤ δ. For the parameter C we give a lower bound by the inequality C > ∆ opt(I, s) = (δ + ǫ + δǫ) opt(I, s). Lemma 2 shows that opt(I, sR) ≤ (1 + ǫ) opt(I, s) and therefore yields δ + ǫ + δǫ opt(I, sR) = 1 + ǫ = (1 + δ) opt(I, sR) − 1 + ǫ ≥ δ opt(I, sR) ≥ δLIN (I, sR) (1 + δ)(1 + ǫ) − 1 1 1 + ǫ opt(I, sR) opt(I, sR) and hence C > δ lin(I, sR). We can therefore use Theorem 2. m Algorithm improve returns by Theorem 2 a x′ with kx′k1 ≤ (1 + δ) lin(I, sR) − α ≤ (1 + δ) opt(I, sR)− α and an integral solution y′ with ky′k1 ≤ kx′k1 + C or ky′k1 ≤ kyk1 − α. Using that opt(I, sR) ≤ (1 + ǫ) opt(I, s) we can conclude kx′k1 ≤ (1 + δ)(1 + ǫ) opt(I, s) − α = (1 + ∆) opt(I, s) − α. In the case where ky′k1 ≤ kx′k1 + C we can bound the number of bins of the new packing B′ by maxi B′(i) = ky′k1 ≤ kx′k1 + C ≤ (1 + 2∆) opt(I, s) + m− α. In the case that ky′k1 ≤ kyk1 − α we obtain maxi B′(i) = ky′k1 ≤ kyk1 − α ≤ (1 + 2∆) opt(I, s) + m − α. Furthermore we know by Theorem 2 that x′ and y′ have at most C non-zero components. Case 2: δ′ > δ. First we prove that C is bounded from below. Since kxk1 = (1 + δ′) lin(I, sR) ≤ (1+∆) opt(I, s) ≤ (1+∆) opt(I, sR) ≤ (1+∆) opt(I, sR) ≤ (1+∆)(lin(I, sR)+ 2 ) ≤ lin(I, sR) + C we obtain that C ≥ δ′ lin(I, sR), which is a requirement to use Corol- lary 2. By using Algorithm improve on solutions x with kxk1 = (1 + δ′) lin(I, sR) and y with kyk1 ≤ lin(I, sR) + 2C we obtain by Corollary 2 a fractional solution x′ with kx′k1 ≤ kxk1 − α ≤ (1 + ∆) opt(I, s) − α and an integral solution y′ with either ky′k1 ≤ kyk1 − α or ky′k1 ≤ kxk1 + C − α. So for the new packing B′ we can guarantee that maxi B′(i) = ky′k1 ≤ kyk1 − α = maxi B(i) − α ≤ (1 + 2∆) opt(I, s) + m − α if ky′k1 ≤ kyk1 − α. In the case that ky′k1 ≤ kxk1 + C − α, we can guarantee that maxi B′(i) = ky′k1 ≤ kxk1 + C − α ≤ (1 + ∆) opt(I, s) + C − α ≤ (1 + 2∆) opt(I, s) + m − α. Furthermore we know by Corollary 2 that x′ and y′ have at most C non-zero components. Theorem 2 as well as Corollary 2 state that the distance ky′ − yk1 is bounded by O(m/δ). Since y corresponds directly to the packing B and the new integral solution y′ corresponds to the new packing B′, we know that only O(m/δ) bins of B need to be changed to obtain packing B′. In order to prove correctness of Algorithm 1, we will make use of the auxiliary Algorithm 3 (ReduceComponents). Due to a delete-operation, the value of the optimal solution opt(I, s) might decrease. Since the number of non-zero components has to be bounded by C = ∆ opt(I, s)+ m, the number of non-zero components might have to be adjusted down. The following algo- rithm describes how a fractional solution x′ and an integral solution y′ with reduced number of non-zero components can be computed such that ky − y′k1 is bounded. The idea behind the algorithm is also used in the Improve algorithm. The smallest m+2 components are reduced to m+1 components using a standard technique presented for example in [BM98]. Arbitrary many components of x′ can thus be reduced to m + 1 components without making the approximation guarantee worse. 19 i =  ⌈xi + x′ i⌉ 0 yi xi + xi 0 xi if i = bj for some j ≤ m if i = aj for some j ≤ m + 1 else if i = bj for some j ≤ m if i = aj for some j ≤ m + 1 else 4. For all i set x′ and yi =  Algorithm 3 (ReduceComponents). 1. Choose the smallest non-zero components ya1, . . . , yam+2. 2. If P1≤i≤m+2 yai ≥ (1/∆ + 2)(m + 2) then return x = x′ and y = y′ 3. Reduce the components xa1, . . . , xam+2 to m+1 components xb1, . . . , xbm+1 withPm+2 Pm+1 j=1 xbj . j=1 xaj = 5. If possible choose d ∈ V (y − x′) such that kdk1 = m + 1 otherwise choose d ∈ V (y − x′) such that kdk1 < m + 1 is maximal. 6. Return y′ = y − d The following theorem shows that the algorithm above yields a new fractional solution x′ and a new integral solution y′ with a reduced number of non-zero components. i ≤ y′ Theorem 4. Let x be a fractional solution of the LP with kxk1 ≤ (1 + ∆) opt(I, s). Let y be an integral solution of the LP with kyk1 ≤ (1 + 2∆) opt(I, s) + m. Suppose x and y have the same number ≤ C + 1 of non-zero components and for all components i we have yi ≥ xi. Using the Algorithm ReduceComponents on x and y returns a new fractional solution x′ with kx′k1 ≤ (1 + ∆) opt(I, s) and a new integral solution y′ with ky′k1 ≤ (1 + 2∆) opt(I, s) + m. Further, both solutions x′ and y′ have the same number of non-zero components and for each component we have x′ i. The number of non-zero components can now be bounded by ≤ C. Furthermore, we have that ky − y′k1 ≤ 2 · (1/∆ + 3)(m + 2). Proof. Case 1: P1≤i≤m+2 yai ≥ (1/∆ + 2)(m + 2). We will show that in this case, x and y already have ≤ C non-zero components. In this case the algorithm returns x′ = x and y′ = y. SinceP1≤i≤m+2 yai ≥ (1/∆+2)(m+2) the components ya1, . . . , yam+2 have an average size of at least (1/∆ + 2) and since ya1, . . . , yam+2 are the smallest components, all components of y have average size at least (1/∆ + 2). The size kyk1 is bounded by (1 + 2∆) opt(I, s) + m. Hence the number of non-zero components can be bounded by (1+2∆) opt(I,s)+m ≤ ∆ opt(I, s) + ∆m ≤ C. Case 2: P1≤i≤m+1 yai < (1/∆ + 2)(m + 2). We have to prove different properties for the new fractional solution x′ and the new integral solution y′. Number of non-zero components: The only change in the number of non-zero components is in step 3 of the algorithm, where the number of non-zero components is reduced by 1. As x, y have at most C + 1 non-zero components, x′, y′ have at most C non-zero components. In step 4 of the algorithm, y is defined such that yi ≥ x′ i. In step 5 of the algorithm d is chosen such that yi − d ≥ x′ Distance between y and y′: The only steps where components of y changes are in step 4 and 5. The distance between y and y is bounded by the sum of the components that are set j=1 ⌈xbj⌉ ≤ j=1 yaj < (1/∆ + 2)(m + 2), we j=1 yaj and the sum of the increase of the increased components Pm+1 i. Hence we obtain that y′ i = yi − d ≥ x′ i. 1/∆+2 to 0, i. e., Pm+2 Pm+1 j=1 xbj + m + 1 = Pm+2 j=1 xaj + m + 1. As Pm+2 j=1 xaj ≤ Pm+2 20 i − x′ ǫ3 · log(1/ǫ)) for the obtain that the distance between y and y is bounded by 2· (1/∆ + 2)(m + 2) + m + 1. Using that kdk1 ≤ m + 1, the distance between y and y′ is bounded by ky′ − yk1 < 2 · (1/∆ + 3)(m + 2). Approximation guarantee: The fractional solution x is modified by condition of step 3 such that the sum of the components does not change. Hence kx′k1 = kxk1 ≤ (1 + ∆) opt(I, s). Case 2a: kdk1 < m + 1. Since d is chosen maximally we have for every non-zero component that y′ i < 1. Since there are at most C = ∆ opt(I, s) + m non-zero components we obtain that ky′k1 ≤ kx′k1 + C ≤ (1 + 2∆) opt(I, s) + m. Case 2b: kdk1 = m + 1. By definition of y we have kyk1 ≤ kyk1 +Pm+1 j=1 xaj ≤ kyk1 + m + 1. We obtain for y′ that ky′k1 = kyk1 − kdk1 ≤ kyk1 + m + 1 − (m + 1) = kyk1 ≤ (1 + 2∆) opt(I, s) + m. Theorem 5. Algorithm 1 is an AFPTAS with migration factor at most O( 1 fully dynamic bin packing problem with respect to large items. Proof. Set δ = ǫ. Then ∆ = 2ǫ + ǫ2 = O(ǫ). We assume in the following that ∆ ≤ 1 (which holds for ǫ ≤ √2 − 1). We prove by induction that four properties hold for any packing Bt and the corresponding LP solutions. Let x be a fractional solution of the LP defined by the instance (It, sRt) and y be an integral solution of this LP. The properties (2) to (4) are necessary to apply Theorem 3 and property (1) provides the wished approximation ratio for the bin packing problem. j=1 ⌈ xbj + xbj⌉ −Pm+2 (1) maxi Bt(i) = kyk1 ≤ (1 + 2∆) opt(I(t), s) + m (the number of bins is bounded) (2) kxk1 ≤ (1 + ∆) opt(I(t), s) (3) for every configuration i we have xi ≤ yi (4) x and y have the same number of non-zero components and that number is bounded by ∆ opt(I(t), s) + m To apply Theorem 3 we furthermore need a guaranteed minimal size for kxk1 and kyk1. Accord- ing to Theorem 3 the integral solution y needs kyk1 ≥ (m+2)(1/δ+2) and kxk1 ≥ 8(1/δ+1) as we set α ≤ 4. By condition of the while-loop the call of improve is made iff SIZE(It, s) ≥ 8(1/δ+1) and SIZE(It, s) ≥ (m + 2)(1/δ + 2). Since kyk1 ≥ kxk1 ≥ SIZE(It, s) the requirements for the minimum size are fulfilled. As long as the instance is smaller than 8(1/δ + 1) or (m + 2)(1/δ + 2) an offline algorithm for bin packing is used. Note that there is an offline algorithm which fulfills properties (1) to (4) as shown by Jansen and Klein [JK13]. Now let Bt be a packing with SIZE(It, s) ≥ 8(1/δ + 1) and SIZE(It, s) ≥ (m + 2)(1/δ + 2) for instance It with solutions x and y of the LP defined by (I(t), sRt ). Suppose by induction that the properties (1) to (4) hold for the instance It. We have to prove that these properties also hold for the instance I(t + 1) and the corresponding solutions x′′ and y′′. The packing Bt+1 is created by the repeated use of an call of improve for x and y followed by an operation (insert, delete, shiftA or shiftB). We will prove that the properties (1) to (4) hold after a call of improve followed by an operation. improve: Let x′ be the resulting fractional solution of Theorem 3, let y′ be the resulting integral solution of Theorem 3 and let B′ t be the corresponding packing. Properties (1) to (4) are fulfilled for x, y and Bt by induction hypothesis. Hence all conditions are fulfilled to use Theorem 3. By Theorem 3 the properties (1) to (4) are still fulfilled for x′, y′ and B′ t and moreover we get kx′k1 ≤ (1 + ∆) opt(I(t), s) − α and ky′k1 = maxi B′ t(i) ≤ (1 + 2∆) opt(I(t), s) + m − α for chosen parameter α. Let x′′ and y′′ be the fractional and integral solution after an operation is applied to x′ and y′. We have to prove that the properties (1) to (4) are also fulfilled for x′′ and y′′. 21 operations: First we take a look at how the operations modify kx′k1 and ky′k1 = maxi B′ t(i). By construction of the insertion operation, kx′k1 and ky′k are increased at most by 2. By construction of the delete operation, kx′k1 and ky′k1 are increased by 1. By construction of the shiftA and shiftB operation, kx′k1 and ky′k1 are increased by 1. An improve(2) call followed by an insertion operation therefore yields ky′′k = ky′k1 + 2 = (1 + 2∆) opt(I(t), s) + m− 2 + 2 = (1 + 2∆) opt(I(t + 1), s) + m since opt(I(t), s) ≤ opt(I(t + 1), s). An improve(4) call followed by a delete operation yields ky′′k = ky′k1 +1 = (1+2∆) opt(I(t), s)+m−3 ≤ (1+2∆) opt(I(t+ 1), s)+(1+2∆)+m−3 ≤ (1+2∆) opt(I(t+1), s) since opt(I(t), s) ≤ opt(I(t+1), s)+1 (an item is removed) and ∆ ≤ 1. In the same way we obtain that ky′′k1 ≤ ky′k1 + 1 ≤ (1 + 2∆) opt(I(t + 1), s) + m for an improve(1)/improve(3) call followed by a shiftA/shiftB operation. This concludes the proof that property (1) is fulfilled for I(t + 1). The proof that property (2) holds is analog since kx′k1 increases in the same way as ky′k1 and kx′k1 ≤ (1 + ∆) opt(I(t), s) − α. For property (3) note that in the operations a configuration xi of the fractional solution is increased by 1 if and only if a configuration yi is increased by 1. Therefore the property that i retains from x′ and y′. By Theorem 3 the number of non-zero for all configurations x′′ components of x′ and y′ is bounded by ∆ opt(I(t), s) + m ≤ ∆ opt(I(t + 1), s) + m in case of an insert operation. If an item is removed, the number of non-zero components of x′ and y′ is bounded by ∆ opt(I(t), s)+m ≤ ∆ opt(I(t+1), s)+m+1 = C +1. By Theorem 4 the algorithm ReduceComponents guarantees that there are at most C = ∆ opt(I(t + 1), s) + m non-zero components. By construction of the shift-operation, x′′ and y′′ might have two additional non- zero components. But since these are being reduced by Algorithm 1 (note that we increased the number of components being reduced in step 6 by 2 to- see [JK13] for details), the LP solutions x′′ and y′′ have at most ∆ opt(I(t + 1), s) + m non-zero components which proves property (4). Algorithm 1 therefore has an asymptotic approximation ratio of 1 + ǫ. i ≤ y′′ ǫ3 log(1/ǫ)). We still need to examine the migration factor of Algorithm 1. In the case that the offline algorithm is used, the size of the instance is smaller than 8(1/δ + 1) = O(1/ǫ) or smaller than (m + 2)(1/δ + 2) = O( 1 ǫ2 log(1/ǫ)). Hence the migration factor in that case is bounded by O( 1 If the instance is bigger the call of improve repacks at most O(m/ǫ) bins by Theorem 3. Since every large arriving item has size > ǫ/14 and m = O( 1 ǫ log(1/ǫ)) we obtain a migration factor of O( 1 ǫ3 log(1/ǫ)) for the Algorithm improve. Since the migration factor of each operation is also bounded by O( 1 ǫ2 log(1/ǫ)), we obtain an overall migration factor of O( 1 ǫ3 log(1/ǫ)). The main complexity of Algorithm 1 lies in the use of Algorithm improve. As described by Jansen and Klein [JK13] the running time of improve is bounded by O(M (1/ǫ log(1/ǫ)) · 1/ǫ3 log(1/ǫ)), where M (n) is the time needed to solve a system of n linear equations. By using heap structures to store the items, each operation can be performed in time O(1/ǫ log(1/ǫ) · log(ǫ2 · n(t))) at time t, where n(t) denotes the number of items in the instance at time t. As the number of non-zero components is bounded by O(ǫ · n(t)), the total running time of the algorithm is bounded by O(M (1/ǫ log(1/ǫ)) · 1/ǫ3 log(1/ǫ) + 1/ǫ log(1/ǫ) log(ǫ2 · n(t)) + ǫn(t)). The best known running time for the dynamic bin packing problem without removals was O(M (1/ǫ2) · 1/ǫ4 + ǫn(t) + 1 ǫ2 log(ǫ2n(t))) and is due to Jansen and Klein [JK13]. As this is polynomial in n(t) and in 1/ǫ we can conclude that Algorithm 1 is an AFPTAS. If no deletions are present, we can use a simple FirstFit algorithm (as described by Jansen and Klein [JK13]) to pack the small items into the bins. This does not change the migration factor or the running time of the algorithm and we obtain a robust AFPTAS with O( 1 ǫ3 ·log(1/ǫ)) migration for the case that no items is removed. This improves the best known migration factor of O( 1 ǫ4 ) [JK13]. 22 4 Handling Small Items In this section we present methods for dealing with arbitrary small items in a dynamic online setting. First, we present a robust AFPTAS with migration factor of O(1/ǫ) for the case that only small items arrive and depart. In Section 4.3 we generalize these techniques to a setting where small items arrive into a packing where large items are already packed and can not be rearranged. Finally we state the AFPTAS for the general fully dynamic bin packing problem. In a robust setting without departing items, small items can easily be treated by packing them greedily via the classical FirstFit algorithm of Johnson et al. [JDU+74b] (see Epstein and Levin [EL09] or Jansen and Klein [JK13]). However, in a setting where items may also depart, small items need to be treated much more carefully. We show that the FirstFit algorithm does not work in this dynamic setting. Lemma 7. Using the FirstFit algorithm to pack small items may lead to an arbitrarily bad approximation. Proof. Suppose, that there is an algorithm A with migration factor c which uses FirstFit on items with size < ǫ/14. We will now construct an instance where A yields an arbitrary bad approximation ratio. Let b = ǫ/14 − δ and a = ǫ/14c − ((δ+cδ)/c) for a small δ such that (1−b)/a is integral. Note that ac < b by definition. Furthermore, let M ∈ N be an arbitrary integer and consider the instance with IM = [A, A, . . . , A , B, B, . . . , B ] M {z } M {z } A = (b, Insert), (a, Insert), (a, Insert), . . . , (a, Insert) B = (a, Delete), (a, Delete), . . . , (a, Delete) (1−b)/a {z } . (1−b)/a {z } After the insertion of all items, there are M bins containing an item of size b and 1−b/a items of size a (see Figure 8a). As ac < b, the deletion of the items of size a can not move the items of size b. The remaining M bins thus only contain a single item of size b (see Figure 8b), while ⌈M · b⌉ bins would be sufficient to pack all of the remaining items. The approximation ratio is thus at least M/M ·b = 1/b ≈ 1 ǫ and thus grows as ǫ shrinks. In order to avoid this problem, we design an algorithm which groups items of similar size together. Using such a mechanism would therefore put the second item of size b into the first bin by shifting out an appropriate number of items of size a and so on. Our algorithms achieves this grouping of small items by enumerating the bins and maintaining the property, that larger small items are always left of smaller small items. 4.1 Only Small Items We consider a setting where only small items exist, i. e., items with a size less than ǫ/14. First, we divide the set of small items into different size intervals Sj where Sj =h ǫ Let b1, . . . , bm be the used bins of our packing. We say a size category Sj is bigger than a size category Sk if j < k, i. e., the item sizes contained in Sj are larger (note that a size category 2j(cid:17) for j ≥ 1. 2j+1 , ǫ 23 a b b (a) A single bin after the insertion (b) A single bin after the deletion Figure 8: Construction in the proof of Lemma 7 Sj with large index j is called small). We say a bin bi is filled completely if it has less than ǫ 2j remaining space, where Sj is the biggest size category appearing in bi. Furthermore we label bins bi as normal or as buffer bins and partition all bins b1, . . . , bm into queues Q1, . . . , Qd for Q ≤ m. A queue is a subsequence of bins bi, bi+1 . . . , bi+c where bins bi, . . . , bi+c−1 are normal bins and bin bi+c is a buffer bin. We denote the i-th queue by Qi and the number of bins in Qi by Qi. The buffer bin of queue Qi is denoted by bbi. erties are always fulfilled. For the sake of simplicity, we assume that 1/ǫ is integral. (1) For every item i ∈ bd with size s(i) ∈ Sj for some j, d ∈ N, there is no item i′ ∈ bd′ with size s(i′) ∈ Sj ′ such that d′ > d and j′ > j. This means: Items are ordered from left to right by their size intervals. We will maintain a special form for the packing of small items such that the following prop- (2) Every normal bin is filled completely. (3) The length of each queue is at least 1/ǫ and at most 2/ǫ except for the last queue Qd. Note that property (1) implies that all items in the same size interval Sj are packed into bins bx, bx+1, . . . , bx+c for constants x and c. Items in the next smaller size category Sj+1 are then packed into bins bx+c, bx+c+1, . . . and so on. We denote by bS(ℓ) the last bin in which an item of size interval Sℓ appears. We denote by S>ℓ the set of smaller size categories Sℓ′ with ℓ′ > ℓ. Note that items in size category S>ℓ are smaller than items in size category Sℓ. . . . . . . . . . . . . b1 Q1 bQ1−1 bb1 bQ1+1 Q2 bQ2−1 bb2 bQd−1+1 Qd bQd−1 bbd Figure 9: Distribution of bins with small items into queues The following lemma guarantees that a packing that fulfills properties (1) to (3) is close to the optimum solution. Lemma 8. If properties (1) to (3) hold, then at most (1 + O(ǫ)) opt(I, s) + 2 bins are used in the packing for every ǫ ≤ 1/3. Proof. Let C be the number of used bins in our packing. By property (2) we know that all normal bins have less than ǫ/14 free space. Property (3) implies that there are at most ǫ · C + 1 buffer bins and hence possibly empty. The number of normal bins is thus at least (1− ǫ)· C − 1. Therefore we can bound the total size of all items by ≥ (1 − ǫ/14) · ((1 − ǫ) · C − 1). As opt(I, s) ≥ SIZE(I, s) ≥ (1− ǫ/14)· ((1 − ǫ)· C − 1) and (1−ǫ/14)(1−ǫ) ≤ 1 + 2ǫ for ǫ ≤ 1/3 we get C ≤ (1 + 2ǫ) opt(I, s) + 2. 1 24 We will now describe the operations that are applied whenever a small item has to be inserted or removed from the packing. The operations are designed such that properties (1) to (3) are never violated and hence a good approximation ratio can be guaranteed by Lemma 8 at every step of the algorithm. The operations are applied recursively such that some items from each size interval are shifted from left to right (insert) or right to left (delete). The recursion halts if the first buffer bin is reached. Therefore, the free space in the buffer bins will change over time. Since the recursion always halts at the buffer bin, the algorithm is applied on a single queue Qk. The following Insert/Delete operation is defined for a whole set J = {i1, . . . , in} of items. If an item i of size interval Sℓ has to be inserted or deleted, the algorithm is called with Insert({i}, bS(ℓ), Qk) respectively Delete({i}, bx, Qk), where bx is the bin containing item i and 2j(cid:17) is a fixed interval for Qk is the queue containing bin bS(ℓ) or bx. Recall that Sj = h ǫ every j ≥ 1 and S≤j =Sj • Insert(J, bx, Qk): i=1 Si and S>j =Si>j Si. Algorithm 4 (Insert or Delete for only small items). 2j+1 , ǫ – Insert the set of small items J = {i1, . . . , in} with size s(ij) ∈ S≤ℓ into bin bx. (By Lemma 9 the total size of J is bounded by O(1/ǫ) times the size of the item which triggered the first Insert operation.) – Remove just as many items J ′ = {i′ m} of the smaller size interval S>ℓ appear- ing in bin bx (starting by the smallest) such that the items i1, . . . , in fit into the bin bx. If there are not enough items of smaller size categories to insert all items from I, insert the remaining items from I into bin bx+1. 1, . . . , i′ – Let J ′ ℓ′ ⊆ J ′ be the items in the respective size interval Sℓ′ with ℓ′ > ℓ. Put the items ℓ′ , bS(ℓ′), Qk) for each ℓ′ > ℓ). If the ℓ′ recursively into bin bS(ℓ′) (i. e., call Insert(J ′ J ′ buffer bin bbk is left of bS(ℓ′) call Insert(J ′ ℓ′ , bbk, Qk) instead. • Delete(J, bx, Qk): – Insert as many small items J ′ = {i′ – Remove the set of items J = {i1, . . . , in} with size s(ij) ∈ S≤ℓ from bin bx (By Lemma 9 the total size of J is bounded by O(1/ǫ) times the size of the item which triggered the first Delete operation.) m} from bS(ℓ′), where Sℓ′ is the smallest size interval appearing in bx such that bx is filled completely. If there are not enough items from the size category Sℓ′, choose items from size category S≥ℓ′+1 in bin bx+1. ℓ′ ⊆ J ′ be the items in the respective size interval Sℓ′ with ℓ′ > ℓ. Remove items ℓ′, bS(ℓ′), Qk) for each ℓ′ > ℓ). If the ℓ′ from bin bS(ℓ′) recursively (i. e., call Delete(J ′ J ′ buffer bin bbk is left of bS(ℓ′), call Delete(J ′ ℓ′, bbk, Qk) instead. 1, . . . , i′ – Let J ′ Using the above operations maintains the property of normal bins to be filled completely. However, the size of items in buffer bins changes. In the following we describe how to handle buffer bins that are being emptied or filled completely. Algorithm 5 (Handle filled or emptied buffer bins). • Case 1: The buffer bin of Qi is filled completely by an insert operation. – Label the filled bin as a normal bin and add a new empty buffer bin to the end of Qi. – If Qi > 2/ǫ, split Qi into two new queues Q′ i + 1. The buffer i is the newly added buffer bin. Add an empty bin labeled as the buffer bin i with Q′′ i = Q′ i, Q′′ bin of Q′′ to Q′ i such that Q′ i = Q′′ i . – Remove the now empty bin. • Case 2: The buffer bin of Qi is being emptied due to a delete operation. 25 bin of Qi. – If Qi ≥ Qi+1 and Qi > 1/ǫ, choose the last bin of Qi and label it as new buffer – If Qi+1 > Qi and Qi+1 > 1/ǫ, choose the first bin of Qi+1 and move the bin to Qi – If Qi+1 = Qi = 1/ǫ, merge the two queues Qi and Qi+1. As Qi+1 already contains a buffer bin, there is no need to label another bin as buffer bin for the merged queue. and label it as buffer bin. Creating and deleting buffer bins this way guarantees that property (3) is never violated since queues never exceed the length of 2/ǫ and never fall below 1/ǫ. i S0 S1 S2 bx S2 S3 S2 bx+1 bx+2 . . . Sj Sj+1 bbk S0 i S1 S2 bx S2 S3 S2 bx+1 bx+2 . . . Sj Sj+1 bbk (a) Insert({i},bx,Qk) with s(i) ∈ S1 (b) Delete({i},bx,Qk) with s(i) ∈ S1 Figure 10: Example calls of Insert and Delete. Figure 10a shows an example call of Insert({i},bx,Qk). Item i with s(i) ∈ S1 is put into the corresponding bin bx into the size interval S1. As bx now contains too many items, some items from the smallest size interval S2 (marked by the dashed lines) are put into the last bin bx+2 containing items from S2. Those items in turn push items from the smallest size interval S3 into the last bin containing items of this size and so on. This process terminates if either no items need to be shifted to the next bin or the buffer bin bbk is reached. It remains to prove that the migration of the operations is bounded and that the properties are invariant under those operations. Lemma 9. (i) Let I be an instance that fulfills properties (1) to (3). Applying operations insert/delete on I yields an instance I ′ that also fulfills properties (1) to (3). (ii) The migration factor of a single insert/delete operation is bounded by O(1/ǫ) for all ǫ ≤ 2/7. Proof. Proof for (i): Suppose the insert/delete operation is applied to a packing which fulfills properties (1) to (3). By construction of the insert operation, items from a size category Sℓ in bin bx are shifted to a bin by. The bin by is either bS(ℓ) or the a buffer bin left of bS(ℓ). By definition by contains items of size category Sℓ. Therefore property (1) is not violated. Symmetrically, by construction of the delete operation, items from a size category Sℓ in bin bS(ℓ) are shifted to a bin bx. By definition bx contains items of size category Sℓ and property (1) is therefore not violated. For property (2): Let bx be a normal bin, where items i1, . . . , in of size category S≤ℓ are inserted. We have to prove that the free space in bx remains smaller than ǫ/2j, where Sj is the smallest size category appearing in bin bx. By construction of the insert operation, just as many items of size categories S>ℓ are shifted out of bin bx such that i1, . . . , in fit into bx. Hence the remaining free space is less than ǫ 2ℓ and bin bx is filled completely. The same argumentation holds for the delete operation. Property (3) is always fulfilled by definition of Algorithm 5. Proof for (ii): According to the insert operation, in every recursion step of the algorithm, it tries to insert a set of items into a bin bx′, starting with an Insert({i}, bx′ , Qk) operation. Let insert(S≤ℓ+y, bx) (x ≥ x′) be the size of all items in size categories Sj with j ≤ ℓ + y that the algorithm tries to insert into bx as a result of an Insert({i}, bx′ , Qk) call. Let pack(bx) be 26 the size of items that are actually packed into bin bx. We have to distinguish between two cases. In the case that insert(S≤ℓ+y, bx) = pack(bx) there are enough items of smaller size categories S>ℓ+y that can be shifted out, such that items I fit into bin bx. In the case that insert(S≤ℓ+y, bx) > pack(bx) there are not enough items of smaller size category that can be shifted out and the remaining size of insert(S≤ℓ+y, bx) − pack(bx) has to be shifted to the following bin bx+1. Under the assumption that each insert(S≤ℓ, bx) ≤ 1 for all x and ℓ (which is shown in the following) all items fit into bx+1. Note that no items from bins left of bx can be shifted into bx+1 since bx = bS(ℓ+y) is the last bin where items of size category S≤ℓ+y appear. Hence all items shifted out from bins left of bx are of size categories S≤ℓ+y (property (1)) and they are inserted into bins left of bx+1. We prove by induction that for each insert(S≤ℓ+y, bx) the total size of moved items is at most insert(S≤ℓ+y, bx) ≤ s(i) + 3 y Xj=1 ǫ 2ℓ+j The claim holds obviously for insert(S≤ℓ, bx′) since bx′ = bS(ℓ) is the bin where only item i is inserted. Insert [S1, S2] S1 S2 bx S2 S3 bx+1 (a) Case 1 Insert [S1] S1 S2 bx S2 S3 bx+1 . . . (b) Case 2a Insert [S1, S2] S1 S2 bx S2 bx+1 (c) Case 2b S2 S3 bx+1 . . . Figure 11: All cases to consider in Lemma 9 Case 1: insert(S≤ℓ+y, bx) > pack(bx) In this case, the size of all items that have to be inserted into bx+1 can be bounded by the size of items that did not fit into bin bx plus the size of items that were removed from bin bx. We can bound insert(S≤ℓ+¯y, bx+1) where ¯y > y is the largest index Sℓ+¯y appearing in bin bx by insert(S≤ℓ+y, bx) + ǫ 2ℓ+y ≤ s(i) + 3 y Xj=1 ǫ 2ℓ+j + 2 ǫ 2ℓ+y+1 < s(i) + 3 y+1 Xj=1 ǫ 2ℓ+j Case 2: insert(S≤ℓ+y, bx) = pack(bx) Suppose that the algorithm tries to insert a set of items I of size categories S≤ℓ+¯y into the bin bx+1 = bS(ℓ+¯y). The items I can only be shifted from previous bins where items of size category S≤ℓ+¯y appear. There are only two possibilities remaining. Either all items I are shifted from a single bin bx (x ≤ x) or from two consecutive bins bx, bx+1 with insert(S≤ℓ+y, bx) > pack(bx). Note that bx+1 can only receive items from more than one bin if there are two bins bx, bx+1 with insert(S≤ℓ+y, bx) > pack(bx) such that bx+1 = bS(ℓ+¯y) and all items shifted out of bx, bx+1 and into bx+1 are of size category Sℓ+¯y. Hence bins left of bx or right of bx+1 can not shift items into bx+1. Case 2a: All items I are shifted from a single bin bx with x ≤ x (note that x < x is possible since pack(bx) = insert(S≤ℓ+y, bx) can be zero). The total size of items that are shifted out of bx can be bounded by insert(S≤ℓ+y, bx) + ǫ 2ℓ+y . By induction hypothesis insert(S≤ℓ+y, bx) ǫ 2ℓ+j . Since all items that are inserted into bx+1 come from bx, 2ℓ+y ≤ s(i) + the value insert(S≤ℓ+¯y, bx+1) (¯y > y) can be bounded by insert(S≤ℓ+y, bx) + ǫ is bounded by s(i) + 3Py j=1 27 ǫ j=1 j=1 2ℓ+j + ǫ 2ℓ+y < s(i) + 3P¯y ǫ 2ℓ+j where Sℓ+¯y is the smallest size category inserted into bx+1. Note that the items I belong to only one size category Sℓ+¯y if x < x since all items that are in size intervals S<ℓ+¯y are inserted into bin bx+1. 3Py Case 2b: Items I are shifted from bins bx and bx+1 (x + 1 ≤ x) with insert(S≤ℓ+y, bx) > pack(bx). In this case, all items I belong to the size category Sℓ+¯y since bx is left of bx. Hence all items which are inserted into bx+1 are from I, i. e., insert(S≤ℓ+y, bx) = pack(bx) + pack(bx+1) as all items in I belong to the same size category Sℓ+¯y. We can bound insert(Sℓ+¯y, bx+1) by the size of items that are shifted out of bx plus the size of items that are shifted out of bx+1. We obtain ǫ 2ℓ+y + pack(bx+1) + ǫ 2ℓ+¯y insert(S≤ℓ+¯y, bx+1) ≤ pack(bx) + ǫ = insert(S≤ℓ+y, bx)) + ǫ 2ℓ+y + 2ℓ+¯y ǫ ǫ 2ℓ+j + ǫ 2ℓ+y + 2ℓ+¯y ≤ s(i) + 3 ≤ s(i) + 3 y Xj=1 Xj=1 y ǫ 2ℓ+j + 3 ǫ 2ℓ+¯y ≤ s(i) + 3 ¯y Xj=1 ǫ 2ℓ+j This yields that insert(S≤ℓ+y, bx) is bounded by s(i)+ 3P¯y we can bound the migration factor for every bin bx of Qk for any y ∈ N by pack(bx) + ǫ insert(S≤ℓ+y, bx) + ǫ ǫ 2ℓ+j for all bins bx in Qk. Now, 2ℓ+y ≤ 2ℓ+y . Using the above claim, we get: j=1 insert(S≤ℓ+y, bx) + < s(i) + 3 ∞ Xj=1 ǫ 2ℓ+y ≤ s(i) + 3 Xj=1 ǫ 2ℓ ∞ ǫ 2ℓ+j = s(i) + 3 y ǫ 2ℓ+j + 2 Xj=1 1 2j = s(i) + 3 · ǫ 2ℓ+y+1 ǫ 2ℓ ≤ 7s(i) Since there are at most 2/ǫ bins per queue, we can bound the total migration of Insert({i}, bS(ℓ), Qk) by 7· 2/ǫ ∈ O(1/ǫ). Note also that s(i) ≤ ǫ/14 for every i implies that insert(S≤ℓ, bx) is bounded by ǫ/2 for all x and ℓ . Suppose that items i1, . . . , in of size interval Sℓ+y have to be removed from bin bx. In order to fill the emerging free space, items from the same size category are moved out of bS(ℓ) into the free space. As the bin bx may already have additional free space, we need to move at most a size of size(i1, . . . , in) + ǫ/2ℓ+y. Using a symmetric proof as above yields a migration factor of O( 1 ǫ ). 4.2 Handling small items in the general setting In the scenario that there are mixed item types (small and large items), we need to be more careful in the creation and the deletion of buffer bins. To maintain the approximation guarantee, we have to make sure that as long as there are bins containing only small items, the remaining free space of all bins can be bounded. Packing small items into empty bins and leaving bins with large items untouched does not lead to a good approximation guarantee as the free space of the bins containing only large items is not used. In this section we consider the case where a sequence of small items is inserted or deleted. We assume that the packing of large items does not change. Therefore the number of bins containing large items equals a fixed constant Λ(B). In the previous section, the bins b1, . . . , bm(B) all had a capacity of 1. In order to handle a mixed 28 setting, we will treat a bin bi containing large items as having capacity of c(bi) = 1 − S, where S is the total size of the large items in bi. The bins containing small items are enumerated by b1, . . . , bL(B), bL(B)+1, . . . , bm(B) for some L(B) ≤ m(B) where c(b1), . . . , c(bL(B)) < 1 and c(bL(B)+1) = . . . = c(bm(B)) = 1. Additionally we have a separate set of bins, called the heap bins, which contain only large items. This set of bins is enumerated by h1, . . . hh(B). Note that L(B) + h(B) = Λ(B). In general we may consider only bins bi and hi with capacity c(bi) ≥ ǫ/14 and c(hi) ≥ ǫ/14 since bins with less capacity are already packed well enough for our approximation guarantee as shown by Lemma 9. Therefore, full bins are not considered in the following. Only large items Large and small items Only small items . . . . . . . . . . . . . . . . . . . . . h1 h2 hh b1 Q1 bb1 b bbℓ = bL bL+1 Qℓ Qℓ+1 bbℓ+1 b bbd = bm Qd heap bins Figure 12: Distribution of bins As before, we partition the bins b1, . . . , bL(B), bL(B)+1, . . . , bm(B) into several different queues Q1, . . . , Qℓ(B), Qℓ(B)+1, . . . , Qd(B) such that b1, . . . bL(B) = Q1, . . . Qℓ(B) and bL(B)+1, . . . bm(B) = Qℓ(B)+1, . . . , Qd(B). If the corresponding packing B is clear from the context, we will simply write h, L, ℓ, d, m, Λ instead of h(B), L(B), ℓ(B), d(B), m(B), Λ(B). We denote the last bin of queue Qi by bbi which is a buffer bin. The buffer bin bbℓ is special and will be treated differently in the insert and delete operation. Note that the bins containing large items b1, . . . , bL(B) are enumerated first. This guarantees that the free space in the bins containing large items is used before new empty bins are opened to pack the small items. However, enumerating bins containing large items first, leads to a problem if according to Algorithm 5 when a buffer bin is being filled and a new bin has to be inserted right to the filled bin. Instead of inserting a new empty bin, we insert a heap bin at this position. Since the heap bin contains only large items, we do not violate the order of the small items (see Figure 12). As the inserted heap bin has remaining free space (is not filled completely) for small items, it can be used as a buffer bin. In order to get an idea of how many heap bins we have to reserve for Algorithm 5 where new bins are inserted or deleted, we define a potential function. As a buffer bin is being filled or emptied completely the Algorithm 5 is executed and inserts or deletes buffer bins. The potential function Φ(B) thus bounds the number of buffer bins in Q1, . . . , Qℓ(B) that are about to get filled or emptied. The potential Φ(B) is defined by Φ(B) = ri + ⌈ǫΛ⌉ − ℓ where the fill ratio ri is defined by ri = s(bbi) c(bbi) and s(bbi) is the total size of all small items in bbi . Note that the potential only depends on the queues Q1, . . . , Qℓ(B) and the bins which contain small and large items. The term ri intends to measure the number of buffer bins that become full. According to Case 1 of the previous section a new buffer bin is opened when bbi is filled i=1 ri bounds the number of buffer bins getting filled. The term ǫΛ in the potential measures the number of bins that need to be inserted due to the length of a queue exceeding 2/ǫ, as we need to split the queue Qi into two queues of length 1/ǫ according to Case 1. Each of those queues needs a buffer bin, hence we need to insert a new buffer bin out of the heap bins. Therefore the potential Φ(B) bounds the number of bins which will be inserted as new buffer bins according to Case 1. i. e., ri ≈ 1. Hence the sum Pℓ−1 ℓ−1 Xi=1 29 Just like in the previous section we propose the following properties to bound the approxima- tion ratio and the migration factor. The first three properties remain the same as in Section 4.1 and the last property gives the desired connection between the potential function and the heap bins. (1) For every item i ∈ bd with size s(i) ∈ Sj for some j, d ∈ N, there is no item i′ ∈ bd′ with size s(i′) ∈ sj ′ such that d′ > d and j′ > j. This means: Items are ordered from left to right by their size intervals. (2) Every normal bin of b1, . . . , bm is filled completely (3) The length of each queue is at least 1/ǫ and at most 2/ǫ except for Qℓ and Qd. The length of Qℓ and Qd is only limited by 1 ≤ Qℓ,Qd ≤ 1/ǫ. Furthermore, Qℓ+1 = 1 and 1 ≤ Qℓ+2 ≤ 2/ǫ. (4) The number of heap bins H1, . . . , Hh is exactly h = ⌊Φ(B)⌋ Since bins containing large items are enumerated first, property (1) implies in this setting that bins with large items are filled before bins that contain no large items. Note also that property (3) implies that Φ(B) ≥ 0 for arbitrary packings B since ǫΛ ≥ ℓ − 1 + ǫ and thus ⌈ǫΛ⌉ ≥ ℓ. The following lemma proves that a packing which fulfills properties (1) to (4) provides a solution that is close to the optimum. Lemma 10. Let M = m + h be the number of used bins and ǫ ≤ 1/4. If properties (1) to (4) hold, then at most max{Λ, (1 + O(ǫ)) opt(I, s) + O(1)} bins are used in the packing. Proof. Case 1: There is no bin containing only small items, i. e., L = m. Hence all items are packed into M = L + h = Λ bins. Case 2: There are bins containing only small items, i. e., L < m. Property (3) implies that the number of queues d is bounded by d ≤ ǫm + 4. Hence the number of buffer bins is bounded by ǫm+4 and the number of heap bins Φ(B) (property (4)) is bounded by Φ(B) =Pℓ−1 i=1 ri +⌈ǫΛ⌉− ℓ ≤ ℓ − 1 + ǫΛ + 1 − ℓ = ǫΛ as ri ≤ 1. Since Λ < M , we can bound Φ(B) by Φ(B) < ǫM . The number of normal bins is thus at least M−(ǫm+5)−(ǫM−1) ≥ M−2ǫM−4 = (1−2ǫ)M−4. By property (2) every normal bin has less than ǫ/14 free space and the total size S of all items is thus at least S ≥ (1−ǫ/14)(1−2ǫ)M−4. Since opt(I, s) ≥ S, we have opt(I, s) ≥ (1−ǫ/14(1−2ǫ)M−4. (1−ǫ/14)(1−2ǫ) ≤ (1 + 5ǫ) for ǫ ≤ 1/4. Therefore we can bound A simple calculation shows that the number of used bins by (1 + 5ǫ) opt(I, s) + 4. 1 According to property (4) we have to guarantee, that if the rounded potential ⌊Φ(B)⌋ changes, the number of heap bins has to be adjusted accordingly. The potential ⌊Φ(B)⌋ might increases by 1 due to an insert operation. Therefore the number of heap bins has to be incremented. If the potential ⌊Φ(B)⌋ decreases due to a delete operation, the number of heap bins has to be decremented. In order to maintain property (4) we have to make sure, that the number of heap bins can be adjusted whenever ⌊Φ(B)⌋ changes. Therefore we define the fractional part {Φ(B)} = Φ(B) − ⌊Φ(B)⌋ of Φ(B) and put it in relation to the fill ratio rℓ of bbℓ (the last bin containing large items) through the following equation: (1 − rℓ) − {Φ(B)} ≤ s c(bbℓ) (Heap Equation) where s is the biggest size of a small item appearing in bbℓ. The Heap Equation ensures that the potential Φ(B) is correlated to 1 − rℓ. The values may only differ by the small term s c(bbℓ) . 30 Note that the Heap Equation can always be fulfilled by shifting items from bbℓ to queue Qℓ+1 or vice versa. Assuming the Heap Equation holds and the potential ⌊Φ(B)⌋ increases by 1, we can guarantee that buffer bin bbℓ is nearly empty. Hence the remaining items can be shifted to Qℓ+1 and bbℓ can be moved to the heap bins. The bin left of bbℓ becomes the new buffer bin of Qℓ. Vice versa, if ⌊Φ(B)⌋ decreases, we know by the Heap Equation that bbℓ is nearly full, hence we can label bbℓ as a normal bin and open a new buffer bin from the heap at the end of queue Qℓ. Our goal is to ensure that the Heap Equation is fulfilled at every step of the algorithm along with properties (1) to (4). Therefore we enhance the delete and insert operations from the previous section. Whenever a small item i is inserted or removed, we will perform the operations described in Algorithm 4 (which can be applied to bins of different capacities) in the previous section. This will maintain properties (1) to (3). If items are inserted or deleted from queue Qℓ (the last queue containing large and small items) the recursion does not halt at bbℓ. Instead the recursion goes further and halts at bbℓ+1. So, when items are inserted into bin bbℓ according to Algorithm 4 the bin bbℓ is treated as a normal bin. Items are shifted from bbℓ to queue Qℓ+1 until the Heap Equation is fulfilled. This way we can make sure that the Heap Equation maintains fulfilled whenever an item is inserted or removed from Qℓ. Algorithm 6 (Insert or Delete small items for the mixed setting). Insert(i, bx, Qj): • Use Algorithm 4 to insert item i into Qj with j < ℓ. • Let i1, . . . , im be the items that are inserted at the last step of Algorithm 4 into bbj. • For k = 1, . . . , m do 1. Insert item ik into bin bbj. 2. If bbj is completely filled use Algorithm 5. 3. If the potential ⌊Φ(B)⌋ increases use Algorithm 7 (see below) to adjust the number 4. Decrease the fill ratio rℓ of bbℓ by shifting the smallest items in bbℓ to Qℓ+1 until of heap bins (property (4)). (1 − rℓ) ≤ {Φ(B)} to fulfill the Heap Equation. Delete(i, bx, Qj): • Use Algorithm 4 to remove item i from bin bx in queue Qj with j < ℓ. • Let i1, . . . , im be the items that are removed at the last step of Algorithm 4 from bbj. • For k = 1, . . . , m do 1. If bbj is empty use Algorithm 5. 2. Remove item ik from bin bbj. 3. If the potential ⌊Φ(B)⌋ decreases use Algorithm 7. 4. Increase the fill ratio rℓ of bbℓ by shifting the smallest items in bbℓ to Qℓ+1 until (1 − rℓ) ≥ {Φ(B)} to fulfill the Heap Equation. For the correctness of step 4 (the adjustment to rℓ) note the following: In case of the insert operation, the potential Φ(B) increases and we have Φ(B) ≥ 1 − rℓ. As items are being shifted from bbℓ to Qℓ+1, the first time that (1 − rℓ) ≤ {Φ(B)} is fulfilled, the Heap Equation is also c(bbℓ) as an item (which has size at most fulfilled. Since the fill ratio of bbℓ changes at most by s) is shifted to Qℓ+1 we know that (1 − rℓ) − {Φ(B)} ≤ s c(bbℓ) . Correctness of step 4 in the delete operation follows symmetrically. s The potential Φ(B) changes if items are inserted or deleted into queues Q1, . . . , Qℓ−1. Due to these insert or delete operations it might happen that the potential ⌊Φ(B)⌋ increases or that a buffer bin is being filled or emptied. The following operation is applied as soon as an item is inserted or deleted into a buffer bin and the potential ⌊Φ(B)⌋ increases or decreases. 31 Algorithm 7 (Change in the potential). • Case 1: The potential ⌊Φ(B)⌋ increases by 1. – According to the Heap Equation the remaining size of small items in bbℓ can be bounded. Shift all small items from bbℓ to Qℓ+1. Qℓ is labeled as a buffer bin. – If Qℓ > 1 then label the now empty buffer bin bbℓ as a heap bin and the last bin in – If Qℓ only consists of the buffer bin (i. e., Qℓ = 1) shift items from bbℓ−1 to Qℓ+1 until the heap equation is fulfilled. If bbℓ−1 becomes empty remove bbℓ−1 and bbℓ. The bin left to bbℓ−1 becomes the new buffer bin of Qℓ−1. The queue Qℓ is deleted and Qℓ−1 becomes the new last queue containing large items. • Case 2: The potential ⌊Φ(B)⌋ decreases by 1. – According to the Heap Equation the remaining free space in bbℓ can be bounded. Shift items from bbℓ+1 to bbℓ such that the buffer bin bbℓ is filled completely. – Add the new buffer bin from the heap to Qℓ. – If Qℓ = 1/ǫ label an additional heap bin as a buffer bin to create a new queue Qℓ+1 with Qℓ+1 = 1. Like in the last section we also have to describe how to handle buffer bins that are being emptied or filled completely. We apply the same algorithm when a buffer bin is being emp- tied or filled but have to distinguish now between buffer bins of Q1, . . . , Qℓ and buffer bins of Qℓ+1, . . . , Qd. Since the buffer bins in Qℓ+1, . . . , Qd all have capacity 1, we will use the same technique as in the last section. If a buffer bin in Q1, . . . , Qℓ is emptied or filled we will also use similar technique. But instead of inserting a new empty bin as a new buffer bin, we take an existing bin out of the heap. And if a buffer bin from Q1, . . . Qℓ is being emptied (it still contains large items), it is put into the heap. This way we make sure that there are always sufficiently many bins containing large items which are filled completely. Lemma 11. Let B be an packing which fulfills the properties (1) to (4) and the Heap Equation. Applying Algorithm 7 or Algorithm 5 on B during an insert/delete operation yields an packing B′ which also fulfills properties (1) to (4). The migration to fulfill the Heap Equation is bounded by O(1/ǫ). Proof. Analysis of Algorithm 7 Properties (1) and (2) are never violated by the algorithm because the items are only moved by shift operations. Property (3) is never violated because no queue (except for Qℓ) exceeds 2/ǫ or falls below 1/ǫ by construction. Algorithm 7 is called during an insert or delete operation. The Algorithm is executed as items are shifted into or out of buffer bbj such that ⌊Φ(B)⌋ changes. In the following we prove property (4) for the packing B′ assuming that ⌊Φ(B)⌋ = h(B) holds by induction. Furthermore we give a bound for the migration to fulfill the heap equation: • Case 1: The potential ⌊Φ(B)⌋ increases during an insert operation, i. e., it holds ⌊Φ(B′)⌋ = ⌊Φ(B)⌋ + 1. Let item i∗ be the first item that is shifted into a bin bbj such that ⌊Φ(B) + r∗⌋ = ⌊Φ(B′)⌋, where r∗ is the fill ratio being added to bbj by item i∗. In this situation, the fractional part changes from {Φ(B)} ≈ 1 to {Φ(B′)} ≈ 0. – In the case that Qℓ > 1, the buffer bin bbℓ is being emptied and moved to the heap bins. The bin left of bbℓ becomes the new buffer bin bb′ ℓ of Qℓ. Hence the number of heap bins increases and we have h(B′) = h(B) + 1 = ⌊Φ(B)⌋ + 1 = ⌊Φ(B′)⌋, which implies property (4). To give a bound on the total size of items needed to be shifted out of (or into) bin ℓ)−{Φ(B′)} by some term bbℓ to fulfill the heap equation, we bound the term (1− r′ 32 ℓ is the fill ratio of bb′ C ≤ O(s(i)/ǫ), where r′ ℓ and s(i) is the size of the arriving or departing item. If the term (1− r′ ℓ)−{Φ(B′)} can be bounded by C, the fill ratio of bb′ ℓ has to be adjusted to fulfill the heap equation according to the insert and delete operation. This can be done be shifting a total size of at most C items out of (or into) bb′ ℓ. The bin bb′ ℓ is completely filled by property (3) and therefore has a fill ratio of ℓ ≥ c(bbℓ)−s r′ 2k is the largest size of a small item appearing ℓ. Let k′ be the largest size in bbℓ and Sk is the largest size category appearing in bb′ category appearing in bin bbj. As the bin bb′ ℓ is right of bbj we know k ≤ k′ (property . Using that {Φ(B′)} ≤ r∗ ≤ 2s(i∗)/ǫ, (1)) and hence s ≤ 2s(i∗). We get r′ we can bound (1 − r′ ǫ + 2s(i∗)/ǫ = O(s(i∗)/ǫ). Hence the Heap Equation can be fulfilled by shifting items of total size O(s(i∗)/ǫ) at the end of the insert operation. ℓ) − {Φ(B′)} by 4 s(i∗) ℓ ≥ 1− 4 s(i∗) c(bbℓ) ≥ 1 − 2 s ǫ , where s ≤ ǫ ǫ – If Qℓ = 1 a set of items in the buffer bin bbℓ−1 is shifted to Qℓ+1 to fulfill the Heap Equation. Since items are being removed from bbℓ−1 the potential decreases. If rℓ−1 > {Φ(B′)}, there are enough items which can be shifted out of bbℓ−1 such that we obtain a new potential Φ(B′′) < Φ(B′)−{Φ(B′)}. Hence ⌊Φ(B′′)⌋ = ⌊Φ(B)⌋ and the Heap Equation is fulfilled. Note that the size of items that are shifted out of bbℓ−1 is bounded by r∗ + s = O(s(i∗)/ǫ), where s is the biggest size of an item appearing in bbℓ−1. If rℓ−1 ≤ {Φ(B′)} all items are shifted out of bbℓ−1. As the number of queues decreases, we obtain the new potential Φ(B′′) = Φ(B′) − rℓ−1 + 1 = ⌊Φ(B′)⌋ + {Φ(B′)}−rℓ−1+1 ≥ ⌊Φ(B′)⌋+1. Hence ⌊Φ(B′′)⌋ = ⌊Φ(B)⌋+2. The buffer bins bbℓ−1 and bbℓ are moved to the heap and thus h(B′′) = h(B) + 2 = ⌊Φ(B)⌋ + 2 = ⌊Φ(B′′)⌋ (property (4)). Note that if rℓ−1 ≤ {Φ(B′)}, item i∗ is not inserted into bin bbℓ−1 as rℓ−1 ≥ r∗ > {Φ(B′)}. Therefore the bin bbj is left of bbℓ−1 and we can bound the fill ratio of the . Using {Φ(B′′)} ≤ r∗ = O(s(i∗)/ǫ) the heap bin left of bbℓ−1 called r′′ equation can be fulfilled by shifting items of total size O(s(i)/ǫ) at the end of the insert operation. ℓ by 1 − 2 s(i∗) ǫ • Case 2: The potential ⌊Φ(B)⌋ decreases during a delete operation, i. e., it holds ⌊Φ(B′)⌋ = ⌊Φ(B)⌋ − 1 = ⌊Φ(B) − r∗⌋, where r∗ is the fill ratio being removed from a buffer bin bbj due to the first shift of an item i∗ that decreases the potential. According to Algorithm 7, buffer bin bbℓ is being filled completely and a new buffer bin for Qℓ is inserted from the heap. Hence the number of heap bins decreases and we have ⌊Φ(B′)⌋ = h(B) − 1 = h(B′). As ⌊Φ(B)⌋ − 1 = Φ(B) − {Φ(B)} − 1 = ⌊Φ(B) − r∗⌋, it holds that {Φ(B)} ≤ r∗ and by the heap equation the fill ratio of bbℓ is rℓ ≥ r∗ + s, where s is the largest size of a small item in bbℓ. As above, r∗ and s can be bounded by O( s(i∗) ǫ ). Hence the total size that is shifted from Qℓ+1 into bin bbℓ can be bounded by O( s(i∗) ǫ ). Furthermore {Φ(B′)} ≥ 1− r∗ (as Φ(B′) = Φ(B)− r∗) and r′ (1 − r′ a total size of at most O(s(i∗)/ǫ) items. In the case that Qℓ = 1/ǫ a new queue Qℓ+1 is created which consists of a single buffer bin (inserted from the heap), which does not contain small items, i. e., h(B′′) = h(B′) − 1 = ℓ = 0, therefore we can bound ℓ) − {Φ(B′)} by r∗ ≤ O(s(i∗)/ǫ) and the Heap Equation can be fulfilled by shifting 33 h(B)−2, where B′′ is the packing after the insertion of item i∗. Let Φ(B′′) be the potential after the queue Qℓ+1 is created. Then Φ(B′′) =Pℓ(B ′′)−1 ri + ǫΛ−ℓ(B′)−1 = Φ(B′)−1, as the buffer bin bbℓ is now counted in the potential, but does not contain any small items and thus r′′ ℓ = 0. Hence Φ(B′′) = Φ(B′)− 1 = h(B′)− 1 = h(B′′). ri + ǫΛ − ℓ(B′′) =Pℓ(B ′)−2 i=1 i=1 Analysis of Algorithm 5 Algorithm 5 is executed as an item i∗ is moved into a buffer bin bbj such that bbj is completely filled or Algorithm 5 is executed if the buffer bin bbj is emptied by moving the last item i∗ out of the bin. As in the analysis of Algorithm 7, properties (1) and (2) are never violated by the algorithm because the items are only moved by shift operations. Property (3) is never violated because no queue (except for Qℓ) exceeds 2/ǫ or falls below 1/ǫ by construction. It remains to prove property (4) and a bound for the migration to fulfill the heap equation: • Case 1: An item i∗ is moved into the buffer bin bbj such that bbj is filled completely for some j < ℓ. According to Algorithm 5 a bin is taken out of the heap and labeled as the new buffer bin bb′ j = 0 of queue Qj, i. e., the number of heap bins decreases by 1. Let Φ(B) be the potential before Algorithm 5 is executed and let Φ(B′) be the potential after Algorithm 5 is executed. The potential changes as follows: j with fill ratio r′ Φ(B) − Φ(B′) = (rj − r′ j) − (ℓ(B) − ℓ(B′)) Since r′ as the splitting of queue is handled later on). j = 0 the new potential is Φ(B′) = Φ(B) − rj ≈ Φ(B) − 1 (assuming ℓ(B) = ℓ(B′), – If ⌊Φ(B′)⌋ = ⌊Φ(B)⌋ − 1 property (4) is fulfilled since the number of heap bins decreases by h(B′) = h(B) − 1 = ⌊Φ(B)⌋ − 1 = ⌊Φ(B′)⌋. As rj ≥ c(bbj )−s c(bbj ) , where s is the biggest size category appearing in bbj and s ≤ 2s(i∗), we obtain for the fractional part of the potential that {Φ(B)} − {Φ(B′)} ≤ 2 s . Hence the Heap Equation can be fulfilled by shifting items of total size O(s(i∗)/ǫ) at the end of the insert operation as in the above proof. ǫ ≤ 4 s(i∗) ǫ – In the case that ⌊Φ(B′)⌋ = ⌊Φ(B)⌋ = ⌊Φ(B) − rj⌋ we know that the fractional part changes by {Φ(B′)} = {Φ(B)} − rj. Since the bin bbj is filled completely we know that rj ≥ c(bbj )−s c(bbj ) ≈ 1 and hence {Φ(B)} ≥ rj ≈ 1 and {Φ(B′)} ≤ 1 − rj ≈ 0. According to the Heap Equation, items have to be shifted out of rℓ such that the fill ratio rℓ changes from rℓ ≤ 1 − rj to rℓ ≈ 1. Therefore we know that as items are shifted out of bbℓ to fulfill the Heap Equation, the buffer bin bbℓ is being emptied and moved to the heap (see Algorithm 7). We obtain for the number of heap bins that h(B′) = h(B) + 1 − 1 = h(B) and hence h(B′) = ⌊Φ(B′)⌋ (property (4)). , the Heap Equation implies that rℓ ≤ 4 s(i∗) As {Φ(B)} ≥ rj ≥ 1 − 4 s(i∗) c(bbℓ) = O(s(i∗)/ǫ). The buffer bin bbℓ is thus emptied by moving a size of O(s(i∗)/ǫ) items out of the bin. Let bb′ ℓ be the new buffer bin of Qℓ that was left of bbℓ. The Heap Equation can be fulfilled by shifting at most O(s(i)/ǫ) out of bb′ ℓ since {Φ(B′)} is bounded by 1 − rj = O(s(i∗)/ǫ). ǫ + s – In the case that Qj > 2/ǫ the queue is split into two queues and an additional heap bin is inserted, i. e., h(B′′) = h(B′) − 1. As the potential changes by Φ(B′′) = Φ(B′) + (ℓ(B′) − ℓ(B′′)) = Φ(B′) − 1 we obtain again that h(B′′) = ⌊Φ(B′′)⌋. ǫ • Case 2: Algorithm 5 is executed if bin bbj is emptied due to the removal of an item i∗ as a result of a Delete(i, bx, Qj) call. According to Algorithm 5, the emptied bin is moved 34 to the heap, i. e., the number of heap bins increases by 1. Depending on the length of Qj and Qj+1, the bin right of bbj or the bin left of bbj is chosen as the new buffer bin bb′ j. The potential changes by Φ(B′) = Φ(B) + r′ j as in case 1. – If ⌊Φ(B′)⌋ = ⌊Φ(B)⌋ + 1 property (4) is fulfilled since the number of heap bins j is the fill ratio of bb′ j, where r′ ǫ ≤ 4 s(i) j ≥ 1 − 2 s j is completely filled, the fill ratio is bounded by r′ increases by h(B′) = h(B) + 1. As bin bb′ ǫ , where s is the largest size appearing in bb′ j. Since the bin bx has to be left of bbj we know that s ≤ 2s(i). We obtain for the fractional part of the potential that {Φ(B)} ≥ {Φ(B′)} − 2 s ǫ . Hence the Heap Equation can be fulfilled by shifting items of total size O(s(i)/ǫ) at the end of the remove operation. – In the case that ⌊Φ(B′)⌋ = ⌊Φ(B)⌋ = ⌊Φ(B) + r′ j⌋ we know that the fractional part changes similar to case 1 by {Φ(B′)} = {Φ(B)} + r′ j. Since the bin bbj is filled completely we know that rj ≥ c(bbj )−s c(bbj ) ≈ 1 and hence {Φ(B′)} ≥ rj ≈ 1 and {Φ(B)} ≤ 1 − rj ≈ 0. According to the Heap Equation items have to be shifted to bbℓ such that the fill ratio rℓ changes from rℓ ≈ 0 to rℓ ≈ 1. Therefore we know that as items are shifted into bbℓ to fulfill the Heap Equation, bbℓ is filled completely and a bin from the heap is labeled as the new buffer bin of Qℓ (see Algorithm 7). We obtain for the number of heap bins that h(B′) = h(B) − 1 + 1 = h(B) and hence h(B′) = Φ(B′) (property (4)). The Heap Equation can be fulfilled similarly to case 1 by shifting items of total size O(s(i)/ǫ). Using the above lemma for, we can finally prove the following central theorem, which states that the migration of an insert/delete operation is bounded and that properties (1) to (4) are maintained. Theorem 6. (i) Let B be a packing which fulfills properties (1) to (4) and the Heap Equation. Applying operations insert(i, bx, Qj) or delete(i, bx, Qj) on a packing B yields an instance B′ which also fulfills properties (1) to (4) and the Heap Equation. (ii) The migration factor of an insert/delete operation is bounded by O(1/ǫ). Proof. Suppose a small item i with size s(i) is inserted or deleted from queue Qj. The insert and delete operation basically consists of application of Algorithm 4 and iterated use of steps (1) to (3) where Algorithms 5 and 7 are used and items in bbℓ are moved to Qℓ+1 and vice versa. Let B be the packing before the insert/delete operation and let B′ be the packing after the operation. Proof for (i): Now suppose by induction that property (1) to (4) and the Heap Equation is fulfilled for packing B. We prove that property (4) and the Heap Equation maintain fulfilled after applying an insert or delete operation on B resulting in the new packing B′. Properties (1) to (3) hold by conclusion of Lemma 9 and Lemma 11. Since the potential and the number of heap bins only change as a result of Algorithm 5 or Algorithm 7, property (4) maintains fulfilled also. By definition of step 4 in the insert operation, items are shifted from bbℓ to Qℓ+1 until the Heap Equation is fulfilled. By definition of step 4 of the delete operation, the size of small items in bbℓ is adjusted such that the Heap Equation is fulfilled. Hence the Heap Equation is always fulfilled after application of Insert(i, bx, Qj) or Delete(i, bx, Qj). 35 Proof for (ii): According to Lemma 9 the migration factor of the usual insert operation is bounded by O(1/ǫ). By Lemma 11 the migration in Algorithm 5 and Algorithm 7 is also bounded by O(1/ǫ). It remains to bound the migration for step 4 in the insert/delete operation. Therefore we have to analyze the total size of items to be shifted out or into bbℓ in order to fulfill the Heap Equation. Since the size of all items i1, . . . , ik that are inserted into bbj is bounded by 7s(i) (see Lemma 9) and the capacity of bbj is at least ǫ/14 the potential Φ(B) changes by at most O(s(i)/ǫ). By Lemma 11 the size of items that needs to be shifted out or into bbℓ as a result of Algorithm 5 or 7 is also bounded by O(s(i)/ǫ). Therefore the size of all items that need to be shifted out or into bbℓ in step (4) of the insert/delete operation is bounded by O(s(i)/ǫ). Shifting a size of O(s(i)/ǫ) to Qℓ+1 or vice versa leads to a migration factor of O(1/ǫ2) (Lemma 9). Fortunately we can modify the structure of queues Qℓ+1 and Qℓ+2 such that we obtain a smaller migration factor. Assuming that Qℓ+1 consists of a single buffer bin, i. e., Qℓ+1 = 1 items can directly be shifted from bbℓ to bbℓ+1 and therefore we obtain a migration factor of O(1/ǫ). A structure with Qℓ+1 = 1 and 1 ≤ Qℓ+2 ≤ 2/ǫ (see property (3)) can be maintained by changing Algorithm 5 in the following way: • If bbℓ+1 is filled completely, move the filled bin to Qℓ+2. – If Qℓ+2 > 2/ǫ, split Qℓ+2 into two queues. • If bbℓ+1 is being emptied, remove the bin and label the first bin of Qℓ+2 as bbℓ+1. – If Qℓ+2 = 0, remove Qℓ+2. 4.3 Handling the General Setting In the previous section we described how to handle small items in a mixed setting. It remains to describe how large items are handled in this mixed setting. Algorithm 1 describes how to handle large items only. However, in a mixed setting, where there are also small items, we have to make sure that properties (1) to (4) and the Heap Equation maintain fulfilled as a large item is inserted or deleted. Algorithm 1 changes the configuration of at most O(1/ǫ2 · log 1/ǫ) bins (Theorem 5). Therefore, the size of large items in a bin b (= 1 − c(b)) changes, as Algorithm 1 may increase or decrease the capacity of a bin. Changing the capacity of a bin may violate properties (2) to (4) and the Heap Equation. We describe an algorithm to change the packing of small items such that all properties and the Heap Equation are fulfilled again after Algorithm 1 was applied. The following algorithm describes how the length of a queue Qj is adjusted if the length Qj falls below 1/ǫ: Algorithm 8 (Adjust the queue length). • Remove all small item IS from bbj and add bbj to the heap. • Merge Qj with Qj+1. The merged queue is called Qj. • If Qj > 2/ǫ split queue Qj by adding a heap bin in the middle. • Insert items IS using Algorithm 6. The following algorithm describes how the number of heap bins can be adjusted. 36 Algorithm 9 (Adjust number of heap bins). • Decreasing the number of heap bins by 1. – Shift small items from Qℓ+1 to bbℓ until bbℓ is filled completely – Label a heap bin as the new buffer bin of Qℓ • Increasing the number of heap bins by 1. – Shift all small items from bbℓ to Qℓ+1 – Label bbℓ as a heap bin – Label the bin left of bbℓ as new buffer bin of Qℓ Note that the Heap Equation can be fulfilled in the same way, by shifting items from bbℓ to Qℓ+1 or vice versa. Using these algorithms, we obtain our final algorithm for the fully dynamic binpacking prob- lem. Algorithm 10 (AFPTAS for the mixed setting). • If i is large do 1. Use Algorithm 1. 2. Remove all small items IS of bins b with changed capacity. 3. Adjust queue length. 4. Adjust the number of heap bins. 5. Adjust the Heap Equation. 6. Insert all items IS using Algorithm 6. • If i is small use Algorithm 6 Combining all the results from the current and the previous section, we finally prove the central result that there is fully dynamic AFPTAS for the binpacking problem with polynomial migration. Theorem 7. Algorithm 10 is a fully dynamic AFPTAS for the binpacking problem, that achieves a migration factor of at most O(1/ǫ4 · log 1/ǫ) by repacking items from at most O(1/ǫ3 · log 1/ǫ) bins. Proof. Approximation guarantee: By definition of the algorithm, it generates at every timestep t a packing Bt of instance I(t) such that properties (1) to (4) are fulfilled. According to Lemma 10, at most max{Λ, (1 +O(ǫ)) opt(I(t), s) +O(1)} bins are used where Λ is the number of bins containing large items. Since we use Algorithm 1 to pack the large items, Theorem 5 implies that Λ ≤ (1 + O(ǫ)) opt(I(t), s) + O(1/ǫ log 1/ǫ). Hence the number of used bins can be bounded in any case by (1 + O(ǫ)) opt(I(t), s) + O(1/ǫ log 1/ǫ). Migration Factor: Note that the Algorithm uses Algorithm 6 or Algorithm 1 to insert and delete small or large items. The migration factor for Algorithm 6 is bounded by O(1/ǫ) due to Theorem 6 while the migration factor for Algorithm 1 is bounded by O(1/ǫ3 · log 1/ǫ) due to Theorem 5. It remains to bound the migration that is needed to adjust the heap bins, the length of a queue falling below 1/ǫ and the Heap Equation in case a large item arrives and Algorithm 1 is applied. 37 Suppose the number of heap bins has to be adjusted by 1. In this case Algorithm 9 shifts items from Qℓ+1 to bbℓ or vice versa until bbℓ is either filled or emptied. Hence, the size of moved items is bounded by 1. Since the size of the arriving or departing item is ≥ ǫ/14 the migration factor is bounded by O(1/ǫ). In the same way, a migration of at most O(1/ǫ) is used to fulfill the Heap Equation which implies that the migration in step 5 is bounded by O(1/ǫ). If Qj falls below 1/ǫ, the two queues Qj and Qj+1 are merged by emptying bbj. The removed items are inserted by Algorithm 6. As their total size is bounded by 1 and the algorithm has a migration factor of O(1/ǫ), the size of the moved items is bounded by O(1/ǫ). The migration to merge two queues can thus be bounded by O(1/ǫ2). Note that the proof of Theorem 5 implies that at most γ = O(1/ǫ2 log 1/ǫ) bins are changed by Algorithm 1. The total size of the items IS which are removed in step 2 is thus bounded by γ. Similarly, the length of at most γ queues can fall below 1/ǫ. The migration of step 3 is thus bounded by γ · 1/ǫ2. As at most γ buffer bins are changed, the change of the potential (and thus the number of heap bins) is also bounded by γ and the migration in step 4 can be bounded by γ · 1/ǫ. The migration in step 6 is bounded by s(IS) · 1/ǫ ≤ γ · 1/ǫ as Algorithm 6 has migration factor 1/ǫ. The total migration of the adjustments is thus bounded by γ · 1/ǫ2 = O(1/ǫ4 log 1/ǫ). Running Time: The handling of small items can be performed in linear time while the handling of large items requires O(M (1/ǫ log(1/ǫ)) · 1/ǫ3 log(1/ǫ) + 1/ǫ log(1/ǫ) log(ǫ2 · n(t)) + ǫn(t)), where M (n) is the time needed to solve a system of n linear equations (see Theorem 5). The total running time of the algorithm is thus O(M (1/ǫ log(1/ǫ)) · 1/ǫ3 log(1/ǫ) + 1/ǫ log(1/ǫ) log(ǫ2 · n(t)) + n(t)). Acknowledgements We would like to thank Till Tantau for his valuable comments and suggestions to improve the presentation of the paper. References [BB10] A. Beloglazov and R. Buyya. Energy efficient allocation of virtual machines in cloud data centers. In 10th IEEE/ACM International Conference on Cluster, Cloud and Grid Computing, CCGrid 2010, pages 577–578, 2010. [BBG10] J. Balogh, J. B´ek´esi, and G. Galambos. New lower bounds for certain classes In Workshop on Approximation and Online Algo- of bin packing algorithms. rithms(WAOA), volume 6534 of LNCS, pages 25–36, 2010. [BBGR08] J. Balogh, J. B´ek´esi, G. Galambos, and G. Reinelt. Lower bound for the online bin packing problem with restricted repacking. SIAM Journal on Computing, 38(1):398– 410, 2008. [BKB07] N. Bobroff, A. Kochut, and K.A. Beaty. Dynamic placement of virtual machines for managing SLA violations. In Integrated Network Management, IM 2007. 10th IFIP/IEEE International Symposium on Integrated Network Management, pages 119–128, 2007. [BM98] P.A. trix Computer Science, 205(1–2):307–316, 1998. multiplication Megiddo. basic to find Beling and N. solutions. Using fast ma- Theoretical 38 [Bro79] D.J. Brown. A lower bound for on-line one-dimensional bin packing algorithms. Technical Report R-864, Coordinated Sci Lab Univ of Illinois Urbana, 1979. [CGJ83] E.G. Coffman, M.R. Garey, and D.S. Johnson. Dynamic bin packing. SIAM Journal on Computing, 12(2):227–258, 1983. [CLW08] J.W. Chan, T. Lam, and P.W.H. Wong. Dynamic bin packing of unit fractions items. Theoretical Computer Science, 409(3):521–529, 2008. [CWY09] J.W. Chan, P.W.H. Wong, and F.C.C. Yung. On dynamic bin packing: An im- proved lower bound and resource augmentation analysis. Algorithmica, 53(2):172– 206, 2009. [DKL14] Khuzaima D., Shahin K., and Alejandro L. On the online fault-tolerant server consolidation problem. In 26th ACM Symposium on Parallelism in Algorithms and Architectures, SPAA ’14, pages 12–21, 2014. [Eis57] K. Eisemann. The Trim Problem. Management Science, 3(3):279–284, 1957. [EL09] L. Epstein and A. Levin. A robust APTAS for the classical bin packing problem. Mathematical Programming, 119(1):33–49, 2009. [EL13] L. Epstein and A. Levin. Robust approximation schemes for cube packing. SIAM Journal on Optimization, 23(2):1310–1343, 2013. [FdlVL81] W. Fernandez de la Vega and G.S. Lueker. Bin packing can be solved within 1 + ǫ in linear time. Combinatorica, 1(4):349–355, 1981. [GPT00] G. Gambosi, A. Postiglione, and M. Talamo. Algo- rithms SIAM Journal on Computing, 30(5):1532–1551, 2000. relaxed online the for bin-packing model. [IL97] Z. Ivkovi´c and E.L. Lloyd. Partially dynamic bin packing can be solved within 1 + ǫ in (amortized) polylogarithmic time. Information Processing Letter, 63(1):45–50, 1997. [IL98] Z. for Journal on Computing, 28(2):574–611, 1998. and packing: Ivkovi´c bin Lloyd. Being E.L. (mostly) myopic helps. Fully dynamic algorithms SIAM [IL09] Z. Ivkovi´c and E.L. Lloyd. Fully dynamic bin packing. In Fundamental Problems in Computing, pages 407–434. Springer, 2009. [JDU+74a] D.S. Johnson, A. Demers, J.D. Ullman, M.R. Garey, and R.L. Graham. Worst-case performance bounds for simple one-dimensional packing algorithms. SIAM Journal on Computing, 3(4):299–325, 1974. [JDU+74b] D.S. Johnson, A.J. Demers, J.D. Ullman, M.R. Garey, and R.L. Graham. Worst- case performance bounds for simple one-dimensional packing algorithms. SIAM Journal on Computing, 3(4):299–325, 1974. [JJH+08] G. Jung, K.R. Joshi, M.A. Hiltunen, R.D. Schlichting, and C. Pu. Generating adaptation policies for multi-tier applications in consolidated server environments. In 2008 International Conference on Autonomic Computing, ICAC 2008, June 2-6, 2008, Chicago, Illinois, USA, pages 23–32, 2008. 39 [JJH+09] G. Jung, K.R. Joshi, M.A. Hiltunen, R.D. Schlichting, and C. Pu. A cost-sensitive adaptation engine for server consolidation of multitier applications. In Middleware 2009, ACM/IFIP/USENIX, 10th International Middleware Conference, Proceed- ings, pages 163–183, 2009. [JK13] K. Jansen and K. Klein. A robust AFPTAS for online bin packing with polynomial In International Colloquium on Automata, Languages, and Program- migration. ming(ICALP), pages 589–600, 2013. [Joh74] D.S. Johnson. Fast algorithms for bin packing. Journal of Computer and System Sciences, 8(3):272–314, 1974. [KK82] N. Karmarkar and R.M. Karp. An efficient approximation scheme for the one- dimensional bin-packing problem. In 23rd Annual Symposium on Foundations of Computer Science (FOCS), pages 312–320. IEEE Computer Society, 1982. [Lia80] F.M. Liang. A lower bound for on-line bin packing. Information processing letters, 10(2):76–79, 1980. [LL85] C.C. Lee and D. Lee. A simple on-line bin-packing algorithm. Journal of the ACM (JACM), 32(3):562–572, 1985. [LTC14] Y. Li, X. Tang, and W. Cai. On dynamic bin packing for resource allocation in the cloud. In 26th ACM Symposium on Parallelism in Algorithms and Architectures, SPAA ’14, pages 2–11, 2014. [PSC+00] J.M. Park, Uday R. Savagaonkar, E.K.P. Chong, H.J. Siegel, and S.D. Jones. Effi- cient resource allocation for qos channels in mf-tdma satellite systems. In MILCOM 2000. 21st Century Military Communications Conference Proceedings, volume 2, pages 645–649. IEEE, 2000. [Sei02] S.S. Seiden. On the online bin packing problem. Journal of the ACM, 49(5):640–671, 2002. [SKZ08] S. Srikantaiah, A. Kansal, and F. Zhao. Energy aware consolidation for cloud computing. In Proceedings of the 2008 Conference on Power Aware Computing and Systems, HotPower’08, pages 10–10, 2008. [SSS09] P. Sanders, N. Sivadasan, and M. Skutella. Online scheduling with bounded migra- tion. Mathematics of Operations Research, 34(2):481–498, 2009. [Sto13] A.L. Stolyar. An infinite server system with general packing constraints. Operations Research, 61(5):1200–1217, 2013. [SV10] M. Skutella and J. Verschae. A robust PTAS for machine covering and packing. In European Symposium on Algorithms(ESA), volume 6346 of LNCS, pages 36–47, 2010. [SZ13] A.L. Stolyar and Y. Zhong. A large-scale service system with packing con- In Proceedings of the on straints: Minimizing the number of occupied servers. ACM Measurement and modeling of computer systems, pages 41–52. ACM, 2013. SIGMETRICS/international conference 40 [Ull71] J.D. Ullman. The Performance of a Memory Allocation Algorithm. Technical report. Princeton University, 1971. [VAN08] A. Verma, P. Ahuja, and A. Neogi. pmapper: Power and migration cost aware appli- cation placement in virtualized systems. In Middleware 2008, ACM/IFIP/USENIX 9th International Middleware Conference, Proceedings, pages 243–264, 2008. [Vli92] A. Vliet. An improved lower bound for on-line bin packing algorithms. Information Processing Letters, 43(5):277–284, 1992. [Yao80] A.C. Yao. New algorithms for bin packing. Journal of the ACM (JACM), 27(2):207– 227, 1980. 41
1502.02051
2
1502
2015-08-13T12:58:37
Approximating ATSP by Relaxing Connectivity
[ "cs.DS" ]
The standard LP relaxation of the asymmetric traveling salesman problem has been conjectured to have a constant integrality gap in the metric case. We prove this conjecture when restricted to shortest path metrics of node-weighted digraphs. Our arguments are constructive and give a constant factor approximation algorithm for these metrics. We remark that the considered case is more general than the directed analog of the special case of the symmetric traveling salesman problem for which there were recent improvements on Christofides' algorithm. The main idea of our approach is to first consider an easier problem obtained by significantly relaxing the general connectivity requirements into local connectivity conditions. For this relaxed problem, it is quite easy to give an algorithm with a guarantee of 3 on node-weighted shortest path metrics. More surprisingly, we then show that any algorithm (irrespective of the metric) for the relaxed problem can be turned into an algorithm for the asymmetric traveling salesman problem by only losing a small constant factor in the performance guarantee. This leaves open the intriguing task of designing a "good" algorithm for the relaxed problem on general metrics.
cs.DS
cs
Approximating ATSP by Relaxing Connectivity Ola Svensson EPFL [email protected] August 14, 2015 Abstract The standard LP relaxation of the asymmetric traveling salesman problem has been conjectured to have a constant integrality gap in the metric case. We prove this conjecture when restricted to shortest path metrics of node-weighted digraphs. Our arguments are constructive and give a constant factor approximation algorithm for these metrics. We remark that the considered case is more general than the directed analog of the special case of the symmetric traveling salesman problem for which there were recent improvements on Christofides’ algorithm. The main idea of our approach is to first consider an easier problem obtained by significantly relaxing the general connectivity requirements into local connectivity conditions. For this relaxed problem, it is quite easy to give an algorithm with a guarantee of 3 on node-weighted shortest path metrics. More surprisingly, we then show that any algorithm (irrespective of the metric) for the relaxed problem can be turned into an algorithm for the asymmetric traveling salesman problem by only losing a small constant factor in the performance guarantee. This leaves open the intriguing task of designing a “good” algorithm for the relaxed problem on general metrics. Keywords: approximation algorithms, asymmetric traveling salesman problem, combinatorial optimization, linear programming 5 1 0 2 g u A 3 1 ] S D . s c [ 2 v 1 5 0 2 0 . 2 0 5 1 : v i X r a 1 Introduction The traveling salesman problem is one of the most fundamental combinatorial optimiza- tion problems. Given a set V of n cities and a distance/weight function w : V × V → R+, it is the problem of finding a tour of minimum total weight that visits each city exactly once. There are two variants of this general definition: the symmetric traveling salesman problem (STSP) and the asymmetric traveling salesman problem (ATSP). In the symmet- ric version we assume w(u, v) = w(v, u) for each pair u, v ∈ V of cities; whereas we make no such assumption in the more general asymmetric traveling salesman problem. In both versions, it is common to assume the triangle inequality and we shall do so in the rest of this paper. Recall that the triangle inequality says that for any triple i, j, k of cities, we have w(i, j) + w(j, k) (cid:62) w(i, k). In other words, it is not more expensive to take the direct path compared to a path that makes a detour. Another equivalent view of the triangle inequality is that, instead of insisting that each city is visited exactly once, we should find a tour that visits each city at least once. These assumptions are arguably natural in many, if not most, settings. They are also necessary in the following sense: any reasonable approximation algorithm (with approximation guarantee O(exp(n))) for the traveling salesman problem without the triangle inequality would imply P = NP because it would solve the problem of deciding Hamiltonicity. Understanding the approximability of the symmetric and the asymmetric traveling salesman problem (where we have the triangle inequality) turns out to be a much more interesting and notorious problem. On the one hand, the strongest known inapproximability results, by Karpinski, Lampis, and Schmied [14], say that it is NP-hard to approximate STSP within a factor of 123/122 and that it is NP-hard to approximate ATSP within a factor of 75/74. On the other hand, the current best approximation algorithms are far from these guarantees, especially in the case of ATSP. For the symmetric traveling salesman problem, Christofides’ beautiful algorithm from 1976 sill achieves the best known approximation guarantee of 1.5 [7]. However, a recent series of papers [11, 16, 17, 19], broke this barrier for the interesting special case of shortest path metrics of unweighted undirected graphs1. Specifically, Oveis Gharan, Saberi, and Singh [11] first gave an approximation guarantee of 1.5− ε; Mömke and Svensson [16] proposed a different approach yielding a 1.461-approximation guarantee; Mucha [17] gave a tighter analysis of this algorithm; and Sebö and Vygen [19] significantly developed the approach to give the current best approximation guarantee of 1.4. The interest in shortest path metrics has several motivations. It is a natural special case that seems to capture the difficulty of the problem: it remains APX-hard and the worst known integrality gap for the Held-Karp relaxation is of this type. Moreover, it has an attractive graph theoretic formulation: given an unweighted graph, find a shortest tour that visits each vertex at least once. This is the (unweighted) “graph” analog of STSP. Indeed, if allow the graph to be edge-weighted, this formulation is equivalent to STSP on general metrics. Let us also mention that the polynomial time approximation scheme for the symmetric traveling salesman problem on planar 1The shortest path metric of a graph G = (V, E) is defined as follows: the weight w(u, v) between cities u, v ∈ V equals the shortest path between u and v in G. If the graph is node-weighted f : V → R+, the weight/length of an edge {u, v} ∈ E is f (u) + f (v). 2 graphs was first obtained for the special case of unweighted graphs [12], i.e., when restricted to shortest path metrics of unweighted graphs, and then generalized to the case of edge-weights [3]. For STSP, it remains a major open problem whether the ideas in [11, 16, 17, 19] can be applied to general metrics. We further discuss this in Section 6. The gap in our understanding is much larger for the asymmetric traveling salesman problem for which it remains a notorious open problem to design an algorithm with any constant approximation guarantee. This is a particularly intriguing as the standard linear programming relaxation, often referred to as the Held-Karp relaxation, is only known to have an integrality gap of at least 2 [6]. There are in general two available approaches for designing approximation algorithms for ATSP in the literature. The first approach is due to Frieze, Galbiati, and Maffiolo [9] who gave a log2(n)-approximation algorithm for ATSP already in 1982. Their basic idea is simple and elegant: a minimum weight cycle cover has weight at most that of an optimal tour and it will decrease the number of connected components by a factor of at least 2. Hence, if we repeat the selection of a minimum weight cycle cover log2(n) times, we get a connected Eulerian graph which (by shortcutting) is a log2(n)-approximate tour. Although the above analysis is tight only in the case when almost all cycles in the cycle covers have length 2, it is highly non-trivial to refine the method to decrease the number of iterations. It was first in 2003 that Bläser [5] managed to give an approximation guarantee of 0.999 log2(n). This was improved shortly thereafter by Kaplan, Lewenstein, Shafrir and Sviridenko [13] who further developed this approach to obtain a 4/3 log3(n) ≈ 0.84 log2(n)-approximation algorithm; and later by Feige and Singh [8] who obtained an approximation guarantee of 2/3 log2(n). A second approach was more recently proposed in an influential and beautiful paper by Asadpour, Goemans, Madry, Oveis Gharan, and Saberi [4] who gave an O(log n/ log log n)-approximation algorithm for ATSP. Their approach is based on finding a so-called α-thin spanning tree which is a (unweighted) graph theoretic problem. Here, the parameter α is proportional to the approximation guarantee so α = O(log n/ log log n) in [4]. Following their publication, Oveis Gharan and Saberi [10] gave an efficient algorithm for finding O(1)-thin spanning trees for planar and bounded genus graphs yielding a constant factor approximation algorithm for ATSP on these graph classes. Also, in a very recent major progress, Anari and Oveis Gharan [1] showed the existence of O(polylog log n)-thin spanning trees for general instances. This implies a O(polylog log n) upper bound on the integrality gap of the Held-Karp relaxation. Hence, it gives an efficient so-called estimation algorithm for estimating the optimal value of a tour within a factor O(polylog log n) but, as their arguments are non-constructive, no approximation algorithm for finding a tour of matching guarantee. The result in [1] is based on developing and extending several advanced techniques. Notably, they rely on their extension [2] of the recent proof of the Kadison-Singer conjecture which was a major breakthrough by Marcus, Spielman, and Srivastava [15]. To summarize, the current best approximation algorithm has a guarantee of O(log n/ log log n) [4] and the best upper bound on the integrality gap of the Held-Karp relaxation is O(polylog log n) [1]. These two bounds are far away from the known inapproximability results [14] and from the lower bound of 2 on the integrality gap of the Held-Karp relaxation [6]. Moreover, there were no better approximation algorithms 3 known in the case of shortest path metrics of unweighted digraphs for which there was recent progress in the undirected setting. In particular, it is not clear how to use the two available approaches mentioned above to get an improved approximation guarantee in this case: in the cycle cover approach, the main difficulty is to bound the number of iterations and, in the thin spanning tree approach, ATSP is reduced to an unweighted graph theoretic problem. 1.1 Our Results and Overview of Approach We propose a new approach for approximating the asymmetric traveling salesman problem based on relaxing the global connectivity constraints into local connectivity conditions. We also use this approach to obtain the following result where we refer to ATSP on shortest path metrics of node-weighted digraphs as Node-Weighted ATSP. Theorem 1.1. There is a constant approximation algorithm for Node-Weighted ATSP. Specifi- cally, for Node-Weighted ATSP, the integrality gap of the Held-Karp relaxation is at most 15 and, for any ε > 0, there is a polynomial time algorithm that finds a tour of weight at most (27 + ε) OPTHK where OPTHK denotes the optimal value of the Held-Karp relaxation. As further discussed in Section 6, the constants in the theorem can be slightly improved by specializing our general approach to the node-weighted case. However, it remains an interesting open problem to give a tight bound on the integrality gap. Let us continue with a brief overview of our approach that is not restricted to the node-weighted version. It is illustrative to consider the following “naive” algorithm that actually was the starting point of this work: 1. Select a random cycle cover C using the Held-Karp relaxation. It is well known that one can sample such a cycle cover C of expected weight equal to the optimal value OPTHK of the Held-Karp relaxation. 2. While there exist more than one component, add the lightest cycle (i.e., the cycle of smallest weight) that decreases the number of components. It is clear that the above algorithm always returns a solution to ATSP: we start with a Eulerian graph2 and the graph stays Eulerian during the execution of the while- loop which does not terminate until the graph is connected. This gives a tour that visits each vertex at least once and hence a solution to ATSP (using that we have the triangle-inequality). However, what is the weight of the obtained tour? First, as remarked above, we have that the expected weight of the cycle cover is OPTHK. So if C contains k = C cycles, we would expect that a cycle in C has weight OPTHK /k (at least on average). Moreover, the number of cycles added in Step 2 is at most k − 1 since each cycle decreases the number of components by at least one. Thus, if each cycle in Step 2 has weight at most the average weight OPTHK /k of a cycle in C, we obtain a 2-approximate tour of weight at most OPTHK + k−1 k OPTHK (cid:54) 2 OPTHK. Unfortunately, it seems hard to find a cycle cover C so that we can always connect it with light cycles. Instead, what we can do, is to first select a cycle cover C then add light 2Recall that a directed graph is Eulerian if the in-degree equals the out-degree of each vertex. 4 cycles that decreases the number of components as long as possible. When there are no more light cycles to add, the vertices/cities are partitioned into V1, . . . , Vk connected components. In order to make progress from this point, we would like to find a “light” Eulerian set F of edges that crosses the cuts {(Vi, ¯Vi) i = 1, 2, . . . , k}. We could then hope to add F to our solution and continue from there. It turns out that it is very important what “light” means in this context. For our arguments to work, we need that F is selected so that the weight of the edges in each component has weight at most α times what the linear programming solution “pays” for the vertices in that component. This is the intuition behind the definitions in Section 3 of Local-Connectivity ATSP and α-light algorithms for that problem. We also need to be very careful in which way we add edges from light cycles and how to use the α-light algorithm for Local-Connectivity ATSP. In Section 5, our algorithm will iteratively solve the Local-Connectivity ATSP and, in each iteration, it will add a carefully chosen subset of the found edges together with light cycles. We remark that in Local-Connectivity ATSP we have relaxed the global connectivity properties of ATSP into local connectivity conditions that only say that we need to find a Eulerian set of edges that crosses at most n = V cuts defined by a partitioning of the vertices. In spite of that, we are able to leverage the intuition above to obtain our main technical result: Theorem (Simplified statement of Theorem 5.1). The integrality gap of the Held-Karp relaxation is at most 5α if there exists an α-light algorithm A for Local-Connectivity ATSP. Moreover, for any ε > 0, we can find a (9 + ε)α-approximate tour in time polynomial in n, 1/ε, and in the running time of A. The proof of the above theorem (Section 5) is based on generalizing and, as alluded to above, deviating from the above intuition in several ways. First, we start with a carefully chosen “Eulerian partition” which generalizes the role of the cycle cover C in Step 1 above. Second, both the iterative use of the α-light algorithm for Local-Connectivity ATSP and the way we add light cycles are done in a careful and dependent manner so as to be able to bound the total weight of the returned solution. Theorem 1.1 follows from Theorem 5.1 together with a 3-light algorithm for Node-Weighted Local-Connectivity ATSP. The 3-light algorithm, described in Section 4, is a rather simple application of classic theory of flows and circulations. We also remark that it is the only part of the paper that relies on having shortest path metrics of node-weighted digraphs. Our work raises several natural questions. Perhaps the most immediate and intriguing question is whether there is a O(1)-light algorithm for Local-Connectivity ATSP on general metrics. We further elaborate on this and other related questions in Section 6. 2 Preliminaries 2.1 Basic Notation Consider a directed graph G = (V, E). For a subset S ⊆ V, we let δ+(S) = {(u, v) ∈ E u ∈ S, v (cid:60) S} be the outgoing edges and we let δ− (S) = {(u, v) ∈ E u (cid:60) S, v ∈ S} be the 5 (cid:48) E(cid:48)(S) = δ+(S)∩ E (cid:48) When considering a function f : U → R, we let f (X) =(cid:80) (cid:48) ⊆ E of the edges, incoming edges of the cut defined by S. When considering a subset E (S)∩ E and by δ− (cid:48) E(cid:48)(S) = δ− we denote the restrictions to that subset by δ+ . We also let C(E ) = { G1 = ( V1, E1), G2 = ( V2, E2), . . . , Gk = ( Vk, Ek)} denote the set of (cid:48) subgraphs corresponding to the k connected components of the graph (V, E ); the vertex set V will always be clear from the context. Here connected means that the subgraphs are connected if we undirect the edges. x∈X f (x) for X ⊆ U. For example, if G is edge weighted, i.e., there exists a function w : E → R, then w(E ) denotes (cid:48) ⊆ E. Similarly, if G is node-weighted, then there the total weight of the edges in E exists a function f : V → R and f (S) denotes the total weight of the vertices in S ⊆ V. When talking about graphs, we shall slightly abuse notation and sometimes write w(G) instead of w(E) and f (G) instead of f (V) when it is clear from the context that w and f are functions on the edges and vertices. Finally, our subsets of edges are multisets, i.e., may contain the same edge several times. The set operators ∪,∩,\ are defined in the natural way. For example, {e1, e1, e2} ∪ {e1, e2} = {e1, e1, e1, e2, e2},{e1, e1, e2} ∩ {e1, e2} = {e1, e2}, and {e1, e1, e2} \ {e1, e2} = {e1}. Other sets, such as subsets of vertices, will always be simple sets without any multiplicities. (cid:48) 2.2 The (Node-Weighted) Asymmetric Traveling Salesman Problem It will be convenient to define ATSP using the Eulerian point of view, i.e., we wish to find a tour that visits each vertex at least once. As already mentioned in the introduction, this definition is equivalent to that of visiting each city exactly once (in the metric completion) since we assume the triangle inequality. ATSP Given: An edge-weighted (strongly connected) digraph G = (V, E, w : E → R+). is a multisubset of E that Find: A connected Eulerian digraph G (cid:48) ) where E (cid:48) = (V, E (cid:48) (cid:48) minimizes w(E ). Similar to the recent progress on STSP, it is natural to consider special cases that are easier to argue about but at the same time capture the combinatorial structure of the problem. In particular, we shall consider the Node-Weighted ATSP, where we assume that there exists a weight function f : V → R+ on the vertices so that w(u, v) = f (u). (Another equivalent definition, which also applies to undirected graphs, is to let the weight of an edge (u, v) be f (u) + f (v). This is equivalent to the definition above, if scaled down by a factor of 2, since the solutions are Eulerian.) Note that this generalizes ATSP on shortest path metrics of unweighted digraphs: that is the problem where f is the constant function. As a curiosity, we also note that the recent progress on STSP when restricted to shortest path metrics of unweighted graphs is not known to generalize to the node-weighted case. We raise this as an interesting open problem in Section 6. 6 2.3 Held-Karp Relaxation The Held-Karp relaxation has a variable xe (cid:62) 0 for every edge in the given edge- weighted graph G = (V, E, w). The intended solution is that xe should equal the number of times e is used in the solution. The relaxation LP(G) is now defined as follows: minimize subject to (cid:88) xew(e) e∈E x(δ+(v)) = x(δ− x(δ+(S)) (cid:62) 1 x (cid:62) 0. (v)) v ∈ V, ∅ (cid:44) S ⊂ V, program as(cid:80) The first set of constraints says that the in-degree should equal the out-degree for each vertex, i.e., the solution should be Eulerian. The second set of constraints enforces that the solution is connected and they are sometimes referred to as subtour elimination constraints. For Node-Weighted ATSP, we can write the objective function of the linear v∈V f (v) · x(δ+(v)), where f : V → R+ is the weights on the vertices that Finally, we remark that although the Held-Karp relaxation has exponentially many constraints, it is well known that we can solve it in polynomial time either by using the ellipsoid method with a separation oracle or by formulating an equivalent compact (polynomial size) linear program. defines the node-weighted metric. 3 ATSP with Local Connectivity In this section we define a seemingly easier problem than ATSP by relaxing the connectivity requirements. Consider an optimal solution x to LP(G). Its value, which is a lower bound on OPT, can be decomposed into a “lower bound” for each vertex v: ∗ (cid:88) e∈E ∗ ew(e) = x (cid:88) v∈V (cid:88) (cid:124)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:123)(cid:122)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:125) ∗ ew(e). x e∈δ+(v) lower bound for v lbx∗,G(v) =(cid:80) With this intuition, we let lb : V → R be the lower bound function defined by ∗ ew(e). We simplify notation and write lb instead of lbx∗,G as G will ∗ always be clear from the context and therefore also x (if the optimal solution to LP(G) is not unique then make an arbitrary but consistent choice). Note that lb(V) equals the value of the optimal solution to the Held-Karp relaxation. e∈δ+(v) x Perhaps the main difficulty of ATSP is to satisfy the connectivity requirement, i.e., to select a Eulerian subset F of edges that connects the whole graph. We shall now relax this condition to obtain what we call Local-Connectivity ATSP: 7 Local-Connectivity ATSP Given: An edge-weighted (strongly connected) digraph G = (V, E, w) and a parti- tioning V1 ∪ V2 ∪ . . . ∪ Vk of the vertices that satisfy: the graph induced by Vi is strongly connected for i = 1, . . . , k. Find: A Eulerian multisubset F of E such that δ+ F (Vi) (cid:62) 1 for i = 1, 2, . . . , k and max G∈C(F) w( G) lb( G) is minimized. Recall that C(F) denotes the set of connected components of the graph (V, F). We remark that the restriction that each Vi should induce a strongly connected component is not necessary but it makes our proofs in Section 4 easier. We say that an algorithm for Local-Connectivity ATSP is α-light if it is guaranteed (over all instances) to find a solution F such that max G∈C(F) w( G) lb( G) (cid:54) α. (3.1) We also say that an algorithm is α-light on an ATSP instance G = (V, E, w) if, for each partitioning V1 ∪ . . . ∪ Vk of V (such that Vi induces a strongly connected graph), it returns a solution satisfying (3.1). We remark that we use the α-light terminology to avoid any ambiguities with the concept of approximation algorithms because an α-light algorithm does not compare its solution with respect to an optimal solution to the given instance of Local-Connectivity ATSP. An α-approximation algorithm for ATSP with respect to the Held-Karp relaxation is trivially an α-light algorithm for Local-Connectivity ATSP: output the same Eulerian subset F as the algorithm for ATSP. Since the set F connects the graph we have max G∈C(F) w( G)/ lb( G) = w(F)/ lb(V) (cid:54) α. Moreover, Local-Connectivity ATSP seems like a significantly easier problem than ATSP as the Eulerian set of edges only needs to cross k cuts formed by a partitioning of the vertices. We substantiate this intuition by proving, in Section 4, that there exists a simple 3-approximation for Local-Connectivity ATSP on shortest path metrics of node-weighted graphs. We refer to this case as Node-Weighted Local-Connectivity ATSP. Perhaps more surprisingly, we show in Section 5 that any α-light algorithm for Local-Connectivity ATSP can be turned into an algorithm for ATSP with an approximation guarantee of 5α with respect to the same lower bound (from the Held-Karp relaxation). Remark 3.1. Our generic reduction from ATSP to Local-Connectivity ATSP (Theorem 5.1) is robust with respect to the definition of lb and there are many possibilities to define ∗ ew(e)/2. In fact, in order to get a constant bound on the integrality gap of the Held-Karp relaxation, our results say that it is enough to find an O(1)-light algorithm for Local-Connectivity ATSP with respect to some nonnegative lb that only needs to satisfy that lb(V) is at most the value of the optimal solution to the LP. Even more generally, if lb(V) is at most the value of an optimal tour then our methods would give a similar approximation guarantee (but not with respect to the Held-Karp relaxation). such a lower bound. Another natural example is lb(v) =(cid:80) e∈δ+(v)∪δ−(v) x 8 V1 V2 A1 A2 (cid:48) Figure 1: A depiction of the construction of the auxiliary graph G (in the proof of Theorem 4.1): edges are subdivided, an auxiliary vertex Ai is added for each partition Vi, and Ai is “connected” to subdivisions of the edges in δ+(Vi) and δ− (Vi). 4 Approximating Local-Connectivity ATSP We give a simple 3-light algorithm for Node-Weighted Local-Connectivity ATSP. The proof is based on finding an integral circulation that sends flow across the cuts {(Vi, ¯Vi) : i = 1, 2, . . . , k} and, in addition, satisfies that the outgoing flow of each vertex (δ+(v))(cid:101) + 1 which in turn, by the assumptions on the metric, implies v ∈ V is at most (cid:100)x ∗ a 3-light algorithm. Theorem 4.1. There exists a polynomial time 3-light algorithm for Node-Weighted Local- Connectivity ATSP. Proof. Let G = (V, E, w) and V1 ∪ V2 ∪ . . . ∪ Vk be an instance of Local-Connectivity ATSP where w : E → R+ is a node-weighted metric defined by f : V → R+. Let also x ∗ be an optimal solution to LP(G). We prove the theorem by giving a polynomial time algorithm that finds a Eulerian multisubset F of E satisfying ∗ (4.1) F (v) (cid:54) (cid:100)x (δ+(v))(cid:101) + 1 for v ∈ V. δ+ F (Vi) (cid:62) 1 for i = 1, . . . , k and δ+ To see that this is sufficient, note that the Eulerian set F forms a solution to the Local- F (Vi) (cid:62) 1 for i = 1, . . . , k; and it is 3-light since, Connectivity ATSP instance because δ+ (cid:80) for each G = ( V, E) ∈ C(F), we have (using that it is a node-weighted metric) (cid:80) (cid:80) δ+ E(v) f (v) v∈ V v∈ V x∗(δ+(v)) f (v) (δ+(v))(cid:101) + 1) f (v) (cid:80) v∈ V((cid:100)x ∗ v∈ V x∗(δ+(v)) f (v) (δ+(v)) (cid:62) 1 and therefore (cid:100)x ∗ (cid:54) ∗ The last inequality follows from x (δ+(v)). We proceed by describing a polynomial time algorithm for finding a Eulerian set F obtained satisfying (4.1). We shall do so by finding a circulation in an auxiliary graph G from G as follows (see also Figure 1): (δ+(v))(cid:101) + 1 (cid:54) 3x ∗ (cid:48) w( G) lb( G) = (cid:54) 3. 1. Replace each edge e = (u, v) in G by adding vertices Oe, Ie and edges (u, Oe), (Oe, Ie), (Ie, v); every e ∈ δ+(Vi) and (Ie, Ai) for every e ∈ δ− (Vi). 2. For each partition Vi, i = 1, . . . , k, add an auxiliary vertex Ai and edges (Ai, Oe) for 9 (cid:48) Recall that a circulation in G satisfying flow conservation: y(δ+(v)) = y(δ− (cid:48) claim follows from the construction of G circulations. (cid:48) Claim 4.2. We can in polynomial time find an integral circulation y in G is a vector y with a nonnegative value for each edge (v)) for every vertex v. The following together with basic properties of flows and satisfying: and y(δ+(v)) (cid:54) (cid:100)x ∗ to LP(G) to define a fractional circulation y y(δ+(Ai)) = 1 for i = 1, . . . , k ∗ (cid:48) Proof. We use the optimal solution x in G that satisfies the above degree bounds. As the vertex-degree bounds are integral, it follows from basic facts about flows that we can in polynomial time find an integral circulation y satisfying the same bounds (see e.g. Chapter 11 in [18]). Circulation y is defined as follows: (δ+(v)(cid:101) for v ∈ V. (cid:48) (cid:48) 1. for each edge e = (u, v) in G with u, v ∈ Vi: (cid:48) y (u,Oe) (cid:48) = y (Oe,Ie) x∗(δ+(Vi)) 2. for each edge e = (u, v) in G with u ∈ Vi, v ∈ Vj where i (cid:44) j: = y = x (cid:48) (Ie,v) ∗ (u,v) 1 (cid:32) 1 − (cid:33) . (cid:48) y (Oe,Ie) (cid:48) y (Ai,Oe) (cid:48) (Ie,Aj) y , ∗ = x (u,v) ∗ x (u,v) = x∗(δ+(Vi)) ∗ (u,v) x = x∗(δ+(Vj)) , , (cid:48) y (u,Oe) (cid:48) y (Ie,v) ∗ = x (u,v) ∗ = x (u,v) (cid:32) 1 − (cid:32) 1 − (cid:33) (cid:33) x∗(δ+(Vi)) 1 1 x∗(δ+(Vj)) , . (cid:48) ∗ ∗ is defined so that a fraction 1/x (δ+(Vi)) of the flow crossing the cut Basically, y (Vi, V \ Vi) goes through Ai. As x (cid:48) (δ+(Vi)) (cid:62) 1 we have that y is nonnegative. It is also (cid:48) immediate from the definition of y that it satisfies flow conservation and the degree bounds of the claim: the in- and out-flow of a vertex v ∈ Vi is (δ+(v)); the in- and out-flow of an auxiliary vertex Ai is 1 by design; and the in- and out-flow of Oe and Ie for e = (u, v) is (1 − 1/x e if u, v ∈ Vi for some i = 1, . . . , k and ∗ (δ+(Vi)))x ∗ (cid:48) x e otherwise. As mentioned above, the existence of fractional circulation y implies that we can also find, in polynomial time, an integral circulation y with the required (cid:3) properties. x∗(δ+(Vi)) 1 − ∗ x (cid:16) (cid:17) ∗ 1 Having found an integral circulation y as in the above claim, we now obtain the Eulerian subset F of edges. Initially, the set F contains y(Oe,Ie) multiplicities of each edge e in G. Note that with respect to this edge set, in each partition Vi, either all vertices in Vi are balanced (each vertex’s in-degree equals its out-degree) or there exist exactly one vertex u so that δ+ F (u) − δ− F (v) = 1. Specifically, let u be the head of the unique edge e such that y(Ie,Ai) = 1 and let v be the (cid:48) so that y(Ai,Oe(cid:48) ) = 1. If u = v then all vertices in Vi are balanced. tail of the unique edge e F (u) = −1 and one vertex v so that δ+ F (v) − δ− 10 F (v) − δ− F (u) − δ− F (u) = −1 and v is so that δ+ F (v) = 1. In that Otherwise u is so that δ+ case, we add a simple path from u to v to make the in-degrees and out-degrees of these vertices balanced. As the graph induced by Vi is strongly connected, we can select the path so that it only visits vertices in Vi. Therefore, we only increase the degree of vertices in Vi by at most 1. Hence, after repeating this operation for each partition Vi, we have that F is a Eulerian subset of edges and δF(δ+(v)) (cid:54) y(δ+(v)) + 1 (cid:54) (cid:100)x (δ+(v))(cid:101) + 1 for all ∗ v ∈ V. Finally, we have δ+ F (Vi) (cid:62) 1 for each i = 1, . . . , k because yAi,Oe = 1 (and therefore (cid:62) 1) for one edge e ∈ δ+(Vi). We have thus given a polynomial time algorithm that yOe,Ie finds a Eulerian subset F satisfying the properties of (4.1), which, as discussed above, implies that it is a 3-light algorithm for Node-Weighted Local-Connectivity ATSP. (cid:3) 5 From Local to Global Connectivity In this section, we prove that if there is an α-light algorithm for Local-Connectivity ATSP, then there exists an algorithm for ATSP with an approximation guarantee of O(α). The main theorem can be stated as follows. Theorem 5.1. Let A be an algorithm for Local-Connectivity ATSP and consider an ATSP instance G = (V, E, w). If A is α-light on G, there exists a tour of G with value at most 5α lb(V). Moreover, for any ε > 0, a tour of value at most (9 + ε)α lb(V) can be found in time polynomial in the number n = V of vertices, in 1/ε, and in the running time of A. Throughout this section, we let G = (V, E, w) and A be fixed as in the statement of the theorem. The proof of the theorem is by giving an algorithm that uses A as a subroutine. We first give the non-polynomial algorithm in Section 5.1 (with the better guarantee) followed by Section 5.2 where we modify the arguments so that we also efficiently find a tour (with slightly worse guarantee). 5.1 Existence of a Good Tour Before describing the (non-polynomial) algorithm, we need to introduce the concept of Eulerian partition. We say that graphs H1 = (V1, E1), H2 = (V2, E2), . . . , Hk = (Vk, Ek) form a Eulerian partition of G if the vertex sets V1, . . . , Vk form a partition of V and each Hi is a connected Eulerian graph where Ei is a multisubset of E. It is an β-light Eulerian partition if in addition w(Hi) (cid:54) β · lb(Hi) for i = 1, . . . , k. Our goal is to find a 5α-light Eulerian partition that only consists of a single component, i.e., a 5α-approximate solution to the ATSP instance G with respect to the Held-Karp relaxation. The idea of the algorithm is to start with a Eulerian partition and then iteratively merge/connect these connected components into a single connected component by adding (cheap) Eulerian subsets of edges. Note that, since we will only add Eulerian subsets, the algorithm always maintains that the connected components are Eulerian. that contains the ∗ The state of the algorithm is described by a Eulerian multiset E multiplicities of the edges that the algorithm has picked. 11 ∗ Initialization. The algorithm starts with a 2α-light Eulerian partition H 1 (V ∗ , E k) that maximizes the lexicographic order of ∗ ∗ 1), . . . , H k ∗ = (V k , E ∗ 1 = (cid:104)lb(H ∗ 1), lb(H ∗ 2), . . . , lb(H k)(cid:105). ∗ (5.1) ∗ 1) (cid:62) lb(H 2) (cid:62) ··· (cid:62) lb(H ∗ As the lexicographic order is maximized, the Eulerian partitions are ordered so that ∗ lb(H k). For simplicity, we assume that these inequalities are strict ∗ (which is w.l.o.g. by breaking ties arbitrarily but consistently). The set E is initialized ∪ ··· ∪ E ∪ E ∗ ∗ so that it contains the edges of the Eulerian partitions, i.e., E k. 2 a connected subgraph G = ( V, E) of G, let low( G) denote the Eulerian partition H lowest index i that intersects G3. That is, During the execution of the algorithm we will also use the following concept. For ∗ i of ∗ = E ∗ 1 low( G) = H ∗ min{i:V∗ i ∩ V(cid:44)∅}. ∗ , . . . , H ∗ ∗ k. This means that H i ). Moreover, as the algorithm will only add edges, each H Note that after initialization, the connected components in C(E ∗ ) are exactly the ∗ = low( G) for exactly one component subgraphs H G ∈ C(E ∗ 1 i will be in at most one component throughout the execution. Remark 5.2. The main difference in the polynomial time algorithm is the initialization since we do not know how to find a 2α-light Eulerian partition that maximizes the lexicographic order in polynomial time. Indeed, it is consistent with our knowledge that 2α (even 2) is an upper bound on the integrality gap and, in that case, such an algorithm would always find a tour. Remark 5.3. For intuition, let us mention that the reason for starting with a Eulerian partition that maximizes the lexicographic order is that we will use the following properties to bound the weight of the total tour: 1. A connected Eulerian subgraph H of G with w(H) (cid:54) 2α lb(H) has lb(H) (cid:54) lb(low(H)). 2. For any disjoint connected Eulerian subgraphs H1, H2, . . . , H(cid:96) of G with low(Hj) = ∗ i and w(Hj) (cid:54) α lb(Hj) for j = 1, . . . , (cid:96), we have H (cid:96)(cid:88) j=1 lb(Hj) (cid:54) 2 lb(H ∗ i ). These bounds will be used to bound the weight of the edges added in the merge procedure. Their proofs are easy and can be found in the analysis (see the proofs of Claim 5.8 and Claim 5.9). 3Equivalently, it is the set H ∗ i maximizing lb(H ∗ i ) over all sets in the Eulerian partition that intersect G. 12 ∗ F ( V) (cid:62) 1 for all ( V, E) ∈ C(E ∗ Merge procedure. The algorithm repeats the following “merge procedure” until C(E ∗ ) contains a single connected component. The components in C(E ) partition the vertex ∗ set and each component is strongly connected as it is Eulerian (since E is a Eulerian subset of edges). The algorithm can therefore use A to find a Eulerian multisubset F of E such that (i) δ+ ); and (ii) for each G ∈ C(F) we have w( G) (cid:54) α lb( G). Note that A is guaranteed to find such a set since it is assumed to be an α-light algorithm for Local-Connectivity ATSP on G. Furthermore, we may assume that no connected component in C(F) is completely contained in a connected component in C(E ∗ ) (except for the trivial components formed by singletons). Indeed, the edges of such a component can safely be removed from F and we have a new (smaller) multiset that satisfies the above conditions. Having selected F, we now proceed to explain the “update phase”: U1: Let X = ∅. U2: Select the component G = ( V, E) ∈ C(E U3: If there exists a cycle C = (VC, EC) in G of weight w(C) (cid:54) α lb(low( G)) that connects ∗ ∪ F ∪ X), then add EC to X and repeat from ∗∪( E∩F)∪( E∩X). G to another component in C(E Step U2. ∗ ∪ F ∪ X) that minimizes lb(low( G)). by adding the “new” edges in E, i.e., E ∗ U4: Otherwise, update E ∗ ← E ∗ ∗ 6 ∗ , H 9 ∗ , H 7 ∗ Some comments about the update of E are in order. We emphasize that we do not add all edges of F ∪ X to E ∗ . Instead, we only add those new edges that belong to the component G selected in the final iteration of the update phase. As G is a connected component in C(E ∗ ∪ F ∪ X), F and X are Eulerian subsets of edges, we have that E remains Eulerian after the update. This finishes the description of the merging procedure and the algorithm (see also the example below). Example 5.4. In Figure 2, we have that, at the start of a merging step, C(E ∗ ) consists of 6 components containing {H }, and {H },{H },{H }. The blue ∗ ∗ 1 4 (solid) cycles depict the connected Eulerian components of the edge set F. First, we set X = ∅ and the algorithm selects the component G in C(E ∗ ∪ F ∪ X) that minimizes lb(low( G)) or, equivalently, that maximizes min{i : H i intersects G}. In this example, it ∗ would be the left most of the three components in C(E ∗ 4. The algorithm now tries to connect this component to another component by adding a ∗ cycle with weight at most α lb(H 4). The red (dashed) cycle corresponds to such a cycle and its edge set is added to X. In the next iteration, the algorithm considers the two ∗ ∪ F ∪ X). The smallest component (with respect to lb(low( G))) is components in C(E ∗ ∗ the one that contains H 8. Now suppose that there is no cycle of weight at ∗ 3 most α lb(H is updated by adding those edges of F ∪ X that belong to this component (depicted by the thick cycle). ∗ 3) that connects this component to another component. Then the set E ∗ ∪ F) with low( G) = H ∗ 5, and H },{H },{H ∗ 10 , H , H ∗ 3 ∗ 5 ∗ , H 8 ∗ 2 13 ∗ H 9 ∗ 6 H ∗ 10 H ∗ H 7 ∗ H 4 ∗ H 3 ∗ H 2 ∗ H 5 ∗ H 8 ∗ H 1 Figure 2: An illustration of the merge procedure. Blue (solid) cycles depict F and the red (dashed) cycle depicts X after one iteration of the update phase. The thick cycle represents the edges that this merge procedure would add to E ∗ . 5.1.1 Analysis Termination. We show that the algorithm terminates by arguing that the update phase terminates with fewer connected components and the merge procedure is therefore repeated at most k (cid:54) n times. Lemma 5.5. The update phase terminates in polynomial time and decreases the number of connected components in C(E ∗ Proof. First, observe that each single step of the update phase can be implemented in polynomial time. The only nontrivial part is Step U3 which can be implemented as follows: for each edge (u, v) ∈ δ+( V) consider the cycle consisting of (u, v) and a shortest path from v to u. Moreover, the whole update phase terminates in polynomial time because each time the if-condition of Step U3 is satisfied, we add a cycle to X that decreases the number of connected components in C(E ∗ ∪ F ∪ X). The if-condition of Step U3 can therefore be satisfied at most k (cid:54) n times. We proceed by proving that at termination the update phase decreases the number of connected components in C(E ). Consider when the algorithm reaches Step U4. In ∗ ∪ F ∪ X). Note that G (cid:60) C(E that case it has selected a component G = ( V, E) ∈ C(E ∗ ) because the edge set F crosses each cut defined by the vertex sets of the connected components in C(E by adding all the edges (F ∪ X) ∩ E it decreases the number of components in C(E (cid:3) ∗ ). Therefore when the algorithm updates E ) by at least one. ∗ ). ∗ ∗ Performance Guarantee. To analyze the performance guarantee we shall split our analysis into two parts. Note that when one execution of the merge procedure terminates (Step U4) we add edge set (F ∩ E) ∪ (X ∩ E) to our solution. We shall analyze the contribution of these two sets F ∩ E and X ∩ E separately. More formally, suppose that the algorithm does T repetitions of the merge procedure. Let G1 = ( V1, E1), G2 = ( V2, E2), . . . , GT = ( VT, ET), F1, F2, . . . , FT, and X1, X2, . . . , XT denote the 14 + + w w i=1 t=1 t=1 Ft Xt w(H k(cid:88) (cid:54)α lb(V) by Lemma 5.6 (cid:54)2α lb(V) by Lemma 5.7 With this notation, we proceed to bound the total weight of the solution by selected components, the edge set F, and the edge set X, respectively, at the end of each ∗ repetition. To simplify notation, we denote the edges added to E in the t:th repetition by Ft = Ft ∩ Et and Xt = Xt ∩ Et. (cid:16)∪T (cid:17) (cid:124)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:123)(cid:122)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:125) (cid:16)∪T (cid:16)∪T (cid:17) (cid:124)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:123)(cid:122)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:125) Here we used that(cid:80)k ∗ i ) (cid:54) 5α lb(V) as claimed in Theorem 5.1. Lemma 5.6. We have w Proof. Note that Xt consists of a subset of the cycles added to Xt in Step U3 of the update phase. Specifically, those cycles contained in the connected component Gt selected at Step U2 in the last iteration of the update phase during the t:th repetition of the merge procedure. We can therefore decompose ∪T Xt into cycles C1 = (V1, E1), C2 = (V2, E2), . . . , Cc = (Vc, Ec) indexed in the order they were added by the algorithm. When Cj was selected in Step U3 of the update phase, it satisfied the following two properties: (i) it connected the component G selected in Step U2 with at least one other component ∗ k is a 2α-light Eulerian partition. (cid:17) (cid:54) α lb(V). It remains to prove Lemmas 5.6 and 5.7. ∗ ∗ i ) (cid:54) 2α lb(V) since H 1 i=1 w(H , . . . , H Xt t=1 t=1 (cid:48) G (cid:48) such that lb(low( G )) > lb(low( G)); and (ii) it had weight w(Cj) at most α lb(low( G)). In this case, we say that Cj marks low( G). ∗ We claim that at most one cycle in C1, C2, . . . , Cc marks each H 1 ∗ k. To see ∗ i (if any). By (i) above, when Cj was this, consider the first cycle Cj that marks H (cid:48) )) > lb(low( G)) added, it connected two components G and G where low( G) = H will remain connected throughout the execution of the algorithm. Therefore, by the definition of low and by the fact that lb(low( G appearing later in the algorithm always has low( G ∗ i and such a cycle (cid:3) ∗ i . As the algorithm only adds edges, G and G ∗ , H 2 (cid:48) such that lb(low( G The bound now follows from that at most one cycle marks each H ∗ ∗ i . Hence, no other cycle marks H i . )) > lb(low( G)), we have that a component G has weight at most α lb(H , . . . , H ) (cid:44) H (cid:48)(cid:48) (cid:48)(cid:48) (cid:48) (cid:48) We complete the analysis of the performance guarantee with the following lemma. ∗ i ). (cid:16)∪T (cid:17) (cid:54) 2α lb(V). Ft t=1 Lemma 5.7. We have w Proof. Consider the t:th repetition of the merge procedure. The edge set Ft is Eulerian but not necessarily connected. Let F t denote the set of the Eulerian subgraphs corresponding to the connected components in C( Ft) where we disregard the trivial , . . . ,F t components that only consist of a single vertex. Further, partition F t into F t where F t ∗ k i and do not intersect ∗ any of the subgraphs H 1 i contains those Eulerian subgraphs in F t that intersect H ∗ i−1. That is, ∗ , H 2 ,F t 1 2 , . . . , H F t i = {H ∈ F t : low(H) = H }. ∗ i 15 Note that the total weight of Ft, w( Ft), equals w(F t) =(cid:80)k i=1 w(F t ∗ i ). ∗ i−1 ∗ , H 2 , . . . , H , . . . , H i , we have lb(H) (cid:54) lb(low(H)) = lb(H i ). We bound the weight of F t by considering each F t i separately. We start by two simple claims that follow from that each H ∈ F t satisfies w(H) (cid:54) α lb(H) (since A is an α-light algorithm) and ∗ ∗ the choice of H k to maximize the lexicographic order of (5.1). We remark that 1 the proofs of the following claims are the only arguments that use the fact that the lexicographic order was maximized. Claim 5.8. For H ∈ F t ∗ i ) together with the fact that w(H) (cid:54) α lb(H) (cid:54) 2α lb(H) Proof. Inequality lb(H) > lb(H ∗ ∗ , . . . , H would contradict that H k was chosen to maximize the lexicographic order of (5.1). 1 Indeed, in that case, a 2α-light Eulerian partition of higher lexicographic order would ∗ , H and the remaining vertices (as trivial singleton components) that be H 1 (cid:3) do not belong to any of these Eulerian subgraphs. Claim 5.9. We have lb(F t = {H1, H2, . . . , H(cid:96)} Proof. Suppose toward contradiction that lb(F t ∗ and define H i and ∗ H1, . . . , H(cid:96). Consider the Eulerian partition H and the remaining vertices 1 (as trivial singleton components) that do not belong to any of these Eulerian subgraphs. ∗ We have lb(H i ) and therefore the lexicographic value of this Eulerian partition ∗ ∗ is larger than the lexicographic value of H k. This is a contradiction if it is also a 1 ∗ 2α-light Eulerian partition, i.e., if w(H ) (cid:54) 2α. lb(H∗) ∗ ). By the facts that w(Hj) (cid:54) α lb(Hj) (since ) > 2α lb(H A is an α-light algorithm) and that H ∗ ∗ , . . . , H k is a 2α-light Eulerian partition, 1 i ). Let F t ∗ i ) > 2 lb(H ∗ , H , . . . , H to be the Eulerian graph obtained by taking the union of the graphs H Therefore, we must have w(H i ) (cid:54) 2 lb(H ) > lb(H , . . . , H ∗ i−1 ∗ i ). ∗ ∗ ∗ i ∗ w(H ) = w(H ∗ i ) + w(Hj) (cid:54) 2α lb(H ∗ i ) + α lb(Hj) and (cid:96)(cid:88) j=1 ) > 2α lb(H ∗ ) imply lb(F t (cid:96)(cid:88) j=1 (cid:16)∪T k(cid:88) (cid:17) (cid:88) Ft as t=1 lb(Hj). j=1 lb(Hj) (cid:54) (cid:3) ∗ j=1 ) (cid:62) lb(H (cid:96)(cid:88) i ) = (cid:80)(cid:96) (cid:88) k(cid:88) These inequalities together with w(H 2 lb(H ∗ i ). ∗ Using the above claim, we can write w T(cid:88) k(cid:88) T(cid:88) k(cid:88) w(F t i ) (cid:54) α lb(F t i ) = α lb(F t i ) (cid:54) 2α lb(H ∗ i ). i i i=1 i=1 i=1 i=1 t=1 t=1 (cid:44)∅ t:F t t:F t (cid:44)∅ We complete the proof of the lemma by using Claim 5.8 to prove that F t i is non-empty for at most one repetition t of the merge procedure. Suppose toward contradiction that there exist 1 (cid:54) t0 < t1 (cid:54) T so that both F t0 (cid:44) ∅. In the t0:th repetition of ∗ i is contained in the subgraph Gt0 since otherwise no edges the merge procedure, H ∗ incident to H i ). Now consider a Eulerian subgraph H ∈ F t1 . First, we cannot have that H is contained in the component Gt0 since each (nontrivial) component of F is assumed to not be contained in any component of C(E ∗ i ). (cid:44) ∅ and F t1 ∗ ∗ i would have been added to E ). Second, by Claim 5.8, we have w(H) (cid:54) α lb(H) (cid:54) α lb(H . Therefore lb(low( Gt0)) (cid:62) lb(H ∗ i i i 16 In short, H is a Eulerian subgraph that connects Gt0 to another component and it has weight at most α lb(low( Gt0)). As H is Eulerian, it can be decomposed into cycles. One of these cycles, say C, connects Gt0 to another component and w(C) (cid:54) w(H) (cid:54) α lb(H ∗ i ) (cid:54) α lb(low( Gt0)). (5.2) In other words, there exists a cycle C that, in the t0:th repetition of the merge procedure, satisfied the if-condition of Step U3, which contradicts the fact that Step U4 was reached (cid:3) when component Gt0 was selected. 5.2 Polynomial Time Algorithm In this section we describe how to modify the arguments in Section 5.1 to obtain an algorithm that runs in time polynomial in the number n of vertices, in 1/ε, and in the running time of A. By Lemma 5.5, the update phase can be implemented in polynomial time in n. Therefore, the merge procedure described in Section 5.1 runs in time polynomial in n and in the running time of A. The problem is the initialization: as mentioned in Remark 5.2, it seems difficult to find a polynomial time algorithm for finding a 2α-light ∗ Eulerian partition H 1 , . . . , H ∗ k that maximizes the lexicographic order of (cid:104)lb(H ∗ 2), . . . , lb(H ∗ 1), lb(H k)(cid:105). ∗ We overcome this obstacle by first identifying the properties that we actually use from selecting the Eulerian partition as above. We then show that we can obtain a Eulerian partition that satisfies these properties in polynomial time. As mentioned in the analysis in Section 5.1, the only place where we use that the Eulerian partition maximizes the lexicographic order of (5.1) is in the proof of Lemma 5.7. Specifically, it is used in the proofs of Claims 5.8 and 5.9. Instead of proving these claims, we shall simply concentrate on finding a Eulerian partition that satisfies a relaxed variant of them (formalized in the lemma below, see Condition (5.3)). The claimed polynomial time algorithm is then obtained by first proving that a slight modification of the merge procedure returns a tour of value at most (9α + 2ε) lb(V) if Condition (5.3) holds, and then we show that a Eulerian partition satisfying this condition can be found in time polynomial in n and in the running time of A. We start by describing the modification to the merge procedure. Modified merge procedure. The only modification to the merge procedure in Sec- tion 5.1 is that we change the update phase by relaxing the condition of the if-statement in Step U3 from w(C) (cid:54) α lb(low( G)) to w(C) (cid:54) α(3 lb(low( G)) + ε lb(V)/n). In other words, Step U3 is replaced by U3’: If there exists a cycle C = (VC, EC) in G of weight w(C) (cid:54) α(3 lb(low( G)) +ε lb(V)/n) ∗ ∪ F ∪ X), then add EC to X and that connects G to another component in C(E repeat from Step U2. 17 Clearly the modified merge procedure still runs in time polynomial in n and in the running time of A. Moreover, we show that if Condition (5.3) holds then the returned tour will have weight O(α). Recall from Section 5.1 that Ft denotes the subset of F and Xt denotes the subset of X that were added in the t:th repetition of the (modified) merge procedure. Furthermore, we define (as in the previous section) F t ∗ i and H is a nontrivial component, i.e., H contains more than one vertex}. Lemma 5.10. Assume that the algorithm is initialized with a 3α-light Eulerian partition ∗ ∗ k so that, in each repetition t of the modified merge procedure, we add a subset Ft H 1 such that = {H ∈ C( Ft) : low(H) = H , . . . , H ∗ , H 2 i lb(F t i ) (cid:54) 3 lb(H ∗ i ) + ε lb(V) n for i = 1, 2, . . . , k. (5.3) Then the returned tour has weight at most (9 + 2ε)α lb(V). Let us comment on the above statement before giving its proof. The reason that we use a 3α-light Eulerian partition (instead of one that is 2α-light) is that it leads to a better constant when balancing the parameters. We also remark that (5.3) is a relaxation of the bound of Claim 5.9 from lb(F t ∗ i ) + ε lb(V)/n; and it also ∗ implies a relaxed version of Claim 5.8: from lb(H) (cid:54) lb(H i )+ε lb(V)/n. It is because of this relaxed bound that we modified the if-condition of the update phase (by relaxing it by the same amount) which will be apparent in the proof. ∗ i ) to lb(H) (cid:54) 3 lb(H i ) to lb(F t ∗ i ) (cid:54) 3 lb(H i ) < 2 lb(H Proof. As in the analysis of the performance guarantee in Section 5.1, we can write the weight of the returned tour as (cid:16)∪T (cid:17) (cid:16)∪T w Ft t=1 + w Xt t=1 + (cid:17) k(cid:88) i=1 w(H ∗ i ). (cid:16)∪T (cid:17) Xt To bound w except that the weight of a cycle C that marks H instead of by α lb(H update phase). Hence, w k (cid:54) n. , we observe that proof of Lemma 5.6 generalizes verbatim ∗ t=1 i )+ε lb(V)/n) ∗ i ) (because of the relaxation of the bound in the if-condition of the ∗ i ) + ε lb(V)/n) (cid:54) (3 + ε)α lb(V) because ∗ i is now bounded by α(3 lb(H (cid:16)∪T α(3 lb(H t=1 i=1 We proceed to bound w . Using the same arguments as in the proof of Xt (cid:17) (cid:54)(cid:80)k (cid:17) (cid:16)∪T (cid:88) Ft t=1 i=1 (cid:44)∅ t:F t i Lemma 5.7, w (cid:16)∪T Ft t=1 (cid:17) (cid:54) α k(cid:88) lb(F t i ) (cid:54) α 3 lb(H ∗ i ) + ε lb(V)/n k(cid:88) (cid:88) (cid:16) i=1 (cid:44)∅ t:F t i (cid:17) where, for the last inequality, we used the assumption of the lemma. Now we apply exactly the same arguments as in the end of the proof of Lemma 5.7 to prove that F t i is non-empty for at most one repetition t of the merge procedure. The only difference, is that (5.2) should be replaced by w(C) (cid:54) w(H) (cid:54) α(3 lb(H ∗ i ) + ε lb(V)/n) (cid:54) α(3 lb(low( Gt0)) + ε lb(V)/n) 18 (because (5.3) can be seen as a relaxed version of Claim 5.8). However, as we also updated the bound in the if-condition, the argument that C would satisfy the if-condition of Step U3’ is still valid. Hence, we conclude that F t is non-empty in at most one repetition and therefore i (cid:16)∪T w Ft t=1 (cid:17) (cid:54) α k(cid:88) (cid:88) (cid:16) i=1 (cid:44)∅ t:F t i (cid:17) (cid:54) (3 + ε)α lb(V). 3 lb(H ∗ i ) + ε lb(V)/n ∗ By the above bounds and since H 1 ∗ , H 2 have that the weight of the returned tour is , . . . , H ∗ k is a 3α-light Eulerian partition, we (cid:16)∪T (cid:17) (cid:16)∪T w Ft t=1 + w Xt t=1 + (cid:17) k(cid:88) i=1 w(H ∗ i ) (cid:54) (3 + ε)α lb(V) + (3 + ε)α lb(V) + 3α lb(V) = (9 + 2ε)α lb(V). (cid:3) Finding a good Eulerian partition in polynomial time. By the above lemma, it is sufficient to find a 3α-light Eulerian partition so that Condition (5.3) holds during the execution of the modified merge procedure. However, how can we do it in polynomial time? We do as follows. First, we select the trivial 3α-light Eulerian partition where each subgraph is only a single vertex. Then we run the modified merge procedure and, in each repetition, we verify that Condition (5.3) holds. Note that this condition is easy to verify in time polynomial in n. If it holds until we return a tour, then we know by Lemma 5.10 that the tour has weight at most (9 + 2ε)α lb(V). If it does not hold during one repetition, then we will restart the algorithm with a new 3α-light Eulerian partition that we find using the following lemma. We continue in this manner until the merge procedure executes without violating Condition (5.3) and therefore it returns a tour of weight at most (9α + 2ε) lb(V). Lemma 5.11. Suppose that repetition t of the (modified) merge procedure violates Condition (5.3) ∗ ∗ ∗ , . . . , H , H when run starting from a 3α-light Eulerian partition H k. Then we can, in time ∗ ∗ ∗ 2 1 , . . . , H , H polynomial in n, find a new 3α-light Eulerian partition H k 2 1 so that k(cid:88) j=1 j)2 − k(cid:88) ∗ j=1 lb( H lb(H ∗ j)2 (cid:62) ε2 3n2 lb(V)2. (5.4) (cid:80)k Note that the above lemma implies that we will reinitialize (in polynomial time) the ∗ ∗ Eulerian partition at most 3n2/ε2 times because any Eulerian partition H k has 1 ∗ i )2 (cid:54) lb(V)2. As each execution of the merge procedure takes time polynomial i=1 lb(H in n and in the running time of A, we can therefore find a tour of weight at most (9 + 2ε)α lb(V) = (9 + ε(cid:48) )α lb(V) in the time claimed in Theorem 5.1, i.e., polynomial in n, 1/ε(cid:48) , and in the running time of A. It remains to prove the lemma. , . . . , H 19 Proof. Since the t:th repetition of the merge procedure violates Condition (5.3), there is an 1 (cid:54) i (cid:54) k such that lb(F t i ) > 3 lb(H ∗ i ) + ε n lb(V). ∗ ∗ ∗ 1 together with a subset of {H We shall use this fact to construct a new 3α-light Eulerian partition consisting of } containing a new Eulerian subgraph H those subgraphs that do not intersect H and finally the vertices (as trivial singleton components) that do not belong to any of these Eulerian subgraphs. We need to define . Let I ⊆ {1, 2, . . . , k} be the indices of those Eulerian subgraphs the Eulerian subgraph H i . Note that, by definition, we have i ∈ I ∗ of H and j (cid:62) i for all j ∈ I. We shall construct the graph H 1 iteratively. Initially, we let H be the connected Eulerian subgraph obtained by taking the union of F t ∗ i and H i . This is a connected Eulerian subgraph as each Eulerian subgraph in F t ∗ ∗ i intersects H i and H i is a connected Eulerian subgraph. k that intersect the vertices in F t ∗ ∗ , . . . , H k , . . . , H ∗ , H 2 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ j ∗ j ) (cid:54) 3α lb(H }j∈I to H ∗ The careful reader can observe that up to now H . Specifically, we would like to add {H is defined in the same way as in the proof of Claim 5.9. However, in order to satisfy (5.4) we shall add more of the Eulerian subgraphs in {H }j∈I(cid:48), ∗ where I ) (because we wish to increase the “potential” in (5.4)) subject to that w(H ) (because the new Eulerian partition should be 3α-light). ∗ To see that w(H (cid:48) ⊆ I \ {i} is selected so as to maximize lb(H ∗ ) (cid:54) 3α lb(H ) implies that the new Eulerian partition is 3α-light, }j(cid:60)I, and recall that the new Eulerian partition consists of H the vertices that do not belong to any of these Eulerian subgraphs. By the definition of I, ∗ no H k are disjoint, it follows that the new Eulerian ∗ ∗ j) (cid:54) 3α lb(H partition consists of disjoint subgraphs. Moreover, each H j) since the Eulerian partition we started with is 3α-light. Hence, the new Eulerian partition is 3α-light if w(H ). Inequality (5.5) is thus a sufficient condition for the new Eulerian partition to be 3α-light. We remark that the condition trivially ∗ i ) > 3 lb(H i ) + ε lb(V)/n. holds for I ∗ Claim 5.12. We have w(H ) if i ) (cid:54) 2 3 ∗ (cid:48) = ∅ because lb(F t (cid:88) , the Eulerian subgraphs {H ∗ j with j (cid:60) I intersects H ) (cid:54) 3α lb(H ∩ F t ∗ j satisfies w(H i ) − lb(H ) (cid:54) 3α lb(H ∩ F t i ). lb(F t , . . . , H . As H lb(H (5.5) ∗ 1 ∗ i ∗ j ∗ j ∗ ∗ ∗ j∈I(cid:48) (cid:88) j∈I(cid:48) ∗ j \ F t i ). lb(H ∗ ) = lb(F t ∗ i ) + lb(H i \ F t i ) + lb(H 20 Proof. We have ∗ w(H ) = w(F t i ) + w(H ∗ i ) + (cid:88) j∈I(cid:48) w(H where the inequality follows from that F t ∗ H 1 ∗ k is a 3α-light Eulerian partition. Moreover, , . . . , H (cid:88) ∗ i ) + 3α i ) + 3α lb(H j) (cid:54) α lb(F t ∗ i was selected by the α-light algorithm A and lb(H ∗ j), j∈I(cid:48) Hence, we have, by rearranging terms and using lb(H w(H ) (cid:54) 3α lb(H ) holds if ∗ ∗ j)− lb(H ∗ ∗ j \F t i ) = lb(H ∗ j ∩F t i ), that ∗ 3α lb(H i ∩ F t i ) + 3α ∗ j ∩ F t i ) (cid:54) 2α lb(F t i ). lb(H (cid:88) j∈I(cid:48) The above can be simplified to(cid:88) ∗ j ∩ F t i ) (cid:54) 2 lb(F t i )/3 − lb(H ∗ i ∩ F t i ). lb(H j∈I(cid:48) (cid:3) (cid:48) ⊆ I \ {i} that satisfies (5.5) From the above discussion, we wish to find a subset I and maximizes ∗ ) = lb(F t ∗ i ) + lb(H i \ F t i ) + lb(H ∗ lb(H i \ F t i ), (cid:88) j∈I(cid:48) (cid:48) where only the last term depends on the selection of I problem that, for each j ∈ I \ {i}, has an item of size sj = lb(H ∩ F t ∗ j i ) − lb(H ∗ pj = lb(H (cid:48) i right-hand-side of (5.5). We solve this knapsack problem and obtain I . We interpret this as a knapsack i ) and profit ∩ F t i ), i.e., the as follows: i ); the capacity U of the knapsack is 2 3 lb(F t \ F t ∗ j 1. Find an optimal extreme point solution z relaxation of the knapsack problem: ∗ to the standard linear programming maximize subject to (cid:88) (cid:88) j∈I\{i} zjpj zjsj (cid:54) U, j∈I\{i} 0 (cid:54) zj (cid:54) 1 for all j ∈ I \ {i}. 2. As the above relaxation has only one constraint (apart from the boundary constraints), the extreme point z has at most one variable with a fractional value. We obtain an integral solution (i.e., a packing) by simply dropping the fractionally packed item. That is, we let I (cid:48) = {j ∈ I \ {i} : z = 1}. ∗ ∗ j The running time of the above procedure is dominated by the time it takes to solve the linear program. This can be done very efficiently by solving the fractional knapsack problem with the greedy algorithm (or, for the purpose here, use any general polynomial time algorithm for linear programming). We can therefore obtain I and the new Eulerian partition in time polynomial in I (cid:54) n as stated in lemma. (cid:48) \ F t It remains to prove (5.4). Let us first bound the profit of our “knapsack solution” I Claim 5.13. We have(cid:80) \ F t (cid:80) i ) − lb(H ∗ i ). j∈I\i lb(H j∈I(cid:48) lb(H i ) (cid:62) 1 3 ∗ j ∗ j (cid:48) . 21 Proof. By definition,(cid:88) j∈I(cid:48) ∗ j \ F t i ) = lb(H (cid:88) (cid:88) j∈I\{i} pj (cid:62) =1 jpj − max ∗ z j∈I\{i} pj, j∈I\{i}:z∗ j where we used that at most one item is fractionally packed in z maxj∈I\{i} pj = maxj∈I\{i} lb(H thus sufficient to prove that z relaxation of the knapsack problem. Indeed, by the optimality of z . As j (cid:62) i for all j ∈ I, \ F t ∗ i ) (cid:54) lb(H i ). To complete the proof of the claim, it is = 1/3 for all j ∈ I \ {i} is a feasible solution to the LP (cid:48) j , we then have ∗ j ∗ ∗ (cid:80) (cid:80) j∈I\{i} z We have that z j∈I\{i} z (cid:48) (cid:48) jpj = 1 3 \ F t i ). is a feasible solution because j∈I\{i} lb(H ∗ j lb(H ∗ j ∩ F t i ) (cid:54) 1 3 lb(F t i ) (cid:54) 2 3 − lb(H ∩ F t ∗ i ) i lb(F t i )  lb(F t i ) = U, ∗ jpj (cid:62)(cid:80) (cid:88) 1 3 j∈I\{i} where the first inequality follows from that the subgraphs {H second inequality follows from that lb(H i ) (cid:54) 1/3. ∗ j }j∈I are disjoint and the (cid:3) We finish the proof of the lemma by using the above claim to show the increase of the “potential” function as stated in (5.4). By the definition of the new Eulerian partition (it contains {H }j(cid:60)I), we have that the increase is at least ∗ j i )/ lb(F t ∗ )2 −(cid:88) lb(H j∈I ∗ j)2. ∗ lb(H Let us concentrate on the first term: By using lb(H i )/3, we can further lower bound this expression by i ) (cid:54) lb(F t ∗ lb(F t i ) + 1 3 lb(F t 1 3 i ) + (cid:88) j∈I lb(H ∗ j \ F t i ) 22 By Claim 5.13, we have that the expression inside the parenthesis is at least ∗ )2 = lb(H \ F t i ) + ∗ j \ F t i ) lb(H (cid:62) lb(F t i ) ∗ i ) + lb(H i i ) + ∗ j \ F t i ) lb(H (cid:88) j∈I(cid:48) \ F t (cid:88) j∈I(cid:48) 2  . lb(F t ∗ i ) + lb(H i lb(F t (cid:88) lb(F t i ) + lb(H ∗ i \ F t i )+1 3 j∈I\{i} (cid:62) lb(F t lb(H ∗ j i ) + 1 3 j∈I \ F t lb(H i ) − lb(H ∗ (cid:88) i ) i ) − lb(H \ F t ∗ ∗ i ). j  = 1 (cid:88) i ) + 1 3 lb(F t 3 lb(H j∈I ∗ j). Finally, as lb(F t i ) (cid:62) ε lb(V)/n, lb(F t )2 −(cid:88) ∗ i ) (cid:62) 3 lb(H i ), and lb(H )2 − lb(H ∗ ∗ ∗ ∗ j)2 (cid:62) lb(H j) i ) (cid:88) lb(H lb(H ∗ lb(H j∈I ∗ j) (cid:54) lb(H i ) for all j ∈ I, we have ∗ 1 3 (cid:62) lb(F t i ) (cid:62) lb(F t i )2 3 lb(F t lb(F t i ) 3 + (cid:88) j∈I i ) + 1 (cid:88) 3 j∈I j∈I lb(H ∗ j) (cid:88) j∈I lb(H ∗ j)  − lb(H (cid:88) ∗ i ) j∈I j) − lb(H ∗ ∗ i ) lb(H lb(H ∗ j) (cid:62) ε2 3n2 lb(V)2 which completes the proof of Lemma 5.11. (cid:3) 6 Discussion and Open Problems We gave a new approach for approximating the asymmetric traveling salesman problem. It is based on relaxing the global connectivity requirements into local connectivity conditions, which is formalized as Local-Connectivity ATSP. We showed a rather easy 3- light algorithm for Local-Connectivity ATSP on shortest path metrics of node-weighted graphs. This yields via our generic reduction a constant factor approximation algorithm for Node-Weighted ATSP. However, we do not know any O(1)-light algorithm for Local-Connectivity ATSP on general metrics and, motivated by our generic reduction, we raise the following intriguing question: Open Question 6.1. Is there a O(1)-light algorithm for Local-Connectivity ATSP on general metrics? We note that there is great flexibility in the exact choice of the lower bound lb as noted in Remark 3.1. A further generalization of our approach is to interpret it as a primal-dual approach. Specifically, it might be useful to interpret the lower bound as a feasible solution of the dual of the Held-Karp relaxation: the lower bound is then not only defined over the vertices but over all cuts in the graph. We do not know if any of these generalizations are useful at this point and it may be that there is a nice O(1)-light algorithm for Local-Connectivity ATSP without changing the definition of lb. By specializing the generic reduction to Node-Weighted ATSP, it is possible to improve our bounds slightly for this case. Specifically, one can exploit the fact that a cycle C always has w(C) (cid:54) lb(C) in these metrics. This allows one to change the bound in Step U3 of the update phase to be w(C) (cid:54) lb(low( G)) instead of w(C) (cid:54) α lb(low( G)), which in turn improves the upper bound on the integrality gap of the Held-Karp relaxation to 4 · α + 1 = 13 (since α = 3 for node-weighted metrics). That said, we do not see how to make a significant improvement in the guarantee and it would be very interesting with a tight analysis of the integrality gap of the Held-Karp relaxation for Node-Weighted ATSP. We believe that such a result would also be very interesting even if we restrict ourselves to shortest path metrics of unweighted graphs. 23 Finally, let us remark that the recent progress for STSP on shortest path metrics of unweighted graphs is not known to extend to node-weighted graphs, i.e., Node- Weighted STSP. Is it possible to give a (1.5 − ε)-approximation algorithm for Node- Weighted STSP for some constant ε > 0? We think that this is a very natural question that lies in between the now fairly well understood STSP on shortest path metrics of unweighted graphs and STSP on general metrics (i.e., edge-weighted instead of node-weighted graphs). Acknowledgments The author is very grateful to László Végh, Johan Håstad, and Hyung-Chan An for inspiring discussions and valuable comments that influenced this work. We also thank Jakub Tarnawski and Jens Vygen for useful feedback on the manuscript. This research is supported by ERC Starting Grant 335288-OptApprox. References [1] N. Anari and S. O. Gharan. Effective-resistance-reducing flows, spectrally thin trees, and asymmetric TSP. CoRR, abs/1411.4613, 2014. 3 [2] N. Anari and S. O. Gharan. The kadison-singer problem for strongly rayleigh measures and applications to asymmetric TSP. CoRR, abs/1412.1143, 2014. 3 [3] S. Arora, M. Grigni, D. R. Karger, P. N. Klein, and A. Woloszyn. A polynomial-time approximation scheme for weighted planar graph TSP. In Proceedings of the Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 1998, pages 33–41, 1998. 3 [4] A. Asadpour, M. X. Goemans, A. Madry, S. O. Gharan, and A. Saberi. An O(log n/ log log n)-approximation algorithm for the asymmetric traveling salesman problem. In Proceedings of the Twenty-First Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2010, pages 379–389, 2010. 3 [5] M. Bläser. A new approximation algorithm for the asymmetric TSP with triangle inequality. ACM Transactions on Algorithms, 4(4), 2008. 3 [6] M. Charikar, M. X. Goemans, and H. J. Karloff. On the integrality ratio for the asymmetric traveling salesman problem. Math. Oper. Res., 31(2):245–252, 2006. 3 [7] N. Christofides. Worst-case analysis of a new heuristic for the travelling salesman problem. Technical report, Graduate School of Industrial Administration, CMU, 1976. 2 [8] U. Feige and M. Singh. Improved approximation ratios for traveling salesperson tours and paths in directed graphs. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, 10th International Workshop, APPROX 2007, and 11th International Workshop, RANDOM 2007, pages 104–118, 2007. 3 [9] A. M. Frieze, G. Galbiati, and F. Maffioli. On the worst-case performance of some algorithms for the asymmetric traveling salesman problem. Networks, 12(1):23–39, 1982. 3 [10] S. O. Gharan and A. Saberi. The asymmetric traveling salesman problem on graphs with bounded genus. In Proceedings of the Twenty-Second Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2011, pages 967–975, 2011. 3 24 [11] S. O. Gharan, A. Saberi, and M. Singh. A randomized rounding approach to the traveling salesman problem. In IEEE 52nd Annual Symposium on Foundations of Computer Science, FOCS 2011, pages 550–559, 2011. 2, 3 [12] M. Grigni, E. Koutsoupias, and C. H. Papadimitriou. An approximation scheme for planar graph TSP. In 36th Annual Symposium on Foundations of Computer Science, FOCS 1995, pages 640–645, 1995. 2 [13] H. Kaplan, M. Lewenstein, N. Shafrir, and M. Sviridenko. Approximation algorithms for asymmetric TSP by decomposing directed regular multigraphs. J. ACM, 52(4):602–626, 2005. 3 [14] M. Karpinski, M. Lampis, and R. Schmied. New inapproximability bounds for TSP. In Algorithms and Computation - 24th International Symposium, ISAAC 2013, pages 568–578, 2013. 2, 3 [15] A. Marcus, D. A. Spielman, and N. Srivastava. Interlacing families II: Mixed characteristic polynomials and the kadison-singer problem, 2013. 3 [16] T. Mömke and O. Svensson. Approximating graphic TSP by matchings. In IEEE 52nd Annual Symposium on Foundations of Computer Science, FOCS 2011, pages 560–569, 2011. 2, 3 In 29th International Symposium on [17] M. Mucha. 13/9-approximation for graphic TSP. Theoretical Aspects of Computer Science, STACS 2012, pages 30–41, 2012. 2, 3 [18] A. Schrijver. Combinatorial Optimization - Polyhedra and Efficiency. Springer-Verlag, Berlin, 2003. 10 [19] A. Sebö and J. Vygen. Shorter tours by nicer ears: 7/5-approximation for the graph- TSP, 3/2 for the path version, and 4/3 for two-edge-connected subgraphs. Combinatorica, 34(5):597–629, 2014. 2, 3 25
1212.6327
1
1212
2012-12-27T08:59:40
Speeding up shortest path algorithms
[ "cs.DS", "cs.CC" ]
Given an arbitrary, non-negatively weighted, directed graph $G=(V,E)$ we present an algorithm that computes all pairs shortest paths in time $\mathcal{O}(m^* n + m \lg n + nT_\psi(m^*, n))$, where $m^*$ is the number of different edges contained in shortest paths and $T_\psi(m^*, n)$ is a running time of an algorithm to solve a single-source shortest path problem (SSSP). This is a substantial improvement over a trivial $n$ times application of $\psi$ that runs in $\mathcal{O}(nT_\psi(m,n))$. In our algorithm we use $\psi$ as a black box and hence any improvement on $\psi$ results also in improvement of our algorithm. Furthermore, a combination of our method, Johnson's reweighting technique and topological sorting results in an $\mathcal{O}(m^*n + m \lg n)$ all-pairs shortest path algorithm for arbitrarily-weighted directed acyclic graphs. In addition, we also point out a connection between the complexity of a certain sorting problem defined on shortest paths and SSSP.
cs.DS
cs
Speeding up shortest path algorithms Andrej Brodnik12 and Marko Grgurovic1 1 University of Primorska, Department of Information Science and Technology, Slovenia, [email protected], [email protected] 2 University of Ljubljana, Faculty of Computer and Information Science, Slovenia, Abstract. Given an arbitrary, non-negatively weighted, directed graph G = (V, E) we present an algorithm that computes all pairs shortest paths in time O(m∗n + m lg n + nTψ(m∗, n)), where m∗ is the number of different edges contained in shortest paths and Tψ(m∗, n) is a run- ning time of an algorithm to solve a single-source shortest path problem (SSSP). This is a substantial improvement over a trivial n times appli- cation of ψ that runs in O(nTψ(m, n)). In our algorithm we use ψ as a black box and hence any improvement on ψ results also in improvement of our algorithm. Furthermore, a combination of our method, Johnson's reweighting tech- nique and topological sorting results in an O(m∗n + m lg n) all-pairs shortest path algorithm for arbitrarily-weighted directed acyclic graphs. In addition, we also point out a connection between the complexity of a certain sorting problem defined on shortest paths and SSSP. Keywords: all pairs shortest path, single source shortest path 1 Introduction Let G = (V, E) denote a directed graph where E is the set of edges and V is the set of vertices of the graph and let ℓ(·) be a function mapping each edge to its length. Without loss of generality, we assume G is strongly connected. To simplify notation, we define m = E and n = V . Furthermore, we define d(u, v) for two vertices u, v ∈ V as the length of the shortest path from u to v. A classic problem in algorithmic graph theory is to find shortest paths. Two of the most common variants of the problem are the single-source shortest path (SSSP) problem and the all-pairs shortest path problem (APSP). In the SSSP variant, we are asked to find the path with the least total length from a fixed vertex s ∈ V to every other vertex in the graph. Similarly, the APSP problem asks for the shortest path between every pair of vertices u, v ∈ V . A common simplification of the problem constrains the edge length function to be non-negative, i.e. ℓ : E → R+, which we assume throughout the rest of the paper, except where explicitly stated otherwise. Additionally, we define ∀(u, v) /∈ E : ℓ(u, v) = ∞. It is obvious that the APSP problem can be solved by n calls to an SSSP algo- rithm. Let us denote the SSSP algorithm as ψ. We can quantify the asymptotic time bound of such an APSP algorithm as O(nTψ(m, n)) and the asymptotic 2 space bound as O(Sψ(m, n)), where Tψ(m, n) is the time required by algorithm ψ and Sψ(m, n) is the space requirement of the same algorithm. We assume that the time and space bounds can be written as functions of m and n only, even though this is not necessarily the case in more "exotic" algorithms that depend on other parameters of G. Note, that if we are required to store the computed distance matrix, then we will need at least Θ(n2) additional space. If we account for this, then the space bound becomes O(Sψ(m, n) + n2). In this paper we are interested in the following problem: what is the best way to make use of an SSSP algorithm ψ when solving APSP? There exists some prior work on a very similar subject in the form of an algorithm named the Hidden Paths Algorithm [1]. The Hidden Paths Algorithm is essentially a modification of Dijkstra's algorithm [2] to make it more efficient when solving APSP. Solving the APSP problem by repeated calls to Dijkstra's algorithm requires O(mn+n2 lg n) time using Fibonacci heaps [3]. The Hidden Paths Algorithm then reduces the running time to O(m∗n + n2 lg n). The quantity m∗ represents the number of edges (u, v) ∈ E such that (u, v) is included in at least one shortest path. In the Hidden Paths Algorithm this is accomplished by modifying Dijkstra's algorithm, so that it essentially runs in parallel from all vertex sources in G, and then reusing the computations performed by other vertices. The idea is simple: we can delay the inclusion of an edge (u, v) as a candidate for forming shortest paths until vertex u has found (u, v) to be the shortest path to v. However, the Hidden Paths Algorithm is limited to Dijkstra's algorithm, since it explicitly sorts the shortest path lists by path lengths, through the use of a priority queue. As a related algorithm, we also point out that a different measure U P related to the number of so-called uniform paths has also been exploited to yield faster algorithms [4]. In Sections 3, 4 and 5 we show that there is a method for solving APSP which produces the shortest path lists of individual vertices in sorted order according to the path lengths. The interesting part is that it can accomplish this without the use of priority queues of any form and requires only an SSSP algorithm to be provided. This avoidance of priority queues permits us to state a time complexity relationship between a sorted variant of APSP and SSSP. Since it is very difficult to prove meaningful lower bounds for SSSP, we believe this connection might prove useful. As a direct application of our approach, we show that an algorithm with a similar time bound to the Hidden Paths Algorithm can be obtained. Unlike the Hidden Paths Algorithm, the resulting method is general in that it works for any SSSP algorithm, effectively providing a speed-up for arbitrary SSSP algorithms. The proposed method, given an SSSP algorithm ψ, has an asymptotic worst-case running time of O(m∗n + m lg n + nTψ(m∗, n)) and space O(Sψ(m, n) + n2). We point out that the m∗n term is dominated by the nTψ(m∗, n) term, but we feel that stating the complexity in this (redundant) form makes the result clearer to the reader. For the case of ψ being Dijkstra's algorithm, this is asymptotically equivalent to the Hidden Paths Algorithm. However, since the algorithm ψ is arbitrary, we show that the combination of our method, Johnson's reweighting 3 technique [5] and topological sorting gives an O(m∗n + m lg n) APSP algorithm for arbitrarily-weighted directed acyclic graphs. 2 Preliminaries Throughout the paper and without loss of generality, we assume that we are not interested in paths beginning in v and returning back to v. We have previously defined the edge length function ℓ(·), which we now extend to the case of paths. Thus, for a path π, we write ℓ(π) to denote its length, which corresponds to the sum of the length of its edges. Similar to the way shortest paths are discovered in Dijkstra's algorithm, we rank shortest paths in nondecreasing order of their lengths. Thus, we call a path π the k-th shortest path if it is at position k in the length-sorted shortest path list. The list of paths is typically taken to be from a single source to variable target vertices. In contrast, we store paths from variable sources to a single target. By reversing the edge directions we obtain the same lists, but it is conceptually simpler to consider the modified case. Thus, the k-th shortest path of vertex v actually represents the k-th shortest incoming path into v. We will now prove a theorem on the structure of shortest paths, which is the cornerstone of the proposed algorithm. Definition 1. (Ordered shortest path list Pv) Let Pv = (π1, π2, ..., πn−1) denote the shortest path list for each vertex v ∈ V . Then, let Pv,k denote the k-th element in the list Pv. The shortest path lists are ordered according to path lengths, thus we have ∀i, j : 0 < i < j < n ⇒ ℓ(πi) ≤ ℓ(πj). Theorem 1. To determine Pv,k we only need to know every edge {(u, v) ∈ E ∀u ∈ V } and the first k elements of each list Pu, where (u, v) ∈ E. Proof. We assume that we have found the first k shortest paths for all neighbors of v, and are now looking for the k-th shortest path into v, which we denote as πk. There are two possibilities: either πk is simply an edge (u, v), in which case we already have the relevant information, or it is the concatenation of some path π and an edge (u, v). The next step is to show that π is already contained in Pu,i where i ≤ k. We will prove this by contradiction. Assume the contrary, that π is either not included in Pu, or is included at position i > k. This would imply the existence of some path π′ for which ℓ(π′) ≤ ℓ(π) and which is contained in Pu at position i ≤ k. Then we could simply take πk to be the concatenation of (u, v) and π′, thereby obtaining a shorter path than the concatenation of (u, v) and π. However, this is not yet sufficient for a contradiction. Note that we may obtain a path that is shorter, but connects vertices that have an even shorter path between them, i.e. the path is not the shortest path between the source s and target v. To show that it does contradict our initial assumption, we point out that Pu contains k shortest paths, therefore it contains shortest paths from k unique 4 sources. In contrast, the list Pv contains at most k − 1 shortest paths. By a counting argument we have that there must exist a path π′, stored in Pu with an index i ≤ k, which originates from a source vertex s that is not contained in Pv, thereby obtaining a contradiction. ⊓⊔ 3 The algorithm Suppose we have an SSSP algorithm ψ and we can call it using ψ(V, E, s) where V and E correspond to the vertex and edge sets, respectively and s corresponds to the source vertex. The method we propose works in the fundamental comparison- addition model and does not assume a specific kind of edge length function, except the requirement that it is non-negative. However, the algorithm ψ that is invoked can be arbitrary, so if ψ requires a different model or a specific length function, then implicitly by using ψ, our algorithm does as well. First we give a simpler variant of the algorithm, resulting in bounds O(mn + nTψ(m∗, n)). We limit our interaction with ψ only to execution and reading its output. To improve the running time we construct a graph G′ = (V ′, E ′) on which we run ψ. There are two processes involved: the method for solving APSP which runs on G, and the SSSP algorithm ψ which runs on G′. Let n′ = V ′ and m′ = E ′. We will maintain m′ ≤ m∗ + n and n′ = n + 1 throughout the execution. There are n − 1 phases of the main algorithm, each composed of three steps: (1) Prepare the graph G′; (2) Run ψ on G′; and (3) Interpret the results of ψ. Although the proposed algorithm effectively works on n−1 new graphs, these graphs are similar to one another. Thus, we can consider the algorithm to work only on a single graph G′, with the ability to modify edge lengths and introduce new edges into G′. Initially we define V ′ = V ∪ {i}, where i is a new vertex unrelated to the graph G. We create n new edges from i to every vertex v ∈ V , i.e. E ′ = Sv∈V {(i, v)}. We set the cost of these edges to some arbitrary value in the beginning. Definition 2. (Shortest path list for vertex v, Sv) The shortest path list of some vertex v ∈ V is denoted by Sv. The length of Sv is at most n + 1 and contains pairs of the form (a, δ) where a ∈ V ∪ {null} and δ ∈ R+. The first element of Sv is always (v, 0), the last element plays the role of a sentinel and is always (null, ∞). For all inner (between the first and the last element) elements (a, δ), we require that δ = d(a, v). A list with k ≤ n − 1 inner elements: Sv = (cid:0)(v, 0), (a1, δ1), (a2, δ2), ..., (ak, δk), (null, ∞)(cid:1). Next we describe the data structures. Each vertex v ∈ V keeps its shortest path list Sv, which initially contains only two pairs (v, 0) and (null, ∞). For each edge (u, v) ∈ E, vertex v keeps a pointer p[(u, v)], which points to some element in the shortest path list Su. Initially, each such pointer p[(u, v)] is set to point to the first element of Su. 5 Definition 3. (Viable pair for vertex v) A pair (a, δ) is viable for a vertex v ∈ V if ∀(a′, δ′) ∈ Sv : a 6= a′. Alternatively, if a = null we define the pair as viable. Definition 4. (Currently best pair for vertex v, (av, δv)) A pair (av, δv) ∈ Sw, where (w, v) ∈ E is the currently best pair for vertex v if and only if (av, δv) is viable for v and: ∀(u, v) ∈ E : ∀(a′, δ′) ∈ Su : (a′, δ′) viable for v and δ′+ℓ(u, v) ≥ δv + ℓ(w, v). We now look at the first step taken in each phase of the algorithm: prepa- ration of the graph G′. In this step, each vertex v finds the currently best pair (av, δv). To determine the currently best pair, a vertex v inspects the elements pointed to by its pointers p[(u, v)] for each (u, v) ∈ E in the following manner: For each pointer p[(u, v)], vertex v keeps moving the pointer to the next element in the list Su until it reaches a viable pair, and takes the minimum amongst these as per Definition 4. We call this process reloading. Once reloaded we modify the edges in the graph G′. Let (av, δv) ∈ Sw where (w, v) ∈ E be the currently best pair for vertex v, then we set ℓ(i, v) ← δv + ℓ(w, v). Now we call ψ(V ′, E ′, i). Suppose the SSSP algorithm returns an array Π[ ] of length n. Let each element Π[v] be a pair (c, δ) where δ is the length of the shortest path from i to v, and c is the first vertex encountered on this path. When determining the first vertex on the path we exclude i, i.e. if the path is πv = {(i, v)} then Π[v].c = v. The inclusion of the first encountered vertex is a mere convenience, and can otherwise easily be accomodated by examining the shortest path tree returned by the algorithm. For each vertex v ∈ V we append the pair (aΠ[v].c, Π[v].δ) to its shortest path list. Note, that the edges (i, v) ∈ E ′ are essentially shorthands for paths in G. Thus, aΠ[v].c represents the source of the path in G. We call this process propagation. After propagation, we modify the graph G′ as follows. For each vertex v ∈ V such that Π[v].c = v, we check whether the currently best pair (av, δv) ∈ Su that was selected during the reloading phase is the first element of the list Su. If it is the first element, then we add the edge (u, v) into the set E ′. This concludes the description of the algorithm. We formalize the procedure in pseudocode and obtain Algorithm 1. To see why the algorithm correctly computes the shortest paths, we prove the following two lemmata. Lemma 1. For each vertex v ∈ V whose k-th shortest path was found during the reloading step, ψ(V ′, E ′, i) finds the edge (i, v) to be the shortest path into v. Proof. For the case when the k-th shortest path depends only on a path at position j < k in a neighbor's list, the path is already found during the reloading step. What has to be shown is that this is preserved after the execution of the SSSP algorithm. Consider a vertex v ∈ V which has already found the k-th shortest path during the reloading step. This path is represented by the edge (i, v) of the same length as the k-th shortest path. Now consider the case that some path, other than the edge (i, v) itself, would be found to be a better path to v by the SSSP algorithm. Since each of the outgoing edges of i represents a path in G, this would mean that taking this path and adding the remaining 6 V ′ := V ∪ {i} E ′ := S∀v∈V {(i, v)} best[ ] := new array [n] of pairs (a, δ) solved[ ][ ] := new array [n][n] of boolean values Initialize solved[ ][ ] to f alse for all v ∈ V do for all v ∈ V do best[v] := (null, ∞) for all u ∈ V s.t. (u, v) ∈ E do while solved[v][p[(u, v)].a] do end while if p[(u, v)].δ + ℓ(u, v) < best[v].δ then best[v].a := p[(u, v)].a best[v].δ := p[(u, v)].δ + ℓ(u, v) end if Sv.append( (v, 0) ) end for for k := 1 to n − 1 do Algorithm 1 All-pairs shortest path 1: procedure APSP(V, E, ψ) 2: 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: end procedure end for Π[ ] := ψ(V ′, E ′, i) for all v ∈ V do end for ℓ(i, v) := best[v].δ end if end for E ′ := E ′ ∪ (u, v) end for ⊲ Reloading p[(u, v)].next() ⊲ An end-of-list element is always viable ⊲ Considering only k − 1 neighboring paths ⊲ Propagation Sv.append( (best[Π[v].c].a, Π[v].δ) ) solved[v][best[Π[v].c].a] := true if Π[v].c = v and best[v] was the first element of some list Su then 7 edges used to reach v would consistute a shorter path than the k-th shortest path of v. Let us denote the path obtained by this construction as π′. Clearly this is a contradiction unless π′ is not the k-th shortest path, i.e. a shorter path connecting the two vertices is already known. Without loss of generality, assume that π′ = {(i, u), (u, v)}. However, ℓ(π′) can only be shorter than ℓ(i, v) if v could not find a viable (non-null) pair in the list Su, since otherwise a shorter path would have been chosen in the reloading phase. This means that all vertex sources (the a component of a pair) contained in the list Su are also contained in the list Sv. Therefore a viable pair for u must also be a viable pair for v. This concludes the proof by contradiction, since the ⊓⊔ path obtained is indeed the shortest path between the two vertices. Lemma 2. ψ(V ′, E ′, i) correctly computes the k-th shortest paths for all vertices v ∈ V given only k − 1 shortest paths for each vertex. Proof. The case when the k-th path requires only k − 1 neighboring paths to be known has already been proven by the proof of Lemma 1. We now consider the case when the k-th path depends on a neighbor's k-th path. If the k-th path of vertex v requires the k-th path from the list of its neighbor u, then we know the k-th path of u must be the same as that of v except for the inclusion of the edge (u, v). The same argument applies to the dependency of vertex u on its neighbor's list. Thus, the path becomes shorter after each such dependency, eventually becoming dependent on a path included at position j < k in a neighbor's list (this includes edges), which has already been found during the reloading step and is preserved as the shortest path due to Lemma 1. We now proceed in the same way that we obtained the contradiction in the proof of Lemma 1, except it is not a contradiction in this case. What follows is that any path from i to v in G′ which is shorter than ℓ(i, v) must represent a viable pair for v. It is easy to see, then, that the shortest among these paths is the k-th shortest path for v in G and also the shortest path from i to v in G′. ⊓⊔ 3.1 Time and space complexity First, we look at the time complexity. The main loop of Algorithm 1 (lines 7 -- 29) performs n − 1 iterations. The reloading loop (lines 8 -- 20) considers each edge (u, v) ∈ E which takes m steps. This amounts to O(mn). Since each shortest path list is of length n+1, each pointer is moved to the next element n times over the execution of the algorithm. There are m pointers, so this amounts to O(mn). Algorithm ψ is executed n − 1 times. In total, the running time of Algorithm 1 is O(mn + nTψ(m∗, n)). The space complexity of Algorithm 1 is as follows. Each vertex keeps track of its shortest path list, which is of size n + 1 and amounts to Θ(n2) space over all vertices. Since there are exactly m pointers in total, the space needed for them is simply O(m). On top of the costs mentioned, we require as much space as is required by algorithm ψ. In total, the combined space complexity for Algorithm 1 is O(n2 + Sψ(m∗, n)). 8 3.2 Implications We will show how to further improve the time complexity of the algorithm in Section 4, but already at its current stage, the algorithm reveals an interesting relationship between the complexity of non-negative SSSP and a stricter variant of APSP. Definition 5. (Sorted all-pairs shortest path SAPSP) The problem SAPSP(m, n) is that of finding shortest paths between all pairs of vertices in a non-negatively weighted graph with m edges and n vertices in the form of Pv for each v ∈ V (see Definition 1). Theorem 2. Let TSSSP denote the complexity of the single-source shortest path problem on non-negatively weighted graphs with m edges and n vertices. Then the complexity of SAPSP is at most O(nTSSSP ). Proof. Given an algorithm ψ which solves SSSP, we can construct a solution to SAPSP in time O(nTψ(m, n)) according to Algorithm 1, since the lists Sv found by the algorithm are ordered by increasing distance from the source. ⊓⊔ What Theorem 2 says is that when solving APSP, either we can follow in the footsteps of Dijkstra and visit vertices in increasing distance from the source without worrying about a sorting bottleneck, or that if such a sorting bottleneck exists, then it proves a non-trivial lower bound for the single-source case. 4 Improving the time bound The algorithm presented in the previous section has a running time of O(mn + nTψ(m∗, n)). We show how to bring this down to O(m∗n + m lg n + nTψ(m∗, n)). We sort each set of incoming edges Ev = S(u,v)∈E{(u, v)} by edge lengths in non-decreasing order. By using any off-the-shelf sorting algorithm, this takes O(m lg n) time. We only keep pointers p[(u, v)] for the edges which are shortest paths between u and v, and up to one additional edge per vertex for which we do not know whether it is part of a shortest path. Since edges are sorted by their lengths, a vertex v can ignore an edge at position t in the sorted list Ev until the edge at position t − 1 is either found to be a shortest path, or found not to be a shortest path. For some edge (u, v) the former case simply corresponds to using the first element, i.e. u, provided by p[(u, v)] as a shortest path. The latter case on the other hand, is not using the first element offered by p[(u, v)], i.e. finding it is not viable during the reloading phase. Whenever one of these two conditions is met, we include the next edge in the sorted list as a pointer, and either throw away the previous edge if it was found not to be a shortest path, or keep it otherwise. This means the total amount of pointers is at most m∗ + n at any given time, which is O(m∗), since m∗ is at least n. The total amount of time spent by the algorithm then becomes O(m∗n + m lg n + nTψ(m∗, n)). 9 Theorem 3. Let ψ be an algorithm which solves the single-source shortest path problem on non-negatively weighted graphs. Then, the all-pairs shortest path problem on non-negatively weighted graphs can be solved in time O(m∗n+m lg n+ nTψ(m∗, n)) and space O(n2 + Sψ(m∗, n)) where Tψ(m, n) is the time required by algorithm ψ on a graph with m edges and n nodes and Sψ(m, n) is the space required by algorithm ψ on the same graph. Proof. See discussion above and in Section 3. ⊓⊔ 5 Directed acyclic graphs A combination of a few techniques yields an O(m∗n + m lg n) APSP algorithm for arbitrarily weighted directed acyclic graphs (DAGs). The first step is to transform the original (possibly negatively-weighted) graph into a non-negatively weighted graph through Johnson's [5] reweighting technique. Instead of using Bellman-Ford in the Johnson step, we visit nodes in their topological order, thus obtaining a non-negatively weighted graph in O(m) time. Next, we use the improved time bound algorithm as presented in Section 4. For the SSSP algorithm, we again visit nodes according to their topological order. Note that if the graph G is a DAG then G′ is also a DAG. The reasoning is simple: the only new edges introduced in G′ are those from i to each vertex v ∈ V . But since i has no incoming edges, the acyclic property of the graph is preserved. The time bounds become O(m) for Johnson's step and O(m∗n + m lg n + nTψ(m∗, n)) for the APSP algorithm where Tψ(m∗, n) = O(m∗). Thus, the combined asymptotic running time is O(m∗n + m lg n). The asymptotic space bound is simply Θ(n2). Theorem 4. All-pairs shortest path on directed acyclic graphs can be solved in time O(m∗n + m lg n) and Θ(n2) space. Proof. See discussion above. ⊓⊔ 6 Discussion In this paper we have shown that the "standard" approach to solving APSP via independent SSSP computations can be improved upon even if we know virtually nothing about the SSSP algorithm itself. However, we should mention that in recent years, asymptotically efficient algorithms for APSP have been formulated in the so-called component hierarchy framework. These algorithms can be seen as computing either SSSP or APSP. Our algorithm is only capable of speeding up SSSP hierarchy algorithms, such as Thorup's [6], but not those which reuse the hierarchy, such as Pettie's [7], Pettie-Ramachandran [8] or Hagerup's [9] since our SSSP reduction requires modifications to the graph G′. These modi- fications would require the hierarchy to be recomputed, making the algorithms prohibitively slow. This raises the following question: is there a way to avoid 10 recomputing the hierarchy at each step, while keeping the number of edges in the hierarchy O(m∗)? Further, if there exists an o(mn) algorithm for the arbitrarily-weighted SSSP problem, then by using Johnson's reweighting technique, our algorithm might become an attractive solution for that case. For the general case, no such algo- rithms are known, but for certain types of graphs, there exist algorithms with an o(mn) asymptotic time bound [10,11]. Furthermore, we can generalize the approach used on DAGs. Namely, in Al- gorithm 1 we can use an SSSP algorithm ψ that works on a specialized graph G, as long our constructed graph G′ has these properties. Therefore, our algorithm can be applied to undirected graphs, integer-weighted graphs, etc., but it cannot be applied, for example, to planar graphs, since G′ is not necessarily planar. Finally, we have shown a connection between the sorted all-pairs shortest path problem and the single-source shortest path problem. If a meaningful lower bound can be proven for SAPSP, then this would imply a non-trivial lower bound for SSSP. Alternatively, if SAPSP can be solved in O(mn) time, then this implies a Dijkstra-like algorithm for APSP, which visits vertices in increasing distance from the source. References 1. Karger, D., Koller, D., Phillips, S.J.: Finding the hidden path: time bounds for all-pairs shortest paths. SIAM Journal on Computing 22(6) (1993) 1199 -- 1217 2. Dijkstra, E.W.: A note on two problems in connexion with graphs. Numerische Mathematik 1 (1959) 269 -- 271 3. Fredman, M.L., Tarjan, R.E.: Fibonacci heaps and their uses in improved network optimization algorithms. J. ACM 34(3) (July 1987) 596 -- 615 4. Demetrescu, C., Italiano, G.F.: Experimental analysis of dynamic all pairs shortest path algorithms. ACM Transactions on Algorithms 2(4) (2006) 578 -- 601 5. Johnson, D.B.: Efficient algorithms for shortest paths in sparse networks. J. ACM 24(1) (January 1977) 1 -- 13 6. Thorup, M.: Undirected single-source shortest paths with positive integer weights in linear time. J. ACM 46(3) (May 1999) 362 -- 394 7. Pettie, S.: A new approach to all-pairs shortest paths on real-weighted graphs. Theor. Comput. Sci. 312(1) (January 2004) 47 -- 74 8. Pettie, S., Ramachandran, V.: A shortest path algorithm for real-weighted undi- rected graphs. SIAM J. Comput. 34(6) (June 2005) 1398 -- 1431 9. Hagerup, T.: Improved shortest paths on the word RAM. In: Proceedings of the 27th International Colloquium on Automata, Languages and Programming. ICALP '00, London, UK, Springer-Verlag (2000) 61 -- 72 10. Goldberg, A.V.: Scaling algorithms for the shortest paths problem. In: Proceedings of the fourth annual ACM-SIAM Symposium on Discrete algorithms. SODA '93, Philadelphia, PA, USA, Society for Industrial and Applied Mathematics (1993) 222 -- 231 11. Gabow, H.N., Tarjan, R.E.: Faster scaling algorithms for network problems. SIAM J. Comput. 18(5) (October 1989) 1013 -- 1036
1503.00049
1
1503
2015-02-28T01:20:55
Algorithms for Longest Common Abelian Factors
[ "cs.DS" ]
In this paper we consider the problem of computing the longest common abelian factor (LCAF) between two given strings. We present a simple $O(\sigma~ n^2)$ time algorithm, where $n$ is the length of the strings and $\sigma$ is the alphabet size, and a sub-quadratic running time solution for the binary string case, both having linear space requirement. Furthermore, we present a modified algorithm applying some interesting tricks and experimentally show that the resulting algorithm runs faster.
cs.DS
cs
Algorithms for Longest Common Abelian Factors Ali Alatabbia, Costas S. Iliopoulosa, Alessio Langiua,b,∗, M. Sohel Rahmana,c aDepartment of Informatics, King's College London, London, UK bIAMC-CNR, National Research Council,Trapani, Italy cA(cid:96)EDA Group, Department of CSE, BUET, Dhaka-1000, Bangladesh Abstract In this paper we consider the problem of computing the longest common abelian factor (LCAF) between two given strings. We present a simple O(σ n2) time algorithm, where n is the length of the strings and σ is the alphabet size, and a sub-quadratic running time solution for the binary string case, both having lin- ear space requirement. Furthermore, we present a modified algorithm applying some interesting tricks and experimentally show that the resulting algorithm runs faster. 1. Introduction Abelian properties concerning words have been investigated since the very beginning of the study of Formal Languages and Combinatorics on Words. Abelian powers were first considered in 1961 by Erdos [Erd61] as a natural generalization of usual powers. In 1966, Parikh [Par66] defined a vector having length equal to the alphabet cardinality, which reports the number of occur- rences of each alphabet symbol inside a given string. Later on, the scientific community started referring to such a vector as the Parikh vector. Clearly, two strings having the same Parikh vector are permutations of one another and there is an abelian match between them. Abelian properties of strings have recently grown tremendous interest among the Stringology researchers and have become an involving topic of discussion in the recent issues of the StringMasters meetings. Despite the fact that there are not so many real life applications where comparing commutative sequence of objects is relevant, abelian combinatorics has a potential role in filtering the data in order to find potential occurrences of some approximate matches. For instance, when one is looking for typing errors in a natural language, it can be useful to select the abelian matches first and then look for swap of adjacent or even near appearing letters. The swap errors and the inversion errors are also very common in the evolutionary process of the genetic code of a living organism and hence is often interesting from Bioinformatics perspective. Similar applications can also be found in the context of network communications. ∗Corresponding author Preprint submitted to Elsevier August 15, 2018 In this paper, we focus on the problem of finding the Longest Common Abelian Factor of two given strings. The problem is combinatorially interesting and analogous to the Longest Common Substring (LCStr) problem for the usual strings. The LCStr problem is a Historical problem and Dan Gusfield reported the following in his book [Gus97, Sec. 7.4] regarding the belief of Don Knuth about the complexity of the problem: ...in 1970 Don Knuth conjectured a linear time algorithm for this problem would be impossible. However, contrary to the above conjecture, decades later, a linear time solution for the LCStr problem was in fact obtained by using the linear construction of the suffix tree. For Stringology researchers this alone could be the motivation for considering LCAF from both algorithmic and combinatorics point of view. However, despite a number of works on abelian matching, to the best of our knowledge, this problem has never been considered until very recently when it was posed in the latest issue of the StringMasters, i.e., StringMasters 2013. To this end, this research work can be seen as a first attempt to solve this problem with the hope of many more to follow. In this paper, we first present a simple solution to the problem running in O(σ n2) time, where σ is the alphabet size (Section 3). Then we present a sub- quadratic algorithm for the binary string case (Section 4). Both the algorithms have linear space requirement. Furthermore, we present a modified algorithm applying some interesting tricks (Section 5) and experimentally show that the resulting algorithm runs in O(n log n) time (Section 6). 2. Preliminaries An alphabet Σ of size σ > 0 is a finite set whose elements are called letters. A string on an alphabet Σ is a finite, possibly empty, sequence of elements of Σ. The zero-letter sequence is called the empty string, and is denoted by ε. The length of a string S is defined as the length of the sequence associated with the string S, and is denoted by S. We denote by S[i] the i-th letter of S, for all 1 ≤ i ≤ S and S = S[1 . .S]. A string w is a factor of a string S if there exist two strings u and v, possibly empty, such that S = uwv. A factor w of a string S is proper if w (cid:54)= S. If u = ε (v = ε), then w is a prefix (suffix) of S. Given a string S over the alphabet Σ = {a1, . . . aσ}, we denote by Saj the number of aj's in S, for 1 ≤ j ≤ σ. We define the Parikh vector of S as PS = (Sa1, . . .Saσ ). In the binary case, we denote Σ = {0, 1}, the number of 0's in S by S0, the number of 1's in S by S1 and the Parikh vector of S as PS = (S0,S1). We now focus on binary strings. The general alphabet case will be considered later. For a given binary string S of length n, we define an n × n matrix MS as follows. Each row of MS is dedicated to a particular length of factors of S. So, Row (cid:96) of MS is dedicated to (cid:96)-length factors of S. Each column of MS is dedicated to a particular starting position of factors of S. So, Column i of 2 MS is dedicated to the position i of S. Hence, MS[(cid:96)][i] is dedicated to the (cid:96)- length factor that starts at position i of S and it reports the number of 1's of that factor. Now, MS[(cid:96)][i] = m if and only if the (cid:96)-length factor that starts at position i of S has a total of m 1's, that is, S[i . . i + (cid:96) − 1]1 = m. We formally define the matrix MS as follows. Definition 1. Given a binary string S of length n, MS is an n× n matrix such that MS[(cid:96)][i] = S[i . . i + (cid:96) − 1]1, for 1 ≤ (cid:96) ≤ n and 1 ≤ i ≤ (n − (cid:96) + 1), and MS[(cid:96)][i] = 0, otherwise. In what follows, we will use MS[(cid:96)] to refer to Row (cid:96) of MS. Assume that we are given two strings A and B on an alphabet Σ. For the sake of ease, we assume that A = B = n. We want to find the length of a longest common abelian factor between A and B. Definition 2. Given two strings A and B over the alphabet Σ, we say that w is a common abelian factor for A and B if there exist a factor (or substring) u in A and a factor v in B such that Pw = Pu = Pv. A common abelian factor of the highest length is called the Longest Common Abelian Factor (LCAF) between A and B. The length of LCAF is referred to as the LCAF length. In this paper we study the following problem. Problem 1 (LCAF Problem). Given two strings A and B over the alphabet Σ, compute the length of an LCAF and identify some occurrences of an LCAF between A and B . Assume that the strings A and B of length n are given. Now, suppose that the matrices MA and MB for the binary strings A and B have been computed. Now we have the following easy lemma that will be useful for us later. Lemma 2. There is a common abelian factor of length (cid:96) between A and B if and only if there exists p, q such that 1 ≤ p, q ≤ n−(cid:96)+1 and MA[(cid:96)][p] = MB[(cid:96)][q]. Proof. Suppose there exists p, q such that 1 ≤ p, q ≤ n− (cid:96) + 1 and MA[(cid:96)][p] = MB[(cid:96)][q]. By definition this means A[p . . p + (cid:96) − 1]1 = B[q . . q + (cid:96) − 1]1. So there is a common abelian factor of length (cid:96) between A and B. The other way is also obvious by definition. Clearly, if we have MA and MB we can compute the LCAF by identifying the highest (cid:96) such that there exists p, q having 1 ≤ p, q ≤ n − (cid:96) + 1 and MA[(cid:96)][p] = MB[(cid:96)][q]. Then we can say that the LCAF between A and B is either A[p . . p + (cid:96) − 1] or B[q . . q + (cid:96) − 1] having length (cid:96). We now generalize the definition of the matrix MS for strings over a fixed size alphabet Σ = {a1, . . . aσ} by defining an n × n matrix MS of (σ − 1)- length vectors. MS[(cid:96)][i] = V(cid:96),i, where V(cid:96),i[j] = S[i . . i + (cid:96) − 1]aj , for 1 ≤ (cid:96) ≤ n, 1 ≤ i ≤ (n−(cid:96)+1) and 1 ≤ j < σ, and V(cid:96),i[j] = 0, otherwise. We will refer to the j-th element of the array V(cid:96),i of the matrix MS by using the notation MS[(cid:96)][i][j]. 3 Notice that the last component of a Parikh vector is determined by using the length of the string and all the other components of the Parikh vector. Now, MS[(cid:96)][i][j] = m if and only if the (cid:96)-length factor that starts at position i of S has a total of m aj's, that is S[i . . i + (cid:96)− 1]aj = m. Clearly, we can compute MS[(cid:96)] using the following steps. Similar to the binary case, the above computation runs in linear time because we can compute S[i + 1 . . i + 1 + (cid:96) − 1]aj from S[i . . i + (cid:96) − 1]aj in constant time by simply decrementing the S[i] component and incrementing the S[i + (cid:96)] one. 3. A Quadratic Algorithm A simple approach for finding the LCAF length considers computing, for 1 ≤ (cid:96) ≤ n, the Parikh vectors of all the factors of length (cid:96) in both A and B, i.e., MA[(cid:96)] and MB[(cid:96)]. Then, we check whether MA[(cid:96)] and MB[(cid:96)] have non- empty intersection. If yes, then (cid:96) could be the LCAF length. So, we return the highest of such (cid:96). Moreover, if one knows a Parikh vector having the LCAF length belonging to such intersection, a linear scan of A and B produces one occurrence of such a factor. The asymptotic time complexity of this approach is O(σ n2) and it requires O(σ n log n) bits of extra space. The basic steps are outlined as follows. 1. For (cid:96) = 1 to n do the following 2. 3. 4. 5. For i = 1 to n − (cid:96) + 1 do the following compute MA[(cid:96)][i] and MB[(cid:96)][i] If MA[(cid:96)](cid:84) MB[(cid:96)] (cid:54)= ∅ then LCAF = (cid:96) It is well known that, for fixed length (cid:96), one can compute all the Parikh vectors in linear time and store them in O(σ n log n) bits. Now once MA and MB are computed, we simply need to apply the idea of Lemma 2. The idea is to check for all values of (cid:96) whether there exists a pair p, q such that 1 ≤ p, q ≤ n − (cid:96) + 1 and MA[(cid:96)][p] = MB[(cid:96)][q]. Then return the highest value of (cid:96) and corresponding values of p, q. In the binary case, a Parikh vector is fully represented by just one arbitrary chosen component. Hence, the set of Parikh vectors of binary factors is just a one dimension list of integers that can be stored in O(n log n) bits, since we have n values in the range [0 . . n]. The intersection can be accomplished in two steps. First, we sort the MA[(cid:96)] and MB[(cid:96)] rows in O(n) time by putting them in two lists and using the classic Counting Sort algorithm [CLRS01, Section 8.2]. Then, we check for a non empty intersection with a simple linear scan of the two lists in linear time by starting in parallel from the beginning of the two lists and moving forward element by element on the list having the smallest value among the two examined elements. A further linear scan of MA[(cid:96)] and MB[(cid:96)] 4 will find the indexes p, q of an element of the not empty intersection. This gives us an O(n2) time algorithm requiring O(n log n) bits of space for computing an LCAF of two given binary strings. In the more general case of alphabet greater than two, comparing two Parikh vectors is no more a constant time operation and checking for empty intersec- tions is not a trivial task. In fact, sorting the set of vectors requires a full order to be defined. We can define an order component by component giving more value to the first component, then to the second one and so on. More formally, we define x < y, with x, y ∈ Nσ, if there exist 1 ≥ k ≥ σ such that x[k] < y[k] and, for any i with 1 ≤ i < k, x[i] = y[i]. Notice that comparing two vectors will take BO(σ) time. Now, one can sort two list of n vectors of dimension σ − 1, i.e., MA[(cid:96)] and MB[(cid:96)], in O(σ n) by using n comparisons taking O(σ) each. Therefore, now the algorithm runs in O(σ n2) time using O(σ n log σ) bits of extra space. 4. A Sub-quadratic Algorithm for the Binary Case In Section 3, we have presented an O(n2) algorithm to compute the LCAF between two binary strings and two occurrences of common abelian factors, one in each string, having LCAF length. In this section, we show how we can achieve a better running time for the LCAF problem. We will make use of the recent data structure of Moosa and Rahman [MR10] for indexing an abelian pattern. The results of Moosa and Rahman [MR10] is presented in the form of following lemmas with appropriate rephrasing to facilitate our description. Lemma 3. (Interpolation lemma). If S1 and S2 are two substrings of a string S on a binary alphabet such that (cid:96) = S1 = S2, i = S11, j = S21, j > i + 1, then, there exists another substring S3 such that (cid:96) = S3 and i < S31 < j. Lemma 4. Suppose we are given a string S of length n on a binary alpha- bet. Suppose that maxOne(S, (cid:96)) and minOne(S, (cid:96)) denote, respectively, the maximum and minimum number of 1's in any substring of S having length (cid:96). Then, for all 1 ≤ (cid:96) ≤ n, maxOne(S, (cid:96)) and minOne(S, (cid:96)) can be computed in O(n2/ log n) time and linear space. A result similar to Lemma 3 is contained in the paper of Cicalese et al. [CFL09, Lemma 4], while the result of Lemma 4 has been discovered simulta- neously and independently by Moosa and Rahman [MR10] and by Burcsi et al. [BCFL10]. In addition to the above results we further use the following lemma. Lemma 5. Suppose we are given two binary strings A, B of length n each. There is a common abelian factor of A and B having length (cid:96) if and only if maxOne(B, (cid:96)) ≥ minOne(A, (cid:96)) and maxOne(A, (cid:96)) ≥ minOne(B, (cid:96)). Proof. Assume that minA = minOne(A, (cid:96)), maxA = maxOne(A, (cid:96)), minB = minOne(B, (cid:96)), maxB = maxOne(B, (cid:96)). Now by Lemma 3, for all minA ≤ kA ≤ 5 maxA, we have some (cid:96)-length substrings A(kA) of A such that A(kA)1 = kA. Similarly, for all minB ≤ kB ≤ maxB, we have some (cid:96)-length factors B(k) of B such that B(kB)1 = kB. Now, consider the range [minA . . maxA] and [minB . . maxB]. Clearly, these two ranges overlap if and only if maxB (cid:54)< minA and maxA (cid:54)< minB. If these two ranges overlap then there exists some k such that minA ≤ k ≤ maxA and minB ≤ k ≤ maxB. Then we must have some substring (cid:96)-length factors A(k) and B(k). Hence the result follows. Let us now focus on devising an algorithm for computing the LCAF given two binary strings A and B of length n. For all 1 ≤ (cid:96) ≤ n, we compute maxOne(A, (cid:96)), minOne(A, (cid:96)), maxOne(B, (cid:96)) and minOne(B, (cid:96)) in O(n2/ log n) time (Lemma 4). Now we try to check the necessary and sufficient condition of Lemma 5 for all 1 ≤ (cid:96) ≤ n starting from n down to 1. We compute the highest (cid:96) such that [minOne(A, (cid:96)) . . maxOne(A, (cid:96))] and [minOne(B, (cid:96)) . . maxOne(B, (cid:96))] overlap. Suppose that K is the set of values that is contained in the above overlap, that is K = { k k ∈ [minOne(A, (cid:96)) . . maxOne(A, (cid:96))] and k ∈ [minOne(B, (cid:96)) . . maxOne(B, (cid:96))] }. Then by Lemma 5, we must have a set S of common abelian factors of A, B such that for all S ∈ S, S = (cid:96). Since we identify the highest (cid:96), the length of a longest common factor must be (cid:96), i.e., LCAF length is (cid:96). Additionally, we have further identified the number of 1's in such longest factors in the form of the set K. Also, note that for a k ∈ K we must have a factor S ∈ S such that S1 = k. Now let us focus on identifying an occurrence of the LCAF. There are a number of ways to do that. But a straightforward and conceptually easy way is to run the folklore (cid:96)-window based algorithm in [MR10] on the strings A and B to find the (cid:96)-length factor with number of 1's equal to a particular value k ∈ K. The overall running time of the algorithm is deduced as follows. By Lemma 4, the computation of maxOne(A, (cid:96)), minOne(A, (cid:96)), maxOne(B, (cid:96)) and minOne(B, (cid:96)) can be done in O(n2/ log n) time and linear space. The checking of the condition of Lemma 5 can be done in constant time for a particular value of (cid:96). Therefore, in total, it can be done in O(n) time. Finally, the folklore algorithm requires O(n) time to identify an occurrence (or all of them) of the factors. In total the running time is O(n2/ log n) and linear space. 5. Towards a Better Time Complexity In this section we discuss a simple variant of the quadratic algorithm pre- sented in 3. We recall that the main idea of the quadratic solution is to find the greatest (cid:96) with MA[(cid:96)](cid:84) MB[(cid:96)] (cid:54)= ∅. The variant we present here is based on the following two simple observations: 1. One can start considering sets of factors of decreasing lengths; 6 2. When an empty intersection is found between MA[(cid:96)] and MB[(cid:96)], some rows can possibly be skipped based on the evaluation of the gap between MA[(cid:96)] and MB[(cid:96)]. skip trick. Assume that MA[(cid:96)] and MB[(cid:96)] have been computed and MA[(cid:96)](cid:84) MB[(cid:96)] = The first observation is trivial. The second observation is what we call the ∅ have been found. It is easy to see that, for any starting position i and for any component j (i.e., a letter aj), we have MA[(cid:96)][i][j] − 1 ≤ MA[(cid:96) − 1][i][j] ≤ MA[(cid:96)][i][j] + 1 Exploiting this property, we keep track, along the computation of MA[(cid:96)] and MB[(cid:96)], of the minimum and maximum values that appear in Parikh vectors of factors of length (cid:96). We use four arrays indexed by σ, namely minA, maxA, minB, maxB. Notice that such arrays do not represent Parikh vectors as they just contain min and max values component by component. Formally, minA[j] = min{MA[(cid:96)][i][j]}, for any i = 1, . . . (cid:96) + 1. The others have similar definitions. We compare, component by component, the range of aj in A and B and j=1 (minB[j] − maxA[j]), assuming minB[j] ≥ we skip as many Rows as maxσ−1 maxA[j] (swap A and B, otherwise). The modified algorithm is reported in Algorithm 1. Note that the tricks employed in our skip trick algorithm are motivated by the fact that the expected value of the LCAF length of an independent and identically distributed (i.i.d.) source is exponentially close to n according to classic Large Deviation results [Ell85]. The same result is classically extended to an ergodic source and it is meant to be a good approximation for real life data when the two strings follow the same probability distribution. Based on this, we have the following conjecture. Conjecture 6. The expected length of LCAF between two strings A, B drawn from an i.i.d. source is LCAFavg = n − O(log n), where A = B = n, and the number of computed Rows in Algorithm 1 is Ø(log n) in average. Finally, we will make use of one more trick, that is, computing the first vector of the current row in constant time from the first vector of the previous row, when we skip some rows, instead of computing the new row from scratch, we can use the first vector of the row below to compute the first vector of the new row. When we compute the rows we need, we will just populate the required two lists and save a copy of the first vector of the computed row as we will need it along the next iterative steps as shown in Algorithm 2. For instance, if we know M[(cid:96)] and we jump to M[(cid:96)−3], i.e., we skip M[(cid:96)−1] and M[(cid:96)− 2], we take M[(cid:96)][1] and compute in constant time M[(cid:96)− 1][1], M[(cid:96)− 2][1], then again compute M[(cid:96) − 3][1]. From M[(cid:96)][1], to compute M[(cid:96) − 1][1], we have to subtract 1 from the vector M[(cid:96)][1] at index s[(cid:96)], that is the last character of the factor of length (cid:96) starting at position 1 (i.e., M[(cid:96)][1]). For example, consider s = aacgcctaatcg, we have M[12][1] = (4a, 4c, 2g, 2t) and M[11][1] = (4a, 4c, 1g, 2t), i.e., (4a, 4c, 2g, 2t) minus 1g. 7 Algorithm 1 Compute LCAF of x and y using the skip trick. 1: function ComputeLCAF(x, y) 2: 3: 4: 5: 6: set (cid:96) = n = x set found = False compute maxx = MAX(x, (cid:96)), maxy = MAX(y, (cid:96)) compute minx = MIN(x, (cid:96)), miny = MIN(y, (cid:96)) if maxx == maxy then 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: else found = True (cid:96) = (cid:96)− SKIP(minx, maxx, miny, maxy) end if while (found == False) AND ((cid:96) ≥ 0) do compute maxx = MAX(x, (cid:96)), minx = MIN(x, (cid:96)) compute maxy = MAX(y, (cid:96)), miny = MIN(y, (cid:96)) compute listx = Mx[(cid:96)], listy = My[(cid:96)] sort listx, listy compute listx(cid:84) listy if listx(cid:84) listy (cid:54)= ∅ then end if (cid:96) = (cid:96)− SKIP(minx, maxx, miny, maxy) found = True break end while return (cid:96) 18: 19: 20: 21: 22: 23: 24: end function 25: function max(s, (cid:96)) 26: 27: 28: 29: 30: count[s[i]]++ int count[σ],max[σ] for (i = 1; i ≤ (cid:96); i++) do end for max = count for (i = (cid:96); i < s − (cid:96); i++) do 31: 32: 33: 34: 35: 36: count[s[i − 1]]- - count[s[i + (cid:96) − 1]]++ if count[s[i + (cid:96) − 1]] ≥ max[s[i + (cid:96) − 1]] then max[s[i + (cid:96) − 1]] = count[s[i + (cid:96) − 1]] end if end for 37: return max 38: 39: end function 40: function skip(minx, maxx, miny, maxy) 41: 42: 43: int gap[σ − 1] for (j = 1; j < σ; j++) do if maxx[j] >= miny[j] then gap[j] = minx[j] − maxy[j] gap[j] = miny[j] − maxx[j] 8 else 44: 45: 46: 47: 48: 49: 50: end function end if end for return max(gap) 6. Experiments We have conducted some experiments to analyze the behaviour and running time of our skip trick algorithm in practice. The experiments have been run on a Windows Server 2008 R2 64-bit Operating System, with Intel(R) Core(TM) i7 2600 processor @ 3.40GHz having an installed memory (RAM) of 8.00 GB. Codes were implemented in C# language using Visual Studio 2010. Figure 1: Plot of the average number of rows computed executing Algorithm 1 on all the strings of length 2, 3, . . . 16 over the binary alphabet. Our first experiment have been carried out principally to verify our rationale behind using the skip trick. We experimentally evaluated the expected number of rows computed in average by using the skip trick of Algorithm 1. Figure 2: Plot of the average number of rows computed executing Algorithm 1 on both genomic and random datasets over the DNA alphabet. Figure 1 shows the average number of rows computed executing Algorithm 1 on all the strings of length 2, 3, . . . 16 over the binary alphabet. Naive method line refers to the number of rows used without the skip trick, but starting from 9 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 2 4 6 8 10 12 14 16 Average Count Length Skip trick Naive method log (n) 0 1 2 3 4 5 6 7 8 9 10 11 10 40 70 100 130 160 190 220 250 280 310 340 370 400 430 460 490 520 550 580 610 640 670 700 730 760 790 820 850 880 910 940 970 1000 Average Count Length log(n) Computed Rows (genomic data) Computed Rows (random data) (cid:96) = n and decreasing (cid:96) by one at each step. Notice that the skip trick line is always below the log n line. To this end we have conducted an experiment to evaluate the expected num- ber of rows computed by our skip trick algorithm. In particular, we have imple- mented the skip trick algorithm as well as the naive algorithm and have counted the average number of rows computed by the algorithms on all the strings of length 2, 3, . . . 16 on binary alphabet. The results are reported in Figure 1. It shows that the computed rows of x, y, starting from (cid:96) = n to (cid:96) = n− log n, sum up to O(log n). √ On the other hand, to reach a conclusion in this aspect we would have to increase the value of n in our experiment to substantially more than 64; for n is just above log n. Regrettably, limitation of computing power n = 64, prevents us from doing such an experiment. So, we resort to two more (non- comprehensive) experimental setup as follows to check the practical running time of the skip trick algorithm. Figure 3: Plot of the average number of rows computed executing Algorithm 1 on sequences taken from the Homo sapiens genome. Furthermore, we conduct our experiments on two datasets, real genomic data and random data. We have taken a sequence (S) from the Homo sapiens genome (250MB) for the former dataset. The latter dataset is generated randomly on the DNA alphabet (i.e., Σ = {a, c, g, t}). In particular, Here we have run the skip trick algorithm on 2 sets of pairs of strings of lengths 10, 20, .., 1000. For the genomic dataset, these pairs of strings have been created as follows. For each length (cid:96), (cid:96) ∈ {10, 20, .., 1000} two indexes i, j ∈ [1..x − (cid:96)] have been randomly selected to get a pair of strings S[i..i + (cid:96) − 1],S[j..i + (cid:96) − 1], each of length (cid:96). A total of 1000 pairs of strings have been generated in this way for each length (cid:96) and the skip trick algorithm has been run on these pairs to get the average results. On the other hand for random dataset, we simply generate the same number of strings pairs randomly and run the skip trick algorithm on each pair of strings and get the average results for each length group. In both cases, we basically count the numbers of computed rows. 10 0 2000 4000 6000 8000 10000 12000 10 50 90 130 170 210 250 290 330 370 410 450 490 530 570 610 650 690 730 770 810 850 890 930 970 Average Count Length Genomic Data First Vector Computed Rows Total n log(n) Figure 4: Plot of the average number of rows computed executing Algorithm 1 on randomly generated sequences over the alphabet Σ = {a, c, g, t}. Figure 2 shows the average number of rows computed executing Algorithm 1 on both genomic and random datasets over the DNA alphabet (i.e., Σ = {a, c, g, t}). Notice that the skip trick line is always below the log n line. Figure 2 shows that the computed rows of x, y, starting from (cid:96) = n to (cid:96) = n − log n, sum up to O(log n). We experimentally evaluated the computing of the first vector and the ex- pected number of rows computed in average by employing the first vector trick (Algorithm 2). We have used the same experiment configuration as the above. The average number of rows and of the first vector computed executing Algo- rithm 2 on both genomic and random datasets over the DNA alphabet (i.e., Σ = {a, c, g, t}). In both cases, we basically count the numbers of computed rows and the first vector. The results are illustrated in Figures 3 and 4. In both cases, The figures report the average count of computed rows (Num- ber of Rows), the average count of the first vector (First Vector) and the sum- mation of these two counts (Total). It also shows the n log n curve. Both of the figures show that the algorithm computed the first vector of the visited rows in O(n) and the total running time for Algorithm 2 would be O(n log n) in practice. Since any row computation takes O(σ n), this suggests an average time complexity of O(σ n log n), i.e., O(n log n) for a constant alphabet. 7. Conclusion In this paper we present a simple quadratic running time algorithm for the LCAF problem and a sub-quadratic running time solution for the binary string case, both having linear space requirement. Furthermore, we present a variant of the quadratic solution that is experimentally shown to achieve a better time complexity of O(n log n). 11 0 2000 4000 6000 8000 10000 12000 10 40 70 100 130 160 190 220 250 280 310 340 370 400 430 460 490 520 550 580 610 640 670 700 730 760 790 820 850 880 910 940 970 1000 Average Count Length Random Data First Vector Computed Rows Total n log(n) Algorithm 2 Compute LCAF of x and y using the first vector trick. 1: function first(s, (cid:96)) 2: 3: 4: 5: int first[σ] for (i = 1; i < (cid:96); i++) do first[s[i]]++ end for return first 6: 7: end function 8: function row(s, (cid:96), first) 9: 10: 11: 12: int row[σ] row =first for (i = 1; i < s − (cid:96); i++) do row[s[i − 1]]- - row[s[i + l − 1]]++ 13: end for 14: return row 15: 16: end function 17: function ComputeLCAF(x, y) 18: 19: set (cid:96) = n = x set found = False compute f irstx = F IRST (x, (cid:96)) compute f irsty = F IRST (y, (cid:96)) while (found == False) AND ((cid:96) ≥ 0) do compute rowx = ROW (x, (cid:96), f irstx) compute rowy = ROW (y, (cid:96), f irsty) compute listx = Mx[(cid:96)], listy = My[(cid:96)] sort listx, listB compute listx(cid:84) listy if listx(cid:84) listy (cid:54)= ∅ then found = True break end if compute maxx = M AX(x, (cid:96)), minx = M IN (x, (cid:96)) compute maxy = M AX(y, (cid:96)), miny = M IN (y, (cid:96)) (cid:96) = (cid:96)− SKIP(minx, maxx, miny, maxy) 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: end while return (cid:96) 36: 37: end function Acknowledgement We thank Thierry Lecroq and Arnaud Lefebvre for proposing the LCAF problem and the participants of Stringmasters 2013 meetings for helping us to get more involved with this topic. 12 References [BCFL10] Peter Burcsi, Ferdinando Cicalese, Gabriele Fici, and Zsuzsanna Lipt´ak. On table arrangements, scrabble freaks, and jumbled pattern matching. In Paolo Boldi and Luisa Gargano, editors, FUN, volume 6099 of Lecture Notes in Computer Science, pages 89 -- 101. Springer, 2010. [CFL09] Ferdinando Cicalese, Gabriele Fici, and Zsuzsanna Lipt´ak. Searching for jumbled patterns in strings. In Jan Holub and Jan Zd´arek, editors, Stringology, pages 105 -- 117. Prague Stringology Club, Department of Computer Science and Engineering, Faculty of Electrical Engineer- ing, Czech Technical University in Prague, 2009. [CLRS01] Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms. MIT Press, Cambridge, MA, second edition, 2001. [Ell85] R. S. Ellis. Entropy, Large Deviations, and Statistical Mechanics. Springer, 1985. [Erd61] P. Erdos. Some unsolved problems. Magyar Tud. Akad. Mat. Kutato. Int. Kozl., 6:221 -- 254, 1961. [Gus97] Dan Gusfield. Algorithms on Strings, Trees, and Sequences - Com- puter Science and Computational Biology. Cambridge University Press, 1997. [MR10] Tanaeem M. Moosa and M. Sohel Rahman. Indexing permutations for binary strings. Inf. Process. Lett., 110(18-19):795 -- 798, September 2010. [Par66] R. J. Parikh. On context-free languages. J. Assoc. Comput. Mach., 13(4):570 -- 581, 1966. 13
1503.07192
1
1503
2015-03-24T20:39:43
Shortest-Path Queries in Planar Graphs on GPU-Accelerated Architectures
[ "cs.DS" ]
We develop an efficient parallel algorithm for answering shortest-path queries in planar graphs and implement it on a multi-node CPU/GPU clusters. The algorithm uses a divide-and-conquer approach for decomposing the input graph into small and roughly equal subgraphs and constructs a distributed data structure containing shortest distances within each of those subgraphs and between their boundary vertices. For a planar graph with $n$ vertices, that data structure needs $O(n)$ storage per processor and allows queries to be answered in $O(n^{1/4})$ time.
cs.DS
cs
Shortest-Path Queries in Planar Graphs on GPU-Accelerated Architectures Guillaume Chapuis and Hristo Djidjev Los Alamos National Laboratory, Los Alamos, NM 87545, USA {gchapuis,djidjev}@lanl.gov Abstract. We develop an efficient parallel algorithm for answering shortest- path queries in planar graphs and implement it on a multi-node CPU/GPU clusters. The algorithm uses a divide-and-conquer approach for decom- posing the input graph into small and roughly equal subgraphs and con- structs a distributed data structure containing shortest distances within each of those subgraphs and between their boundary vertices. For a pla- nar graph with n vertices, that data structure needs O(n) storage per processor and allows queries to be answered in O(n1/4) time. Keywords: shortest path problems, graph algorithms, distributed com- puting, GPU computing, graph partitioning 1 Introduction Finding shortest paths (SPs) in graphs has applications in transportation, social network analysis, network routing, and robotics, among others. The problem asks for a path of shortest length between one or more pairs of vertices. There are many algorithm for solving SP problems sequentially. Dijkstra's algorithm [2] finds the distances between a source vertex v and all other vertices of the graph in O(m log n) time, where n and m are the numbers of the vertices and edges of the graph, respectively. It can also be used to find efficiently the distance between a pair of vertices. This algorithm is nearly optimal (within a logarithmic factor), but has irregular structure, which makes it hard to implement efficiently in parallel. Floyd-Warshall's algorithm, on the other hand, finds the distances between all pairs of vertices of the graph in O(n3) time, which is efficient for dense (m = Θ(n2)) graphs, has a regular structure good for parallel implementation, but is inefficient for sparse (m = O(n)) graphs such as planar graphs. In this paper we are considering the query version of the problem. It asks to construct a data structure that will allow to answer any subsequent distance query fast. A distance query asks, given an arbitrary pair of vertices v, w, to compute dist(v, w). This problem has applications in web mapping services such as MapQuest and Google Maps. There is a tradeoff between the size of the data structure and the time for answering a query. For instance, Dijkstra's algorithm gives a trivial solution of the query version of the SP problem with (small) O(n + m) space (for storing the input graph), but large O(m log n) query time (for running Dijkstra's algorithm with a source the first query vertex). On the other end of the spectrum, Floyd-Warshall's algorithm can be used to construct a (large) O(n2) data structure (the distance matrix) allowing (short) O(1) query time (retrieving the distance from the data base). However, for very large graphs, the O(n2) space requirement is impractical. We are interested in an algorithm that needs significantly less than than O(n2) space, but will answer queries faster than Disjkstra's algorithm. Our algorithm will use the structure of planar graphs for increased efficiency, as most road networks are planar or near-planar, and will also be highly parallelizable, making use of the features available in modern high-performance clusters and specialized processors such as the GPUs. The query version for shortest path queries in planar graphs was proposed in [3] and after that different aspects of the problem were studied by multiple authors, e.g., [6,1,8,9]. Here we present the first distributed implementation for solving the problem that is designed to make use of the potential for parallelism offered by GPUs. Our solution makes use of the fast parallel algorithm for com- puting shortest paths in planar graphs from [4], resulting in asymptotically faster and also shown to be efficient in practice. 2 Preliminaries Given a graph G with a weight wt(e) on each edge e, the length of a path p is the sum of the weights of the edges of the path. The single-pair shortest path problem (SPSP ) is, given a pair v, w of vertices of G, to find a path between v and w, called shortest path (SP), with minimum length. The length of that path is called distance between v and w and is denoted as dist(v, w). For any subgraph H of G, the distance between v and w in H is denoted as distH (v, w). The single-source shortest path problem (SSSP ) is to find SPs from a fixed vertex v to all other vertices of G. Finally, the all-pairs shortest path problem (APSP ) is to find SPs between all pairs of vertices. There are distance versions of SPSP, SSSP, and APSP, which are more commonly studied, where the objective is to compute the corresponding distances instead of SPs. Most distance algorithms allow the corresponding SPs to be retrieved in additional time proportional to the number of the edges of the path. In this paper, by SPSP, SSSP, and APSP we mean the distance versions of these problems. A k-partition P of G is a set V1, . . . , Vk of subsets of V (G), the set of the i=1 Vi = V (G). We call the subgraphs of G induced by Vi components of P. The boundary of the partition consists consists of all vertices of G that have at least one neighbor in a different component. We denote by BG(G) or simply by BG the subgraph of G induced by the boundary vertices. For any C ∈ P, we denote by B(C) the set of all boundary vertices that are from C. For any planar graph of n vertices and bounded (O(1) as a function of n) vertex degree one can find in O(n) time a k-partition P with vertices of G, such that Vi ∩ Vj = ∅ if i (cid:54)= j and (cid:83)k B(C) = O((cid:112)n/k) for each component C ∈ P. 3 Algorithm overview and analysis Our algorithm works in two modes: preprocessing mode, during which a data structure is computed that allows efficient SP queries, and the query mode that uses that data structure to compute the distance between a query pair of vertices. We assume that the input is a planar graph G of n vertices and bounded vertex degree and the cluster has p nodes. 3.1 Preprocessing mode The preprocessing algorithm (Algorithm 1) has three phases. During the first phase (line 1), the graph is partitioned and each component is assigned to a distinct cluster node. During the second phase (lines 2-5), the APSP problem is solved for each component C independently and in parallel and the computed distance matrix APSP(C) is stored at the same node. Finally, in the third phase (lines 6-10), the boundary graph BG is constructed and the APSP is solved for BG. That computation is done distributedly such that the distances from vertex v ∈ BG to all other vertices of BG are computed at the node containing v, by using Dijkstra's algorithm [2]. The computed distance matrix is stored at the node that has done the computations. Hence, at the end of the algorithm, the node N (C) contains two matrices: one containing the SP distances in C and the other containing all SP distances in BG with source a vertex in BG ∩ C. One can think of BG as a compressed version of G where the non-boundary vertices are removed, but are implicitly represented in BG by the information encoded in its edge weights. Note however that the distances APSP(C) (and the corresponding edge weights of BG) are not distances in G; the reason is that a shortest path between two vertices v and w from C might pass through vertices not in C. Hence the following fact is non-trivial. Lemma 1. [4] For any two vertices v, w ∈ BG the distance between v and w in BG is equal to the distance between v and w in G. We will next estimate the time and space (memory) required to run the al- gorithm. As G is planar and of bounded vertex degree (as a function of n), it can be divided in O(n) time into k parts so that each part has no more than (n/k) vertices and O((cid:112)n/k) boundary vertices [5]. We will estimate the require- ments of each phase. Since the maximum amount of coarse-grained parallelism of Algorithm 1 is min{p, k}, we assume without loss of generalization that p ≤ k. Phase 1 requires O(n) running time and O(n) space [5]. The complexity of Phase 2 is dominated by the time for computing dis- tances in line 3. We assume that we are using the algorithm from [4] that can be implemented efficiently on a GPU-accelerated architecture and has complex- ity O(N 9/4). Then Phase 2 requires O((k/p)(n/k)9/4) = O(n9/4/(pk5/4)) time and kO((n/k)(cid:112)n/k) = O(n3/2/k1/2) total space. The space per processor is For Phase 3, the number of the vertices of BG is k O((cid:112)n/k) = O( the number of the edges is k O(((cid:112)n/k)2) = O(n). One execution of line 8 (for one kO((n/k)2) = O(n2/k). √ nk) and component C) takes (k/p)BG∩CE(BG) log(BG) = (k/p)O((cid:112)n/k)O(n log n) CBG = O((cid:112)n/k time and O(n) space. The space needed for one iteration of Step 9 is BG ∩ nk) = O(n). Hence Phase 3 requires O((k/p)n3/2/k1/2 log n) √ = O(n3/2k1/2 log n/p) time and O(nk/p) space per processor. Summing up the requirements for Phases 1, 2, and 3, we get O(n9/4/(pk5/4)+ n3/2k1/2 log n/p)) time and O(n + n2/(pk) + nk/p) space per processor needed for Algorithm 1. Assuming space is more important in this case than time (since nodes have limited memory), we find that k = n1/2 minimizes the function n2/k + nk. Hence we have the following result. Lemma 2. With k = (cid:100)n1/2(cid:101) and p ≤ k, Algorithm 1 runs in O(n7/4 log n/p) time and uses O(n3/2/p) space per processor. With p = k, the time and space are O(n5/4) and O(n), respectively. The time bound of Lemma 2 is conservative as it doesn't take into account our use of fine-grain parallelism due to multi-threading, e.g., by the GPUs. Algorithm 1 Preprocessing algorithm Input: A planar graph G Output: A data structure for efficient shortest path queries in G 1: Construct a k-partition P of G and assign each component C to a distinct node /∗ Partitioning ∗/ N (C) /∗ Solve the APSP problem for each component ∗/ 2: for all components C ∈ P do in parallel 3: 4: Solve APSP for C and save the distances in a table APSP(C) For each pair of boundary vertices v, w ∈ C define edge (v, w), if not already in G, and assign a weight wt(v, w) = distC (v, w) 5: end for /∗ Solve the APSP problem for the boundary graph ∗/ defined in the previous step and store it at each node 6: Define a boundary graph BG with vertices all boundary vertices of G and edges as 7: for all components C ∈ P do in parallel 8: 9: Solve SSSP in BG for each vertex of C ∩ BG Store the distances from all vertices of C ∩ BG to all vertices of BG in a table APSPBG (C) 10: end for 3.2 Query mode The query algorithm (Algorithm 2) is based on the fact that if C1 (cid:54)= C2, then any path between v1 and v2 should cross both B(C1) and B(C2). Let π be a shortest path between v1 and v2. Then π can be divided into three parts: from v1 to a vertex b1 from B(C1), from b1 to a vertex b2 on p from B(C2), and from b2 to v2. Vertices b1 and b2 minimizing the length of p are found as follows: in the loop on lines 2-7, for each b2 an optimal b1 and dist(v1, b2) are found; in lines 10-12 an optimal b2 is found. Algorithm 2 Query algorithm Input: Vertices v1, v2 of G, a k-partition P of G, tables APSP(C) and APSPBG (C) for all C ∈ P Output: dist(v1, v2) 1: Determine components C1 and C2 such that v1 ∈ C1, v2 ∈ C2 2: for all vertices b2 ∈ B(C2) do in parallel /∗ Compute dist(v1, b2) ∗/ dist(v1, b2) = ∞ for all vertices b1 ∈ B(C1) do dist(v1, b2) = min{dist(v1, b2), distC1 (v1, b1) + distBG (b1, b2)} 3: 4: 5: 6: 7: end for 8: If N (C1) (cid:54)= N (C2) then transfer the column of SP(C2) corresponding to v2 from end for /∗ Now we can compute dist(v1, v2) ∗/ N (C2) to N (C1). 9: dist(v1, v2) = ∞ 10: for all vertices b2 ∈ B(C2) do 11: 12: end for 13: If C1 = C2 then dist(v1, v2) = min{dist(v1, v2), distC1 (v1, v2)}, where the distance dist(v1, v2) = min{dist(v1, v2), dist(v1, b2) + distC2 (b2, v2)} distC1 (v1, v2) is taken from APSP(C1). Lemma 3. Algorithm 2 correctly computes dist(v1, v2) and its running time is O(n1/4) with k = (cid:100)n1/2(cid:101) and p ≥ (cid:100)n1/4(cid:101). Proof. Let π be a shortest path between v1 and v2, let C1 (cid:54)= C2, and let b1 be the first vertex along π that is on B(C1) and π1 be the subpath of π from v1 to b1, let π2 be the last vertex along π that is on B(C2) and π2 be the subpath of π from b1 to b2, and let π3 be the subpath of π from b2 to v2. Then π1 is entirely in C1 and hence distC1(v1, b1) = distG(v1, b1) (note, however, that the distances in APSP(C1) from v1 to other vertices from B(C1) may not be correct). Similarly, distC2(b2, v2) = distG(b2, v2). Finally, distBG (b1, b2) = distG(b1, b2) by Lemma 1. Hence lines 5 and 11 use correct values for computing the distances between v1 and b2 and between b2 and v2. The loop on lines 5-10 takes time B(C1)B(C2)/p = O((cid:112)n/k(cid:112)n/k/p) = If C1 = C2 (line 13), then a shortest path between v1 and v2 may or may not leave C1. In the first case lines 1-12 compute correctly dist(v1, v2), in the second case APSP(C1) contains the correct distance. O(n/(pk)), for p ≤ min{k, (n/k)1/2}. If k = n1/2 and p = n1/4 (the maximum value for which the formula applies), that time becomes O(n1/4). The loop in lines 10-12 takes time O((n/k)1/2) = O(n1/4) for k = n1/2. Note that using the methodology of [3], a more complex implementation of Algorithm 2 can reduce the query time to logarithmic. Note also that compu- tation in lines 2-7 can be overlapped with transferring of data in line 8 thereby saving time (upto a factor of two). 4 Implementation details In this section, we describe how the preprocessing and query modes are imple- mented on a hybrid CPU-GPU cluster. We use a distance matrix to represented both the input graph G and the output. Such a 2-dimensional matrix contains in cell (i, j) the value of the distance from vertex i to vertex j. Initially, cell (i, j) contains wt(i, j) if an edge (i, j) is present in G, or infinity otherwise. These values are updated as the algorithm progresses. At the end of the algorithm, cell (i, j) contains dist(i, j). In phase 1 of the preprocessing mode, we construct a k-partition of G using the METIS library[7]. Based on that partition, we reorder the vertices of G so that vertices from the same component have consecutive indices and boundary vertices of each components have the lowest indices -- see Figure 1 . Fig. 1: Distance matrix after reorder- ing of the vertices. Vertices from the same component are stored contigu- ously starting with boundary vertices. Red submatrices are also part of the boundary distance matrix. Grey sub- matrices do not generate any compu- tations in preprocessing mode. Fig. 2: The distances required to com- pute dist(v, w), shown in green, are scattered in three submatrices: two di- agonal ones, for component I and for component J, and a non-diagonal sub- matrix (I, J). In phase 2, we compute the shortest distances within each of the components. For k components, this phase gives a total k independent tasks that can be executed in parallel. Computations at this phase are already balanced across C1C3C2C1C3C1C3B(C1)B(C1)other C1B(C1)other C1other C1VerticesB(C1)B(C3)other C1B(C3)B(C1)other C3other C1otherC3vw......Submatrix (I, I)Submatrix (I, J)Submatrix (J, J)B(CI)B(CJ)vB(CI)wB(CJ) nodes as components contain roughly the same number of vertices and the APSP algorithm from [4] ensures the same O(N 9/4) complexity with respect to the number of nodes. Finally, phase 3 consists in computing the shortest distances within the boundary graph using Dijkstra's algorithm. Computations at this phase may be imbalanced between nodes for two reasons. First, the number of boundary vertices in two components may differ and, second, the complexity of Dijkstra's algorithm does not solely depend on the number of vertices in the graph, but also on the number of edges, which may vary even more than the number of vertices between two components' boundary graphs. In the query mode, we are interested in finding dist(v, w), where v and w are from components I and J, respectively. The required values for that computation are scattered in three submatrices, as illustarted in Figure 2. For such a query, assuming k = p, node i, holding the required values from diagonal submatrix I and non-diagonal submatrix (I, J), will be in charge of the computations. Required values from diagonal submatrix J are held by node j and need to be transfered to node i. 5 Experimental evaluation In this section we describe experiments designed to test our algorithm and its implementation. Specifically, we are going to test the strong scaling properties by running our code on a fixed graph size and a varying number p of cluster nodes and number k of components. All computations are run on a 300 node cluster. Each cluster node is comprised of 2 x Eight-Core Intel Xeon model E5-2670 @ 2.6 GHz and two GPGPU Nvidia Tesla M2090 cards connected to PCIe-2.0 x16 slots. In order to make full use of the available GPUs, each node is assigned at least two graph components so that the two associated diagonal submatrices can be computed simultaneously on the two GPUs. For the strong-scaling experiment, the graph size is fixed to 256k vertices. Preprocessing and queries are run with increasing numbers of nodes ranging from 4 to 64. Each node handles 2 components (one per available GPU); therefore the number of components k ranges from 8 to 128. Figure 3 shows the run times for the preprocessing mode. For low numbers of nodes and thus low values of k, preprocessing time is dominated by step 2 - the computation of the shortest distances within each component - since lower k values means larger components. For higher numbers of nodes and thus higher values of k, preprocessing time becomes dominated by step 3 - the computation of the boundary graph - as more components mean higher numbers of incident edges and thus larger boundary graphs. Note that while the figure seems to show supralinear speedup, that is not the case (and similarly for the memory usage). The reason is that, with increasing the number of processors p, the number k of parts is increased too (as it is tied to p in this implementation) and hence the complexity of the algorithm is also reduced. Fig. 3: Preprocessing run times for a fixed graph size of 256k vertices and in- creasing number of nodes. Fig. 4: Peak memories and run times for 10k queries for a fixed graph size of 256k vertices and increasing number of parts/processors. Figure 4 shows the query times and peak memory usage per node. The run times are given for 10, 000 queries from random sources to random targets. Note that in the query mode only fine-grain (node-level) parallelism is used, while multiple nodes are still needed for distributed storage and, optionally, to handle multiple queries in parallel (not implemented in the current version). For the n -- or 512 memory usage, the optimal value for k, theoretically expected to be for this instance -- is not reached in this experiment since k only goes up to 128. We can however see that peak memory usage per node is still dropping with increasing values of k up to 128. The query times in the figure vary from about 2 milliseconds per query for k = 8 to 0.25 milliseconds for k = 128. Compared with the Boost library implementation of Dijkstra's algorithm, our implementation answers queries on the largest instances about 1000 times faster. √ 6 Conclusion √ We developed and implemented a distributed algorithm for shortest path queries in planar graphs with good scalability. It allows answering SP queries in O(n1/4) n) processors with O(n) space per processor and O(n5/4) time by using O( preprocessing time. Our implementation on 300 node CPU-GPU cluster has preprocessing time of less than 10 seconds using 32 or more nodes and 0.025 milliseconds per query using two nodes. Interesting tasks for future research is implementing a version allowing parallel queries and reducing the query time of the implementation to O(log n) by using properties of graph planarity. References 1. Chen, D.Z., Xu, J.: Shortest path queries in planar graphs. pp. 469 -- 478. STOC '00, ACM, New York, NY, USA (2000) 2. Dijkstra, E.W.: A note on two problems in connexion with graphs. Numerische mathematik 1(1), 269 -- 271 (1959) 481632640200400600800100012001400run time step 3 (s)run time step 2 (s)run time init +step 1 (s)# of nodesrun time (s)48163264051015202505101520253035peak memory (GB)run time queries (s)# of nodesRun time (s)Peak memory (GB) 3. Djidjev, H.: Efficient algorithms for shortest path queries in planar digraphs. In: Graph-Theoretic Concepts in Computer Science, Lecture Notes in Computer Sci- ence, vol. 1197, pp. 151 -- 165 (1997) 4. Djidjev, H., Thulasidasan, S., Chapuis, G., Andonov, R., Lavenier, D.: Efficient multi-GPU computation of all-pairs shortest paths. In: IPDPS'2014. pp. 360 -- 369 (2014) 5. Frederickson, G.N.: Planar graph decomposition and all pairs shortest paths. J. ACM 38(1), 162 -- 204 (1991) 6. Hutchinson, D., Maheshwari, A., Zeh, N.: An external memory data structure for shortest path queries (extended abstract). pp. 51 -- 60. COCOON'99, Springer-Verlag, Berlin, Heidelberg (1999) 7. Karypis, G., Kumar, V.: Multilevel k-way partitioning scheme for irregular graphs. Journal of Parallel and Distributed computing 48(1), 96 -- 129 (1998) 8. Kowalik, L.: Shortest path queries in planar graphs in constant time. In: STOC03. pp. 143 -- 148. ACM (2003) 9. Mozes, S., Sommer, C.: Exact distance oracles for planar graphs. pp. 209 -- 222. SODA '12, SIAM (2012)
1607.08337
2
1607
2017-02-06T13:00:15
Efficient Algorithms for Constructing Very Sparse Spanners and Emulators
[ "cs.DS" ]
Miller et al. \cite{MPVX15} devised a distributed\footnote{They actually showed a PRAM algorithm. The distributed algorithm with these properties is implicit in \cite{MPVX15}.} algorithm in the CONGEST model, that given a parameter $k = 1,2,\ldots$, constructs an $O(k)$-spanner of an input unweighted $n$-vertex graph with $O(n^{1+1/k})$ expected edges in $O(k)$ rounds of communication. In this paper we improve the result of \cite{MPVX15}, by showing a $k$-round distributed algorithm in the same model, that constructs a $(2k-1)$-spanner with $O(n^{1+1/k}/\epsilon)$ edges, with probability $1- \epsilon$, for any $\epsilon>0$. Moreover, when $k = \omega(\log n)$, our algorithm produces (still in $k$ rounds) {\em ultra-sparse} spanners, i.e., spanners of size $n(1+ o(1))$, with probability $1- o(1)$. To our knowledge, this is the first distributed algorithm in the CONGEST or in the PRAM models that constructs spanners or skeletons (i.e., connected spanning subgraphs) that sparse. Our algorithm can also be implemented in linear time in the standard centralized model, and for large $k$, it provides spanners that are sparser than any other spanner given by a known (near-)linear time algorithm. We also devise improved bounds (and algorithms realizing these bounds) for $(1+\epsilon,\beta)$-spanners and emulators. In particular, we show that for any unweighted $n$-vertex graph and any $\epsilon > 0$, there exists a $(1+ \epsilon, ({{\log\log n} \over \epsilon})^{\log\log n})$-emulator with $O(n)$ edges. All previous constructions of $(1+\epsilon,\beta)$-spanners and emulators employ a superlinear number of edges, for all choices of parameters. Finally, we provide some applications of our results to approximate shortest paths' computation in unweighted graphs.
cs.DS
cs
Efficient Algorithms for Constructing Very Sparse Spanners and Emulators∗ Michael Elkin†1 and Ofer Neiman‡1 1Department of Computer Science, Ben-Gurion University of the Negev, Beer-Sheva, Israel. Email: {elkinm,neimano}@cs.bgu.ac.il Abstract Miller et al. [MPVX15] devised a distributed1 algorithm in the CONGEST model, that given a parameter k = 1, 2, . . ., constructs an O(k)-spanner of an input unweighted n-vertex graph with O(n1+1/k) expected edges in O(k) rounds of communication. In this paper we improve the result of [MPVX15], by showing a k-round distributed algorithm in the same model, that constructs a (2k − 1)- spanner with O(n1+1/k/ǫ) edges, with probability 1 − ǫ, for any ǫ > 0. Moreover, when k = ω(log n), our algorithm produces (still in k rounds) ultra-sparse spanners, i.e., spanners of size n(1 + o(1)), with probability 1 − o(1). To our knowledge, this is the first distributed algorithm in the CONGEST or in the PRAM models that constructs spanners or skeletons (i.e., connected spanning subgraphs) that sparse. Our algorithm can also be implemented in linear time in the standard centralized model, and for large k, it provides spanners that are sparser than any other spanner given by a known (near-)linear time algorithm. We also devise improved bounds (and algorithms realizing these bounds) for (1 + ǫ, β)-spanners and emulators. In particular, we show that for any unweighted n-vertex graph and any ǫ > 0, there exists a (1 + ǫ, ( log log n )log log n)-emulator with O(n) edges. All previous constructions of (1 + ǫ, β)-spanners and emulators employ a superlinear number of edges, for all choices of parameters. ǫ Finally, we provide some applications of our results to approximate shortest paths' computation in unweighted graphs. 1 Introduction 1.1 Setting, Definitions We consider unweighted undirected n-vertex graphs G = (V, E). For a parameter α ≥ 1, a subgraph H = (V, E′), E′ ⊆ E, is called an α-spanner of G, if for every pair u, v ∈ V of vertices, we have dH (u, v) ≤ α · dG(u, v). Here dG(u, v) (respectively, dH (u, v)) stands for the distance between u and v in G (resp., in H). The parameter α is called the stretch of the spanner H. More generally, if for a pair of parameters α ≥ 1, β ≥ 0, for every pair u, v ∈ V of vertices, it holds that dH(u, v) ≤ α · dG(u, v) + β, then the subgraph H is said to be an (α, β)-spanner of G. Particularly important is the case α = 1 + ǫ, for ∗A preliminary version [EN17] of this paper appeared in SODA'17. †This research was supported by the ISF grant No. (724/15). ‡Supported in part by ISF grant No. (523/12) and by BSF grant No. 2015813. 1They actually showed a PRAM algorithm. The distributed algorithm with these properties is implicit in [MPVX15]. 1 some small ǫ > 0. Such spanners are called near-additive. If H = (V, E′′, ω), where ω : E′′ → R+, is not a subgraph of G, but nevertheless satisfies that for every pair u, v ∈ V of original vertices, dG(u, v) ≤ dH (u, v) ≤ (1 + ǫ)dG(u, v) + β, then H is called a near-additive β-emulator of G, or a (1 + ǫ, β)-emulator of G. Graph spanners have been introduced in [Awe85, PS89, PU89a], and have been intensively studied ever since [ADD+93, ABCP93, Coh99, ACIM99, DHZ00, BS03, Elk04, Elk07a, EZ06, TZ06, Woo06, Elk07b, Pet09, DGPV08, Pet10, BW15, MPVX15, AB16]. They were found useful for computing approximately shortest paths [ABCP93, Coh99, Elk04, EZ06], routing [PU89b], distance oracles and labeling schemes [Pel99, TZ05, EP15], synchronization [Awe85], and in other applications. The simplest and most basic algorithm for computing a multiplicative α-spanner, for a parameter α ≥ 1, is the greedy algorithm [ADD+93]. The algorithm starts with an empty spanner, and examines the edges of the input graph G = (V, E) one after another. It tests if there is a path in H of length at most α between the endpoints u and v of e. If it is not the case, the edge is inserted into the spanner. Otherwise the edge is dropped. It is obvious that the algorithm produces an α-spanner H. Moreover, the spanner H has no cycles of length α + 1 or less, i.e., the girth of H, denoted g(H), satisfies g(H) ≥ α + 2. Denote m = m(n, g) the maximum number of edges that a girth-g n-vertex graph may contain. It follows that H ≤ m(n, α + 2). The function m(n, g) is known to be at most n1+ 2 g−2 , when g ≤ 2 log2 n, and for larger g (i.e., for m ≤ 2n), it is given by m(n, g) ≤ n(1 + (1 + o(1)) ln(p+1) ), where p = m − n, [AHL02, BR10]. These bounds are called "Moore's bounds for irregular graphs", or shortly, (generalized) Moore's bounds. Any construction of multiplicative α-spanners for n-vertex graphs with at most m′(n, α + 2) edges implies an upper bound m(n, α + 2) ≤ m′(n, α + 2) for the function m(n, g). (As running the construction on the extremal girth-(α + 2) n-vertex graph can eliminate no edge.) Hence the greedy algorithm produces (See also [FS16].) multiplicative spanners with optimal tradeoff between stretch and number of edges. However, the greedy algorithm is problematic from algorithmic perspective. In the centralized model of computation, the best-known implementation of it [RZ04] requires O(α · n2+1/α) time. Moreover, the greedy algorithm is inherently sequential, and as such, it is generally hard2 to implement it in distributed and parallel models of computation. g In the distributed model [Pel00] we have processors residing in vertices of the graph. The processors communicate with their graph neighbors in synchronous rounds. In each round, messages of bounded length can be sent. (This is the assumption of the CONGEST model. In the LOCAL model, messages' size is arbitrary.) The running time of an algorithm is this model is the number of rounds that it runs. By "parallel" model we mean here PRAM EREW model [Rei93], and we are interested in algorithms with small running time (aka depth) and work complexities. (The latter measures the overall number of operations performed by all processors.) Dubhashi et al. [DMP+03] devised a distributed implementation of the greedy algorithm in the LOCAL model of distributed computation. Their algorithm runs in O(α · log2 n) rounds, i.e., suboptimal by a factor of log2 n. Moreover, it collects graph topology to depth O(α), and conducts heavy local computations. To our knowledge, there is no distributed-CONGEST or PRAM implementation of the greedy algorithm known. There is also no known efficient3 centralized, distributed-CONGEST, or PRAM algorithm that constructs ultra-sparse spanners, i.e., spanners with n + o(n) edges. 2In the sequel we discuss a distributed setting, specifically, the LOCAL model, in which a relatively efficient implementation of the greedy is known. 3By "efficient" centralized algorithm in this paper we mean an algorithm with running time close to O(E). By efficient distributed or parallel algorithm we mean an algorithm that runs in polylogarithmic, or nearly-polylogarithmic, time. 2 In the distributed and parallel settings it is often enough to compute a sparse skeleton H of the input graph G, where a skeleton is a connected subgraph that spans all the vertices of G, i.e., the stretch require- ment is dropped. Dubhashi et al. [DMP+03] devised a distributed-LOCAL algorithm that computes ultra- sparse skeletons of size m(n, α) ≤ n + O(n · log n α ) in O(α) rounds. Like their algorithm for constructing spanners, this algorithm also collects topologies to depth O(α), and involves heavy local computations. To our knowledge, no efficient distributed-CONGEST or PRAM algorithm for computing ultra-sparse skele- tons is currently known. In this paper we devise the first such algorithms. 1.2 Prior Work and Our Results In the centralized model of computation the best-known efficient algorithm for constructing multiplicative spanners (for unweighted graphs) is due to Halperin and Zwick [HZ96]. Their deterministic algorithm, for an integer parameter k ≥ 1, computes a (2k − 1)-spanner with n1+1/k + n edges in O(E) time. (Their result improved previous pioneering work by [PS89, Coh99].) Note that their bound on the number of edges is always at least 2n, i.e., in the range k = Ω(log n) it is very far from Moore's bound. Our centralized randomized algorithm computes (with probability close to 1), a (2k − 1)-spanner with n· (1 + O( log n k )) edges in O(E) time, whenever k = Ω(log n). Note that when k = ω(log n), the number of edges is n(1 + o(1)), i.e., in this range the algorithm computes an ultra-sparse spanner in O(E) time. Moreover, whenever k ≤ n1−ǫ, for any constant ǫ > 0, up to a constant factor in the lower-order term, our bound matches Moore's bound. In fact, our algorithm and its analysis can be viewed as an alternative proof of (a slightly weaker version of) the generalized Moore's bound. Note that it is not the case for the greedy algorithm and its implementations [ADD+93, RZ04, DMP+03]: the analysis of these algorithms relies on Moore's bounds, but these algorithms cannot be used to derive them. Another variant of our algorithm, which works for any k ≥ 2, computes with high probability a (2k−1)- spanner with n1+1/k(1 + O( log k ln ln n the number of edges in our spanner is n1+1/k + o(n), improving the result of [HZ96] (albeit with a somewhat worse running time for 2 ln n k )) edges, in O(kE) time.4 In particular, for the range k ≥ 2 ln n ln ln n ≤ k ≤ log n). Note that for any k ≥ 2 we have O(n1+1/k) edges. Yet another variant of our algorithm computes a (2k − 1)-spanner with O(n1+1/k) edges, in expected In the distributed-CONGEST and PRAM models, efficient algorithms for computing linear-size span- O(E) time. ners were given in [Pet09, MPVX15]. Specifically, [MPVX15] devised an O(k)-round distributed-CONGEST randomized algorithm for constructing O(k)-spanner (with high probability) with expected O(n1+1/k) In the PRAM model their algorithm has depth O(k log∗ n) and work O(E). There are also edges. k-round distributed-CONGEST randomized algorithms for constructing (2k − 1)-spanner with expected O(k · n1+1/k) edges [BS07, Elk07a]. It is known that at least k rounds are required for this task, under Erdos' girth conjecture [Elk07a, DGPV08]. Our randomized algorithm uses k rounds in the distributed-CONGEST model, and with probability at least 1− ǫ it constructs a (2k − 1)-spanner with O(n1+1/k/ǫ) edges (for any desired, possibly sub-constant, ǫ > 0). In the PRAM model the depth and work complexities of our algorithm are the same as in [MPVX15]. Furthermore, when k ≥ log n we can bound the number of edges by n · (1 + O( log n ǫ·k )), again matching Moore's bound up to a constant factor in the lower-order term. This result improves the previous state-of-the-art in the entire range of parameters. In particular, it is also the first efficient algorithm in the distributed-CONGEST or PRAM models that constructs an ultra- sparse skeleton. Specifically, in O(log n) time it computes an O(log n)-spanner with n(1 + o(1)) edges, 4As usual, O(f (n)) stands for O(f (n)polylogf (n)). 3 with probability 1 − o(1). We also use our algorithm for unweighted graphs to devise an improved algorithm for weighted graphs as well. Specifically, our algorithm computes (2k − 1)(1 + ǫ)-spanner with O(n1+1/k · (log k)/ǫ) edges, within expected O(E) time. See Theorem 2, and the discussion that follows it, for further details. 1.3 Near-Additive Spanners and Emulators It was shown in [EP04] that for any ǫ > 0 and κ = 1, 2, . . ., and any (unweighted) n-vertex graph G = (V, E), there exists a (1 + ǫ, β)-spanner with O(β · n1+1/κ) edges, where β = β(κ, ǫ) ≤ O( log κ ǫ )log κ. Ad- ditional algorithms for constructing such spanners were later given in [Elk04, EZ06, TZ06, DGPV08, Pet09, Pet10]. Abboud and Bodwin [AB16] showed that multiplicative error of 1 + ǫ in [EP04]'s theorem cannot be eliminated, while still keeping a constant (i.e., independent of n) additive error β, and more recently . In the regime of constant κ, the bound of [EP04] remains the state-of-the-art. Pettie [Pet09] showed that one can construct a (1 + ǫ, β)-spanner with O(n log log(ǫ−1 log log n)) edges and β = O( log log n )log log n. This result of [Pet09] is not efficient in the sense considered in this paper, i.e., no distributed or parallel implementations of it are known, and also no efficient (that is, roughly O(E)-time) centralized algorithm computing it is known. Also, this result does not extend ([Pet16]) to a general tradeoff between β and the number of edges. [ABP17] showed that any such (1 + ǫ, β)-spanner of size O(n1+1/κ−δ), δ > 0, has β = Ω(cid:16) 1 ǫ·log κ(cid:17)log κ−1 ǫ Improving upon previous results by [Elk05, EZ06], Pettie [Pet10] also devised an efficient distributed- CONGEST algorithm, that for a parameter ρ > 0, constructs in O(nρ) rounds a (1 + ǫ, β)-spanner with being the golden ratio. 5 Independently and simultaneously to our work, [ABP17] showed that there exist (1 + ǫ, β)-spanners with < 3/4. This O(n1+1/κ(ǫ−1 log κ)φ) edges and β = O(cid:16) log κ+1/ρ O((ǫ−1 log κ)h · log κ · n1+1/κ) edges and β = O(cid:16) log κ spanner has improved dependence on ǫ in the number of edges (at the cost of worse dependence on κ). (cid:17)logφ κ+1/ρ ǫ (cid:17)log κ−2 , where h = (3/4)κ−1−log κ , for φ = 1+√5 In this paper we improve all of the tradeoffs [EP04, Pet10] in the entire range of parameters. Specifically, log(1/ǫ)+log log log n , our distributed-CONGEST algorithm constructs for any ǫ > 0, ρ > 0 and κ = 1, 2, . . . , in O(nρ) rounds a (1 + ǫ, β)-spanner with O(n1+1/κ) edges and log n κ 2 ǫ β ≤ O(cid:18) log κ + 1/ρ ǫ (cid:19)log κ+1/ρ . Our algorithm also admits efficient implementations in the streaming and standard models of computation, see Section 3. Our spanners are sparser and have polynomially smaller β than the previous best efficient con- structions. They are even sparser than the state-of-the-art existential ones (with essentially the same β), with the following exceptions: whenever ǫ < 1/ log3 log n our result and that of [ABP17] are incomparable,6 and the spanner from [Pet09] that has O(n log(4) n) edges, while ours never gets sparser than O(n log log n)/ǫ. In the complementary range, ǫ > 1/ log3 log n, our result is strictly stronger than that of [ABP17]. Moreover, a variant of our algorithm efficiently constructs very sparse (1+ǫ, β)-emulators. In particular, we can obtain a linear-size (1 + ǫ, ( log log n )log log n)-emulator. (We stress that the number of edges does not depend even on ǫ.) All previous constructions of (1 + ǫ, β)-spanners or emulators employ a superlinear number of edges, for all choices of parameters. ǫ 5 In the range of κ = o( log n log log n ), the result of [Pet10] is incomparable with [EP04], as spanners of [EP04] provide smaller β, while spanners of [Pet10] are slightly sparser. 6The i-iterated logarithm is defined by log(i+1) n = log(log(i) n), for all i ≥ 0, and log(0) n = n. 4 We use our new algorithms for constructing near-additive spanners and emulators to improve approxi- mate shortest paths' algorithms, in the centralized and streaming models of computation. One notable result in this context is a streaming algorithm that for any constant ǫ > 0 and any subset S ⊆ V with S = nΩ(1), computes (1+ǫ)-approximate shortest paths for S×V within O(S) passes over the stream, using O(n1+ǫ) space. See Section 4 for more details, and additional applications of our spanners. 1.4 Technical Overview Linial and Saks [LS93] were the first to employ exponential random variables to build network decomposi- tions, i.e., partitions of graphs into clusters of small diameter, which possess some useful properties. This technique was found useful for constructing padded partitions, hierarchically-separated trees, low-stretch spanning trees [Bar96, Bar98, Bar04, EEST05, ABN11, AN12] and spanners [Coh99, BS03, Elk07b]. In [LS93] every vertex v tosses a random variable rv from an exponential distribution, and broadcasts to all vertices within distance rv from v. Every vertex v joins the cluster of a vertex u with largest identity number, whose broadcast u heard. Blelloch et al. [BGK+14] introduced a variant of this technique in which, roughly speaking, every vertex v starts to broadcast at time −rv, and broadcasts indefinitely. A vertex x joins the cluster centered at a vertex v, whose broadcast reaches x first. They called the resulting partition "exponential start time clustering", and it was demonstrated in [BGK+14, MPX13, EN16a] that this approach leads to very efficient distributed and parallel algorithms for constructing padded partitions and network decompositions. Miller et al. [MPVX15] used this approach to devise an efficient parallel and distributed-CONGEST O(k)-time algorithm for constructing O(k)-spanner with O(n1+1/k) edges. Specifically, they build the exponential time clustering, add the spanning trees of the clusters into the spanner, and then every vertex x adds into the spanner one edge (x, y) connecting x to every adjacent cluster Cy, y ∈ Cy. The main property of the partition exploited by [MPVX15] in the analysis of their algorithm is that any unit-radius ball in the input graph G intersects just O(n2/k) clusters, in expectation. Note also that their algorithm is doomed to use at least n1+1/k + (n − 1) edges, because it starts with inserting the spanning trees of all clusters (amounting to up to n− 1 edges), and then inserts the O(n1+2/k) edges crossing between different clusters into the spanner. To get O(n1+1/k) edges, one rescales k′ = 2k. In our algorithm we do not explicitly construct the exponential start time clustering. Rather we run the procedure that builds it, but every vertex x connects not just to the neighbor y through which x received its first broadcast message at time, say, ty, but also to all neighbors z whose broadcast x received witin time interval [ty, ty + 1]. We show that, in expectation, x connects to n1/k neighbors altogether, and not just to that many adjacent clusters. As a result we obtain both a sparser spanner, a smaller stretch, and a smaller running time. The stretch and running time are smaller roughly by a factor of 2 than in [MPVX15], because we do not need to consider unit balls, that have diameter 2. Rather we tackle individual edges (of length 1). In the context of weighted graphs, [MPVX15] showed how their efficient algorithm for constructing sparse (4k − 2)-spanners for unweighted graphs can be converted into an efficient algorithm that constructs (16k − 8)-spanners with O(n1+1/k log k) edges for weighted graphs. By using their scheme naively on top of our algorithm for unweighted graphs, one gets an efficient algorithm for computing (4k − 2)(1 + ǫ)- spanners with O(n1+1/k · (log k)/ǫ) edges. Roughly speaking, the overhead of 2 in the stretch is because in the analysis of [MPVX15], every vertex contributes expected O(n1/k) edges to the spanner on each of roughly O(n1/k) phases of the algorithm in which it participates. By employing a more delicate probabilistic argument, we argue that in fact, the expected total contribution of every vertex in all phases altogether is O(n1/k), rather than O(n2/k). This enables us to eliminate another factor of 2 from the stretch bound. See Section 2.3 for details. 5 Our constructions of (1 + ǫ, β)-spanners and emulators follow the [EP04] superclustering and intercon- nection approach. One starts with a base partition P0. In [EP04] this was the partition of [Awe85, PS89, AP92], obtained via region-growing technique. Then every cluster C ∈ P0 that has "many" unclustered clusters of P0 "nearby", creates a supercluster around it. The "many" and the "nearby" are determined by degree threshold deg 0 and distance threshold δ0, respectively. Once the superclustering phase is over, the remaining unclustered clusters enter an interconnection phase, i.e., every pair of participating nearby clusters gets interconnected by a shortest path in the spanner. This completes one iteration of the process. The resulted superclustering P1 is the input for the next iteration of this process, which runs with different, carefully chosen thresholds deg 1 and δ1. Such iterations continue until only very few clusters survive. The latter are interconnected without further superclustering. One bottleneck in devising efficient distributed algorithm based on this approach is the base parti- tion. Known algorithms for constructing a region-growing partition of [Awe85] require almost linear dis- tributed time [DMZ06]. We demonstrate that one can bypass it completely, and start from the base partition P0 = {{v} v ∈ V }. This requires some modfication of the algorithm, and a more nuanced analysis. In addition, we show that the superclustering and interconnection steps themselves can be implemented effi- ciently. This part of the algorithm is based on our recent work on hopsets [EN16b], where we showed that [EP04] approach is extremely useful in that context as well, and that it can be made efficient. 1.5 Related Work Efficient algorithms for constructing (1 + ǫ, β)-spanners were also devised in [Elk05, EZ06, TZ06, Pet09, Pet10]. These algorithms are based, however, on different approaches than that of the current paper. The latter is based on [EP04]. Specifically, the approach of [Elk05, EZ06] is based on [Coh99, Coh00] construc- tion of pairwise covers and hopsets, i.e., the algorithm works top-down. It recurses in small clusters, and eliminates large ones. The approach of [TZ06, Pet09, Pet10] is based on [TZ05] collection of trees, used originally for distance oracles. Streaming algorithms for constructing multiplicative spanners were given in [FKM+05, Elk07b, Bas08], and near-additive spanners in [Elk05, EZ06]. Spanners and emulators with sublinear error were given in [TZ06, Pet09]. Spanners with purely additive error and lower bounds concerning them were given in [ACIM99, EP04, BCE05, BKMP10, Che13, Woo06, BW15, AB16]. 1.6 Organization In Section 2 we present our algorithm for constructing multiplicative spanners and its analysis. In Section 2.3 we use this algorithm to provide improved spanners for weighted graphs as well. Our near-additive spanners and emulators are presented in Section 3. 2 Sparse Multiplicative Spanners and Skeletons Let G = (V, E) be a graph on n vertices, and let k ≥ 1 be an integer. Let c > 3 be a parameter governing the success probability, and set β = ln(cn)/k. Recall the exponential distribution with parameter β, denoted EXP(β), which has density f (x) =(cid:26) β · e−βx 0 x ≥ 0 otherwise. 6 Construction. Each vertex u ∈ V samples a value ru from EXP(β), and broadcasts it to all vertices within distance k. Each vertex x that received a message originated at u, stores mu(x) = ru − dG(x, u), and also a neighbor pu(x) that lies on a shortest path from x to u (this neighbor sent x the message from u, breaking ties arbitrarily if there is more than one). Let m(x) = maxu∈V {mu(x)}, then for every x ∈ V we add to the spanner H the set of edges The following lemma is implicit in [MPVX15]. We provide a proof for completeness. C(x) = {(x, pu(x)) : mu(x) ≥ m(x) − 1} . Lemma 1 ([MPVX15]). Let d1 ≤ . . . ≤ dn be arbitrary values and let δ1, . . . , δn be independent random variables sampled from EXP(β). Define the random variables M = maxi{δi− di} and I = {i : δi− di ≥ M − 1}. Then for any 1 ≤ t ≤ n, Pr[I ≥ t] = (1 − e−β)t−1 . Proof. Denote by X (t) the random variable which is the t-th largest among {δi − di}. Then for any value a ∈ R, if we condition on X (t) = a, then the event I ≥ t is exactly the event that all the remaining t − 1 values X (1), . . . , X (t−1) are at least a and at most a + 1. Using the memoryless property of the exponential distribution and the independence of the {δi}, we have that Pr[I ≥ t X (t) = a] = (1 − e−β)t−1 . Since this bound does not depend on the value of a, applying the law of total probability we conclude that Pr[I ≥ t] = (1 − e−β)t−1 . Using this lemma, we can bound the expected size of the spanner. Lemma 2. The expected size of H is at most (cn)1/k · n. Proof. Fix any x ∈ V , and we analyze E[C(x)]. Note that the event C(x) ≥ t happens when there are at least t shifted random variables ru − dG(u, x) that are within 1 of the maximum. By Lemma 1 this happens with probability at most (1 − e−β)t−1 (we remark that if x did not hear at least t messages, then trivially Pr[C(x) ≥ t] = 0). We conclude that Xt=1 (1 − e−β)t = eβ = (cn)1/k , Pr[C(x) ≥ t] ≤ ∞ Xt=0 n E[C(x)] = and the lemma follows by linearity of expectation. We now argue about the stretch of the spanner. Claim 3. With probability at least 1 − 1/c, it holds that ru < k for all u ∈ V . Proof. For any u ∈ V , Pr[ru ≥ k] = e−βk = 1/(cn). By the union bound, Pr[∃u, ru ≥ k] ≤ 1/c. Assume for now that the event of Claim 3 holds, i.e., that ru < k for all u ∈ V . Corollary 4. For any x ∈ V , if u ∈ V is the vertex maximizing mu(x), then dG(u, x) < k. 7 Proof. First note that m(x) ≥ mx(x) ≥ 0, and using Claim 3 we have ru < k. So 0 ≤ m(x) = mu(x) = ru − dG(u, x) < k − dG(u, x). Claim 5. For any u, x ∈ V , if x adds an edge to pu(x), then there is a shortest path P between u and x that is fully contained in the spanner H. Proof. We prove by induction on dG(u, x). In the base case dG(x, u) = 1, then pu(x) = u, so (x, u) is in the spanner. Assume that every vertex y ∈ V with dG(u, y) = t − 1 which added an edge to pu(y) has a shortest path to u in H, and we prove for x that has dG(u, x) = t. We know that x added an edge to y = pu(x), which lies on a shortest path to u, and thus satisfies dG(u, y) = t − 1. It remains to show that this y added an edge to pu(y). First we claim that m(y) ≤ m(x) + 1 . (1) Seeking contradiction, assume that (1) does not hold, and let v ∈ V be the vertex maximizing mv(y). By Corollary 4 we have dG(v, y) < k, and thus dG(v, x) ≤ k. Hence x will hear the message of v. This means that mv(x) ≥ mv(y) − 1 = m(y) − 1 > m(x), which is a contradiction. This establishes (1). Now, since x added an edge to y = pu(x), by construction mu(x) ≥ m(x) − 1 . (2) We conclude that (2) (1) mu(y) = mu(x) + 1 ≥ m(x) − 1 + 1 ≥ m(y) − 1 , so y indeed adds an edge to pu(y), and by the induction hypothesis we are done. Lemma 6. The spanner H has stretch at most 2k − 1. Proof. Since H is a subgraph of G, it suffices to prove for any (x, y) ∈ E, that dH (x, y) ≤ 2k − 1. Let u be the vertex maximizing m(x) = mu(x), and w.l.o.g assume m(x) ≥ m(y). By Corollary 4 we have dG(u, x) ≤ k − 1, so dG(u, y) ≤ k, and y heard the message of u (which was sent to distance k). This implies that mu(y) ≥ mu(x)− 1 = m(x)− 1 ≥ m(y)− 1, so y adds the edge (y, pu(y)) to the spanner. By applying Claim 5 on x and y, we see that both have shortest paths to u that are fully contained in H. Since dG(x, u) ≤ k − 1 and dG(y, u) ≤ k, these two paths provide stretch 2k − 1 between x, y. 2.1 Main Theorem We now state our main theorem, from which we will derive several interesting corollaries in various settings. Theorem 1. For any unweighted graph G = (V, E) on n vertices, any integer k ≥ 1, c > 3 and δ > 0, there is a randomized algorithm that with probability at least (1− 1/c)· δ/(1 + δ) computes a spanner with stretch 2k − 1 and number of edges at most (cn)1+1/k (1 + δ) · c − 1 − δ(n − 1) . Proof. Let Z be the event that {∀u ∈ V, ru < k}. By Claim 3 we have Pr[Z] ≥ 1 − 1/c. Note that conditioning on Z, by Lemma 6 the algorithm produces a spanner H = (V, E′) with stretch 2k − 1. In particular, it must have at least n− 1 edges. Let X be the random variable E′− (n− 1), which conditioned on Z takes only nonnegative values. By Lemma 2 we have E[X] = (cn)1/k · n − (n − 1). We now argue 8 that conditioning on Z will not affect this expectation by much. Indeed, by the law of total probability, for any t, Pr[X = t] ≥ Pr[X = t Z] · Pr[Z]. Thus Pr[Z] ≤ c − 1 ·h(cn)1/k · n − (n − 1)i . E[X Z] ≤ E[X] (3) c By Markov inequality, Pr [X ≥ (1 + δ)E[X Z] Z] ≤ 1 1 + δ . We conclude that Pr [(X < (1 + δ)E[X Z]) ∧ Z] = Pr [X < (1 + δ)E[X Z] Z] · Pr[Z] ≥(cid:18)1 − 1 c(cid:19) · δ 1 + δ . If this indeed happens, then E′ = X + n − 1 c (3) ≤ (1 + δ) · = (1 + δ) · c − 1 ·h(cn)1/k · n − (n − 1)i + n − 1 (cn)1+1/k − (n − 1) − δ(n − 1) . c − 1 2.1.1 Implementation Details Distributed Model. It is straightforward to implement the algorithm in the LOCAL model of computation, it will take k rounds to execute it – in each round, every vertex sends to its neighbors all the messages it received so far. We claim that the algorithm can be implemented even when bandwidth is limited, i.e., in the CONGEST model. This will require a small variation: in each round, every vertex v ∈ V will send to all its neighbors the message (ru, dG(u, v)) for the vertex u that currently maximizes mu(v) = ru − dG(u, v). We note that omitting all the other messages will not affect the algorithm, since if one such message would cause some neighbor of v to add an edge to v, then the message about u will suffice, as the latter has the largest mu(v) value. (Also recall that all vertices start their broadcast simultaneously, and do so for k rounds, so any omitted message could not have been sent to further distance than the message from u, which implies dropping it will have no effects on farther vertices as well.) PRAM Model. In the parallel model of computation, we can use a variant of the construction that appeared in [MPX13, MPVX15]. Roughly speaking, vertex u will start its broadcast at time k − ⌈ru⌉, and every vertex x will send only the first message that arrives to it (which realizes m(x)). As argued in [MPVX15], the algorithm can be implemented in O(k log∗ n) depth and O(E) work. Standard Centralized Model. Note that in the standard centralized model of computation, the running time is at most the work of the PRAM algorithm, which is O(m). By taking constant c and δ, and repeating the algorithm until the first success (we can easily check the number of edges of the spanner and that all ru < k), we get a spanner with stretch 2k − 1 and O(n1+1/k) edges in expected time O(E). 9 2.2 Implications of Theorem 1 2.2.1 Standard Centralized Model and PRAM The currently sparsest spanners which can be constructed in linear time are those of Halperin and Zwick [HZ96]. They provide for any k ≥ 1, a deterministic algorithm running in O(m) time, that produces a spanner with n1+1/k + n edges. We can improve their result for a wide range of k, albeit with a randomized algorithm. First we show a near-linear time algorithm (which can be also executed in parallel), that provides a spanner sparser than Halperin and Zwick in the range k ≥ 2 ln n/ ln ln n.7 Corollary 7. For any unweighted graph G = (V, E) on n vertices and m edges, and any integer k ≥ 2, there is a randomized algorithm, that with high probability8 computes a spanner for G with stretch 2k − 1 k (cid:17) edges. The algorithm has O(k2 ln n ln∗ n) depth and the running time (or work) and n1+1/k ·(cid:16)1 + O(ln k) is O(kE). k+1 ≥ 1 Proof. Apply Theorem 1 with parameters c = k and δ = 1/k. So with probability at least k−1 k we obtain a spanner whose number of edges is at most 3k 1 · (1 + 1/k) · (kn)1+1/k k − 1 ≤ n1+1/k ·(cid:18)1 + O(ln k) k (cid:19) . (4) Run the algorithm C · k ln n times for some constant C. We noted in Section 2.1.1 that each run takes O(k ln∗ n) depth and O(E) work, so the time bounds are as promised. Now, with probability at least 1 − (1 − 1/(3k))C·k ln n ≥ 1 − n−C/3, we achieved a spanner with number of edges as in (4) in one of the executions. Remark 1. Whenever k ≥ 2 ln n/ ln ln n, we have n1/k ≤ √ln n, so the number of edges in Corollary 7 is n1+1/k + o(n), and the running time is O(kE). 2.2.2 Distributed Model In a distributed setting we have the following result. Corollary 8. For any unweighted graph G = (V, E) on n vertices, any k ≥ 1 and 0 < ǫ < 1, there is a randomized distributed algorithm that with probability at least 1− ǫ computes a spanner with stretch 2k− 1 and O(n/ǫ)1+1/k edges, within k rounds. Proof. Apply Theorem 1 with c = 3/ǫ and δ = 2/ǫ, so the success probability is at least (1 − ǫ/3) · (1 − ǫ/(ǫ + 2)) > 1 − ǫ . With these parameters, by Theorem 1, the number of edges in spanner will be bounded by O(n/ǫ)1+1/k. 7In fact, the factor 2 can be replaced by any 1 + ǫ for constant ǫ > 0. 8By high probability we mean probability at least 1 − n−C, for any desired constant C. 10 2.2.3 Ultra-Sparse Spanners and Skeletons We now show that in the regime k ≥ ln n, our algorithm (that succeeds with probability close to 1) provides a spanner whose number of edges is very close to n (as a function of k and the success probability). This will hold in all computational models we considered. We note that for the centralized and PRAM models, Corollary 7 gives high probability with roughly the same sparsity, albeit with larger depth and work. Corollary 9. For any unweighted graph G = (V, E) on n vertices, and any integer k ≥ ln n and parameter 2/k < ǫ < 1, there is a randomized algorithm, that with probability at least 1− ǫ computes a spanner for G with stretch 2k − 1 and n ·(cid:16)1 + O(ln n) ǫ·k (cid:17) edges. The number of rounds in distributed model is k, in PRAM it is O(k log∗ n) depth and O(E) work, and in the centralized model it is O(E) time. Proof. Apply Theorem 1 with parameters c = k and δ = 2/ǫ, so with probability at least k−1 2/ǫ+1 ≥ 1−ǫ we obtain a (2k − 1)-spanner. In the regime k ≥ ln n we have (kn)1/k ≤ e(2 ln n)/k ≤ 1 + O(ln n)/k, so the number of edges is at most k · 2/ǫ (1 + 2/ǫ) · (kn)1+1/k k − 1 − 2(n − 1)/ǫ ≤ n ·(cid:18)1 + O(ln n) ǫ · k (cid:19) . (5) Remark 2. The spanner of Corollary 9 can be used as a skeleton. E.g., one can take ǫ = o(1) and k = O(log n), to obtain with probability 1 − o(1), a skeleton with n(1 + o(1)) edges, which is computed in O(log n) rounds. 2.3 Weighted Graphs Miller et al. [MPVX15] used their efficient algorithm for constructing O(k)-spanners with O(n1+1/k) edges for unweighted graphs, to provide an efficient algorithm for constructing O(k)-spanners with O(n1+1/k log k) edges for weighted graphs. In this section we argue that their scheme can be used to convert our algorithm for constructing (2k − 1)-spanners with O(n1+1/k) edges for unweighted graphs (Theorem 1; see also Sec- tion 2.1.1) into an efficient algorithm for constructing (2k − 1)(1 + ǫ)-spanners with O(n1+1/k · log k ǫ ) edges for weighted graphs. The scheme of [MPVX15] works in the following way. It partitions all edges of G = (V, E) into ⌈log1+ǫ ωmax⌉ = λ categories Et = {e ∈ E ω(e) ∈ [(1 + ǫ)t−1, (1 + ǫ)t)}, t = 1, 2, . . . , λ. (We assume that the minimum weight is 1, and the maximum weight is ωmax. The last category Eλ should also contain edges of weight exactly ωmax.) Now one defines ℓ = ⌈log1+ǫ kc⌉, for a sufficiently large constant c, graphs Gj = (V, Ej ), j = 0, 1, . . . , ℓ − 1, Ej =S{Et t ≡ j( mod ℓ)}. Observe that the edge weights in (each) Gj are well-separated, i.e., Ej is a disjoint union of at most q = ⌈λ/ℓ⌉ edge sets E(1), . . . , E(q), such that the edge weights within each set are within a factor of 1 + ǫ from one another. Moreover, if edge weights in E(i), i = 1, 2, . . . , q, are in the range [w(i), (1 + ǫ)w(i)), then we have w(i) = w(1)(kc)i−1, for every i = 1, 2, . . . , q. For each graph Gj, the scheme of [MPVX15] constructs an O(k)-spanner with O(n1+1/k) edges. It then takes a union of ℓ = O( log k ǫ ) such spanners as the ultimate O(k)-spanner of the original graphs. (In fact, [MPVX15] used specifically ǫ = 1.) We will next outline the way in which [MPVX15] construct O(k)- spanner with O(n1+1/k) edges for each Gj, and show how to modify it to provide a (2k− 1)(1 + ǫ)-spanner. 11 The scheme starts with running a routine of [MPVX15] that constructs an O(k)-spanner H (1) with O(n1+1/k) edges for the unweighted graph (V (1), E(1)), V (1) = V , and constructing the exponential start time partition P (1) for it. It then contracts each of the clusters of P (1) (which have unweighted radii at most k − 1) into single vertices of V (2), and runs the unweighted spanner routine on (V (2), E(2)). As a result, it constructs an O(k)-spanner H (2) and a partition P (2) of V (2), contracts all clusters of P (2) to get V (3), etc. The final spanner returned by the scheme is H =Sq The scheme guarantees stretch (1 + ǫ)(1 + O(k−(c−1)))O(k), because the blackbox routine for un- weighted graphs provides stretch O(k) for each category of weights, but the weights are uniform only up to a factor of 1 + ǫ. Also, the factor of 1 + O(k−(c−1)) appears, because one contracts clusters of unweighted diameter O(k) of lower scales, on which all edge weights are a factor of roughly k−c smaller than the edge weights on the current scale. i=1 H (i). In the analysis of H, [MPVX15] show that every vertex u is active (i.e., non-isolated vertex which is not yet contracted into a larger super-vertex) for expected O(n1/k) phases, and when it is active, it con- tributes expected O(n1/k) edges to the spanner of the current phase. Hence the overall size of the spanner is O(n1+2/k), and by rescaling k′ = 2k, they ultimately get their result. (See the proof of Theorem 3.3 in [MPVX15] for full details of this proof. We have sketched it for the sake of completeness.) While the stretch analysis of [MPVX15] is sufficiently precise for our purposes, this is not the case with the size analysis. Indeed, even when one plugs in stretch 2k − 1 of our unweighted spanner routine instead of stretch O(k) of their routine, still one obtains a (2k − 1)(1 + ǫ)2(1 + k−(c−1))-spanner with O(n1+2/k) edges, i.e., a (4k − 2)(1 + O(ǫ))-spanner with O(n1+1/k) edges (for each Gj). In what follows we refine their size analysis, and show that, in fact, every vertex u contributes expected O(n1/k) edges in all phases of the algorithm altogether (for a single graph Gj with well-separated edge weights). Denote by r(i) u the radius that u tosses from EXP(β) in the ith phase, i = 1, 2, . . . , q, assuming that it is active on that phase. We say that a vertex v (which is active on phase i) is a candidate vertex of phase i if its broadcast message reaches u no later than within one time unit after the time −r(i) u , i.e., −r(i) v + d(v, u), where d(v, u) is the unweighted distance between v and u in the graph on which the unweighted spanner routine is invoked on phase i. u + 1 ≥ −r(i) Let X (i) denote the random variable counting the number of such candidate vertices on phase i, for i = 1, 2, . . . , q. (Recall that these are the vertices which might cause u to add an edge to the spanner.) Let j denote the random variable which is the phase in which u was contracted (and j = q if there is no such phase). That is, j indicates the level in which the broadcast of some candidate vertex v has −r(i) v +d(v, u) < −r(i) u . Denote also by X (i), i = 1, 2, . . . , q, the total number of candidates u sees between the beginning of phase i, and up until phase j, where a candidate vertex v reaches u before time −r(j) u . On that phase j, X (i) counts the number of candidates with index not larger than that of the candidate vertex v (assume every vertex has an arbitrary distinct index in {1, . . . n}). Note that for i > j, by definition, X (i) = 0. Also, in particular, X = X (1) is at least the total contribution of edges u adds to the spanner, except for up to expected O(n1/k) edges that it might contribute on phase j (as shown in Lemma 2). We next argue that for any t = 0, 1, 2, . . ., Pr( X > t) ≤ (1 − e−β)t . (6) This implies that E( X) = ∞ Xt=0 Pr( X > t) ≤ ∞ Xt=0 (1 − e−β)t = eβ = O(n1/k) . 12 First, note that Pr( X > t) = ∞ Xt(1)=0 Pr(X (1) = t(1)) · Pr( X > t X (1) = t(1)) . For t(1) > t, we have Pr( X > t X (1) = t(1)) = (1 − e−β)t . v + d(v, u) ≥ −r(1) To justify this equation, note that the left-hand side is exactly the probability that on the first phase, all the t first candidate vertices v have −r(1) u , conditioned on them being candidates, i.e., on −rv + d(v, u) ≤ −r(1) u + 1. Since these are independent shifted exponential random variables, the equation follows from the memoryless property of the exponential distribution. For t(1) ≤ t, we have Pr( X > t X (1) = t(1)) = (1 − e−β)t(1) = (1 − e−β)t(1) · Pr( X (2) > t − t(1) X (1) = t(1), X (1) ≥ t(1)) · Pr( X (2) > t − t(1) X (1) ≥ X (1)) . (Again, (1 − e−β)t(1) is the probability that no candidate vertex of the first phase reached u before time u , and so u was not contracted away at this phase.) We conduct an induction on the phase, where the induction base is the last phase i = q. On the last −r(1) phase, for any h, Pr( X (q) > h X (1) ≥ X (1), X (2) ≥ X (2), . . . , X (q−1) ≥ X (q−1)) ≤ (1 − e−β)h , because it is just the probability that none of the first h candidates (that have −r(q) reaches u before time −r(q) this probability is 0.) u + 1) u . (If there are fewer candidates or u was contracted in a previous phase, then v + d(v, u) ≤ −r(1) Hence by the inductive hypothesis, Pr( X (2) > t − t(1) X (1) ≥ X (1)) ≤ (1 − e−β)t−t(1) , and so for any t(1) ≤ t as well. Hence Pr( X (1) > t X (1) = t(1)) ≤ (1 − e−β)t , Pr( X > t) = ≤ ∞ Xt(1)=0 Xt(1)=0 ∞ Pr(X (1) = t(1)) · Pr( X > t X (1) = t(1)) Pr(X (1) = t(1)) · (1 − e−β)t = (1 − e−β)t , as required. Hence the expected contribution of every vertex is O(n1/k), and the overall spanner size for each Gj is, in expectation, O(n1+1/k). The running time of the algorithm is expected to be O(E), following the analysis of [MPVX15]. Moreover, as in [MPVX15], our algorithm can be implemented in PRAM model, in O(log n · log∗ n · log Λ) depth, and O(E) work, where Λ is the aspect ratio of the input graph. We summarize the result below. 13 Theorem 2. Given a weighted n-vertex graph G, and a pair of parameters k ≥ 1, 0 < ǫ < 1, our algorithm computes a (2k − 1)(1 + ǫ)-spanner of G with O(n1+1/k · (log k)/ǫ) edges, in expected O(E) centralized time, or in O(log n · log∗ n · log Λ) depth and O(E) work. The result of Theorem 2 can be used in conjunction with the scheme of [ES16] to devise an algorithm that computes (2k − 1)(1 + ǫ)-spanners of size O(n1+1/k(log k/ǫ)1/ǫ), with lightness (i.e., weight of the spanner divided by the weight of the MST of the input graph) O(k · n1/k(1/ǫ)2+1/k), in expected time O(E + min{n log n,Eα(n)}), where α(·) is an inverse-Ackermann function. This improves a result of [ES16] that provides spanners with the same stretch and lightness, but with more edges (specifically, O((k + (1/ǫ)2+1/k)n1+1/k), and using O(k·E + min{n log n,Eα(n)}) time. Recently, consequently to our work, Alstrup et al. [ADF+17] further improved these bounds. We thus omit the details of our argument that provides the aforementioned bounds. 3 An Efficient Centralized Construction of Nearly-Additive Spanners and Emulators 3.1 A Basic Variant of the Algorithm In this section we present an algorithm for constructing (1 + ǫ, β)-spanners, which can be efficiently imple- mented in various settings. We start with the centralized setting. In this setting we present two variants of our construction. The first variant presented in this section is somewhat simpler, while the second variant presented in the next section provides better bounds. Let G = (V, E) be an unweighted graph on n vertices, and let k ≥ 1, ǫ > 0 and 0 < ρ < 1/2 be parameters. Unlike the algorithm of [EP04], our algorithm does not employ sparse partitions of [AP92]. The algorithm initializes the spanner H as an empty set, and proceeds in phases. It starts with setting P0 = {{v} v ∈ V } to be the partition of V into singleton clusters. The partition P0 is the input of phase 0 of our algorithm. More generally, Pi is the input of phase i, for every index i in a certain appropriate range, which we will specify in the sequel. Throughout the algorithm, all clusters C that we will construct will be centered at designated cen- In particular, each singleton cluster C = {v} ∈ P0 is centered at v. We define Rad (C) = ters rC. max{dG(C)(rC, v) v ∈ C}, and Rad ( Pi) = maxC∈ Pi{Rad (C)}. All phases of our algorithm except for the last one consist of two steps. Specifically, these are the superclustering and the interconnection steps. The last phase contains only the interconnection step, and the superclustering step is skipped. We also partition the phases into two stages. The first stage consists of phases 0, 1, . . . , i0 = ⌊log(κρ)⌋, and the second stage consists of all the other phases i0 + 1, . . . , i1 where κρ m− 2, except for the last phase ℓ = i1 + 1. The last phase will be referred to as the concluding i1 = i0 +l κ+1 Each phase i accepts as input two parameters, the distance threshold parameter δi, and the degree param- eter deg i. The difference between stage 1 and 2 is that in stage 1 the degree parameter grows exponentially, while in stage 2 it is fixed. The distance threshold parameter grows in the same steady rate (increases by a factor of 1/ǫ) all through the algorithm. phase. Next we describe the first stage of the algorithm. We start with describing its superclustering step. We set deg i = n2i/κ, for all i = 0, 1, . . . , i0. Let R0 = 0, and δi = (1/ǫ)i + 4 · Ri, where Ri is determined by the following recursion: Ri+1 = δi + Ri = (1/ǫ)i + 5· Ri. We will show that the inequality Rad ( Pi) ≤ Ri will hold for all i. 14 On phase i, each cluster C ∈ Pi is sampled i.a.r. with probability 1/deg i. Let Si denote the set of sampled clusters. We now conduct a BFS exploration to depth δi in G rooted at the set Si = SC∈Si{rC}. As a result, a forest Fi is constructed, rooted at vertices of Si. For a cluster center r′ = rC′ of a cluster C′ ∈ Pi\Si such that r′ is spanned by Fi, let rC be the root of the forest tree of Fi to which r′ belongs. (The vertex rC is by itself a cluster center of a cluster C ∈ Si.) The cluster C′ becomes now superclustered in a cluster C centered around the cluster C. (We also say that C′ is associated with C. We will view association as a transitive relation, i.e., if C′ is associated with C and C′′ is associated with C′, we will think of C′′ as associated with C as well.) The cluster center rC of C becomes the new cluster center of C, i.e., r C = rC. The vertex set of the new supercluster C is the union of the vertex set of C with the vertex sets of all clusters C′ which are superclustered into C. The edge set T C of the new cluster C contains the BFS spanning trees of all these clusters, and, in addition, it contains shortest paths from the forest Fi between rC and each rC′ as above. Si is the set of superclusters created by this process. We set Pi+1 = Si. All edges that belong to the edgeset of one of these superclusters are now added to the spanner H. For each supercluster C, we write Rad ( C) = Rad (T C, r C ). Observe that Rad ( P0) ≤ R0 = 0, and Rad ( S0) = max{Rad ( C) C ∈ S0} ≤ δ0 + R0 = R1 = 1. More generally we have Rad ( Si) = max{Rad ( C) C ∈ Si} ≤ δi + Rad ( Pi) ≤ δi + Ri ≤ (1/ǫ)i + 5Ri = Ri+1. (7) Denote by Ui the set of clusters of Pi which were not superclustered into clusters of Si. In the intercon- nection step for i ≥ 1, every cluster center rC of a cluster C ∈ Ui initiates a BFS exploration to depth 1 2 δi, i.e., half the depth of the exploration which took place in the superclustering step. For each cluster center rC′ for C′ ∈ Pi which is discovered by the exploration initiated in rC, the shortest path between rC and rC′ is inserted into the spanner H. The first phase i = 0 is slightly different: the exploration depth is set to be 1, and we add an edge from {v} ∈ U0 to all neighbors that are in U0. This completes the description of the interconnection step. Lemma 10. For any vertex v ∈ V , the expected number of explorations that visit v at the interconnection step of phase i is at most deg i. Proof. For i ≥ 1, assume that there are l clusters of Pi whose centers are within distance δi/2 from v. If at least one of them is sampled to Si, then no exploration will visit v (since in the superclustering phase the sampled center will explore to distance δi, and thus will supercluster all these centers). The probability that none of them is sampled is (1− 1/deg i)l, in which case we get that l explorations visit v, so the expectation is l · (1 − 1/deg i)l ≤ deg i (which holds for any l). For i = 0, we note that we add an edge touching v iff none of its neighbors were sampled at phase 0 (as otherwise it would be clustered and thus not in U0). The expected number of edges added is once again l · (1 − 1/deg i)l ≤ deg i (here l is the number of neighbors). We also note the following lemma for future use, its proof follows from a simple Chernoff bound. Lemma 11. For any constant c > 1, with probability at least 1 − 1/nc−1, for every vertex v ∈ V , at least one among the deg i · c · ln n closest cluster centers rC′ with C′ ∈ Pi to v is sampled, i.e., satisfies C′ ∈ Si. Observe that no vertex v ∈ V is explored by more than c · ln n · deg i explorations, with probability at least 1 − n−(c−1). Indeed, otherwise when i ≥ 1 there would be more than c · ln n · deg i cluster centers rC of unsampled clusters C ∈ Pi at pairwise distance at most δi. Applying Lemma 11 to any of them we 15 conclude that that the particular cluster C was superclustered by a nearby sampled cluster, i.e., C 6∈ Ui, contradiction. In the case i = 0, we would have that v has at least c · ln n · deg i unsampled neighbors, which occurs with probability at most n−c. Hence, by union-bound, every vertex v is explored by at most c · ln n · deg i explorations, with probability at least 1 − n−(c−1). Lemma 10 suggests that the interconnection step of phase i can be carried out in expected O(E · deg i) time. Clearly, the superclustering step can be carried out in just O(E) time, and thus the running time of the interconnection step dominates the running time of phase i. In order to control the running time, we terminate stage 1 and move on to stage 2 when i0 = ⌊log(κρ)⌋, so that deg i0 ≤ nρ. Observe also that the superclustering step inserts into the spanner at most O(n) edges (because we insert a subset of edges of Fi, and Fi is a forest), and by Lemma 10 the interconnection step inserts in expectation at most O( Pi · deg i · ((1/ǫ)i + Ri)) = O( Pi · deg i · (1/ǫ)i) edges. (We will soon show that Ri = O((1/ǫ)i−1).) A more detailed argument providing an upper bound on the number of edges inserted by the interconnection step will be given below. Lemma 12. For all i, 1 ≤ i ≤ ℓ, for every pair of clusters C ∈ Ui, C′ ∈ Pi at distance at most 1 2 (1/ǫ)i from one another, a shortest path between the cluster centers of C and C′ was inserted into the spanner H. Moreover, for any pair {v} ∈ U0, {v′} ∈ P0, such that e = (v, v′) ∈ E, the edge e belongs to H. Proof. We start with proving the first assertion of the lemma. For some index i, 1 ≤ i ≤ ℓ, and a pair C ∈ Ui, C′ ∈ Pi of clusters, let rC , rC′ be the respective cluster centers. Then we have dG(rC, rC′) ≤ Rad (C) + dG(C, C′) + Rad (C′) ≤ dG(C, C′) + 2 · Ri (1/ǫ)i + 2 · Ri = ≤ 1 2 1 2 δi, and so a shortest path between rC and rC′ was inserted into the spanner H. The second assertion of the lemma is guaranteed by the interconnection step of phase 0. Next we analyze the radii of clusters' collections Pi, for i = 1, 2, . . .. Lemma 13. For i = 0.1, . . . , ℓ, the value of Ri is given by Ri = i−1 Xj=0 (1/ǫ)j · 5i−1−j. Proof. The proof is by induction of the index i. The basis (i = 0) is immediate as R0 = 0. For the induction hypothesis, note that Ri+1 = δi + Ri = (1/ǫ)i + 5 · Ri (1/ǫ)j · 5i−1−j  i−1 = (1/ǫ)i + 5 · Xj=0  Xj=0 (1/ǫ)j · 5i−j , = i as required. 16 Observe that Lemma 13 implies that for ǫ < 1/10, we have Ri = 5i−1 · 1/(5ǫ)i−1 1−5ǫ · (1/ǫ)i−1 ≤ 2 · (1/ǫ)i−1. Recall that Pi = Si−1. Hence Rad ( Pi) = Rad ( Si−1). By inequality (7), we have Rad ( Pi) ≤ (1/ǫ)i−1 + 5 · Ri−1 = Ri, for all i = 0, 1, . . . , ℓ. 1/(5ǫ)−1 ≤ 1 We analyze the number of clusters in collections Pi in the following lemma. Lemma 14. For i = 0, 1, . . . , i0, κ Pi ≤ 2 · n1− 2i−1 κ )}. with probability at least 1 − exp{−Ω(n1− 2i−1 Proof. The probability that a vertex v ∈ V will be a center of a cluster in Pi isQi−1 Thus the expected size of Pi is n1−(2i−1)/κ, and by Chernoff bound, Pr[ Pi ≥ 2E[ Pi]] ≤ exp{−Ω(E[ Pi])} = exp{−Ω(n1− 2i−1 κ )} . , (8) j=0 1/deg j = n−(2i−1)/κ. Since for ρ < 1/2 and i ≤ i0 = ⌊log(κρ)⌋, we have n1− 2i+1−1 whp for all 0 ≤ i ≤ i0, Pi+1 = Si = O(n1− 2i+1−1 The total expected running time of the first stage is at most κ ≥ n1−2ρ = ω(log n), we conclude that ). Hence in particular, Pi0+1 = O(n1−ρ+1/κ), whp. κ O(E) i0 Xi=1 deg i = O(E · n 2i0 κ ) = O(E · nρ) . Since each superclustering step inserts at most O(n) edges into the spanner, the overall number of edges inserted by the i0 superclustering steps of stage 1 is O(n · i0) = O(n · log(κρ)). The expected number of edges added to the spanner by the interconnection step of phase i is at most O( Pi · deg i · (1/ǫ)i) = O(n1− 2i−1 κ · (1/ǫ)log(κρ) · n 2i κ ) = O(n1+1/κ · (1/ǫ)log(κρ)) . Next we describe stage 2 of the algorithm, i.e., phases i = i0+1, i0+2, . . . , i1, where i1 = i0+⌈ κ+1 κρ ⌉−2. All these phases are executed with the same fixed degree parameter deg i = nρ. On the other hand, the distance threshold keeps growing in the same steady rate as in stage 1, i.e., it is given by δi = (1/ǫ)i + 4Ri. The sets Pi0+1, Pi0+2, . . . , Pi1 on which phases i0 + 1, i0 + 2, . . . , i1, respectively, operate are defined by Pi0+i = Si0+i−1, for 1 ≤ i ≤ i1 − i0. Lemma 13 keeps holding for these additional i1 − i0 phases, i.e., Rad ( Pi) ≤ Ri ≤ 2 · (1/ǫ)i−1 . (We assume all through that ǫ < 1/10.) another, their centers are interconnected in the spanner by a shortest path between them. Also, for every pair of clusters C ∈ Ui and C′ ∈ Pi which are at distance at most 1 In addition, for every i ∈ [i0, i1], the expected size of Pi+1 is 2 (1/ǫ)i from one E[ Pi+1] = n · i Yj=0 1/deg j ≤ n1+1/κ−(i+1−i0)ρ . 17 By Chernoff bound, for every such i, with probability at least 1 − exp{−Ω(nρ)}, we have Assuming that nρ = ω(1), we conclude that whp Pi+1 = Si ≤ 2 · n1+1/κ−ρ−(i−i0)ρ . Pi1+1 = Si1 ≤ O(n1+1/κ−(i1+1−i0)ρ) = O(n1+1/κ−(⌈ κ+1 κρ ⌉−1)ρ) = O(nρ) . (9) (For the assumption above to hold we will need to assume that ρ ≥ log log n this assumption is valid in our setting.) 2 log n , say. We will show soon that O(E · deg i · (1/ρ)) = O(Enρ/ρ). κρ ⌉ − 2 ≤ 1/ρ additional phases is expected to be at most The time required to perform these ⌈ κ+1 The final collection of clusters Pi1+1 is created by setting Pi1+1 = Si1. We will next bound the expected number of edges inserted into the spanner during stage 2 of the al- gorithm. Each of the forests Fi, i ∈ [i0 + 1, i1], created during the superclustering steps contributes at most n − 1 edges. The interconnection step of phase i + i0 contributes in expectation at most O( Pi+i0 · deg i+i0 · (1/ǫ)i) ≤ O(n1+1/κ−iρ · (1/ǫ)log(κρ)+i) edges. Assuming that 1/ǫ < nρ/2, this becomes a geometric progression, so the overall expected number of edges inserted into the spanner on stage 2 is O(n1+1/κ · (1/ǫ)log(κρ)). (We will show the validity of this assumption in the end of this section.) Finally, we describe the concluding phase of the algorithm, i.e., phase ℓ = i1 + 1. In this phase we skip the superclustering step (as the number of clusters is already sufficiently small), and proceed directly to the interconnection step. 1 j=0 On this step each of the cluster centers rC for C ∈ Pℓ conducts a BFS exploration in G to depth 2 (1/ǫ)ℓ + 2Rℓ. (Essentially, we define Uℓ = Pℓ, and perform the usual interconnection step of the 2 δℓ = 1 algorithm.) By (9), the number of edges inserted by this step into the spanner is whp only O( Pℓ2·(1/ǫ)ℓ) = O( Pi1+12·(1/ǫ)i1+1) = O(n2ρ·(1/ǫ)log(ρκ)+1/ρ). Recall that we assume that ρ < 1/2. Hence this number of edges is sublinear in n. Hence the overall expected number of edges in the spanner is H = O(n1+1/κ · (1/ǫ)log(κρ)). Observe also that the running time of the last phase is O(E · nρ). Hence the overall expected running time of the algorithm is O(Enρ/ρ). It remains to analyze the stretch of the resulting spanner H. Let U = Sℓ Uj. Observe that every singleton cluster {v} ∈ P0 is associated with exactly one cluster of U, i.e., U is a partition of V . Note that Rad ( U0) = 0, Rad ( U1) ≤ 1 = R1, and for every j ∈ [ℓ], we have Rad ( Uj) ≤ Rad ( Pj) ≤ Rj ≤ 2 · (1/ǫ)j−1. Denote c = 2. Recall also (see Lemma 12) that for j ≥ 1, for every pair of clusters C, C′ ∈ Uj at distance at most 1 2 (1/ǫ)j from one another, a shortest path between the cluster centers of this pair of clusters in G was added to the spanner H. Moreover, neighboring clusters of U0 are also interconnected by a spanner edge. Lemma 15. Consider a pair of indices 0 ≤ j < i ≤ ℓ, and a pair of neighboring (in G) clusters C′ ∈ Uj, C ∈ Ui, and a vertex w′ ∈ C′ and the center r of C. Then the spanner H contains a path of length at most 3Rad ( Uj) + 1 + Rad ( Ui) between w′ and r. Proof. Let (z′, z) ∈ E ∩ (C′ × C) be an edge connecting this pair of clusters. There exists a subcluster C′′ ⊆ C, C′′ ∈ Pj such that z ∈ C′′. Hence the interconnection step of phase j inserted a shortest path π(r′, r′′) in G between the cluster centers r′ of C′ and r′′ of C′′ into the spanner H. Note that the distance between r′, r′′ is at most 1 + 2Rad ( Pj) ≤ 1 + 4(1/ǫ)j−1 < 1/2 · (1/ǫ)j, since we assume ǫ < 1/10. Hence a path between w′ and r in H can be built by concatenating a path π(w′, r′) between w′ and r′ in 18 the spanning tree T (C′) of C′ with the path π(r′, r′′) in H, and with the path π(r′′, r) in the spanning tree T (C) of C. (Note that both r′′ and r belong to C.) Its length is at most π(w′, r′) + π(r′, r′′) + π(r′′, r) ≤ Rad (C′) + (Rad (C′) + 1 + Rad (C′′)) + Rad (C) ≤ 3Rad ( Uj) + 1 + Rad ( Ui) . Now we are ready to analyze the stretch of our spanner. Lemma 16. Suppose ǫ ≤ 1/10. Consider a pair of vertices u, v ∈ V . Fix a shortest path π(u, v) between them in G, and suppose that for some index i ∈ [0, ℓ], all vertices of π(u, v) are clustered in the set U (i) defined by U (i) =Si Uj. Then j=0 i dH(u, v) ≤ (1 + 16c · ǫ · i)dG(u, v) + 4 Rj · 2i−j . Xj=1 For the induction step, consider first a pair of vertices x, y such that π(x, y) ≤ 1 Proof. The proof is by induction on i. For the induction basis i = 0, observe that all vertices of π(u, v) are clustered in U0, and thus all edges of π(u, v) are inserted into the spanner on phase 0. Hence dH (u, v) = dG(u, v). 2 (1/ǫ)i, and V (π(x, y)) ⊆ U (i). Let z1 and z2 be the leftmost and the rightmost Ui-clustered vertices in π(x, y), if exist. (The case when both these vertices exist is the one where the largest stretch is incurred; cf. [EP04].) Let C1, C2 ∈ Ui be their respective clusters, i.e., z1 ∈ C1, z2 ∈ C2. Let w1 (respectively, w2) be the neighbor of z1 (resp., z2) on the subpath π(x, z1) (resp., π(z2, y)) of π(x, y), and denote by C′1 and C′2 the respective clusters of w1 and w2. Observe that C′1, C′2 ∈ U (i−1). Denote r1 and r2 the cluster centers of C1 and C2, respectively. The spanner H contains a path of length at most dG(r1, r2) between these cluster centers. Also, by Lemma 15, since C′1 and C1 are neighboring clusters, the spanner H contains a path of length at most 3Rj + 1 + Ri ≤ 2Ri + 1 between w1 and r1, and a path of at most this length between r2 and w2. (For ǫ < 1/10, 3Rj ≤ Ri, for all j < i.) Observe also that the subpaths π(x, w1) and π(w2, y) of π(x, y) have all their vertices clustered in U (i−1), and thus the induction hypothesis is applicable to these subpaths. Hence dH (x, y) ≤ dH (x, w1) + dH (w1, r1) + dH (r1, r2) + dH(r2, w2) + dH(w2, y) ≤ (1 + 16c · ǫ(i − 1))dG(x, w1) + 4 Rj · 2i−1−j + 2Ri + 1 + (dG(C1, C2) + 2Ri) i−1 Xj=1 +2Ri + 1 + (1 + 16c · ǫ(i − 1)) · dG(w2, y) + 4 i−1 Xj=1 Rj · 2i−1−j = (1 + 16c · ǫ(i − 1)) · (dG(x, w1) + dG(w2, y)) + dG(C1, C2) + 4Ri + 2 + 8 Note also that i−1 Xj=1 Rj · 2i−1−j. dG(x, y) = dG(x, w1) + 1 + dG(z1, z2) + 1 + dG(w2, y) ≥ dG(x, w1) + dG(C1, C2) + 2 + dG(w2, y). 19 Hence dH(x, y) ≤ (1 + 16c · ǫ(i − 1))dG(x, y) + 4Ri + 8 Rj · 2i−1−j = (1 + 16c · ǫ(i − 1))dG(x, y) + 4 i Xj=1 i−1 Xj=1 Rj · 2i−j. Now consider a pair of vertices u, v such that all vertices of π(u, v) are clustered in U (i), without any restriction on π(u, v). We partition π(u, v) into segments π(x, y) of length exactly ⌊ 1 2 (1/ǫ)i⌋, except maybe one segment of possibly smaller length. Inequality (10) applies to all these segments. Hence dH (u, v) ≤ (1 + 16c · ǫ(i − 1))dG(u, v) + 4 Rj · 2i−j ≤ 1 + 16c · ǫ(i − 1) + i dG(u, v) 2 (1/ǫ)i − 1⌋ + 4 1 Rj · 2i−j⌊ Xj=1 4Pi 2 (1/ǫ)i − 1 ! dG(u, v) + 4 j=1 Rj · 2i−j 1 i Xj=1 Rj · 2i−j. i Xj=1 It remains to argue that 8 Pi j=1 Rj 2i−j (1/ǫ)i−2 ≤ 16c · ǫ. Recall that for every j, we have Rj ≤ c · (1/ǫ)j−1. Since 1/ǫ ≥ 10, the left-hand-side is at most 10c · ǫi i Xj=1 (1/ǫ)j−1 · 2i−j = 10c · ǫ i Xj=1 (2ǫ)i−j = 10c · ǫ i−1 Xh=0 (2ǫ)h ≤ 16c · ǫ . Observe that (as ǫ ≤ 1/10), we have Rj · 2i−j ≤ c i i Xj=1 i 2ǫ(cid:19)j−1 i−1 Xj=1 (1/ǫ)j−1 · 2i−j = c · 2i−1 · 2ǫ(cid:19)j Xj=0(cid:18) 1 = c · 2i−1 2 · (1/ǫ)i − 2i−1 Xj=1(cid:18) 1 = c · 2i−1 (1/2ǫ)i − 1 (1/2ǫ) − 1 = O (cid:18) 1 ǫ(cid:19)i−1! . = c · ǫ · 2 − ǫ 1 1 Note also that the condition of the last lemma holds with i = ℓ for every pair u, v ∈ V of vertices. Hence Corollary 17. For every pair u, v ∈ V , dH (u, v) ≤ (1 + 16c · ℓ · ǫ)dG(u, v) + O((1/ǫ)ℓ−1) . Recall that the spanner H contains, whp, H = O(n1+1/κ·log n·(1/ǫ)log(κρ)+n·log n·(1/ǫ)log(κρ)+1/ρ) edges, and the expected running time required to construct it is O(E· nρ/ρ). Recall also that ℓ = i1 + 1 ≤ (cid:17)log κ+1/ρ(cid:19). The log(κρ) + 1/ρ + 1. Set now ǫ′ = 16c · ℓ · ǫ. We obtain stretch (cid:18)1 + ǫ′, O(cid:16) log κ+1/ρ condition ǫ < 1/10 translates now to ǫ′ ≤ 1.6c(log(κρ) + 1/ρ). We will replace it by a simpler stronger condition ǫ ≤ 1. ǫ′ 20 Corollary 18. For any parameters 0 < ǫ ≤ 1, κ ≥ 2, and ρ > 0, and any n-vertex unweighted graph (cid:17)log κ G = (V, E), our algorithm computes a (1+ǫ, β)-spanner with expected number of edges O(cid:16) log κ+1/ρ · n1+1/κ, in expected time O(E · nρ/ρ), where ǫ β =(cid:18) O(log κ + 1/ρ) ǫ (cid:19)log κ+1/ρ . A particularly useful setting of parameters is ρ = 1/ log κ. Then we get a spanner with expected 1 ǫ (cid:17)log κ · n1+1/κ edges, in time O(E · n O(cid:16) log κ We remark that it makes no sense to set ρ < 1/κ, as the resulting parameters will be strictly worse than when ρ = 1/κ. Also our assumptions that ρ > log log n/(2 log n) and 16c · ℓ/ǫ < nρ/2 are justified, as otherwise we get β ≥ n, so a trivial spanner will do. 3.2 An Improved Variant of the Algorithm log κ · log κ), and β = O(cid:16) log κ ǫ (cid:17)2 log κ . In this section we show that the leading coefficient O((log κ + 1/ρ)/ǫ)log κ of n1+1/κ in the size of the spanner can be almost completely eliminated at essentially no price. We also devise here yet sparser con- structions of emulators. ǫ (cid:17)i Recall also that the interconnection step of the ith phase contributes Ni · deg i ·(cid:16) c′ℓ For i = 0, 1, . . . , ℓ, denote by Ni = Pi the expected number of clusters which take part in phase i. edges in expectation, where ℓ is the total number of steps, and c′ is a universal constant. Note that the contribution of the intercon- nection step dominates the contribution of the superclustering step in the current variant of the algorithm, and it will still be the case after the modification that we will now introduce. Hence we will now focus on decreasing the number of edges contributed by the interconnection steps. We keep the structure of the algorithm intact, and have the values of distance thresholds δi unchanged. The only change is in the degree sequence deg 0, deg 1, . . . of degree parameters used in phases 0, 1, . . ., respectively. Next, we describe our new setting of these parameters for stage 1 of the algorithm (i.e., phases i, 1 ≤ i ≤ i0). In the case that κ ≥ 16 let a = log log κ, otherwise, when κ < 16, let a = 2. Define i0 = min{⌊log(aκρ)⌋,⌊κρ⌋}, and for i = 0, 1, . . . , i0 let deg i = n(2i−1)/(aκ)+1/κ. We now have that for i ≤ i0 + 1, Ni = n 1/deg j = n1− 2i−1−i aκ − i κ , i−1 Yj=0 and in particular, when i0 = ⌊log(aκρ)⌋ we have Ni0+1 ≤ n1− aκρ−1−(i0+1) i0 ≥ 1). Whenever i0 = ⌊κρ⌋ we also have Ni0+1 ≤ n1− i0+1 κ ≤ n1−ρ. Additionally, we always have 2i−1 aκ + 1 κ ≤ n1−ρ (since a ≥ 2 and − i0+1 aκ κ = n1+ i aκ− i−1 κ . We restrict ourselves to the case that Ni · deg i = n1− 2i−1−i aκ − i c′ℓ ǫ ≤ n κ · n which holds whenever κ ≤ c0·log n inserted at phase i ≤ i0 is at most 1 2κ /2 , (10) log(ℓ/ǫ) , for a sufficiently small constant c0. Now the expected number of edges ǫ (cid:19)i Ni · deg i ·(cid:18) c′ℓ ≤ n1+ i 2κ− i−1 2 !i κ · n1/(2κ) 21 = n1+ 1 κ /2i . (11) Thus the total expected number of edges inserted in the first stage is O(n1+1/κ). The second stage proceeds by setting deg i0+1 = nρ/2, and in all subsequent phases i0 + i, with i = 2, 3, . . . , i1− i0, we have deg i = nρ as before. The "price" for reducing the degree in the first phase of stage two is that the number of phases i1 may increase by an additive 1. It follows that Ni0+1 · deg i0+1 ≤ n1−ρ/2. For i ≥ 2, at phase i0 + i we have Ni0+i ≤ n1−3ρ/2−(i−2)ρ. We set i1 = ⌊1/ρ⌋, so that Ni1+1 ≤ nρ/2, and whp we have that Ni1+1 ≤ 2nρ/2. We calculate Ni0+i · deg i0+i ≤ n1−ρ/2−(i−2)ρ . Note that i0/(2κ) ≤ ρ/2, which holds since i0 ≤ ⌊κρ⌋. Hence the condition (10) implies that i0 (c′ℓ/ǫ)i0 ≤ n 2κ ≤ nρ/2. The total expected number of edges inserted at phase i0 + 1 is at most Ni0+1 · deg i0+1 ·(cid:18) c′ℓ ǫ (cid:19)i0+1 ≤ n1−ρ/2 · nρ/2 · c′ℓ ǫ ≤ n1+1/κ . The expected contribution of phase i0 + i for i ≥ 2 is at most Ni0+i · deg i0+i ·(cid:18)c′ℓ ǫ (cid:19)i0+i ≤ n1−ρ/2−(i−2)ρ · nρ/2 · ni/(2κ)/2i ≤ n1+1/κ/2i , (12) where the last inequality uses that ρ ≥ 1/κ (which we may assume w.l.o.g). This implies that the expected number of edges in all these ⌊1/ρ⌋ phases is O(n1+1/κ). .9 The upper bound on κ under which this analysis was carried out is c0·log n Ω(log n) log(ℓ/ǫ) ≥ log(1/ǫ)+log(1/ρ)+log(3) n log(1/ǫ)+log(1/ρ)+log(3) n We summarize this discussion with the following theorem. c·log n Theorem 3. For any unweighted graph G = (V, E) with n vertices , 0 < ǫ < 1/10, 2 ≤ κ ≤ for a constant c, and 1/κ ≤ ρ < 1/2, our algorithm computes a (1 + ǫ, β)-spanner with β = O( 1 ǫ (log κ + 1/ρ))log κ+1/ρ+max{1,log(3) κ} and expected number of edges O(n1+1/κ). The expected running time is O(E · nρ/ρ). .) Note that the sparsest this spanner can be is O(n log log n), and at this level of sparsity its β = O(log log n + 1/ρ)log log n+1/ρ. (To get this bound we set ǫ > 0 to be an arbitrary small constant, and κ = c0 log n log(3) n This is sparser than the state-of-the-art efficiently-computable sparsest (1+ ǫ, β)-spanner due to [Pet10], which has O(n(log log n)φ) edges, where φ = 1+√5 is the golden ratio. Moreover, this spanner has a smaller β than the one of [Pet10] in its sparsest level. Denoting the latter as βP et, it holds that βP et ≈ O(log κ)1.44 log κ+1/ρ, i.e., for every setting of the time parameter ρ, the exponent of our β is smaller than that of βP et. 2 3.2.1 Sparse Emulator Finally, we note that if one allows an emulator instead of spanner, then we can decrease the size all the way to O(n) when κ = log n. To achieve this, we insert single "virtual" edges instead of every path (of length (c′ℓ/ǫ)i) between every pair of cluster centers that we choose to interconnect on phase i, for every i. Analogously, in the superclustering step we also form a supercluster around a center rC of a cluster C by adding virtual edges (rC, rC′) for each cluster C′ associated with C. The weight of each such edge is 9We denote log(k) n as the iterated logarithm function, e.g. log(3) n = log log log n. 22 defined by ω(rC, rC′) = dG(rC , rC′). The condition (10) was required to obtain converging sequences at (11) and (12), but without the (c′ℓ/ǫ)i terms, the number of edges already forms a converging sequence at each stage. 2i Moreover, one can also use for emulators a shorter degree sequence than the one we used for spanners, and as a result to save the additive term of log(3) κ in the exponent of β. Specifically, one can set deg i = j=0 1/deg j = n1− 2i−1 κ /22i−1, for each i = 0, 1, . . . , i0 = ⌊log(κρ)⌋. As a result we get Ni = n ·Qi−1 n · 22i−1−i, and thus the expected number of edges inserted at phase i ≤ i0 is at most κ Ni · deg i = n1+1/κ/2i . As before, when the first stage concludes, we run one phase with deg i0+1 = nρ/2, and all subsequent phases with deg i = nρ. To bound the expected number of edges added at phase i0 + 1 we need to note that 22i0 +1 ≤ 22κρ ≤ nρ/2 as long as κ ≤ (log n)/4. (The latter can be assumed without affecting any of the parameters by more than a constant factor). It follows that Ni0+1 · deg i0+1 = n1− 2i0+1−1 · 22i0 +1−1−(i0+1) · nρ/2 ≤ n1+1/κ. In the remaining phases Ni0+i ≤ n1+1/κ−(i−1)ρ for i ≥ 2, and the contribution of these phases is a converging sequence. We conclude the discussion with the following theorem. Theorem 4. For any unweighted graph G = (V, E) with n vertices, and for any parameters 0 < ǫ ≤ 1, 2 ≤ κ ≤ (log n)/4, 1/κ ≤ ρ < 1/2, our algorithm computes a (1 + ǫ, β)-emulator with β = O(cid:16) log κ+1/ρ and expected number of edges O(n1+1/κ). The expected running time is O(E · (cid:17)log κ+1/ρ nρ/ρ). ǫ κ In particular, the algorithm produces a linear-size (1+ǫ, β)-emulator with β = O(cid:16) log log n+1/ρ within this running time. ǫ (cid:17)log log n+1/ρ 3.3 Distributed and Streaming Implementations In this section we provide efficient distributed and streaming algorithms for constructing sparse (1 + ǫ, β)- spanners. The distributed algorithm works in the CONGEST model. To implement phase 0, each vertex selects itself into S0 with probability n−1/κ, i.a.r.. In distributed model vertices of S0 send messages to their neighbors. Each vertex u that receives at least one message, picks an origin v ∈ S0 of one of these messages, and joins the cluster centered at v. It also sends negative acknowledgements to all its other neighbors from S0. All unclustered vertices z insert all edges incident on them into the spanner. It is also straightforward to implement this in O(1) passes in the streaming model. Each consecutive phase is now also implemented in a straightforward manner, i.e., BFS explorations to depth δi in the superclustering steps are implemented via broadcasts and convergecasts in the distributed model, and by δi passes in the streaming model. In the interconnection steps, however, we need to implement many BFS explorations which may explore the same vertices. However, by Lemma 11 every vertex is explored on phase i by up to O(degi · log n) explorations whp, it follows that in distributed setting this step requires, whp, O(deg i · log n · δi) time. Also note thatPi δi = O(β). In the streaming model we have two possible tradeoffs. The first uses expected O(n · deg i) space to maintain for each vertex v the BFS parents and distance estimates, and requires just δi passes. To see that such space suffices, recall that the expected number of explorations which visit any vertex v is at most deg i, by Lemma 10. Whp, the space is O(n · deg i · log n) = O(n1+ρ · log n). 23 The second option in the streaming algorithm is to divide the interconnection step of phase i to c · deg i · log n subphases, for a sufficiently large constant c. On each subphase each exploration source, which was not sampled on previous subphases, samples itself i.a.r. with probability 1/deg i. Then the sampled exploration sources conduct BFS explorations to depth δi/2. For every vertex v, the expected number of explorations that traverse it on each subphase is O(log n). Moreover, by Chernoff's inequality, whp, no vertex v is ever traversed by more than O(log n) explorations. (Here we take a union-bound on all vertices, all phases, and all subphases. The bad events are that some vertex is traversed by more than twice its expectation explorations on some subphase.) Hence each subphase requires O(δi) passes, and whp, the space requirement is O(n log n), plus the size of the spanner. After c · deg i · log n subphases, whp, each exploration source is sampled on at least one of the subphases, and so the algorithm performs all the required explorations. Finally, the stretch analysis of distributed and streaming variants of our algorithm remains the same as in the centralized case. Hence we obtain the following distributed and streaming analogues of Theorem 3. c·log n Theorem 5. For any unweighted graph G = (V, E) with n vertices , 0 < ǫ < 1/10, 2 ≤ κ ≤ for a constant c, and 1/κ ≤ ρ < 1/2, our distributed algorithm (CONGEST model) computes a (1 + ǫ, β)- ǫ (log κ + 1/ρ))log κ+1/ρ+max{1,log(3) κ} and expected number of edges O(n1+1/κ). spanner with β = O( 1 The required number of rounds is whp O(nρ/ρ · β · log n). expected space and O(nρ/ρ · log n · β) passes, or using O(n1+ρ · log n) space, whp, and O(β) passes. Our streaming algorithm computes a spanner with the above properties, in either: O(n log n + n1+1/κ) log(1/ǫ)+log(1/ρ)+log(3) n The streaming algorithm described above can also be modified to provide a (1 + ǫ, β)-emulator as in Theorem 4, within the same pass and space complexities. 4 Applications In this section we describe applications of our improved constructions of spanners and emulators to com- puting approximate shortest paths for a set S × V of vertex pairs, for a subset S ⊆ V of designated sources. 4.1 Centralized Setting We start with the centralized setting. Here our input graph G = (V, E) is unweighted, and we construct a (1 + ǫ, β)-emulator H of G with O(n1+1/κ) edges, in expected time O(E · nρ/ρ), where β = O(cid:18) log κ + 1/ρ ǫ (cid:19)log κ+1/ρ . (13) Observe that all edge weights in H are integers in the range [1, β]. We round all edge weights up to the closest power of 1 + ǫ. Let H′ be the resulting emulator. Note that for any pair u, v of vertices, we have dG(u, v) ≤ dH(u, v) ≤ dH ′(u, v) ≤ (1 + ǫ)dH(u, v) ≤ (1 + ǫ)2dG(u, v) + (1 + ǫ)β . For a sufficiently small ǫ, (1 + ǫ)2 ≤ 3ǫ, and we rescale ǫ′ = 3ǫ. As a result the constant factor hidden by the O-notation in the basis of β's exponent grows, but other than that H′ has all the properties of the emulator 24 H. Also, it employs only t = O(cid:18) log β ǫ (cid:19) = O(cid:18) (log 1/ǫ + log(log κ + 1/ρ)) · (log κ + 1/ρ) ǫ (cid:19) different edge weights. Hence a single-source shortest path computation in H can be performed in O(H + n log t) = O(n1+1/κ + n(log(1/ǫ) + log(log κ + 1/ρ))) time [OMSW10]. (See also [KMP11], Section 5.) Hence computing S × V (1 + ǫ, β)-approximate shortest distances requires O(E · nρ/ρ + S(n1+1/κ + n(log(1/ǫ) + log(log κ + 1/ρ)))) time. Theorem 6. For any n, and for any parameters 0 < ǫ ≤ 1, 2 ≤ κ ≤ (log n)/4, 1/κ ≤ ρ ≤ 1/2, and any n-vertex unweighted graph G = (V, E) with a set S ⊆ V , our algorithm computes (1 + ǫ, β)-approximate S × V shortest distances in the centralized model in expected O(E · nρ/ρ + S(n1+1/κ + n(log(1/ǫ) + log(log κ + 1/ρ)))) time, where β is given by (13). If one is interested in actual paths rather than just in distances, then one can use our (1 + ǫ, β)-spanner with β = O(cid:18) log κ + 1/ρ ǫ (cid:19)log κ+1/ρ+max{1,log(3) κ} , (14) O(log n) log(1/ǫ)+log(1/ρ)+log(3) n and O(n1+1/κ) edges, but restricting κ ≤ . After computing the spanner H with these properties, we conduct BFS explorations on H originated at each vertex of S. The overall running time becomes O(E · nρ/ρ + S · n1+1/κ). Corollary 19. For any n, and for any parameters 0 < ǫ ≤ 1, κ ≤ , 1/κ ≤ ρ ≤ 1/2, and any n-vertex unweighted graph G = (V, E), our algorithm computes (1 + ǫ, β)-approximate S × V shortest paths in the centralized model in expected O(E · nρ/ρ + S · n1+1/κ) time, with β given by (14). log κ . Then the running time of our algorithms from Theorem 6 and Corollary 19 become respectively O(E · n1/ log κ · log κ + S(n1+1/κ + n(log 1/ǫ + log log κ))) and O(E · n1/ log κ · log κ + S · n1+1/κ) (we note that the former has smaller β given by (13), while the latter has slightly larger β given by (14)). The algorithm of Corollary 19 always outperforms the algorithm which can be derived by using the spanner of [Pet10] within the same scheme. Specifically, the running time of that algorithm is at least O(Enρ) + O(S · (n1+1/κ + n( log κ ǫ )φ)), and the additive error βP et there is given by A useful setting of parameters is ρ = 1 O(log n) log(1/ǫ)+log(1/ρ)+log(3) n βP et = O(cid:18) log κ + 1/ρ ǫ (cid:19)logφ κ+1/ρ , 2 where φ = 1+√5 is the golden ratio. So βP et is typically polynomially larger than the additive error β in our algorithm, e.g., for ρ = 1/ log κ we have βP et ≈ β1.22. (Setting ρ to be smaller than 1/ log κ makes less sense, because then the additive errors β and βP et deteriorate. At any rate, as ρ tends to 0, the two estimates approach each other.) Also, in the bound of [Pet10] there is a term of S · n · ( log κ ǫ )φ)), which does not occur in our construction. 25 4.2 Streaming Setting In this section we show how efficient constructions of spanners and emulators for an unweighted graph G in the streaming setting can be used for efficient computation of approximate shortest paths. First, one can use O(nρ/ρ · log n · β) passes and expected space O(n1+1/κ + n · log n) to construct an (1 + ǫ, β)-emulator H with β = (O(log κ + 1/ρ)/ǫ)log κ+1/ρ. One can now compute V × V (1 + ǫ, β)- approximate shortest distances in G by computing exact V ×V shortest distances in H, using the same space and without additional passes. (Observe that we do not store the output, as its size is larger than the size of H.) In particular, one can use here space of O(n · log n), and have β = (O(log log n + 1/ρ)/ǫ)log log n+1/ρ. It is also possible to set here ρ = log log n ) passes, β = O( log log n log log n , and obtain 2O( log n )2 log log n. Another option is to use space O(n1+ρ·log n), whp, and O(β) passes for constructing the same emulator H. Again given the emulator we can compute V × V approximate shortest distances in G by computing shortest distances in H offline. Corollary 20. For any n and any parameters 0 < ǫ ≤ 1, 2 ≤ κ ≤ (log n)/4, 1/κ ≤ ρ ≤ 1/2, and any n-vertex unweighted graph G, our streaming algorithm computes (1 + ǫ, β)-approximate shortest distances for V × V with β given by (13). It uses in expectation either O(nρ/ρ · log n · β) passes and expected space O(n1+1/κ + n · log n) or O(β) passes and space O(n1+ρ · log n), whp. 1 ǫ If the actual paths rather than just distances are needed, then we compute a (1 + ǫ, β)-spanner H with β given by (14) and with expected O(n1+1/κ) edges (with the restriction on κ as above). Then we compute V × V (1 + ǫ, β)-approximate shortest paths in H offline, using space O(H). Corollary 21. For any n, κ, ǫ, ρ and G as in Corollary 19, a variant of our streaming algorithm computes (1 + ǫ, β)-approximate shortest paths for V × V with β given by (14). It uses either O(nρ/ρ · log n · β) passes and expected space O(n1+1/κ + n · log n) or O(β) passes and space O(n1+ρ · log n), whp. If one is interested only in S × V paths or distances, then it is possible to eliminate the additive term of β by using O(S· β/ǫ) additional passes. These passes are used to compute exactly distances between pairs (s, v) ∈ S × V , with dG(s, v) ≤ β/ǫ. The overall number of passes becomes O(S· β/ǫ + nρ/ρ· log n· β), and space O(n1+1/κ + n · log n). Whenever S ≥ n1/κ log n, we can set ρ = log S log n , and obtain the following corollary. Corollary 22. For any n, ǫ, ρ, κ and G as in Corollary 20, and any set S ⊆ V of size at least S ≥ n1/κ log n, a variant of our streaming algorithm computes (1 + ǫ)-approximate shortest distances for S × V in expected log n − log log n ǫ · O(cid:18) 1 S ǫ (cid:18)log κ + log n log S−log log n(cid:19)(cid:19)log κ+ log n log S−log log n (15) passes, and space O(n1+1/κ + n · log n). To compute actual paths we have similar complexities10, but one needs to restrict κ as in Corollary 19. Observe that for a constant ǫ > 0 and S = nΩ(1), we can take a constant κ, so the number of passes is O(S). One can also get for S = 2Ω(log n/ log log n), a streaming algorithm for computing (1 + ǫ)- approximate shortest paths for S × V by setting κ = c log n/ log log log n, and obtaining O(S/ǫ) · O( log log n )2 log log n passes and space O(n log n). ǫ 10Though there is an additional additive term of log(3) κ in the exponent in (15). 26 References [AB16] Amir Abboud and Greg Bodwin. The 4/3 additive spanner exponent is tight. In Proceedings of the 48th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2016, Cambridge, MA, USA, June 18-21, 2016, pages 351–361, 2016. [ABCP93] Baruch Awerbuch, Bonnie Berger, Lenore Cowen, and David Peleg. Near-linear cost sequential and distribured constructions of sparse neighborhood covers. In 34th Annual Symposium on Foundations of Computer Science, Palo Alto, California, USA, 3-5 November 1993, pages 638–647, 1993. [ABN11] Ittai Abraham, Yair Bartal, and Ofer Neiman. Advances in metric embedding theory. Advances in Mathematics, 228(6):3026 – 3126, 2011. [ABP17] Amir Abboud, Greg Bodwin, and Seth Pettie. A hierarchy of lower bounds for sublinear additive spanners. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 568–576, 2017. [ACIM99] Donald Aingworth, Chandra Chekuri, Piotr Indyk, and Rajeev Motwani. Fast estimation of diameter and shortest paths (without matrix multiplication). SIAM J. Comput., 28(4):1167– 1181, 1999. [ADD+93] I. Althofer, G. Das, D. Dobkin, D. Joseph, and J. Soares. On sparse spanners of weighted graphs. Discrete Comput. Geom., 9:81–100, 1993. [ADF+17] Stephen Alstrup, Soren Dahlgaard, Arnold Filtser, Morten Stockel, and Christian Wulff-Nilsen. Personal communication, 2017. [AHL02] Noga Alon, Shlomo Hoory, and Nathan Linial. The moore bound for irregular graphs. Graphs and Combinatorics, 18(1):53–57, 2002. [AN12] [AP92] Ittai Abraham and Ofer Neiman. Using petal-decompositions to build a low stretch spanning tree. In STOC, pages 395–406, 2012. B. Awerbuch and D. Peleg. Routing with polynomial communication-space tradeoff. SIAM J. Discrete Mathematics, 5:151–162, 1992. [Awe85] B. Awerbuch. Complexity of network synchronization. J. ACM, 4:804–823, 1985. [Bar96] [Bar98] [Bar04] Yair Bartal. Probabilistic approximations of metric spaces and its algorithmic applications. In FOCS, pages 184–193, 1996. Yair Bartal. On approximating arbitrary metrices by tree metrics. In Proceedings of the Thirti- eth Annual ACM Symposium on Theory of Computing, STOC '98, pages 161–168, New York, NY, USA, 1998. ACM. Yair Bartal. Graph decomposition lemmas and their role in metric embedding methods. In Algorithms - ESA 2004, 12th Annual European Symposium, Bergen, Norway, September 14- 17, 2004, Proceedings, pages 89–97, 2004. 27 [Bas08] S. Baswana. Streaming algorithm for graph spanners - single pass and constant processing time per edge. Inf. Process. Lett., 106(3):110–114, 2008. [BCE05] B´ela Bollob´as, Don Coppersmith, and Michael Elkin. Sparse distance preservers and additive spanners. SIAM J. Discrete Math., 19(4):1029–1055, 2005. [BGK+14] Guy E. Blelloch, Anupam Gupta, Ioannis Koutis, Gary L. Miller, Richard Peng, and Kanat Tangwongsan. Nearly-linear work parallel SDD solvers, low-diameter decomposition, and low-stretch subgraphs. Theor. Comp. Sys., 55(3):521–554, October 2014. [BKMP10] Surender Baswana, Telikepalli Kavitha, Kurt Mehlhorn, and Seth Pettie. Additive spanners and (alpha, beta)-spanners. ACM Transactions on Algorithms, 7(1):5, 2010. [BR10] [BS03] [BS07] [BW15] [Che13] [Coh99] [Coh00] Ajesh Babu and Jaikumar Radhakrishnan. An entropy based proof of the moore bound for irregular graphs. CoRR, abs/1011.1058, 2010. S. Baswana and S. Sen. A simple linear time algorithm for computing a (2k − 1)-spanner of O(n1+1/k) size in weighted graphs. In Proceedings of the 30th International Colloquium on Automata, Languages and Programming, volume 2719 of LNCS, pages 384–396. Springer, 2003. Surender Baswana and Sandeep Sen. A simple and linear time randomized algorithm for computing sparse spanners in weighted graphs. Random Struct. Algorithms, 30(4):532–563, 2007. Gregory Bodwin and Virginia Vassilevska Williams. Very sparse additive spanners and emula- tors. In Proceedings of the 2015 Conference on Innovations in Theoretical Computer Science, ITCS 2015, Rehovot, Israel, January 11-13, 2015, pages 377–382, 2015. Shiri Chechik. New additive spanners. In Proceedings of the Twenty-Fourth Annual ACM- SIAM Symposium on Discrete Algorithms, SODA '13, pages 498–512, Philadelphia, PA, USA, 2013. Society for Industrial and Applied Mathematics. E. Cohen. Fast algorithms for t-spanners and stretch-t paths. SIAM J. Comput., 28:210–236, 1999. Edith Cohen. Polylog-time and near-linear work approximation scheme for undirected shortest paths. J. ACM, 47(1):132–166, 2000. [DGPV08] Bilel Derbel, Cyril Gavoille, David Peleg, and Laurent Viennot. On the locality of distributed sparse spanner construction. In Proceedings of the Twenty-Seventh Annual ACM Symposium on Principles of Distributed Computing, PODC 2008, Toronto, Canada, August 18-21, 2008, pages 273–282, 2008. [DHZ00] D. Dor, S. Halperin, and U. Zwick. All-pairs almost shortest paths. SIAM J. Comput., 29:1740– 1759, 2000. [DMP+03] D. Dubhashi, A. Mei, A. Panconesi, J. Radhakrishnan, and A. Srinivisan. Fast distributed algorithm for (weakly) connected dominating sets and linear-size skeletons, 2003. 28 [DMZ06] Bilel Derbel, Mohamed Mosbah, and Akka Zemmari. Fast distributed graph partition and application. In 20th International Parallel and Distributed Processing Symposium (IPDPS 2006), Proceedings, 25-29 April 2006, Rhodes Island, Greece, 2006. [EEST05] Michael Elkin, Yuval Emek, Daniel A. Spielman, and Shang-Hua Teng. Lower-stretch span- ning trees. In STOC, pages 494–503, 2005. [Elk04] [Elk05] [Elk07a] M. Elkin. An unconditional lower bound on the time-approximation tradeoff of the minimum spanning tree problem. In Proc. of the 36th ACM Symp. on Theory of Comput. (STOC 2004), pages 331–340, 2004. Michael Elkin. Computing almost shortest paths. ACM Trans. Algorithms, 1(2):283–323, 2005. Michael Elkin. A near-optimal distributed fully dynamic algorithm for maintaining sparse spanners. In Proceedings of the Twenty-Sixth Annual ACM Symposium on Principles of Dis- tributed Computing, PODC 2007, Portland, Oregon, USA, August 12-15, 2007, pages 185–194, 2007. [Elk07b] Michael Elkin. Streaming and fully dynamic centralized algorithms for constructing and main- taining sparse spanners. In Automata, Languages and Programming, 34th International Col- loquium, ICALP 2007, Wroclaw, Poland, July 9-13, 2007, Proceedings, pages 716–727, 2007. [EN16a] [EN16b] [EN17] [EP04] [EP15] [ES16] [EZ06] Michael Elkin and Ofer Neiman. Distributed strong diameter network decomposition. In Proceedings of the 2016 ACM Symposium on Principles of Distributed Computing, PODC 2016, Chicago, IL, USA, July 25-28, 2016, pages 211–216, 2016. Michael Elkin and Ofer Neiman. Hopsets with constant hopbound, and applications to approx- imate shortest paths. In IEEE 57th Annual Symposium on Foundations of Computer Science, FOCS 2016, 9-11 October 2016, Hyatt Regency, New Brunswick, New Jersey, USA, pages 128–137, 2016. Michael Elkin and Ofer Neiman. Efficient algorithms for constructing very sparse spanners and emulators. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 652–669, 2017. Michael Elkin and David Peleg. (1+epsilon, beta)-spanner constructions for general graphs. SIAM J. Comput., 33(3):608–631, 2004. Michael Elkin and Seth Pettie. A linear-size logarithmic stretch path-reporting distance oracle for general graphs. In Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, San Diego, CA, USA, January 4-6, 2015, pages 805–821, 2015. Michael Elkin and Shay Solomon. Fast constructions of lightweight spanners for general graphs. ACM Trans. Algorithms, 12(3):29:1–29:21, 2016. Michael Elkin and Jian Zhang. Efficient algorithms for constructing (1+epsilon, beta)-spanners in the distributed and streaming models. Distributed Computing, 18(5):375–385, 2006. 29 [FKM+05] J. Feigenbaum, S. Kannan, A. McGregor, S. Suri, and J. Zhang. Graph distances in the stream- ing model: The value of space. In Proc. of the ACM-SIAM Symp. on Discrete Algorithms, pages 745–754, 2005. [FS16] Arnold Filtser and Shay Solomon. The greedy spanner is existentially optimal. In Proceedings of the 2016 ACM Symposium on Principles of Distributed Computing, PODC 2016, Chicago, IL, USA, July 25-28, 2016, pages 9–17, 2016. [HZ96] S. Halperin and U. Zwick. Linear time deterministic algorithm for computing spanners for unweighted graphs, 1996. manuscript. [KMP11] Ioannis Koutis, Gary L. Miller, and Richard Peng. A nearly-m log n time solver for sdd linear systems. In Proceedings of the 2011 IEEE 52Nd Annual Symposium on Foundations of Computer Science, FOCS '11, pages 590–598, Washington, DC, USA, 2011. IEEE Computer Society. [LS93] N. Linial and M. Saks. Decomposing graphs into regions of small diameter. Combinatorica, 13:441–454, 1993. [MPVX15] Gary L. Miller, Richard Peng, Adrian Vladu, and Shen Chen Xu. Improved parallel algo- rithms for spanners and hopsets. In Proceedings of the 27th ACM Symposium on Parallelism in Algorithms and Architectures, SPAA '15, pages 192–201, New York, NY, USA, 2015. ACM. [MPX13] Gary L. Miller, Richard Peng, and Shen Chen Xu. Parallel graph decompositions using random shifts. In 25th ACM Symposium on Parallelism in Algorithms and Architectures, SPAA '13, Montreal, QC, Canada - July 23 - 25, 2013, pages 196–203, 2013. [OMSW10] James B. Orlin, Kamesh Madduri, K. Subramani, and M. Williamson. A faster algorithm for the single source shortest path problem with few distinct positive lengths. J. of Discrete Algorithms, 8:189–198, June 2010. [Pel99] David Peleg. Proximity-preserving labeling schemes and their applications. In Graph- Theoretic Concepts in Computer Science, 25th International Workshop, WG '99, Ascona, Switzerland, June 17-19, 1999, Proceedings, pages 30–41, 1999. [Pel00] David Peleg. Distributed Computing: A Locality-sensitive Approach. Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, 2000. [Pet09] Seth Pettie. Low distortion spanners. ACM Transactions on Algorithms, 6(1), 2009. [Pet10] Seth Pettie. Distributed algorithms for ultrasparse spanners and linear size skeletons. Dis- tributed Computing, 22(3):147–166, 2010. [Pet16] Seth Pettie. Personal communication, 2016. [PS89] D. Peleg and A. Schaffer. Graph spanners. J. Graph Theory, 13:99–116, 1989. [PU89a] D. Peleg and J. D. Ullman. An optimal synchronizer for the hypercube. SIAM J. on Comput., 18:740–747, 1989. 30 [PU89b] D. Peleg and E. Upfal. A tradeoff between size and efficiency for routing tables. J. of the ACM, 36:510–530, 1989. [Rei93] [RZ04] John H. Reif. Synthesis of Parallel Algorithms. Morgan Kaufmann Publishers Inc., San Fran- cisco, CA, USA, 1st edition, 1993. Liam Roditty and Uri Zwick. On dynamic shortest paths problems. In Algorithms - ESA 2004, 12th Annual European Symposium, Bergen, Norway, September 14-17, 2004, Proceedings, pages 580–591, 2004. [TZ05] Mikkel Thorup and Uri Zwick. Approximate distance oracles. J. ACM, 52(1):1–24, 2005. [TZ06] [Woo06] M. Thorup and U. Zwick. Spanners and emulators with sublinear distance errors. In Proc. of Symp. on Discr. Algorithms, pages 802–809, 2006. David P. Woodruff. Lower bounds for additive spanners, emulators, and more. In Proceedings of the 47th Annual IEEE Symposium on Foundations of Computer Science, FOCS '06, pages 389–398, Washington, DC, USA, 2006. IEEE Computer Society. 31
1312.0497
1
1312
2013-12-02T16:17:22
Property-Testing in Sparse Directed Graphs: 3-Star-Freeness and Connectivity
[ "cs.DS" ]
We study property testing in directed graphs in the bounded degree model, where we assume that an algorithm may only query the outgoing edges of a vertex, a model proposed by Bender and Ron in 2002. As our first main result, we we present a property testing algorithm for strong connectivity in this model, having a query complexity of $\mathcal{O}(n^{1-\epsilon/(3+\alpha)})$ for arbitrary $\alpha>0$; it is based on a reduction to estimating the vertex indegree distribution. For subgraph-freeness we give a property testing algorithm with a query complexity of $\mathcal{O}(n^{1-1/k})$, where $k$ is the number of connected componentes in the queried subgraph which have no incoming edge. We furthermore take a look at the problem of testing whether a weakly connected graph contains vertices with a degree of least $3$, which can be viewed as testing for freeness of all orientations of $3$-stars; as our second main result, we show that this property can be tested with a query complexity of $\mathcal{O}(\sqrt{n})$ instead of, what would be expected, $\Omega(n^{2/3})$.
cs.DS
cs
Property-Testing in Sparse Directed Graphs: 3-Star-Freeness and Connectivity Frank Hellweg and Christian Sohler(cid:63) Department of Computer Science, Technische Universität Dortmund {frank.hellweg,christian.sohler}@tu-dortmund.de Abstract. We study property testing in directed graphs in the bounded degree model, where we assume that an algorithm may only query the outgoing edges of a vertex, a model proposed by Bender and Ron [5]. As our first main result, we we present a property testing algorithm for strong connectivity in this model, having a query complexity of O(n1−/(3+α)) for arbitrary α > 0; it is based on a reduction to esti- mating the vertex indegree distribution. For subgraph-freeness we give a property testing algorithm with a query complexity of O(n1−1/k), where k is the number of connected componentes in the queried subgraph which have no incoming edge. We furthermore take a look at the problem of testing whether a weakly connected graph contains vertices with a degree of least 3, which can be viewed as testing for freeness of all orientations of 3-stars; as our second main result, we show that this property can √ be tested with a query complexity of O( n) instead of, what would be expected, Ω(n2/3). 1 Introduction Property testing is a technique for solving decision problems that sacrifices some accuracy for the benefit of a sublinear time complexity. The sacrifice of accuracy is twofold: On the one hand, we allow property testing algorithms to accept a small margin of inputs that do not have the queried property Π but are similar to some inputs that have Π. More formally, for a proximity parameter  < 1, we say that an input is -far from having the property Π, if one must modify an -fraction of the input's description in order to construct an input that has Π. We only require a property testing algorithm for Π to give a reliable answer for inputs that either have the property Π or are -far from it. The second relaxation in accuracy is due to the randomized nature of prop- erty testing algorithms: All those algorithms are Monte Carlo algorithms, which means that they are allowed to have a small constant error probability. The most important measure for the performance of a property testing algo- rithm is its query complexity, which is the worst-case number of accesses to the input that it needs for inputs of a given size. We aim for algorithms that have a query complexity of o(n) or even O(1). (cid:63) Research partly supported by DFG grant SO 514/3-2 and ERC Starting Grant 307696 In this paper we are particularly interested in property testing for sparse directed graphs. Such graphs are assumed to be stored in adjacency list repre- sentation and have both an in- and an outdegree of at most some constant d; we require the adjacency lists to only contain the outgoing edges of a vertex, a model which has been introduced in [5]. This is a quite natural model for directed graphs: For example, the webgraph or, typically, graphs of social networks are sparse graphs which have directed links; in particular, the incoming edges of a vertex of these graphs might not be visible, for example in case of the incoming links of a website during a web crawl. To gain this knowledge, basically the whole graph has to be explored, and since these graphs are typically very large, this may be inappropriate. Property testing algorithms for this graph model can be useful to gain information about the structure of such graphs while exploring only a small portion of it. Property testing has been introduced by Rubinfeld and Sudan [16], while Goldreich, Goldwasser, and Ron [10] have initiated the study of graph properties. In this paper the authors introduced property testing in the dense graph model, where graphs are assumed to be stored as an adjacency matrix. Furthermore, Goldreich and Ron have introduced property testing in the sparse graph model [11]. Since then a large variety of graph properties has been studied, including [6,8,12,14] in the sparse graph model and [2] in the dense graph model. These papers aim for identifying classes of testable properties: For the sparse graph model, the above series of papers shows that every hyperfinite graph property is testable, as well as every property in hyperfinite graphs; in the dense graph model, a graph property is testable if and only if it can be reduced to a problem of testing for satisfaction of one of a finite number of Szemerédi-Partitions. Property testing in directed graphs can also be subdivided into property testing in the dense graph and the sparse graph models. In the dense graph model, Alon and Shapira have studied the property of subgraph-freeness [3]. Bender and Ron have studied the property of acyclicity in both the sparse graphs and the dense graph model and the property of strong connectivity for sparse graphs [5]. In the sparse graph model, they show that if a property testing algorithm is only allowed to query the outgoing edges of a vertex, there are no such algorithms with a query complexity of o(n1/3) for acyclicity and o(n1/2) for strong connectivity, where n is the number of vertices of the input graph. The assumption that only the outgoing edges of a vertex may be queried makes testing strong connectivity much harder: As Bender and Ron show, there is a one-sided error property testing algorithm with a query complexity of O(1/) for strong connectivity without this constraint. Finally, Yoshida and Ito give a constant-time property testing algorithm for k-edge connectivity of directed graphs [17], which also relies on the visibility of incoming edges. Our Results. In this paper we further study property testing in sparse directed graphs where only the outgoing edges of a vertex may be queried. The first property we study is subgraph-freeness, i.e., to test whether a graph H does not occur as a subgraph of a graph G. Let k be the number of connected components of H that have no incoming edge from another part of H: Then our algorithm has a query complexity of O(n1−1/k). A problem connected to subgraph-freeness is testing whether a weakly con- nected graph is free of all orientations of 3-stars. Birthday-paradox type argu- ments would imply a query complexity of Ω(n2/3) for this problem, but we can give an algorithm with one of O(n1/2), which is the first main result of the pa- per. This algorithm makes use of two facts: The first is that the above mentioned class of forbidden subgraphs induces some strong properties for graphs that are free of them; the second is that, when sampling edges, the probability of hitting a vertex twice as the target vertex of two different edges is disproportionally high if it has many incoming edges. This allows the algorithm to compute a ratio of two estimators, which will be considerably larger if the input graph has many vertices with a degree of at least 3. The second main result of this paper is a property testing algorithm for strong connectivity that achieves a query complexity of O(n1−/(3+α)) for arbitrary α > 0. The algorithm is based on a reduction of the strong connectivity problem to a problem of estimating the vertex indegrees of a graph: We show that it is possible to define a locally computable partitioning of the input graph, such that small connected components that have no incoming edges become their own partitions; one can then construct a metagraph in which every partition of the original graph becomes a vertex. If the input graph is far from strongly connected, then the metagraph will contain many vertices with an indegree of 0, which can indeed be tested by statistics of the vertex indegrees. After first publishing this result at ESA 2012 [13] we discovered that there already existed a proof sketch for an algorithm similar to ours, which Oded Goldreich published in the appendix of a survey article about graph property testing [9]. At the end of the corresponding section we include a detailed discussion about similarities and differences between Goldreich's and our algorithm. 2 Preliminaries The graph model studied in this paper is the sparse graph model. If not explicitly stated else, all graphs in this paper are directed graphs whose vertices have an outdegree which is bounded by a constant d, as well as the indegree; this follows the notion in [5]. The graphs are assumed to be stored as adjacency lists. We at first define the notion of -farness: Definition 1. Let G, H be directed graphs as above, both having n vertices. We say that G is -far from H, if one has to change more than dn entries of the adjacency lists of G to obtain a graph that is isomorphic to H. Let Π be a graph property. We say that G is -far from Π, if it is -far from any graph in Π. Note that graphs as defined above have at most dn edges. This implies that changing dn entries of adjacency lists means changing an -fraction of the graph's description. We can now define the way property testing algorithms get access to an input graph: Definition 2. Let G = (V, E) be a directed graph with each vertex having an outdegree of at most d ∈ N. We define fG : V ×N → V ∪{+} to be a function that for querying f (v, i) returns the i-th neighbour of vertex v ∈ V in the adjacency list representation of G, or +, if v has less than i neighbours. Property testing algorithms get access to fG to gain knowledge about the input graph. A call to fG takes O(1) time. Definition 3. Let A be an algorithm that has parameters fG,  and n. We define the query complexity of A as the worst case number of calls to fG it performs for any graph G with n vertices. A is a property testing algorithm for a graph property Π, if: 1. The query complexity of A is sublinear in n. 2. A accepts every graph G ∈ Π with a probability of at least 2 3. 3. A rejects every graph G that is -far from Π with a probability of at least 2 3. If A accepts every G ∈ Π with probability 1, we say it has 1-sided error, else we say it has 2-sided error. Finally, we define some graph properties that we will need throughout the rest of this paper. Let G = (V, E) and H = (V (cid:48), E(cid:48)) be directed graphs. We call H a subgraph of G, if there exists an injective mapping g : V (cid:48) → V such that (g(u), g(v)) ∈ E for all (u, v) ∈ E(cid:48); we say that G is H-free, if H is not a subgraph of G. We call G (strongly) connected, if for all pairs of vertices u, v ∈ V there is a directed path from u to v in G (we also say that v can be reached from u). We call G weakly connected, if for all u, v ∈ V there is an undirected path between u and v. U ⊆ V is a connected component of G, if the subgraph of G induced by U is strongly connected and there is no set of vertices W ⊆ V − U such that the subgraph of G induced by U ∪ W is strongly connected; i.e., U is maximal. We have to distinguish between several types of connected components of a graph that are witnesses to it being not strongly connected: Source and sink components: Definition 4 (source and sink components and dead ends). Let G = (V, E) be a directed graph. A strongly connected compontent U ⊆ V is called a source component, if there is no edge from V − U to U; U is called sink component, if there is no vertex from U to V − U. We will call either of those components dead ends. We next define a special type of undirected graphs, k-stars. Such graphs consist of a central vertex that is connected to k other vertices: Definition 5 (k-star). An undirected graph H = (V, E) is called k-star, if the following holds: -- H has k + 1 vertices; -- there is a vertex v ∈ V , such that for every vertex u ∈ V − {v} there is an edge {u, v}; -- G does not contain any other edges. In a directed setting, we will consider orientations of k-stars. If a k-star orientation occurs as a subgraph of a graph G, then we call the central vertex of this occurence k-star vertex. We call a vertex incoming k-star vertex if it has at least k incoming edges and we call it outgoing k-star vertex if it has at least k outgoing edges. To simplify the analysis of our algorithms, we use a sampling technique that deviates from the usual sampling of vertices (respectively, edges) with replace- ment. Instead, we sample each vertex (edge) of the input graph with a certain probability p. If a fixed number of vertex (edge) samples is exceeded, the algo- rithm aborts by returning an arbitrary answer; the probability of this event will be small. Note that in our analyses the case that the sample limit is exceeded seperately is considered seperately from the rest of the particular analysis; after that we use a union bound to bound the total error. Thus, in the rest of the analyses we can assume that each vertex (edge) is independently sampled with probability p. 3 Testing 3-Star-Freeness We start by developing a simple property testing algorithm with one sided error for a very basic graph property, subgraph freeeness. Definition 6. Let G and H be directed graphs. We call G (induced) H-free if H does not appear as an (induced) subgraph of G. This algorithm has one-sided error and a query complexity of Θ(n1−1/k), if the forbidden subgraph H has k source components. We will later use this al- gorithm as a subroutine for a more complex algorithm that tests for freeness of a certain class of subgraphs: The class of all orientations of 3-Stars. By running the simple property tester for subgraph freeness for every possible 3-star orien- tation, one would achieve a query complexity of O(n2/3). This is because there is a 3-star orientation where the central vertex has 3 incoming edges and thus this graph has 3 source components. We give a more refined algorithm that requires the input graph to be weakly connected and that uses statistical measures to distinguish between graphs that have many occurences of such 3-star orientations with only incoming edges and graphs that are 3-star-free; these statistical measures include 2-way collision- statistics on the target vertices of samples edges, which can be done with O(n1/2) queries. For all other types of 3-star orientations occuring in the input graph, the simple subgraph freeness algorithm is called, each of these calls also having a query complexity of O(n1/2). Hence, our algorithm has a query complexity of O(n1/2) (considering  as a constant) and thus breaks the trivial barrier of TestSubgraphFreeness(G, H, ) Sample every vertex of G with probability p =(cid:0) 6m if more than 4 ·(cid:0) 6m (cid:1)1/k n1−1/k are sampledthen return true (cid:1)1/k; n Foreach sampled vertex v do  Start a breadth first search at v having a maximum depth of m If BFS explores an occurence of H in G or BFS completes an occurence that was partly explored before then return false return true Algorithm 1: TestSubgraphFreeness O(n2/3) for this problem. To our knowledge, this is the first algorithm that does so for a nontrivial property of directed graphs. At the end of the chapter we show that this algorithm is asymptotically optimal for testing 3-star freeness: We show that any property testing algorithm for this problem has a query complexity of Ω(n1/2), and that even Ω(n2/3) queries are required if the input graph is allowed to be disconnected. 3.1 A Property Testing Algorithmus for H-Freeness The algorithm TestSubgraphFreeness is given to directed bounded-degree graphs G und H, where G has n vertices and H has m vertices. The algorithm is also given a proximity parameter . Let k be the number of source components of H. In order to find an occurence of H in G, TestSubgraphFreiheit samples every vertex of G with a probability of p = (cid:0) 6m (cid:1)1/k, such that the expected number of sampled vertices is np = O(−1m1/kn1−1/k). We will see that this is sufficient for with high probability sampling a vertex in every source component of at leastone occurence of H, if G is -far from H-free. The maximum depth of m of the breadth first searches started in the sampled vertices ensures that this suffices to completely explore that occurence of H. We note that TestSubgraphFreeness can only reject the input, if it ac- tually explores a occurence of H; hence, if G is H-free, it can never be rejected, and thus TestSubgraphFreeness has a one-sided error. It remains to bound the probability for inadvertantly accepting the input, if G is -far from H-free. The following lemma bounds the number of vertex-disjoint occurences of H in G from below in this case: n Lemma 1. Let G = (V, E) and H = (VH , EH ) be directed graphs with both the vertex indegrees and outdegrees bounded by D ∈ N; let  < 1 be a proximity parameter and assume that G is -far from H-free. Let also V =: n and VH =: m. Then G contains at least n 2m vertex-disjoint copies of H. Proof. Let H consist of l weak connected components H1, . . . , Hl. We can assume that each Hi contains at least two vertices, and, because it is weakly connected, every vertex of Hi is incident to an edge. We assume that G contains less than 2m vertex-disjoint occurences of H lead this to a contradiction. n Let M be any inclusionwise maximal set of vertex-disjoint occurences of H in G. Then there is at least one connected componentn Hi of H, for which all the remaining occurences are not vertex-disjoint with the occurences of H in M. Thus, at least one edge of each of these occurences of Hi is incident to a vertex that belongs to some occurence of H in M. Now consider the graph G(cid:48) that results from removing any edges that are incident to vertices of occurences in M: G(cid:48) does not contain an occurence of Hi any more, and thus does not contain a copy of H either. Thus, G(cid:48) is H-free. On 2m, each occurence of H has the other hand, M has a cardinality of less than n m vertices, and the maximum number of edges incident to any of these vertices is 2D. Thus, the number of edges that are deleted from G to get G(cid:48) is less than 2Dm· n 2m = Dn. This is a contradiction to the assumption that G is -far from H-free. It remains to show that the size of the vertex sample in TestSubgraph- Freeness is sufficiently large for, with high probability, exploring at least one occurence of H, if G is -far from H-free. We at first assume that H is weakly connected. Theorem 1 Let G = (V, E) and H = (VH , EH ) be directed graphs with both the vertex indegrees and outdegrees bounded by D ∈ N and let H be weakly connected; let  < 1 be a proximity parameter and let k be the number of source components of H. Let also V =: n and VH =: m. Then TestSubgraphFreeness(G, H, ) returns true, if G is H-free and returns false with probability at least 2/3, is G is -far from H-free. TestSub- graphFreeness has a query complexity of O(cid:16) n1−1/k(cid:17) . Dm(cid:0) m  (cid:1)1/k Proof. As discussed above, TestSubgraphFreeness can only reject if G con- tains at least one occurence of H; thus, the algorithm always accepts if G is H-free. Now assume that G is -far from H-free and let M be a maximal set of occurences of H in G; Lemma 1 ensures that there is a set M with a cardinality of at least n/2m. Let Xi be the event that the i-th occurence in M (according to an arbitrary but fixed ordering of the occurences in M) is explored completely by TestSubgraphFreeness. Since the BFS traversals have a depth of m, this happens if a vertex in each of the source components of this occurence is sampled; since there are k of those, it holds Pr[Xi] ≥ pk for all i. Since all the occurences in M are vertex-disjoint (and due to the sample process), the events Xi are independent. Hence, TestSubgraphFreenessAmplified(G, H, , p) If not TestSubgraphFreeness(G, H, , p) then return false (cid:109) (cid:108) 1 p For i → 1 to log3 return true Algorithm 2: TestSubgraphFreenessAmplified  (cid:92) 1≤i≤M  = ¯Xi Pr = (cid:89) (1 − Pr[Xi]) ≤(cid:0)1 − pk(cid:1)n/2m (cid:19)n/2m ≤ e−3 < 1 12 (cid:18) 1≤i≤M 1 − 6m n gives an upper bound for the probability that none of the occurences in M is explored completely and thus an upper bound for the probability that none of the occurences of H in G is identified. It remains to bound the probability that the input is inadvertantly accepted in the first line of TestSubgraphFreeness due to too many vertices being sampled. The expected number of vertices sampled is np = (3m/)1/k · n1−1/k, and, due to the Markov Inequality, the probability, that more than four times this number of vertices is sampled is at most 1/4. Together with the above bound on the probability of not exploring a single occurence of H, the union bound gives a total probability of at most 1/4 + 1/12 = 1/3 for inatvertantly accepting the input. The number of vertices sampled by TestSubgraphFreeness is at most n1−1/k of those a BFS traversal of depth m is started. Since the vertex outdegree of G is bounded by D, the number of edges queried in each of the BFS traversals is bounded by Dm, and (cid:1)1/k 4 ·(cid:0) 3m n1−1/k + 1, for at most 4 ·(cid:0) 3m thus the total number of queries needed is O(cid:16) Dm(cid:0) m n1−1/k(cid:17) (cid:1)1/k (cid:1)1/k .    Now we assume that H is disconnected, i.e. consists of l > 1 weakly connected components H1, . . . , Hl. It suffices to identify occurences of each of the Hi inde- pendently, all of those pairwise vertex-disjoint. In a maximal set of vertex-disjoint occurences of H, as guaranteed by lemma 1, the occurences of the individual Hi can be combined arbitrarily to get an occurence of H. Thus, TestSubgraphFreeness can be run individually for each of the Hi. For this purpose, we define the algorithm TestSubgraphFreenessAmplified, which uses probability amplification to guarantee a better success probability p instead of 2/3. Lemma 2. Let G = (V, E) and H = (VH , EH ) be directed graphs with both the vertex indegrees and outdegrees bounded by D ∈ N; let  < 1 be a prox- imity parameter and p ≤ 1 3. Then TestSubgraphFreenessAmplified re- turns true if G is H-free and false with probability at least 1 − p if G is -far from H-free. TestSubgraphFreenessAmplified has a query complexity of O(cid:16) p · Dm(cid:0) m  (cid:1)1/k n1−1/k(cid:17) . log 1 Proof. In case G is H-free, the correctness follows directly from the correctness of TestSubgraphFreeness. Now assume that G is -far from H-free. Theorem 1 guarantees that every call of TestSubgraphFreeness returns false with probability at least 2/3. Thus, the probability that none of the calls returns false (and thus TestSubgraphFreenessAmplified inadvertantly returns true) is at most (1/3)log3(cid:100)1/p(cid:101) ≤ 3− log3 1/p = p. times in TestSubgraphFreenessAmplified, the query complexity of the lat- Since TestSubgraphFreeness is called at most log3 ter algorithm is O(cid:16) p · Dm(cid:0) m  (cid:1)1/k n1−1/k(cid:17) . log 1 (cid:109) (cid:108) 1 p = O(cid:16) log 1 p (cid:17) For testing H-freeness for disconnected H, we run TestSubgraphFree- nessAmplified individually for each of the l connected components of H while 3l. Assume that G is -far from H-free: Then the setting the parameter p to 1 probability that at least one of the l calls to TestSubgraphFreenessAmpli- fied fails to identify a complete occurence of the corresponding component is at most l · p = 1/3 due to the union bound. Hence we get the following corollary: Corollary 1. H = (VH , EH ) be a directed graph with m vertices and with both the vertex indegrees and outdegrees bounded by D ∈ N; let H consist of l > 1 connected components. Let  < 1 be a proximity parameter and let V = n and VH = m. Let kmax the maximum number of source components of one of the connected components of H and let kmin the minimum number of source components of one of them. Then there is a property testing algorithm for H-freeness, which in Graphs with n vertices and both vertex indegree and outdegree bounded by D has a query l log l · Dm(cid:0) m (cid:1)1/kmin n1−1/kmax complexity of O(cid:16) (cid:17) .  3.2 A Property Testing Algorithm for 3-Star-Freeness We will now consider the problem of testing for a certain class of forbidden sub- graphs, the class of all orientations of 3-stars. The algorithm that we introduce distinguishes between directed graphs that contain many occurences of 3-stars, regardless of how the edges of these occurences are oriented. We make two major additional assumptions: The first is that the input graph is weakly connected. The second assumption is that the input graph does not contain any double edges, i.e. pairs of edges in both directions between two vertices; thus, the undi- rected degree of a vertex is equal to its number of adjacent vertices. The latter assumption is only made for simplicity and can be dropped using a simple re- duction, as we will see later. The former assumption is, however, necessary, since without this assumption testing 3-star-freeness requires Ω(n2/3) queries. We will additionally assume that the undirected degree of each vertex of the input graph is at most D ∈ N≥3. At last, we can assume n = ω( D4 3 ): Else an algorithm could read all the input graph's edges with at most Dn = O( D3 3/2 ) queries and thus solve the problem deterministically. In the following we will simply use the term k-star for any k-star orienta- tion in directed graph contexts. We have to distinguish several types of k-stars, depending on their number of incoming and outgoing edges: Definition 7. Let G be a directed k-star and let 2 ≤ m ≤ k. We call G incoming m-star, if for at least m of the edges of G the central vertex of G is the target vertex. We call G outgoing m-star, if for at least m of the edges of G the central vertex of G is the source vertex. If G is an incoming respectively outgoing m-star, we call the central vertex of G outgoing respectively incoming k-star vertex. As noted above, a simple algorithm for testing 3-star freeness works as follows: Run the algorithm TestSubgraphFreenessAmplified from the previous sec- tion for each of the 4 (neglecting isomorphism) possible orientations of 3-stars and for a proximity parameter of /4; if one of the calls to TestSubgraphFree- nessAmplified rejects, return false; else return true. This algorithm has a query complexity of Θ(n2/3), since an incoming 3-star without outgoing edges has 3 source components. The algorithm that is introduced in this chapter will instead have a query complexity of O(n1/2), but will in exchange have a two-sided error. Since at this point the input graphs are restricted to weakly connected di- rected graphs without double edges, we can formulate the problem differently: We want to distinguish directed graphs that are orientations of a single circle or a line from those that are -far from doing so. This is not trivial, since due to the restriction that only outugoing edges of a vertex are possible to query, the portion of the graph explored by a breadth first search may be very small, particularly for vertices that have only incoming edges. The algorithm makes use of a certain property of directed graphs that contain many occurences of incoming 3-stars without outgoing edges: In such graphs, the number of edges that are part of incoming 2-stars is significantly larger than the number of edges that are part of outgoing two-stars (note that every incoming 3-star vertex is also an incoming 2-star vertex). Moreover, the probability of sampling two incloming edges of a vertex grows quadratically in the total number of its incoming edges. Thus, in a graph that contains many incoming 3-stars, the number of incoming 2-stars found by collisions statistics on the target vertices of edges will ne disproportionately high in comparision to the number of incoming 2-stars in this graph with high probability; on the other hand, in a graph is 3-star-free, these values will be roughly the same with high probability, as we will see. Such collision statistics only require O(n1/2) edge samples. For testing for any 3-stars that have incoming edges, we can rely on calling TestSubgraphFreeness as sketched above. Since we now only have to call this algorithm for orientations with at most 2 incoming edges, the query complexity for all these calls is O(n1/2). Thus, we get a total query complexity of O(n1/2). For formalizing these ideas, we state the algorithm Test3StarFreeness. Test3StarFreeness(n, G, ) if EstimateEdgeCount(n, G,  Foreach 3-star orientation H that has at least one outgoing edge 16 then return false 16 )> n + n if not TestSubgraphFreenessAmplified(G, H,  6 ) 192D , 1 times the number of outgoing 2-star vertices in {v1, . . . , v3.1} then return false s3.1 12  vertices v1, . . . , v3.1 of G u.i.d. sample s3.1 = 48 k ← n k ← k + n 3/2√ sample each edge of G with probability p = 128D n if more than s3.2 = 2048·D c ← 1 if c < 3 2 n then return true if r := c > 1 +  k else return true 24 then return false √ n 3/2 p2 times the number of collisions on target vertices of sampled edges are sampled then return false Algorithm 3: Test3StarFreeness We will at first introduce a couple of Lemmas that state structural properties of weakly connected directed graphs. All these Lemmas are connected to the notion of the balance of a directed graph: Definition 8. Let G = (V, E) be a directed graph. The balance B(G) of G is the difference between the number of outgoing 2-star vertices and the number of incoming 2-star vertices in G, i.e.: B(G) = #{v ∈ V degout(v) ≥ 2} − #{v ∈ V degin(v) ≥ 2} We will show several upper bounds on the balance of directed graphs, de- pending on their structure. We will start with graphs that are orientations of an undirected circle graph. Lemma 3. Let G = (V, E) be an orientation of an undirected circle graph. Then, B(G) = 0. Proof. Since each vertex in G has an undirected degree of two, incoming 2-star vertices do not have outgoing edges and outgoing 2-star vertices do not have incoming edges. Each vertex that is neither of them has exactly one incoming edge and one outgoint edge. Furthermore, the total number of incoming edges in G equals the total number of outgoing edges, and hence, by the above con- siderations, for each vertex that has two outgoing edges, there must be a vertex that has two incoming edges and vice versa. Thus the number of incoming 2-star vertices in G equals the number of outgoint 2-star vertices, i.e. B(G) = 0. The following proofs make use of the techniques of contracting and re-expanding and of deleting and re-inserting edges of graphs. Observe that inserting an edge into a graph can only change its balance by one: Only the target vertex of the (a) (b) e Fig. 1: Orientations of undirected graphs: (a) Circle graph; (b) Tree; a feasible edge e for choosing in the inductive step of the proof of Lemma 5 is drawn dashed. In both cases incoming 2-star vertices are painted in red and outgoing 2-star vertices are painted in blue. edge can become a new incoming 2-star, and only its source vertex can become a new outgoing 2-star. Of course the same holds true in reverse direction for deleting an edge. We continue by showing that orientations of line-shaped graphs have a bal- ance of at most 1, and, if the balance of such a graph is not 0, both edges at the ends of the graph have the same orientation. A line-shaped graph is a tree that has only two leafs. Lemma 4. Let G = (V, E) be an orientation of a line-shaped graph. Then, B(G) ≤ 1. If B(G) (cid:54)= 0, one of the following statements holds: -- The number of outgoing 2-star vertices in G exceeds the number of incoming 2-star vertices by 1 and both leafs of G have incoming edges. -- The number of incoming 2-star vertices in G exceeds the number of outgoing 2-star vertices by 1 and both leafs of G have outgoing edges. Proof. At first we prove B(G) ≤ 1. Consider an arbitratily oriented edge e to be inserted between the two leafs of G. The resulting graph G(cid:48) is an orientation of a circle and, according to lemma 3, has a balance of 0. Since by re-deleting e from G(cid:48) the balance can change by at most 1, we have B(G) ≤ 1. Now assume that B(G) = 1. Then the insertion of e must have created a new 2-star vertex of the type that appears less in G and cannot have created one of the other type, since G(cid:48) has a balance of 0. Thus, if G has more incoming 2-star vertices than outgoing 2-star vertices, both leafs have an outgoing edge, so that the insertion of e creates a new outgoing 2-star vertex at one of them and does not create a new 2-star vertex at the other. Equvialently, if G has more outgoing 2-star vertices than incoming 2-star vertices, both leafs have an incoming edge. We will now show that the maximum balance of a tree depends on its number of leafs. Lemma 5. Let G = (V, E) be an orientation of a tree with k leafs. Then B(G) ≤ k − 1. Proof. We prove the lemma by induction over the number k of leafs of the tree. For the base case let G be an orientation of a tree with k = 2 leafs. Then, by Lemma 4, we have B(G) ≤ 1 = k − 1. For the induction step we assume that G is an orientation of a tree with k > 2 leafs and that every orientations of a tree with at most m < k leafs has a balance of at most m − 1. Since G has at least three leaf vertices, there exists at least one 3-star vertex v in G. If we delete an edge e incident to v, G decomposes into two subgraphs G1 and G2 which are not connected to each other. We can choose v and e in such a way that G2 is a single vertex or an orientation of a line-shaped graph by starting at an arbitrary leaf of G and traversing along the edges of G until the first 3-star vertex is reached. Let v be a vertex found in such a way and let e be the last edge visited when traversing from the corresponding leaf to v (see figure 1). G1 has k − 1 leafs and, by the induction hypothesis, is guaranteed to have a balance of at most k − 2; G2 has a balance of 0, if it consists of a single vertex, and, by the induction hypothesis, a balance of at most 1 elsewise. We now re-insert e: We have B(G) ≤ B(G1) + B(G2) + 1. If B(G2) = 0 this immediately yields B(G) ≤ k−1; if the majority of 2-stars in G1 is incoming and the majority of 2-stars in G2 is outgoing (or vice versa), B(G) ≤ k − 1 follows immediately, too. Now assume that neither of it is the case, i.e. both G1 and G2 the same type of 2-stars has the majority and the balance G2 is 1; without loss of generality, assume that the majority of 2-stars in both graphs is incoming. Let u be the vertex of G2 that e is connected to. Then, by Lemma 4, u has an outgoing edge. Thus, if e = (u, v), a new outgoing 2-star at u is created, and at most one new incoming 2-star at v is created. If e = (v, u), no incoming 2-star at u is created, since the other edge incident to u is incoming, and, since e is an outgoing edge at v, no additional incoming 2-star at v is created. Thus, the number of incoming 2-star created by re-inserting e is bounded by the number of outgoing 2-stars created, and thus we have B(G) ≤ B(G1) + B(G2) ≤ k − 2 + 1 = k − 1. Finally we will derive an upper bound on the balance of arbitrary weakly connected graphs. We will need the following observation for this: Observation 1 Let G = (V, E) be an orientation of a tree and let C3 ⊆ V be deg(v) the set of 3-star vertices of G. Then G has exactly 2 − 2C3 +(cid:80) leafs. v∈C3 Proof. We show the observation by induction over the number of 3-star vertices in G. For the base case observe that if C3 = 0, G is an orientation of a line- shaped graph and thus has 2 leafs; hence the observation holds. For C3 = 1, assume that v is the only 3-star vertex in G and v has an undirected degree of k. Then, G consists of orientations of k lines, which are connected in v; G thus has k leafs and we have 2 − 2 · C3 +(cid:80) v∈C3 = k; hence the observation holds if G has at most one 3-star vertex. For the induction step we assume that G is a graph with C3 = i ≥ 2 3- star vertices and that the observation holds for all graphs G(cid:48) that have j < i 3-star vertices. Since G is a tree and contains at least 2 3-star vertices, there exists an edge e which is incident to a 3-star vertex v and lies on a direct path from v to another 3-star vertex u, but all the other edges incident to v lie on paths to leafs of G. We delete all the vertices and edges from G that form paths from v to leafs, but we sustain v and e. By the choice of v, v is a leaf in the 3 = C3\{v}. Thus, resulting graphs G(cid:48), and the set of 3-star vertices in G(cid:48) is C(cid:48) G(cid:48) has less than less than i 3-stars and by the induction hypothesis has at most 2 − 2C(cid:48) deg(v) leafs; furthermore, the degree of every vertex v ∈ C(cid:48) in G(cid:48) equals its degree in G. 3 +(cid:80) v∈C(cid:48) Now let G be the subgraph of G induced by the deleted vertices and v: Since by construction G can have no 3-star vertices other than v, G contains at most a single 3-star. Thus, by the base case, the number of leafs of G equals the undirected degree of v in G; let k be this number. Now we join G(cid:48) and G: v now has a degree of k + 1, and in the resulting graph G, v is not a leaf any more compared to G(cid:48), but G contains k additional leafs from G; thus, the number of leafs in G is larger than that of G(cid:48) by deg(v) − 2 and hence equals 3 3 (cid:88) deg(v) 3 ∪ {v} + (cid:88) v∈C3 v∈C(cid:48) 3∪{v} deg(v). = 2 − 2C3 + deg(v) − 2 + 2 − 2C(cid:48) 3 + deg(v) = 2 − 2C(cid:48) (cid:88) v∈C(cid:48) 3 Now we can proceed by proving an upper bound on the balance of an arbi- trary weakly connected graph: Lemma 6. Let G = (V, E) be a weakly connected graph that has (1 + δ)V edges, δ > 0. Also let C3 ⊆ V be the set of 3-star vertices of G. Then G has a balance of at most 2 + δV − 2C3 +(cid:80) by its number of leafs, which, by observation 1, is 2 − 2C3 +(cid:80) hence it holds B(G(cid:48)) ≤ 1 − 2C3 +(cid:80) 2 + δV − 2C3 +(cid:80) Proof. Delete δV + 1 edges from G in such a way that G remains weakly connected; Since the resulting graph G(cid:48) is weakly connected and has V − 1 edges, G(cid:48) is an orientation of a tree. By Lemma 5 the balance of G(cid:48) is bounded deg(v); By re-inserting all the deleted edges into G(cid:48), we get G. Since every re-inserted edge can only alter the balance by 1, we have B(G) ≤ B(G1) + δV + 1 ≤ deg(v). deg(v). deg(v). v∈C3 v∈C3 v∈C3 v∈C3 The following simple Lemma states that every weakly connected graph whose number of edges is larger than its number of vertices, contains at least one 3-star vertices. Hence, a graph can be rejected if it contains too many edges. EstimateEdgeCount(n, G, ) m ← 0 Sample s4 = 2D for i ← 1 to s4 do return m  pairs (v1, k1), . . . , (vs4 , ks4 ) of a vertex and a number of an adjacency list slot, i.e. (vi, ki) ∈ V × {1 . . . D} if vi has a ki-th edge then m ← m + Dn s4 Algorithm 4: EstimateEdgeCount Lemma 7. Let G = (V, E) be a weakly connected directed graph with n vertices and m > n edges. Then, G contains at least 1 3-star vertex. Proof. Since every edge of G has two incident vertices, the sum of all undirected vertex degrees in G is 2m. Hence, the average undirected vertex degree in G is 2m/n > 2; thus, there exists at least one vertex that has an undirected degree of more than 2 and therefore is a 3-star vertex (note that, by the assumption from the beginning of the section, G does not contain any double-edges). We will use the fact stated by Lemma 7 to reject every input graph, whose edge count exceeds a certain number. To estimate the edge count of a given directed graph, we use the algorithm EstimateEdgeCount. The algorithm samples O(D/) pairs (v, i) ∈ V (G) × {1, . . . , D} of a vertex and the number of a slot of its adjacency list uniformly and independently distributed at random; it then checks for all those pairs whether the corresponding edge exists and extrap- olates the fraction of edges found. Note that a similar technique has already been used in a property testing algorithm for acyclicity in bounded-degree graphs by Goldreich and Ron [11]. Lemma 8. Let G = (V, E) be a directed graph with n vertices and m edges and let the undirected degree of every vertex of G be bounded by D ∈ N; let  < 1 be a proximity parameter. Then EstimateEdgeCount returns a value m that, with probability at least 1 − 2e−4, satisfies m − n ≤ m ≤ m + n. The running time of EstimateEdgeCount is O(D/). neighbor, i = 1, . . . , s4; let X =(cid:80) Proof. Let Xi be an indicator random variable for the event that vi has a ki-th Xi. Each of the m edges of G is stored in exactly one adjacency list slot as an outgoing edge and there are Dn adjacency list slots in total. Since (vi, ki) is chosen u.i.d. at random among all pairs of a vertex and an adjacency list slot, it holds 1≤i≤s4 E[Xi] = Pr[Xi = 1] = m Dn and, by the linearity of expectation, E[ m] = E = E (cid:21) (cid:20) Dn · (cid:88) · X s4 1≤i≤s4  Dn s4  m Dn = m. · (cid:88) · (cid:88) 1≤i≤s4 Xi 1≤i≤s4 = Dn s4 E[Xi] = Dn s4 It remains to show that the probability that m differs from m by more than n is at most 2e−4. For this purpose, we use an additive Chernoff Bound: Pr [ m − E[ m] > n] = Pr (cid:104)X − E[X] > (cid:105) ≤ 2e−2s2 s4 D 4/D2 = 2e−4. The running time of EstimateEdgeCount directly follows from the number of samples taken. Analogously to the above proof one can show that the value k that is com- puted in algorithm Teste3SternFreiheit is a good estimate of the number of outgoing 2-stars in the input graph: Lemma 9. Let G = (V, E) be a directed graph with n vertices and a bounded undirected vertex degree of D ∈ N. Let  be a proximity parameter and assume that G contains k ≤ n outgoing 2-star vertices. Then, for the value k computed by Test3StarFreeness(n, G, ) it holds k ≤ k ≤ k +  6 n with a probability of at least 1 − 2e−16. Proof. We consider the vertex sample drawn in the fifth line of the algorithm: Let Xi be an indicator random variable for the event that the vertex vi is an outgoing 2-star vertex. Both the probability for this event and the expected value X. By the linearity of Xi are k/n. Let X =(cid:80) Xi; then, k =  1≤i≤s3.1 of expectation we get E (cid:105) (cid:104)k (cid:104)(cid:12)(cid:12)(cid:12)k − E[k] Pr k n 12 n + n s3.1  (cid:88)  = k + (cid:105) ≤ 2e−2s2 1≤i≤s3.1 s3.1  12 =  12 n + n s3.1 E[X] =  12 n + n s3.1  12 n. To bound the probability of k deviating from its expectation by more than  we again use an additive Chernoff Bound: 12 n (cid:12)(cid:12)(cid:12) > n/12 (cid:105) (cid:104)X − E[X] > = Pr 3.1/144 = 2e−16. We can now start with proving the correctness of Test3StarFreeness. We divide the proof into four parts: The first part handles the case that the input graph G (having n vertices) is 3-star free, the remaining three parts the case that G ist -far from 3-star free. In this case we consider the following three subcases: -- G has more than n +  -- G has at most n +  8 n edges; have at least one outgoing edge; 8 n edges and contains at least  16D n 3-star vertices that -- G has at most n +  16D n 3-star vertices that have at least one outgoing edge (and thus there are many 3-star vertices that have only incoming edges). 8 n edges and contains less than  For every possible input one of the above cases holds. We start our analysis with the three subcases where we assume G to be -far from 3-star free. In case 8 n edges, Test3StarFreeness will reject in the first line G has more than n +  with probability at least 2e−4; this follows directly from Lemma 8: Lemma 10. Let G = (V, E) be a weakly connected directed graph with n vertices and a bounded undirected vertex degree of D ∈ N. Let  < 1 be a proximity param- eter and assume that G has m > n+  returns false with a probability of at least 1 − 2e−4 false. The next case we consider is that G has at most n +  8 n edges and contains at least 16D n 3-star vertices that have an outgoing edge. Each of these 3-star vertices is the central vertex of an occurence of a 3-star orientation in G, that has at least one incoming edge; there are (not considering isomorphism) 3 such orientations, and hence one of them has at least 8 n edges. Then, Test3StarFreeness(n, G, ) 48D n occurences in G. 96D n ≥  Since deleting an edge from G can at most remove two of these occurences, at least 192D n + 1 edge modifications in G are necessary to remove all the occurences of this orientation1, and thus G is 192D -far from freeness of this 3-star orientation. Hence and by Lemma 2, the corresponding call to TestSubgraphFreenessAmplified in the third line of Test3StarFreeness returns false with a probability of at least 5/6 false. These considerations yield the following Lemma:     Lemma 11. Let G = (V, E) be a directed graph with n vertices and a bounded undirected vertex degree of D ∈ N. Let  < 1 be a proximity parameter and assume that G has m ≤ n +  16D n 3-star vertices that have at least one outgoing edge each. Then, Test3StarFreeness(n, G, ) returns false with a probabilty of at least 5/6. 8 n edges and contains at least  For the case of the input graph G being -far from 3-star free, it remains to show that Test3StarFreeness rejects with high probability if G contains less than  16D n 3-stars that have outgoing edges. Lemma 12. Let G = (V, E) be a weakly connected directed graph with n vertices and a bounded undirected vertex degree of D ∈ N. Let  < 1 be a proximity parameter and assume that G is -far from 3-star free, has m ≤ n +  8 n edges and contains less than  16D n 3-star vertices that have at least one outgoing edge each. Then, Test3StarFreeness(n, G, ) returns false with a probabilty of at least 5/6. 1 n ≥ 192D can be assumed since we have assumed n = ω (cid:16) D4 above. (cid:17)  2 e1 v e2 Fig. 2: Two-way collision at an incoming 3-star vertex v; the sampled edges e1 and e2 are highlighted and the vertex colouring follows that of figure 1. 24 holds in the Proof. We will show that under the given assumptions r > 1 +  first but las line of Test3StarFreeness with a probability of at least 1 − e−6; hence the algorithm rejects the input with high probability. The basic idea of this proof is the following: By Lemma 6, the maximum Balance of G has a linear dependence on the number of its edges that are incident to 3-star vertices; the probability of sampling at least two of the incoming edges of a 3-star vertex, however, grows quadratically in the number of incoming edges that this vertex has. Since there are (as we will show) at least n 3-star vertices in G and almost all of them do not have outgoing edges, there are nearly n 3-star vertices that have at least 3 incoming edges each. Hence the probability of sampling a collision at one of them is relatively large: Counting the number of collisions and grossing up overestimates the number of outgoing 2-star vertices (to which the outgoing 3-star vertices belong) by more than the outgoing 2-star vertices can outnumber the incoming 2-star vertices due to the balance of G. Thus, the expected value of c will be much larger than that of k and the expected value of c will be much larger than 1 hence. We will need some additional definitions to concretize this idea. At fist, let C2 be the set of incoming 2-stars vertices that have exactly 2 incoming edges 3 ⊆ C3 the set of and let C3 be the set of incoming 3-stars in G. We denote by C(cid:48) incoming 3-stars that do not have an outgoing edge and by C3 ⊇ C3 the set of all 3-star vertices in G. For the cardinalities of these sets we define c2 := C2, 3 and c3 := C3. Then it holds C := C2 + C3 for the set of c3 := C3, c(cid:48) all incoming 2-star vertices C and c := c2 + c3 for its cardinality. Analogously to the last equation, we also say c = c2 + c3, where c2 denotes the contribution of collisions on vertices in C2 and c3 that of collisions on vertices in C3. 3 := C(cid:48) G contains at least n 3-star vertices: If the number of 3-star vertices was smaller, there would be less than Dn edges adjacent to them, and deleting all of these edges would remove every 3-star vertex from G; this would be a contradiction to the assumption that G is -far from 3-star free. Since by the assumption of the lemma less than  have incoming edges and D ≥ 3, there are at least c(cid:48) 3 > (cid:0)1 − 1 16D n of these 3-star vertices 48 n (cid:1) n ≥ 47 16D 3-star vertices without outgoing edges. Since C(cid:48) We define c3 ≥ c(cid:48) 3 > l := (deg(v) − 2), (cid:19) 3 is a subset of C3, it also holds n ≥ 47 48 n. (1) 1 − 1 16D (cid:18) (cid:88) v∈C3 and in the following we will derive an upper bound for k and a lower bound for c; both bounds will relate on l, which will help us bounding r = c from below. k Furthermore, it holds l ≥ c3, , (2) since every vertex in C3 has an undirected degree of at least 3. We start by proving an upper bound for k. Since G has at most n +  by the assumption of the Lemma, the balance of G is at most 8 n edges B(G) ≤  8 n + 2 + = <  8  8 n + 2 + n + l + (cid:88) (cid:88) v∈ C3 v∈C3  16 (deg(v) − 2) (deg(v) − 2) + (cid:88) v∈ C3\C3 (deg(v) − 2) n < l +  4 n, sumption of the Lemma, and thus there are at most D(cid:0)  by Lemma 6 and because C3\C3 only contains 3-star vertices that have at least 16D n − 1 such 3-star vertices by the as- one outgoing edge; there are at most 16 n − 2 Since c is the number of incoming 2-star vertices and the balance of G is at 4 n. 4 n, the number of outgoing 2-star vertices in G is ar most c + l +  most l +  By Lemma 9 we get that, with probability at least 1 − 2e−16, it holds 16D n − 1(cid:1) <  edges that are incident to one of them.  k ≤ c + l + 1 2 the second inequality follows from the inequality 5 12 n < 5 we get from (1). n < c2 + c3 + l + c3 ≤ c2 + n +  4  6 12 · 48 l; 5 2 47 c3 < 1 2 c3, that We will now bound c from above. Let Xv be an indicator random variable for the event that for a vertex v at least 2 incoming edges are contained in the edge sample of Test3StarFreeness, i.e., we have a (2-way) collision at v. Let X (2) =(cid:80) v∈C2 Xv und X (3) =(cid:80) v∈C3 Xv. It holds (cid:18)degin(v) (cid:19) 2 (cid:18)degin(v) (cid:19) 2 ≥ αp2 E[Xv] = Pr[Xv = 1] = p2(1 − p)degin(v)−2 48 due to the minimum number of vertices we have assumed for G and by n ≥ 47 for α := 47 the Bernoulli Inequality: (1− p)degin(v)−2 ≥ (1− p)D ≥ 1− pD = 1− D2 √ for n ≥ 2304D4 3/2 48 . 3 Hence, for the contribution of collisions on incoming 2-star vertices to c, (cid:88) v∈C3 = 1 p2 X (3)(cid:105) (cid:104) (cid:88) 1 p2 E α 2 v∈C(cid:48) 3 deg(v)2 − deg(v) ≥ 3α E[c3] = = E[Xv] ≥ α (cid:18)degin(v) (cid:19) (cid:88) (cid:18)deg(v) (cid:19) v∈C(cid:48) 3 2 ≥ α (cid:88) (cid:88) v∈C(cid:48) 3 2 v∈C3 deg(v) − 2 due to the linearity of expectation and since for every 3-star vertex it holds deg(v)2 − deg(v) ≥ 6· (deg(v)− 2). We want to relate the above sum to l, but in this sum only the vertices in C(cid:48) 3 are considered. However, by the assumption of 16D n vertices in C3\C(cid:48) 3 -- all of these vertices are the Lemma there are at most 3-star vertices that have at least one outgoing edge. The sum over the degrees 47 l since it holds of these vertices is at most 1 16 n ≤ 3 1 l ≥ c3 ≥ 47 48 n (3) by the inequalities (2) and (1). Hence we can conclude (cid:88) v∈C(cid:48) 3 deg(v) − 2 > deg(v) − 2 − (cid:88) (cid:88) v∈C3 v∈C3\C(cid:48) 3 deg(v) ≥ l − 3 47 l = 44 47 l. We can use this in the above bound for E[c3] and get E[c3] > 3αl = 11 4 · 4 l ≥ 11 48 n since α = 47 48 and due to inequality (3). Now we can apply a multiplicative 47 Chernoff Bound, which yields an upper bound for the probability that c3 is (cid:19) smaller than this value by a factor of more than (1 − /44): Pr [c3 < (1 − /44)E[c3]] = Pr X (3) < (1 − /44)p2E [c3] (cid:105) ≤ exp (cid:19) ≤ exp (cid:18) (cid:18) − 2p2 2 · 442 E[c3] − 8 · 47D2 (cid:19) 33 < e−100. ≤ exp − 12822D2 2 · 4423n · 11 4 · 47 48 n (cid:104) (cid:18) Analogously we can conclude Pr [c3 < (1 − /24)E[c3]] < e−600. In both cases we use the fact D ≥ 3. For estimating c it remains to calculate the expected number of collisions on vertices in C2. Since these vertices have exactly 2 incoming edges, it holds E[c2] = E[Xv] = p2 = c2. v∈C2 Now we distinguish between two cases, c2 ≥ 1 v∈C2 16 l. In the former case, c2 is relatively large, and we can use a Chernoff Bound to show that c2 is a good estimate for c2; then we can argue that the vertices in C3 form at least roughly an -fraction of the vertices in C and thus c = c2 + c3 is significantly larger than c. 16 l and c2 < 1 (cid:88) 1 p2 (cid:88) 1 p2 of the vertices in C2 to c. In the latter case, i.e., if c2 is small, we will simply neglect the contribution We start with the first case, i.e., we have c2 ≥ 1 16·48 n by inequality 16 l ≥ 47 (3), and by applying a multiplicative Chernoff Bound we conclude Pr [c2 < (1 − /24)E[c2]] = Pr X (2) < (1 − /24)E ≤ exp − 12822D2 2 · 2423n · 47n 16 · 48 (cid:104) (cid:18) (cid:18) (cid:104) X (2)(cid:105)(cid:105) ≤ exp (cid:19) < e−7. (cid:19) − 2p2 2 · 242 c2 By adding the lower bounds for c3 and c2, we gain a lower bound for c, i.e., ≥ (cid:1) r = = (cid:16) (cid:16) c2 + c3 (cid:17)(cid:18) with high probability it holds (cid:1)(cid:0)c2 + 11 (cid:0)1 −  (cid:18) 5 (cid:19)(cid:19) (cid:1) n, since G contains at least(cid:0)1 − 1 Furthermore we have c2 ≤ n−(cid:0)1 − 1 3-star vertices that do not have an incoming edge, and c3 ≥(cid:0)1 − 1 c k 1 −  24 24 c2 + 5 2 c3 c2 + 5 1 4 c3 c2 + 5 1 −  24 (cid:17)(cid:18) (cid:19) 1 10 4 c3 2 c3 2 c3 2 c3 1 + 1 + 16D = = k . (cid:1) n (cid:1) n by in- 16D equality (1) and since every such vertex is contained in C3. We are allowed to insert this lower bound for c3 into the fraction c2+5c3/2 since the fraction is smaller than 1 and by inserting both nominator and denominator are decreased by the same value. Hence we can conclude 5c3/2 16D (cid:32) 1 + 1 10 (cid:17)(cid:32) (cid:17)(cid:32) r ≥(cid:16) (cid:16) = 1 −  24 1 −  24 n −(cid:0)1 − 1 (cid:33) 5 2 16D 1 4  . 1 + 1 1− 1 16D + 3 2  (cid:1) n (cid:0)1 − 1 (cid:1) n + 5 (cid:0)1 − 1 16D 2 16D (cid:1) n (cid:33)(cid:33) 48 and  < 1 -- from which in particular follows  > 2 -- , we Since 1 − 1 finally get r ≥(cid:16) 16D ≥ 47 (cid:17)(cid:18) 1 −  24 (47 · 24 − 474) − 472 1 4  47 + 3 2  1 + 48 = 1 + 24 · 474 (cid:19) ≥(cid:16) (cid:17)(cid:18) 1 −  24 ≥ 1 + 607 24 · 474  1 + 192 47 + 6 1 24  > 1 + = . (cid:19) (cid:16) (cid:17)(cid:18) 1 −  24 1 + 47 474 (cid:19) The probability that one of the bounds for c2 and c3 that we have assumed here does not hold hold is, by the Union Bound, at most e−600 + e−7 < e−6. We will now consider the case that there are only very few incoming 2-stars 16 l. Since, by inequality (2), it holds that are not incoming 3-stars, i.e., c2 < 1 c3 ≤ l, we can conclude (cid:0)1 −  (cid:1) · 11 4 l 44 c2 + 5 2 c3 (cid:16) = 1 −  44 (cid:17) · (cid:16) (cid:17) · 44 41 1 −  44 11 4 l 16 l + 5 2 l 1 = ≥ r = = ≥ c3 c k k 44 −  41 ≥ 41 + 2 41 > 1 + 1 24 , with a probability of at least e−100 < e−6. We have by now proven that r > 1 + 1 24  holds with a probability of 1− e−6 if the assumptions of the lemma are fulfilled and the algorithm Test3StarFreeness gets to the first but last line; hence, the algorithm rejects the input with at least the above probability in this case. It remains to show that Test3StarFreeness does not return true in the second but last line -- this would happen in case c ≤ 3 4 l holds, and by in- equality (3) we can conclude 2 n. We have, however, assumed that c3 ≥ (cid:0)1 −  (cid:1) 11 24 c ≥ c3 ≥(cid:16) (cid:17) 11 1 −  24 l ≥ 47 48 · 11 4 n ≥ 2n 4 from this. Thus Test3StarFreeness does not return true in the second but last line if r is estimated correctly. at least 1 − e−6 > 5 6. Hence the probability that Test3StarFreeness correctly returns false is It remains to show that Test3StarFreeness works correctly if the input graph is 3-star free. Lemma 13. Let G = (V, E) be a weakly connected directed 3-star free graph with n vertices and a bounded undirected vertex degree of D ∈ N. Let  < 1 be a proximity parameter. Then, Test3StarFreeness(n, G, ) returns true with a probabilty of at least 3/4. Proof. There are three possibilities for Test3StarFreeness inadvertantly re- jecting the input: By considerably overestimating the edge count in the first line, by drawing an edge sample of a size of more than 2048D and by computing a 3/2 24. Since TestSubgraphFreenessAmplified has an one-sided value r > 1 +  error and G is 3-star free, the subgraph freeness tests in the third line will always return true. Since G is weakly connected and does not contain any 3-star vertex, G con- tains at most n edges (note that we still assume that there are no double edges in G). By Lemma 8 the probability that EstimateEdgeCount(n, G, /16) re- 16 n is at most 2e−4; hence Test3StarFreeness turns a value larger than n +  will not return false in the first line with a probability of at least 1 − 2e−4. √ n The expected number of edges that are drawn in the eigth line of Test3StarFreeness √ n ; thus, by Markov's Inequality, the number of edges drawn will is pn = 128D 3/2 16. Hence not be larger than 2048D 3/2 Test3StarFreeness will not return false in the eigth line with at least this probability. = 16pn with a probability of at least 15 √ n It remains to show that the estimator e does not exceed 1 +  24 with high probability. Let k be the number of outgoing 2-star vertices in G and let c be the number of incoming 2-star vertices. By Lemma 9 it holds k ≥ k with a probability of at least 1 − 2e−16, and, since G is an orientation of a circle or a line-shaped graph, the balance of G is at most 1 by lemma 3 respectively by Lemma 5. Thus, we have k ≥ c − 1 with a probability of at least 1 − 2e−16. Now let C2 be the set of incoming 2-star vertices; let, for v ∈ C2, Xv be an indicator random variable for the event that both incoming edges of v are in Xv. Es gilt E[Xv] = the edge sample of Test3StarFreeness. Let X :=(cid:80) v∈C2 Pr[Xv = 1] = p2. For the expected value of c we conclude E[c] = 1 p2 X = 1 p2 E[Xv] = C2 = c. (cid:88) v∈C2 Now at first assume c ≥  (cid:104) c ≥(cid:16) Pr 1 +  32 (cid:17) (cid:105) 4 n. Then, by a multiplicative Chernoff Bound − 2p2c 3 · 1024 (cid:105) ≤ exp  32 E[X] (cid:17) = Pr 1 + c (cid:18) (cid:19) (cid:104) X ≥(cid:16) (cid:18) (cid:19) = exp − 12823D2n 3 · 4 · 10243n = e−2D2/3 ≤ e−6. (cid:17) (cid:0)1 +  24 (cid:1) −  ≤(cid:16) (cid:17) (cid:0)1 +  32 (cid:1) c (cid:16) Thus, by the Union Bound, with at least a probability of 1 − 2e−16 − e−6 > 5 6: 25 24 −  c − 1 96·4 n , 96 c r ≤ = + + 1 + 1 +  24 c − 1 c − 1  24 and the last fraction is smaller or equal zero if n ≥ 400 2 ; however, this holds because of the minimum number of vertices of G we have assumed above. Hence it holds r ≤ 1 +  24 with a probability of at least 5 6. Finally consider the second case for c, c <  4. By Markov's Inequality we have 6, and hence Test3StarFreeness returns true Thus, the probability that Test3StarFreeness(n, G, ) inadvertantly re- in the second but last line with a probability of at least 5 6. turns false is at most 2e−4 + 1 2 n(cid:3) = Pr [c > 6E[c]] ≤ 1 Pr(cid:2)c > 3 4 by the Union-Bound. 16 + 1 6 < 1 The correctness of Teste3SternFreiheit directly follows from Lemmas 11, 12 and 13. The size of the edges sample drawn dominates the query complexity of Teste3SternFreiheit, which is, hence, O(cid:16) √ (cid:17) . n 3/2 Theorem 2 Let G = (V, E) be a weakly connected directed graph with n ver- tices and a bounded undirected vertex degree of D ∈ N. Let  < 1 be a prox- imity parameter and assume that G does not have any double edges. Then, Test3StarFreeness(n, G, ) returns true with a probabilty of at least 3/4 if G is 3-star free, and returns false with a probability of at least 5 6 if G is -far from . n 3/2 3-star free. The query complexity of the algorithm is O(cid:16) √ (cid:17) Finally we will reconsider the restriction that the input graphs are not allowed to have double edges. Assume that a graph G has double edges: Then let G(cid:48) be the graph that results from deleting from every double edge in G the edge whose starting vertex has the larger vertex number. Since in this way we delete exactly one edge from every double edge, G(cid:48) does not have any double edges; on the other hand, the number of adjacent vertices did not change for any vertex in G(cid:48). Hence, G(cid:48) contains exactly the same number of 3-star vertices as G and thus is 3-star free if G is 3-star free and is -far from 3-star free if G is -far from 3-star free. This reduction can be computed locally: For any sampled edge (u, v) it has to be checked whether there is an edge (v, u); if this is the case and u has a larger vertex number than v, (u, v) is considered non-existent and the sampled edge is dismissed and, instead, a new edge is drawn uniformly by random. We can now run Test3StarFreeness on G(cid:48) while construction G(cid:48) from G locally. The expected number of edges we have to draw until the sample does not get dismissed is at most 2, and by Markov's Inequality the number of edges sampled in G is with high probability larger than the number of those returned to Test3StarFreeness only by a constant number. If not so, the algorithm can abort computation by returning true, which will result in a small increase of the error probability in case the input graph is -far from 3-star free: Corollary 2. Let G = (V, E) be a weakly connected directed graph with n ver- tices and a bounded undirected vertex degree of D ∈ N. Let  < 1 be a proximity parameter. Then, Test3StarFreeness(n, G, ) returns true with a probabilty of at least 3/4 if G is 3-star free, and returns false with a probability of at least 3 4 . if G is -far from 3-star free. The query complexity of the algorithm is O(cid:16) √ (cid:17) n 3/2 4 Lower Bounds for Testing 3-Star Freeness √ In this section we give two lower bounds on the query complexity of property- testing algorithms for 3-star freeness: A lower bound of Ω( n) queries for testing 3-star freeness in weakly connected graphs, and a lower bound of Ω(n2/3) queries if weak connectivity of the input graphs is not required. This means that the algorithm given in the last section is asymptotically optimal in the number n of vertices of the input graph; moreover, it means that testing 3-star freeness is easier if the input graphs are guaranteed to be weakly connected. This brings up the question whether there are more problems for which this holds true. The first lower bound, that of Ω( n) for testing in weakly connected graphs, follows from graph classes given by Bender and Ron for their lower bound for testing strong connectiviy [5]: Their class of strongly connected graphs consists of orientations of circles, where all edges have the same orientation. Such graphs are 3-star free. Their class of graphs that are -far from strongly connected consists of orientations of circles where all edges have the same orientation, but additionally there are more than Dn outer vertices that have an edge towards a circle vertex. Each circle vertex at most one incoming edge from an outer vertex, and since a circle vertex that has such an edge possesses three neighbours, it is a √ 3-star vertex. By construction there are more than Dn such vertices, and since converting such a graph into a 3-star free graph requires deletion of one incedent edge for each of these vertices, those graphs are -far from 3-star free. Since Bender and Ron show that the two classes of graphs cannot be distinguished √ with o( n) queries, we can conclude the following corollary: Corollary 3. In the adjacency list model for directed graphs where algorithms √ cannot query the incoming edges of a vertex, every property testing algorithm n), where n is the number for 3-star freeness has a query complexity of Ω( of vertices of the input graph. This even holds if the possible input graphs are restricted to be weakly connected. In the remainder of this section we will derive a lower bound of Ω(n2/3) for the query complexity of every property testing algorithm for 3-star freeness that does not require the input graph to be weakly connected. Note that for the above bound of Ω(n1/2) both graph classes considererd consist of weakly connected graphs. We will make use of a technique invented by Raskhodnikova et al. [15] and construct two classes of problem instances -- one consisting of 3- star free graphs, the other of -far ones -- such that the distributions of incoming vertex degrees in graphs of these two classes have 2 proportional moments. By the results of [15] that means that every algorithm that measures a significant difference between these distributions uses Ω(n2/3). The difficulty here is to show that measuring vertex in-degrees is the only thing an algorithm can do to compare graphs from these classes. Since this is hard to argue even for graphs that only consist of isolated k-stars, we will define a helper problem that is very similar to the distinct elements problem examined in [15]. We will then reduce testing this helper problem to testing 3-star freeness. The helper problem is defined as follows: We are given a sequence A of m integers Ai ∈ N, i = 1, . . . m; each value occurs in at most 3 elements of A. Let l be the number of distinct values that occur in A: We assume that all these values are from {1, . . . , l}. If there is no value a ∈ {1, . . . , l} that occurs in 3 elements of A, we call A 3-value free. Note that this problem is completely characterized by the sequence A. For property testing we call a sequence A -far from 3-value free, if more than m elements of A have to be changed to establish 3-value freeness; for that matter it is allowed to assign values that are not yet assigned to one of the elements of A, i.e., numbers that are larger than l. A property testing algorithm knows the number m of elements and may query the value of the i-th element of the sequence for i = 1, . . . , m. We call an algorithm poisson-s algorithm if it determines randomly by the poisson distribution how many random samples it draws. The analysis in [15] requires poisson-s algorithms that only get access to the histograms of their random samples; i.e., the algorithms get the information how many values in the sample occur once, twice, thrice, etc., but not the numbers of the elements or their values itself: Definition 9. Let S be a multiset. The histogram H of S is a function that assigns to each integer i ∈ N the number of elements of S that occur exactly i times in S; i.e., H(i) := {s ∈ Ss is contained in S exactly i times} . We make use of two Lemmas from [15] in order to show that for a lower bound for testing 3-value freeness it suffices to consider poisson-s algorithms that only get access to the histogram of their samples. The following Lemma is a direct corollary of Lemma 3.12 and of Lemma 5.3 a) and c) from [15]: Lemma 14. Let A be an arbitrary sampling-based algorithm that draws t ele- ments of a sequence A; assume that A accepts with a probability of at least 3 4 if A is 3-value free and rejects with a probability of at least 3 4 if A is -far from 3-value free. Then there is a poisson-s algorithm A(cid:48) that has an expected number of s = O(t) queries and only gets access to the histogram of these queries and that 4 − o(1) if A is 3-value free and rejects with accepts with a probability of at least 3 a probability of at least 3 4 − o(1) if A is -far from 3-value free. Note that the property of 3-value freeness of a sequence A is closed under permutation of the sequence elements, as is the property of -farness of 3-value freeness; thus these properties fulfill the premises of Lemma 3.1 and 5.3 c) in [15]. The probability guarantees of A(cid:48) follow from those that Lemma 5.3 a) in [15], since the statistical distance between the distributions of the results of A and A(cid:48) is at most 4 Analogously to [15] define a frequency variable XA as a random variable for the number of occurences in A that a value drawn randomly uniformly dis- tributed from {1, . . . , l} has. The following Lemma is a also a direct corollary from [15], namely from Corollary 5.7: s = o(1)3. Lemma 15. Seien A und B Probleminstanzen von 3-Wert-Freiheit und seien XA und XB die zugehörigen Frequenzvariablen. Falls XA und XB k − 1 pro- portionale Momente haben, dann gilt für jeden Poisson-s-Algorithmus A mit s = o(n1−1/k), der nur die Histogramme seiner Samples sieht Pr[A(A) = true] − Pr[A(B) = true] = o(1). Two random variables X1 and X2 are said to have k−1 proportional moments, E[X2] = E[X 2 We can now use the preceeding Lemmas in order to prove that any property- 2 ] = . . . = E[X k−1 E[X k−1 1 ] E[X 2 ] ] if E[X1] . 1 2 testing algorithm for 3-value freeness needs at least Ω(n2/3) samples. Lemma 16. Any property-testing algorithm for 3-value freeness needs at least Ω(n2/3) samples, where n is the length of the input sequence. 2 Cited by Raskhodnikova et al. from [4]. 3 Due to corollary 3 we can assume s = Ω( √ n), and hence it holds 4 s = o(1). Proof. At first note that, due to Lemma 14, every property testing algorithm for 3-value freeness can be replaced by a poisson-s algorithm with an asymptotically equal query complexity, which only gets access to the histogram of its queries -- for sufficiently large sequence length n the additional error probability is negleg- ible. Hence it suffices to show that every poisson-s algorithm for 3-value freeness needs to take at least an expected number of s = Ω(n2/3) queries. Furthermore, due to Lemma 15, every such poisson-s-algorithm needs at least Ω(n2/3) queries in expectation to distinguish two sequences A and B whose frequency variables XA and XB have to proportional moments. We will now give two such classes, CA being a class of 3-value free sequences and CB a class of sequences that are -far from 3-value free. From the above considerations we can then conclude that testing 3-value freeness requires Ω(n2/3) queries. Let CA be the class of all sequences A of length n, such that n is a multiple 2 n distinct values, each of them two times. Every sequence Let CB be the class of all sequences B of length n, such that n is a multiple of 32 and the values that occur in B are distributed as follows: There are 17 32 n distinct values in total, of whom 1 32 n values 2 times 32, all of the sequences in CB are -far from 3-value and 3 free. We will now show that the frequency variables of two sequences of equal length from CA and CB have two proportional moments. Let, for an arbitrary fixed n, A ∈ CA and B ∈ CB with length n each and let XA and XB be the corre- sponding frequency variables. It holds E[XA] = 2 and E[X 2 A] = 4. Furthermore, we have of 32 and A contains 1 in A is 3-value free. 32 n values occur 3 times, 13 32 n values once. For  < 1 E[XB] = · 3 + 1 17 13 17 · 2 + · 1 = 3 17 32 17 and E[XB] = 1 17 · 9 + · 4 + 13 17 3 17 · 1 = 64 17 . We can conclude E[X 2 A] E[X 2 B] and hence XA and XB have two proportional moments. E[XA] E[XB] = = = , 2 · 17 32 4 · 17 64 Wir werden nun durch Reduktion zeigen, dass jeder Property-Testing-Algorithmus für 3-Stern-Freiheit Ω(n2/3) Anfragen benötigt, wenn dies auch eine untere Schranke für das Testen von 3-Wert-Freiheit ist. Theorem 3 In the adjacency list model for directed graphs where algorithms cannot query the incoming edges of a vertex, every property testing algorithm for 3-star freeness has a query complexity of Ω(n2/3), where n is the number of vertices of the input graph. Proof. For a proof by contradiction we assume that there is a property testing algorithm A for 3-star freeness that has a query complexity of o(n2/3) for input graphs with n vertices. We will construct an algorithm A(cid:48) that takes as input a 2 n and a proximity parameter (cid:48), and we will prove sequence A of length n(cid:48) = 1 that A(cid:48) is a property testing algorithm for 3-value freeness that has a query complexity of o(n2/3). A(cid:48) works by calling A and returning the return value of A; the proximity parameter  of A is set to 2(cid:48) and A is given oracle access to a graph G = (V, E) with n = 2n(cid:48) vertices that is dynamically constructed for each query of A. G consists of isolated stars or single vertices and is defined as follows: -- V consists of n(cid:48) central vertices v1, . . . , vn(cid:48) and n(cid:48) outer vertices u1, . . . , un(cid:48). -- For i = 1, . . . , n(cid:48), there is an edge from ui to vAi; i.e., the outer vertices for whose numbers the corresponding elements of A have the same value form a star together with a common central vertex. -- G does not contain any further vertices and edges; thus, there may be isolated vertices in G. 1 Hence, the vertices ui represent the elements of the sequence A in G, and by having a common central vertex in G it is represented that the corresponding elements of A have the same value. For a query of A, G can be constructed locally4: When an unknown vertex is queries, it is determined by throwing a coin whether this vertex will be a central n(cid:48)−c 2n(cid:48)−c−o, if so vertex or an outer vertex; the probability for a central vertex is far c central vertices and o outer vertices are known to A. If the queried vertex turns out to be an outer vertex, A(cid:48) queries a sequence element that is randomly uniformly distributed among those that have not already been queried; hence the probability for each of the remaining elements is n(cid:48)−o if, again, o is the number of previously queried outer vertices. Basically this is equivalent to drawing from A without replacement. Now let i be the number of the sequence element that has been selected in this way: A(cid:48) inserts an edge (u, vAi ) into the graph in construction. Since A can only query the outgoing edges from vertices and all the edges of G are directed from outer to central vertices, every edge that A queries can be constructed in this way. This construction procedure needs at most 1 query to A for every query of A; hence the query complexity of A(cid:48) is at most that of A, which is o(n2/3) = o((n(cid:48))2/3). Furthermore, each value that occurs i times in A corresponds to an i-star in the graph G constructed by A(cid:48). Hence, G is 3-star free if and only if A is 3-value free, and, by the choices of  and (cid:48), G is -far from 3-star free if and only if A is (cid:48)-far from 3-value free. Thus, A(cid:48) is a property testing algorithm for 3- value freeness that has a query complexity of o((n(cid:48))2/3), which is a contradiction to Lemma 16. Hence there does not exist a property testing algorithm A for 3-star freeness that has a query complexity of o(n2/3). 4 The construction method given here does not necessarily create the above vertex permutation, but the resulting graph is isomorphic to G. For the sake of simplicity, we will refer to it as G. We finally discuss lower bounds for the query complexity of testing k-star freeness for k > 3. The property of k-value freeness is defined analogously to 3-value freeness, and the Lemmas 14 and 15 hold analogously for k-star freeness; the reduction from k-value freeness to k-star freeness can be done analogously to the special case k = 3. The difficulty is to give classes CA and CB like in the proof of Lemma 16 that have k − 1 proportional moments. This can be easily done for fixed k > 3, but it is an open problem to give closed formulae for the frequency distributions of the different i-stars in graphs of these classes. We close this chapter with the below conjecture: Conjecture 1. In the adjacency list model for directed graphs where algorithms cannot query the incoming edges of a vertex, every property testing algorithm for k-star freeness has a query complexity of Ω(n1−1/k), where n is the number of vertices of the input graph. 5 Testing Strong Connectivity Strong connectivity, i.e., the question whether all pairs of vertices are connected by paths in both directions, is a very basic property of directed graphs. In this chapter we will give a property testing algorithm for strong connectivity that Property-Testing for this graph property was at first considered by Bender and Ron [5], who, amongst others, give a lower bound of Ω(n1/2) for any property testing algorithm for this problem under the assumption that the algorithm may only query the incoming edges of a vertex. After first publishing this result at ESA 2012 [13] we discovered that there already existed a proof sketch for an algorithm similar to ours, which Oded Goldreich published in the appendix of a survey article about graph property testing [9]. At the end of this section we will include a detailed discussion about similarities and differences between Goldreich's and our algorithm. The above-mentioned lower bound construction of Bender and Ron -- more precisely the class of -far graphs that Bender and Ron give -- can be used for deriving a lower bound of Ω(n) for any property testing algorithm with one- sided error in the same graph model: Let G be a graph with n vertices that consists of a directed circle of n − Dn − 1 vertices, whose edges all have the same direction, and Dn + 1 outer vertices that have exactly one edge to one of the circle vertices; each circle vertex has at most one incoming edge from an outer vertex (see figure 3). G is -far from being strongly connected, since for archieving strong connectivity, every outer vertex needs an additional incoming edge. On the other hand, every subgraph H of G induced by at most n− Dn− 2 vertices can be completed to a strongly connected graph G(cid:48) with n vertices as follows: There are Dn+2 vertices and their adjacent edges to add; for every outer vertex of G, add an edge from one of the missing vertices; in particular, since at least one of the circle vertices of G is missing in H, this missing circle vertex can be connected to one of the outer vertices. After this, add the remaining edges of G to G(cid:48), ignoring those that would create an outgoing 2-star at its source G H G(cid:48) Fig. 3: Graph G, example for a subgraph H explored by an algorithm and strongly connected graph G(cid:48) constructed from H vertex (see again figure 3). The resulting graph is strongly connected. Hence, no algorithm that only queries n − Dn − 2 vertices of G and only its outgoing edges can rule out the possibility that G is strongly connected; hence, every such property testing algorithm for strong connectivity that has one-sided error would have to accept G. Corollary 4. Every property testing algorithm for strong connectivity of di- rected graphs in the adjacency list model with only outgoing edges being visible for the algorithm has a query complexity of Ω(n). In the remainder of this section we will present a property testing algorithm for strong connectivity in directed graphs that has a two-sided error and a query complexity of O(n1−/(3+α)); α > 0 is an arbitrarily small constant. We assume that both the in- and the outdegree of every vertex of the input graph is bounded by a constant D ∈ N; hence, the undirected degree of a vertex can at most be 2D. The total number of edges is still at most Dn, such that a graph is -far from another graph, if more than Dn adjacency list entries of the first graph have to be modified to obtain the second one. In the following we can assume D ≥ 2, since for D = 1 strong connectivity can be easily tested as follows: If D = 1, every vertex has at most one incoming edge and one outgoing edge; every weakly connected component in such a graph is either an orientation of a circle or a line-shaped graph, and all the edges in each of these orientations have the same direction. The only strongly connected graph is a circle orientation with all n vertices where all edges have the same direction. Every -far graph consists of Ω(n) weakly connected components, which means that there are also Ω(n) weakly connected components that have  vertices each -- a vertex sample of size Θ(1/) contains one of them at most 1 with high probability. By the above considerations, starting from an arbitrary vertex of component, every single of these components can either be completely  queries (in case it is a circle) or a sink vertex can be found explored with 1 TestSinkFreeness(n, G, β) Sample s5 = 4 Foreach sampled vertex v do βD vertices of G u.i.d. at random Start a breadth first traversal at v which stops after exploring 2 If the breadth first traverdal completely explores a sink component βD vertices then return false return true Algorithm 5: TestSinkFreeness within 1 query complexity of Θ( 1  queries. Hence, for D = 1, strong connectivity can be tested with a 2 ) with one-sided error. Corollary 5. For D = 1, strong connectivity of a directed graph with both vertex in- and outdegree bounded by D ∈ N can be tested with O( 1 2 ) queries. For larger values of D, testing for strong connectivity turns out to be much harder; one main obstacle is that one cannot rely on identifying whitnesses against strong connectivity for -far graphs: Such whitnesses would either be sink or source components of the input graph, and while it is easy to identify a sink component if the input graph contains many of them, a source compo- nent can never be identified without knowing the whole remaining graph, since it cannot be ruled out that an explored area has incoming edges. On the other hand, Bender and Ron have shown that the total number of dead ends in an -far graph is large: Lemma 17 ([5]). Let G be a directed graph with n vertices and both its vertex in- and outdegree bounded by D ∈ N and let  < 1 be a proximity parameter. If G is -far from strongly connected, then G has more than 1 3 Dn dead ends. Input graphs that contain many small sink components can be handled in the same way as in the property testing algorithm of Bender and Ron for the model where incomong edges are visible: It suffices to sample O(1/) vertices, explore a small area of size O(1/) vertices around them using breadth first search and reject the input graph, if for one of the sample vertices there are no outgoing edges left during the breadth first search traversal. It can be shown that, if G has many sink components, then G also has many sink components of size O(1/), and hence the above approach will identify one of them with high probability. Lemma 18. Let G be a directed graph with n vertices both its vertex in- and outdegree bounded by D ∈ N and let β < 1 be a proximity parameter. If G does not have any sink components, TestSinkFreeness(n, G, β) always returns true; if G has at least βDn sink components, TestSinkFreeness(n, G, β) returns false with a probability of at least 1− e−2. The query complexity and the running time of the algorithm both are O(cid:16) 1 (cid:17) . β2D2 EstimateReachableVertices(n, G, D, ) for i ← D downto 1 do pi i return m = Dn i 1≤i≤D ni Sample each edge of G with a probability of pi = ain−1/i, If more than ti = 16Dain1−1/i edges are sampled then return n ci ← number of vertices for which exactly i incoming edges have been sampled ni ← ci (cid:1)nj(1 − pi)j−i (cid:0)j −(cid:80) 16 +(cid:80) i<j≤d Algorithm 6: EstimateReachableVertices Proof. If G does not have any sink components, the condition queried by the if statement in the second but last line of TestSinkFreeness can never turn out to be true; hence the algorithm alway accepts the input. 2 βDn of the sink components have Now assume that G contains at least βDn sink components. Since G has n vertices Knoten and each of them belongs to at most one sink component, at least 1 βD or less vertices. If a vertex v of such a sink component is sampled, then the breadth first search that starts at v completely explores the sink component. Hence the algorithm correctly returns false. The probability that none of the s5 sample vertices lie in one of the small sink components is at most (1 − 1 2 βD)s5 ≤ e−2. Running time and query complexity of the algorithm arise from the num- ber s5 of sample vertices taken mulitplied by the maximum number of vertices explored by the breadth first search. 2 As discussed above, source components that are not sink components at the same time are much harder to identify as sink components. Indeed, corollary 4 implies that they cannot be directly identified (for example by a breadth first search) in sublinear time. However, there may be graphs that are -far from strong connectivity and that have very few sink components, and a property testing algorithm for strong connectivity has to identify such graphs. Hence our algorithm will identify the presence of many source components indirectly: We will at first assume that the input graph G has many small source components and that each of them contains of exactly one vertex; we will show that in this case there is statistical evidence for G not being strongly connected. In the next step we will give a reduction that is locally constructible -- that is, given G, the reduced graph can be sampled from and explored with a constant number of queries in G for each query to the reduced graph -- and that converts a graph with many constant-size source components into a graph that has equally many source components with a size of one each. Hence we reduce the problem of testing a graph for strong connectivity to the problem of approximating the number of vertices that have no incoming edge. We solve the latter problem by computing collision statistics for i-way collisions of common target vertices of a set of sampled edges, for i = 1, . . . , D; combining these statistics allows us to measure the number of vertices that do not have an incoming edge and thus cannot appear in any of the collision statistics, affecting their outcomes significantly if there are sufficiently many such vertices. At this moment, we only state the following lemma, the proof will be given at the end of the section5: Lemma 19. Let G be a directed graph with n vertices both its vertex in- and outdegree bounded by D ∈ N and let  < 1 be a proximity parameter. Let m be the number of vertices of G that have at least one incoming edge. Then, EstimateReachableVertices(n, G, ) returns an estimate m for which m ≤ m ≤ m + 4. The algorithm needs at most O(cid:16) D8D+15 log D 3 holds with a probability of at least 3 queries to G. Dn 8 n1−1/D(cid:17) The basic proof strategy is to show by induction that, for appropriate choice of the ai, the estimators ni approximate the number of vertices with exactly i incoming edges with high probability (see algorithm 6). Then, by the Union Bound, m satisfies the constraints given in Lemma 19 with high probability. We will now introduce the reduction function C. For this purpose, we need the notion of a compact component; the reduction will create a graph in which every compact component in the original graph is contracted into a single vertex: (a) U1 U2 (b) U u2 u1 v Fig. 4: (a) Compact components U1, U2; (b) for 3+α component, since the highlighted path violates the third condition. D = 5, U is no compact Definition 10. Let G be a directed graph with n vertices both its vertex in- and outdegree bounded by D ∈ N and let  < 1 be a proximity parameter; let α > 0 be a fixed, but arbitrary constant. We call a set of vertices U ⊆ V compact component if the following three conditions hold: 1. U ≤ 3+α D ; 5 In [15], section 4, footnote 4, a similar approach for approximating a distribution with several i-way collision statistics as in EstimateReachableVertices is mentioned, but its correctness is not proved there. 2. The subgraph of G that is induced by U is strongly connected; 3. There are no vertices v ∈ V \U and u1, u2 ∈ U such that there are paths from u1 tp v and from v to u2, each having a length of at most 3+α D . The following Lemma shows that the compact component of every vertex of a graph is unique: Lemma 20. Let G = (V, E), D,  and α be defined as in definition 10. Then, every vertex of G belongs to at most one compact component. Proof. Let v ∈ V be an arbitrary vertex. Assume that v belongs to two distinct compact components U and W . Since U (cid:54)= W , there is at least one vertex that is in one of the components, but not in the other; let, without loss of generality, u ∈ U\W be such a vertex. Since U is a compact component, U is strongly D vertices. Hence, since v, u ∈ U, there are connected and contains at most 3+α paths from v to u and from u to v, each having a length of at most 3+α D . This is, however, a contradiction to the assumption that W is a compact component: Since v ∈ W and u /∈ W , the existence of the above paths violates the third condition for compact components. Hence there are not two distinct compact components v belongs to. There may be vertices of a graph that do not belong to any compact compo- nent by the above definition. In the following we will assume that such vertices form their own compact components. Together with the above Lemma this means that every vertex of a graph can be mapped to a unique compact component: Definition 11. Let G = (V, E), D,  and α be defined as in definition 10. Then, for a vertex v ∈ V , C(v) denotes the compact component that v belongs to, if there exists such a component, or C(v) = {v} if v does not belong to a compact component. Let additionally C(G) be the graph that results from contracting every com- pact component of G. Next we show that every vertex of a compact component has the same com- pact component. Lemma 21. Let G = (V, E), D,  and α be defined as in definition 10. Then, C(u) = C(v) for all vertices v ∈ V and u ∈ C(v). Proof. We assume C(v) > 1, since otherwise the Lemma holds trivially because of C(v) = {v}. Furthermore we assume that there os a vertex u ∈ C(v) such that C(u) (cid:54)= C(v); i.e., there exists a vertex that is only contained in either in C(v) or in C(u). First assume that there exists w ∈ C(u)\C(v): Then, analogously to the proof of Lemma 20, there exist paths from u to w and from w to u of length D each, and, since v ∈ C(v) but w /∈ C(v), this violates the third at most 3+α condition for compact components for C(v) -- a contradiction to the assumption that C(v) is a compact component. Now assume that there exists w ∈ C(v)\C(u) gibt. Analogously to the first case this implies the existence of short paths from v to w and from w to v, contradicting with the third condition for compact components for C(u). By the above Lemma, the mapping C is well-defined. The fundamental prop- erty of this mapping is that it maps every small source component of a graph to a compact component; in C(G), each of these compact components gets contracted to a single vertex, such that C(G) contains many vertices with an indegree of 0 if G contains many small source components. Observation 2 Let G = (V, E), D,  and α be defined as in definition 10 and let U ⊆ V be a source component that contains at most 3+α D vertices. Then, U is a compact component. Proof. By the assumption of the Lemma, U ≤ 3+α D , and by definition of source components, U is strongly connected. Additionally, there is no edge from V \U to U, and thus there is not path from any vertex in V \U to a vertex in U. Hence the three conditions for compact components are satisfied for U. 6+2α O(cid:16) 1 D −1(cid:17) For the remainder of this section we assume that α > 0 is chosen fixed but arbitrary; we will assume an appropriate choice for α implicitly whenever we refer to C(G) for a graph G. Analogously,  is used implicitly there. It remains to show that a compact component of a given vertex can be determined in a constant number of queries and how sampling in a contracted graph C(G) can be realized. Determining the compact component of a given vertex v can be done with  · D queries as follows: Start a breadth first search at v that explores up to a maximal depth of 3+α D in order to find every vertex that can possible be in a compact component that includes v. Let U be the maximal set of vertices that have been explored in this way such that v ∈ U and the subgraph of G induced by U is strongly connected; if U > 3+α D , it holds C(v) = {v}, elsewise U is the candidate set for the compact component of v. We verify U by checking for vertices that violate the third condition for compact components: For this purpose we perform a breadth first search with a maximum depth of 6+2α D , having U as the set of starting vertices. The depth boundary on this breadth first search traversal makes for the above-mentioned query complexity. Sampling a vertex in C(G) is realized by at first sampling a vertex of G and then computing the connected component that the vertex belongs to. A vertex sample is accepted with a probability of 1/i, if i is the number of vertices in the corresponding component; in this case, the vertex of C(G) that represents the sampled vertex of G is returned. Otherwise, the sample is thrown away. This procedure ensures that all vertices have the same sample probability. For this procedure, several tries may be necessary until a vertex or an edge has been successfully sampled; however, the probability of a successful sample is 3+α, since this is the inverse of the maximum number of vertices that at least D can be represented by a vertex of C(G); hence, sampling k times yields k · D 3+α EstimateVertexNumber(n, G, ) x ← 0 Sample s7 = 3 Foreach sampled vertex v do x ← x + 1C(v) return n = n 2d2 vertices of G u.i.d. at random t x Algorithm 7: EstimateVertexNumber p · 3+α successful samples in expectation, and by Markov's Inequality, sampling k yields k successful samples with a probability of at least (1 − p). This leads to the following observation: Observation 3 Let G = (V, E), D,  and α be defined as in definition 10 and let p ∈ (0, 1). Sampling k vertices of C(G) uniformly and independently distributed and with an error probability of at most p can be done with O(cid:16) k D −2(cid:17) 6+2α 2 2p · D queries to G. For using the algorithm TestSinkFreeness on a contracted graph C(G), an estimate for the number of vertices of C(G) is needed. The algorithm Estimat- eVertexNumber returns such an estimate with high probabilty; in contrast to the approximation algorithm for the number of connected components of an undirected graph by Chazelle et al. ([7]), here the idea is to sample vertices of G and increase the estimate by the inverse of the size of the compact component of the sample vertex. Lemma 22. Let G be a directed graph with n vertices both its vertex in- and outdegree bounded by D ∈ N and let  < 1 be a proximity parameter; let n be te number of vertices of C(G). Then, for the value n that is returned by EstimateVertexNumber(n, G, ) it holds with a probabilty of at least 1 − 2e−3. The algorithm has a query complexity of n − Dn ≤ n ≤ n + Dn O(cid:0) 1 3D3 · D(6+α)/(D)(cid:1). X =(cid:80) 1≤j≤s7 Proof. Let, for i = 1, . . . , 3+α D , ki be the number of compact components of G that consist of exactly i vertices. Let Xj be a random variable for the con- C(vj ). Let tribution of the j-the sampe vertex to x, j = 1, . . . , s7, i.e., Xj = 1 (cid:88) Xj. For every j it holds · Pr[C(vj) = i] = 1 i (cid:88) 1≤i≤ 3+α D E[Xj] = 1≤i≤ 3+α D · ki · i n 1 i = 1 n · (cid:88) 1≤i≤ 3+α D ki = n n , since the sum in the first but last step is the number of compact components of G and hence the number of vertices of C(G). Moreover, E[n] = · E[X] = n s7 n s7 E[Xj] = n s7 n n = n, · (cid:88) 1≤j≤s7 · (cid:88) 1≤j≤s7 TestStrongConnectivity(n, G, ) if D ≥ 3 + α then return true if not TestSinkFreeness(n, G, n ←EstimateVertexNumber(C(G), m ←EstimateReachableVertices(n, C(G), 3+α if m < n − else return true 12(3+α) Dn then return false 24(3+α) ) α α  α 6(3+α) ) then return false , α2D 6(3+α)2 ) Algorithm 8: TestStrongConnectivity and since all Xj are between 0 and 1, applying the Hoeffding Inequality yields Pr[n−E[n] > dn] = Pr[X−E[X] > ds7] ≤ 2 exp − By the above considerations, determining the compact component of a vertex of G takes at most O(cid:0) 1 2d2 vertices in the algorithm, the overall query complexity is O(cid:0) 1 D · D(6+α)/(D)(cid:1) queries to G; since this is done for s7 = 3D3 · D(6+α)/(D)(cid:1). 3 (cid:32) (cid:80) (cid:33) 2d2s2 7 (1 − 0)2 1≤i≤s7 = 2e−3. Now we can state our property testing algorithm TestStrongConnectiv- ity; it at first calls TestSinkFreeness in order to test whether there are many sink components; if this is not thr case, the algorithm estimates the number of vertices of C(G) by calling EstimateVertexNumber and uses this value to measure the number of vertices that have at least one incoming edge by call- ing EstimateReachableVertices. If the estimate returned by the latter call is much smaller than the estimated number of vertices of C(G), then Test- StrongConnectivity rejects; elsewise it accepts. Theorem 4 Let G be a directed graph with n vertices both its vertex in- and outdegree bounded by D ∈ N and let  < 1 be a proximity parameter. Then, TestStrongConnectivity(n, G, ) returns false with a probability of at least 3, if G is -far from strongly connected; it returns true with a probability of 2 at least 2 3, if G is strongly connected. The query complexity of the algorithm is O(cid:16) α−4(cid:0) 4  (cid:1)32/+23 D144/(α2)n1−/(3+α) log 1 . (cid:17)  Proof. Let n be the number of vertices of C(G) and let m be the number of those vertices that have at least one incoming edge. Let D be the maximum in- or outdegree of a vertex in C(G): Because of the maximum size of a compact component it holds D ≤ 3+α At first assume that G is -far from strongly connected. We will show that then the probability that TestStrongConnectivity inadvertantly returns true is bounded by a constant. Initially note that this cannot happen in the first line of the algorithm: For  ≥ 3 + α there is no graph that is -far from strongly connectes, since in this case it would be possible to remove all edges of .  3 true. In the second case at least the graph and insert a circle over all vertices instead, not surpassing Dn edge modifications; hence, for an -far graph the condition of the if-statement in line 1 will never hold true. Since G is -far from strongly connected, G contains more than 1 3 Dn dead 6(3+α) Dn sink components or ends by Lemma 17. Hence it contains at least at least 1 6(3+α) Dn source components. In the first case Lemma 18 guarantees that TesteSenkenFeiheit returns true with a proba- bility of at most e−2 < 1 6(3+α) Dn = 6+α 3 Dn − α α 6(3+α) Dn of the source components have a size of D , since they are vertex-disjoint and together contain at most n ver- 6(3+α) Dn, at most 3+α tices. Thus the number of vertices without incoming edges is at least too; i.e., it holds m ≤ n − α α α 6(3+α) Dn. We can use this bound on the number of non-reachable vertices of C(G) to gain an upper bound for m that holds with high probability: Lemma 19 6(3+α)2 · Dn holds with a probability of at least 3 guarantees that m ≤ m + 1 4; moreover, by Lemma 22 we have n ≥ n − 24(3+α) Dn with a probability of at least 1− 2e−3. These two facts combined with the bound of D ≤ D · 3+α D = 3+α for the in- and outdegree of a vertex of C(G) yield 8 · α2D α  m ≤ m + ≤ n + 1 8 1 4 · α2D 6(3 + α)2 · Dn ≤ n − · α 6(3 + α) Dn − 7 8 · 6(3 + α) α 6(3 + α) α Dn + 1 8 Dn < n − · α 6(3 + α) Dn α 12(3 + α) Dn. Hence, by the Union Bound, TestStrongConnectivity(n, G, D, ) returns false with a probability of at least 1 − 3 4 − 2e−3 > 2 3 in this case. Finally we consider the case that G is strongly connected, i.e., there are no dead ends in G. By Lemma 18, the call to TesteSenkenFreiheit will hence return true true. Particularly, there are no source components in G, and thus there are no vertices without incoming edges in C(G) -- every such vertex in C(G) would correspond to a source component in G. Hence it holds m = n. Moreover, Lemma 19 guarantees that m ≥ m holds with a probability of at least 4 and by Lemma 22 we have n ≤ n + 24(3+α) Dn with a probability of at least 1 − 2e−3. Altogether we can conclude α 3 m ≥ m = n ≥ n − α 24(3 + α) Dn > n − α 12(3 + α) Dn, and hence by the Union Bound TestStrongConnectivity(n, G, D, ) returns 3. true in this case with a probability of at least 2 The query complexity of the algorihtm is dominated by the query complex- , α2D 6(3+α)2 ): Since the ity of the call EstimateReachableVertices(n, C(G), 3+α  degree bound of C(G) is 3+α  von C(G), for α < 1 this call queries C(G) (cid:19)8(3+α)/+15 n1−/(3+α) log 1  (cid:33) = O(cid:16) (cid:19) O  α−3 = O 6(3 + α)2 (cid:32)(cid:18) α2D (cid:19)−3(cid:18) 3 + α (cid:32) (cid:18) 4 (cid:19)32/+21 (cid:18) 6(3 + α)2 (cid:32) (cid:19)32/+23 α2D2 (cid:18) 4  O α−4  times. Because each of these queries induces · D6(6+α)(3+α)2/(α2D2) O queries to G, the overall query complexity is D144/(α2)n1−/(3+α) log (cid:33) n1−/(3+α) log 3 + α  −2α−1D144/(α2)(cid:17) (cid:33) 1  . 1 It remains to show 19, i.e., that the estimate m returned by algorithm Es- timateReachableVertices satisfies m ≤ m ≤ m + 1 8 Dn with a probability of at least 3 4, if m is the number of reachable vertices in the input graph C(G), and that this algorithm has a query complexity of O(−3D8D+15n1−1/D log D). Proof (Beweis (Lemma 19).). We will show by induction that the basic estima- tors ni are a good approximation for the number ni of vertices that have exactly i incoming edges; we then conclude that m is a good estimate for m. At first note that, by Markov's Inequality, the probability that the algorithm aborts in the third line (and possibly returns the wrong value) is at most 16D ; the probability that this happens in at least one of the D iterations of the for-loop is at most 1 16 by the union bound hence. If the input graph G is a contracted graph, we can set the error probability in Observation 3 to 1 16D ; the probability that in at least one iteration of the for-loop the required number of samples is not attained is at most 1 16 then because of the union bound. For the remainder of this proof we will assume that neither of these events occurs. Now let ai := aD/i für i = 1, . . . , D; we will determine the exact value of the constant a later. For all these values for i let Vi be the set of vertices of G that have exactly i incoming edges; we have ni = Vi hence. We define the random variable Yi,j as the number of i-way collisions on vertices in Vj in the iteration of the for-loop that has the loop counter i; an i-way collision is the event that for a vertex v exactly i of its incoming edges are contained in the edge sample taken in the second line of the algorithm. Moreover let Xv,i be an indicator random variable for the event that in the iteration that has the loop counter i the vertex v has an i-way collision. For every vertex v ∈ Vj it holds E[Xv,i] = Pr[Xv,i = 1] = = (ain−1/i)i(1 − pi)j−i = i(1 − pi)j−i pi (cid:18)j (cid:19) aD(1 − pi)j−i, 1 n i (cid:18)j (cid:19) i (cid:18)j (cid:19) i since the events for the incoming edges of v being in the sample set are indepen- dent from each other. Thus the number of incoming edges of v that are contained in the sample set is binomially distributed. Hence we can conclude (cid:88) v∈Vj (cid:18)j (cid:19) i E[Yi,j] = E[Xv,i] = nj n aD(1 − pi)j−i. aD We can now bound the probability that Yi,j deviates from its expectation by too much. The maximum deviation that we want to allow is δi := 2i+4D2i−1 . Since a Chernoff Bound can only be effectively used if the expected value is relatively large, we distinguish two cases and use a Chernoff Bound, if nj is relatively large, and Markov's Inequality, if nj is small. At first consider the latter case and assume nj ≤ n(1−p)j−i i)2i+7D2i+1 , that is, it (j holds E[Yi,j] ≤ aD(1−pi)2j−2i and hence in particular E[Yi,j] < δi. The latter fact implies that Yi,j can deviate from its expectation by more than δi only by exceeding it. Hence we can conclude Pr[Yi,j − E[Yi,j] > δi] = Pr[Yi,j − E[Yi,j] > δi] < Pr[Yi,j > δi] ≤ E[Yi,j] ≤ 1 2i+7D2i+1 δi 8D2 , applying Markov's Inequality. Now consider the first of the two cases, i.e., nj > n(1−p)j−i . Since nj ≤ n, we additionally have E[Yi,j] ≤(cid:0)j i)2i+7D2i+1 ; this means that (j · δi. Since the events Xv,i = 1 are independent for E[Yi,j] > aD(1−pi)2j−2i pi)j−i ≤ 2i+4D2i−1(j all vertices v, we can conclude i)(1−p)j−i 2i+7D2i+1  i (cid:1)aD(1 − (cid:35) E[Yi,j] (cid:33) Pr[Yi,j − E[Yi,j] > δi] ≤ Pr Yi,j − E[Yi,j] > (cid:34) ≤ 2 exp (cid:1)(1 − p)j−i (1 − p)2j−2i E[Yi,j]  2i+4D2i−1(cid:0)j 3 · 22i+8D4i−2(cid:0)j (cid:1)2 (cid:33) 3 · 23i+15D6i−1(cid:0)j (cid:1)2 3aD 2 i i (cid:32) (cid:32) − − < 2 exp by a multiplicatice Chernoff Bound; hence, for sufficiently large a = O(cid:16) D8+13/D i (cid:17) log1/D D 3/D this probability does not exceed 1 8D2 . Basically we are only interested in i-way collisions that occur on vertices of Vi, since this is the set whose size we want to estimate in the iteration of the for-loop that has the loop counter i. However, for vertices with a degree if j > i, i-way collisions can also happen, which can distort the estimate for ni. Hence we have to estimate the number of i-way collisions Yi,j on vertices in Vj, j > i, that will happen in the iteration of the for-loop that has a loop counter of i. We can then subtract these estimates from the number of collisions measured in this iteration and in this way gain an estimator for ni. For estimating the Yi,j we can simply use the estimators nj from the previous iterations of the for-loop. In what follows we will assume that Yi,j − E[Yi,j] ≤ δi holds for i = 1, . . . D and j ≥ i; by the Union Bound, the probability for this to happen is at least 8, since the probability that a single Yi,j deviates from its expectation by more 7 8D2 ist. We will now show by induction over than δi is, as shown above, at most i that, under these assumptions, ni deviates from ni by at most 1 n 2i+3D2i−2 . For the base case we chose the iteration of the for-loop that has i = D as the loop counter. It holds (cid:18)D (cid:19) D E[nD] = E[cD] pD D = n aD D E[YD,D] = n aD · nD n aD(1 − pD)D−D = nD. i n n n Moreover we have assumed that YD,D deviates from its expectation by at most δD = 2D+3D2D−2 from its expectation E[nD] = nD. 2D+4D2D−1 . Hence nD deviates by at most δDn 2D+4D2D−1 < aD = aD Now let i < D be an arbitrary value of the loop counter. As induction 2j+3D2j−2 . hypothesis assume that, for all j > i, nj deviates from nj by at most Since E[Yi,j] = nj n (cid:1)aD(1 − pi)j−i holds for all j > i, we can conclude (cid:0)j  ci (cid:18)j (cid:19) − (cid:88) (cid:19) (cid:18)j − (cid:88) E[ci] − (cid:88) − (cid:88) − (cid:88) i<j≤d n aD E[Yi,j] E[nj](1 − pi)j−i nj(1 − pi)j−i =  = nj(1 − pi)j−i  = (cid:18)j E[ni] =E = = E[Yi,j] E[Yi,i] i<j≤d i<j≤d i<j≤d (cid:19) = ni. E[ci] pi i E[ci] pi i E[ci] pi i pi i i i i i<j≤d pi i 1 pi i It remains to bound the maximum deviation of ni from its expected value. There are two types of deviation that can occur: The first one is that, for j > i, nj may deviate from E[nj]; due to the induction hypothesis, this deviation is at most ni, the contribution of nj to the overall deviation is at most 2j+3D2j−2 , and since nj gets multiplied by(cid:0)j (cid:18)j (cid:1)(1 − pi)j−i when computing (cid:19) n n n i · 2j+3D2j−2 ≤ Dj−i · i 2j+3D2j−2 = n 2j+3Dj+i−2 ≤ n 2i+4D2i−1 . αj := The second type of error results from the deviation of at most δi that, for j ≥ i, may occur between Yi,j and E[Yi,j]; due to this deviation, ci may deviate from E[ci]. The contribution to the overall deviation is at most βj := δi pi i = n aD · aD 2i+4D2i−1 = n 2i+4D2i−1 . Adding the contributions of both types of deviation, we can bound the overall deviation by αj+βj ≤ 2Dn 2i+4D2i−1 = n 2i+3D2i−2 , ni−ni = ni−E[ni] ≤ (cid:88) (cid:88) (cid:88) αj+ βj < i<j≤D i≤j≤D i≤j≤D which completes the induction step. Altogether we therefor have (cid:88) ni − ni ≤ (cid:88) 1≤i≤D 1≤i≤D 2i+3D2i−2 ≤ (cid:88) n and hence m deviates from m+  on the tightness of the Yi,j hold, i.e., 16 Dn by at most  n 24 =  16 Dn, 1≤i≤D 16 Dn, if the above assumptions m ≤ m ≤ m +  8 Dn. Union Bound this leads to a success probability of at least 1−(cid:0) 1 The success probability of the algorithm results from the probabilities for successfully sampling and for all Yi,j being tight to their expected values; by the 4. The query complexity of the algorithm results from the number of edges that are sampled; since these are at most O(Dain1−1/i) = O(−3D8D+14n1−1/i log D) in the iteration of the for-loop that has the loop counter i, the overall number of samples is at most O(−3D8D+15n1−1/D log D). (cid:1) = 3 16 + 1 16 + 1 8 At the end of the section we give a brief overview over the proof sketch for a property testing algorithm for strong connectivity that Oded Goldreich published earlier and independently from our result ([9], Appendix of the survey article Introduction to Testing Graph Properties). Goldreich at first notes that √ n) on the graph classes that Bender and Ron use for their lower bound of Ω( testing strong connectivity [5] also yield a lower bound of Ω(n) for testing strong connectivity with a one-sided error; our proof at the beginning of this section also makes use of this observation, considering only the class of -far graphs Bender and Ron give. For testing strong connectivity, Goldreich's approach is the same as ours, except for his choice of a reduction function: In particular, he also proposes to at first solve the problem for graphs in which all source components have size 1 by computing i-way collision statistics for the target vertices of sets of sampled edges for i = 1, . . . , D. considers directed circles with a length of at most s =(cid:6) 4 Goldreich's reduction function then has a similar effect than ours: Goldreich (cid:7), and, for each vertex v, the set Cv of all those vertices that lie on such a circle together with v. If Cu = Cv for all vertices u ∈ Cv, then Cv is contracted. This approach guarantees that all sufficiently small source components are contracted to a single vertex in the resulting graph, and the reduction function can be computed locally. For Goldreich's reduction, the maximal number of vertices in a contracted component is at most s2 and hence the maximum indegree of a vertex in the D resulting graph is t = s2·D ≈ 16 of O(n1−1/t) ≈ O(1 − 2D leaving open any technical details. 2D . This leads to a slightly worse query complexity 16 ). Goldreich only gives a brief sketch of his result, References 1. N. Alon. Testing subgraphs in large graphs. Random Struct. Algorithms 21, 3-4, pp. 359-370, 2002. 2. N. Alon, E. Fischer, I. Newman, and A. Shapira. A combinatorial characterization of the testable graph properties: it's all about regularity. SIAM Journal on Computing, 39(1): 143-167, 2009. 3. N. Alon, A. Shapira. Testing subgraphs in directed graphs. In: Proc. of the 35th ACM Symp. on the Theory of Computing (STOC), pp. 700-709, 2003. 4. Z. Bar-Yossef, R. Kumar, D. Sivakumar. Sampling algorithms: Lower bounds and applications. In: Proc. of the 33rd ACM Symp. on the Theory of Computing (STOC), pp. 266-275, 2001. 5. M.A. Bender, D. Ron. Testing properties of directed graphs: acyclicity and connec- tivity. Random Structures & Algorithms, Volume 20 No. 2, 2002. 6. I. Benjamini, O. Schramm, A. Shapira. Every minor-closed property of sparse graphs is testable. In: Proc. of the 40th ACM Symp. on the Theory of Computing (STOC), pp. 393-402, 2008. 7. B. Chazelle, R. Rubinfeld, L. Trevisan. Approximating the Minimum Spanning Tree Weight in Sublinear Time SIAM Journal on Computing, 34(6): 1370-1379, 2005 8. A. Czumaj, A. Shapira, and C. Sohler. Testing hereditary properties of non- expanding bounded-degree graphs. SIAM Journal on Computing, 38(6): 2499-2510, 2009. 9. O. Goldreich. Property Testing: Current Research and Surveys. Springer 2010. 10. O. Goldreich, S. Goldwasser, D. Ron. Property Testing and its Connection to Learning and Approximation. J. of the ACM, 45(4): 653-750, 1998. 11. O. Goldreich, D. Ron. Property Testing in Bounded Degree Graphs. In: Proc. of the 29th ACM Symp. on the Theory of Computing (STOC), pp. 406-415, 1997. 12. A. Hassidim, J.A. Kelner, H.N. Nguyen, and K. Onak. Local graph partitions for approximation and testing. In: Proc. of the 50th IEEE Symp. on Foundations of Computer Science (FOCS), pp. 22-31, 2009. 13. F. Hellweg, C. Sohler. Property Testing in Sparse Directed Graphs: Strong Connec- tivity and Subgraph Freeness. In: Proc. of the 20th European Symp. on Algorithms (ESA), pp. 599-610, 2012. 14. I. Newman, C. Sohler. Every property of hyperfinite graphs is testable. In: Proc. of the 43rd ACM Symp. on the Theory of Computing (STOC) pp. 675-684, 2011. 15. S. Raskhodnikova, D. Ron, A. Shpilka, A. Smith. Strong Lower Bounds for Approx- imating the Distribution Support Size and the Distinct Elements Problem. SIAM Journal on Computing 39(3), pp. 813-842, 2009. 16. R. Rubinfeld, M. Sudan. Robust Characterizations of Polynomials with Applica- tions to Program Testing. SIAM Journal on Computing, 25(2): 252-271, 1996. 17. Y. Yoshida, H. Ito. Testing k-edge-connectivity of digraphs. Journal of System Science and Complexity, 23(1) pp. 91-101, 2010.
1007.1726
5
1007
2016-07-26T17:26:40
Vsep-New Heuristic and Exact Algorithms for Graph Automorphism Group Computation
[ "cs.DS", "cs.DM", "math.CO" ]
One exact and two heuristic algorithms for determining the generators, orbits and order of the graph automorphism group are presented. A basic tool of these algorithms is the well-known individualization and refinement procedure. A search tree is used in the algorithms - each node of the tree is a partition. All nonequivalent discreet partitions derivative of the selected vertices are stored in a coded form. A new strategy is used in the exact algorithm: if during its execution some of the searched or intermediate variables obtain a wrong value then the algorithm continues from a new start point losing some of the results determined so far. The algorithms has been tested on one of the known benchmark graphs and shows lower running times for some graph families. The heuristic versions of the algorithms are based on determining some number of discreet partitions derivative of each vertex in the selected cell of the initial partition and comparing them for an automorphism - their search trees are reduced. The heuristic algorithms are almost exact and are many times faster than the exact one. The experimental tests exhibit that the worst-cases running time of the exact algorithm is exponential but it is polynomial for the heuristic algorithms. Several cell selectors are used. Some of them are new. We also use a chooser of cell selector for choosing the optimal cell selector for the manipulated graph. The proposed heuristic algorithms use two main heuristic procedures that generate two different forests of search trees.
cs.DS
cs
Vsep-New Heuristic and Exact Algorithms for Computing Graph Automorphism Group and Graph Isomorphism Stoicho D. Stoichev Department of Computer Systems, Technical University of Sofia email: [email protected] Abstract. Five new algorithms, named Vsep, are described. Four of them are for determining the generators, orbits and order of an undirected graph automorphism group. Vsep-e – exact, Vsep-orb and Vsep-sch – heuristic and Vsep-a automatically selects the optimal version among Vsep-e, Vsep-orb and Vsep-sch. The fifth algorithm, Vsep-is, is for finding an isomorphism between two graphs. Vsep-orb firstly finds heuristically the generators and orbits and then uses the exact one on the orbital partition for determining the order of the group. Vsep-sch differs from Vsep-orb in using the Schreier-Sims algorithm for determining the order of the group. A basic tool of these algorithms is the adjacency refinement procedure that gives finer output partition on a given input partition of graph vertices. The refinement procedure is a simple iterative algorithm based on the criterion of relative degree of a vertex toward a basic cell in the partition. A search tree is used in the algorithms - each node of the tree is a partition. All nonequivalent discreet partitions derivative of the selected vertices called a bouquet are stored in a coded form in a hash table in order to reduce the necessary storage – this is a main difference of Vsep-e with the known graph automorphism group algorithms. A new strategy is used in the exact algorithm: if during its execution some of the searched or intermediate variables obtain a wrong value then the algorithm continues from a new start point losing some of the results determined so far. The new start point is such that the correct results can be obtained. The proposed algorithms has been tested on the nauy&Traces benchmark graphs and compared with Traces, and the results show that for some graph families Vsep-e outperforms Traces and for some of the others Traces outperforms Vsep-e. The heuristic versions of Vsep are based on determining some number of discreet partitions derivative of each vertex in the selected cell of the initial partition and comparing them for an automorphism, i.e. their search trees are reduced. The heuristic algorithms are almost exact and are many times faster than the exact one. The heuristic algorithms are good choice for the user because of their smaller running times. Several cell selectors are used in Vsep, some of them are known and some are new. We also use a chooser of cell selector for choosing the optimal cell selector for the manipulated graph. The experiments show that the running time of Vsep algorithms does not depend on the vertex labeling. Key words: graph, isomorphism, automorphism, group, stabilizer, exact algorithm, heuristic algorithm, partition, numeration, generators, orbits and order of the graph automorphism group. - 1 - 1. Introduction We assume some familiarity with the basics in the design and analysis of algorithms[1– 3], combinatorial algorithms[4,5], graph theory and group theory [6–10]. We consider simple finite undirected graphs (without loops and multiple edges). The graph is denoted by G(V,E), where : V={1,2,3, . . . ,n} is the set of vertices and E - the set of edges (v, w), v, w  V. The number E of the edges of G we denote by k, k=O(n2). Our algorithms are applicable to any undirected graph including disconnected graphs but for them there is more efficient algorithm we do not describe here. The set of all vertices adjacent to a vertex x is denoted by Adj(x). We use a static list representation of a graph (by two static arrays) because of its least required storage and fastest operation of finding all adjacent vertices of a given vertex compared with the adjacency matrix and the dynamic list representation. An isomorphism [4–12] between two graphs G1(V1, E1) and G2(V2,E2) is called one-to-one correspondence (mapping) yi = f(xi) between the vertices of the graphs (xiV1, yiV2, i=1,2,...,n, n=V1=V2) such that two adjacent (nonadjacent) vertices from one of the graphs correspond to two adjacent (nonadjacent) vertices from the another graph, i. e. every edge (non-edge) (p, q ) from graph G1 corresponds to an edge (non-edge) (f(p),f(q)) from graph G2 and vice versa. So, the isomorphism preserves the adjacency relation of vertices - this kind of bijection is commonly called "edge-preserving bijection". Two graphs G1 and G2 are called isomorphic (G1G2) if there is at least one isomorphism between them. Otherwise they are non-isomorphic, G1!G2. An automorphism [4–11,13] of a graph is an isomorphism of the graph onto itself. Or, an automorphism h of graph G(V,E) is called one-to-one correspondence yi=h(xi) between the vertices of the graph (xi,yiV, i=1,2,...,n) that preserves the adjacency of the vertices, i. e. there is unique corresponding edge (non-edge) (h(p),h(q))E to each edge (non-edge) (p,q)E. A fixed point x of an automorphism h is called a vertex x for which x = h(x). Trivial automorphism is an automorphism h0 if each its vertex is a fixed point, xi=h0(xi), i=1,2,...,n and a non–trivial automorphism is an automorphism for which there is at least one pair of vertices x,y such that y=h(x) x. Two vertices xi and yi in the a graph G(V,E) are called similar (or symmetric) [6,7], xiyi, when they are corresponding, yi=h(xi), in some automorphism h. Otherwise, if xi and yi are not similar we use the notation xi! yi. An automorphism h can be presented by two sequences Па and Пb of graph vertex labels: a1, a2,..., ai,... an=Па b1, b2,..., bi,... bn=Пb, where the corresponding vertices are ai and bi=h(ai), i=1,2,...,n. The automorphism h may be shortly written in the form Пb=h(Па). The automorphism can be presented by n! pairs of rows - each row being derived from the other by transposing the positions of the pairs of corresponding vertices. The corresponding pairs of vertices can be set on to any place of the rows, but it is possible the place to depend on the sorting criterion which does not depend on the vertex labeling. Each automorphism can be written uniquely only with the permutation Пb if we assume that Пa = 1, 2, 3, … n. Even a simpler notation - 2 - called cycle notation [10] is often used. In a cycle (x1,x2, . . . ,xi, xi+1, . . . ,xp) xi maps to xi+1, 1  i  p-1 and xp maps to x1. For example, h=(1,8)(2,6,3,7)(4,5) = 1 2 3 4 5 6 7 8 8 6 7 5 4 3 2 1 Any automorphism can be written as the product of disjoint cycles and the product is unique up to the order of the cycles [10]. The cycles of length 1 are omitted. The operation function composition (or superposition) [4–11,13] of two automorphisms . This is a consecutive execution of  and , i. e. and operation is usually called multiplication and is denoted by juxtaposition γ=.. The set of all automorphisms of a given graph G(V,E) form a graph automorphism group (under the operation function composition of automorphisms) denoted Aut(G), shortly A(G) or A ) [4–11,13]. The trivial automorphism is the identity of the group – we denote it by I. The number of the automorphisms in A(G), Aut(G), is called an order of the automorphism group. An order of an automorphism is the order of the cyclic group generated by this automorphism. If the automorphism is written in cycle form then its order is the least common multiple of the cycle lengths[10]. The subset gen(А)А, denoted gen(А) or <g1,g2,...,gd>, is called a generating set [4,5,9,10,12] of the automorphism group if every automorphism hA can be written as a finite product of elements . The generating sets are not unique. The subset of the graph vertices y similar to vertex x in any automorphism hAut(G), y=h(x), is called an orbit of x, denoted Orb(x,A): Orb(x,A)={h(x)hAut(G)} and Orb(x,A) is read as 'orbit of a vertex x under a group A'. By Orb(A) we denote the set of all orbits of the group A. A graph with only one orbit of Aut(G) is called transitive, and a graph is called rigid or asymmetric if each of its vertices is in a separate orbit, i.e. Aut(G)=1. A stabilizer А(х1,х2,...,хi) or point-wise stabilizer [5,10,13] is the subgroup of the automorphism group A that contains only the automorphisms with fixed points х1,х2,...,хi. There is a theorem called orbit-stabilizer theorem[5–8] for computing the order A of the automorphism group of graph G(V,E). We denote it O-S theorem. The theorem claims that A=A(х1)*Orb(х1,A)=A(х1)*d, where Orb(х1,A)={ х1, х2,..., хd} is the orbit of vertex x1 under the group A, and A(x1) is a stabilizer of a representative x1 of this orbit. In other words, the order of the graph automorphism group is equal to the product of the order of a stabilizer of one of its vertices and the length of the orbit of this vertex. Vsep algorithms and other known graph isomorphism and automorphism algorithms use the orbit-stabilizer theorem. The stabilizer Ai= А(х1,...,хi) is called an ancestor stabilizer to the stabilizer Aj= А(х1,...,хj) if j>i and Aj is called a successor (or descendant) stabilizer to Ai. Obviously, the orbits of the successor stabilizer are subsets of the orbits of the ancestor stabilizer and the order of the successor stabilizer is a divisor of the order of the ancestor stabilizer. Given a set SV a set-wise stabilizer [10,12], denoted Aut(G,S), is a subgroup of Aut(G) defined by:Aut(G,S)={Aut(G) x,(x)S}. The graph isomorphism (GI) problem consists in deciding whether two given graphs are isomorphic, i.e., whether there is an isomorphism between them. The graph isomorphism - 3 - ...........XY...........YZ.............XZ)(,1Agenggii problem belongs to the class of NP problems [4–9,11,12,14], and has been conjectured intractable, although probably not NP-complete. It is neither known that this problem has polynomial time complexity nor to belong to the class of NP–complete problems. Its unknown complexity status is a theoretical and practical challenge. Two problems are called polynomial-time equivalent if there is a polynomial time algorithm that transforms one of the problems to another [4,7,9,10]. The problems [3,9,10] that are polynomial-time equivalent to graph isomorphism are called graph isomorphism complete. The following problems are graph isomorphism complete [15,16]: given two graphs G1 and G2: existence of isomorphism of the graphs; determine the isomorphism of the graphs if it exists; determine the numbers of the isomorphisms from G1 to G2; given a graph G: determine the generating set gen(Aut(G)), determine the orbits Orb(Aut(G)), determine the order Orb(Aut(G)). The problems of determining the orbits and order of the graph automorphism group A are also called automorphism partitioning and automorphisms counting, respectively. The generators, orbits and order of a graph G automorphism group A we denote by GOO(A) or GOO(Aut(G)) and by GO(A) - the generators and orbits of the group. A class of graphs is called graph isomorphism complete if the recognition of isomorphism for graphs from this class is a graph isomorphism complete problem. The following classes are graph isomorphism complete [16]: connected graphs, graphs of diameter 2 and radius 1, directed acyclic graphs, regular graphs, bipartite graphs without non-trivial strongly regular subgraphs, bipartite Eulerian graphs, bipartite regular graphs, line graphs, chordal graphs, regular self-complementary graphs, etc. However, there are special cases of the graph isomorphism problem with polynomial-time complexity: planar graphs (linear time), trees have a particularly simple algorithm, graphs of bounded degree, interval graphs, permutation graphs and convex graphs. At present it is not known a polynomial time algorithm for solving the graph isomorphism complete problems in the worst-case [14,17] – all known algorithms have exponential or moderately exponential worst-case time complexity. Graph isomorphism problems are of great practical and theoretical interest [3–5,12,14,17]. Recently, Laszlo Babai has claimed that the Graph Isomorphism problem can be solved in quasipolynomial time [18]. There are several practical algorithms (their names are shown below in parentheses ) for graph isomorphism and graph automorphism group, due to Brendan McKay (nauty), Adolfo Piperno (Traces), William Kocay (Groups&Graphs), Schmidt and Druffel, Jeffrey Ullman; L.P. Cordella, P. Foggia C. Sansone and M.Vento (VF2), Tommi Junttila and Petteri Kaski (bliss), Hadi Katebi, Karem A. Sakallah, and Igor L. Markov (saucy), Jose Luis Lopez-Presa, Luis Nunez Chiroque, and Antonio Fernandez Anta (conauto), G. Tener and N. Deo (nishe), Nechepurenko [4], etc. There is a comparison in [13,19] on running times of the following tools: nauty, Taces, bliss, conauto and saucy. Their running time on random graphs is quite well but a major problem of these algorithms is their exponential time performance in the worst- case. There are two main generalizations of the graph isomorphism: subgraph problem (given two graphs determine if one of them is a subgraph to another) and largest common subgraph problem (given two graphs determine the common subgraph to both that has the maximum number of vertices or edges). These two problems are NP-complete and have many applications and the algorithms for them use the graph isomorphism and automorphism algorithms as basic - 4 - tools. Another important problem related to graph isomorphism is [5,12]: Compute a complete invariant (certificate, signature) f for G, i.e. for all graphs G and H, G  H  f(G) = f(H) (graph certificate identifies a graph uniquely up to isomorphism). The graph isomorphism related problems (graph isomorphism itself, GOO(Aut(G))), subgraph isomorphism, largest common subgraph, graph certificate and canonization of a graph) arise in such fields as mathematics, chemistry, information retrieval, linguistics, logistics, switching theory, bioinformatics, and network theory [4,20]. Our goal is to develop exact and heuristic algorithms for determining GOO(Aut(G)), i.e. to solve the three problems by one algorithm with time complexity as lower as possible. In addition, our requirements to the heuristic algorithms are to give results equal to the results of the exact algorithm with the probability close to 1. There are a few heuristic algorithms for the graph isomorphism problem [21–24] – there is no access to their program codes. We propose three new heuristic algorithms (Vsep-orb, Vsep-hway, Vsep-sch) for GOO(Aut(G)) with much lower polynomial time complexity than the exact one. The experiments show that they are many times faster than the exact algorithm - even for difficult graphs with large sizes they give correct results. One of the first step in the exact algorithm is a call to a heuristic procedure for determining a representative of one of the smallest orbits of Aut(G) as a starting selected vertex – this way we speed up the exact algorithm and reduce the required storage. 2. Partitions and a refinement procedure An ordered partition (or simply partition) П or П(G) П = C1C2…Ci…Cp = C1C2...Ci...Cp of the vertices of graph G(V, E) [5,12,15] is a sequence of disjoint non-empty subsets of V whose union is V. П = x1,1, x1,2, …, x1,k1 … xi,1, xi,2, …, xi,ki … xp,1, xp,2, …, xp,kp is a detailed presentation of П, where Ci= xi,1, xi,2, …, xi,ki , xi,j ϵ V, i=.1,…,p, j=1,…,ki. The subsets C1, C2,… , Cp, are called cells (classes, blocks). We denote the number of the cells in a partition П by П. Two cells are called adjacent if there is at least one edge between their vertices, i.e. cells Ci,Cj П are adjacent if there is at least one edge (x,y), x Ci, y Cj. A cell with cardinality one is called trivial (or singleton). The vertex of such a cell is said to be fixed by П or it is called a fixed point of П. A partition, of which each cell is trivial is called discrete or numeration having in mind that in fact it is a permutation that can be viewed as a graph vertices renumbering – vertex i corresponds to vertex x that is on the position i in the partition. By NC(x, П) we denote the index of the cell C of П that contains vertex x, x  C. The position (index) of a vertex x in the partition (or in the cell) we denote by pos(x). The relative degree ρ(x,Ci) of a vertex хСj toward a cell Сi is equal to the number of vertices of cell Сi adjacent to vertex x. We denote by ν(x, П) a cell-degree vector defined as ν(x, П)=( ρ(x,Ci), i=1,…,p), p=П – it is a vector whose components are the relative degrees of x to each cell in П. We call a partition П stable (or equitable) if the cell-degree vectors ν(x, П)= ν(y, П) for each two vertices x, y  Ci, where Ci is any cell in П. We say that the partition П2 is finer than П1, written П2 ≤ П1, if for every cell Ci  П2 there exists a cell Cj  П1 such that Сi  Cj. In order to get a finer partition П2=D1D2...Dq when given П1=С1С2...Ср , a refinement - 5 - procedure (RP, П2= RP(П1)) is used, that assign to each vertex х V a sorting criterion according by which the vertices of each class СiП1 are sorted out in increasing or decreasing order of their criterions [4,5,12]. Often a sorting criterion is the relative degree ρ(x,W) of any vertex х П toward some cell WΠ.. The refinement procedure that uses this criterion is called adjacency refinement procedure. We use only this version of the procedure. Example of another criterion for sorting is the number of the subgraphs of a given type (for example a triangle) that contain vertex x. Two partitions Π1 and Π2 of the vertices of graph G(V,E) are called compatible [40] if: (1) Π1 = Π2 = m; (2) if Π1 = W1W2…Wm and Π2 = U1U2…Um, then for all i ϵ [1:m], Wi = Ui; (3) for all x,y ϵ V, NC(x,Π1) = NC(y,Π2) implies ν(x,Π1) = ν(y,Π2). Similar definition is valid if Π1 and Π2 are for different graphs. Two partitions П1=С1С2...Ср and П2=D1D2...Dq are called equivalent if there is an automorphism αAut(G) such that NC(x,П1) = NC(y,П2) for each pair of vertices x, y= α(x). In other words, the similar vertices are in cells with the same label of П1 and П2). Obviously for the equivalent partitions П1 and П2 we have: p = q and Ci = Di, i[1:p]. We denote the equivalent partitions by П2 = α(П1) or П2  П1. Evidently the equivalence relation is transitive. Two discrete partitions П1 = a1a2...ak...an, П2 = b1b2...bk...bn of graph G(V,E) vertices are called equivalent if they form an automorphism h Aut(G), bk = h(ak), k = 1,2, ... ,n. The testing if two discrete partitions П1 and П2 form an automorphism is a basic operation in our algorithms. Given sequence of equivalent discrete partitions П1, ... , Пm, we store one of them, for example П1 and the orbits derived by the automorphisms Пi = i(П1), i=2, ... ,m. A partition-wise stabilizer A(G, П) is defined by: A(G, П) = {Aut(G) x,(x) Ci, where Ci is any cell of П} [12]. This is a subgroup of Aut(G) such that each automorphism αAut(G) belongs to Aut(G, П) if to any vertex x of any cell of П corresponds a vertex y=α(x) from the same cell. The orbits of A(G, П) are subsets of the cells of П as we'll see below. If П= Пu then A(G, Пu) = Aut(G).Algorithms for determining the graph automorphisms and isomorphisms use very often the refinement procedure - each cell of its output partition contains at least one orbit of a graph automorphism group or its stabilizer. It is still not known a refinement algorithm that gives output partition each cell of which coincides with an orbit (orbit partition or automorphism partition) [20] on unit input partition. One of the most efficient RP is the RP with a base cell. The RP with a base cell sorts (counting sort [1,2]) the vertices of any cell Cj according to their relative degree rdg(x,i) toward a selected base cell Ci. The sorting continues until it reaches a partition П2 in which there is no cell that can be divided into subcells toward any base cell – such partition is called stable (equitable) [5,12] as we noted above: it holds the property П1=RP(П1). Vertices in every cell of the stable partition have the same sorting criterion - in our case, the same relative degree toward each cell. The base cell refinement algorithm has time complexity О(к.log n), where k and n are respectively the number of edges and the number of vertices of the graph [25,26]. The base cell RP refinement algorithm (Figure. 1) uses the counting sort that does not use a comparison operation – it sorts integers (the relative degree of the vertices) within the range 0 to some integer. In our algorithms for - 6 - GOO(Aut(G)) we use only the adjacency refinement procedure with a base cell (Figure. 1) [25] and a W queue that contains the labels of all not selected cells as base cell. It differs from the known refinement algorithms [5,12,20] in the way the base cell is selected. After the current base cell ends sorting the adjacent cells as a new base cell is selected the first new smallest subcell and if there is no such subcell the label of the new base cell is taken from a W queue - the first cell label in W queue. There is a property that speeds up RP procedure: the label of the new largest subcell of C cell (adjacent to B cell) is not included in W queue if C cell label is not in W. There is a version of RP refinement algorithm with base cell that always takes the new base cell from the queue. The individualization-refinement operation (denoted IR), used in the known GA algorithms, has two steps: individualization and refinement. Given an equitable partition π and a vertex x at the individualization step a new partition π1 is obtained: the cell C(x) of π with index i is divided into 2 subcells: {x}-the first subcell, with index i and the second subcell {C(x)\{x}} with index i+1, other cells of π are not changed. At the refinement step the partition π1 is refined with the refinement procedure RP obtaining a new equitable partition π2=RP(π1) finer than π1. Given a partition π and a vertex x we denote by IR(π,x,brcl) the resulting partition π2 from the application of IR operation on π and x, where brcl is the number of cells of π2. Input: graph G(V,E); П1 is the input partition on the graph vertices, W is a queue of some cells of П1,BRCL-the number of cells of П1 Output: a better stable partition П2 ( П2 П1), BRCL-the number of cells of П2 S1: П2:= П1; S2: Base cell В:= first cell in W; Delete the label B from W; S3: repeat{each the loop execution is performed for different base cell B} S4: Each cell С П2 adjacent to B is divided into subcells according to its relative vertex degrees toward В; S5: if there are new subcells from S4 then В:= the label of the subcell with minimum length. If there are more cells with minimum length then the one with the smallest label is chosen. Put into W the labels of the new subcells in П2, excluding the label of one of the largest subcell if it is not in W; Delete the label B from W; S6: if there are no new subcells from S4 then В:= first cell label in W; S7: until there are no new subcells from S4 and W becomes empty Figure. 1. RP refinement procedure with base cell B Cells in our algorithms are not consecutively labeled by 1, 2, … . The label NC(Cj,П) of a cell Cj in the partition П is determined by , i. e. the label of the cell Ci (respectively of each of its vertices ) is the first vertex index in the cell, or it is greater by 1 than the number of the vertices in all cells preceding Ci in the partition. NC(х,П) denotes the label of the cell that contains vertex x. This way of labeling is time saving because changing the labels of a given cell does not cause change of the labels of other cells. - 7 - 111)),(ijjiCПCNC Two cells of a partition are called non-trivially joined (have non-trivial join, non-uniformly joined) if the number of edges between them is greater than 0 and less than maximum possible. A channel of a cell C (new notion), denoted as Ch(C)), is the number of the edges adjacent to any vertex in C cell. A channel of two cells C1,C2, denoted as Ch(C1,C2)), is the number of all edges (x,y) between any vertex xC1 and any vertexC2. Example: Let П=1,84,52,3,6,7=C1 C2 C3 be a partition on the vertices of the graph on Fig. 2. The the cells are: Ch(C1,C1)=0, Ch(C1,C3)=4, Ch(C1)=4, Ch(C3,C3)=2, channels of Ch(C3,C2)=4, Ch(C3)=10, Ch(C2,C2)=1, ChC(C2)=5. Only the edges of cells with non- trivial join to C are included in Ch(C). For example, the cells D5 and D6 of the partition П=18546, 72, 3=D1 D2 D3 D4 D5 D6 of the vertices of the above graph have channels Ch(D5)=1, Ch(D6)=1 since the edges incident to vertices from D5 and D6 and connected to vertices from the trivial cells D1 D2 D3 D4 are not included – only the edge (6,7) is included in Ch(D5) and (2,3) in Ch(D6). A channel vector of a cell C П, ChVect(C), is a vector VC whose component VC(i) is equal to Ch(Ci,C) channel where Ci is a cell П with non-trivial join to C. A channel graph of a partition П, ChG (П), is an weighted graph with loops: each vertex of ChG corresponds uniquely to a cell of Π and its weight is the channel of the cell; each edge of ChG corresponds to a channel of the corresponding cells of Π and the weight of this edge is equal to the weight of this channel. Similar notion is a quotient graph in [27]. A selected non-trivial cell, SC(П), of a partition П is the cell Cj, Cj>1, that is selected by a defined criterion (often it is called target cell, for example in [12]). The procedure that finds the target cell is called cell selector. Fig. 2. GIRA graph The selection of the target cell has strong influence on the search tree size (see the next section) and consequently, on the running time of the GA algorithms. In Vsep algorithms, at given an equitable partition π we use the following 5 cell selectors (their numbering is denoted by izb): izb=1, MXNACS1: (a) it selects the nontrivial cell C of π with maximal number of adjacent non-trivially joined cells to C, and (b) if there are several such cells it selects the first one of the smallest size; izb=2, MXNACS2: it differs from (1) only in (b) selecting the first cell with largest size. izb=3, MXVECTCHVAL: it selects the first nontrivial cell C of π with the largest vector of relative degrees of C to other cells – the vector is considered as a number with leftist least significant digit. - 8 - izb=4, MXPRCHVAL: it selects the first nontrivial cell C of π with largest channel. izb=5, ICLMXBRCL: it selects the first non-trivial cell C with maximal number of cells of the derived partition π(x), x ϵ π, obtained after IR. To select the optimal cell selector we use a cell selector chooser (CSLCh) – it chooses the cell selector by three criteria: a) the smallest maximal level LMAX of the first path in the search tree., b) the smallest product of the sizes of all target cells of the first path in the search tree and c) the smallest product of the numbers of the cells of all partitions on the first path in the search tree. The partitions in the developed algorithms can be: 1. Unit partition (denoted by Пu=V=1, . . ., n) - all its vertices are in one cell С1 and the cell number is NC(i)=1, i=1, . . .,n. 2. Еquitable partition - it is obtained as a result of the execution of the refinement procedure (RP) on given input partition (see the definition given above); 3. Transformed partition ПТ is obtained from a stable partition П by separating from SC(П) given vertex x in a singleton cell. The difference between ПТ and П is that SC(П) with cell label i, is divided into two cells in ПТ: cell С'={x} with label i containing vertex x and cell С''= SC(П)\{x} with label i+1 containing the other vertices of SC(П). The transformation operation is denoted by TR: ПТ=TR(x, П) and is called an individualization in many references. The following theorem holds for the RP. Theorem 1 Given a graph G(V,E), two different equivalent partitions П1 and П2 on V and a non-trivial automorphism fAut(G). Then, NC(x,Па) = NC(y,Пb) for each pair x, y=f(x), where Пa=RP(П1), Пb=RP(П2). In other words, RP gives output partitions where the similar vertices remain in cells with the same label. This theorem is equivalent to the Theorem 7.1 in [5] – for equivalent partitions under an isomorphism of two graphs and the statement that the RP is invariant under an automorphism [28]. This is the reason for not giving here the proof of the theorem. Corollary 1 of Theorem 1 Let П be a partition on V of a graph G(V,E) with an automorphism fAut(G) and let for each pair of similar vertices x, y=f(x) the property NC(x,П) = NC(y,П) holds. Then, NC(x,Пс) = NC(y,Пс), where Пс=RP(П). Corollary 1 means that the similar vertices in any cell of a given input partition remain in one cell of the resulting partition of RP. Proof Let П=П1=П2 NC(x,Пс)=NC(y,Пс) is obtained by replacing Пс in NC(x,Па)=NC(y,Пb).  theorem 1. Then, we obtain Пс=Па=Пb=RP(П) and in Corollary 2 of Theorem 1 The refinement procedure RP is invariant under the vertex orbits of a subgroup HА=Aut(G(V,E)): if Orb(x,H)C(x,П) for each vertex хV of a given partition П, then Orb(x,H)C(x,Пc) for a partition Пc=RP(П). (In other words, if - 9 - each orbit of a given automorphism subgroup is a subset of a cell of the input partition П, then the same is true for the output partition Пc=RP(П). Obviously, this corollary holds for any stabilizer А(х1,х2,...,хi) of the automorphism group.) Proof The condition Orb(x,H)C(x,П) means that NC(x,П)=NC(y,П), y=f(x) for each f Н, i. e. the condition of Corollary 1 of Theorem 1 holds for each f Н and from it follows NC(x,Пс)=NC(y,Пс), y=f(x) for each f Н, i.e. Orb(x,H)C(x,Пс).  Corollary 3 of Theorem 1 Orb(x,A)C(x,П1) holds for each vertex xV of the initial partition П1=RP(Пu) of the graph G(V,E) where Пu is the unit partition. Proof Let H=A and П=Пu Orb(x,A)C(x,П1) follows from Corollary 2 where П1=Пс=RP(Пu).  for which obviously Orb(x,A)C(x, Пu). Then, 3. Auxiliary algorithms 3.1. A1 algorithm for determining one discrete partition The output of A1 algorithm (Figure 3) is a series of better partitions the last of which is discrete on given input partition П. Using A1 we introduce new notions and prove a property used for speeding up our algorithms. The following basic operations are performed in the A1 algorithm: {П1=RP(П), L=1}; { determine SC(ПL) by some cell selector; select any vertex ХL in the SC(ПL); L:=L+1; ПL:=IR(ПL-1, XL-1)}; L=2, . . . , LK, where ПLK is discrete and LK<n. Given any input partition П the initial partition П1=RP(П) is determined first. In most cases we'll consider that the starting input partition П is the unit partition, П= Пu. A selection level is called the successive number L of the refinement procedure RP calls for obtaining the partition ПL in A1 algorithm. ПL=П(х1,х2, ... , хL-1) denotes the partition that is obtained by making L-1 selections х1,х2, ... , хL-1 starting with the partition П1. The selected non-singleton cell in partition ПL is denoted by SC(ПL) or SC(х1,х2, ... , хL-1). Five operations (rows 4, 5) are executed in the loop C: determining SC(ПL), a selection of vertex xL in SC(ПL), a move to next level (a forward move, L+1), obtaining the T) (refinement with RP) – the last two transformed partition ПL operations are IR . Obviously, ПL is a stable partition. The determination of SC(ПL) is made by some cell selector. This execution continues until a discrete partition ПLK is obtained – its level of selection LK is called terminal or final. The process of obtaining the sequence П1, П2, . . . , ПLK is called series of forward moves (SFM). The selection of a vertex also is made by some criterion but here we consider (for definiteness) the selection of the first vertex in SC( ПL). The five instructions (lines 4, 5) we denote by CSVSIR (cell selection, vertex selection, individualization and refinement) – cell selection in ПL-1, vertex Xl-1 selection in SC(ПL-1), L=L+1, individualization of XL-1 (ПL:=IR(ПL-1,XL-1)) and refinement of ПL Each partition ПL, L=1, 2, ... , LK is called a partition-child of ПL-1 (partition-parent) and a successor of each of the partitions ПL-1, ПL-2, ... , П1, П0 (partitions-ancestors of ПL). T:=TR(xL-1,ПL-1), ПL:=RP(ПL T. - 10 -  The selected cells SC (L), L=1, 2, . . ., L-1 for a given partition ПL are called supporting SC for ПL, and the selected vertices х1,х2, ... , хL-1 of ПL are called base points or a base of ПL (or supporting points). A search tree (ST) is an oriented tree whose root represents the initial partition П1=RP(П). Each node of the search tree corresponds to an equitable partition ПL. Each arc coming out of a node ПL corresponds to a selected vertex from the SC(ПL). Thus, the partition ПL+1 of a particular node q on a level L+1 could be obtained from the partition ПL (node p on a level L) by selecting a vertex х  SC (ПL), x being depicted on the edge p-q in ST. Let r = SC(ПL), then each node ПL=П(х1,х2, ... ,хL-1) with SC (ПL) = {a1a2 ... ar} has r nodes- children of level L+1: П(х1,х2, ... ,хL-1,a1), П(х1,х2, ... ,хL-1,a2), ... , П(х1,х2, ... ,хL-1,ar). Thus, each vertex in each SC(ПL), for each level L is selected in ST. Only in П1 one vertex is selected – the first vertex in SC(П1). The just described search tree ST may be called a full search tree in contrast to the reduced Input: a graph G(V,E), a partition П of V Output: Series of better partitions П1<П2<…< ПL< ..< ПLK(discrete) 1: L:=1; ПL:=П; ПL:=RP(ПL); Output(ПL); 2: if ПL is discrete then message; return end if 3: repeat {loop C} 4: determine SC(ПL) by some cell selector; select a vertex ХL in the SC(ПL) 5: L:=L+1; ПL:=IR(ПL-1, XL-1,brcl); Output(ПL); 6: until brcl=n Figure 3. A1 algorithm search tree RST, in which some vertices from SC(ПL) are not selected according to a certain criterion. In the reduced search tree, for each orbit of а stabilizer AL-1=А(х1,х2, ... ,хL-1) only one representative of the orbit(AL-1)SC(ПL) is selected – this is the first orbits vertex met during the traversal of the SC(ПL). This way of a selection of vertices is used in Vsep algorithms. It is based on the theorems proved below. The reduced search tree used in Vsep algorithms is not explicitly presented in the algorithm – only the partitions of the path from the root to the current ПL are stored, i.e., the sequence П1, . . . , ПL. 3.2. A2 algorithm for generating the full search tree A2 algorithm (Figure 4) generates all partitions of the search tree on a given input partition П of graph G(V,E) and the selection of a vertex Х1  SC(L) of the initial partition П1 = RP(П). The leaf nodes of ST are discrete partitions. A new partition ПL (a new node of ST) is obtained after each execution of the instruction 10. In A2, each of the vertices in every SC(ПL) is successively selected and after that the algorithm continues with a forward move until a discrete partition is obtained. There are two loops - 11 - in A2: the loop C1 (lines 4-15) performs a forward move and the loop C2 (lines 9-13) performs the backward move. In the forward move, as in A1 algorithm, we begin from the partition ПL (on a level L) and selected vertex xSC(ПL), and we obtain successively the partitions ПL+1, ПL+2, ... , ПLK (discrete). The backward move (L:=L-1) is made when all vertices in the SC(L) are selected. We introduce a new notion – a level of the last backward move, denoted by LP and meaning the last value assigned to L by the instruction 10 (L:=L-1), i. e. LP is the level to which the last backward move is made. We call LP a working level and SC(ПLP) - a working cell since the main operations of the algorithms are with the vertices in SC(ПLP). Level LP is a significant variable for Vsep-e algorithm. A sequence of forward moves (SFM) starts from the level LP. A2 algorithm (as well as Vsep-e algorithm) generates the search tree in preorder [1,2]– first visiting the root (a vertex SC(ПL) then visiting the subtree of each vertex SC(ПL+1) from left to right. Input: a partition П of vertices of G(V,E) graph Output: all partitions –nodes of the full search tree 1: L:=1;ПL= П; ПL:=RP(П); Output ПL; 2: if ПL is discrete then message ' the graph is rigid'; return end if 3: determine SC(П1) by the cell selector; select a vertex X1  SC(ПL); 4: do { C1: loop of the forward move} 5: L:=L+1; ПL:=IR(ПL-1, XL-1,brcl); Output ПL; 6: if ПL is not discrete then 7: determine SC(ПL) by the cell selector; Х L:=first vertex in the SC(ПL) 8: else 9: repeat{ C2: loop of the backward move} 10: L:=L-1; 11: if L=1 then return end if; 12: Х L:=first unselected vertex in SC(ПL); 13: until Х L  0; 14: end if 15: end do Figure 4. A2 algorithm A bouquet В(хL) or В(х1,х2, ... , хL) of a selected vertex хLSC(ПL) is called the set of all mutually non-equivalent discrete partitions derived from the partition ПL and the selection of хL, i.e. obtained from П(х1,х2, ... , хL)=ПL+1. Only the first numeration obtained by Vsep-e algorithm is stored from the set of equivalent discrete partitions and is used as a representative in В(хL). The bouquet В(х1,х2, ... , хL) consists of the bouquets of the orbits representatives of vertices in the SC(ПL+1), i. e. it consists of the bouquets В(х1,х2, ... , хL, are orbits representatives of the stabilizer А(х1, х2, ... , хL) in SC(L+1). Given the ), . . . , В(х1,х2, ... , хL, ), В(х1,х2, ... , хL, ), where , . . . , , - 12 - 11La21LapLa111La21LapLa1 selected vertices х1, х2, . . . , хL-1, хL the following relation holds for the bouquets: В(х1) В(хL), i.e., the bouquet of a selected vertex хL is included . . . В(хL-1) В(х2) Т,Qi Т), Рi=RP(Рi Т). Т and Qi Т) =NC(y, Qi Т the property NC(x, Pi in the bouquets of all preceding selected vertices. Theorem 2 Given a graph G(V,E), a partition П on V, an automorphism fAut(G, П), NC(x,П) = NC(y,П) for each pair x, y=f(x) (a property- equal cell labels for each pair of similar vertices), two partitions PL=П(а1, а2, . . . , аL-1 ), QL= П(b1, b2, . . . , bL-1 ) obtained by 2 series of executions of CSVSIR on the input partition П and NC(ai)=NC(bi) for bi = f(ai), i=1,2, . . . , L-1 (equal cell labels of corresponding base vertices). Then, NC(x, PL) = NC(y, QL) for each pair x, y=f(x), x PL, y  QL (the property holds for each pair of similar vertices). Proof (by the mathematical induction): (1). The base case: By assumption the property NC(x, П) = NC(y, П) holds for the initial partition П. In particular, NC(a1, П)=NC(b1, П). (2). The inductive step: Let the property holds for i-1: NC(x, Pi-1) = NC(y, Qi-1) for Т) holds since by each pair x, y=f(x). For Pi assumption NC(ai-1)=NC(bi-1) for ai-1,bi-1=f(ai-1) is true. For all other vertices of the cells С(ai-1) and С(bi-1) the cell labels are equal to NC(ai-1)+1 – this does not violate the property. For the vertices of other cells of Pi-1, Qi-1 there is no change of cell labels in Т Pi i. Hence, according to Corollary 1 of Theorem 1 the property NC(x, Пi) =NC(y, Pi) also holds for Пi=RP(Пi Since both the base and the inductive step have been proved, it has now been proved that NC(x, ПL) =NC(y, PL) holds for all vertices x and y=f(x), x PL, y  QL. Corollary of Theorem 2 Given a partition ПL=П(х1,х2, ... ,хL-1). Then, Orb(x, AL-1)C(x, ПL) for each vertex хV of the graph G(V,E), L=1, . . . , LK. (In other words, the orbits of AL-1 are subsets of the cells of ПL). Proof Let bi=ai, i=1,2, . . . , L-1 in Theorem 2. Thus, these L-1vertices become fixed points of automorphism f and PL=QL. From NC(x, ПL) = NC(y, ПL) for each pair x, y = f(x) and for each fАL-1=А(а1, а2, . . . , аL-1) follows Orb(x,AL-1)C(x,ПL).  Applying the corollary for L=1 we have Orb(x, A0)= Orb(x, A(П)) C(x, П1). Applying it to L=LK we obtain Orb(x,ALK-1)C(x,ПLK) and Orb(x,ALK-1)C(x,ПLK)=1 since ПLK is discrete, i.e., Orb(x, ALK-1)=1 and ALK-1={I}. Thus, for the series of partitions П1, . . . , ПLK only the stabilizer ALK-1 is known – the stabilizer of the first selected vertex XLK-1 in SC(ПLK-1) . Theorem 3 Given a graph G(V,E), n=V, an automorphism fAut(G) with fixed points а1, а2, ... , аj-1 and a partition Пj=П(а1, а2, ... , аj-1), obtained after (j-1) successive applications of CSVSIR operation on а1, а2, . . . , аj-1 with starting input partition П and vertices p, q SC (Пj), q=f(p). Then, each numeration - 13 -  П′=П(а1, а2, ..., аj-1, p, аj+1, аj+2, ..., аLК-1)=x1 x2 . . . xi . . . xn, derivative of П(а1, а2, ... , аj-1,p) has a corresponding numeration П″=П(а1, а2, ..., аj-1, q, bj+1, bj+2, ..., bLК-1)= y1 y2 . . . yi . . . yn, derived from П(а1, а2, ... , аj-1,q), such that yi=f(xi), i=1, 2, ... , n and NC(xi,П′)=NC(yi, П″). (Note: There is an equivalent theorem of B. McKay - theorem 2.15 in [12]). . Proof Let we consider two executions (labeled I and II) of the operation CSVSIR on starting input partition П of graph G(V, E). The first j-1 selections а1, а2, ... , аj-1 are equal for both executions and the resulting partitions are equal to Пj. Under the conditions of the theorem, there are vertices p, q=f(p) in the cell SC (Пj). Let the jth selection be p in the first execution, and the jth selection be q in the second execution, i.e. the obtained partitions are: for execution I – ПI=П(а1, а2, ..., аj-1, p), for execution II – ПII=П( а1, а2, ..., аj-1, q), for which the conditions of Theorem 2 hold: аi=f(аi) for i = 1, 2, ..., j-1 and q=f(p). Therefore, according to Theorem 2, the similar vertices are in cells with the same label, and thus the vertex аj+1 in SC (ПI) will correspond to the vertex bj+1= f(аj+1) in SC (ПII). So, the selection аj+1 is possible in execution I and the selection bj+1 = f(аj+1) is also possible in execution II. The conditions of Theorem 2 also hold for these selections and at the (j+2)th selection similar vertices can be selected again, i. e. аj+2, in the execution I and bj+2 = f(аj+2) in the execution II. This process continues until the last selections аLК-1, bLК-1=f(аLК-1) in both executions have been done – after these selections the partitions will be discrete. This means that each numeration П(а1, а2, ..., аj-1, p, аj+1, аj+2, ..., аLК-1)= x1 x2 . . . xi . . . xn=П′ has a corresponding numeration П(а1, а2, ..., аj-1, q, bj+1, bj+2, ... , bLК-1)= y1 y2 . . . yi . . . yn=П″ , such that NC(xi,П′)=NC(yi, П″), yi=f(xi), i=1, 2, ... , n.  There are four obvious corollaries of Theorem 3: Corollary 1 of Theorem 3 Under the conditions of Theorem 3 the discrete partitions of type П″, successors of the partition П(а1, а2, ..., аj-1, q), do not find new automorphisms (new similar vertices). Consequently, it is not necessary to determine them if we pre.liminarily know the discrete partitions of type П′ - successors of the partition П(а1, а2, ..., аj-1, p). Corollary 2 of Theorem 3 The bouquets of two similar vertices in a given SC(ПL) are of the same size. This statement is obvious because to each numeration of the one bouquet uniquely corresponds a numeration of the other bouquet. Corollary 3 of Theorem 3 To determine whether two vertices X and Y in SC(ПL) are similar we need to know the bouquet of one of the vertices, say B(L, X), and generate one numeration n1 derived of a selection Y in SC(L) and compare n1 with the numerations B(L, X). Even more, B(L, X) should not contain equivalent numerations - 14 - because of the transitivity of the equivalence: if n1 is equivalent to one of them it is equivalent to the another. Corollary 4 of Theorem 3 The bouquet B(L, X) contains all bouquets derived from each representative of an orbit in SC(ПL+1). .Important conclusions follow from Theorem 3 and its corollaries. There are three possibilities to determine whether two vertices X and Y in SC(ПL) are similar under A(x1, . . . ,xL-1): (a) The bouquet B(L, X) of the vertex X should be stored and for the vertex Y we should generate only one numeration and compare it with the numerationsB(L, X) - this version is used in Vsep-e algorithm; (b) One numeration should be stored for vertex X and the whole bouquet for vertex Y should be generated. This version is used in Nauty [12] and in the most of the known algorithms; (c) Two bouquets В(L, X) and В(L, Y) are partially generated and their numerations are compared for determining an automorphism (with a certain probability) that maps X to Y. This probability might be near to 1 if we choose an appropriate selection of the bouquets size. This is the basis for the heuristic algorithms described in Section 5. NS-number stored numerations m 1 of NG-number of generated numerations m+q-1 m+m(q-1)=q.m of number - NC comparisons of numerations c.m(q-1) c.m(q-1) versio n a b Table 1 Let's compare versions (a) and (b) (Table 1). Let m=B(L, X) and let's consider that the numerations of the bouquets are stored in a hash table with a maximum number c of collisions of some hash function (characteristic of the numeration) we'll explain below. Let's also consider the worst-case – a rigid regular graph for L=1 and SC(П1)=q – in this case all vertices in SC(П1) are not similar each other. This is the worst-case since: (i) for L=1 the bouquets have the larger size than the bouquets for L>1 and (ii) the bouquets for rigid graphs are full – each vertex at each level is selected. The advantage of a version (b) is a low storage – only one numeration is stored and the disadvantage of version (a) is the large required storage – the whole bouquet of size m for the first vertex x1 SC(П1) is stored. A version (a) is faster since the number of the generated numerations is smaller: NG=m+q-1. In this case the bouquet of the first vertex x1 SC(ПL) is generated and stored and for each of the other q-1 vertices only one numeration is generated - totally NG =m+q- 1. In case of version (b) for each vertex x SC(П1) all m numerations of bouquet В(1, x) are generated, i.e. NG= m.q – we suppose that the size of each bouquet is m or m is the largest size. Since m.q >> m+q-1 version (a) is many times faster than version (b). The number (NC) of the comparisons of numerations is c.m(q-1) for both versions. In version (a) one numeration for each vertex in SC(1) is compared with c.m numerations of B(X1). In - 15 -  version (b) the only stored numeration n1 derived from the selection X1 is compared with c.m numerations of each bouquet B(X), x SC(1), x≠x1. Examples:  Graph A29_1 (rigid regular graph from [29]):n=29, m=14 (this size is for each vertex in SC(П1), q=n=29; NG(a)=m+q-1=42, NG(b)=q*m=29*14=406 (in the brackets is the numbering of the version). We see the big difference between the .numbers of generated numerations of the two versions.  Graph G1275 (Rigid affine plane of order 25, received from R. Mathon in private communication): n=1275, bipartite graph with k=625*26=650*25=16250; m=8322060; q=625; NG(a)=m+q-1=8322060+625-1=8322684; NG( b)=q*m = 625*8322060 =5201287500. In this case the difference between NG (a) and NG (b) is impressive. 4. S-code of a partition and storing the bouquets We propose new code, named S-code, of a partition of the graph vertices. The partition code is a number depending on the labels, sizes of the partition cells and the number of the edges between the cells. S-code is used for reducing the time of comparing the partitions in the graph isomorphism and automorphism algorithms. The code of a given partition can be computed directly from the partition and the graph representation or from the code of the parent partition and the differences between the partition and its parent partition. In our algorithms a large number of discrete partitions (numerations) of graph vertices are generated and stored. The length of each partition is n (n is the number of the graph vertices). One way of reducing storage requirements is the coding of partitions. To every partition is assigned a code (a number, characteristic value). The codes of two partitions are compared (instead of comparing the corresponding partitions) and if they are equal then the partitions are compared to determine if they form an automorphism. In this case the partitions have to be regenerated using the stored base B, p=B of the partition and applying the IR operation p times. The cardinality p of the base is many times less than n. Let's consider the storing of a partition L obtained from the start partition 0 by applying the IR operation successively. There are 3 ways of storing the partition L: a) storing the partition itself, i.e. n numbers are stored; b) storing the base B(L) and the code c(L) , i.e. p+1 numbers are stored – one for the code and p for the base. This way the amount of the stored information is reduced from n to p+1 numbers, where p << n. In this case a regeneration of L is made when using of L is needed; c) storing the code c(L) and a polynomial code of B, i.e. only 2 numbers are stored but a regeneration of both L and B is needed. In our implementations the version (b) is used. The requirements for the code are: i) The codes of the equivalent partitions have to be equal; ii) The splitting ability of the code has to be maximal. This means that the number of not equivalent partitions with equal codes have to be minimal (minimum collisions); iii) The computation of the code should have minimal number of operations (easy to compute); We have examined a few versions of coding and the code with the best satisfaction of the requirements is the following: - 16 - , where: (4.1)  - the adjacency refinement partition of the vertices of graph G(V,E), (x,y)- an edge of the graph, C(x),C(y) – the cells of the vertices x,yV and L(C(x)), L(C(y)) – the labels of the cells C(x),C(y). The label of a cell is the index of the first vertex in the cell representing a partition as an array. The following theorem proves that the requirement (i) holds for the code (4.1): Theorem Given a graph G and 1 ≡ 2, then code(1) = code(2). Proof Each edge (x,y)E(G) has unique image (α(x),α(y))E(G) for an automorphism α defining the equivalency of 1,2. Moreover, C(x) = C(α(x)), C(y) = C(α(y)) – the similar vertices are in namesake cells. Therefore, L(C(x)) = L(C(α(x))), L(C(y)) = L(C(α(y))) and L(C(x)).L(C(y)) { code(1) }= L(C(α(x))).L(C(α(y))) { code(2)}. Consequently, code(1) = code(2), since the last equation holds for each edge E(G). Evidently, the time complexity of computing the code by (4.4.1) is T=k=O(n2) multiplications (k-the number of the graph edges) since k= O(n2). The code of  can be computed directly by (4.4.1) or indirectly by the code of the parent partition of . The maximal value of the code Max(Code()) is obtained for a discrete partition  of a complete graph on n vertices (since its number of vertices is largest) : Max(code(π)) 1 = 2 1 = 2 𝑛−1 ((𝑛2 + 𝑛) ∑ 𝑖=1 ((𝑛2 + 𝑛) 𝑛(𝑛−1) 𝑖 − − 2 𝑛−1 𝑖=1 − ∑ 𝑖3 ∑ 𝑛2(𝑛−1)2 = ∑ 𝑛−1 𝑖=1 𝑖 𝑛−1 𝑖=1 𝑖2) = (𝑛+𝑖+1)(𝑛−𝑖) = 2 − 𝑛(𝑛−1)(2𝑛−1) 6 ) = 𝑛(𝑛−1)(𝑛+1)(3𝑛+2) 24 (4.2) 4 The second multiplicand of the first expression in (4.4.2) is a sum of an arithmetic progression. Example: Let's consider the graph in Figure 5 and the series of partitions and their codes: Figure 5. G8 graph Figure 5. G8 graph π0=π(0) = 1,2,3,4,5,6,7,8 = C1 1 C4 2 C4 1785,63,42) = C1 17,85,63,42 = C1 1 C2 2 C2 1 C3 2 C3 0 ; Code(π0)=12; π1= π(1) = RP (1 2,3,4,5,6,7,8) = 1 C5 2 C5 1 ; Code(π1)=208; π2=π(1,7) = RP (1785,63,42) = 2 C6 2 C7 3 C2 2 Code(π2)=218; π3=π(1,7,5) = 3 C3 3 C6 3 C5 3 C7 3 C4 3 C8 3 ; Code(π3)=234. We RP(178563,42) =17856432) = C1 illustrate only how Code(π1) is computed (Table 2). - 17 - EyxyCLxCLcode),())(()).(()(iiinnin(...)12111 1,2 1,3 1,4 2,3 2,4 3,5 4,6 5,7 5,8 6,7 6,8 7,8 Code (π1) edge (x,y) L(C(x))* 1*8 1*6 1*6 8*6 8*6 6*4 6*4 4*2 4*2 6*2 6*2 2*2 208 L(C(y)) =8 =6 =6 =48 =48 =24 =24 =8 =8 =12 =12 =4 5. The exact Vsep-e algorithm Table 2 In this and the following section we describe the proposed algorithms some of which were preliminary presented in arXiv [30]. , 5.1. Basics of the algorithm We need the following theorem for the reasoning of Vsep-e algorithm. Theorem 4 Given: A=Aut(G(V,E)), an orbit Q=Orb(x1,A) of vetex x1V and a generating set gen(A(x1)) of a stabilizer A(x1). Then, there is a tower of acsending subgroups of A A(x1)=A(1) A(2)  . . . A(i) . . . A(m)=A, such that: (a) A(i) is a proper subgroup of A(i+1) 1 i  m-1; (b) gen(A(i))={ gen(A(i-1)),i}, 2  i  m, where the autmorphism i is such that xi=i(x1); (c) A(i) 2. A(i-1), Orb(x1, A(i))  2.Orb(x1,A(i-1)), 2  i  m; (d) m is the minimal value of i such that Orb(x1, A(m))=Q. {Note: Evidently, the consequence of (b) is gen(A)=gen(A(m)))={gen(A(x1)), 2, 3,…,m. Theorem 4 can be considered as an extension or modification of Theorem 5 of C. M. Hoffmann in [10], page 25} Proof (inductive, it follows the proof of Theorem 5 in [10]). Let's construct a tower of ascending subgroups of A: A(x1)=A(1) A(2)  . . . A(i) . . . A(m)=A, such that A(i) is a proper subgroup of A(i+1) , i=1,2, . . . ,m-1; m is finite since A is a finite group. For i=1 we have A(1)= A(x1) and gen(A(1)) =gen(A(x1)), known. Assume inductively that A(i) is a proper subgroup of A and let we have orbits Q= Orb(x1, A(i-1))≠Q= Orb(x1, A(i-1)), Q, QQ. Then, we'll have an automorphism iA\ A(i-1) such that xi=i(x1) and Orb(x1, gen(A(i))) Q Q. Thus, i is a generator of A and A(i) since it does not belong to A(i-1), i.e. gen(A(i))=gen(A(i-1))i and therefore A(i)2. A(i-1) (since at least one new coset appear in the partitioning of A(i) into cosets of A(i-1)) and Orb(x1,A(i))  2.Orb(x1,A(i-1)) (from the orbit-stabilizer theorem: Orb(x1,A(i))= A(i)/.A(x1) ≥Orb(x1,A(i-1))=A(i-1)/A(x1)). The first value of i when Orb(x1,gen(A(i)))=Q and A-A(i)= is i=m and consequently gen(A)=gen(A(m)))={gen(A(x1)), 2, 3, . . . , m}. Theorem 4 gives us the idea how to find the generators of a group if we know an orbit Q of the group and the generators of a stabilizer of a representative x1 of this orbit. This is done by traversing the orbit step by step. At each step we find one new generator of a new subgroup of A knowing the generators and the orbits of the previous subgrpoup of A. Before the first step the previous subgroup is equal to A(x1) with its orbits and generators. - 18 - Visiting each vertex x of the orbit, xx1, we select x only if x is not similar to x1 under the previous subgroup. Thus a new automorphism-generator that maps x to x1 and new orbits for a new subgroup are found. The new subgroup is a proper supergroup of the previous subgroup.. At each step the generators, orbits and order of the current group A (subgroup of A) are defined by the position of the selected vertex x. This process stops when the orbit of x1 under the new subgroup becomes equal to the given orbit Q. The described process is presented in Table 3. The selected vertex xi, i=2, . . . ,m is the first vertex after xi-1 in Q that is not similar to x1 under A(i-1). The generators of A(x1) are called proper generators of A and the generators 2, 3, . . . , m - mutual generators of A. The following corollary is obvious: Selec- ted vertex x x1 Mutual generators Visited vertices Orb(x1,A) 1={x1} gen(A) A(x1) A {x1} - A A(1)= A(x1) gen(A(x1)) (proper generators of A) x2 x3 x4 . . . xi . . . xm {x1:x2} x2=2(x1) gen(A(x1)) 2 {x1:x3} x3=3(x1) gen(A(x1)) 23 {x1:x4} x4=4(x1) gen(A(x1)) . . . . . . {x1:xi} xi=i(x1) 234 . . . gen(A(x1)) 2 . . . i . . . . . . xi=m(x1) gen(A(x1)) 2. . . . . . {x1:xm} =Q m 2 4 8 . . . 2i-1 . . . Q2m-1 2.A(x1) A(2) 4.A(x1) A(3) 8.A(x1) A(4) . . . 2i- 1.A(x1) . . . 2m- 1.A(x1) . . . A(i) . . . A(m)=A Table 3 Corollary of Theorem 4 The number of the mutual generators of the graph automorphism group A toward the stabilizer A(x1) is m=1+log2Orb(x1, A). Based on Theorems 3 4 and O-S theorem we build a new algorithm called A3. Actually, Theorem 4 tell us that there is a generator xi=i(x1) if xx1 is not similar to x1 under the current group but according to Theorem 3 to determine this generator we should know the bouquet B(x1) and one numeration derivative of x and to compare them. Knowing the partition П1 and SC(П1) according to Theorem 4 to traverse the unknown Q orbit we should traverse its superset, SC(П1)  Q. Thus, we come to the idea of A3 algorithm (Figure 6). We denote by FRPO(X) – all first representatives of the orbits of A positioned in SC(П1) before the selected vertex X and by BFRPO(X) – the bouquets of FRPO(X). Then, the bouquet B may be considered as a union of the bouquets BFRPO(X). - 19 - A3 algorithm determines GOO(A) of the graph automorphism group A=Aut(G,1) ) and the bouquet of each representative of an orbit Orb(A)SC(1) given GOO(A(X1)) of a stabilizer A(X1) of the first vertex X1SC(1) and the bouquet B(X1). According to Theorem 3 and 4 we'll determine GOO(A) and the bouquet of each representative of an orbit Orb(A)SC(1) visiting each vertex xSC(1) positioned after X1. Before the traversal of SC(1) we have GOO(A)=GOO(A(X1)). Each visited vertex xSC(1) is selected if it is not similar to any previous vertexSC(1) under the current group A. Then, we determine if there is an automorphism , x=(y), where y is one of the roots of numerations in B. This is made (according to Theorem3) by comparing the first numeration LK derived from the selection x with the numerationsB. Two cases are Input: a graph G; a partition 1=RP() for a given input partition  ; SC(1); a vertex XF SC(1) and its index in SC(1); GOO(XF): the generating set gen(A(XF)) of a stabilizer A(XF), the orbits of A(XF) and A(XF) and the bouquet B(XF); the bouquets BFRPO(XF), i.e., the bouquet of each first representative y of an orbit of A in SC(1) with index (y) < index (XF); each representative y and XF has no similar vertices in a position in SC(1) before it. Output: The generators, the orbits and the order (shortly GOO) of the graph automorphism group A=Aut(G, 1); the bouquet B of each representative of an orbit of A in SC(1). 1. orbits of A:=orbits of A(XF); gen(A):=gen(A(XF)); (A):= A(XF) 2. X:=XF; 3. Do 4. 5. 6. 7. select next X SC(1); if there is no selected vertex X then exit; determine a numeration n1 by SFM(X); compare the numeration n1 with the numerations of the BFRPO(X); if n1 is equivalent to some numeration from BFRPO(X), i.e. there is new automorphism  mapping X to some vertex from FRPO(X) then gen(A):= gen(A); recompute the orbits of A; A:=Orb(XF).A(XF) else {n1 is not equivalent to any numeration from BFRPO(X), i.e. there is no new automorphism mapping X to some vertex from FRPO(X)} build the search tree ST(X) for determining GOO(A(X)) and the bouquet B(X) end; {if} 8. 9. 10. 11. 12. end do Figure 6. A3 algorithm possible: (a) If there is an automorphism  then it belongs to a new subgroup of A since it unites the orbits of x and X1, i.e., gen(A): = gen(A) {}; (b) If LK is not equivalent to any numeration B then x becomes a representative of a new orbit and a new search tree ST(x) is built - it determines gen(A(x)) and B(x). If during the generation of ST(x) an automorphism is discovered and if it unites the orbits of A then, it is also a generator for A since A(x)A. Thus, after case (b) for the next selected vertex we should compare the numeration LK derived from the selection of x with the numerations of all known bouquets B. To determine the orbit of the vertex X1 it is sufficient to do the above comparison only with the bouquet B(X1) but we do this comparison with the numerations of all bouquets of - 20 - B since we store them and the earlier finding of a generator is better since we can use it earlier. If the found automorphism , x=(y), yX1 unites orbits of the current A it is a generator of A. After each of both cases has been handled the traversal of SC(1) continue by selection of a new vertex x. Thus, after the traversal of SC(1) all verticesOrb(X1, A) will be visited and the bouquet of each first representative xiSC(1) of an orbit of A and GOO(A) will be determined (according to Theorem 4). During the execution of A3 algorithm (as in Theorem 4) a tower of ascending subgroups of A are built implicitly: A(x1)=A(0) A(1) . . . A(i) . . . A(m)=A, such that A(i) is a proper subgroup of A(i+1), 0  i  m-1. A3 algorithm is applied differently for L partition of level L=1 and L>1. If L=1 then GOO(X1) and B(X1) are determined only for the first vertex X1 SC(1) and for other orbit representatives in SC(1) only one numeration is generated and compared with B(X1). This means that instruction in line 10 of A3 is not necessary if L=1. If L>1 then GOO(XL) and B(XL) are determined for all orbit representatives XL  SC(1) since they are needed for A3 application to L=L-1. A3 algorithm can be applied for determining any GOO(A(XL-1)) and B(XL-1), L=2, . . . , LK-1 under the following requirements: R1. For L known are: ПL, SC(ПL), a vertex XFLSC(ПL); its index in SC(ПL, , , is not similar to any previous vertex in SC(ПL) under A(XL-1), XL-selected vertex, bouquets BFRPO(XL); GOO(XL-1)= GOO(XL) at the start; R2. XL is selected in interval index(XFL)+1 to the end of SC(ПL), XL is selected as a first not similar vertex after the current XL under the current A(XL-1). At the start XL is the vertex with index=index(XFL)+1. This means that the vertices of in SC(ПL) are after requirement of Theorem 4; R3. If XL is similar to some vertexFRPO(XL) then the discovered automorphism is a generator of A(XL-1): gen(A):= gen(A). Otherwise, each new numeration in B(XL) (instruction 10) belongs also to B(XL-1). . Thus, traversing SC(ПL) we'll traverse Orb(XFL,A(XL-1))– this is the 5.2. Vsep-e exact algorithm: cases CS1, CS2, CS3 and CS4 Let we have the starting series SFM1: П1, П2,…, ПLK. We can apply A3 algorithm directly only to the partition ПLK-1 because for the other partitions the required input variables are not known. For the partition ПLK-1 we have B(xLK-1) ={ПLK} and gen(A(xLK-1))=, i.e., A(xLK-1)=1 and discrete orbits of A(xLK-1). After the application of A3 to ПLK-1 we have determined correctly B(xLK-2) and GOOGA(A(xLK-2)). Then, A3 can be applied to ПLK-2, i.e., a backward move is done from LK-1 to LK-2. Thus, applying A3 to the series ПLK-1, ПLK-2,…, П2, П1 we can determine GOO(A). The lowest level to which a backward move has been made we denote by LMIN, i.e., LMIN is the level for which we determine GOO(A(XLMIN-1)). In A3 algorithm the process of the backward moves is not included and the instruction 10 is not revealed. All this is taken into account in PART1 (Figure 9) and PART2 ( Figure 11) algorithms called from the Vsep-e algorithm - 21 - ))((LXFAGOO)(LXFBLXF))(,(1LLXAXFOrbLXF (Figure 8) that determines GOO(A) of the partition-wise stabilizer A=Aut(G, П) given a graph G(V,E) and the input partition П on V. S3. Before calling PART1 and PART2 Vsep-e algorithm determines (step S2) the orbits of A by an TREE4 heuristic algorithm (see section 7.1) and selects X1 SC(П1) - a representative of one of the smallest orbit of the vertices in SC(П1). Experimental tests show with very rare exceptions that if the staring vertex X1 is a representative of one of the smallest orbit of A then the size of the bouquet B(X1) built by PART1 is the smallest and the running time is minimal. PART1 algorithm (Figure 9) can be considered as an application of A3 algorithm with added the backward moves and revealed instruction 10 – all above requirements are implemented in it. PART1 algorithm determines GOO(A(x1) and B(x1) given П1, SC(П1) and x1SC(П1). PART2 algorithm (the second part of Vsep-e algorithm, line S5 in Figure 8) determines GOO(A) given GOO(A(x1) and B(x1) obtained from PART1 algorithm. PART2 algorithm can be considered also as an application of A3 algorithm to the partition П1 with replacing the instruction 10 by determining one derivative numeration ПLK of each selected vertex xSC(П1) if x is not similar to x1 under the current A. PART2 algorithm may be also considered as a direct application of theorems 3 and 4. The satisfaction of the requirements of these theorems guarantees .the correctness of PART2 At the start of PART2 GOO(Aut(G):= GOO(Aut(G,x1)). Each vertex x in SC(П1) that is not similar to x1 under the current Aut(G) is selected (line B2) and a comparison (line B5) of the first derived from the selection x (line B4) with the numerationsB(x1) is numeration made. If there is an automorphism  between some numeration B(x1) and then  is a generator for A since it unites the orbits of x and x1. In both cases (existence or nonexistence of ) the traversing of SC(П1) continues until its end. When the traversal of SC(П1) completes, the generators and the orbits of A are determined and the 'orbit- stabilizer' theorem is applied for determining A=Orb(x1, A). A(x1) (line B3). We'll describe PART1 algorithm considering an intermediate state of ST search tree (Figure 7) being built by the algorithm during its execution. The series of partitions ПL, L=2, . . . , LK-1 can be divided into three intervals: the first is from П1 to ПLMIN-1, the second – from ПLMIN to ПLP and the third – from ПLP+1 to ПLK-1. The search tree is built in a preorder: first visiting the root (a partition ПL) and then its subtrees (the partitions ПL+1 derived from each selected vertex) in a defined order. Applying A3 algorithm for determining gen(A(xL)) we have: , is the generating set of the current stabilizer , is the , is the generating set of the current stabilizer where generating set of the stabilizer A(xL) and conditions hold for the intermediate state of PART1 algorithm execution (Figure 9) shown as a search tree ST on Figure 7: C1: On the current path of ST tree known are: L, ПL, SC(ПL), XL, L=1, 2, . . . ,LK-1, XL is the current selected vertex in SC(ПL). The current numeration is ПLK-1=n1; C2: LMIN, LP, LMINLP, LP2 are known; C3: X1 is the first vertex  SC(П1); is th.e set of the mutual generators of . The following - 22 - LKLK))((),())(())((111111LLLLLxAgenxxMGxAgenxAgen))((LxAgen)(LxA))((11LxAgen)(11LxA),(111LLxxMG))((1LxAgen)(1LxA C4: Each selected vertex XL is not similar to any previous vertex in SC(ПL) under A(XL-1), L=2, . . . ,LP-1; C5: Each selected vertex XL is the first vertex in the SC(ПL) for L=LP+1, . . . ,LK-1; The partitions in this section of the path are a result of the forward move SFM(XLP); C6: Known are: GOO(XLMIN-1), B(XLMIN-1), FRPO(XLMIN); C7: Known are the bouquets BFRPO(XL), L=1, 2, . . . , LP; C8: Known are the orbits and orders A(X) of vertices X FRPO(XL) and X= XL, L=LMIN,…,LP, under A(XL-1). C9: On the current path known are the computed orbits Orbc(Xl) and computed orders AC(Xl) for L=LMIN+1,…,LK-1 under the current A(Xlmin-1). For L=LMIN we have Orbc(Xl)= Orb(Xl) and AC(Xl)= A(Xl) under the current A(Xlmin-1) since all generators found so far have the same fixed points with A(Xlmin-1). The action that follows the above state is a comparison of n1 numeration with the numerations of BFRPO(XLP) for discovering a new generator of A(Xlmin-1). All above conditions can be considered as an invariant for correctness of the loop C1 of PART1algorithm. Let's now describe PART1 algorithm. It calls SFM1 (Figure 10) and COMP (Figure 13) algorithm. At the start all of the searched variables are not known and for each partition ПL, L=2, . . . , LK-1 we select the first vertex XLSC(ПL) and obtain the partition ПL+1, i.e. the only action we do is a forward move (line I1) until a discrete ПLK is obtained. Thus, the conditions R1 to R3 hold for only for ПLK-1.Let's now consider the above requirements R1 to R3 for determining GOO(A(XLP-1))=GOO(A(x1, , . . . , xLP-1)) and the bouquet B(XLP- 1)=B(x1, , . . . , xLP-1) given the partitions П, П1, . . . , ПLP. For ПLP=П(x1, , . . . , xLP-1) also SC(ПLP) and the selected vertex XLP are known. Besides, the requirements hold for the position of the current vertex XLP in SC(ПLP). By the loop C1 (lines I1- I12) in PART1 algorithm each selected cell SC(ПLP) is visited and the following four basic steps are performed: A1 {Selection}: The selection of a vertex XLP in SC(ПLP) (line I3) is made starting from the position next to the current XLP. The vertex XLP should not be similar to any previous vertex in SC(ПLP) under the current A(XLMIN-1). For each level L the position i(XL) of the selected vertex XL is stored and when a backward move to this level is performed then the selection of a new vertex starts from the next position, i.e. i(XL)+1. If there is no selected vertex in SC(ПLP), i.e. the SC(ПLP) has been traversed then, a backward move follows (step A4). If there is a selected vertex XLP in SC(ПLP) then, step A2 follows. A2 {Series of forward moves}: A series of forward moves SFM1 is performed determining the partitions ПL=ПLP+1, . . . , ПLK with discrete ПLK (line I5). In each of these partitions the selected vertex XL is the first vertex in SC(ПL). This way the requirements hold for the orbit Orb(XL, A(XL-1)). A3 {Comparison}: A check if there is a new automorphism  that not belong to the current subgroup of A(xLP-1) and maps the vertex X to any vertex from FRPO(X) is made, i.e. if  belongs to the next subgroup of A(xLP-1). This check is made by comparing ПLK with BFRPO(X) (line I6, COMP algorithm). A4 {Backward move}: After the traversal of SC(ПLP) is completed then GOO(A(xLP-1)) and B(xLP-1) are determined and a backward move - 23 - LP:=LP-1 is made. Stop follows if LP=1. Otherwise, a selection of a new vertex in SC(ПLP) is made applying the step A1 to it. If there is an automorphism  then, it is a generator: gen(A(XLP-1)) := gen(A(XLP-1)){} and the orbits and the order of A(XLP-1) are recomputed. It is a generator also for A(X1): gen(A(X1)):=gen(A(X1)){} and the orbits and the order of A(X1) are recomputed. If there is no  mapping x to a vertexFRPO(X) then a move back to LK-1 follows. This way the building of the tree ST(x) starts from LK-1 performing the step A1 to SC(ПLK-1). ST(x) is necessary since it determines the bouquet B(x) that belongs to B(XLP-1). After ST(x) has been built we continue with a selection of a new vertex in SC(LP) applying the step A1 to SC(ПLP). The search tree is built in preorder traversal: first visiting the root (ПLP partition) and then its subtrees (the partitions ПLP+1 derived from each selected vertex) in a defined order. For the selected vertex XLP (line I3 – the start of ST(XLP) building) by SFM1 (line I5) is built the first (leftmost) tree ST(XLP+1), ST(XLP+2), . . . , ST(XLK-1) for each previous subtree. Each of these subtrees is built in backward ord..er. When the subtree ST(XLP+1) has been built then the building of the subtree for the next selected vertex XLP+1 starts (XLP+1 should hold the requirements). When there is no selected vertex XLP+1 then a backward move LP+1 to LP is made – this means that the ST(XLP) is built. If LP=1 the algorithm stops. Figure 7. Search tree of VSEP-e LMIN-1 LMIN xLMIN-1 . . . . . . . . xLMIN . . . . . . . . . . LP-1 . . . . LP xLP 1 xLP 2 . . . . B(a1,1 LP) B(a2,1 LP) . . . . xLP-1 . . . . . . . . xL i P . . . . LP+1 LP+2 . . . . . . . . LK-1 LK n1 . . . . x2 x3 x1 L=1 L=2 L=3 5.2.1. Cases CS1 and CS3 . . . . . . . . . . . . . . . . . . . . SC(1) SC(2) SC(3) . . . . . . . . . . . . . . . . . SC(LMIN-1) SC(LMIN) SC(LP-1) SC(LP) SC(LP+1) SC(LP+2) SC(LK-1) - 24 - (5.2.2) (5.2.1) Let us consider the cases when the numeration .ПLK (Figure 7) does not form an automorphism with any numeration BFRPO(ПLP). Knowing that A(XLP-1) is correct and supposing that each orbit Orb(XL, A(XL-1)) for L=LP, . . . , LK-1 is also correct, and applying the Theorem 'O-S' we obtain A(XLP-1)/Orb(XLP, A(XLP-1))/Orb(XLP+1, A(XLP))/ … /Orb(XLK-1,A(XLK-2)) = АLK-1 = 1. However, the orbits in (5.2.1) are unknown and consequently we cannot use it. Instead, the sets W=COrb(XL, A(XLP-1)) of the vertices in SC(ПL) similar to XL under A(XLP-1) are known, i.e. W=COrb(XL, A(XLP-1))= Orb(XL, A(XLP-1)) SC(ПL). We call the set W 'computed orbit' to distinguish it from the real orbit U=Orb(XL, A(XL)). The following relation holds U=Orb(xL,A(xL-1))COrb(xL,A(xLP-1))=W, (5.2.3) since A(xL-1))  A(xLP-1). Considering (5.2.3) and applying the Theorem 'O-S' for the computed orbits we obtain A(XLP-1)/COrb(XLP,A(XLP-1))/COrb(XLP+1,A(XLP-1))/ … / COrb(XLK-1,A(XLP-1)) = АLK-1  1. The computation on (5.2.4) is performed by SFM1 algorithm (Figure 10) called from the instruction I5 of PART1. If the sign in (5.2.4) is = (i.e., the real and the computed orbit are equal), then we call the orbit Orb(xL, A(xL-1)) separated. If the sign in (5.2.4) is < , then, obviously, W=UR, R>1, i.e., W (and R) include vertices that belong to SC(ПL) but are not similar to XL under A(XL-1). It can be proved that when W contains some vertex, then it contains the whole orbit of this vertex under A(XL-1). Thus, W can be considered as an union of orbits of .A(XL-1). We call this case non- separation of orbits (denoted by NSO) and the orbit U is called non-separated (non- partitioned). Since the representatives of the orbits belonging to R are not known we cannot select them during the traversal of the SC(ПL). Thus, the search tree of such a (5.2.4) Input: Graph G(V,E) and a partition П on V Output: Generators, orbits and order of the partition-wise stabilizer A=Aut(G, П), denoted GOO(A) S1: Initialization: П1:=RP(П, NCL);{NCL-the number of the cells in П1} S2: if NCL=n {П1is discrete} then message'Trivial group'); return end if; S3: CSLCh {call cell selector chooser-finds the cell selector}; S4: Determine SC(П1) and х1:=first vertex in SC(П1); S5: Use a filter that defines whether or not to call the following procedures that: a) Give a better partition П1 obtained by S code sorting of the vertices in П1. Determine a new SC(П1) and х1:=first vertex in SC(П1); b) Determine: (i) the generators and orbits of A by TREE4 heuristic algorithm, starting from discrete orbits; (ii) SC(П1); X1:=a representative of the smallest orbit of the vertices in SC(П1); Put the vertex х1 on the first position in SC(П1); S6: PART1: Determine GOO(A(х1)), B(х1) given П1, SC(П1), х1SC(П1) S7: PART2: Determine GOO(A) given GOO(A(х1)), B(х1) Figure 8. Vsep-e algorithm - 25 - vertex cannot be built and its bouquet will not be determined. This is an unallowable error since these bouquets belong to B(XL-1), B(XL-2), . . . , B(X1) and they are needed (as we know from A3 algorithm) for determining GOO(A(XL-2)), GOO(A(XL-3)), . . . , GOO(A(X1)). If there is only one partition with non- separated orbit, then the sign in (4.2.1.4) is <, since the length of the computed orbit is greater or equal to the length of the real orbit – this is the condition to detect the presence of NSO. We call this case CS3. If there is no NSO in any partition, i.e. each computed orbit is equal to the real one, then the sign in (4.2.1.4) is = and the case is denoted by CS1. If the case is CS1, then at the exit of COMP algorithm (line I6 in PART1) the invariant for correctness holds for LP=LK-1: only LP is changed, LMIN remains the same. When the case is CS3 we lose GOO(XLMIN-1) determined so far and the algorithm continues with a new start point: LP=LK-1, LMIN=LP, XLMIN= XLK-1 is the first vertex in SC(LK-1) and A(XLMIN-1)={I}, i.e., each vertex is put into a separate orbit. Obviously, the invariant for correctness holds for CS3 case. Input: П1, SC(П1), х1 Output: GOO(A(х1)), B(х1) I1:SFM1:Determine ПL,A(XL-1)=1,SC(L),L=2, . . . ,LK given ,П1,SC(П1),X1; LP:=LK-1; LMIN:=LP; gen(A(х1)):=; A(х1):=1; B(XLK-1):={ПLK}; I2: do {loop C1: Visit vertices in SC(ПLP) } I3: Select XLP in SC(LP); I4: if XLP0 then {forward move} I5: SFM1: Determine ПL, A(XL-1), SC(L),L=LP+1, . . . ,LK given LP, ПLP , SC(ПLP), XLP; I6: COMP: Compare ПLK with the numerationsBFRPO(XLP) for determining an automorphism A(XLP-1). Determine GOO(A(XLMIN-1)), LP; I7: else {backward move: SC(LP) has been traversed} I8: LP:=LP-1; I9: if LP<LMIN then LMIN:=LP; Aut(XLMIN):= Aut(XLMIN+1) end if; I10: if LP=1 then return end if; I11: end if I12:end do;{ loop C1} Figure 9. PART1 algorithm (instruction S6 of Vsep-e algorithm (Figure 8)) Input: L=LP, ПL, SC(ПL), XL; Output: ПL, A(XL-1), L=LP+1,… ,LK 1. do 2. L:=L+1; ПL:=RP(ПL-1,XL-1,BRCL); 3. if BRCL=n then return end if 2. 4. determine SC(L); XL:=first vertex in SC(L); 5. A(XL):= A(XL-1)/Orb(XL, A(XLMIN-1)SC(ПL) 5. end do Figure 10. SFM1 algorithm (instruction I5 of PART1 algorithm (Figure 9) - 26 - The operations in the case CS3 may be considered as an error correction of the incorrect orbits of some A(XL-1) determined by the moment since the algorithm interrupts its current execution and starts from the new start point for finding the correct orbits of A(XL-1) and the bouquet В(ХL-1) . 3.2.1. Cases CS2 and CS4 Let's consider the cases when there is an automorphism  mapping XLP to some vertex ULPFRPO(XLP), i.e. the numeration ПLK forms an automorphism  with some numerationB(ULP), XLP=α(ULP). Input: L=1, П1, SC(П1), х1, GOO(A(х1)), B(х1) Outut: GOO(A) B1: do B2: Selecte next vertex Х in SC(П1); B3: if X=0 then A=Orb(х1, A.A(х1); return end if; B4: SFM1A: Determine ПLK given L=1, П1, SC(П1), X SC(П1) B5: COMP: Compare ПLK with the numerationsbouquet В(x1) for an automorphism . If there is  then gen(A):=gen(A)  and recompute the orbits of A; B6: end do; Figure 11. PART2 algorithm (instruction S5 of Vsep-e algorithm (Figure 8)) Input: L=1, П1, SC(П1), X SC(П1) Output: ПLK 1: do 2: L=L+1; ПL=IR(ПL-1,XL-1); 3: if NCL=n then return end if; 4: else determine SC(L); XL=first vertex in SC(L) 5: end do Figure 12. SFM1A algorithm (instruction B4 of PART2 algorithm ( Figure 11)) Then, there is a possibility of NSO for some orbits of the vertices of the target cells of the current path for the levels LMIN+1  L  LP: we denote by CS2 the case when there is no NSO and by CS4 the case when there is at least one case of NSO in this interval. The automorphism  is a generator of A(XLMIN-1) since A(XLP-1)  A(XLMIN-1): gen(A(XLMIN-1)) := gen(A(XLMIN-1))  {}. Thus, the Orb(A(XLMIN)) and A(XLMIN) are changed (line 11) and we denote by +α any variable with changed value. Before  each orbit and each order of the current stabilizers are correct: A(ZL) =A(XL-1)/Orb(ZL, A(XL-1)) for each representative of orbit ZL SC(L), L=LMIN, . . . , LP. The following actions are: - 27 - a) For the interval L=LMIN to LP (loop: lines 11 to 24) of the current ST path the stabilizers of the selected vertices XL before and after  are determined (line 13) ; Input: ПL, SC(ПL), XL, A(XL-1), L=2,3, . . . , LK; LP, BFRPO(XLP), LMIN, GOO(A(XLMIN-1)) Output: GOO(A(XLMIN-1)), LP 1: Compare ПLK with the numerationsBFRPO(XLP) 2: if ПLK is not equivalent to any numerationBFRPO(XLP) 3: then {CS1 or CS3} 4: if A(XLK-1)=1 5: then {CS1} 6: LP=LK-1; B(XLP)={ПLK}; if LP<LMIN then LMIN=LP 7: else {CS3} 8: LP=LK-1; B(XLP)={ПLK}; LMIN=LP; A(XLMIN-1)={I};XLMIN:=the the first vertex in SC(LMIN); Aut(XLMIN):=1 9: end if 10: else{CS2 or CS4: there is an automorphism , XLP=(ULP), between ПLK and some numerationBFRPO(XLP) derivative of the vertex ULPFRPO(XLP)} 11: Determine GOO(A+(XLMIN-1)): gen(A+(XLMIN-1))=A(XLMIN-1)  {}; determine orbits of A+(XLMIN-1) and A+(XLMIN-1)=A(XLMIN)Orb(XLMIN, A+(XLMIN-1)) 12: for L=LMIN, LMIN+1, . . . , LP do 13: A(XL)= A(XL-1)/Orb(XL, A(XL-1)); A+(XL)= A+(XL-1)/COrb(XL, A+(XLMIN-1)); 14: if L>LMIN then 15: for each vertex ZLFRPO(XL) do{check if A(ZL) has changed after } 16: If A+ (ZL)= A(XL-1)/COrb(ZL, A(XLMIN-1))< A(ZL)= A(XL-1) / Orb(ZL, A(XL-1)) 17: then CS4=true 18: end if 19: if L=LP and index(ZL)= index(ZLp) 20: then IULP:= index(ULP); RSTBULP:=A(ULP) 21: end if 22: end for {loop for from line 15} 23: end if 24: end for {loop for from line 12} 25: if (not CS4) then return end if 26: if RSTBULP=1 27: then LMIN:=LP;L:=LP; gen(A(XLMIN-1)):={};orbits of A(XLMIN-1) :=cycles of ; A(XLMIN-1):= Orb(ULP, A(XLMIN-1)) ;XFLMIN:=ULP; A(XFLMIN-1) :=1; the execution continues by starting the selection with a vertex with index(ULP)+1 28: else SFM(ULP);L:=LK-1;LP:-L;LMIN:=L;A(XLMIN):={I};the next selected vertex is the first vertex in SC(LP) 29: end if 30:end if Figure 13. . COMP algorithm (instruction I6 of PART1 algorithm (Figure 9)) - 28 - b) For each representative ZLFRPO(XL), L>LMIN a check if A(ZL) has changed after  (line 16) is performed. This check is excluded for L=LMIN since all orbits and c) stabilizers are correct – all so far found generators have the same fixed points with A(XLMIN-1); If there is a change of A(ZL) for some L then CS4=true. Also, the index(ZLP) and A(ULP) are stored; d) If CS4=false (line 25), i.e. the case is CS2 then an exit from COMP follows, no changes of the variables computed so far are made and the next selection starts from the current selected vertex in SC (LP). e) In CS4 GOO(XLMIN-1) found so far are lost and the algorithm continue from a new start point as in CS3 case. The invariant for correctness holds for the new state of the ST tree. The main requirement that hold is that the selected vertices XL of the current path (ULP for L=P) are not similar to the previous vertices in SC(L) under A(XL-1). If the case is CS4 (lines 26 to 30) then there are possible two subcases: i) A(ULP)=1 and ii) A(ULP)>1. If A(ULP)=1 then LMIN:=LP, L:=LP and a new GOO(XLMIN-!) determined (line 17) are determined – the new start point is index(ULP) in SC(LP). The case when A(ULP)>1 (line 28) means that there are generators we do not know – that's why we do a forward move FM(index(ULP)) to come to a new start point: L=LK-1;LP=L, LMIN=L, A(XLMIN):={I};the next selected vertex is the first vertex in SC(LP). From registered CS4 cases in experiments on benchmark graphs there are only cases with A(ULP)=1. There is another way for CS2CS4 check (not shown in COMP procedure): the check for difference of the new and old stabilizer is made only for the selected vertices XL of the path. The experiments show that both ways work correctly. The experiments on the benchmark graphs in [19] show that CS4 case occurs only for the graphs B52 (Mathon doubling of b25-1 graph [18]), latin-16 and 24, and had-96. 5.3. Examples Figure 14. G10 graph Let us consider the search tree traversal in Figure 15 (in preorder) for the graph of 5.3.1. Simple example Figure 14 . Starting from the partition П1= П()= RP(Пu)=2,94,5,6,71,3,8,10 we do a series of forward moves SFM: П2 = П(4) = 2947568,101,3, П3=П(4,8) = 2947568101,3, П4=П(4,8,1)=29475681013 - the first numeration n1. The selected cell SC(ПL) in this SFM is the cell with the largest number of adjacency cells, the selected vertex is always the first in SC(ПL) and the order of the stabilizers A(0), A(1), A(2),…, A(L), L=1,2,…,LK-1 is 1. Then, a back move follows, L=L-1, L=3, vertex 3 is selected and П4 = П(4,8,1)= 2947581031 - n2, n2 =α1(n1), α1=(1,3). Then, again back move to L=3, where there is no selected vertex in SC(3), new back move to L=2, A(4,8)=Orb(1).A(4,8,1)=2,1=2 and - 29 - selected vertex in SC(2) is 10, П3=П(4,10) = 2947561081,3, П43 = П(4,10,1) = 29475610813 - n3, n3 =α2(n1), α2=(8,10). At this point, there are no selected vertices in SC(3) and SC(2), that's why back moves to L=3,2,1 are made and A(4) = Orb(8).A(4,8)=2.2=4. Here PART1 ends and PART2 starts generating two SFM, for vertices 5, 6  SC(1). The first SFM is: П(5)= 29564768,101,3, П(5,8)=29564768101,3, П(5,8,1)= 295647681013 - n4, n4 =α3(n1), α3=(4,5).(6,7). The second SFM is: П(6)= 9267541,38,10, П(6,1)= 926754138,10, П(6,1,8)= 92675413810 - n5, n5 =α4(n1), α4=(1,8)(2,9)(3,10)(4,6).(5,7). Orbits of A are: (2,9)(1,3,8,10)(4,5,6,7) and A=Orb(4).A(4)=4.4=16. A α4 α3 α2 α1 16 8 4 2 1 SC(1) SNSC( 1) L=1 П( )= П1 ) 4 ( A 4 2 1 4 5 6 7 SNSC( SC(2) 2) L=2 П(4)= П2 ) 8 , 4 ( A 2 1 8 10 L=2 П(5)=П2 8 10 L=2 П(6)=П2 1 3 SC(3) L=3 П(4,8)= П3 1 3 L=3 П(4,10)= П3 ) 1 , 8 , 4 ( A 1 ) 1 , 0 1 , 4 ( A 1 1 3 L=3 П(5,8)= П3 1 3 L=3 П(6,1)= П3 8 10 n1 = 29475681013 = П(4,8,1) α1 = (1,3) = (n1 ~ n2); orbits: (1,3)(2)(4)(5)(6)(7)(8)(9)(10) n3 = 29475610813 = П(4,10,1) α2 = (8,10) = (n1 ~ n3); orbits: (1,3)(2)(4)(5)(6)(7)(8,10)(9) n4 = 29546781013 = П(5,8,1) α3 = (4,5)(6,7) = (n1 ~ n4); orbits: (1,3)(8,10)(4,5)(6,7)(2)(9) n5 = 92675413810 = П(6,1,8) α4 = (2,9)(4,6)(5,7)(1,8) = (n1 ~ n5); orbits: (1,3,8,10)(2,9)(4,5,6,7) Figure 15. Search tree for the graph of Fig, 14 - 30 - 5.3.2. Example with all cases (CS1, CS2, CS3, CS4) (Figure 16 ) The example is for graph G=B52 (Mathon [29]), regular graph, n=52, degree=25, Aut(G)=12, orbit lengths: 2*2+4*6+2*12; orbits: (4,30)(24,50) (21,37, 12,38,11,47) (17,36,16,42,10,43) (8,44,39,18,13,34) (26,35,28,2,9,52) (29,25,22,15,20,33,7,46,41,48,3,51) (40, 6,49,45,5,1,27,31,19,23,32,14). We show in Figure 16 only the subtrees of the selections (4,11), (4,13), (4,14) and (4,24) of the search tree. The first selected vertex in П1=1,2, . . . ,52 is the vertex 4 since it is from one of the smallest orbits – the orbits are found by the heuristic algorithm. We start the consideration from the selections (4,11,51) – this is the numeration n52: it is not equivalent to any numeration from B(4,2), B(4,3), B(4,10). Before these selections there were determined the bouquets of the representatives B(4,2), B(4,2)=9, B(4,3), B(4,3)=37, B(4,10), B(4,10)=15, i.e., totally 51 nonequivalent numerations. These bouquets are derivatives of FRPO of the set {2, 3, 7, 9, 10} – these vertices precede the selected vertex 11 in SC(П2), П2=П(4). There are no bouquets for the vertices 7 and 9 since they are similar to previous vertices in SC(П2) under A(4): 7-3, 9-2. We have LP=LMIN=2 at the selections (4,11,51). Before these selections there are found 4 generators of A(4), its order, orbits and some stabilizers. At the selections (4,11,51) the case CS3 has been discovered. That's why the selected vertex 51 in SC(П3), П3=П(4, 11) becomes a new starting start point: all information about the stabilizer A(4) obtained so far is lost and A(4)=A(4,11)=A(4,11,51)={I}, LP=LMIN=3, XFLMIN=51, A(XFLMIN)=1. The next selected vertex in SC(П3) is 7. The numeration П(4, 11, 7) is equivalent to numeration n52. Thus a new generator α5 for A(4,11) and A(4) is found (this is case CS2), α5= (1,6)(2,52)(3,41)(4)(5,45)(7,51)(8,39)(9)(10,43)(11)(12,21)(13,34)(14,23)(15,29)(16)(17,3 6)(18)(19,31)(20,22)(24)(25,33)(26,28)(27,32)(30)(35)(37)(38,47)(40,49)(42)(44)(46,48)(5 0). Then, we compute A(XLMIN-1)=A(XFLMIN)Orb(XFLMIN, A(XLMIN)), i.e., A(4,11)=Orb(51, A(4,11)).A(4,11,51)=2*1=2. The next selected vertex in SC(П3) is 9 - the partition П4=П(4, 11,9) is not discrete: A(4, 11,9)= A(4, 11)/Orb(9, A(4, 11))=2/{9}=2/1=2. Then, the next selected vertex in SC(П4) is 46 and П5=П(4, 11,9,46) is discrete (numeration n53). The numeration n53 is not equivalent to the numeration n52 and A(4, 11,9,46)= A(4, 11,9)/Orb(46, A(4, 11,9))=2/{46,48}=2/2=1 – this is CS1. The vertex 48 is not selected in SC(П4) since it is similar to the vertex 46 under A(4, 11,9). Then, a backward move to L=3 and a selection of the vertex 10 are made. The partition n54 is discrete and not equivalent to any numeration in B(4,11), A(4,11,10)= A(4,11)/Orb(10, A(4,11))=2/2=1 (the case is CS1). The vertex 43 in SC(П3) is not selected because it's similar to the vertex 10 under A(4, 11). The next selected vertex in SC(П3) is 48- the partition П4=П(4,11,48) is not discrete, so we do forward move to L=4 and choose vertex 27 in SC(П4). The numeration П5=П(4,11,48,27)=n55 is not equivalent to any numeration in B(4,11): A(4,11,48,27)=A(4,11)/Orb(48,A(4, 11))/Orb(27, A(4,11,48)) = 2/{46,48}/{27,32} =2/2/2=0.5<1. This is case CS3. So, the vertex 27 in SC(П(4,11,48)) becomes a new starting start point: all information about the stabilizer A(4,11) is lost, A(4)=A(4,11)=A(4,11,48)=A(4,11,48,27)={I}, LP=LMIN=4, XFLMIN=27, A(XFLMIN)= - 31 - Figure 16. The search tree ST for the graph B52 - 32 - L=1L=2L=3L=45225...3114CS1α523791011134578951791043484218324624274648273274318244648322727323474610311445679101112146101112131415675...1254125657n1n9n36n51n52n53n54n55n56n57n58n59n60n61n62n63n64n655148n665α6α72622222212221122122CS4CS1CS1CS1CS1CS2CS1CS1CS1CS1CS1CS3CS1CS3CS2CS1CS1CS1.........n8n50n35622348181431512734891113CS1CS1CS1CS1n67n68n69n701111 Figure 16A. The search tree ST for the graph B52 (continued) A(4,11,48,27)=1. We omit the description of the next selections in SC(П3)= SC(П(4,11)). We only mention the occurrence of CS2: the generator 6=5 that leads to gen(A(4,11))= {6}, A(4,11)=2 and the orbits of A(4,11) equal to the cycles of A(4,11). After the SC(П(4,11)) has been traversed a backward move to L=2 follows: LP=LMIN=2, B(4,11)={n52,n52,...,n64}, B(4)={n1,n2,...,n63}), XFLMIN=11, A(XFLMIN)= A(4,11)=2. The next selected vertex in SC(П2) is 13: the partition П3=П(4,13) is not discrete, we do forward move to L=3 and choose the vertex 3 in SC(П3). The numeration П4=П(4,13,3) - 33 - L=1L=2L=3L=45225314...CS12379101424457101451791043484218324624273843471010424567910111215...12412559n1n9n36n78n77n75n73n71n72n74n76n79n813214n83α9221CS1CS1CS3CS1.........n8n50n356...231918131189CS1CS1CS1CS1CS1CS1CS1CS1CS181314n80n823α812...3112...1132544CS2CS2n51...n63n64...n70...n67CS1n84n8511122262 (n64) is not equivalent to any numeration in B(4). The order of its stabilizer is A(4,13,3)=A(4)/Orb(13, A(4))/Orb(3,A(4,13)) =2/{13,34}/{3} =2/2/1=1 (CS1). After the selection 47 in SC(П3) and 31 in SC(П4) we obtain the numeration n65=П5=П(4,13,47,31) that is not equivalent to n65 and A(4,13,47,31)=A(4)/Orb(13,A(4))/Orb(47,A(4,13))/Orb(31,A(4,13,47))=2/{13,34}/ {47}/{31}=2/2/1/1=1 (CS1). After the selection 14 in SC(П4) we have the numeration П(4,13,47,14), LP=4, LMIN=2. Numeration П(4,13,47,14) is equivalent to previous one n65. Thus, a new generator α7 = (1,49) (2,9)(3,46)(4)(5,40)(6,45)(7,41)(8,44)(10)(11,38)(12,37)(13)(14,31)(15,33)(16,17)(18,34)( 19,32)(20,29)(21)(22,25)(23,27)(24)(26)(28 35)(30)(36)(39)(42,43)(47)(48,51)( 50)(52) for A(4) is found and the new orbits are Orb(A(4))={1,5,6,40,45,49}{2,9,52}{3,7,41,46,48,51}{4}{8,39,44} {10,42,43}{11,38,47} {12,21,37}{13,18,34}{14,19,23,27,31,32}{15,20,22,25,29,33}{16,17,36}{24}{26,28,35} {30}{50} and the order of the stabilizer A(4) is A(4)=A(4,11).Orb(11,A(4))=2.3=6 (XFLMIN=13). Then, a check for CS2/CS4 follows (LMIN=2<LP=4). We check for NRO for each vertex ZLFRPO(XL), L=LMIN+1,...,LP=3,4, i.e., if there are changes of the orders A(4,13,3) and A(4,13,47,31). The order of A(4,13,3) before α7 is A-α7(4,13,3) = A-α7(4)/Orb(13,A-α7(4))/Orb(3,A-α7(4,13))=2/2/1=1 and after α7 it is A(4,13,3)=A(4)/COrb(13,A(4))/COrb(3,A(4))=6/13,18,34/3,46,51,48=6/3/4=0.5. This difference (A-α7(4,13,3) =1  A(4,13,3) = 0.5) shows that the orbit Orb(3,A(4,13))={3,46,51,48} under A(4,13) is incorrect, it is united orbit, i.e., the case is CS4. (As we'll see later, the correct orbits are {3,46}{51,48}). Hence, the check for A(4,13,47,31) is not necessary. As the case is CS4 we set LP=4 (not changed), LMIN=LP, gen(A(XLMIN-1)=gen(A(4,13,47))={α7}; Orb(A(4,13,47))=cycles of α7 and A(4,13,47))=2 (the least multiple of the cycle lengths of α7). We also set XFLMIN=31 and we start the selection of a new vertex from the current XLP=14 and since it is the last vertex in SC(П4) we make a move back to the level L=3 selecting the vertex 46. We omit the following actions of the algorithm. We only mention the last generators α8=(1,5)(2)(3,51)(4)(6,40)(7,46)(8)(9,52)(10,42)(11,47)(12)(13,18)(14,32)(15,22)(16,36)(1 7)(19,23)(20,33)(21,37)(24)(25,29)(26,35)(27,31)(28)(30)(34)(38)(39,44)(41,48)(43)(45,4 9)(50) (14,27,19) (15,20,25)(16,17,36)(22,29,33)(23,31,32)(24)(26,35,28). The orbits due to the generators α8 and α9 are: Orb(A(4))={1,5,6,40,45,49}{2,9,52}{3,7,41,46,48,51}{4}{8,39,44}{10,42,43}{11,38,47} {12,21,37}{13,18,34}{14,19,23,27,31,32}{15,20,22,25,29,33}{16,17,36}{24}{26,28,35} {30}{50} and A(4)=Orb(XFLMIN,A(4)).A(4,XFLMIN)=6.1=6, where XFLMIN=14. The last generator found by PART2 is α10=(1,27)(2,28)(3,29)(4,30)(5,31)(6,32)(7,33)(8,34)(9,35)(10,36)(11,37)(12,38)(13,39) (14,40)(15,41)(16,42)(17,43)(18,44)(19,45)(20,46)(21,47)(22,48)(23,49)(24,50)(25,51) (26,52). The orbits of A due to the generators α8, α9 and α10 are given at the beginning of this section and A=A(4)Orb(4,A)=6*2=12. Thus, the output is: A=12, Orb(A) and generators α8, α9 and α10. - 34 - Figure 17. The search tree for A50 rigid graph 5.3.3. Example of a search tree for a rigid graph The example is for graph A50, Mathon [29], n=50, regular bipartite graph, k=105=15*7+35*3, Error! Reference source not found..). The bouquet B(1)=168, SC(П2)=14, each selected cell SC(П3) has size SC(П2)=12. The search tree is full. 5.4. Correctness and analysis of the algorithm We do not prove formally the correctness of the algorithm but it follows from the description of the algorithm. If the bouquets of each representative of an orbit in SC(ПLP) are correct and the whole orbit of each selected vertex in SC(ПLP) is traversed then according to Theorem 4 GOO(A(XLP-1)) and B(A(XLP-1)) will be determined correctly. The main problem is to guarantee the correctness of the bouquets - this is shown in the description of the cases CS1, CS2, CS3 and CS4. The traversal of the whole orbit of each selected vertex in SC(ПLP) is also guaranteed (Figure 9). The formal correctness prove of the algorithms and their analysis will be presented in a new article.. 6. Vsep-is algorithm for graph isomorphism(GI algorithm) Vsep-is algorithm finds an isomorphism between two graphs G1(n1,k1), G2(n2,k2), if any. It is based on Corollary 3 of theorem 3 and theorem 4. Firstly, it checks for some necessary conditions for isomorphism: a) n1=n2?; b) k1=k2? c) equality of sorted degree sequences of vertices of G1,G2;c) compatibility of π1=RP(G1,πu); π2=RP(G2,πu); d) equality of indices of the target cells of π1and π2. If one of these conditions does not hold the graphs are not isomorphic. Otherwise, the bouquet B(x1, G1) is determined by applying PART1 to the first vertex x1SC(π1). Then, by applying PART2 for each vertex ySC(π2,G2) is generated one numeration that is compared with the numerations of the bouquet B(x1,G1) for an isomorphism, If there is an isomorphism for the current numeration then a message 'G1G2', printing the isomorphism and stop follows. If all numerations (instruction 6) derived from each vertex - 35 - 38 37 36 LK=4 L=1 L=2 L=3 15 14 1 12 12 12 12 ySC(π2,G2) do not form an isomorphism with the bouquet B(x1,G1) then a message that the graphs are not isomorphic follows. Input: Graphs G1(n1,k1), G2(n2,k2), Output: G1 and G2 are isomorphic or no; print the isomorphism if any 1: if (n1≠n2 or k1≠k2 or ordered sequences of vertex degrees of G1,G2 are not equal) then output 'G1!G2';return end if 2: Define π1=RP(G1,πu); π2=RP(G2,πu); if π1,π2 are not compatible then message 'G1!G2'; return end if 3. Define SC(π1), SC(π2); if(index(SC(π1)) ≠ index(SC(π2)))then output 'G1!G2'; return end if 4. Apply PART1 to the first vertex x1SC(π1) to determine the bouquet B(x1,G1) 5. for each vertex ySC(π2,G2) do determine one numeration num by applying SFM(y); compare num with the bouquet B(x1,G1) for isomorphism; if there is an isomorphism then output 'G1G2' and the isomorphism; return end if end for Figure 18. Vsep-is algorithm 6. output 'G1!G2' 7. The heuristic algorithms (Vsep-orb, Vsep-hway, Vsep-sch) They are based on Theorem 3. For determining whether two vertices x and y are similar two partial bouquets are built for both vertices and then, some automorphisms between the numerations of these bouquets are determined. To determine certainly that x and y are similar one of the bouquets should be full. Consequently, the probability to find at least one automorphism mapping x to y is less than 1 if we use the algorithm with partial bouquets. This makes the algorithms inexact. Instead, less time is needed for bouquets building and less storage is needed for them because of their smaller sizes. We describe two heuristic algorithms Vsep-orb, and Vsep-hway in this section. 7.1. TABLE1 and TREE4 procedures These procedures are needed for the following description of the heuristic algorithms. TABLE1 heuristic procedure generates in SC(П) numerations by the operations fork and RRST. Each new numeration is compared with previously found numerations (stored in HT) for an automorphism. If there is an automorphisn it is added to previously found set of generators. If there is no an automorphism the numeration is put into HT. RRST tree is defined by the parameters W (width) and D (depth): for each level L, 1< L ≤ 1+D, in SC(ПL) the number of selected vertices is W. The experiments show that when the selected vertices are evenly distributed in SC(ПL) of RRST the results are more correct compared - 36 - Input: G- a graph, П – a stable partition, W, D – a width and a depth of the reduced regular search tree RRST; Output: Generators and orbits of A=А(G, П) stabilizer, norb - a number of orbits; Local variables: HT- a hash table of partial bouquets of generated numerations T1: Initialization: Set Orb(A(G, П) to discrete orbits; gen( A):=; HT empty; T2: Find SC(П) target cell; T3: Select each vertex xSC(П) that is not similar to a previous vertex in SC(LB) under current orbits. Generate a numeration n1 for x vertex by a series of forward move and compare it for an automorphism  with the numerations in HT .If there is  then: gen(A) :=gen(A)  {} and determine new Orb(A(G, П) and norb. If there is no  then add n1 into HT. We call this operation a fork. T4: A reduced regular search tree (RRST) is built for each representative of the orbits in SC(LB) determined so far. The orbits are sorted in increasing order of their lengths starting from the smallest one. Each representative of an orbit is a root of a tree. The depth of RRST is D. Each node of the RRST corresponds to a selection level L, 1 < L ≤ 1+D and a target cell SC(L). In each SC(ПL) a fixed number W of vertices y are selected, then a forward move to next level L is made for each y. In the 1+D level only a series of forward moves SFM is made for each selected vertex until a discrete partition (numeration n1) is obtained. The number W may be regarded as out- degree of the RRST node. The vertices in SC (ПL) are selected successively by step st= SC(ПL) / W ≥ 1 starting from the beginning of SC ПL), i.e. they are evenly distributed in SC(ПL). To determine an automorphism  and new orbits each numeration n1 is compared with the numerations in HT table. If there is  then: gen(A) :=gen(A)  {}, new Orb(A(G, П) and norb are .determined. If there is no  then add n1 into HT. The procedure stops when RRSTs are generated for all representatives of the orbits in SC(ПL). Figure 19. TABLE1 procedure Input: graph G, equitable partition П, parameters mbrsyvp,wth1, b1a, dpth1, br2a Output: GO(A(П)), norb – number of orbits of A(П) 1: DO wth=wth1, wth1+br1a 2: DO dpth=dpth1, dpth1+br2a 3: TABLE1(П, WTH, DPTH, norb) 4: IF (norb=1 or SC(П1) contains one orbit or norb remains unchanged after mbrsyvp number of successive calls to TABLE1) then 5: exit 6: end if 7: END DO 8:END DO Figure 20. TREE4 procedure - 37 - with other ways of distribution. One call to TABLE1 procedure with fixed parameters W and D usually is not sufficient to determine а correct GO(A). That's why several calls to TABLE1 with different parameters (W, D) are needed – this is done by TREE4 procedure (Figure 20). The parameters of TREE4 have the following meaning: mbrsyvp – maximal number of successive calls to TABLE1 with no changed norb, wth1 – the start value of W, wth1+br1a - the last value of W, dpth1 – the start value of D, dpth1+br2a - the last value of D. The parameters have default values but there is a possibility the user to change them. 7.2. Vsep-orb algorithm It has two main steps S1 and S2: S1) Determine the orbits Orb(G, Π) by an heuristic TREE4 algorithm (Figure 20); S2) Use PART1, PART2 algorithms to determine GOO(G, ΠORB), where ΠORB is a partition which cells to the orbits found in S1 (orbit partition). TREE4 does not guarantee the computation of the exact orbits of GOO(G, Π) and consequently Vsep-orb is an heuristic algorithm - it does not guarantee the computation of the exact GOO(G, Π). But if the parameters of Vsep-orb are selected in proper way the probability of the exact computation of GOO(G, Π) is very close to 1. The experiments confirm this. 7.3. Vsep-sch algorithm Vsep-sch algorithm has two main steps: S1) Determine the base points, generators and orbits of Aut(G, Π) by TABLE1 heuristic algorithm (fig. 18) applied with a parameter LB = 1; S2) Determine the order Aut(G, Π) using Schreier-Sims algorithm [5,31,32] on the base points and generators found in S1. Obviously, at this step the strong generators (see the definition below) of Aut(G,Π) are determined. Recall [32] that a base for a group A is a sequence of points B=[1,2,…, m] such that the stabilizer 𝐴𝛽1,𝛽2 ,…,𝛽𝑚 = 𝐼. Schreier-Sims algorithm determines a chain of stabilizers A=A(1) ≥ A(2) ≥ . . . ≥ A(m) ≥ A(m+1) = I, where 𝐴(𝑗) = 𝐴𝛽1,𝛽2,…,𝛽𝑖−1. Each stabilizer A(j) is represented by a series of all right cosets to A(j+1) A(j) = A(j+1) \ A(j) = A(j+1) ∪ A(j+1) α2 ∪ A(j+1) α3 ∪ . . . ∪ A(j+1) αn The collection of elements in A(j+1) \ A(j) , j=1,2, . . . ,m are called strong generators for A toward B. The algorithm [33] is constructing a table T(n,m) of strong generators, where T(i,j) is an element of the group A which fixes 1, 2 ,…,j-1 and maps j to i. If no such element exists, then the entry is empty. The non-empty elements of the j-th column of T form a set of coset representatives U(j) of A(j+1) in A(j). The step S2 algorithm (fig. 21) uses a procedure called sift (fig. 22) that for a given automorpism α compares (j) with y=α((j)), j=1,2,…,m: (a) if y= (j) then a pass to the next base point (j+1) follows; (b ) if y ≠ (j) then a check if α belongs to the stabilizer A(j) follows, i.e. if T(y,j) is empty or no. If T(y,j) is empty then T(y,j) = α, the number of nonempty elements in column j of T is increased by 1, c(j)=c(j)+1, and the sift ends. If - 38 - T(y,j)=γ then a new automorphism α = γα-1 is determined and all above actions are applied to α for the next base points (j+1). The procedure sift modifies the table T by inserting at most one new coset representative. Step S2 algorithm is with base points - that is the difference from FHL version of Schreier- Sims method in [33]. When the first 3 instructions of S2 algorithm are finished, the table T should have the property that α ε A iff α can be expressed as a1a2 . . . am , where ai is a member of the j-th column of T. This is called canonical representation of α toward B. The time complexity of step S2 is O(n6) [33,34] Input: n, generators, B - base points, m==B Local variables: T(n, m)-2 dimensional integer array, c – integer array of size m, c(j) is the number of nonempty elements in column j of T; Output: Aut(G, Π) 1; Set each element of c to 1;Set each element T(i,j) empty; 2: sift(n, α,B,m,T,c,) {Pass each generator to the procedure sift}; 3: sift(n,γ,B,m,T,c,) {Pass the product γ of each pair of representatives in T to the procedure sift until no new element is inserted in T}; 4: Determine the order Aut(G, Π)=∏ 𝑐(𝑗) . 𝑚 𝑗=1 Figure 21. S2 step of Vsep-sch algorithm Input: n,α, B, m, T, c; c-array of size m=B,c(j) is the number of nonempty elements in column j of T;Output: T,c 1: for j:=1 to m do 2: y:= α(B(j)) 3: if(y=B(j)) cycle 4: if (T(y,j) is empty) then 5: T(y,j) := α; c(j) := c(j)+1; return 6: else 7: γ := T(y,j); α := γα-1 8: end if 9: end for Figure 22. sift procedure 8. Vsep-a automatic version of Vsep algorithm Experiments show that Vsep-sch algorithm runs long for graphs with large Aut(G) (small number of orbits), especially for transitive graphs. In these cases T table is large and full or almost full and evidently this causes more computation. On the other hand, Vsep-orb runs fast on such graphs. This is the reason for developing Vsep-a algorithm that chooses Vsep- orb when the number of orbits is small (≤ 3) and Vsep-sch otherwise. There are also other criteria for this selection. Vsep-a algorithm also chooses Vsep-e algorithm for many graphs on the base of some criteria, for example for some non-regular graphs. - 39 - 9. Program implementation of Vsep algorithms All proposed algorithms in this paper are implemented in Fortran programs that can be compiled by any Compaq Fortran compiler. The program version published on author's web site section My Programs [35] is called VSEP_PUB4. It implements Vsep-e, Vsep- orb, Vsep-sch and Vsep-a version of VSEP algorithms. The user may choose any version and set different parameters (see user guide). 10. Experimental results In this section we present: a) experiments on almost all benchmark graphs from [19] that compare the performance of VSEP_PUB4 program with Traces (nauty2.6r5 [19]) (Table 4) –one of the most competitive known tool for the worst cases; b) The running times of VSEP_PUB4 for whole families of some benchmark graphs are given in Table 5. Some of the experimental results from VSEP _PUB4 (as they are received from the program) are in RESVSE4P_PUB4OBSHT file given in [35]. The most difficult graphs for our algorithms are the graphs with Aut(G)=1 or with small Aut(G). It is known that none of the known algorithms outperform others for all graphs. For each algorithm there are specific difficult and easy graph families. A graph family may be easy for one algorithm and very difficult for another. The same is for Vsep and Traces. Even more, for Vsep different cell selectors give different running times – none of the cell selectors outperform others. The chooser of cell selectors does not always choose the optimal cell selector. For each result we show the cell selector for which it is obtained. The experiments were carried out on a laptop Dell, CPU: Intel(R) Core (TM) i5-3317U@ 1.7 GHz, Memory: 8 GB, OS: 64 bit Microsoft Windows 7 Profesional. For the experiments, we have used all the benchmark graphs of nauty&Traces page [19] that includes a variety of graph families with different characteristics. We show mostly the results for the graphs that are worst cases for either of the compared tools and cell selectors for which they are obtained (only for Vsep). It is evident (See Table 4) that Vsep outperforms Traces considerably for the graphs tnn(39)_1014-1, chh_cc(7-7)_1078-1, f-lex-srg-10-1 and f-lex-srg-50-1 . On the other side Traces outperforms Vsep-e considerably for the graphs of projective planes (pp- 16-14, 15, 22, pp-25-90, 116) , had-112, had-176 and latin-sw-112 but for the same graphs Vsep-a outperforms Traces considerably. There are no essential differences between Vsep and Traces on the other graphs on the Table 4! Traces is slow for the graphs with large order of the automorphism group and large number of generators – my experience show that this is may be due to the use of Schreier-Sims method. The main disadvantage of Vsep-e is the storing of the whole bouquet of the first selected vertex- millions of words for some graphs. For almost all benchmark graph families the heuristic versions are many times faster than the exact one and at correctly chosen parameters give correct results. - 40 - G graph, n*, minval*, maxval*, Aut(G), norb* tnn(39)_1014-1, 1014, 4,312, 6.314790834154e174,12 cmz-50, 1200,2,5, 1.267650600228e32,8 ag-49,4851,49,50, 2.710632960000e10,2 cfi-200,2000, 3,3, 2.535301200456e30, 800 chh_cc(7-7)_1078-1 1078,3,45,4.907372642035e71,8 had-128,512,129,129, 1.073807313661e19,1 had-112,448,113,113, 1677312,1 T in seconds Traces vsep-e* izb*, bouquet size*.par* 5654.38 0.08 1.01, 1,1,nop 0.83, 4,1,nop 0.14, 1, 1,nop vsep-a* selected version(orb for vsep-orb,shc for vsep-sch,e-for vsep-e),izb*,par* 1.03,e,1,nop 0.80,e,4,nop 0.13,e,1,nop 0.11 0.14, 1,21,nop 0.14,e,1,nop 0.14 NA 1.17, 1,4,nop 1.06,4,4,nop 0.17, 1,1,nop 1.17,e,1,nop 1.07,e,1,nop 0.17,e,1,nop 0.02 0.11,3,def 0.05 had-176,704,177,177. 15257088,1 0.14 had-256,1024,257,257, 1.401962828716e24,1 latin-30.dre,900 ,87,87, 43200.1 latin-sw-30-1,900 ,87,87, 1,900 0.05 0.03 0.17 had-sw-112,448,113,113, 2,224 1.61 lattice-30.dre, 900 , 58,58, 1.407181592771e65,1 10cube,1024,10,10, 3.715891200e9,1 0.02 0.05 85.75,1,32287,de f 429.75,1,21210,d ef 0.61,1,1,def 0.71,1,1106,def 0.66,4,962,def 4.33, 1,812; 1,2,1,1,1 179.7,1, 519624; 1,2,1,1,1 0.09, 1 ,1,def 0.11, 1,1,def 0.11,e,1,def 0.42.e,1,def 1.88,e,1,def 0.62,e,1,def 1.33.e,1,def 3.16,e,1; 1,2,1,1,1 16.69,sch,1,def 0.61,sch, 1,2,1,1,1 0.12,orb,1,def 0.11,orb, 1,def 0.15,orb, 1,def 2.00,orb,1,def paley-461.dre ,461,230,230, 1.06030e5,1 pg2-49, 4902,50,50, 1.328752276992e14,1 pp-16-14,546,17,17, 2304,14 0.02 0.14, 1,1,def 0.11 2.00, 1,21,def 0.66 55.24, 1, 420960; 0.44,sch,1; - 41 - G graph, n*, minval*, maxval*, Aut(G), norb* T in seconds Traces vsep-e* izb*, bouquet size*.par* pp-16-22,546,17,17, 9216,10 0.55 pp-25-1,1302,26,26, 609336000000,2 0.05 pp-25-90,1302,26,26,1000,40 42.62 pp-25-116,1302,26,26, 500,64 104.82 pp-27-10, 1514,28, 28, 122472,6 1.05 pp-49-1,4902,50,50,288120,10 236.87 3,3,2,1,1 8.50, 2, 52680; 3,3,2,1,1 15.4, 1,117264; 3,3,2,1,1 2.26,2,13336; 3,3,2,1,1 0.12,2,10; 3,3,2,1,1 242.6, 2, 522995, 3,3,2,1,1; 2244.03,1, 5016276,def 500.0, 2 , 1058568, 3,3,2,1,1 40.0,,2, 73008 3 5 2 1 1 5631.0, 2, 1975680; 2,5,2,2,1 5600.0, 4, 1975680 2,5,2,2,1 5529.05, 2, 1975680 2,5,2,2,1 vsep-a* selected version(orb for vsep-orb,shc for vsep-sch,e-for vsep-e),izb*,par* 3,3,2,1,1 0.26,sch,1; 3,3,2,1,1 0.12,orb,1, 3,3,2,1,1 9.7,sch,1; 3,3,2,1,1 6.00,sch,1, 3,3,2,1,1 4.59,sch,2; 3 5 2 1 1 117.4,1; 2,5,2,2,1; 90.1,2; 2,4,2,2,1 0.22, orb,1,def mz-aug-50,1000,3,6, 101412048018258352119736256430 08,250 mz-aug2-50,1200,2,5, 507060240091291760598681282150 4,700 mz-50,1000,3,3, 0.00 0.22,1,1,def 0.00 0.54,1,1,def 0.53,orb, 1,def 0.00 0.22,1,1,def 0.20,orb, 1,def - 42 - G graph, n*, minval*, maxval*, Aut(G), norb* 101412048018258352119736256430 08,250 f-lex-reg-50-5,1700, 8,30,16384,1016 f-lex-srg-10-1,790,16,75,16,,439 T in seconds Traces vsep-e* izb*, bouquet size*.par* vsep-a* selected version(orb for vsep-orb,shc for vsep-sch,e-for vsep-e),izb*,par* 0.06 0.42,1,2,def 0.42,orb,1,def NA NA NA 0.17,sch,2; 2 2 1 2 2 10.69,sch,2; 2 2 1 2 2 NA f-lex-srg-50-5,3950, 16,75,32768,2360 Table 4. Experimental comparison of VSEP4P_PUB4 program with Traces. n - number of vertices, norb-number of orbits, vsep-e - exact version, vsep-a – automatic version, izb - the numbering of the chosen cell selector; minval, maxval - minimal and maximal degree of a vertex of the graph, bouquet size – number of the stored numerations; PAR – parameters mbrsyvp, wth1, dpth1, br1a, br2a; 4,5,2 ,1,1 are default parameters (def=default),nop-no parameters since there is no call to tree4;NA-not attended Graph family Parameters: mbrsyvp, wth1, dpth1, br1a, br2a; 4,5,2 ,1,1-default (def) mathon mathon dobling tnn tnn cmz ag chh cfi cfi latin lattice hypercubes3 paley ppsmall pp16 pp16 pp16 pp25 pp27 pp27 Def Def Def Def Def Def Def Def Def Def Def Def Def Def 3 3 2 4 1 3 3 2 2 1 3 3 2 1 1 3 3 2 1 1 Def 3 5 2 1 1 izb T[secs]-running time 0.1248 0.312 3.97 3.31 2.37 0.71 2.19 38.94 36.77 3.79 0.99 0.25 1.90 0.56 7.28 7.22 7.19 746.11 60.66 57.60 1 1 1 4 1 1 1 1 4 1 1 1 1 1 1 1 1 1 2 2 - 43 - Graph family Parameters: mbrsyvp, wth1, dpth1, br1a, br2a; 4,5,2 ,1,1-default (def) pp27 pp27 pp27 pp27 pp27 pp27 pp27 pp27 pp27 pp27 pp27 pp49 pp49 pp49 had had had f-lex=srg f-lex=reg pg pg pg mz-aug mz-aug2 total run time for all cases in the table 3 5 2 1 1 3 4 3 4 2 3 4 3 4 2 2 4 3 4 2 3 4 3 3 2 3 4 3 4 1 2 4 3 3 2 2 4 3 3 1 2 4 3 4 1 2 4 3 2 1 2 4 3 1 1 3 5 2 2 1 2 5 2 2 1 2 5 2 2 1 4 5 2 1 1 4 5 2 1 1 3 6 2 1 1 2 2 1 2 2 Def Def 3 4 2 1 1 3 3 2 1 1 Def Def izb T[secs]-running 3 1 2 2 2 2 2 2 2 2 2 1 2 1 1 3 3 2 1 1 1 1 1 1 time 58.26 68.53 88.54 70.76 88.90 60.31 76.32 68.62 75.48 69.28 68.82 505.00 349.60 365.10 293.28 278.40 281.36 589.29 18.47 7.84 7.80 7.80 2.09 3.77 4478.15 Table 5. Experimental results from VSEP4P_PUB4 program for whole families of the most of the benchmark graphs in [19], some of the results are in RESVSEP4OBSHT file [35], izb is the numbering of the chosen cell selector 11. Concluding remarks and open problems Five new algorithms, named Vsep, are described. Four of them are for determining the generators, orbits and order of an undirected graph automorphism group:. Vsep-e – exact, Vsep-orb and Vsep-sch – heuristic and Vsep-a automatically selects the optimal version among Vsep-e, Vsep-orb and Vsep-sch. The fifth algorithm, Vsep-is, is for finding an isomorphism between two graphs. A new approach is used in the exact algorithm: if during its execution some of the searched or intermediate variables obtain a wrong value then the algorithm continues from a new start point losing some of the results determined so far (cases CS3, CS4). The new start point is such that the correct results are obtained. A new code, named S-code, of a partition of the graph vertices is proposed. S-code is used for reducing the time of comparing the partitions in the proposed algorithms. The experiments show that the worst case time complexity of Vsep-e for an arbitrary graph is exponential but for some classes it is polynomial. The main difference of the exact one and the widely known tools is the storing of the whole bouquet of numerations of the first - 44 - selected vertex in the first level. Five cell selectors are used in the algorithms and a chooser of optimal cell selector is presented. Some of the cell selectors are new, namely mxvectchval and mxprchval. Experimental comparison of the proposed algorithms with Traces algorithm is made - it shows their worst and best cases. A disadvantage of Vsep-e algorithm is its higher requirements for memory (for some worst cases several millions of numbers are stored. The worst cases for the algorithm Vsep-e are the graphs with smaller order Aut(G), especially the rigid graphs. Vsep-orb and Vsep-sch heuristic algorithms are extremely fast (with some exceptions) compared with the exact one and are almost exact - for all tested thousands of graphs they give correct results. Practically, their requirements for memory are very small. Heuristic algorithms are an important approach for solving so hard problem as graph isomorphism is. The future work on developing Vsep algorithms will include: a) search for a new cell selector that will reduce the size of the search tree; b) search for a new chooser of a cell selector; c) conduct a comparison of Vsep algorithms with other known GOO algorithms; d) develop parallel versions of Vsep algorithms. Open problems are: i) Develop a new chooser of cell selector that given a graph can determine the best cell selector (that yields a minimal running time of the algorithm); ii) Develop an algorithm that given a graph and the first numeration can determine the parameters mbrsyvp, wth1, dpth1, br1a, br2a of the forest of reduced regular trees such that when used the heuristic versions of VSEP algorithms will give correct results for a minimal running time; iii) Develop an algorithm that given a graph on the base of some criteria to choose the optimal algorithm from the known published algorithms. Acknowledgements The author thanks to Brendan McKay, Bill Kocay, Rudi Mathon, Vladimir Tonchev, Ulrich Dempwolff, Gordon Royle, Adolfo Piperno, Jose Luis López-Presa, Petteri Kaski and Hadi Katebi for the extensive discussions on the graph isomorphism problem and exchanging graphs with interesting properties and papers on this problem. Special thanks to my former diploma student Apostol Garchev who contributed in performing and repeating some of the experiments on the developed algorithms. The author would like to thank all colleagues and students who contributed to this study. References [1] A. V Aho, J.E. Hopcroft, J.D. Ullman, The Design and Analysis of Computer Algorithms, 1974. [2] C.C.E. Leiserson, R.R.L. Rivest, C. Stein, T.H. Cormen, Introduction to Algorithms, Third Edition, 2009. doi:10.2307/2583667. [3] E. by J. van Leeuwen, Handbook of Theoretical Computer Science, Volume B Formal Models and Semantics, MIT Press, 1994. https://mitpress.mit.edu/books/handbook-theoretical-computer-science-0. edited by M.I. Nechepurenko, Algorithms and Programs for Solving Problems on - 45 - [4] Graphs and Networks, Nauka, Novosibirsk, 1990. http://mt3.org/bloog/wodolaz/39.html. [5] K. D. L., D. R.Stinson, Combinatorial Algorithms, CRS Press (1999)., CRS Press, 1999. [6] F. Harary, Graph theory 1736–1936, Hist. Math. 4 (1977) 480–481. doi:10.1016/0315-0860(77)90099-4. [7] F. Harary, E.M. Palmer, Graphical Enumeration, 1973. http://oai.dtic.mil/oai/oai?verb=getRecord&amp;metadataPrefix=html&amp;identifie r=AD0765600. [8] R.B. Ash, Abstract Algebra : The Basic Graduate Year, Nature. 169 (1952) 167–168. [9] doi:10.1038/169167b0. J.L. Gross, J. Yellen, Handbook of graph theory, 2004. doi:10.1016/0304- 3878(86)90037-4. [10] C.M. Hoffmann, Group-Theoretic Algorithms and Graph Isomorphism, Lecture No, Springer-Verlag ., 1982. http://link.springer.com/book/10.1007/3-540-11493-9. [11] P.J. Cameron, Automorphisms of graphs, J. Math. Sci. 72 (1994) 3341–3343. doi:10.1007/BF01261692. [12] B.D. McKay, Practical Graph Isomorphism, Congr. Numer. 30 (1981) 45–87. http://users.cecs.anu.edu.au/~bdm/papers/pgi.pdf. [13] B.D. McKay, A. Piperno, Practical graph isomorphism, II, J. Symb. Comput. 60 (2014) 94–112. doi:10.1016/j.jsc.2013.09.003. [14] L. Babai, Moderately Exponential Bound for Graph Isomorphism, Proceeding FCT '81 Proc. 1981 Int. FCT-Conference Fundam. Comput. Theory. (1981) 34–50. http://dl.acm.org/citation.cfm?id=739270. [15] R. Mathon, A note on the graph isomorphism counting problem, Inf. Process. Lett. 8 (1979) 131–136. http://www.sciencedirect.com/science/article/pii/0020019079900048. [16] K.S.B. and C.J. Colbourn, Problems Polynomially Equivalent to Graph Isomorphism, 1979. https://cs.uwaterloo.ca/research/tr/1977/CS-77-04.pdf. [17] V.N. Zemljachenko, N.M. Korneenko, R.I. Tishkevich, Graph isomorphism problem, (1982) 83–158. doi:1007/BF02104746. [18] L. Babai, Graph Isomorphism in Quasipolynomial Time, arXiv. (2016) 89. http://arxiv.org/abs/1512.03547. [19] B.D. McKay, A. Piperno, Nauty&Traces website, (n.d.). http://pallini.di.uniroma1.it/. [20] D.G. Corneil, C.C. Gotlieb, An Efficient Algorithm for Graph Isomorphism, J. ACM. 17 (1970) 51–64. doi:10.1145/321556.321562. [21] A.V.P. Faizullin,R.T., Heuristic algorithm for solving the graph isomorphism prob lem, 2002. http://arxiv.org/pdf/math/0205220.pdf. [22] G.-H.A.W.-G.T. KING, A New Graph Invariant for Graph Isomorphism:Probability Propagation Matrix, J. Inf. Sci. Eng. 15 (1999) 337–352. http://www.iis.sinica.edu.tw/page/jise/1999/199905_01.pdf. [23] H. Ogata, W. Fujibuchi, S. Goto, M. Kanehisa, A heuristic graph comparison algorithm and its application to detect functionally related enzyme clusters., Nucleic Acids Res. 28 (2000) 4021–4028. doi:10.1093/nar/28.20.4021. - 46 - [24] H.B. Mittal, A Fast Backtrack Algorithm for Graph Isomorphism, Inf. Process. Lett. 29 (1988) 105–110. doi:10.1016/0020-0190(88)90037-3. [25] S.D. Stoichev, Fast Adjacency Refinement Algorithm, in: Intern. Conf. Digit. Signal Process., Limassol, Cyprus, 1995: pp. 870–875. [26] J. Hopcroft, An n log n algorithm for minimizing states in a finite automaton, Reproduction. (1971) 189–196. http://oai.dtic.mil/oai/oai?verb=getRecord&metadataPrefix=html&identifier=AD071 9398. [27] A. Piperno, Search Space Contraction in Canonical Labeling of Graphs (Preliminary Version), arXiv. (2008) 1–21. http://arxiv.org/abs/0804.4881. [28] D.G. Corneil, C.C. Gotlieb, An Efficient Algorithm for Graph Isomorphism, J. ACM. 17 (1970) 51–64. doi:10.1145/321556.321562. [29] R. Mathon, Sample graphs for isomorphism testing, in: Proc. 9th S.-E.conf. Comb. Graph Theory Comput. Boca - Raton, 1978: pp. 499–517. [30] S.D. Stoichev, Vsep-New Heuristic and Exact Algorithms for Graph Automorphism Group Computation, (n.d.). arXiv:1007.1726v4 [cs.DS]. [31] M. Jaggi, Implementations of 3 Types of the Schreier-Sims Algorithm, (2005). http://www.m8j.net/data/List/Files-118/Documentation.pdf. [32] E.A. O'Brien., Toward effective algorithms for linear groups, pp. 163–190, in: Finite Geom. Groups, Comput. , Gruyter, Berlin (2006), Berlin, 2006: pp. 163–190. https://www.math.auckland.ac.nz/~obrien/research/survey.pd. [33] G.. Butler, Chapter 14. Complexity of the Schreier-Sims method, in: Lect. Notes Comput. Sci. Vol. 559 1991 Fundam. Algorithms Permut. Groups, Springer, 1991. http://link.springer.com/chapter/10.1007/3-540-54955-2_33#page-1. [34] M. Furst, J. Hopcroft, E. Luks, Polynomial-time algorithms for permutation groups, in: Found. Comput. Sci. …, 1980: pp. 36–41. http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4567802. [35] S.D. Stoichev, S.D. Stoichev's web page, (n.d.). https://sites.google.com/site/stoichostoichev2/my-programs. - 47 -
1510.01800
4
1510
2017-04-10T19:21:24
Logarithmic regret bounds for Bandits with Knapsacks
[ "cs.DS" ]
Optimal regret bounds for Multi-Armed Bandit problems are now well documented. They can be classified into two categories based on the growth rate with respect to the time horizon $T$: (i) small, distribution-dependent, bounds of order of magnitude $\ln(T)$ and (ii) robust, distribution-free, bounds of order of magnitude $\sqrt{T}$. The Bandits with Knapsacks model, an extension to the framework allowing to model resource consumption, lacks this clear-cut distinction. While several algorithms have been shown to achieve asymptotically optimal distribution-free bounds on regret, there has been little progress toward the development of small distribution-dependent regret bounds. We partially bridge the gap by designing a general-purpose algorithm with distribution-dependent regret bounds that are logarithmic in the initial endowments of resources in several important cases that cover many practical applications, including dynamic pricing with limited supply, bid optimization in online advertisement auctions, and dynamic procurement.
cs.DS
cs
Logarithmic Regret Bounds for Bandits with Knapsacks* Arthur Flajolet Operations Research Center Massachusetts Institute of Technology Cambridge, MA 02139 [email protected] Patrick Jaillet Department of Electrical Engineering and Computer Science Laboratory for Information and Decision Systems Operations Research Center Massachusetts Institute of Technology Cambridge, MA 02139 [email protected] Optimal regret bounds for Multi-Armed Bandit problems are now well documented. They can be classified into two cat- egories based on the growth rate with respect to the time horizon T : (i) small, distribution-dependent, bounds of order of magnitude ln(T ) and (ii) robust, distribution-free, bounds of order of magnitude √T . The Bandits with Knapsacks model, an extension to the framework allowing to model resource consumption, lacks this clear-cut distinction. While several algorithms have been shown to achieve asymptotically optimal distribution-free bounds on regret, there has been little progress toward the development of small distribution-dependent regret bounds. We partially bridge the gap by design- ing a general-purpose algorithm with distribution-dependent regret bounds that are logarithmic in the initial endowments of resources in several important cases that cover many practical applications, including dynamic pricing with limited supply, bid optimization in online advertisement auctions, and dynamic procurement. 1. Introduction. 1.1. Motivation. Multi-Armed Bandit (MAB) is a benchmark model for repeated decision making in stochastic environments with very limited feedback on the outcomes of alternatives. In these circumstances, a decision maker must strive to find an overall optimal sequence of decisions while making as few subop- timal ones as possible when exploring the decision space in order to generate as much revenue as possible, a trade-off coined exploration-exploitation. The original problem, first formulated in its predominant ver- sion in Robbins [21], has spurred a new line of research that aims at introducing additional constraints that reflect more accurately the reality of the decision making process. Bandits with Knapsacks (BwK), a model formulated in its most general form in Badanidiyuru et al. [8], fits into this framework and is characterized by the consumption of a limited supply of resources (e.g. time, money, and natural resources) that comes with every decision. This extension is motivated by a number of applications in electronic markets such as dynamic pricing with limited supply, see Besbes and Zeevi [11] and Babaioff et al. [6], online advertising, see Slivkins [22], online bid optimization for sponsored search auctions, see Tran-Thanh et al. [26], and crowdsourcing, see Badanidiyuru et al. [7]. A unifying paradigm of online learning is to evaluate algo- rithms based on their regret performance. In the BwK theory, this performance criterion is expressed as the gap between the total payoff of an optimal oracle algorithm aware of how the rewards and the amounts of resource consumption are generated and the total payoff of the algorithm. Many approaches have been pro- posed to tackle the original MAB problem, where time is the only limited resource with a prescribed time * Research funded in part by ONR, grants N00014-12-1-0033 and N00014-15-1-2083. 1 2 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK horizon T , and the optimal regret bounds are now well documented. They can be classified into two cate- gories with qualitatively different asymptotic growth rates. Many algorithms, such as UCB1, see Auer et al. [4], Thompson sampling, see Agrawal and Goyal [3], and ǫ-greedy, see Auer et al. [4], achieve distribution- dependent, i.e. with constant factors that depend on the underlying unobserved distributions, asymptotic bounds on regret of order Θ(ln(T )), which is shown to be optimal in Lai and Robbins [19]. While these results prove very satisfying in many settings, the downside is that the bounds can get arbitrarily large if a malicious opponent was to select the underlying distributions in an adversarial fashion. In contrast, algo- rithms such as Exp3, designed in Auer et al. [5], achieve distribution-free bounds that can be computed in an online fashion, at the price of a less attractive growth rate Θ(√T ). The BwK theory lacks this clear-cut dis- tinction. While provably optimal distribution-free bounds have recently been established, see Agrawal and Devanur [1] and Badanidiyuru et al. [8], there has been little progress toward the development of asymptot- ically optimal distribution-dependent regret bounds. To bridge the gap, we introduce a template algorithm with proven regret bounds which are asymptotically logarithmic in the initial supply of each resource, in four important cases that cover a wide range of applications: • Case 1, where there is a single limited resource other than time, which is not limited, and the amount of resource consumed as a result of making a decision is stochastic. Applications in online advertising, see Tran-Thanh et al. [23], fit in this framework; • Case 2, where there are arbitrarily many resources and the amounts of resources consumed as a result of making a decision are deterministic. Applications to network revenue management of perishable goods, see Besbes and Zeevi [11], shelf optimization of perishable goods, see Graczov´a and Jacko [15], and wireless sensor networks, see Tran-Thanh et al. [25], fit in this framework; • Case 3, where there are two limited resources, one of which is assumed to be time while the consump- tion of the other is stochastic, under a nondegeneracy condition. Typical applications include online bid optimization in sponsored search auctions, see Tran-Thanh et al. [26], dynamic pricing with limited supply, see Babaioff et al. [6], and dynamic procurement, see Badanidiyuru et al. [7]; • Case 4, where there are arbitrarily many resources, under a stronger nondegeneracy condition than for Case 3. Typical applications include dynamic ad allocation, see Slivkins [22], dynamic pricing of multiple products, see Badanidiyuru et al. [8], and network revenue management, see Besbes and Zeevi [11]. In terms of applicability and significance of the results, Case 3 is the most important case. Case 4 is the most general one but the analysis is more involved and requires stronger assumptions which makes it less attractive from a practical standpoint. The analysis is easier for Cases 1 and 2 but their modeling power is more limited. In fast-paced environments, such as in ad auctions, the stochastic assumptions at the core of the BwK model are only valid for a short period of time but there are typically a large number of actions to be performed per second (e.g. submit a bid for a new ad auction). In these situations, the initial endowments of resources are thus typically large and logarithmic regret bounds can be significantly more attractive than distribution-free ones. 1.2. Problem statement and contributions. At each time period t ∈ N, a decision needs to be made among a predefined finite set of actions, represented by arms and labeled k = 1,··· , K. We denote by at the arm pulled at time t. Pulling arm k at time t yields a random reward rk,t ∈ [0, 1] (after scaling) and incurs the consumption of C ∈ N different resource types by random amounts ck,t(1),··· , ck,t(C) ∈ [0, 1]C (after scaling). Note that time itself may or may not be a limited resource. At any time t and for any arm k, the vector (rk,t, ck,t(1),··· , ck,t(C)) is jointly drawn from a fixed probability distribution νk independently from the past. The rewards and the amounts of resource consumption can be arbitrarily correlated across arms. We denote by (Ft)t∈N the natural filtration generated by the rewards and the amounts of resource consumption revealed to the decision maker, i.e. ((rat,t, cat,t(1),··· , cat,t(C)))t∈N. The consumption of any resource i ∈ {1,··· , C} is constrained by an initial budget B(i) ∈ R+. As a result, the decision maker can Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 3 keep pulling arms only so long as he does not run out of any of the C resources and the game ends at time period τ ∗, defined as: τ ∗ = min{t ∈ N ∃i ∈ {1,··· , C}, t Xτ =1 caτ ,τ (i) > B(i)}. (1) Note that τ ∗ is a stopping time with respect to (Ft)t≥1. When it comes to choosing which arm to pull next, the difficulty for the decision maker lies in the fact that none of the underlying distributions, i.e. (νk)k=1,··· ,K, are initially known. Furthermore, the only feedback provided to the decision maker upon pulling arm at (but prior to selecting at+1) is (rat,t, cat,t(1),··· , cat,t(C)), i.e. the decision maker does not observe the rewards that would have been obtained and the amounts of resources that would have been consumed as a result of pulling a different arm. The goal is to design a non-anticipating algorithm that, at any time t, selects at based on the information acquired in the past so as to keep the pseudo regret defined as: RB(1),··· ,B(C) = EROPT(B(1),··· , B(C))− E[ τ ∗−1 Xt=1 rat,t], (2) as small as possible, where EROPT(B(1),··· , B(C)) is the maximum expected sum of rewards that can be obtained by a non-anticipating oracle algorithm that has knowledge of the underlying distributions. Here, an algorithm is said to be non-anticipating if the decision to pull a given arm does not depend on the future observations. We develop algorithms and establish distribution-dependent regret bounds, that hold for any choice of the unobserved underlying distributions (νk)k=1,··· ,K, as well as distribution-independent regret bounds. This entails studying the asymptotic behavior of RB(1),··· ,B(C) when all the budgets (B(i))i=1,··· ,C go to infinity. In order to simplify the analysis, it is convenient to assume that the ratios (B(i)/B(C))i=1,···,C are constants independent of any other relevant quantities and to denote B(C) by B. b(i) is a positive quantity. ASSUMPTION 1. For any resource i ∈ {1,··· , C}, we have B(i) = b(i) · B for some fixed constant b(i) ∈ (0, 1]. Hence b = min i=1,··· ,C When time is a limited resource, we use the notation T in place of B. Assumption 1 is widely used in the dynamic pricing literature where the inventory scales linearly with the time horizon, see Besbes and Zeevi [11] and Johnson et al. [17]. Assumption 1 will only prove useful when deriving distribution-dependent regret bounds and it can largely be relaxed, see Section A of the Appendix. As the mean turns out to be an important statistics, we denote the mean reward and amounts of resource consumption by µr k(C) and their respective empirical estimates by ¯rk,t, ¯ck,t(1),··· , ¯ck,t(C). These estimates depend on the number of times each arm has been pulled by the decision maker up to, but not including, time t, which we write nk,t. We end with a general assumption, which we use throughout the paper, meant to have the game end in finite time. k, µc k(1),··· , µc ASSUMPTION 2. For any arm k ∈ {1,··· , K}, we have max i=1,··· ,C µc k(i) > 0. Note that Assumption 2 is automatically satisfied if time is a limited resource. Contributions. We design an algorithm that runs in time polynomial in K for which we establish O(K C · ln(B)/∆) (resp.pK C · B · ln(B)) distribution-dependent (resp. distribution-free) regret bounds, where ∆ is a parameter that generalizes the optimality gap for the standard MAB problem. We estab- lish these regret bounds in four cases of increasing difficulty making additional technical assumptions that become stronger as we make progress towards tackling the general case. We choose to present these inter- mediate cases since: (i) we get improved constant factors under weaker assumptions and (ii) they subsume many practical applications. Note that our distribution-dependent regret bounds scale as a polynomial func- tion of K of degree C, which may be unacceptable when the number of resources is large. We provide evidence that suggests that a linear dependence on K can be achieved by tweaking the algorithm, at least in 4 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK some particular cases of interest. Finally, we point out that the constant factors hidden in the O notations are not scale-free, in the sense that jointly scaling down the amounts of resources consumed at each round along with their respective initial endowments worsens the bounds. As a consequence, initially scaling down the amounts of resource consumption in order to guarantee that they lie in [0, 1] should be done with caution: the scaling factors should be as small as possible. 1.3. Literature review. The Bandits with Knapsacks framework was first introduced in its full gener- ality in Badanidiyuru et al. [8], but special cases had been studied before, see for example Tran-Thanh et al. [23], Ding et al. [13], and Babaioff et al. [6]. Since the standard MAB problem fits in the BwK framework, with time being the only scarce resource, the results listed in the introduction tend to suggest that regret bounds with logarithmic growth with respect to the budgets may be possible for BwK problems but very few such results are documented. When there are arbitrarily many resources and a time horizon, Badanidiyuru et al. [8] and Agrawal and Devanur [1] obtain O(√K · T ) distribution-free bounds on regret that hold on average as well as with high probability, where the O notation hides logarithmic factors. These results were later extended to the contextual version of the problem in Badanidiyuru et al. [9] and Agrawal et al. [2]. Johnson et al. [17] extend Thompson sampling to tackle the general BwK problem and obtain distribution- dependent bounds on regret of order O(√T ) (with an unspecified dependence on K) when time is a limited resource, under a nondegeneracy condition. Trovo et al. [27] develop algorithms for BwK problems with a continuum of arms and a single limited resource constrained by a budget B and obtain o(B) regret bounds. Combes et al. [12] consider a closely related framework that allows to model any history-dependent con- straint on the number of times any arm can be pulled and obtain O(K · ln(T )) regret bounds when time is a limited resource. However, the benchmark oracle algorithm used in Combes et al. [12] to define the regret is significantly weaker than the one considered here as it only has knowledge of the distributions of the rewards, as opposed to the joint distributions of the rewards and the amounts of resource consumption. Babaioff et al. [6] establish a Ω(√T ) distribution-dependent lower bound on regret for a dynamic pric- ing problem which can be cast as a BwK problem with a time horizon, a resource whose consumption is stochastic, and a continuum of arms. This lower bound does not apply here as we are considering finitely many arms and it is well known that the minimax regret can be exponentially smaller when we move from finitely many arms to uncountably many arms for the standard MAB problem, see Kleinberg and Leighton [18]. Tran-Thanh et al. [24] tackles BwK problems with a single limited resource whose consumption is deterministic and constrained by a global budget B and obtain O(K · ln(B)) regret bounds. This result was later extended to the case of a stochastic resource in Xia et al. [30]. Wu et al. [29] study a contextual version of the BwK problem when there are two limited resources, one of which is assumed to be time while the consumption of the other is deterministic, and obtain O(K · ln(T )) regret bounds under a nondegeneracy condition. Logarithmic regret bounds are also derived in Slivkins [22] for a dynamic ad allocation problem that can be cast as a BwK problem. Organization. The remainder of the paper is organized as follows. We present applications of the BwK model in Section 2. We expose the algorithmic ideas underlying our approach in Section 3 and apply theses ideas to Cases (1), (2), (3), and (4) in Sections 4, 5, 6, and 7 respectively. We choose to discuss each case separately in a self-contained fashion so that readers can delve into the setting they are most interested in. This comes at the price of some overlap in the analysis. We relax some of the assumptions made in the course of proving the regret bounds and discuss extensions in Section A of the Appendix. To provide as much intuition as possible, the ideas and key technical steps are all included in the main body, sometimes through proof sketches, while the technical details are deferred to the Appendix. Notations. For a set S, S denotes the cardinality of S while 1S is the indicator function of S. For a vector x ∈ Rn and S a subset of {1,··· , n}, xS refers to the subvector (xi)i∈S. For a square matrix A, det(A) is the determinant of A while adj(A) denotes its adjugate. For x ∈ R, x+ is the positive part of x. We use standard asymptotic notations such as O(·), o(·), Ω(·), and Θ(·). Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 5 2. Applications. A number of applications of the BwK framework are documented in the literature. For the purpose of being self-contained, we review a few popular ones that satisfy our technical assumptions. 2.1. Online advertising. Bid optimization in repeated second-price auctions. Consider a bidder participating in sealed second- price auctions who is willing to spend a budget B. This budget may be allocated only for a period of time (for the next T auctions) or until it is completely exhausted. Rounds, indexed by t ∈ N, correspond to auctions the bidder participates in. If the bid submitted by the bidder for auction t is larger than the highest bid submitted by the competitors, denoted by mt, the bidder wins the auction, derives a private utility vt ∈ [0, 1] (whose monetary value is typically difficult to assess), and is charged mt. Otherwise, mt is not revealed to the bidder and vt cannot be assessed. We consider a stochastic setting where the environment and the competitors are not fully adversarial: ((vt, mt))t∈N is assumed to be an i.i.d. stochastic process. The goal for the bidder is to design a strategy to maximize the expected total utility derived given that the bidder has selected a grid of bids to choose from (b1,··· , bK) (e.g. b1 = $0.10,··· , bK = $1). This is a BwK problem with two resources: time and money. Pulling arm k at round t corresponds to bidding bk in auction t, costs ck,t = mt · 1bk≥mt , and yields a reward rk,t = vt · 1bk≥mt . Weed et al. [28] design bidding strategies for a variant of this problem where the bidder is not limited by a budget and rk,t = (vt − mt)· 1bk≥mt . This model was first formalized in Tran-Thanh et al. [26] in the context of sponsored search auctions. In sponsored search auctions, advertisers can bid on keywords to have ads (typically in the form of a link followed by a text description) displayed alongside the search results of a web search engine. When a user types a search query, a set of relevant ads are selected and an auction is run in order to determine which ones will be displayed. The winning ads are allocated to ad slots based on the outcome of the auction and, in the prevailing cost-per-click pricing scheme, their owners get charged only if the user clicks on their ads. Because the auction is often a variant of a sealed second-price auction (e.g. a generalized second- price auction), very limited feedback is provided to the advertiser if the auction is lost. In addition, both the demand and the supply cannot be predicted ahead of time and are thus commonly modeled as random variables, see Ghosh et al. [14]. For these reasons, bidding repeatedly on a keyword can be formulated as a BwK problem. In particular, when the search engine has a single ad slot per query, this problem can be modeled as above: B is the budget the advertiser is willing to spend on a predetermined keyword and rounds correspond to ad auctions the advertiser has been selected to participate in. If the advertiser wins the auction, his or her ad gets displayed and he or she derives a utility vt = 1At , where At is the event that the ad gets clicked on. The goal is to maximize the expected total number of clicks given the budget constraint. The advertiser may also be interested in optimizing the ad to be displayed, which will affect the probability of a click. In this case, the modeling is similar but arms correspond to pairs of bid values and ads. Dynamic ad allocation. This problem was first modeled in the BwK framework in Slivkins [22]. A publisher, i.e. the owner of a collection of websites where ads can be displayed, has previously agreed with K advertisers, indexed by k ∈ {1,··· , K}, on a predetermined cost-per-click pk. Additionally, advertiser k is not willing to spend more than a prescribed budget, Bk, for a predetermined period of time (which corresponds to the next T visits or rounds). Denote by Ak t the event that the ad provided by advertiser k gets clicked on at round t. We consider a stochastic setting where the visitors are not fully adversarial: (1Ak )t∈N is assumed to be an i.d.d. stochastic process for any advertiser k. The goal for the publisher is to maximize the total expected revenues by choosing which ad to display at every round, i.e. every time somebody visits one of the websites. This situation can be modeled as a BwK problem with K + 1 resources: time and money for each of the K advertisers. Pulling arm k ∈ {1,··· , K} at round t corresponds to displaying the ad owned by advertiser k, incurs the costs ck,t(i) = pk · 1Ak t · 1i=k to advertiser i ∈ {1,··· , K}, and yields a revenue rk,t = pk · 1Ak . t t 2.2. Revenue management. 6 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK Dynamic pricing with limited supply. This BwK model was first proposed in Babaioff et al. [6]. An agent has B identical items to sell to T potential customers that arrive sequentially. Customer t ∈ {1,··· , T} is offered a take-it-or-leave-it price pt and purchases the item only if pt is no larger than his or her own valuation vt, which is never disclosed. Customers are assumed to be non-strategic in the sense that their valuations are assumed to be drawn i.i.d. from a distribution unknown to the agent. The goal for the agent is to maximize the total expected revenues by offering prices among a predetermined list (p1,··· , pK). This is a BwK problem with two resources: time and item inventory. Pulling arm k ∈ {1,··· , K} at round t corresponds to offering the price pk, depletes the inventory of ck,t = 1pk≤vt unit, and generates a revenue rk,t = pk · 1pk≤vt . Badanidiyuru et al. [8] propose an extension where multiple units of M different products may be offered to a customer, which then buys as many as needed of each kind in order to maximize his or her own utility function. In this case, the modeling is similar but arms correspond to vectors of dimension 2M specifying the number of items offered along with the price tag for each product and there are M + 1 resources: time and item inventory for each of the M products. t mk t t t Network revenue management. Non-perishable goods. This is an extension of the dynamic pricing problem developed in Besbes and Zeevi [11] which is particularly suited for applications in the online retailer industry, e.g. the online fashion sample sales industry, see Johnson et al. [17]. Each product m = 1,··· , M is produced from a finite amount of C different kinds of raw materials (which may be products themselves). Producing one unit of product m ∈ {1,··· , M} consumes a deterministic amount of resource i ∈ {1,··· , C} denoted by cm(i). Customer t ∈ {1,··· , T} is offered a product mt ∈ {1,··· , M} along with a take-it-or-leave-it price pmt and purchases is larger than pmt it if his or her valuation vmt . Products are manufactured online as customers order them. t ,··· , vM We assume that ((v1 t ))t∈N is an i.i.d. stochastic process with distribution unknown to the agent. This is a BwK problem with C + 1 resources: time and the initial endowment of each resource. Given a predetermined list of arms ((mk, pk))k=1,··· ,K, pulling arm k at round t corresponds to offering product mk at the price pk, incurs the consumption of resource i by an amount ck,t(i) = cmk(i)· 1pk≤v , and generates a revenue rk,t = pk · 1pk≤v Perishable goods. This is a variant of the last model developed for perishable goods, with appli- cations in the food retail industry and the newspaper industry. At each time period t ∈ {1,··· , T}, a retailer chooses how many units λm t ∈ N of product m ∈ {1,··· , M} to manufacture along with a price offer for it pm t . At time t, the demand for product m sold at the price p is a random quantity denoted by dm t (p). We assume that customers are non-strategic: for any vector of prices (p1,··· , pm), ((d1 t (p1),··· dM t (pM )))t∈N is an i.i.d. stochastic process with distribution unknown to the agent. Products perish at the end of each round irrespective of whether they have been purchased. Given a predetermined list of arms ((λ1 k,··· , λM k units of product m at the price pm k for any m ∈ {1,··· , M}, incurs the consumption of resource i by a determinis- tic amount ck,t(i) =PM m=1 λm k · cm(i) (where cm(i) is defined in the previous paragraph), and generates a revenue rk,t =PM k · min(dm Shelf optimization for perishable goods. This is a variant of the model introduced in Graczov´a and Jacko [15]. Consider a retailer who has an unlimited supply of M different types of products. At each time period t, the retailer has to decide how many units, λm t , of each product, m ∈ {1,··· , M}, to allocate to a promotion space given that at most N items fit in the limited promotion space. Moreover, the retailer also has to decide on a price tag pm for each product m. All units of product m ∈ {1,··· , M} perish t by time period Tm and the retailer is planning the allocation for the next T time periods. At round t, the demand for product m is a random quantity denoted by dm t (p). Customers are non-strategic: for any vector of prices (p1,··· , pm), ((d1 t (pM )))t∈N is an i.i.d. stochastic process with distribution unknown to the agent. This is a BwK problem with M + 1 resources: time horizon and time after which each product perishes. Given a predetermined list of arms ((λ1 k ≤ K for any k ∈ {1,··· , K}, pulling arm k at round t corresponds to allocating λm k units of product m to k ))k=1,··· ,K, pulling arm k at round t corresponds to offering λm k ))k=1,··· ,K satisfyingPM t (p1),··· dM t (pm k ), λm k ). k, p1 k,··· , λM k , pM m=1 λm k, p1 k , pM . mk t m=1 pm Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 7 the promotion space for every m ∈ {1,··· , M} with the respective price tags (p1 consumption of resource i by a deterministic amount ck,t(i) = 1, and generates a revenue rk,t =PM min(dm k,··· , pM k ), incurs the m=1 pm k · k ). t (pm k ), λm 2.3. Dynamic procurement. This problem was first studied in Badanidiyuru et al. [7]. Consider a buyer with a budget B facing T agents arriving sequentially, each interested in selling one good. Agent t ∈ {1,··· , T} is offered a take-it-or-leave-it price, pt, and makes a sell only if the value he or she attributes to the item, vt, is no larger than pt. We consider a stochastic setting where the sellers are not fully adver- sarial: (vt)t∈N is an i.i.d. stochastic process with distribution unknown to the buyer. The goal for the buyer is to maximize the total expected number of goods purchased by offering prices among a predetermined list (p1,··· , pK). This is a BwK problem with two resources: time and money. Pulling arm k at round t corresponds to offering the price pk, incurs a cost ck,t = pk · 1pk≥vt , and yields a reward rk,t = 1pk≥vt . It is also possible to model situations where the agents are selling multiple types of products and/or multiple units, in which case arms correspond to vectors specifying the number of units of each product required along with their respective prices, see Badanidiyuru et al. [8]. Applications of this model to crowdsourcing platforms are described in Badanidiyuru et al. [7] and Badanidiyuru et al. [8]. In this setting, agents correspond to workers that are willing to carry out microtasks which are submitted by buyers (called "requesters") using a posted-price mechanism. Requesters are typi- cally submitting large batches of jobs and can thus adjust the posted prices as they learn about the pool of workers. 2.4. Wireless sensor networks. This is a variant of the model introduced in Tran-Thanh et al. [25]. Consider an agent collecting information using a network of wireless sensors powered by batteries. Acti- vating sensor k ∈ {1,··· , K} consumes some amount of energy, ck, which is depleted from the sensor's initial battery level, Bk, and triggers a measurement providing a random amount of information (measured in bits), rk,t, which is transmitted back to the agent. Sensors cannot harvest energy and the goal for the agent is to maximize the total expected amount of information collected over T actions. This is a BwK problem with K + 1 resources: time and the energy stored in the battery of each sensor. Pulling arm k ∈ {1,··· , K} corresponds to activating sensor k, incurs the consumption of resource i ∈ {1,··· , K} by a deterministic amount ck,t = ck · 1k=i, and yields a random reward rk,t. 3. Algorithmic ideas. 3.1. Preliminaries. To handle the exploration-exploitation trade-off, an approach that has proved to be particularly successful hinges on the optimism in the face of uncertainty paradigm. The idea is to consider all plausible scenarios consistent with the information collected so far and to select the decision that yields the most revenue among all the scenarios identified. Concentration inequalities are intrinsic to the paradigm as they enable the development of systematic closed form confidence intervals on the quantities of interest, which together define a set of plausible scenarios. We make repeated use of the following result. LEMMA 1. Hoeffding's inequality Consider X1,··· , Xn n random variables with support in [0, 1]. If ∀t ≤ n E[Xt X1,··· , Xt−1] ≤ µ, then P[X1 +··· + Xn ≥ nµ + a] ≤ exp(− 2a2 If ∀t ≤ n E[Xt X1,··· , Xt−1] ≥ µ, then P[X1 +··· + Xn ≤ nµ− a] ≤ exp(− 2a2 n ) ∀a ≥ 0. n ) ∀a ≥ 0. Auer et al. [4] follow the optimism in the face of uncertainty paradigm to develop the Upper Confidence Bound algorithm (UCB1). UCB1 is based on the following observations: (i) the optimal strategy always consists in pulling the arm with the highest mean reward when time is the only limited resource, (ii) infor- k ∈ [¯rk,t − ǫk,t, ¯rk,t + ǫk,t] at time t with probability at least 1 − 2/t3 for mally, Lemma 1 shows that µr ǫk,t =p2 ln(t)/nk,t, irrespective of the number of times arm k has been pulled. Based on these observa- tions, UCB1 always selects the arm with highest UCB index, i.e. at ∈ arg maxk=1,··· ,K Ik,t, where the UCB 8 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK index of arm k at time t is defined as Ik,t = ¯rk,t + ǫk,t. The first term can be interpreted as an exploita- tion term, the ultimate goal being to maximize revenue, while the second term is an exploration term, the smaller nk,t, the bigger it is. This fruitful paradigm go well beyond this special case and many extensions of UCB1 have been designed to tackle variants of the MAB problem, see for example Slivkins [22]. Agrawal and Devanur [1] embrace the same ideas to tackle BwK problems. The situation is more complex in this all-encompassing framework as the optimal oracle algorithm involves pulling several arms. In fact, find- ing the optimal pulling strategy given the knowledge of the underlying distributions is already a challenge in its own, see Papadimitriou and Tsitsiklis [20] for a study of the computational complexity of similar problems. This raises the question of how to evaluate EROPT(B(1),··· , B(C)) in (2). To overcome this issue, Badanidiyuru et al. [8] upper bound the total expected payoff of any non-anticipating algorithm by the optimal value of a linear program, which is easier to compute. LEMMA 2. Adapted from Badanidiyuru et al. [8] The total expected payoff of any non-anticipating algorithm is no greater than B times the optimal value of the linear program: K sup (ξk)k=1,··· ,K subject to plus the constant term max k=1,··· ,K i=1,··· ,C with µc k(i)>0 µr k k (i) . µc µr k · ξk K Xk=1 Xk=1 ξk ≥ 0, k = 1,··· , K. µc k(i)· ξk ≤ b(i), i = 1,··· , C (3) The optimization problem (3) can be interpreted as follows. For any arm k, B · ξk corresponds to the expected number of times arm k is pulled by the optimal algorithm. Hence, assuming we introduce a dummy arm 0 which is equivalent to skipping the current round, ξk can be interpreted as the probability of pulling arm k at any round when there is a time horizon T . Observe that the constraints restrict the feasible set of expected number of pulls by imposing that the amounts of resources consumed are no greater than their respective budgets in expectations, as opposed to almost surely which would be a more stringent constraint. This explains why the optimal value of (3) is larger than the maximum achievable payoff. In this paper, we use standard linear programming notions such as the concept of a basis and a basic feasible solution. We refer to Bertsimas and Tsitsiklis [10] for an introduction to linear programming. A pseudo-basis x is described by two subsets Kx ⊂ {1,··· , K} and Cx ⊂ {1,··· , C} such that Kx = Cx. A pseudo-basis x is a basis for (3) if the matrix Ax = (µc k(i))(i,k)∈Cx×Kx is invertible. Furthermore, x is said to be a feasible basis for (3) if the corresponding basic solution, denoted by (ξx k = 0 for k 6∈ Kx and Axξx Kx = bCx (where bCx is the subvector (b(i))i∈Cx), is feasible for (3). When x is a feasible basis for k )k=1,··· ,K and determined by ξx k its objective function. From Lemma 2, we derive: (3), we denote by objx =PK k=1 µr k · ξx τ ∗ Xt=1 RB(1),··· ,B(C) ≤ B · objx∗ − E[ rat,t] + O(1), (4) where x∗ is an optimal feasible basis for (3). For mathematical convenience, we consider that the game carries on even if one of the resources is already exhausted so that at is well defined for any t ∈ N. Of course, the rewards obtained for t ≥ τ ∗ are not taken into account in the decision maker's payoff when establishing regret bounds. Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 9 3.2. Solution methodology. Lemma 2 also provides insight into designing algorithms. The idea is to incorporate confidence intervals on the mean rewards and the mean amounts of resource consumption into the offline optimization problem (3) and to base the decision upon the resulting optimal solution. There are several ways to carry out this task, each leading to a different algorithm. When there is a time horizon T , Agrawal and Devanur [1] use high-probability lower (resp. upper) bounds on the mean amounts of resource consumption (resp. rewards) in place of the unknown mean values in (3) and pull an arm at random according to the resulting optimal distribution. Specifically, at any round t, the authors suggest to compute an optimal solution (ξ∗k,t)k=1,··· ,K to the linear program: K sup (ξk )k=1,··· ,K subject to (¯ck,t(i)− ǫk,t)· ξk ≤ (1− γ)· b(i), i = 1,··· , C − 1 (5) (¯rk,t + ǫk,t)· ξk K Xk=1 Xk=1 Xk=1 ξk ≥ 0, K ξk ≤ 1 k = 1,··· , K, for a well-chosen γ ∈ (0, 1), and then to pull arm k with probability ξ∗k,t or skip the round with probability 1 −PK k=1 ξ∗k,t. If we relate this approach to UCB1, the intuition is clear: the idea is to be optimistic about both the rewards and the amounts of resource consumption. We argue that this approach cannot yield log- arithmic regret bounds. First, because γ has to be of order 1/√T . Second, because, even if we were given an optimal solution to (3), (ξx∗ k )k=1,··· ,K, before starting the game, consistently choosing which arm to pull at random according to this distribution at every round would incur regret Ω(√T ), as we next show. LEMMA 3. For all the cases treated in this paper, pulling arm k with probability ξx∗ yields a regret of order Ω(√T ) unless pulling any arm in {k ∈ {1,··· , K} ξx∗ deterministic amount of resource consumption for all resources in Cx∗ and for all rounds t ∈ N. Proof. We use the shorthand notation K∗ = {k ∈ {1,··· , K} ξx∗ i ∈ {1,··· , C − 1}, we have: Xt=1 T · objx∗ − E[ k at any round t k > 0} incurs the same k > 0}. Observe that, for any resource τ ∗ ≥ E[( Xt=τ ∗ Xt=1 {cat,t(i)− b(i)})+]· objx∗ + O(1), where the inequality is derived using cat,t(i) ≤ 1 for all rounds t and Pτ ∗−1 i ∈ Cx∗ , (cat,t(i))t∈N is an i.i.d. bounded stochastic process with mean b(i), we have: = E[( T cat,t(i)− B(i))+]· objx∗ + O(1) t=1 cat,t(i) ≤ B(i). Since, for rat,t] = (T − E[τ ∗])· objx∗ Xt=1 cat,t(i) + τ ∗−1 T E[( T {cat,t(i)− b(i)})+] = Ω(√T ), Xt=1 (6) provided that cat,t(i) has positive variance, which is true if there exists at least one arm k ∈ K∗ such that ck,t(i) has positive variance or if there exist two arms k, l ∈ K∗ such that ck,t(i) and cl,t(i) are not almost surely equal to the same deterministic value. Strictly speaking, this is not enough to conclude that RB(1),··· ,B(C−1),T = Ω(√T ) as T · objx∗ is only an upper bound on the maximum total expected payoff. 10 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK However, in Sections 4, 5, 6, and 7, we show that there exists an algorithm that satisfies T · objx∗ − E[Pτ ∗ t=1 rat,t] = O(ln(T )) for all the cases considered in this paper. This result, together with (6) and k at any round is Ω(√T ). Lemma 2, implies that the regret incurred when pulling arm k with probability ξx∗ The fundamental shortcoming of this approach is that it systematically leads us to plan to consume the same average amount of resource i per round b(i), for any resource i = 1,··· , C − 1, irrespective of whether we have significantly over- or under-consumed in the past. Based on this observation, a natural idea is to solve the linear program: K sup (ξk)k=1,··· ,K subject to (¯ck,t(i)− ǫk,t)· ξk ≤ (1− γ)· bt(i), i = 1,··· , C − 1 (7) (¯rk,t + ǫk,t)· ξk K Xk=1 Xk=1 Xk=1 ξk ≥ 0, K ξk ≤ 1 k = 1,··· , K, instead of (5), where bt(i) denotes the ratio of the remaining amount of resource i at time t to the remaining time horizon, i.e. T − t + 1. Bounding the regret incurred by this adaptive algorithm is, however, difficult from a theoretical standpoint. To address this issue, we propose the following family of algorithms, whose behaviors are similar to the adaptive algorithm but lend themselves to an easier analysis. Algorithm: UCB-Simplex Take λ ≥ 1 and (ηi)i=1,··· ,C ≥ 0 (these quantities will need to be carefully chosen). The algorithm is preceded by an initialization phase which consists in pulling each arm a given number of times, to be specified. For each subsequent time period t, proceed as follows. Step-Simplex: Find an optimal basis xt to the linear program: K (¯rk,t + λ· ǫk,t)· ξk sup (ξk )k=1,··· ,K subject to K Xk=1 Xk=1 ξk ≥ 0, k = 1,··· , K (¯ck,t(i)− ηi · ǫk,t)· ξk ≤ b(i), i = 1,··· , C (8) . Kx,t = bKxt , and the corresponding basic feasible k,t)k=1,··· ,K determined by ξxt k,t = 0 for k 6∈ Kxt and ¯Axt,tξxt Adapting the notations, xt is described by two subsets Kxt ⊂ {1,··· , K} and Cxt ⊂ {1,··· , C} such that Kxt = Cxt, the matrix ¯Axt,t = (¯ck,t(i)− ηi · ǫk,t)(i,k)∈Cxt×Kxt solution (ξxt Step-Load-Balance: Identify the arms involved in the optimal basis, i.e. Kxt . There are at most min(K, C) such arms. Use a load balancing algorithm Axt, to be specified, to determine which of these arms to pull. For all the cases considered in this paper, (8) is always bounded and Step-Simplex is well defined. The Simplex algorithm is an obvious choice to carry out Step-Simplex, especially when ηi = 0 for any resource i ∈ {1,··· , C}, because, in this case, we only have to update one column of the constraint matrix per round which makes warm-starting properties attractive. However, note that this can also be done in time polynomial in K and C, see Grotschel et al. [16]. If we compare (8) with (5), the idea remains to be overly optimistic but, as we will see, more about the rewards than the amounts of resource consumption through the exploration factor λ which will typically be larger than ηi, thus transferring most of the burden of exploration from the constraints to the objective function. The details of Step-Load-Balance are purposefully left out Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 11 and will be specified for each of the cases treated in this paper. When there is a time horizon T , the general idea is to determine, at any time period t and for each resource i = 1,··· , C, whether we have over- or under-consumed in the past and to perturb the probability distribution (ξxt k,t)k=1,··· ,K accordingly to get back on track. k=1 ξx k=1 ξx k,t)k=1,··· ,K and objx,t are plug-in estimates of (ξx k,t · ¯rk,t, and the exploration term, Ex,t = λ ·PK The algorithm we propose is intrinsically tied to the existence of basic feasible optimal solutions to (3) and (8). We denote by B (resp. Bt) the subset of bases of (3) (resp. (8)) that are feasible for (3) (resp. (8)). Step-Simplex can be interpreted as an extension of the index-based decision rule of UCB1. Indeed, Step-Simplex assigns an index Ix,t to each basis x ∈ Bt and outputs xt ∈ arg maxx∈Bt Ix,t, where Ix,t = objx,t + Ex,t with a clear separation (at least when ηi = 0 for any resource i) between the exploitation term, objx,t =PK k,t · ǫk,t. Observe that, for x ∈ Bt that is also feasible for (3), (ξx k )k=1,··· ,K and objx when ηi = 0 for any resource i. Also note that when λ = 1 and ηi = 0 for any resource i and when time is the only limited resource, UCB-Simplex is identical to UCB1 as Step-Load-Balance is unambiguous in this special case, each basis involving a single arm. For any x ∈ B, we define ∆x = objx∗ − objx ≥ 0 as the optimality gap. A feasible basis x is said to be suboptimal if ∆x > 0. At any time t, nx,t denotes the number of times basis x has been selected at Step-Simplex up to time t while nx k,t denotes the number of times arm k has been pulled up to time t when selecting x at Step-Simplex. For all the cases treated in this paper, we will show that, under a nondegeneracy assumption, Step-Simplex guarantees that a suboptimal basis cannot be selected more than O(ln(B)) times on average, a result reminiscent of the regret analysis of UCB1 carried out in Auer et al. [4]. However, in stark contrast with the situation of a single limited resource, this is merely a prerequisite to establish a O(ln(B)) bound on regret. Indeed, a low regret algorithm must also balance the load between the arms as closely as possible to optimality. Hence, the choice of the load balancing algorithms Ax is crucial to obtain logarithmic regret bounds. 4. A single limited resource. In this section, we tackle the case of a single resource whose consump- tion is limited by a global budget B, i.e. C = 1 and b(1) = 1. To simplify the notations, we omit the indices k, ck,t, ¯ck,t, and η as opposed to µc identifying the resources as there is only one, i.e. we write µc k(1), ck,t(1), ¯ck,t(1), and η1. We also use the shorthand ǫ = mink=1,··· ,K µc k. Recall that, under Assumption 2, ǫ is positive and a priori unknown to the decision maker. In order to derive logarithmic bounds, we will also need to assume that the decision maker knows an upper bound on the optimal value of (3). ASSUMPTION 3. The decision maker knows κ ≥ max k=1,··· ,K µr k µc k ahead of round 1. Assumption 3 is natural in repeated second-price auctions, as detailed in the last paragraph of this section. Moreover, note that if ǫ happens to be known ahead of round 1 we can take κ = 1/ǫ. Specification of the algorithm. We implement UCB-Simplex with λ = 1 + κ and η = 0. The initializa- tion step consists in pulling each arm until the amount of resource consumed as a result of pulling that arm is non-zero. The purpose of this step is to have ¯ck,t > 0 for all periods to come and for all arms. Step-Load- Balance is unambiguous here as basic feasible solutions involve a single arm. Hence, we identify a basis x such that Kx = {k} and Cx = {1} with the corresponding arm and write x = k to simplify the notations. In particular, k∗ ∈ {1,··· , K} identifies an optimal arm in the sense defined in Section 3. For any arm k, the exploration and exploitation terms defined in Section 3 specialize to: objk,t = ¯rk,t ¯ck,t and Ek,t = (1 + κ)· ǫk,t ¯ck,t , while objk = µr k/µc k, so that: k∗ ∈ arg max k=1,··· ,K µr k µc k , at ∈ arg max k=1,··· ,K ¯rk,t + (1 + κ)· ǫk,t ¯ck,t , and ∆k = µr k∗ k∗ − µc µr k µc k . 12 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK We point out that, for the particular setting considered in this section, UCB-Simplex is almost identical to the fractional KUBE algorithm proposed in Tran-Thanh et al. [24] to tackle the case of a single resource whose consumption is deterministic. It only differs by the presence of the scaling factor 1 + κ to favor exploration over exploitation, which becomes unnecessary when the amounts of resource consumed are deterministic, see Section A of the Appendix. Regret analysis. We omit the initialization step in the theoretical analysis because the amount of resource consumed is O(1) and the reward obtained is non-negative and not taken into account in the deci- sion maker's total payoff. Moreover, the initialization step ends in finite time almost surely as a result of Assumption 2. First observe that (4) specializes to: RB ≤ B · τ ∗ µr k∗ Xt=1 k∗ − E[ µc rat,t] + O(1). (9) To bound the right-hand side, we start by estimating the expected time horizon. t=1 cat,t ≤ B. Taking expectations on both sides yields Sketch of proof. LEMMA 4. For any non-anticipating algorithm, we have: E[τ ∗] ≤ B+1 B ≥ E[Pτ ∗ By definition of τ ∗, we havePτ ∗−1 t=1 µc ǫ . at ]− 1 ≥ E[τ ∗]· ǫ− 1 by Assumption 2. Rearranging this last inequality yields the claim. The next result is crucial. Used in combination with Lemma 4, it shows that any suboptimal arm is pulled at most O(ln(B)) times in expectations, a well-known result for UCB1, see Auer et al. [4]. The proof is along the same lines as for UCB1, namely we assume that arm k has already been pulled more than Θ(ln(τ ∗)/(∆k)2) times and conclude that arm k cannot be pulled more than a few more times, with the additional difficulty of having to deal with the random stopping time and the fact that the amount of resource consumed at each step is stochastic. LEMMA 5. For any suboptimal arm k, we have: E[ln(τ ∗)] (∆k)2 + Sketch of proof. We use the shorthand notation βk = 25(λ/µc E[nk,τ ∗] ≤ 26( λ µc k )2 · 4π2 3ǫ2 . k)2·(1/∆k)2. First observe that if we want to bound E[nk,τ ∗], we may assume, without loss of generality, that arm k has been pulled at least βk · ln(t) times at any time t up to an additive term of 2βk· E[ln(τ ∗)] in the final inequality. We then just have to bound by a constant the probability that k is selected at any time t given that nk,t ≥ βk · ln(t). If k is selected at time t, it must be that k is optimal for (8), which, in particular, implies that objk,t + Ek,t ≥ objk∗,t + Ek∗,t. This can only happen if either: (i) objk,t ≥ objk + Ek,t, i.e. the objective value of k is overly optimistic, (ii) objk∗,t ≤ objk∗ − Ek∗,t, i.e. the objective value of k∗ is overly pessimistic, or (iii) objk∗ < objk + 2Ek,t, i.e. the optimality gap of arm k is small compared to its exploration factor. The probability of events (i) and (ii) can be bounded by ∼ 1/t2 in the same fashion, irrespective of how many times these arms have been pulled in the past. For example for event (i), this is because if ¯rk,t/¯ck,t = objk,t ≥ objk + Ek,t = µr k + Ek,t, then k − ǫk,t and both of these events have probability at most ∼ 1/t2 by either (a) ¯rk,t ≥ µr Lemma 1. Indeed, if (a) and (b) do not hold, we have: k + ǫk,t or (b) ¯ck,t ≤ µc k/µc ¯rk,t ¯ck,t − µr k µc k = < k)µc (¯rk,t − µr ǫk,t ǫk,t ¯ck,t · ¯ck,t + k + (µc ¯ck,t · µc µr k k ≤ (1 + κ)· µc k − ¯ck,t)µr ǫk,t ¯ck,t k k = Ek,t. As for event (iii), observe that if objk∗ < objk + 2Ek,t and nk,t ≥ βk · ln(t) then we have ¯ck,t ≤ µc k/2, which happens with probability at most ∼ 1/t2 by Lemma 1 given that arm k has already been pulled at least ∼ ln(t)/(µk c )2 times. Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 13 Building on the last two results, we derive a distribution-dependent regret bound which improves upon the one derived in Xia et al. [30]: the decision maker is only assumed to know κ, as opposed to a lower bound on ǫ, ahead of round 1. This is more natural in bidding applications as detailed in the last paragraph of this section. This bound generalizes the one obtained by Auer et al. [4] when time is the only scarce resource. THEOREM 1. We have: RB ≤ 26λ2 · ( Xk∈{1,··· ,K} ∆k>0 1 µc k · ∆k )· ln( B + 1 ǫ ) + O(1). Sketch of proof. We build upon (9): RB ≤ B · τ ∗ K rat,t] + O(1) µr k∗ Xt=1 k∗ − E[ µc µr k∗ Xk=1 µr k∗ − k · E[nk,τ ∗] + O(1) µc k∗ · (B − Xk ∆k=0 µc k · E[nk,τ ∗])− Xk ∆k>0 = B · µr k∗ = µc µr k · E[nk,τ ∗ ] + O(1). t=1 cat,t. Taking expectations on both By definition of τ ∗, the resource is exhausted at time τ ∗, i.e. B ≤Pτ ∗ sides yields B ≤PK µc k · ∆k · E[nk,τ ∗ ] + O(1). k=1 µc k · E[nk,τ ∗ ]. Plugging this last inequality back into the regret bound, we get: RB ≤ Xk ∆k>0 Using the upper bound of Lemma 4, the concavity of the logarithmic function, and Lemma 5, we derive: B + 1 4π2 1 µc k · ∆k ǫ ) + k∗ /µc )· ln( k∗ ≤ κ and µc µc k · ∆k) + O(1) 3ǫ2 · ( Xk ∆k>0 k ≤ 1 for any arm k. RB ≤ 26λ2 · ( Xk ∆k>0 which yields the claim since ∆k ≤ µr Observe that the set of optimal arms, namely arg maxk=1,··· ,K µr k, does not depend on B and that ∆k is a constant independent of B for any suboptimal arm. We conclude that RB = O(K · ln(B)/∆) with ∆ = mink∈{1,··· ,K} ∆k>0 ∆k. Interestingly, the algorithm we propose does not rely on B to achieve this regret bound, much like what happens for UCB1 with the time horizon, see Auer et al. [4]. This result is optimal up to constant factors as the standard MAB problem is a special case of the framework considered in this section, see Lai and Robbins [19] for a proof of a lower bound in this context. It is possible to improve the constant factors when the consumption of the resource is deterministic as we can take λ = 1 in this scenario and the resulting regret bound is scale-free, see Section A of the Appendix. Building on Theorem 1, we can also derive a near-optimal distribution-free regret bound in the same fashion as for UCB1. k/µc THEOREM 2. We have: RB ≤ 8λ·rK · B + 1 ǫ B + 1 ǫ · ln( ) + O(1). Proof To get the distribution-free bound, we start from the penultimate inequality derived in the proof sketch of Theorem 1 and apply Lemma 5 only if ∆k is big enough, noting that: K Xk=1 E[nk,τ ∗] = E[τ ∗] ≤ (B + 1)/ǫ. 14 Specifically, we have: RB ≤ sup (n1,··· ,nK )≥0 k=1 nk≤ B+1 PK ǫ ≤ sup (n1,··· ,nK )≥0 k=1 nk≤ B+1 PK ǫ min(µc min(µc { Xk ∆k>0 { Xk ∆k>0 { Xk ∆k>0r26λ2 · nk · ln( B + 1 ǫ · ln( ) + O(1), ǫ sup (n1,··· ,nK )≥0 k=1 nk≤ B+1 PK ǫ B + 1 ≤ ≤ 8λ·rK · Flajolet and Jaillet: Logarithmic Regret Bounds for BwK ln( B+1 ǫ ) µc k · ∆k ln( B+1 ǫ ) µc k · ∆k + 4π2 3ǫ2 · µc k · ∆k) } + O(1) ) } + K · 4π2κ 3ǫ2 + O(1) k · ∆k · nk, 26λ2 · k · ∆k · nk, 26λ2 · B + 1 ǫ ) } + O(1) where the second inequality is obtained with ∆k ≤ µr by maximizing on (µc inequality. k ≤ 1, the third inequality is derived k· ∆k) ≥ 0 for all arms k, and the last inequality is obtained with the Cauchy−Schwarz We conclude that RB = O(pK · B · ln(B)), where the hidden constant factors are independent of the underlying distributions (νk)k=1,··· ,K. k∗ ≤ κ and µc k∗/µc Applications. Assumption 3 is natural for bidding in repeated second-price auctions when the auction- eer sets a reserve price R (this is common practice in sponsored search auctions). Indeed, then we have: E[ck,t] = E[mt · 1bk≥mt] ≥ R· E[1bk≥mt] ≥ R· E[vt · 1bk≥mt] = R· E[rk,t], for any arm k ∈ {1,··· , K} and Assumption 3 is satisfied with κ = 1/R. 5. Arbitrarily many limited resources whose consumptions are deterministic. In this section, we study the case of multiple limited resources when the amounts of resources consumed as a result of pulling an arm are deterministic and globally constrained by prescribed budgets (B(i))i=1,··· ,C , where C is the number of resources. Note that time need not be a constraint. Because the amounts of resources consumed are deterministic, we can substitute the notation µc k(i) with ck(i) for any arm k ∈ {1,··· , K} and any resource i ∈ {1,··· , C}. We point out that the stopping time need not be deterministic as the decision to select an arm at any round is based on the past realizations of the rewards. We define ρ ≤ min(C, K) as the rank of the matrix (ck(i))1≤k≤K,1≤i≤C. Specification of the algorithm. We implement UCB-Simplex with an initialization step which consists in pulling each arm ρ times. The motivation behind this step is mainly technical and is simply meant to have: nk,t ≥ ρ + Xx∈B k∈Kx nx k,t ∀t ∈ N,∀k ∈ {1,··· , K}. (10) Compared to Section 4, we choose to take λ = 1 and ηi = 0 for any i ∈ {1,··· , C}. As a result and since the amounts of resource consumption are deterministic, the exploration (resp. exploitation) terms defined in Section 3 specialize to objx,t =PK k · ǫk,t). Compared to the case of a single resource, we are required to specify the load balancing algorithms involved in Step-Load-Balance of UCB- Simplex as a feasible basis selected at Step-Simplex may involve several arms. Although Step-Simplex will also need to be specified in Sections 6 and 7, designing good load balancing algorithms is arguably easier here as the optimal load balance is known for each basis from the start. Nonetheless, one challenge remains: k · ¯rk,t (resp. Ex,t =PK k=1 ξx k=1 ξx Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 15 we can never identify the (possibly many) optimal bases of (3) with absolute certainty. As a result, any basis selected at Step-Simplex should be treated as potentially optimal when balancing the load between the arms involved in this basis, but this inevitably causes some interference issues as an arm may be involved in several bases, and worst, possibly several optimal bases. Therefore, one point that will appear to be of particular importance in the analysis is the use of load balancing algorithms that are decoupled from one another, in the sense that they do not rely on what happened when selecting other bases. More specifically, we use the following class of load balancing algorithms. Algorithm: Load balancing algorithm Ax for a feasible basis x ∈ B If basis x is selected at time t, pull any arm k ∈ Kx such that nx k,t ≤ nx,t · ξx k PK l=1 ξx l . The load balancing algorithms Ax thus defined are decoupled because, for each basis, the number of times an arm has been pulled when selecting any other basis is not taken into account. The following lemma shows that Ax is always well defined and guarantees that the ratios (nx l,t)k,l∈Kx remain close to the optimal ones (ξx k,t/nx k /ξx l )k,l∈Kx at all times. LEMMA 6. For any basis x ∈ B, Ax is well defined and moreover, at any time t and for any arm k ∈ Kx, we have: nx,t · ξx k l=1 ξx l PK − ρ ≤ nx k,t ≤ nx,t · + 1, ξx k l=1 ξx l PK while nx k,t = 0 for any arm k /∈ Kx. Proof. We need to show that there always exists an arm k ∈ Kx such that nx k,t ≤ nx,t · ξx Suppose there is none, we have: l=1 ξx l . k /PK nx,t = Xk∈Kx nx k,t > Xk∈Kx nx,t · = nx,t, ξx k l=1 ξx l PK a contradiction. Moreover, we have, at any time t and for any arm k ∈ Kx, nx Indeed, suppose otherwise and define t∗ ≤ t as the last time arm k was pulled, we have: k,t ≤ nx,t · ξx k /PK l=1 ξx l + 1. k,t∗ = nx nx k,t − 1 > nx,t · ξx k l=1 ξx l ≥ nx,t∗ · ξx k l=1 ξx l , PK k /PK PK k,t since nx,t =Pk∈Kx nx l − ρ ≤ nx which shows, by definition, that arm k could not have been pulled at time t∗. We also derive as a byproduct that, at any time t and for any arm k ∈ Kx, nx,t · ξx k,t and since a basis involves at most ρ arms. l=1 ξx Observe that the load balancing algorithms Ax run in time O(1) but may require a memory storage capacity exponential in C and polynomial in K, although always bounded by O(B) (because we do not need to keep track of nx k,t if x has never been selected). In practice, only a few bases will be selected at Step-Simplex, so that a hash table is an appropriate data structure to store the sequences (nx k,t)k∈Kx . In Section A of the Appendix, we introduce another class of load balancing algorithms that is both time and memory efficient while still guaranteeing logarithmic regret bounds (under an additional assumption) but no distribution-free regret bounds. Regret Analysis. We use the shorthand notation: ck(i). ǫ = min k=1,··· ,K i=1,··· ,C with ck(i)>0 16 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK Note that ǫ < ∞ under Assumption 2. We discard the initialization step in the theoretical study because the amounts of resources consumed are bounded by a constant and the total reward obtained is non-negative and not taken into account in the decision maker's total payoff. We again start by estimating the expected time horizon. Proof. LEMMA 7. For any non-anticipating algorithm, we have: E[τ ∗] ≤ PC t=1 cat,t(i) ≤ B(i) for any resource i ∈ {1,··· , C}. Summing up these inequalities and using Assumption 2 and the fact that (ck,t(i))t=1,··· ,T are deterministic, we get By definition of τ ∗, we havePτ ∗−1 i=1 B(i). Taking expectations on both sides and using Assumption 1 yields the result. i=1 b(i)·B + 1. ǫ (τ ∗ − 1)· ǫ ≤PC We follow by bounding the number of times any suboptimal basis can be selected at Step-Simplex in the same spirit as in Section 4. LEMMA 8. For any suboptimal basis x ∈ B, we have: E[nx,τ ∗] ≤ 16ρ· ( ξx k )2 · E[ln(τ ∗)] (∆x)2 + ρ· π2 3 . K Xk=1 Sketch of proof. We use the shorthand notation βx = 8ρ· (PK k /∆x)2. The proof is along the same lines as for Lemma 5. First note that we may assume, without loss of generality, that x has been selected at least βx· ln(t) times at any time t up to an additive term of 2βx· E[ln(τ ∗)] in the final inequality. We then just have to bound by a constant the probability that x is selected at any time t given that nx,t ≥ βx · ln(t). If x is selected at time t, x is an optimal basis to (8). Since the amounts of resources consumed are deterministic, x∗ is feasible to (8) at time t, which implies that objx,t + Ex,t ≥ objx∗,t + Ex∗,t. This can only happen if either: (i) objx,t ≥ objx + Ex,t, (ii) objx∗,t ≤ objx∗ − Ex∗,t, or (iii) objx∗ < objx + 2Ex,t. First note that (iii) is impossible because, assuming this is the case, we would have: k=1 ξx ∆x 2 ξx ξx nk,t ρ + nx k,t k ·s 2 ln(t) k ·s 2 ln(t) k · Xk∈Kxpξx k ·r 2 < Xk∈Kx ≤ Xk∈Kx ≤sXk∈Kx ≤ √ρ · Xk∈Kx βx ξx ξx k ·s 2 ln(t) nx,t = ∆x 2 , where we use (10), Lemma 6 for each k ∈ Kx, the Cauchy−Schwarz inequality, and the fact that a basis involves at most ρ arms. Along the same lines as for Lemma 5, the probability of events (i) and (ii) can be bounded by ∼ ρ/t2 in the same fashion, irrespective of how many times x and x∗ have been selected in the past. For example for event (i), this is because if objx,t ≥ objx + Ex,t, then there must exist k ∈ Kx such k + ǫk,t, but any of these events have individual probability at most ∼ 1/t2 by Lemma 1. Indeed that ¯rk,t ≥ µr otherwise, if ¯rk,t < µr k + ǫk,t for all k ∈ Kx, we would have: objx,t − objx = Xk∈Kx < Xk∈Kx k (¯rk,t − µr ǫk,t · ξx k)· ξx k = Ex,t, a contradiction Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 17 Lemma 8 used in combination with Lemma 7 shows that a suboptimal basis is selected at most O(ln(B)) times. To establish the regret bound, what remains to be done is to lower bound the expected total payoff derived when selecting any of the optimal bases. This is more involved than in the case of a single limited resource because the load balancing step comes into play at this stage. THEOREM 3. We have: RB(1),··· ,B(C) ≤ 16 ρ·PC i=1 b(i) ǫ · ( Xx∈B ∆x>0 1 ∆x )· ln(PC i=1 b(i)· B ǫ + 1) + O(1). Sketch of proof. The proof proceeds along the same lines as for Theorem 1. We build upon (4): RB(1),··· ,B(C) ≤ B · = B · K K Xk=1 Xk=1 τ ∗ k · ξx∗ Xt=1 µr k − E[ k · ξx∗ Xk=1 k −Xx∈B µr K rat,t] + O(1) µr k · E[nx k,τ ∗ ] + O(1). Using the properties of the load balancing algorithm established in Lemma 6, we derive: K K E[nx,τ ∗] k=1 ξx K = ( k · ξx∗ Xk=1 k −Xx∈B µr RB(1),··· ,B(C) ≤ B · { PK k · ξx∗ k )· (B − Xx∈B ∆x=0 Xk=1 µr Xk=1 − Xx∈B ∆x>0 {( PK k · ξx µr k )· K E[nx,τ ∗] k=1 ξx µr k · ξx k · ( E[nx,τ ∗] k=1 ξx k Xk=1 PK k } + O(1). ) k )} + O(1) Now observe that, by definition, at least one resource is exhausted at time τ ∗. Hence, there exists i ∈ {1,··· , C} such that: where we use Lemma 6 again and the fact that any basis x ∈ B satisfies all the constraints of (3). We conclude that: Taking expectations on both sides and plugging the result back into the regret bound yields: ck(i)· ξx k k,τ ∗ B(i) ≤Xx∈B Xk∈Kx ck(i)· nx nx,τ ∗ ≤ O(1) +Xx∈B PK k=1 ξx ≤ O(1) + b(i)·Xx∈B nx,τ ∗ k=1 ξx k k · Xk∈Kx PK k ≥ B − Xx∈B ∆x>0 nx,τ ∗ k=1 ξx , Xx∈B ∆x=0 PK ∆x k=1 ξx RB(1),··· ,B(C) ≤ Xx∈B ∆x>0 PK RB(1),··· ,B(C) ≤ 16ρ· ( Xx∈B ∆x>0PK ρ· ( Xx∈B ∆x>0 PK k· ξx∗ i=1 b(i)/ǫ,PK k ≤PC k=1 ξx ∆x ∆x k=1 ξx k=1 µr π2 3 + k k )· ln(PC ) + O(1) + O(1). nx,τ ∗ k=1 ξx k PK k · E[nx,τ ∗] + O(1). i=1 b(i)· B + 1) ǫ Using Lemma 7, Lemma 8, and the concavity of the logarithmic function, we obtain: which yields the claim since ∆x ≤PK k=1 ξx k ≥ b, andPK k=1 ξx k ≤PC i=1 b(i)/ǫ. 18 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK We point out that, if time is a limited resource with a time horizon T , we can also derive the (possibly better) regret bound: RB(1),··· ,B(C) ≤ 16ρ· ( Xx∈B ∆x>0 Since the number of feasible bases to (3) is at most(cid:0)K+ρ K (cid:1) ≤ 2K ρ, we get the distribution-dependent regret bound O(ρ · K ρ · ln(B)/∆) where ∆ = minx∈B ∆x>0 ∆x. In Section A of the Appendix, we introduce an alternative class of load balancing algorithms which yields a better dependence on K and C with a regret bound of order O(ρ3 · K · ln(B)/∆2) provided that there is a unique optimal basis to (3). Along the sames lines as in Section 4, the distribution-dependent bound of Theorem 3 almost immediately implies a distribution-free one. )· ln(T ) + O(1). 1 ∆x THEOREM 4. We have: RB(1),··· ,B(C) ≤ 4sρ·B· (PC i=1 b(i)· B ǫ + 1)· ln(PC i=1 b(i)· B ǫ + 1) + O(1). Sketch of proof. The proof is along the same lines as for the case of a single limited resource, we start from the penultimate inequality derived in the proof sketch of Theorem 3 and apply Lemma 8 only if ∆x is big enough, taking into account the fact thatPx∈B We conclude that RB(1),··· ,B(C) = O(pρ· K ρ · B · ln(B)), where the hidden constant factors are indepen- dent of the underlying distributions (νk)k=1,··· ,K. If time is a limited resource, we can also derive the (pos- sibly better) regret bound: E[nx,τ ∗] ≤ E[τ ∗] ≤PC i=1 b(i)· B/ǫ + 1. RB(1),··· ,B(C) ≤ 4pρ·B· T · ln(T ) + O(1). In any case, we stress that the dependence on K and C is not optimal since Badanidiyuru et al. [8] and Agrawal and Devanur [1] obtain a O(√K · B) bound on regret, where the O notation hides factors logarith- mic in B. Observe that the regret bounds derived in this section do not vanish with b. This can be remedied by strengthening Assumption 2, additionally assuming that ck,t(i) > 0 for any arm k ∈ {1,··· , K} and resource i ∈ {1,··· , C}. In this situation, we can refine the analysis and substitutePC i=1 b(i) with b in the regret bounds of Propositions 3 and 4 which become scale-free. Applications. BwK problems where the amounts of resources consumed as a result of pulling an arm are deterministic find applications in network revenue management of perishable goods, shelf optimization of perishable goods, and wireless sensor networks, as detailed in Section 2. 6. A time horizon and another limited resource. In this section, we investigate the case of two lim- ited resources, one of which is assumed to be time, with a time horizon T , while the consumption of the other is stochastic and constrained by a global budget B. To simplify the notations, we omit the indices identifying the resources since the second limited resource is time and we write µc k, ck,t, ¯ck,t, B, and T as opposed to µc k(1), ck,t(1), ¯ck,t(1), B(1), and B(2). Moreover, we refer to resource i = 1 as "the" resource. Observe that, in the particular setting considered in this section, τ ∗ = min(τ (B), T + 1) with τ (B) = min{t ∈ N Pt τ =1 caτ ,τ > B}. Note that the budget constraint is not limiting if B ≥ T , in which case the problem reduces to the standard MAB problem. Hence, without loss of generality under Assumption 1, we assume that the budget scales linearly with time, i.e. B = b · T for a fixed constant b ∈ (0, 1), and we study the asymptotic regime T → ∞. Motivated by technical considerations, we make two additional assumptions for the particular setting considered in this section that are perfectly reasonable in many applications, such as in repeated second-price auctions, dynamic procurement, and dynamic pricing, as detailed in the last paragraph of this section. ASSUMPTION 4. There exists σ > 0 such that µr k ≤ σ · µc k for any arm k ∈ {1,··· , K}. Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 19 ASSUMPTION 5. The decision maker knows κ > 0 such that: µr k − µr l ≤ κ·µc k − µc l ∀(k, l) ∈ {1,··· , K}2, ahead of round 1. Note that σ, as opposed to κ, is not assumed to be known to the decision maker. Assumption 4 is relatively weak and is always satisfied in practical applications. In particular, note that if µc k > 0 for all arms k ∈ {1,··· , K}, we can take σ = 1/ mink=1,··· ,K µc k. Specification of the algorithm. We implement UCB-Simplex with λ = 1 + 2κ, η1 = 1, η2 = 0, and an initialization step which consists in pulling each arm once. Because the amount of resource consumed at each round is a random variable, a feasible basis for (8) may not be feasible for (3) and conversely. In particular, x∗ may not be feasible for (8), thus effectively preventing it from being selected at Step-Simplex, and an infeasible basis for (3) may be selected instead. This is in contrast to the situation studied in Section 5 and this motivates the choice η1 > 0 to guarantee that any feasible solution to (3) will be feasible to (8) with high probability at any round t. t = {0, kt} (resp. {kt, K + kt}) and Cx′ Just like in Section 5, we need to specify Step-Load-Balance because a basis selected at Step-Simplex may involve up to two arms. To simplify the presentation, we introduce a dummy arm k = 0 with reward 0 and resource consumption 0 (pulling this arm corresponds to skipping the round) and K dummy arms k = K + 1,··· , 2K with reward identical to arm K − k but resource consumption 1 so that any basis involving a single arm can be mapped to an "artificial" one involving two arms. Note, however, that we do not introduce new variables ξk in (8) for these arms as they are only used for mathematical convenience in Step-Load-Balance once a basis has been selected at Step-Simplex. Specifically, if a basis xt involving a single arm determined by Kxt = {kt} and Cxt = {1} (resp. Cxt = {2}) is selected at Step-Simplex, we map it to the basis x′t determined by Kx′ = {1, 2}. We then use a load balancing algorithm specific to this basis, denoted by Axt, to determine which of the two arms in Kx′ t to pull. Similarly as in Section 5, using load balancing algorithms that are decoupled from one another is crucial because the decision maker can never identify the optimal bases with absolute certainty. This implies that each basis should be treated as potentially optimal when balancing the load between the arms, but this inevitably causes interference issues as an arm may be involved in several bases. Compared to Section 5, we face an additional challenge when designing the load balancing algorithms: the optimal load balances are initially unknown to the decision maker. It turns out that we can still approximately achieve the unknown optimal load balances by enforcing that, at any round t, the total amount of resource consumed remains close to the pacing target b· t with high probability, as precisely described below. Algorithm: Load balancing algorithm Ax for any basis x For any time period t, define bx,t as the total amount of resource consumed when selecting x in the past t− 1 rounds. Suppose that x is selected at time t. Without loss of generality, write Kx = {k, l} with ¯ck,t − ǫk,t ≥ ¯cl,t − ǫl,t. Pull arm k if bx,t ≤ nx,t · b and pull arm l otherwise. Observe that a basis x with Kx = {k, l} is feasible for (3) if either µc we are in the first situation, the exploration and exploitation terms defined in Section 3 specialize to: k. Assuming k > b > µc l > b > µc l or µc t objx,t = ξx l,t · ¯rl,t + ξx k,t · ¯rk,t and Ex,t = λ· (ξx l,t · ǫl,t + ξx k,t · ǫk,t) with: ξx l,t = (¯ck,t − ǫk,t)− b (¯ck,t − ǫk,t)− (¯cl,t − ǫl,t) and ξx k,t = b− (¯cl,t − ǫl,t) (¯ck,t − ǫk,t)− (¯cl,t − ǫl,t) , provided that ¯ck,t − ǫk,t > b > ¯cl,t − ǫl,t. Moreover, their offline counterparts are given by: objx = ξx l · µr l + ξx k · µr k, ξx l = µc k − b µc k − µc l , and ξx k = l b− µc µc k − µc l . 20 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK Regret Analysis. We start by pointing out that, in degenerate scenarios, using the linear relaxation (3) as an upper bound on EROPT(B, T ) already dooms us to Ω(√T ) regret bounds. Precisely, if there exists a unique optimal basis x∗ to (3) that happens to be degenerate, i.e. Kx∗ = {k∗} (pre-mapping) with µc k∗ = b, then, in most cases, T · objx∗ ≥ EROPT(B, T ) + Ω(√T ) as shown below. LEMMA 9. Sketch of proof. √T this is also nothing more than an i.i.d. strategy which implies, along the same lines as in Lemma 3, that If there exists k∗ ∈ {1,··· , K} such that: (i) the i.i.d. process (ck∗,t)t∈N has positive vari- k∗ = b, and (iii) (ξk)k=1,··· ,K determined by ξk∗ = 1 and ξk = 0 for k 6= k∗ is the unique optimal ance, (ii) µc solution to (3), then there exists a subsequence of ( T·objx∗−EROPT(B,T ) )T∈N that does not converge to 0. For any time horizon T ∈ N and any arm k ∈ {1,··· , K}, we denote by nopt k,T the expected number of times arm k is pulled by the optimal non-anticipating algorithm when the time horizon is T and the budget is B = b· T . We expect that consistently pulling arm k∗ is near-optimal. Unfortunately, E[τ ∗] = T − Ω(√T ) so that the total expected payoff is E[τ ∗]· µr k∗ = T · objx∗ − Ω(√T ). To formalize these k∗,T = o(√T ) (Case B) and we show ideas, we study two cases: T − nopt that EROPT(B, T ) = T · objx∗ − Ω(√T ) in both cases. In Case A, this is because the optimal value of (3) remains an upper bound on the maximum total expected payoff if we add the constraint ξk∗ ≤ nopt k∗,T /T to the linear program (3) by definition of nopt k∗,T . Since the constraint ξk∗ ≤ 1 is binding for (3), the optimal value of this new linear program can be shown to be smaller than objx∗ − Ω((T − nopt k∗,T )/T ) (by strong duality and strict complementary slackness). In Case B, up to an additive term of order o(√T ) in the final bound, the optimal non-anticipating algorithm is equivalent to consistently pulling arm k∗, which is an i.i.d. strategy so the study is very similar to that of Lemma 3. k∗,T = Ω(√T ) (Case A) and T − nopt Dealing with these degenerate scenarios thus calls for a completely different approach than the one taken on in the BwK literature and we choose instead to rule them out in such a way that there can be no degenerate optimal basis to (3). ASSUMPTION 6. We have µc k − b > 0 for any arm k ∈ {1,··· , K}. We use the shorthand notation ǫ = mink=1,··· ,K µc k − b. Assumption 6 is equivalent to assuming that any basis for (3) is non-degenerate. This assumption can be relaxed to some extent at the price of more tech- nicalities. However, in light of Lemma 9, the minimal assumption is that there is no degenerate optimal basis to (3). As a final remark, we stress that Assumption 6 is only necessary to carry out the analysis but Step-Simplex can be implemented in any case as ǫ is not assumed to be known to the decision maker. We are now ready to establish regret bounds. Without loss of generality, we can assume that any pseudo- basis for (3) involves two arms, one of which may be a dummy arm introduced in the specification of the algorithm detailed above. As stressed at the beginning of this section, UCB-Simplex may sometimes select an infeasible basis or even a pseudo-basis x with det(Ax) = 0 (i.e. such that µc l assuming Kx = {k, l}). Interestingly the load balancing algorithm plays a crucial role to guarantee that this does not happen very often. k = µc LEMMA 10. For any basis x /∈ B, we have: E[nx,T ] ≤ 26 ǫ3 · ln(T ) + 10π2 3ǫ2 . The same inequality holds if x is a pseudo-basis but not a basis for (3). k, µc Proof. We use the shorthand notation βx = 25/ǫ3. Without loss of generality, we can assume that Kx = {k, l} with µc l > b (the situation is symmetric if the reverse inequality holds). Along the same lines as in Lemma 5, we only have to bound by a constant the probability that x is selected at any round t given that x has already been selected at least βx · ln(t) times. If x is selected at round t and nx,t ≥ βx · ln(t), then bx,t must be larger than nx,t · b by at least a margin of ∼ 1/ǫ2 · ln(t) with high probability given that l > b. Moreover, at least one arm, say k, has been pulled at least ∼ 1/ǫ3 · ln(t) times and, as a result, k, µc µc Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 21 ¯ck,τ − ǫk,τ ≥ b with high probability for the last s ∼ 1/ǫ2 · ln(t) rounds τ = τ1,··· , τs where x was selected. This implies that arm l must have been pulled at least ∼ 1/ǫ2 · ln(t) times already by definition of the load balancing algorithm but then we have ¯cl,t − ǫl,t ≥ b with high probability and x cannot be feasible for (8) at time t with high probability. What remains to be done is to: (i) show that suboptimal bases are selected at most O(ln(T )) times and (ii) lower bound the expected total payoff derived when selecting any of the optimal bases. The major diffi- culty lies in the fact that the amounts of resource consumed, the rewards obtained, and the stopping time are correlated in a non-trivial way through the budget constraint and the decisions made in the past. This makes it difficult to study the expected total payoff derived when selecting optimal bases independently from the amounts of resource consumed and the rewards obtained when selecting suboptimal ones. How- ever, a key point is that, by design, the pulling decision made at Step-Load-Balance is based solely on the past history associated with the basis selected at Step-Simplex because the load balancing algorithms are decoupled. For this reason, the analysis proceeds in two steps irrespective of the number of optimal bases. In a first step, we show that, for any basis x for (3), the amount of resource consumed per round when selecting x remains close to the pacing target b with high probability. This enables us to show that the ratios (E[nx l,T ])k,l∈Kx are close to the optimal ones (ξx l )k,l∈Kx , as precisely stated below. k,T ]/E[nx k /ξx LEMMA 11. For any basis x ∈ B and time period t, we have: P[bx,t − nx,t · b ≥ u + ( 4 ǫ )2 · ln(t)] ≤ 4 ǫ2 · exp(−ǫ2 · u) + 8 ǫ2 · t2 ∀u ≥ 1, which, in particular, implies that: E[nx E[nx k,T ] ≥ ξx l,T ] ≥ ξx k · E[nx,T ]− 13/ǫ5 − 16/ǫ3 · ln(T ) l · E[nx,T ]− 13/ǫ5 − 16/ǫ3 · ln(T ). (11) k > b > µc Sketch of proof. Without loss of generality, we can assume that Kx = {k, l} with µc l . Observe that, if the decision maker knew that µc l ahead of round 1, he would always pull the "correct" arm in order not to deviate from the pacing target nx,t · b and bx,t − nx,t · b would remain small with high probability given Assumption 6. However, because this information is not available ahead of round 1, the decision maker is led to pull the incorrect arm when arm k and l are swapped, in the sense that ¯ck,t − ǫk,t ≤ ¯cl,t− ǫl,t. Fortunately, at any time t, there could have been at most 1/ǫ2· ln(t) swaps with probability at least ∼ 1 − 1/t2 given Assumption 6. To derive (11), we use: E[bx,T − nx,T · b] ≤R T P[bx,T − nx,T · b ≥ u]du and E[bx,T ] = µk c · E[nx c · E[nx k > b > µc k,T ] + µl l,T ]. 0 The next step is to show, just like in Section 5, that any suboptimal feasible basis is selected at most O(ln(T )) times on average. Interestingly, the choice of the load balancing algorithm plays a minor role in the proof. Any load balancing algorithm that pulls each arm involved in a basis at least a constant fraction of the time this basis is selected does enforce this property. LEMMA 12. For any suboptimal basis x ∈ B, we have: ln(T ) (∆x)2 + E[nx,T ] ≤ 29 λ2 ǫ3 · 10π2 ǫ2 . Sketch of proof. We use the shorthand notation βx = 28/ǫ3 · (λ/∆x)2. Without loss of generality, we can assume that Kx∗ = {k∗, l∗} with µc l . Along the same lines as in Lemma 5, we only have to bound by a constant the probability that x is selected at any round t given that x has already been selected at least βx·ln(t) times. If x is selected at time t, x is optimal for (8). Observe that (ξx∗ l∗ , which happens with probability at least ∼ 1− 1/t2. As a result, objx,t + Ex,t ≥ objx∗ when additionally ¯rk∗,t + ǫk∗,t ≥ µr k∗ k )k=1,··· ,K is a feasible solution to (8) when ¯ck∗,t − ǫk∗,t ≤ µc l∗ and Kx = {k, l} with µc k∗ and ¯cl∗,t − ǫl∗,t ≤ µc k∗ > b > µc k > b > µc 22 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK and ¯rl∗,t + ǫl∗,t ≥ µr l∗ , which also happens with probability at least ∼ 1− 1/t2. If objx,t + Ex,t ≥ objx∗ then we have either (i) objx,t ≥ objx + Ex,t or (ii) objx∗ < objx + 2Ex,t. Observe that (ii) can only happen with probability at most ∼ 1/t2 given that nx,t ≥ βx· ln(t) because (ii) implies that either nl,t ≤ 8(λ/∆x)2· ln(t) or nk,t ≤ 8(λ/∆x)2 · ln(t) but the load balancing algorithm guarantees that each arm is pulled a fraction of the time x is selected (using Lemma 11). As for (i), if objx,t ≥ objx + Ex,t, then, using Assumption 4, either ¯rk,t ≥ µr l + ǫl,t] but all of these events have individual probability at most ∼ 1/t2 by Lemma 1. In a last step, we show, using Lemma 11, that, at the cost of an additive logarithmic term in the regret bound, we may assume that the game lasts exactly T rounds. This enables us to combine Lemmas 10, 11, and 12 to establish a distribution-dependent regret bound. l + ǫl,t, or ¯cl,t /∈ [µc k + ǫk,t, ¯ck,t /∈ [µc k + ǫk,t], ¯rl,t ≥ µr k − ǫk,t, µc l − ǫl,t, µc THEOREM 5. We have: RB,T ≤ 29 λ2 ǫ3 · ( Xx∈B ∆x>0 1 ∆x )· ln(T ) + O( K 2 · σ ǫ3 · ln(T )), where the O notation hides universal constant factors. Sketch of proof. We build upon (4): RB,T ≤ T · ≤ T · K K Xk=1 Xk=1 τ ∗ k · ξx∗ µr k · ξx∗ µr Xt=1 k − E[ Xt=1 k − E[ T rat,t] + O(1) rat,t] + σ · E[( T Xt=1 cat,t − B)+] + O(1), where we use Assumption 4 for the second inequality. Moreover: E[( T Xt=1 cat,t − B)+] ≤Xx∈B E[bx,T − nx,T · b] +Xx /∈B + Xx pseudo-basis for (3) with det(Ax)=0 E[nx,T ] = O( E[nx,T ] K 2 ǫ3 ln(T )), using Lemmas 10 and 11. Plugging this last inequality back into the regret bound yields: RB,T ≤ T · T ( K K K K K K ≤ T · k · ξx∗ Xk=1 Xt=1 µr k − E[ k · ξx∗ Xk=1 Xk=1 k −Xx∈B µr k · ξx∗ Xk=1 k −Xx∈B Xk=1 µr ≤ T · k · ξx∗ k · (T − Xx∈B ∆x=0 Xk=1 µr k · ξx∗ Xk=1 k · ( Xx∈B ∆x>0 µr Xk=1 − Xx∈B ∆x>0 µr k · ξx = = K K ( k )· E[nx,T ] + O( K 2 · σ ǫ3 ln(T )) E[nx,T ]) rat,t] + O( K 2 · σ ǫ3 ln(T )) µr k · E[nx k,T ] + O( K 2 · σ ǫ3 ln(T )) k · ξx µr k )· E[nx,T ] + O( E[nx,T ])− Xx∈B ∆x>0 ln(T )) K 2 · σ ǫ3 K ( Xk=1 k · ξx µr E[nx,T ] + Xx pseudo-basis for (3) K 2 · σ ǫ3 with det(Ax)=0 ln(T )) E[nx,T ] +Xx /∈B k )· E[nx,T ] + O( Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 23 ≤ Xx∈B ∆x>0 ≤ 29 λ2 ǫ3 · ( Xx∈B ∆x>0 ∆x · E[nx,T ] + O( K 2 · σ ǫ3 ln(T )) 1 ∆x )· ln(T ) + O( K 2 · σ ǫ3 ln(T )), the fourth inequality, and Lemma 12 for the last inequality. where we use Lemma 11 for the third inequality, Lemma 10 along withPK Since there are at most 2K 2 feasible bases, we get the regret bound O(K 2 · (1/∆ + σ/ǫ3) · ln(T )), where ∆ = minx∈B ∆x>0 ∆x. Along the sames lines as in Sections 4 and 5, pushing the analysis further almost immediately yields a distribution-free regret bound. k · ξx∗ k ≤PK k ≤ 1 for k=1 ξx∗ k=1 µr THEOREM 6. We have: RB,T ≤ 25 λ ǫ3/2 ·pB· T · ln(T ) + O( where the O notation hides universal constant factors. K 2 · σ ǫ3 ln(T )), Sketch of proof. The proof is along the same lines as for Theorems 2 and 4, we start from the penul- timate inequality derived in the proof sketch of Theorem 5 and apply Lemma 12 only if ∆x is big enough, E[nx,T ] ≤ T . taking into account the fact thatPx∈B We conclude that RB,T = O(pK 2 · T · ln(T )), where the hidden factors are independent of the underlying distributions (νk)k=1,··· ,K. Just like in Section 5, we stress that the dependence on K is not optimal since Badanidiyuru et al. [8] and Agrawal and Devanur [1] obtain a O(√K · T ) bound on regret, where the O notation hides factors logarithmic in T . Observe that the regret bounds derived in Theorems 5 and 6 do not vanish with b, which is not the expected behavior. This is a shortcoming of the analysis that can easily be remedied when mink=1,··· ,K µc k > 0 provided that instead of pulling the dummy arm 0 we always pull the other arm involved in the basis (i.e. we never skip rounds). Note that not skipping rounds can only improve the regret bounds derived in Theorems 5 and 6: arm 0 was introduced only in order to harmonize the notations for mathematical convenience. THEOREM 7. Relax Assumption 6 and redefine ǫ = mink=1,··· ,K µc k. Suppose that b ≤ ǫ/2 and that we never skip rounds, then we have: RB,T ≤ 212 λ2 1 ∆x )· ln( B + 1 ǫ ) + O( K 2 · κ ǫ3 · ln( B + 1 ǫ )) ǫ3 · ( Xx∈B ∆x>0 ǫ3/2 ·rK · and · ln( where the O notations hide universal constant factors. ǫ RB,T ≤ 26 λ B + 1 B + 1 ǫ ) + O( K 2 · κ ǫ3 · ln( B + 1 ǫ )), Applications. Similarly, as in the case of a single resource, Assumptions 4 and 5 are natural when bidding in repeated second-price auctions if the auctioneer sets a reserve price R (which is common practice in sponsored search auctions). Indeed, we have: E[ck,t]− E[cl,t] = E[mt · 1bk≥mt>bl] ≥ R · E[1bk≥mt>bl] ≥ R · E[vt · 1bk≥mt>bl] = R·E[rk,t]− E[rl,t], 24 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK for any pair of arms (k, l) ∈ {1,··· , K} with bk ≥ bl. Hence, Assumption 4 (resp. 5) is satisfied with σ = 1/R (resp. κ = 1/R). In dynamic procurement, Assumptions 4 and 5 are satisfied provided that the agents are not willing to sell their goods for less than a known price P . Indeed, in this case, pulling any arm k associated with a price pk ≤ P is always suboptimal and we have: E[ck,t]− E[cl,t] = pk · P[pk ≥ vt]− pl · P[pl ≥ vt] ≥ pk · P[pk ≥ vt > pl] ≥ P · P[pk ≥ vt > pl] = P ·E[rk,t]− E[rl,t], for any pair of arms (k, l) ∈ {1,··· , K} with pk ≥ pl ≥ P . Hence, Assumption 4 (resp. 5) is satisfied with σ = 1/P (resp. κ = 1/P ). In dynamic pricing, Assumptions 4 and 5 are satisfied if the distribution of valuations has a positive probability density function f (·). Indeed, in this case, we have: E[rk,t]− E[rl,t] = pl · P[pl ≤ vt]− pk · P[pk ≤ vt] = pl · P[pl ≤ vt < pk] + (pl − pk)· P[pk ≤ vt] ≤ max r=1,··· ,K ≤ ( max r=1,··· ,K = ( max pr · P[pl ≤ vt < pk] +pk − pl )· P[pl ≤ vt < pk] pr + )·E[rk,t]− E[rl,t], pr + r=1,··· ,K 1 1 inf f (·) inf f (·) for any pair of arms (k, l) ∈ {1,··· , K} with k ≥ l. Hence, Assumption 4 (resp. 5) is satisfied with σ = maxk=1,··· ,K pk + 1/ inf f (·) (resp. κ = maxk=1,··· ,K pk + 1/ inf f (·)). 7. Arbitrarily many limited resources. In this section, we tackle the general case of arbitrarily many limited resources. Additionally, we assume that one of them is time, with index i = C, but this assumption is almost without loss of generality, as detailed at the end of this section. To simplify the presentation, we consider the regime K ≥ C, which is the most common in applications. This implies that Kx = Cx ≤ C for any pseudo-basis x. We also use the shorthand notation ¯At = (¯ck,t(i))(i,k)∈{1,··· ,C}×{1,··· ,K} at any round t. For similar reasons as in Section 6, we are led to make two additional assumptions which are discussed in the last paragraph of this section. ASSUMPTION 7. There exists σ > 0 such that rk,t ≤ σ · min i=1,··· ,C ck,t(i) for any arm k ∈ {1,··· , K} and for any round t ∈ N. Note that Assumption 7 is stronger than Assumption 4 given that the amounts of resources consumed at each round have to dominate the rewards almost surely, as opposed to on average. Assumption 7 is not necessarily satisfied in all applications but it simplifies the analysis and can be relaxed at the price of an additive term of order O(ln2(T )) in the final regret bounds, see the last paragraph of this section. ASSUMPTION 8. There exists ǫ > 0, known to the decision maker ahead of round 1, such that every basis x for (3) is ǫ-non-degenerate for (3) and satisfy det(Ax) ≥ ǫ. Without loss of generality, we assume that ǫ ≤ 1. Observe that Assumption 8 generalizes Assumption 6 but is more restrictive because ǫ is assumed to be known to the decision maker initially. Just like in Section 6, this assumption can be relaxed to a large extent. For instance, if ǫ is initially unknown, taking ǫ as a vanishing function of T yields the same asymptotic regret bounds. However, note that Lemma 9 carries over to this more general setting and, as a result, the minimal assumption we need to get logarithmic rates is that any optimal basis for (3) is non-degenerate. Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 25 Specification of the algorithm. We implement UCB-Simplex with λ = 1 + 2(C + 1)!2/ǫ, ηi = 0 for any i ∈ {1,··· , C}, and an initialization step which consists in pulling each arm 28(C + 2)!4/ǫ6 · ln(T ) times in order to get i.i.d. samples. Hence, Step-Simplex is run for the first time after round tini = K · 28(C + 2)!4/ǫ6 · ln(T ). Compared to Section 6, the initialization step plays as a substitute for the choice ηi > 0 which was meant to incentivize exploration. This significantly simplifies the analysis but the downside is that ǫ has to be known initially. Similarly, as in Section 6, we introduce a dummy arm which corresponds to skipping the round (i.e. pulling this arm yields a reward 0 and does not consume any resource) so that any basis can be mapped to one for which the time constraint is always binding, i.e. without loss of generality we assume that C ∈ Cx for any pseudo-basis x. Following the ideas developed in Section 6, we design load balancing algorithms for any basis x that pull arms in order to guarantee that, at any round t, the total amount of resource i consumed remains close to the target t · b(i) with high probability for any resource i ∈ Cx. This is more involved that in Section 6 since we need to enforce this property for multiple resources but, as we show in this section, this can be done by perturbing the probability distribution solution to (8) taking into account whether we have over- or under-consumed in the past for each binding resource i ∈ Cxt. Algorithm: Load balancing algorithm Ax for any basis x For any time period t > tini and i ∈ Cx −{C}, define bx,t(i) as the total amount of resource i consumed when selecting basis x in the past t− 1 rounds. Suppose that basis x is selected at time t and define the vector ex i,t = 1) if bx,t(i) ≥ nx,t · b(i) (resp. bx,t(i) < nx,t · b(i)) for any i ∈ Cx −{C}. Since x is selected at round t, ¯Ax,t is invertible and we can define, for any δ ≥ 0, k,t(δ) = ( ¯A−1 px k,t(δ) = 0 otherwise, which together define the probability distribution px x,t(bCx + δ · ex t (δ) = (px t by ex C,t = 0 and ex i,t = −1 (resp. ex t ))k for k ∈ Kx and px k,t(δ))k∈{1,··· ,K}. Define δ∗x,t = δ ( ¯Atpx t (δ))i≤b(i),i /∈Cx max δ≥0 px t (δ)≥0 t = px and px Step-Simplex. Pull an arm at random according to the distribution px t . t (δ∗x,t). Note that δ∗x,t is well defined as x must be feasible for (8) if it is selected at Observe that the load balancing algorithms generalize the ones designed in Section 6 (up to the change ηi = 0). Indeed, when there is a single limited resource other than time, the probability distribution px t is a Dirac supported at the arm with smallest (resp. largest) empirical cost when bx,t ≥ nx,t · b (resp. bx,t < nx,t· b). Similarly, as in Section 5, the load balancing algorithms Ax may require a memory storage capacity exponential in C and polynomial in K, but, in practice, we expect that only a few bases will be selected at Step-Simplex, so that a hash table is an appropriate data structure to store the sequences (bx,t(i))i∈Cx. Note, however, that the load balancing algorithms are computationally efficient because px t can be computed in O(C 2) running time if ¯A−1 x,t is available once we have computed an optimal basic feasible solution to (8), which is the case if we use the revised simplex algorithm. Regret analysis. The regret analysis follows the same recipe as in Section 6 but the proofs are more technical and are thus deferred to Section F of the Appendix. First, we show that the initialization step guarantees that infeasible bases or pseudo-bases x with det(Ax) = 0 cannot be selected more than O(ln(T )) times on average at Step-Simplex. LEMMA 13. For any basis x /∈ B, we have: E[nx,T ] ≤ 29 (C + 3)!4 ǫ6 . The same inequality holds if x is a pseudo-basis but not a basis for (3). 26 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK The next step is to show that the load balancing algorithms guarantee that, for any basis x, the amount of resource i ∈ Cx (resp. i /∈ Cx) consumed per round when selecting x remains close to (resp. below) the pacing target b(i) with high probability. This enables us to show that the ratios (E[nx l,T ])k,l∈Kx are close to the optimal ones (ξx k,T ]/E[nx k /ξx l )k,l∈Kx . LEMMA 14. For any feasible basis x and time period t, we have: P[bx,t(i)− nx,t · b(i) ≥ u] ≤ 25 (C + 1)!2 for any resource i ∈ Cx while ǫ4 · exp(−u· ( ǫ2 4· (C + 1)! )2) + 29 (C + 3)!4 ǫ6 1 T · ∀u ≥ 1, (12) P[bx,t(i)− nx,t · b(i) ≥ 28 (C + 3)!3 ǫ6 for any resource i /∈ Cx. In particular, this implies that: · ln(T )] ≤ 210 (C + 4)!4 ǫ6 · T , E[nx k,T ] ≥ ξx k · E[nx,T ]− 210 (C + 3)!4 ǫ9 , (13) (14) for any arm k ∈ Kx. Next, we show that a suboptimal basis cannot be selected more than O(ln(T )) times on average at Step- Simplex. Just like in Section 6, the exact definition of the load balancing algorithms has little impact on the result: we only need to know that, for any feasible basis x, each arm k ∈ Kx is pulled at least a fraction of the time x is selected with high probability. LEMMA 15. For any suboptimal basis x ∈ B, we have: E[nx,T ] ≤ 210 (C + 3)!3 · λ2 ǫ6 · ln(T ) (∆x)2 + 211 (C + 4)!4 ǫ6 . We are now ready to derive both distribution-dependent and distribution-independent regret bounds. THEOREM 8. We have: RB(1),··· ,B(C−1),T ≤ 210 (C + 3)!3 · λ2 ǫ6 · ( Xx∈B ∆x>0 1 ∆x where the O notation hides universal constant factors. )· ln(T ) + O( σ ·B· (C + 3)!4 ǫ6 · ln(T )), THEOREM 9. We have: RB(1),··· ,B(C−1),T ≤ 25 (C + 3)!2 · λ ǫ3 where the O notation hides universal constant factors. ·pB· T · ln(T ) + O( σ ·B· (C + 3)!4 ǫ6 · ln(T )), Since the number of feasible bases is at most 2K C, we get the distribution-dependent regret bound RB(1),··· ,B(C−1),T = O(K C · (C + 3)!4/ǫ6 · (λ2/∆ + σ) · ln(T )) where ∆ = minx∈B ∆x>0 ∆x and the distribution-independent bound RB(1),··· ,B(C−1),T = O((C + 3)!2 · λ/ǫ3 ·pK C · T · ln(T )). We stress that the dependence on K and C is not optimal since Agrawal and Devanur [1] obtain a O(√K · T ) distribution- independent bound on regret, where the O notation hides factors logarithmic in T . Just like in Section 6, we can also derive regret bounds that vanish with b under the assumption that pulling any arm incurs some positive amount of resource consumption in expectations for all resources, but this requires a minor tweak of the algorithm. Flajolet and Jaillet: Logarithmic Regret Bounds for BwK THEOREM 10. Suppose that: ǫ ≤ min i=1,··· ,C−1 k=1,··· ,K µc k(i) 27 and that b ≤ ǫ. If the decision maker artificially constrains himself or herself to a time horizon T = b· T /ǫ ≤ T , then the regret bounds derived in Theorems 8 and 9 hold with T substituted with T . Similarly, if the decision maker is not constrained by a time horizon, artificially constraining himself or herself to a time horizon T = mini=1,··· ,C B(i)/ǫ yields the regret bounds derived in Theorems 8 and 9 with T substituted with T . Applications. In dynamic pricing and online advertising applications, Assumption 7 is usually not satis- fied as pulling an arm typically incurs the consumption of only a few resources. We can relax this assumption but this comes at the price of an additive term of order O(ln2(T )) in the final regret bounds. THEOREM 11. If Assumption 7 is not satisfied, the regret bounds derived in Theorems 8 and 9 hold with σ = 0 up to an additive term of order O( (C+4)!4·B2 b·ǫ6 · ln2(T )). As for Assumption 8, the existence of degenerate optimal bases to (3) is determined by a complex interplay between the mean rewards and the mean amounts of resource consumption. However, we point out that the set of parameters (µr k(i))k=1,··· ,K,i=1,··· ,C that satisfy these conditions has Lebesgue measure 0, hence such an event is unlikely to occur in practice. Additionally, while ǫ is typically not known in applications, taking ǫ as a vanishing function of T yields the same asymptotic regret bounds. k)k=1,··· ,K and (µc 8. Concluding remark. In this paper, we develop an algorithm with a O(K C · ln(B)/∆) distribution- dependent bound on regret, where ∆ is a parameter that generalizes the optimality gap for the standard MAB problem. It is however unclear whether the dependence on K is optimal. Extensions discussed in Section A of the Appendix suggest that it may be possible to achieve a linear dependence on K but this calls for the development of more efficient load balancing algorithms. Appendix A: Extensions. A.1. Improving the multiplicative factors in the regret bounds. A.1.1. A single limited resource whose consumption is deterministic. If the amounts of resource consumed are deterministic, we can substitute the notation µc k for ck. Moreover, we can take λ = 1 and, going through the analysis of Lemma 5, we can slightly refine the regret bound. Specifically, we have 3 , for any arm k such that ∆k > 0. Moreover, τ ∗ ≤ B/ǫ + 1 in this setting E[nk,τ ∗] ≤ 16 (ck)2 · E[ln(τ ∗)] (∆k)2 + π2 since: B ≥ τ ∗−1 Xt=1 cat,t ≥ (τ ∗ − 1)· ǫ, by definition of τ ∗. As a result, the regret bound derived in Theorem 1 turns into: RB ≤ 16( Xk ∆k>0 1 ck · ∆k )· ln( B ǫ + 1) + O(1), which is identical (up to universal constant factors) to the bound obtained by Tran-Thanh et al. [24]. Note that this bound is scale-free. 28 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK A.1.2. Arbitrarily many limited resources whose consumptions are deterministic. We propose another load balancing algorithm that couples bases together. This is key to get a better dependence on K because, otherwise, we have to study each basis independently from the other ones. Algorithm: Load balancing algorithm Ax for a feasible basis x ∈ B. If x is selected at time t, pull any arm at ∈ arg max k∈Kx ξx k nk,t . Observe that this load balancing algorithm is computationally efficient with a O(K) runtime (once we have computed an optimal basic feasible solution to (8)) and requires O(K) memory space. The shortcoming of this approach is that, if there are multiple optimal bases to (3), the optimal load balance for each optimal basis will not be preserved since we take into account the number of times we have pulled each arm when selecting any basis (for which we strive to enforce different ratios). Hence, the following assumption will be required for the analysis. ASSUMPTION 9. There is a unique optimal basis to (3). Regret Analysis. All the proofs are deferred to Section G. We start by bounding, for each arm k, the number of times this arm can be pulled when selecting any of the suboptimal bases. This is in stark contrast with the analysis carried out in Section 5 where we bound the number of times each suboptimal basis has been selected. LEMMA 16. For any arm k ∈ {1,··· , K}, we have: ρ· (PC E[ Xx∈B k∈Kx, x6=x∗ where ∆k = minx∈B k∈Kx, x6=x∗ ∆x. nx k,τ ∗] ≤ 16 i=1 b(i))2 ǫ2 E[ln(τ ∗)] (∆k)2 + K · π2 3 , · l,t)k,l∈Kx remain close to the optimal l )k,l∈Kx at all times for the optimal basis x = x∗. This will not allow us to derive distribution-free k,t/nx k /ξx In contrast to Section 5, we can only guarantee that the ratios (nx ones (ξx regret bounds for this particular class of load balancing algorithms. LEMMA 17. At any time t and for any arm k ∈ Kx∗ , we have: l − ρ· ( Xx∈B,x6=x∗ nk,t ≥ nx∗,t · ξx∗ l=1 ξx∗ k and PK nk,t ≤ nx∗,t · PK k ξx∗ l=1 ξx∗ l nx,t + 1) + Xx∈B,x6=x∗ nx,t + 1. (15) (16) + 1) + O(1), Bringing everything together, we are now ready to establish regret bounds. THEOREM 12. We have: RB(1),··· ,B(C) ≤ 32 ρ3 · (PC i=1 b(i))3 ǫ3 · b · ( K Xk=1 where the O notation hides universal constant factors. 1 (∆k)2 )· ln(PC i=1 b(i)· B ǫ We derive a distribution-dependent regret bound of order O(ρ3· K · ln(B) no non-trivial distribution-free regret bound. ∆2 ) where ∆ = minx∈B ∆x>0 ∆x but Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 29 A.1.3. Arbitrarily many limited resources. A straightforward extension of the load balancing algo- rithm developed in the case of deterministic resource consumption in Section A.1.2 guarantees that the total number of times any suboptimal basis is pulled is of order O(K · ln(T )). However, in contrast to Section A.1.2, this is not enough to get logarithmic regret bounds as ξx k,t fluctuates around the optimal load balance k,t with a magnitude of order at least ∼ 1/√t, and, as a result, the ratios (E[nx ξx l,T ])k,l∈Kx might be very different from the optimal ones (ξx k,T ]/E[nx k /ξx l )k,l∈Kx. Algorithm: Load balancing algorithm Ax for a feasible basis x ∈ B. If x is selected at time t, pull any arm at ∈ arg max k∈Kx ξx k,t nk,t . LEMMA 18. For any arm k ∈ {1,··· , K}, we have: E[ Xx∈B k∈Kx, ∆x>0 where ∆k = minx∈B k∈Kx, ∆x>0 ∆x. nx k,T ] ≤ 16C · λ2 · ln(T ) (∆k)2 + 212 K · (C + 3)!2 ǫ6 , A.2. Relaxing Assumption 1. The regret bounds obtained in Sections 5, 6, and 7 can be extended when the ratios converge as opposed to being fixed, as precisely stated below, but this requires slightly more work. ASSUMPTION 10. For any resource i ∈ {1,··· , C}, the ratio B(i)/B(C) converges to a finite value b(i) ∈ (0, 1]. Moreover, b = min i=1,··· ,C To state the results, we need to redefine some notations and to work with the linear program: b(i) is a positive quantity. K sup (ξk)k=1,··· ,K subject to µr k · ξk K Xk=1 Xk=1 ξk ≥ 0, µc k(i)· ξk ≤ , B(i) B(C) k = 1,··· , K. i = 1,··· , C (17) We redefine B as the set of bases that are feasible to (17) and, for x ∈ B, ∆x is redefined as the optimality gap of x with respect to (17). We also redefine O = {x ∈ B ∆x = 0} as the set of optimal bases to (17). Moreover, we define B∞ (resp. O∞) as the set of feasible (resp. optimal) bases to (3) and, for x ∈ B∞, ∆∞x is the optimality gap of x with respect to (3). Our algorithm remains the same provided that we substitute b(i) with B(i)/B(C) for any resource i ∈ {1,··· , C}. Specifically, Step-Simplex consists in solving: K sup (ξk)k=1,··· ,K subject to K Xk=1 Xk=1 ξk ≥ 0, (¯ck,t(i)− ηi · ǫk,t)· ξk ≤ B(i) B(C) , i = 1,··· , C (18) (¯rk,t + λ· ǫk,t)· ξk k = 1,··· , K and Step-Load-Balance is identical up to the substitution of b(i) with B(i)/B(C). 30 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK Regret Analysis. As it turns out, the logarithmic regret bounds established in Theorems 3, 5, and 8 do not always extend when Assumption 1 is relaxed even though these bounds appear to be very similar to the one derived in Theorem 1 when there is a single limited resource. The fundamental difference is that the set of optimal bases may not converge while it is always invariant in the case of a single limited resource. Typically, the ratios (B(i)/B(C))i=1,···,C may oscillate around (b(i))i=1,··· ,C in such a way that there exist two optimal bases for (3) while there is a unique optimal basis for this same optimization problem whenever the right-hand side of the inequality constraints is slightly perturbed around this limit. This alternately causes one of these two bases to be slightly suboptimal, a situation difficult to identify and to cope with for the decision maker. Nevertheless, this difficulty does not arise in several situations of interest which generalize Assumption 1, as precisely stated below. The proofs are deferred to Section G. Arbitrarily many limited resources whose consumptions are deterministic. THEOREM 13. Suppose that Assumption 10 holds. If there exists a unique optimal basis to (3) or if B(i)/B(C)− b(i) = O(ln(B(C))/B(C)) for all resources i ∈ {1,··· , C − 1} then, we have: RB(1),··· ,B(C) = O( ρ·PC i=1 b(i) ǫ· b · ( Xx∈B∞ ∆∞ x >0 1 ∆∞x )· ln(PC i=1 b(i)· B(C) ǫ + 1) +O∞· ln(B(C)) ǫ· b ), where the O notation hides universal constant factors. A time horizon and another limited resource. THEOREM 14. (0, 1]. If there exists a unique optimal basis to (3) or if B/T − b = O(ln(T )/T ), then, we have: Suppose that Assumptions 4, 5, and 6 hold and that the ratio B/T converges to b ∈ RB,T = O( λ2 ǫ3 · ( Xx∈B∞ ∆∞ x >0 1 ∆∞x )· ln(T ) + K 2 · σ ǫ3 · ln(T )), where the O notation hides universal constant factors. Arbitrarily many limited resources with a time horizon. THEOREM 15. Suppose that Assumptions 7, 8, and 10 hold. If there exists a unique optimal basis to (3) or if B(i)/T − b(i) = O(ln(T )/T ) for all resources i ∈ {1,··· , C − 1}, then, we have: RB(1),··· ,B(C−1),T = O( (C + 3)!3 · λ2 ǫ6 · ( Xx∈B∞ ∆∞ x >0 1 ∆∞x )· ln(T ) + σ ·B∞· (C + 3)!4 ǫ6 · ln(T )), where the O notation hides universal constant factors. Appendix B: Proofs for Section 3. B.1. Proof of Lemma 2. The proof can be found in Badanidiyuru et al. [8]. For the sake of complete- ness, we reproduce it here. The optimization problem (3) is a linear program whose dual reads: C inf (ζi)i=1,··· ,C subject to b(i)· ζi C Xi=1 Xi=1 ζi ≥ 0, µc k(i)· ζi ≥ µr k, k = 1,··· , K (19) i = 1,··· , C. Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 31 Observe that (3) is feasible therefore (3) and (19) have the same optimal value. Note that (3) is bounded under Assumption 2 as ξk ∈ [0, b(i)/µc k(i)] for any feasible point and any resource i ∈ {1,··· , C} such that k(i) > 0. Hence, (19) has an optimal basic feasible solution (ζ∗1 ,··· , ζ∗C). Consider any non-anticipating µc algorithm. Let Zt be the sum of the total payoff accumulated in rounds 1 to t plus the "cost" of the remaining i=1 ζ∗i · (B(i)−Pt τ =1 raτ ,τ +PC resources, i.e. Zt =Pt τ =1 caτ ,τ (i)). Observe that (Zt)t is a supermartingale i=1 ζ∗i · µc with respect to the filtration (Ft)t as E[Zt Ft−1] = E[µr at(i) Ft−1] + Zt−1 ≤ Zt−1 since (ζ∗1 ,··· , ζ∗C) is feasible for (19). Moreover, note that (Zt)t has bounded increments since Zt − Zt−1 = i=1 ζ∗i · cat,t(i) ≤ 1 +PC rat,t −PC i=1 ζ∗i < ∞. We also have E[τ ∗] < ∞ as: at −PC ∞ E[τ ∗] = t ∞ ∞ P[ t−1 ≤ Xt=1 P[τ ∗ ≥ t] Xτ =1 Xt=1 Xt=1 ≤ 1 + ≤ (PC < ∞, i=1 B(i) P[ ǫ C caτ ,τ (i) ≤ B(i), i = 1,··· , C] Xτ =1 caτ ,τ (i) ≤ t· ǫ− (t· ǫ− Xt≥ exp(− Xi=1 + 2) + i=1 ǫ PC ∞ B(i) C B(i))] Xi=1 2(t· ǫ−PC i=1 B(i))2 t ) where the third inequality results from an application of Lemma 1 and µc k(i). ǫ = min k=1,··· ,K i=1,··· ,C with µc k (i)>0 By Doob's optional stopping theorem, E[Zτ ∗] ≤ E[Z0] =PC C i=1 ζ∗i · B(i). Observe that: Xi=1 ζ∗i · caτ ∗ ,τ ∗(i) + Zτ ∗−1] τ ∗−1 Xt=1 Using Assumption 2 and since (ζ∗i )i=1,··· ,C is a basic feasible solution, for every i ∈ {1,··· , C} such that ζ∗i > 0 there must exist k ∈ {1,··· , K} such that ζ∗i ≤ µr E[Zτ ∗] = E[raτ ∗ ,τ ∗ − Xi=1 k(i) > 0. We get: k(i) with µc ≥ E[− rat,t]. ζ∗i + k/µc C E[Zτ ∗] ≥ E[ τ ∗−1 Xt=1 rat,t]− max k=1,··· ,K i=1,··· ,C with µc k(i)>0 µr k k(i) µc and finally: E[ τ ∗−1 Xt=1 rat,t] ≤ C Xi=1 Xi=1 = B · C ζ∗i · B(i) + max k=1,··· ,K i=1,··· ,C with µc k (i)>0 µr k k(i) µc ζ∗i · b(i) + max k=1,··· ,K i=1,··· ,C with µc k(i)>0 µr k k(i) µc . By strong duality,PC i=1 ζ∗i · b(i) is also the optimal value of (3). 32 Appendix C: Proofs for Section 4. Flajolet and Jaillet: Logarithmic Regret Bounds for BwK C.1. Proof of Lemma 4. By definition of τ ∗, we havePτ ∗−1 sides yields: t=1 cat,t ≤ B. Taking expectations on both τ ∗−1 τ ∗ = ∞ cat,t] Xt=1 B ≥ E[ Xt=1 cat,t]− 1 ≥ E[ ∞ Xt=1 E[Iτ ∗≥t · cat,t]− 1 Xt=1 Xt=1 Xt=1 ≥ = E[τ ∗]· ǫ− 1, E[Iτ ∗≥t · ǫ]− 1 E[Iτ ∗≥t · µc at ]− 1 ∞ ∞ = = E[Iτ ∗≥t · E[cat,t Ft−1]]− 1 where we use the fact that ck,t ≤ 1 for all arms k to derive the second inequality, the fact that τ ∗ is a stopping time for the second equality, the fact that at is deterministically determined by the past, i.e. at ∈ Ft−1, for the third equality and Assumption 2 for the third inequality. We conclude that E[τ ∗] ≤ B+1 . ǫ C.2. Proof of Lemma 5. We break down the analysis in a series of facts. Consider any arm k such that ∆k > 0. We use the shorthand notation βk = 25( λ µc k )2 · ( 1 ∆k )2. Fact 1 τ ∗ Xt=1 E[nk,τ ∗] ≤ 2βk · E[ln(τ ∗)] + E[ Iat=k · Ink,t≥βk ln(t)]. (20) Proof. Define the random variable Tk = βk · ln(τ ∗). We have: E[nk,τ ∗] = E[nk,τ ∗ · Ink,τ ∗ <Tk] + E[nk,τ ∗ · Ink,τ ∗≥Tk ] ≤ βk · E[ln(τ ∗)] + E[nk,τ ∗ · Ink,τ ∗≥Tk ]. Define T ∗k as the first time t such that nk,t ≥ Tk and T ∗k = ∞ if no such t exists. We have: τ ∗ Xt=1 Iat=k · Ink,τ ∗≥Tk ] E[nk,τ ∗ · Ink,τ ∗≥Tk] = E[ Xt=1 k −1 · Ink,τ ∗≥Tk] + E[ ≤ E[nk,T ∗ Iat=k · Ink,τ ∗≥Tk ] + E[ T ∗ k −1 = E[ τ ∗ k τ ∗ Iat=k · Ink,τ ∗≥Tk] Xt=T ∗ Xt=T ∗ Iat=k · Ink,t≥Tk ] k τ ∗ Xt=1 ≤ βk · E[ln(τ ∗)] + E[ Iat=k · Ink,t≥βk ln(t)], Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 33 since, by definition of T ∗k , nk,T ∗ k −1 ≤ Tk if T ∗k if finite, which is always true if nk,τ ∗ ≥ Tk (the sequence (nk,t)t is non-decreasing and τ ∗ is finite almost surely as a byproduct of Lemma 4). Conversely, nk,t ≥ Tk ≥ βk ln(t) for t ∈ {T ∗k ,··· , τ ∗}. Wrapping up, we obtain: Xt=1 E[nk,τ ∗] ≤ 2βk · E[ln(τ ∗)] + E[ Iat=k · Ink,t≥βk ln(t)]. τ ∗ Fact 1 enables us to assume that arm k has been pulled at least βk ln(t) times out of the last t time periods. The remainder of this proof is dedicated to show that the second term of the right-hand side of (20) can be bounded by a constant. Let us first rewrite this term: τ ∗ E[ Xt=1 τ ∗ τ ∗ Xt=1 Iat=k · Ink,t≥βk ln(t)] ≤ E[ Xt=1 ≤ E[ Xt=1 Xt=1 + E[ + E[ τ ∗ τ ∗ Iobjk,t+Ek,t≥objk∗,t+Ek∗,t · Ink,t≥βk ln(t)] Iobjk,t≥objk+Ek,t] Iobjk∗,t≤objk∗−Ek∗,t] Iobjk∗ <objk+2Ek,t · Ink,t≥βk ln(t)]. (21) (22) (23) To derive this last inequality, simply observe that if objk,t < objk + Ek,t and objk∗,t > objk∗ − Ek∗,t while objk,t + Ek,t ≥ objk∗,t + Ek∗,t, it must be that objk∗ < objk + 2Ek,t. Let us study (21), (22), and (23) separately. Fact 2 τ ∗ Iobjk∗ <objk+2Ek,t · Ink,t≥βk ln(t)] ≤ 2π2 3ǫ2 . E[ Xt=1 Proof. Observe that when both nk,t ≥ βk ln(t) and objk∗ < objk + 2Ek,t, we have: ∆k 2 < Ek,t λ ¯ck,t ·r 2 µc k 2¯ck,t · βk ∆k 2 , ≤ ≤ by definition of βk. This implies that ¯ck,t ≤ µc k/2. Thus: τ ∗ τ ∗ E[ Xt=1 Xt=1 Iobjk∗ <objk+2Ek,t · Ink,t≥βk ln(t)] ≤ E[ I¯ck,t<µc k /2 · Ink,t≥βk ln(t)] We upper bound this last term using the concentration inequalities of Lemma 1 observing that: E[ ∞ Xt=1 I¯ck,t<µc k /2 · Ink,t≥βk ln(t)] = ≤ ∞ ∞ Xt=1 Xt=1 µc k 2 ; nk,t ≥ βk ln(t)] P[¯ck,t < µc k − µc k 2 ; nk,t = s]. P[¯ck,t < t Xs=βk ln(t) 34 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK Denote by t1,··· , ts the first s random times at which arm k is pulled (these random variables are finite almost surely). We have: P[¯ck,t < µc k − µc k 2 s Xl=1 ; nk,t = s] ≤ P[ ck,tl < s· µc k − s· µc k 2 ]. Observe that, for any l ≤ s: ∞ Xτ =1 E[ck,tl ck,t1,··· , ck,tl−1] = E[ Xτ =1 = E[ ∞ = µc k, Itl=τ · E[ck,τ Fτ−1] ck,t1,··· , ck,tl−1] Itl=τ · µc k ck,t1,··· , ck,tl−1] since the algorithm is not randomized ({tl = τ} ∈ Fτ−1) and using the tower property. Hence, we can apply Lemma 1 to get: P[¯ck,t < µc k 2 ∞ Xt=1 ; nk,t ≥ βk ln(t)] ≤ k)2 (µc 2 ) · βk ln(t)) ∞ ∞ k)2 2 ∞ 1 ∞ ≤ ≤ exp(−s· k)2 2 Xs=βk ln(t) exp(− (µc 1− exp(− (µc Xt=1 Xt=1 Xt=1 1− exp(− (µc 2π2 3(µc k)2 2π2 3ǫ2 , )2 ≥ 25( 1+ 1 ≤ ≤ k)2 2 (µc ) ) 1 t2 where we use the fact that βk ≥ 25( 1+κ Assumption 3), the fact that exp(−x) ≤ 1 − x µc k the last inequality. µr k∗ k∗ )2 · ( µc k)2 for the third inequality (using 2 for x ∈ [0, 1] for the fourth inequality, and Assumption 2 for )2 ≥ 4 κ µc k Let us now elaborate on (21). Fact 3 τ ∗ Proof. Note that if ¯rk,t/¯ck,t = objk,t ≥ objk + Ek,t = µr µc k − ǫk,t, otherwise we would have: ¯rk,t ¯ck,t − k)µc = µr k µc k E[ Xt=1 Iobjk,t≥objk+Ek,t] ≤ k/µc π2 3 . k + Ek,t, then either ¯rk,t ≥ µr k + ǫk,t or ¯ck,t ≤ k − ¯ck,t)µr k k + (µc ¯ck,t · µc µr k µc k k < (¯rk,t − µr ǫk,t ǫk,t ¯ck,t · ¯ck,t ǫk,t ¯ck,t + ≤ (1 + κ)· = Ek,t, a contradiction. Therefore: Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 35 k + ǫk,t] + P[¯ck,t ≤ µc k − ǫk,t] τ ∗ E[ Xt=1 Iobjk,t≥objk+Ek,t] ≤ ≤ + = + ≤ = ∞ ∞ ∞ ∞ Xt=1 Xt=1 Xt=1 Xt=1 Xt=1 Xt=1 ∞ ∞ π2 3 , t t t s s k +r 2 ln(t) k −r 2 ln(t) rk,tl ≥ s· µr P[¯rk,t ≥ µr P[¯rk,t ≥ µr Xs=1 Xs=1 Xs=1 Xs=1 Xs=1 P[¯ck,t ≤ µc Xl=1 Xl=1 2 exp(−4 ln(t)) ck,tl ≤ s· µc P[ P[ s s t t ; nk,t = s] ; nk,t = s] k +ps· 2 ln(t) ; nk,t = s] k −ps· 2 ln(t) ; nk,t = s] where the random variables (tl)l are defined similarly as in the proof of Fact 2 and the last inequality results from an application of Lemma 1. What remains to be done is to bound (22). Fact 4 τ ∗ Iobjk∗,t≤objk∗−Ek∗,t] ≤ π2 3 . E[ Xt=1 Proof. We proceed along the same lines as in the proof of Fact 3. As a matter of fact, the situation is perfectly symmetric because, in the course of proving Fact 3, we do not rely on the fact that we have pulled k∗ − Ek∗,t, arm k more than βk ln(t) times at any time t. If ¯rk∗,t/¯ck∗,t = objk∗,t ≤ objk∗ − Ek∗,t = µr then we have either ¯rk∗,t ≤ µr k∗ + ǫk∗,t, otherwise we would have: k∗ /µc k∗ − ǫk∗,t or ¯ck∗,t ≥ µc ¯rk∗,t ¯ck∗,t − µr k∗ µc k∗ = k∗ )µc k∗ + (µc ¯ck∗,t · µc k∗ µr k∗ µc k∗ ǫk∗,t ¯ck∗,t · ǫk∗,t ¯ck∗,t (¯rk∗,t − µr ǫk∗,t > − ¯ck∗,t − ≥ −(1 + κ)· = −Ek∗,t, k∗ − ¯ck∗,t)µr k∗ a contradiction. Therefore: τ ∗ E[ Xt=1 ∞ k∗ +ǫk,t] t Xt=1 Iobjk∗,t≤objk∗−Ek∗,t] ≤ E[ I¯rk∗,t≤µr ∞ Xs=1 Xt=1 Xs=1 Xt=1 ≤ ∞ + t k∗−ǫk,t + I¯ck∗,t≥µc k∗ −r 2 ln(t) k∗ +r 2 ln(t) s s P[¯rk∗,t ≤ µr P[¯ck∗,t ≥ µc ; nk∗,t = s] ; nk∗,t = s] 36 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 2 t4 t Xs=1 ≤ = ∞ Xt=1 π2 3 , where the third inequality is obtained using Lemma 1 in the same fashion as in Fact 3. We conclude: E[nk,τ ∗] ≤ 2βk · E[ln(τ ∗)] + 4π2 3ǫ2 . C.3. Proof of Theorem 1. First observe that: τ ∗ E[ Xt=1 rat,t] = = = = = ∞ ∞ ∞ Xt=1 Xt=1 Xt=1 Xk=1 Xk=1 K K E[Iτ ∗≥t · E[rat,t Ft−1]] K E[Iτ ∗≥t · µr at] Xk=1 µr k · E[Iτ ∗≥t · Iat=k] ∞ Xt=1 µr k · E[ µr k · E[nk,τ ∗], Iτ ∗≥t · Iat=k] since τ ∗ is a stopping time. Plugging this equality into (9) yields: µr k · E[nk,τ ∗] + O(1) RB ≤ B · µr k∗ µc = K Xk=1 µr k∗ k∗ − µc k∗ · (B − Xk ∆k=0 µc k · E[nk,τ ∗])− Xk ∆k>0 Along the same lines as for the rewards, we can show that E[Pτ ∗ of τ ∗, we have B ≤Pτ ∗ K µr k · E[nk,τ ∗ ] + O(1). t=1 cat,t almost surely. Taking expectations on both sides yields: t=1 cat,t] =PK k=1 µc k · E[nk,τ ∗]. By definition Xk=1 B ≤ = Xk ∆k=0 µc k · E[nk,τ ∗] k · E[nk,τ ∗] + Xk ∆k>0 µc µc k · E[nk,τ ∗]. Plugging this inequality back into the regret bound, we get: RB ≤ Xk ∆k>0 = Xk ∆k>0 ( k − µr µr k∗ k∗ · µc µc µc k · ∆k · E[nk,τ ∗ ] + O(1). k)· E[nk,τ ∗] + O(1) (24) Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 37 Using the upper bound of Lemma 4, the concavity of the logarithmic function, and Lemma 5, we derive: RB ≤ 26λ2 · ( Xk ∆k>0 ≤ 26λ2 · ( Xk ∆k>0 k∗ ≤ κ and µc since ∆k ≤ µr k∗/µc k ≤ 1 for any arm k. 1 µc k · ∆k 1 µc k · ∆k )· ln( )· ln( B + 1 ǫ B + 1 ǫ ) + 4π2 3ǫ2 · ( Xk ∆k>0 ) + K · 4π2κ 3ǫ2 + O(1), µc k · ∆k) + O(1) Appendix D: Proofs for Section 5. D.1. Proof of Lemma 8. Consider any suboptimal basis x ∈ B. The proof is along the same lines as for Lemma 5 and follows the exact same steps. We use the shorthand notation βx = 8ρ· ( PK k=1 ξx k ∆x )2. Fact 5 Xt=1 E[nx,τ ∗] ≤ 2βx · E[ln(τ ∗)] + E[ Ixt=x · Inx,t≥βx ln(t)]. τ ∗ (25) We omit the proof as it is analogous to the proof of Fact 1. As in Lemma 5, we break down the second term in three terms and bound each of them by a constant: τ ∗ E[ Xt=1 τ ∗ τ ∗ Xt=1 Ixt=x · Inx,t≥βx ln(t)] = E[ Xt=1 ≤ E[ Xt=1 Xt=1 + E[ + E[ τ ∗ τ ∗ Iobjx,t+Ex,t≥objx∗,t+Ex∗,t · Inx,t≥βx ln(t)] Iobjx,t≥objx+Ex,t] Iobjx∗,t≤objx∗−Ex∗,t] Iobjx∗ <objx+2Ex,t · Inx,t≥βx ln(t)]. (26) (27) (28) Fact 6 τ ∗ Iobjx∗ <objx+2Ex,t · Inx,t≥βx ln(t)] = 0. E[ Xt=1 Proof. If objx∗ < objx + 2Ex,t, we get: ∆x 2 ξx < Xk∈Kx ≤ Xk∈Kx ≤sXk∈Kx nk,t k ·s 2 ln(t) k ·s 2 ln(t) k · Xk∈Kxpξx ρ + nx k,t ξx ξx k ·s 2 ln(t) nx,t , 38 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK where we use (10) and Lemma 6 for each k ∈ Kx such that ξx k 6= 0 (otherwise, if ξx k = 0, the inequality is trivial). This implies: nx,t < 8ρ· (PK k=1 ξx ∆x = βx · ln(t), k )2 · ln(t) using the Cauchy−Schwarz inequality and the fact that a basis involves at most ρ arms. Fact 7 τ ∗ Iobjx,t≥objx+Ex,t] ≤ ρ· π2 6 . E[ Xt=1 Proof. If objx,t ≥ objx + Ex,t, there must exist k ∈ Kx such that ¯rk,t ≥ µr k + ǫk,t, otherwise: objx,t − objx = Xk∈Kx < Xk∈Kx = Ex,t, k)· ξx k (¯rk,t − µr ǫk,t · ξx k where the inequality is strict because there must exist l ∈ Kx such that ξx l > 0 as a result of Assumption 2 (at least one resource constraint is binding for a feasible basis to (3) aside from the basis x associated with Kx = ∅). We obtain: τ ∗ E[ Xt=1 Iobjx,t≥objx+Ex,t] ≤ Xk∈Kx ≤ ρ· π2 6 ∞ Xt=1 , P[¯rk,t ≥ µr k + ǫk,t] where the last inequality is derived along the same lines as in the proof of Fact 3. Fact 8 Proof. Similar to Fact 7. τ ∗ E[ Xt=1 Iobjx∗,t≤objx∗−Ex∗,t] ≤ ρ· π2 6 . D.2. Proof of Theorem 3. The proof proceeds along the same lines as for Theorem 1. We build upon (4): K τ ∗ RB(1),··· ,B(C) ≤ B · = B · = B · K Xk=1 Xk=1 Xk=1 K k · ξx∗ µr k · ξx∗ µr k − Xt=1 k − E[ ∞ Xt=1 E[Iτ ∗≥t · Xt=1 E[Iτ ∗≥t · ∞ k · ξx∗ µr k − rat,t] + O(1) K K Xk=1Xx∈B Xk=1Xx∈B rk,t · Ixt=x,at=k] + O(1) Ixt=x,at=k · E[rk,t Ft−1]] + O(1) Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 39 = B · = B · K K Xk=1 Xk=1 k · ξx∗ k −Xx∈B µr k · ξx∗ k −Xx∈B µr K K Xk=1 Xk=1 τ ∗ Xt=1 µr k · E[ k · E[nx µr Ixt=x,at=k] + O(1) k,τ ∗] + O(1), where we use the fact that xt and at are determined by the events of the first t − 1 rounds and that τ ∗ is a stopping time. Using the properties of the load balancing algorithm established in Lemma 6, we derive: K ξx k l=1 ξx K K K = ( RB(1),··· ,B(C) ≤ B · {µr k · E[nx,τ ∗] k=1 ξx l · E[nx,τ ∗]− ρ} + O(1) k )− (ρ)2} + O(1) µr k · ξx k · ξx∗ Xk=1 k −Xx∈B Xk∈Kx µr k · ξx∗ Xk=1 k −Xx∈B µr { = B · PK k · ξx∗ Xk=1 k )· (B − Xx∈B ∆x=0 µr Xk=1 − Xx∈B ∆x>0 {( PK Now observe that, by definition, at least one resource is exhausted at time τ ∗. Hence, there exists i ∈ {1,··· , C} such that the following holds almost surely: ck(i)· nx PK Xk=1 k · ( E[nx,τ ∗] PK k=1 ξx k } + O(1). E[nx,τ ∗] k=1 ξx µr k · ξx k )· K ) k k,τ ∗ ξx k l=1 ξx B(i) ≤Xx∈B Xk∈Kx ≤Xx∈B Xk∈Kx [ck(i)· ( PK k · Xk∈Kx = B· ρ +Xx∈B PK ≤ B· ρ + b(i)·Xx∈B PK nx,τ ∗ k=1 ξx nx,τ ∗ k=1 ξx k , l · nx,τ ∗ + 1)] ck(i)· ξx k where we use Lemma 6 again and the fact that any basis x ∈ B satisfies all the constraints of (3). We conclude that the inequality: Xx∈B ∆x=0 nx,τ ∗ k=1 ξx k PK ≥ B − Xx∈B ∆x>0 nx,τ ∗ k=1 ξx k − B· ρ b PK holds almost surely. Taking expectations on both sides and plugging the result back into the regret bound yields: K k=1 µr (PK RB(1),··· ,B(C) ≤ Xx∈B ∆x>0 k )· B· ρ k · ξx∗ Xk=1 µr ≤ Xx∈B ∆x>0 PK ∆x k=1 ξx + ( b k=1 µr k · ξx k ) k · ξx∗ k −PK PK k=1 ξx + O(1) k k · E[nx,τ ∗] + O(1), · E[nx,τ ∗] (29) (30) 40 where we use the fact that: K Xk=1 k · ξx∗ µr k ≤ Flajolet and Jaillet: Logarithmic Regret Bounds for BwK (31) i=1 ck(i) k · ξx∗ ck(i)· ξx∗ k K C = ǫ K Xk=1 PC 1 Xk=1 Xi=1 ǫ · ≤ PC i=1 b(i) ǫ , using Assumption 2 and the fact that x∗ is a feasible basis to (3). Using Lemma 7, Lemma 8, and the concavity of the logarithmic function, we obtain: k ǫ + + 1) π2 3 i=1 b(i)· B )· ln(PC k=1 ξx ∆x ∆x k=1 ξx k RB(1),··· ,B(C) ≤ 16ρ· ( Xx∈B ∆x>0PK ρ· ( Xx∈B ∆x>0 PK ρ·PC · ( Xx∈B ∆x>0 To derive this last inequality, we use: (i) ∆x ≤PK i=1 b(i)/ǫ (see (31)), (ii) the fact that, for any basis x ∈ B, at least one of the first C inequalities is binding in (3), which implies that there exists i ∈ {1,··· , C} such that: )· ln(PC k ≤PC i=1 b(i)· B i=1 b(i) ǫ + 1) + O(1). k · ξx∗ ) + O(1) ≤ 16 k=1 µr 1 ∆x ǫ ck(i)· ξx k K Xk=1 K Xk=1 ξx k ≥ = b(i) ≥ b, and (iii) the inequality: K Xk=1 i=1 ck(i) · ξx k ck(i)· ξx k ξx k ≤ K C = ǫ K Xk=1 PC 1 Xk=1 Xi=1 ǫ · ≤ PC i=1 b(i) ǫ , for any basis x ∈ B. As a side note, observe a possibly better regret bound is given by: RB(1),··· ,B(C) ≤ 16ρ· ( Xx∈B ∆x>0 )· ln(T ) + O(1), if time is a limited resource since, in this case, τ ∗ ≤ T and the constraintPK 1 ∆x D.3. Proof of Theorem 4. Along the same lines as for the case of a single limited resource, we start from inequality (30) derived in the proof of Theorem 3 and apply Lemma 8 only if ∆x is big enough, taking into account the fact that: k=1 ξx k ≤ 1 is part of (3). E[nx,τ ∗] ≤ E[τ ∗] ≤PC ǫ i=1 b(i)· B + 1. Xx∈B Flajolet and Jaillet: Logarithmic Regret Bounds for BwK Specifically, we have: 41 RB(1),··· ,B(C) ≤ sup Px∈B nx≤ (nx)x∈B≥0 ǫ PC i=1 b(i)·B k=1 ξx ∆x k 16ρ·PK sup Px∈B nx≤ (nx)x∈B≥0 ǫ PC i=1 b(i)·B k=1 ξx ∆x k 16ρ·PK sup ≤ ≤ +1 ǫ { Xx∈B ∆x>0 · ln(PC { Xx∈B ∆x>0 · ln(PC { Xx∈B ∆x>0 ǫ +1 (nx)x∈B≥0 ǫ PC i=1 b(i)·B +1 i=1 b(i)· B Px∈B nx≤ ǫ ≤ 4sρ· ln(PC ≤ 4sρ·B· (PC i=1 b(i)· B where we use ∆x ≤PC i=1 b(i)/ǫ and PK Theorem 3), we maximize over ∆x/PK Cauchy-Schwartz for the last inequality. ǫ Appendix E: Proofs for Section 6. min( ∆x k=1 ξx k · nx, PK i=1 b(i)· B + 1) + min( ∆x k=1 ξx PK + 1)) } + i=1 b(i)· B ) } + O(1) ∆x k=1 ξx k π2 3 ρ· PK k · nx, π2 3 B· ρ ǫ + O(1) s16ρ· ln(PC i=1 b(i)· B ǫ + 1)· nx } + O(1) + 1)· sup (nx)x∈B≥0 ǫ PC i=1 b(i)·B Px∈B nx≤ { Xx∈B ∆x>0 +1 √nx } + O(1) ǫ + 1) + O(1), i=1 b(i)· B + 1)· ln(PC k ≥ b for the second inequality (see the end of the proof of k ≥ 0 for each x ∈ B to derive the third inequality, and we use k=1 ξx k=1 ξx E.1. Proof of Lemma 9. For any T ∈ N and any arm k ∈ {1,··· , K}, we denote by nopt k,T the expected number of times that arm k is pulled by the optimal non-anticipating algorithm (which is characterized by a high-dimensional dynamic program) when the time horizon is T and the budget is B = b · T . We prove the k∗,T = Ω(√T ) (Case A) or T − nopt k∗,T = o(√T ) (Case B) then claim in two steps. First, we show that if T − nopt k∗,T 6= Ω(√T ) EROPT(B, T ) = T · objx∗ − Ω(√T ). This is enough to establish the result because if T − nopt k∗,T )/√T that converges to 0 and we can conclude with Case then we can extract a subsequence of (T − nopt B. Case A: T − nopt k∗,T = Ω(√T ). Consider the linear program: K sup (ξk)k=1,··· ,K subject to µr k · ξk µc k · ξk ≤ b ξk ≤ 1 K Xk=1 Xk=1 Xk=1 ξk∗ ≤ Γ ξk ≥ 0, K k = 1,··· , K (32) 42 parametrized by Γ and its dual: Flajolet and Jaillet: Logarithmic Regret Bounds for BwK inf b· ζ1 + ζ2 + Γ· ζ3 (ζ1,ζ2,ζ3) subject to µc k · ζ1 + ζ2 ≥ µr k, k∗ · ζ1 + ζ2 + ζ3 ≥ µr µc ζ1, ζ2, ζ3 ≥ 0. k 6= k∗ k∗ (33) Since the vector (ξk)k=1,··· ,K determined by ξk∗ = 1 and ξk = 0 for k 6= k∗ is the only optimal solution to (32) when Γ = 1 (by assumption), we can find a strictly complementary optimal solution to the dual (33) ζ∗1 , ζ∗2 , ζ∗3 > 0. Moreover, by definition of nopt k∗,T , we can show, along the same lines as in the proof of Lemma 2, that EROPT(B, T ) is no larger than T times the optimal value of (32) when Γ = nopt k∗,T /T (up to a constant additive term of order O(1)). By weak duality, and since (ζ∗1 , ζ∗2 , ζ∗3 ) is feasible for (33) for any Γ, this implies: EROPT(B, T ) ≤ T · (b· ζ∗1 + ζ∗2 + ≤ T · (b· ζ∗1 + ζ∗2 + ζ∗3 − ≤ T · objx∗ − Ω(√T ), nopt k∗,T T · ζ∗3 ) + O(1) T − nopt k∗,T T · ζ∗3 ) + O(1) where we use the fact that b · ζ∗1 + ζ∗2 + ζ∗3 is the optimal value of (32) when Γ = 1 by strong duality (both (32) and (33) are feasible) and ζ∗3 > 0. k∗,T = o(√T ). First observe that since the vector (ξk)k=1,··· ,K determined by ξk∗ = 1 and ξk = 0 for k 6= k∗ is the only optimal solution to (3), it must be that µr k∗ > 0 (since 0 is a feasible solution to (3) with objective value 0). For any t ∈ N, denote by at the arm pulled by the optimal non-anticipating algorithm at time t and define τ ∗T as the corresponding stopping time when the time horizon is T . We have: Case B: T − nopt EROPT(B, T ) = E[ τ ∗ T −1 K k,T = rat,t] Xt=1 Xk=1 k · nopt µr ≤ Xk6=k∗ nopt k,T + µr ≤ (T − nopt k∗,T ) + µr = T · µr k∗ − µr = T · objx∗ − µr ≤ T · objx∗ − µr ≤ T · objx∗ − µr = T · objx∗ − µr k∗,T k∗ · (E[τ ∗T ]− 1) k∗ · nopt k∗ · (T − E[τ ∗T ] + 1) + o(√T ) k∗ · E[ 1] + o(√T ) T T T τ ∗ T −1 ck∗,t + Xt=1 Xt=τ ∗ Xt=τ ∗ cat,t − B)+] k∗ · E[( k∗ ·(cid:16)E[( Xt=1 {ck∗,t − b})+]− Xk6=k∗ {ck∗,t − b})+] + o(√T ). Xt=1 k∗ · E[( T T T nopt k,T(cid:17) + o(√T ) The first inequality is obtained using the fact that the rewards are bounded by 1. The second inequality k,T = E[τ ∗T ] − 1 ≤ T . The third inequality is obtained along the k=1 nopt is obtained using the fact that PK Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 43 same lines as in the proof of Lemma 3, usingPτ ∗ T −1 t=1 cat,t ≤ B by definition of τ ∗T . We use the inequality (y + z)+ ≥ y+ − z (true for any (y, z) ∈ R2) and the fact the amount of resource consumed at any step is no larger than 1 for the fourth inequality. Since (ck∗,t − b)t∈N is an i.i.d. zero-mean bounded stochastic t=1{ck,t − b})+] converges to a positive value and we conclude: process with positive variance, 1√T · E[(PT EROPT(B, T ) ≤ T · objx∗ − Ω(√T ), since µr k∗ > 0. E.2. Proof of Lemma 10. Consider x either an infeasible basis to (3) or a pseudo-basis for (3). Without loss of generality, we can assume that x involves two arms (one of which may be a dummy arm introduced in the specification of the algorithm given in Section 6) and that Kx = {k, l} with µc l > b (the situation is symmetric if the reverse inequality holds). Defining βx = 32/ǫ3, we have: k, µc T Ixt=x · Inx,t≥βx ln(t) · Ibx,t≥nx,t·(b+ǫ/2)] t T T + Ixt=x · Inx,t≥βx ln(t)] Xt=1 E[nx,T ] ≤ 2βx · ln(T ) + E[ Xt=1 ≤ 2βx · ln(T ) + E[ Xs=βx ln(T ) Xt=1 P[bx,t < s· (b + ǫ)− s· ǫ/2, nx,t = s] Xt=1 ≤ 2βx · ln(T ) + E[ Xt=1 ≤ 2βx · ln(T ) + E[ T T Ixt=x · Inx,t≥βx ln(t) · Ibx,t≥nx,t·(b+ǫ/2)] + Xt=1 Ixt=x · Inx,t≥βx ln(t) · Ibx,t≥nx,t·b+ǫβx/4·ln(t)] + Xs=βx ln(T ) 2π2 3ǫ2 . T ∞ exp(−s ǫ2 2 ) The first inequality is derived along the same lines as in Fact 1. The third inequality is obtained by observing that, as a result of Assumption 6, the average amount of resource consumed any time basis x is selected at Step-Simplex is at least b + ǫ no matter which of arm k or l is pulled. Finally, we use the same bounds as in Fact 2 for the last two inequalities. Observe that if x is selected at time t, either ¯ck,t − ǫk,t ≤ b or ¯cl,t − ǫl,t ≤ b, otherwise x would have been infeasible for (8). Moreover, if nx,t ≥ βx ln(T ), then we have either nx k,t ≥ βx/2 ln(T ) or nx l,t ≥ βx/2 ln(T ) since there are only two arms in Kx. By symmetry, we study the first situation and look at: T E[ k,t≥βx/2·ln(t) · Ibx,t≥nx,t·b+ǫβx/4·ln(t)] k,t≥βx/2·ln(t) · Ibx,t≥nx,t·b+ǫβx/4·ln(t) · I¯ck,τq−ǫk,τq≥b, q=qt−ǫβx/4 ln(t),··· ,qt ] t T T + Xt=1 Ixt=x · Inx Xt=1 Ixt=x · Inx ≤ E[ Xs=βx/4·ln(t) Xτ =1 Xt=1 Xt=1 Ixt=x · Inx ≤ E[ Xs=βx/4·ln(t) Xτ =1 Xt=1 ∞ + T T t t P[¯ck,τ < b + ǫ 2 , nk,τ = s] exp(−s· ǫ2 2 ) k,t≥βx/2·ln(t) · Ibx,t≥nx,t·b+ǫβx/4·ln(t) · I¯ck,τq−ǫk,τq≥b, q=qt−ǫβx/4 ln(t),··· ,qt ] Flajolet and Jaillet: Logarithmic Regret Bounds for BwK Ixt=x · Inx k,t≥βx/2·ln(t) · Ibx,t≥nx,t·b+ǫβx/4·ln(t) · I¯ck,τq−ǫk,τq≥b, q=qt−ǫβx/4 ln(t),··· ,qt ] 44 T Xt=1 ≤ E[ 2π2 3ǫ2 , + k,t − ǫβx/4 ln(t) ≥ βx/4 ln(t) for q = qt − ǫβx/4 ln(t),··· , qt and nk,τq ≥ nx where (τq)q∈N denote the random times at which basis x is selected and, for a time t at which basis x is selected, qt denotes the index q ∈ N such that τq = t. The first inequality is a consequence of nx k,τq = k,t − (qt − q) ≥ nx nx k,τq , which implies ǫk,τq ≤ ǫ/2. We use the same bounds as in Fact 2 for the last two inequalities. Now observe that, for any q ∈ {qt − ǫβx/4 ln(t),··· , qt}, we have ¯cl,τq − ǫl,τq ≤ b since ¯ck,τq − ǫk,τq ≥ b and since x is feasible basis to (8) at time τq (by definition). This implies that, for any q ∈ {qt − ǫβx/4 ln(t),··· , qt}, arm l was pulled at time τq by definition of the load balancing algorithm since the amount of resource consumed at any round cannot be larger than 1 and bx,τq ≥ bx,t− (qt− q) ≥ nx,t· b + ǫβx/4· ln(t)− (qt− q) ≥ nx,t· b ≥ nx,τqb. Hence, we get: T E[ k,t≥βx/2·ln(t) · Ibx,t≥nx,t·b+ǫβx/4·ln(t)] l,t≥ǫβx/4·ln(t) · I¯cl,t−ǫl,t≤b] + 2π2 3ǫ2 T ≤ Inx Xt=1 Ixt=x · Inx Xt=1 ≤ E[ Xt=1 P[¯cl,t ≤ b + Xs=ǫβx/4·ln(t) Xt=1 Xs=ǫβx/4·ln(t) Xt=1 4π2 3ǫ2 . ≤ ≤ ≤ T T T t ∞ ǫ 2 , nx l,t ≥ ǫβx/4· ln(t)] + P[¯cl,t ≤ b + ǫ2 2 exp(−s· ǫ 2 , nl,t = s] + ) + 2π2 3ǫ2 2π2 3ǫ2 2π2 3ǫ2 Bringing everything together, we derive: E[nx,T ] ≤ 26 ǫ3 · ln(T ) + 10π2 3ǫ2 . E.3. Proof of Lemma 11. Without loss of generality, we can assume that x involves two arms (one of which may be a dummy arm introduced in the specification of the algorithm given in Section 6) and that Kx = {k, l} with µc l . We say that a "swap" occurred at time τ if basis x was selected at time τ and ¯ck,τ − ǫk,τ ≤ b ≤ ¯cl,τ − ǫl,τ . We define nswap as the total number of swaps that have occurred before time t, x,t =Pt−1 i.e. nswap τ =1 Ixτ =x · I¯ck,τ −ǫk,τ≤b≤¯cl,τ−ǫl,τ . Consider u ≥ 1 and define γx = (4/ǫ)2. First note that: k > b > µc x,t t P[nswap x,t ≥ γx ln(t)] ≤ ≤ + t Xq=γx ln(t) Xq=γx ln(t) Xq=γx ln(t) t P[¯ck,τq − ǫk,τq ≤ b ≤ ¯cl,τq − ǫl,τq ] P[¯ck,τq ≤ b + ǫ 2 γx 2 , nk,τq ≥ γx 2 ln(t)] ln(t)] P[b− ǫ 2 ≤ ¯cl,τq, nl,τq ≥ Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 45 exp(−s· ǫ2 2 ) ∞ Xs=γx/2·ln(t) t Xq=1 ≤ 2 ǫ2 · t2 , ≤ 8 where (τq)q∈N are defined as the times at which basis x is selected. The first inequality is derived observing that if nswap x,t ≥ γx ln(t) then it must be that basis x was selected for the qth time, for some q ≥ γx ln(t), and that we had ¯ck,τq − ǫk,τq ≤ b ≤ ¯cl,τq − ǫl,τq . To obtain the second inequality, we observe that, at any time τ , at least one of arm k and l must have been pulled nx,τ /2 times and that ǫk,τ ≤ ǫ/2 when nk,τ ≥ γx/2 ln(t) (a similar inequality holds for arm l). The last two inequalities are derived in the same fashion as in Lemma 10. This yields: P[bx,t − nx,t · b ≥ u + γx ln(t)] ≤ P[bx,t − nx,t · b ≥ u + γx ln(t) ; nswap ≤ P[bx,t − nx,t · b ≥ u + γx ln(t) ; nswap x,t ≤ γx ln(t)] + P[nswap x,t ≤ γx ln(t)] + ǫ2 · t2 . 8 x,t ≥ γx ln(t)] Note that, by definition of the load balancing algorithm, we are led to pull arm k (resp. arm l) at time τq if the budget spent so far when selecting basis x, denoted by bx,τq , is below (resp. above) the "target" of nx,τq · b assuming there is no "swap" at time τq (i.e. ¯ck,τq − ǫk,τq ≥ ¯cl,τq − ǫl,τq ). Hence, if bx,t− nx,t· b ≥ u + γx ln(t) and nswap x,t ≤ γx ln(t), we must have been pulling arm l for at least s ≥ ⌊u⌋ rounds t1 ≤ ··· ≤ ts ≤ t − 1 where basis x was selected since the last time, denoted by t0, where basis x was selected and the budget was below the target, i.e. bx,t0 ≤ nx,t0 · b (because the amounts of resource consumed at each round are almost surely bounded by 1). Moreover, we have: t−1 Xτ =t0+1 Ixτ =x·(ck,τ · I¯ck,τ −ǫk,τ ≥¯cl,τ−ǫl,τ + cl,τ · I¯ck,τ −ǫk,τ <¯cl,τ−ǫl,τ ) = bx,t − bx,t0+1 ≥ (nx,t − nx,t0)· b + u− 1 + γx ln(t) ≥ s· b + u− 1 + γx ln(t). This implies: s Xq=1 τ =t0+1 Ixτ =x · I¯ck,τ −ǫk,τ <b · ck,τ ≤ nswap x,t ≤ γx ln(t). Hence, if u ≥ 1: x,t ≤ γx ln(t)] P[bx,t − nx,t · b ≥ u + γx ln(t) ; nswap cl,tq ≥ s· b + u− 1 s t sincePt−1 cl,tq ≥ s· b + u− 1] cl,tq ≥ s· µc l + s· (b− µc l )] cl,tq ≥ s· µc l + s· ǫ] ≤ = ≤ ≤ ≤ ≤ t t t s s P[ P[ P[ Xq=1 Xq=1 Xq=1 exp(−2ǫ2 · s) Xs=⌊u⌋ Xs=⌊u⌋ Xs=⌊u⌋ Xs=⌊u⌋ exp(−2ǫ2 ·⌊u⌋) 1− exp(−2ǫ2) 2 ǫ2 · exp(−ǫ2 · u), 46 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK where we use Lemma 1 for the third inequality and the fact that exp(−2v) ≤ 1 − v/2 for v ∈ [0, 1] for the last inequality. With a similar argument, we conclude: P[bx,t − nx,t· b ≥ u + γx ln(t) ; nswap x,t ≤ γx ln(t)] ≤ 4 ǫ2 · exp(−ǫ2 · u). This last result enables us to show that: 0 E[bx,T ]− E[nx,T ]· b ≤ E[bx,T − nx,T · b] =Z T ≤Z T ≤Z T ǫ2 ·Z T ≤ 13 ǫ4 + ( = 4 ǫ 0 4 0 0 P[bx,T − nx,T · b ≥ u]du P[bx,T − nx,T · b ≥ u ; nswap P[bx,T − nx,T · b ≥ u + 1 + γx ln(T ) ; nswap exp(−ǫ2 · u)du + 1 + γx ln(T ) + )2 ln(T ). 8 ǫ2 x,T ≤ γx ln(T )]du + T · P[nswap x,T ≥ γx ln(T )] x,T ≤ γx ln(T )]du + 1 + γx ln(T ) + 8 ǫ2 We get: which, in combination with E[nx E[nx k,T ]· µc k + E[nx l,T ]· µc k,T ] + E[nx l = E[bx,T ] ≥ E[nx,T ]· b− l,T ] = E[nx,T ], shows that: 13 ǫ4 − ( 4 ǫ )2 ln(T ), E[nx l b− µc k,T ] ≥ ( µc k − µc ≥ ξx k · E[nx,T ]− 13 )· E[nx,T ]− ǫ4 · (µc k − µc 13 16 ǫ5 − ǫ3 ln(T ). l l ) − 42 ǫ2 · (µc k − µc l ) ln(T ) Symmetrically, we get: E[nx l,T ] ≥ ξx l · E[nx,T ]− 13 ǫ5 − 16 ǫ3 ln(T ). 28 ∆x E.4. Proof of Lemma 12. Consider any suboptimal basis x ∈ B. We use the shorthand notation βx = ǫ3 ·( λ )2. Without loss of generality, we can assume that both x and x∗ involve two arms (one of which may be a dummy arm introduced in the specification of the algorithm given in Section 6) and that Kx∗ = {k∗, l∗} l∗ and Kx = {k, l} with µc with µc l . The proof is along the same lines as for Lemmas 5 and 8. We break down the analysis in a series of facts where we emphasize the main differences. We start off with an inequality analogous to Fact 1. k∗ > b > µc k > b > µc T Ixt=x · Inx,t≥βx ln(t)] Ixt=x · Inx,t≥βx ln(t) · I¯ck∗,t−ǫk∗,t≤µc k∗ · I¯cl∗ ,t−ǫl∗,t≤µc l∗ ] T Xt=1 E[nx,T ] ≤ 2βx · ln(T ) + E[ Xt=1 ≤ 2βx · ln(T ) + E[ Xt=1 Xt=1 ≤ 2βx · ln(T ) + E[ P[¯cl∗,t > µc + T T l∗ + ǫl∗,t] + P[¯ck∗,t > µc k∗ + ǫk∗,t] Ixt=x · Inx,t≥βx ln(t) · I¯ck∗,t−ǫk∗,t≤µc k∗ · I¯cl∗ ,t−ǫl∗,t≤µc l∗ ] + π2 3 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK T Ixt=x · Iobjx,t+Ex,t≥Pk∈{k∗,l∗}(¯rk,t+λǫk,t)·ξx∗ k · Inx,t≥βx ln(t)] + 47 π2 3 T T Xt=1 ≤ 2βx · ln(T ) + E[ Xt=1 ≤ 2βx · ln(T ) + E[ Xt=1 l∗ − ǫl∗,t] + P[¯rk∗ ,t < µr Xt=1 ≤ 2βx · ln(T ) + E[ P[¯rl∗,t < µr + T Ixt=x · Iobjx,t+Ex,t≥objx∗ · Inx,t≥βx ln(t)] k∗ − ǫk∗,t] + π2 3 Ixt=x · Iobjx,t+Ex,t≥objx∗ · Inx,t≥βx ln(t)] + 2π2 3 . The first inequality is derived in the same fashion as in Fact 1 substituting k with x. The third and last inequalities are obtained using Lemma 1 in the same fashion as in Fact 3. The fourth inequality is obtained by observing that (i) if xt = x then xt is optimal for (8) and (ii) (ξ∗k)k=1,··· ,K is feasible for (8) if ¯cl∗,t− ǫl∗,t ≤ l∗ and ¯ck∗,t − ǫk∗,t ≤ µc µc k . The second term in the last upper bound can be broken down in two terms similarly as in Lemmas 5 and 8: k∗ . The fifth inequality results from λ ≥ 1 and objx∗ =Pk∈{k∗,l∗} k · ξx∗ µr T E[ T Xt=1 Ixt=x · Iobjx,t+Ex,t≥objx∗ · Inx,t≥βx ln(t)] Xt=1 ≤ E[ Xt=1 Ixt∈Bt · Iobjx,t≥objx+Ex,t · Inx,t≥βx ln(t)] Ixt∈Bt · Iobjx∗≤objx+2Ex,t · Inx,t≥βx ln(t)]. + E[ T (34) (35) We carefully study each term separately. Fact 9 E[ T Xt=1 Ix∈Bt · Iobjx∗≤objx+2Ex,t · Inx,t≥βx ln(t)] ≤ 6π2 ǫ2 . Proof. Using the shorthand notations αx = 8( λ ∆x )2 and γx = ( 4 ǫ )2, we have: T E[ T I∆x≤2λ·max(ǫk,t,ǫl,t) · Inx,t≥βx ln(t)] Xt=1 Ix∈Bt · Iobjx∗≤objx+2Ex,t · Inx,t≥βx ln(t)] Xt=1 ≤ E[ Xt=1 Xt=1 P[nl,t ≤ αx ln(t) ; nx,t ≥ βx ln(t)] + Imin(nk,t,nl,t)≤αx ln(t) · Inx,t≥βx ln(t)] = E[ ≤ T T T Xt=1 k,t · ǫk,t + ξx P[nk,t ≤ αx ln(t) ; nx,t ≥ βx ln(t)]. The first inequality is derived using Ex,t = λ · (ξx l,t ≤ 1 (this is imposed as a constraint in (8)). Observe now that αx/βx is a constant factor independent of ∆x. Thus, we just have to show that if x has been selected at least βx ln(t) times, then both k and l have been pulled at least a l,t · ǫl,t) and ξx k,t + ξx 48 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK constant fraction of the time with high probability. This is the only time the load balancing algorithm comes into play in the proof of Lemma 12. We study the first term and we conclude the study by symmetry. We have: P[nl,t ≤ αx ln(t) ; nx,t ≥ βx ln(t)] t Ixτ =x · Iaτ =k · ck,τ ≥ (b + ǫ/2)· nx k,t] Xτ =1 t t t + P[ Xτ =1 Ixτ =x · Iaτ =k · ck,τ ≤ (b + ǫ/2)· s ; nx ≤ P[nl,t ≤ αx ln(t) ; nx,t ≥ βx ln(t) ; Xs=4/ǫ2 ln(t) ≤ P[nl,t ≤ αx ln(t) ; nx,t ≥ βx ln(t) ; bx,t − nx,t · b ≥ ǫ/2· nx Xs=4/ǫ2 ln(t) + ≤ P[bx,t − nx,t · b ≥ 2γx ln(t)] + ( ≤ ǫ2 · t2 . exp(−s· 2 ǫ· t ǫ2 2 16 )2 ) k,t = s] k,t − nx l,t] The first inequality is obtained observing that if nl,t ≤ αx ln(t) and nx,t ≥ βx ln(t), we have: derive the second inequality, we use Lemma 1 for the second term and remark that: l,t ≥ ( k,t = nx,t − nx nx because λ ≥ 1 and ∆x ≤ objx∗ =PK bx,t − nx,t · b ≥ ( Xτ =1 since b ≤ 1. The third inequality is derived using: k=1 µr k · ξx∗ t )2 · ln(t) ≥ λ ∆x k=1 ξx∗ 28 ǫ3 − 8)· ( k ≤PK Ixτ =x · Iaτ =k · ck,τ − nx k ≤ 1 since x∗ is a feasible basis to (3). To 4 ǫ2 · ln(t) k,t · b)− nx l,t ǫ/2· nx k,t − nx l,t ≥ ǫ/2· nx,t − 2· nx l,t ≥ ( 27 ǫ2 − 16)· ln(t) ≥ 2γx ln(t) and the last inequality is obtained with Lemma 11. Fact 10 T E[ Xt=1 Proof. First observe that: T Ixt∈Bt · Iobjx,t≥objx+Ex,t · Inx,t≥βx ln(t)] ≤ 3π2 ǫ2 . E[ T T Ixt∈Bt · Iobjx,t≥objx+Ex,t · Ink,t≥βx/2·ln(t)] Xt=1 Ixt∈Bt · Iobjx,t≥objx+Ex,t · Inx,t≥βx ln(t)] Xt=1 ≤ E[ Xt=1 Xt=1 ≤ E[ Ixt∈Bt · Iobjx,t≥objx+Ex,t · I¯ck,t−ǫk,t>b] Ixt∈Bt · Iobjx,t≥objx+Ex,t · Inl,t≥βx/2·ln(t)] + E[ T Flajolet and Jaillet: Logarithmic Regret Bounds for BwK T 49 t t T T T T + + + E[ P[¯ck,t ≤ b + ǫ/2, nk,t = s] + P[¯cl,t ≥ b + ǫ/2, nl,t = s] P[¯ck,t − ǫk,t ≤ b, nk,t = s] + P[¯cl,t − ǫl,t ≥ b, nl,t = s] Iobjx,t≥objx+Ex,t · I¯ck,t−ǫk,t≥b≥¯cl,t−ǫl,t · I¯ck,t−ǫk,t>¯cl,t−ǫl,t] Xt=1 Ixt∈Bt · Iobjx,t≥objx+Ex,t · I¯cl,t−ǫl,t<b] Xs=βx/2·ln(t) Xt=1 Xt=1 ≤ 2· E[ Xs=βx/2·ln(t) Xt=1 Xt=1 Iobjx,t≥objx+Ex,t · I¯ck,t−ǫk,t≥b≥¯cl,t−ǫl,t · I¯ck,t−ǫk,t>¯cl,t−ǫl,t] ≤ 2· E[ Xs=βx/2·ln(t) Xt=1 Xt=1 Iobjx,t≥objx+Ex,t · I¯ck,t−ǫk,t≥b≥¯cl,t−ǫl,t · I¯ck,t−ǫk,t>¯cl,t−ǫl,t] + ≤ 2· E[ k· ξx∗ k ≤PK 2 for nk,t, nl,t ≥ βx exp(−s + 2· ǫ2 2 ) T T t 4π2 3ǫ2 . k=1 µr k=1 ξx∗ The third inequality is obtained by observing that ǫk,t, ǫl,t ≤ ǫ 2 ln(t) (because λ ≥ 1 and ∆x ≤ objx∗ =PK k ≤ 1) and that, if xt ∈ Bt and (for example) ¯cl,t− ǫl,t < b, it must be that ¯ck,t− ǫk,t ≥ b. The last two inequalities are obtained in the same fashion as in Lemma 10 observing that βx/2 ≥ 4/ǫ2. At this point, the key observation is that if objx,t ≥ objx + Ex,t, ¯ck,t − ǫk,t ≥ b ≥ ¯cl,t − ǫl,t, and ¯ck,t − ǫk,t > ¯cl,t − ǫl,t, at least one of the following six events occurs: {¯rk,t ≥ µr l + ǫl,t}, {¯ck,t ≤ µc l + ǫl,t}. Otherwise, using the shorthand notations ck = ¯ck,t − ǫk,t and cl = ¯cl,t − ǫl,t, we have: l − ǫl,t} or {¯cl,t ≥ µc k − ǫk,t}, {¯ck,t ≥ µc k + ǫk,t}, {¯rl,t ≥ µr k + ǫk,t}, {¯cl,t ≤ µc objx,t − objx = [ < [ = = l l + l + ǫl,t) + k − µr (µr l · µr k] l · µr l + b− µc µc k − µc µc k − b k − µc µc µc k − b b− cl ck − b l · µr ck − cl · ¯rk,t]− [ ck − cl · ¯rl,t + µc k − µc ck − b b− cl ck − cl · (µr ck − cl · (µr k + ǫk,t)]− [ b− µc b− cl 1 λ · Ex,t + (µr l )· [ ck − cl − µc k − µc k − µr 1 l ) l ) · [(µc k − b)(µc l − cl) + (b− µc λ · Ex,t + k − µc (ck − cl)· (µc 1 ck − cl ·(µc k − b)(µc l − cl) + (b− µc l )(µc k − ck) λ · Ex,t + 1 λ · Ex,t + 2 ck − cl · [(ck − b)· ǫl,t + (b− cl)· ǫk,t] 1 2κ λ · Ex,t λ · Ex,t + κ κ ] l l ≤ ≤ = = Ex,t, l b− µc k − µc µc l · µr k] l )(µc k − ck)] a contradiction. The first inequality is strict because either ck > b or cl < b. The second inequality is derived using Assumption 5. The third inequality is derived from the observation that the expression (µc l − cl) + (b − µc l cancels out) so that k − b)(µc (µc l ) and the maximum of this expression over the polyhedron [¯ck,t − ǫk,t, ¯ck,t + ǫk,t]× [¯cl,t − ǫl,t, ¯cl,t + ǫl,t] is attained at an extreme point. We obtain: k, µc k − ck) is convex in (µc l ) (since the cross term µc k, µc k − ck) is a linear function of (µc l )(µc l − cl) + (b − µc k − b)(µc k · µc l )(µc T E[ Xt=1 Ix∈BtIobjx,t≥objx+Ex,t · Inx,t≥βx ln(t)] 50 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK ∞ + ∞ ≤ Xt=1 Xt=1 Xt=1 ≤ π2 + 3π2 ≤ ǫ2 , using the same argument as in Fact 3. ∞ + P[¯rk,t ≥ µr k + ǫk,t] + P[¯rl,t ≥ µr l + ǫl,t] P[¯cl,t ≥ µc l + ǫl,t] + P[¯ck,t ≥ µc k + ǫk,t] k − ǫk,t] + P[¯cl,t ≤ µc l − ǫl,t] + 4π2 3ǫ2 P[¯ck,t ≤ µc 4π2 3ǫ2 E.5. Proof of Theorem 5. We build upon (4): K τ ∗ RB,T ≤ T · = T · ≤ T · ≤ T · K K Xk=1 Xk=1 Xk=1 Xk=1 K k · ξx∗ µr k · ξx∗ µr k · ξx∗ µr k · ξx∗ µr T Xt=1 k − E[ Xt=1 k − E[ Xt=1 k − E[ Xt=1 k − E[ T T rat,t] + O(1) T T rat,t] + E[ Xt=τ ∗+1 Xt=τ ∗+1 rat,t] + σ · E[ Xt=1 rat,t] + σ · E[( T rat,t] + O(1) cat,t] + O(1) cat,t − B)+] + O(1). The second inequality is a consequence of Assumption 4: Iτ ∗≥t · E[cat,t Ft−1]] T E[ Xt=τ ∗+1 cat,t] = E[ T τ ∗ Xt=1 cat,t]− E[ cat,t] ∞ Xt=1 E[cat,t Ft−1]]− E[ Iτ ∗≥t · µc at ] Xt=1 µc at]− E[ ∞ = E[ = E[ = E[ T T Xt=1 Xt=1 Xt=1 Xt=τ ∗+1 1 Xt=τ ∗+1 σ · E[ T T µc at] ≥ µr at] = 1 σ · E[ T Xt=τ ∗+1 rat,t], since τ ∗ is a stopping time. To derive the third inequality, observe that if τ ∗ = T + 1, we have: T T Xt=τ ∗+1 cat,t = 0 ≤ ( cat,t − B)+, while if τ ∗ < T + 1 we have run out of resources before round T , i.e.Pτ ∗ cat,t − B cat,t ≤ cat,t + Xt=1 τ ∗ T T Xt=τ ∗+1 Xt=τ ∗+1 Xt=1 t=1 cat,t ≥ B, which implies: Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 51 Now observe that: E[( T Xt=1 ≤ ( T Xt=1 cat,t − B)+. cat,t − B)+] = E[( Xx pseudo-basis for (3) {bx,T − nx,T · b})+] ≤Xx∈B = O( E[bx,T − nx,T · b] +Xx /∈B K 2 ǫ3 ln(T )), E[nx,T ] + Xx pseudo-basis for (3) with det(Ax)=0 E[nx,T ] where we use the fact that ck,t ≤ 1 at any time t and for all arms k for the first inequality and Lemma 10 along with the proof of Lemma 11 for the last equality. Plugging this last inequality back into the regret bound yields: RB,T ≤ T · T K K K ( K K K K = ≤ T · k · ξx∗ Xt=1 Xk=1 µr k − E[ k · ξx∗ Xk=1 Xk=1 k −Xx∈B µr k · ξx∗ Xk=1 Xk=1 k −Xx∈B µr ≤ T · k · ξx∗ Xk=1 k · (T − Xx∈B ∆x=0 µr k · ξx∗ Xk=1 k · ( Xx∈B ∆x>0 µr Xk=1 − Xx∈B ∆x>0 µr k · ξx ≤ Xx∈B ∆x>0 ∆x · E[nx,T ] + O( ≤ 29 λ2 ǫ3 · ( Xx∈B ∆x>0 1 ∆x = K ( rat,t] + O( K 2 · σ ǫ3 ln(T )) k · E[nx µr k,T ] + O( K 2 · σ ǫ3 ln(T )) k · ξx µr k )· E[nx,T ] + O( E[nx,T ])− Xx∈B ∆x>0 ln(T )) K 2 · σ ǫ3 K ( Xk=1 k · ξx µr E[nx,T ] + Xx pseudo-basis for (3) K 2 · σ ǫ3 with det(Ax)=0 ln(T )) E[nx,T ] +Xx /∈B k )· E[nx,T ] + O( K 2 · σ ǫ3 ln(T )) )· ln(T ) + O( K 2 · σ ǫ3 ln(T )), k )· E[nx,T ] + O( E[nx,T ]) K 2 · σ ǫ3 ln(T )) (36) where we use Lemma 11 for the third inequality, Lemma 10 along withPK the fourth inequality, and Lemma 12 for the last inequality. k=1 µr k · ξx∗ k ≤PK k=1 ξx∗ k ≤ 1 for E.6. Proof of Theorem 6. Along the same lines as for the case of a single limited resource, we start from inequality (36) derived in the proof of Theorem 5 and apply Lemma 12 only if ∆x is big enough, taking into account the fact that: Specifically, we have: RB,T ≤ sup (nx)x∈B≥0 Px∈B nx≤T { Xx∈B ∆x>0 E[nx,T ] ≤ T. Xx∈B min(∆x · nx, 29 λ2 ǫ3 · ln(T ) ∆x + 10π2 3ǫ2 · ∆x) } + O( K 2 · σ ǫ3 ln(T )) min(∆x · nx, 29 λ2 ǫ3 · Flajolet and Jaillet: Logarithmic Regret Bounds for BwK ln(T ) ∆x ) } + O( K 2 · σ ǫ3 ln(T )) 52 ≤ sup (nx)x∈B≥0 Px∈B nx≤T { Xx∈B ∆x>0 {Xx∈Br29 λ2 ǫ3 · ln(T )· nx } + O( K 2 · σ ǫ3 ln(T )) √nx } + O( K 2 · σ ǫ3 ln(T )) (nx)x∈B≥0 Px∈B nx≤T ≤ sup ≤ 25 λ ≤ 25 λ sup (nx)x∈B≥0 Px∈B nx≤T {Xx∈B ǫ3/2 ·pln(T )· K 2 · σ ǫ3/2 ·pB· T · ln(T ) + O( ǫ3 k · ξx∗ k ≤PK k=1 µr ln(T )), where we use the fact that ∆x ≤PK over each ∆x ≥ 0 to derive the third inequality, and we use Cauchy-Schwartz for the last inequality. E.7. Proof of Theorem 7. When b ≤ ǫ/2, the analysis almost falls back to the case of a single limited k ≤ 1 for the second inequality, we maximize resource. Indeed, we have τ ∗ = τ (B) with high probability given that: k=1 ξx∗ P[τ (B) > T + t] = P[ T +t T +t Xτ =1 1 T + t · caτ ,τ ≤ B] Xt=1 ≤ exp(−(T + t)· ≤ P[ ǫ2 2 ), cat,t ≤ ǫ− (ǫ− b)] for any t ∈ N using Lemma 1. Now observe that, since b ≤ ǫ/2, the feasible bases for (3) are exactly the bases x such that Kx = {k} and Cx = {1} for some k ∈ {1,··· , K}, which we denote by (xk)k=1,··· ,K. This shows that EROPT(B, T ) = B· maxk=1,··· ,K µr k. Moreover note that Assumption 6 is automatically satisfied when b ≤ ǫ/2. Hence, with a minor modification of the proof of Lemma 10, we get: k/µc E[nx,τ (B)] ≤ 212 ǫ3 · E[ln(τ (B))] + 40π2 3ǫ2 , for any pseudo-basis x involving two arms or any basis x such that Kx = {k} and Cx = {2} for some arm k ∈ {1,··· , K}. Similarly, a minor modification of Lemma 12 yields: E[nxk,τ (B)] ≤ 212 λ2 ǫ3 · E[ln(τ (B))] ∆2 xk + 40π2 ǫ2 , for any k ∈ {1,··· , K}. What is left is to refine the analysis of Theorem 5 as follows: RB,T ≤ B · max k=1,··· ,K τ ∗ τ (B) rat,t] + O(1) µr Xt=1 k k − E[ µc µr Xt=1 k k − E[ µc µr Xk=1 k · E[nxk k µr k − µc k · (B − Xk ∆xk =0 k · E[nxk µc K ≤ B · max k=1,··· ,K ≤ B · max k=1,··· ,K µr k ≤ max µc k=1,··· ,K k,τ (B)] + O(1) rat,t] + T · P[τ (B) > T ] + E[(τ (B)− T )+] + O(1) k,τ (B)])− Xk ∆xk >0 k · E[nxk µr k,τ (B)] + O(1). Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 53 K By definition of τ (B), we have B ≤Pτ (B) µc k · E[nk,τ (B)] k · E[nxk µc Xk=1 B ≤ = Xk ∆xk =0 t=1 cat,t. Taking expectations on both sides yields: k,τ (B)] + Xk ∆xk >0 k · E[nxk µc k,τ (B)] +Xx /∈B E[nx,τ (B)]. Plugging this inequality back into the regret bound, we get: RB,T = Xk ∆xk >0 ≤ Xk ∆xk >0 ≤ 212 λ2 k · ∆xk · E[nxk µc k,τ (B)] + max k · ∆xk · E[nxk µc k,τ (B)] + µr k µc k=1,··· ,K 212K 2 · κ ǫ3 E[nx,τ (B)] + O(1) k ·Xx /∈B · E[ln(τ (B))] + O(1) ǫ3 · ( Xk ∆xk >0 1 ∆xk )· ln( B + 1 ǫ ) + 212K 2 · κ ǫ3 · ln( B + 1 ǫ ) + O(1), where we use Assumption 5 for the second inequality and Lemma 4 for the third inequality. A distribution- ǫ )) can be derived from the penul- independent regret bound of order O(qK · B+1 timate inequality along the same lines as in Theorem 6. ǫ ) + K2·κ · ln( B+1 · ln( B+1 ǫ3 ǫ Appendix F: Proofs for Section 7. F.1. Preliminary work for the proofs of Section 7. Concentration inequality. We will use the following inequality repeatedly. For a given round τ ≥ tini and a basis x: P[∃(k, i) ∈ Kx ×{1,··· , C},¯ck,τ (i)− µc k(i) > T 16· (C + 2)!2 ] ǫ3 P[¯ck,τ (i)− µc k(i) > ǫ3 16· (C + 2)!2 , nk,τ = s] i∈{1,··· ,C} ∞ ≤ Xs=tini /K Xk∈Kx Xs=tini /K ≤ 2· C 2 · ≤ 29 (C + 3)!4 ǫ6 · T2 , exp(−s· ǫ6 27 · (C + 2)!4 ) (37) using Lemma 1, the inequality exp(−x) ≤ 1−x/2 for x ∈ [0, 1], and the fact that we pull each arm tini /K ≥ 28 (C+2)!4 · ln(T ) times during the initialization phase. ǫ6 Useful matrix inequalities. For any basis x, assume that {¯ck,t(i) − µc k(i) ≤ ǫ3 16·(C+2)!2}, for any arm k ∈ Kx and resource i ∈ Cx. We have: det( ¯Ax,t)− det(Ax) = Xσ∈S(Kx,Cx) ¯ck,t(σ(k))− Yk∈Kx µc k(σ(k))] ¯ck,t(σ(k))· [¯cl,t(σ(l))− µc ¯cl,t(σ(l))− µc l (σ(l)) l (σ(l))]·Yk>l µc k(σ(k)) [ Yk∈Kx = Xσ∈S(Kx,Cx)Xl∈KxYk<l ≤ Xσ∈S(Kx,Cx)Xl∈Kx ≤ 16· (C + 2)! ǫ ≤ , 2 ǫ3 54 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK since the amounts of resources consumed at any round are no larger than 1. This yields: det( ¯Ax,t) ≥ det(Ax)− det( ¯Ax,t)− det(Ax) ≥ using Assumption 8. Now consider any vector c such that kck∞ ≤ 1, we have: ǫ 2 , (38) cT ¯A−1 x,tbKx − cTA−1 x bKx 1 det(Ax)· det( ¯Ax,t)· det(Ax)· cT adj( ¯Ax,t)bKx − det( ¯Ax,t)· cT adj(Ax)bKx = det( ¯Ax,t)·cT(adj( ¯Ax,t)− adj(Ax))bKx det(Ax)· det( ¯Ax,t)· det( ¯Ax,t)− det(Ax)·cT adj(Ax)bKx ≤ + 1 1 ǫ + 8· (C + 2)! ·kck2 ·kadj(Ax)bKxk2 ǫ2 8 ǫ . 4 ≤ ≤ The second inequality is obtained using Assumption 8 and (38) by proceeding along the same lines as above to bound the difference between two determinants for each component of adj( ¯Ax,t) − adj(Ax). The last inequality is obtained using kck2 ≤ √C and the fact that each component of Ax is smaller than 1. If we take c = ek for k ∈ Kx, this yields: (39) (40) (41) x,tbKx − cTA−1 x bKx x,tbKx − cTA−1 x,tbKx +cT ¯A−1 det( ¯Ax,t) ·(cid:13)(cid:13)adj( ¯Ax,t)bKx(cid:13)(cid:13)2 + 16· (C + 2)!2 · 2 ǫ · C! + x bKx ǫ 4 ǫ 4 ǫ3 If we take c = (µc and Xk∈Kx k ≤ ǫ 4 . ξx k,t − ξx µc k(i)· ξx Xk∈Kx k,t − Xk∈Kx ǫ k ≤ 4 k(i))k∈Kx, for any i ∈ {1,··· , C}, we get: k,t − Xk∈Kx µc k(i)· ξx k = ¯cT ¯A−1 ≤ (¯c− c)T ¯A−1 ≤ k¯c− ck2 · √C · ≤ ≤ ¯ck,t(i)· ξx µc k(i)· ξx ǫ 2 1 , where ¯c = (¯ck,t(i))k∈Kx. F.2. Proof of Lemma 13. First, consider a basis x /∈ B. Since x is ǫ-non-degenerate by Assumption 8, there must exist k ∈ Kx such that ξx k ≥ b(i) + ǫ. Let us assume that we are in the first situation (the proof is symmetric in the other scenario). Using (39) in the preliminary work of Section F.1, we have: k ≤ −ǫ or i ∈ {1,··· , C} such that PK k(i) · ξx k=1 µc ξx k,t = ξx k + (ξx k,t − ξx k ) ≤ − ǫ 2 , (42) if {¯ck,t(i)− µc k(i) ≤ ǫ3 16·(C+2)!2} for all arms k ∈ Kx and resources i ∈ {1,··· , C}. Hence: T E[nx,T ] = E[ Xt=tini Ixt=x] Flajolet and Jaillet: Logarithmic Regret Bounds for BwK T 55 k,t ≥ 0] T ≤ P[ξx Xt=tini Xt=tini Xk∈Kx ≤ ≤ 29 (C + 3)!4 i∈{1,··· ,C} , ǫ6 P[¯ck,t(i)− µc k(i) > ǫ3 16· (C + 2)!2 ] where the third inequality is derived with (37). Second, consider a pseudo-basis x for (3) that is not a basis. Since det(Ax) = 0, either every component of Ax is 0, in which case det( ¯Ax,t) = 0 at every round t and x can never be selected, or there exists a basis x for (3) with Kx ⊂ Kx and Cx ⊂ Cx along with coefficients (αkl)k∈Kx−Kx,l∈Kx such that µc k(i) = Pl∈Kx l (i) for any resource i ∈ Cx. Assuming we are in the second scenario and since x is ǫ-non- degenerate by Assumption 8, we havePK k ≤ b(j)− ǫ for any j /∈ Cx. Take i ∈ Cx −Cx. Suppose that x is feasible for (8) at round t and assume by contradiction that {¯ck,t(j)− µc 16·(C+2)!2} for all arms k ∈ Kx and resources j ∈ {1,··· , C}. Using the notations ξx αkl · ξx l,t, we have, for any resource j ∈ Cx: k(j) ≤ k,t +Pl∈Kx−Kx k(j)· ξ x αkl · µc k,t = ξx k=1 µc ǫ3 b(j) = Xl∈Kx l,t ¯cl,t(j)· ξx = α(j) +Xl∈Kx µc l (j)· ξx l (j)· ξx = α(j) +Xl∈Kx µc l,t, l,t 16·(C+2)!2 since ξk ∈ [0, 1] ∀k ∈ {1,··· , K} for any feasible solution to (8). We get ǫ3 where α(j) ≤ Ax ξx Kx,t = bCx − αCx while Axξ x Kx = bCx . We derive: K µc k(i)· ξ x k + ǫ3 16· (C + 2)!2 K Xk=1 K K k,t − Xk=1 k(i)· ξ x µc k Xk=1 µc k(i)· ξx k,t − k(i)· ( ξx k,t − ξ x µc k ) + (i)TA−1 x αCx 1 ¯ck,t(i)· ξx Xk=1 ≤ ≤ Xk∈Kx +µc Kx +√C · = ǫ 4 det(Ax) ·kadj(Ax)αCxk2 ǫ3 (C + 1)! ǫ · 16· (C + 2)!2 ǫ 4 ǫ 4 ǫ 4 ǫ 2 ≤ ≤ ≤ + . Thus we obtain: K Xk=1 ¯ck,t(i)· ξx k,t ≤ K Xk=1 µc k(i)· ξ x k + ǫ 2 ≤ b(i)− ǫ 2 < b(i), 56 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK a contradiction since this inequality must be binding by definition if x is selected at round t. We finally conclude: T E[nx,T ] = E[ T Ixt=x] Xt=tini Xt=tini Xk∈Kx ≤ ≤ 29 (C + 3)!4 ǫ6 j∈{1,··· ,C} . P[¯ck,t(j)− µc k(j) > ǫ3 16· (C + 2)!2 ] F.3. Proof of Lemma 14. Proof of (12). Consider a resource i ∈ Cx and u ≥ 1. We study P[bx,t(i)− nx,t · b(i) ≥ u] but the same technique can be used to bound P[bx,t(i) − nx,t · b(i) ≤ −u]. If bx,t(i) − nx,t · b(i) ≥ u, it must be that ex i,τ = −1 for at least s ≥ ⌊u⌋ rounds τ = t1 ≤ ··· ≤ ts ≤ t − 1 where x was selected at Step-Simplex since the last time, denoted by t0 < t1, where x was selected at Step-Simplex and the budget was below the target, i.e. bx,t0(i) ≤ nx,t0 · b(i) (because the amounts of resources consumed at each round are bounded by 1). Moreover, we have: s Xq=1 Hence: P[bx,t(i)− nx,t · b(i) ≥ u] s t catq ,tq (i) = t−1 Ixτ =x · caτ ,τ (i) Xτ =t0+1 = bx,t(i)− bx,t0+1(i) ≥ (nx,t − nx,t0)· b(i) + u− 1 ≥ s· b(i) + u− 1. catq ,tq (i) ≥ s· b(i) + u− 1 ; ex i,tq = −1 ∀q ∈ {1,··· , s}] K Xk=1 k(j) > µc k(i)· px k,tq ≤ b(i)− ǫ3 16· (C + 2)!2 ] ǫ2 4· (C + 1)! ∀q ∈ {1,··· , s}] catq ,tq (i) ≥ s· b(i) ; P[¯ck,τ (j)− µc t s T + P[ P[ ≤ ≤ Xq=1 Xs=⌊u⌋ Xq=1 Xs=⌊u⌋ Xτ =tini Xk∈Kx Xs=⌊u⌋ ≤ 16 (C + 1)!2 ≤ ∞ ǫ4 j∈{1,··· ,C} exp(−2s· ( ǫ2 4· (C + 1)! )2) + 29 (C + 3)!4 ǫ6 1 T · · exp(−u· ( ǫ2 4· (C + 1)! )2) + 29 (C + 3)!4 ǫ6 1 T · . The last inequality is obtained using exp(−x) ≤ 1− x/2 for x ∈ [0, 1]. The third inequality is derived using Lemma 1 for the first term and (37) for the second term. The second inequality is obtained by observing that if x was selected at time τ and ¯ck,τ (j) − µc 16·(C+2)!2 for any arm k ∈ Kx and resource j ∈ {1,··· , C}, then we must have δ∗x,τ ≥ ǫ2 4·(C+1)! and any arm k ∈ Kx: 4·(C+1)! . Indeed, using (38) and (39), we have, for δ ≤ ǫ2 k(j) ≤ ǫ3 cT ¯A−1 x,τ (bCx + δ · ex τ ) = ξx k,τ + δ · cT ¯A−1 x,τ ex τ Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 57 x,τ ex τ k,τ− δ ·cT ¯A−1 k − ξx ≥ ξx k −ξx ǫ ¯A−1 2 − δ ·(cid:13)(cid:13) τ(cid:13)(cid:13)2 x,τ ex ≥ 1 det( ¯Ax,τ ) ·(cid:13)(cid:13)adj( ¯Ax,τ )ex τ(cid:13)(cid:13)2 ≥ √C · C! ≥ ≥ 0, ǫ 2 − δ · ǫ 2δ 2 − ǫ · where c = ek and since x is ǫ-non-degenerate by Assumption 8. Similarly, using (38) and (41), we have, for δ ≤ ǫ2 x,τ (bCx + δ · ex 4·(C+1)! and any resource j /∈ Cx: cT ¯A−1 τ ) = Xk∈Kx ≤ Xk∈Kx ≤ b(j)− ≤ b(j)− ≤ b(j), τ x,τ ex ¯ck,τ (j)· ξx µc k(j)· ξx ǫ + δ · 2 2δ ǫ ǫ · (C + 1)! + 2 k,τ + δ · cT ¯A−1 k,τ + Xk∈Kx √C ·(cid:13)(cid:13) ¯ck,τ (j)· ξx τ(cid:13)(cid:13)2 x,τ ex ¯A−1 k,τ − Xk∈Kx µc k(j)· ξx k,τ + δ ·cT ¯A−1 x,τ ex τ where c = (¯ck,τ (j))k∈Kx and since x is ǫ-non-degenerate by Assumption 8. Proof of (14). First observe that, using (12), we have: i∈Cx E[bx,T (i)]− E[nx,T ]· b(i) max i∈Cx bx,T (i)− nx,T · b(i)] P[max i∈Cx bx,T (i)− nx,T · b(i) ≥ u]du P[bx,T (i)− nx,T · b(i) ≥ u]du ǫ2 0 (C + 1)!2 exp(−u· ( ·Z T + C + C · 29 (C + 3)!4 4· (C + 1)! ǫ6 0 ≤ E[max =Z T =Xi∈CxZ T 0 ≤ 32C · = 29C · ≤ 210C · (C + 1)!4 (C + 3)!4 . ǫ4 ǫ8 ǫ8 )2)du + C + C · 29 (C + 3)!4 ǫ6 Now observe that, for any resource i ∈ Cx, we have E[bx,T (i)] =Pk∈Kx µc E[nx E[nx,T ] )k∈Kx , we get: vector p = ( k,T ] k(i)· E[nx k,T ]. Hence, defining the E[nx,T ]·kp− ξxk2 = E[nx,T ]·(cid:13)(cid:13)A−1 1 = x Ax(p− ξx)(cid:13)(cid:13)2 √C · 210C · x (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)2 ·kE[nx,T ]· Ax(p− ξx)k2 ≤(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)A−1 det(Ax) ·adj(Ax)2 ·k(E[bx,T (i)])i∈Cx − (E[nx,T ]· b(i))i∈Cxk2 1 ǫ · (C + 1)!· ≤ ≤ 210 (C + 3)!5 (C + 3)!4 ǫ9 ǫ8 , 58 using Assumption 8. Finally we obtain: Flajolet and Jaillet: Logarithmic Regret Bounds for BwK E[nx,T ]· ξx k − E[nx k,T ] ≤ E[nx,T ]·kp− ξxk2 ≤ 210 (C + 3)!5 ǫ9 , ǫ4 contradiction, suppose that: · ln(T ) for all resources j ∈ Cx, 8·(C+2)! for all resources j ∈ {1,··· , C} and for all arms k ∈ Kx such that nx for any arm k ∈ Kx. Proof of (13). Consider a resource i /∈ Cx and assume that bx,t(i) − nx,t · b(i) ≥ 28 (C+3)!3 • bx,t(j)− nx,t · b(j) ≤ 16 (C+1)!2 • µc 26 (C+2)!2 basis x and pulling arm k, i.e. ck(j) = 1 nx Observe that if bx,t(i)− nx,t · b(i) ≥ 28 (C+3)!3 ln(T ) times at Step-Simplex since tini, i.e. nx,t ≥ 28 (C+3)!3 and K2 for any j ∈ Cx: k(j) − ck(j) ≤ ǫ2 k,t ≥ · ln(T ), where ck(j) denotes the empirical average amount of resource j consumed when selecting · ln(T ), it must be that x has been selected at least 28 (C+3)!3 · · ln(T ). We can partition Kx into two sets K1 x k,t < 26 (C+2)!2 x. We get, Ixτ =x · Iaτ =k · ck,τ (j). · ln(T ) for all k ∈ K2 · ln(T ) for all k ∈ K1 k,t ·Pt−1 k,t ≥ 26 (C+2)!2 · ln(T ). By ǫ6 x and nx x such that nx τ =tini ǫ4 ǫ4 ǫ4 ǫ6 ǫ6 ǫ6 (C + 1)!2 16 ǫ4 · ln(T ) ≥ bx,t(j)− nx,t · b(j) ≥ nx,t · Xk∈K1x ≥ nx,t · Xk∈K1x nx k,t ck(j)· pk − b(j)− Xk∈K2 ck(j)· pk − b(j)− 26C · x (C + 2)!2 ǫ4 · ln(T ), where pk = nx k,t nx,t 1 and pk = 0 otherwise. Hence: for k ∈ Kx Xk∈Kx µc k(j)· pk − b(j) ≤ max k∈K1x µc k(j)− ck(j) + Xk∈K1x ck(j)· pk − b(j) ǫ2 (16 (C+1)!2 ǫ4 + 26C · (C+2)!2 ǫ4 )· ln(T ) nx,t ≤ ≤ + , ǫ2 8· (C + 2)! 4· (C + 2)! where we use the fact that PK · ln(T ) for the last one. We get: 28 (C+3)!3 ǫ6 k=1 pk ≤ 1 and pk ≥ 0 for any arm k for the first inequality and nx,t ≥ 1 x Ax(p− ξx)(cid:13)(cid:13)2 kp− ξxk2 =(cid:13)(cid:13)A−1 ≤(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)A−1 x (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)2 ·kAx(p− ξx)k2 det(Ax) ·adj(Ax)2 · √C · 1 ǫ · (C + 1)!· 4·√C ≤ ≤ ≤ ǫ , ǫ2 4· (C + 2)! √C · ǫ2 4· (C + 2)! using Assumption 8. Hence: 28 (C + 3)!3 ǫ6 · ln(T ) ≤ bx,t(i)− nx,t · b(i) Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 59 nx k,t ck(i)· pk − b(i)) + Xk∈K2 ck(i)· pk − b(i)) + 26C · ≤ nx,t · (Xk∈K1x ≤ nx,t · (Xk∈K1x k(i))k∈Kx, this implies: x (C + 2)!2 ǫ4 · ln(T ). Using the shorthand notation c = (µc ck(i)· pk − b(i) 0 ≤ Xk∈K1x ≤ Xk∈K1x ≤ cT(p− ξx)− √C ·kp− ξxk2 − ≤ < 0, µc k(i)· pk + ǫ 2 ǫ 2 ǫ2 8· (C + 2)! − (Xk∈Kx µc k(i)· ξx k + ǫ) k=1 pk ≤ 1 and pk ≥ 0 for any arm k and Assumption 8 for · ln(T )] (C + 1)!2 ǫ4 ǫ6 the second inequality. We conclude that: a contradiction. Note that we use the fact thatPK P[bx,t(i)− nx,t · b(i) ≥ 28 (C + 3)!3 ≤Xj∈Cx P[bx,t(j)− nx,t · b(j) ≥ 16 + Xk∈Kx ≤ 25C · + Xk∈Kx ≤ 2C · T · 29 (C + 3)!4 ≤ 210 (C + 4)!4 ǫ6 · T (C + 1)!2 ǫ4 · T Xs=26·(C+2)!2/ǫ4·ln(T ) ǫ6 · T2 +28C 2 · k(j)− ck(j) ≥ + C · T · 29 (C + 3)!4 ǫ6 · T2 P[µc j∈{1,··· ,C} j∈{1,··· ,C} P[µc ǫ2 , (C + 2)!2 ǫ4 · T 2 · ln(T )] k,t ≥ 26 (C + 2)!2 ǫ4 ; nx · ln(T )] 8· (C + 2)! k(j)− ck(j) ≥ ǫ2 8· (C + 2)! ; nx k,t = s] where we use (12) for the second inequality and Lemma 1 for the third inequality. F.4. Proof of Lemma 15. Consider any suboptimal basis x ∈ B. The proof is along the same lines as for Lemmas 5, 8, and 12. We break down the analysis in a series of facts where we emphasize the main differences. We start off with an inequality similar to Fact 1. We use the shorthand notation βx = 210 (C+3)!3 )2. ǫ6 · ( λ ∆x Fact 11 E[nx,T ] ≤2βx · ln(T ) + 29 (C + 3)!4 ǫ6 T + E[ Xt=tini Ixt=x · Inx,t≥βx ln(t) · Ix∗∈Bt]. (43) 60 Proof. Similarly as in Fact 1, we have: Flajolet and Jaillet: Logarithmic Regret Bounds for BwK T E[nx,T ] ≤2βx · ln(T ) + E[ Xt=tini Ixt=x · Inx,t≥βx ln(t)]. This yields: T T E[nx,T ] ≤ 2βx · ln(T ) + E[ Xt=tini Ixt=x · Inx,t≥βx ln(t) · Ix∗∈Bt] + E[ Xt=tini Ix∗ /∈Bt]. Using (39), (41), and Assumption 8, we have: ξx∗ k,t = ξx∗ k − (ξx∗ k − ξx∗ k,t) ≥ ǫ 2 ≥ 0, ¯ck,t(i)· ξx∗ for any k ∈ Kx∗ and Xk∈Kx∗ k,t = Xk∈Kx∗ ≤ b(i)− ǫ + ǫ ≤ b(i)− 2 ≤ b(i), for any resource i /∈ Cx∗ if {¯cl,t(j)− µc l (j) ≤ ǫ 2 Hence: k(i)· ξx∗ µc k + ( Xk∈Kx∗ ¯ck,t(i)· ξx∗ k,t − Xk∈Kx∗ k(i)· ξx∗ µc k ) ǫ3 16·(C+2)!2} for any arm l ∈ Kx∗ and resource j ∈ {1,··· , C}. E[nx,T ] ≤ 2βx · ln(T ) + E[ Ixt=x · Inx,t≥βx ln(t) · Ix∗∈Bt] T Xt=tini P[¯cl,t(j)− µc T + Xt=tini Xl∈Kx∗ j∈{1,··· ,C} ≤ 2βx · ln(T ) + E[ T Xt=tini l (j) > ǫ3 16· (C + 2)!2 ] Ixt=x · Inx,t≥βx ln(t) · Ix∗∈Bt] + 29 (C + 3)!4 ǫ6 , where we bound the third term appearing in the right-hand side using (37). The remainder of this proof is dedicated to show that the last term in (43) can be bounded by a constant. This term can be broken down in three terms similarly as in Lemmas 5 and 8. T Iobjx,t+Ex,t≥objx∗,t+Ex∗,t · Inx,t≥βx ln(t) · Ix∈Bt,x∗∈Bt] E[ Xt=tini ≤ E[ ≤ E[ + E[ + E[ T T Iobjx,t≥objx+Ex,t · Ix∈Bt] Ixt=x · Inx,t≥βx ln(t) · Ix∗∈Bt] Xt=tini Xt=tini Xt=tini Xt=tini T T Iobjx∗,t≤objx∗−Ex∗,t · Ix∗∈Bt] Iobjx∗ <objx+2Ex,t · Ix∈Bt · Inx,t≥βx ln(t)]. (44) (45) (46) Flajolet and Jaillet: Logarithmic Regret Bounds for BwK Fact 12 61 E[ T Xt=tini Iobjx∗ <objx+2Ex,t · Ix∈Bt · Inx,t≥βx ln(t)] ≤ 211 (C + 4)!4 ǫ6 . Proof. Using the shorthand notation αx = 8( λ ∆x )2, we have: T E[ Xt=tini Iobjx∗ <objx+2Ex,t · Ix∈Bt · Inx,t≥βx ln(t)] T T ≤ E[ Xt=tini Xt=tini ≤ E[ Xt=tini Xk∈Kx ≤ T I∆x<2λ·maxk∈Kx ǫk,t · Inx,t≥βx ln(t)] Imink∈Kx nk,t≤αx ln(t) · Inx,t≥βx·ln(t)] P[nk,t ≤ αx ln(t) ; nx,t ≥ βx ln(t)], ǫ4 l=1 ξx l,t ≤ 1 and ξx · ln(t) for any resource i ∈ Cx and that µc since PK l,t ≥ 0 for any arm l when x is feasible for (8) at time t. Consider k ∈ Kx and assume that nk,t ≤ αx · ln(t) and nx,t ≥ βx · ln(t). Suppose, by contradiction, that bx,t(i) − nx,t · b(i) ≤ 32 (C+1)!2 8·(C+2)! for any resource i ∈ {1,··· , C} for all arms l ∈ Kx such that nx · ln(t), where cl(i) is the empirical average amount of resource l,t ·Pt−1 i consumed when selecting basis x and pulling arm l, i.e. cl(i) = 1 Ixτ =x · Iaτ =l · cl,τ (i). We nx can partition Kx − {k} into two sets K1 l,t < 27 (C+2)!2 x and nx x. Similarly as in the proof of Lemma 14, we have, for any resource i ∈ Cx: l (i) − cl(i) ≤ ǫ2 · ln(t) for all l ∈ K2 · ln(t) for all l ∈ K1 l,t ≥ 27 (C+2)!2 l,t ≥ 27 (C+2)!2 x such that nx x and K2 τ =tini ǫ4 ǫ4 ǫ4 32 (C + 1)!2 ǫ4 · ln(t) ≥ bx,t(i)− nx,t · b(i) ≥ nx,t ·Xl∈K1x ≥ nx,t ·Xl∈K1x cl(i)· pl − b(i)− nk,t −Xl∈K2 cl(i)· pl − b(i)− αx · ln(t)− C · nx l,t x 27 · (C + 2)!2 ǫ4 · ln(t), where pl = nx l,t nx,t 1 and pl = 0 otherwise. Hence: for l ∈ Kx Xl∈Kx µc l (i)· pl − b(i) ≤ max l∈K1x µc l (i)− cl(i) +Xl∈K1x cl(i)· pl − b(i) ǫ2 (αx + C · 27·(C+2)!2 )· ln(t) + ǫ4 nx,t ≤ ≤ ǫ2 8· (C + 2)! 4· (C + 2)! To derive the first inequality, we use the fact that PK inequality, we use nx,t ≥ 210 (C+3)!3 )2 · ln(t) along with λ ≥ 1 and ∆x ≤ objx∗ =PK k=1 ξx∗ PK k ≤ 1 because of the time constraint imposed in (3). We get: l=1 pl ≤ 1 and pl ≥ 0 for any arm l. For the last k ≤ k · ξx∗ k=1 µr · ( λ ∆x ǫ6 . ξx k ≤ kp− ξxk2 62 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 1 =(cid:13)(cid:13)A−1 x Ax(p− ξx)(cid:13)(cid:13)2 ≤(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)A−1 x (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)2 ·kAx(p− ξx)k2 det(Ax) ·adj(Ax)2 · √C · 1 ǫ · (C + 1)!· ǫ , 2 ≤ ≤ ≤ ǫ2 4· (C + 2)! √C · ǫ2 4· (C + 2)! a contradiction since x is ǫ-non-degenerate by Assumption 8. We conclude that: T E[ Xt=tini Iobjx∗ <objx+2Ex,t · Ix∈Bt · Inx,t≥βx·ln(t)] T ≤ C · + C · T Xt=tiniXi∈Cx Xt=tini Xl∈Kx i∈Cx P[bx,t(i)− nx,t · b(i) ≥ 32 ǫ2 P[µc l (i)− cl(i) ≥ 8· (C + 2)! π2 6 · (C + 1)!2 ǫ4 ≤ 32C 2 · +Xl∈Kx ≤ 4C · 29 (C + 3)!4 ≤ 211 (C + 4)!4 Xs=27·(C+2)!2/ǫ4·ln(T ) +27C 2 · j∈Cx ǫ6 ǫ6 , + C · 29 (C + 3)!4 P[µc l (j)− cl(j) ≥ ǫ6 (C + 2)!2 ǫ4 π2 6 · (C + 1)!2 ǫ4 · ln(t)] ; nx l,t ≥ 27 (C + 2)!2 ǫ4 · ln(t)] ǫ2 8· (C + 2)! ; nx l,T = s] where we use (12) for the second inequality and Lemma 1 for the third inequality. Fact 13 Proof. First observe that: T E[ Xt=tini Iobjx,t≥objx+Ex,t · Ix∈Bt] ≤ 210 (C + 3)!2 ǫ6 . T T E[ Xt=tini Iobjx,t≥objx+Ex,t · Ix∈Bt] ≤ E[ Iobjx,t≥objx+Ex,t · Ix∈Bt · I det( ¯Ax,t)≥ǫ/2] T T + E[ Xt=tini Xt=tini Xt=tini ≤ E[ Xt=tini Xk∈Kx Xt=tini ≤ E[ + 29 (C + 3)!4 + T T ǫ6 , I det( ¯Ax,t)<ǫ/2] Iobjx,t≥objx+Ex,t · Ix∈Bt · I det( ¯Ax,t)≥ǫ/2] P[¯ck,t(i)− µc k(i) > ǫ3 16· (C + 2)!2 ] i∈Cx Iobjx,t≥objx+Ex,t · Ix∈Bt · I det( ¯Ax,t)≥ǫ/2] Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 63 where we use the preliminary work of Section F.1 and in particular (38). The key observation now is that if k + ǫk,t}, objx,t ≥ objx + Ex,t, x ∈ Bt, and det( ¯Ax,t) ≥ ǫ/2, at least one of the following events {¯rk,t ≥ µr for k ∈ Kx, or {¯ck,t(i)− µc k(i) ≥ ǫk,t}, for k ∈ Kx and i ∈ {1,··· , C}, occurs. Otherwise we have: objx,t − objx = ( ¯A−1 < ( ¯A−1 x,tbCx)T¯rKx,t − (A−1 x,tbCx)T(µr x bCx)Tµr Kx Kx + ǫKx,t)− (A−1 x bCx)Tµr Kx x,t − A−1 x )bCx)Tµr Kx, 1 λ · Ex,t + (( ¯A−1 = where the first inequality is a consequence of the fact that x is feasible for (8), i.e. ¯A−1 x,tbCx ≥ 0 with at least one non-zero coordinate since ¯ck,t(i) ≥ ǫ for all arms k and resource i by Assumption 8. Writing µc k(i) = ¯ck,t(i) + ui,k · ǫk,t, with ui,k ∈ [−1, 1] for all (i, k) ∈ Cx ×Kx, and defining the matrix U = (ui,k)(i,k)∈Cx×Kx, we get: objx,t − objx < = ≤ = Ex,t λ Ex,t λ Ex,t λ Ex,t λ Ex,t λ Ex,t λ Ex,t λ Ex,t λ ≤ ≤ ≤ ≤ = Ex,t. +( ¯A−1 +( ¯A−1 + x,t − ( ¯Ax,t + U diag(ǫKx,t))−1)bCx)Tµr Kx x,tU (I + diag(ǫKx,t) ¯A−1 x,tU )−1 diag(ǫKx,t) ¯A−1 x,tbCx)Tµr Kx x,tU )−1 diag(ǫKx,t) ¯A−1 x,tU (I + diag(ǫKx,t) ¯A−1 x,tU ) diag(ǫKx,t) ¯A−1 x,tbCx)Tµr 1 ǫ · det( ¯Ax,t + U diag(ǫKx,t))·( ¯A−1 1 ǫ ·(adj( ¯Ax,t)U adj(I + diag(ǫKx,t) ¯A−1 1 ǫ ·(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)adj( ¯Ax,t)U adj(I + diag(ǫKx,t) ¯A−1 x,tU )(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)2 ·(cid:13)(cid:13)diag(ǫKx,t) ¯A−1 Kx(cid:13)(cid:13)2 x,tbCx(cid:13)(cid:13)2 ·(cid:13)(cid:13)µr √C ǫ ·(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)adj( ¯Ax,t)U(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)2 ·(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)adj(I + diag(ǫKx,t) ¯A−1 ǫ · (C + 1)!·(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)adj(I + diag(ǫKx,t) ¯A−1 x,tU )(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)2 · x,tU )(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)2 · Ex,t λ · Ex,t λ 2 ǫ · (C + 1)!2 · Ex,t λ Kx 1 1 + + + + + x,tbCx)Tµr Kx We use the Woodbury matrix identity to derive the first equality and the matrix determinant lemma for the second equality. The second inequality is derived from Assumption 8 since ǫ ≤ det(Ax) = det( ¯Ax,t + U diag(ǫKx,t)) by definition of U . The fourth inequality is derived from the observation that diag(ǫKx,t) ¯A−1 k,t)k∈Kx . The fifth inequality is obtained by observing that the com- ponents of ¯Ax,t and U are all smaller than 1 in absolute value. The sixth inequality is obtained by observing that the elements of ¯A−1 2·C! for all arms k as a result of the initialization phase. We get: ǫ · (C − 1)! since det( ¯Ax,t) ≥ ǫ x,tbCx is the vector (ǫk,t · ξx 2 and that ǫk,t ≤ ǫ x,t are smaller than 2 T E[ Xt=tini Iobjx,t≥objx+Ex,t · Ix∈Bt] ≤ P[ck,t(i)− µc k(i) ≥ ǫk,t] T T + i∈Cx Xt=tini Xk∈Kx Xt=tini Xk∈Kx + 29 (C + 3)!4 ≤ 2· 29 (C + 3)!4 ǫ6 ǫ6 . P[rk,t ≥ µr k + ǫk,t] 64 Fact 14 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK T E[ Xt=tini Iobjx∗,t≤objx∗−Ex,t · Ix∗∈Bt] ≤ 210 (C + 3)!2 ǫ6 . We omit the proof since it is almost identical to the proof of Fact 13. F.5. Proof of Theorem 8. Along the same lines as for Theorem 5, we build upon (4): RB(1),··· ,B(C−1),T ≤ T · = T · ≤ T · ≤ T · K K K Xk=1 Xk=1 Xk=1 Xk=1 K k · ξx∗ µr k · ξx∗ µr k · ξx∗ µr k · ξx∗ µr τ ∗ T Xt=1 k − E[ Xt=1 k − E[ Xt=1 k − E[ Xt=1 k − E[ T T rat,t] + O(1) T T rat,t] + E[ rat,t] + O(1) Xt=τ ∗+1 Xt=τ ∗+1 rat,t] + σ · E[ min i=1,··· ,C T C Xt=1 cat,t(i)− B(i))+] + O(1). cat,t(i)] + O(1) rat,t] + σ · Xi=1 E[( The second inequality is a direct consequence of Assumption 7. To derive the last inequality, observe that if τ ∗ = T + 1, we have: T Xt=τ ∗+1 cat,t(j) = 0 ≤ C Xi=1 E[( T Xt=1 cat,t(i)− B(i))+], for any j ∈ {1,··· , C} while if τ ∗ < T + 1 we have run out of resources before the end of the game, i.e. there exists j ∈ {1,··· , C} such thatPτ ∗ t=1 cat,t(j) ≥ B(j), which implies that: T T T min i=1,··· ,C cat,t(i) ≤ Xt=τ ∗+1 Xt=τ ∗+1 Xt=τ ∗+1 Xt=1 Xi=1 Now observe that, for any resource i ∈ {1,··· , C}: = ( ≤ ≤ ( C T cat,t(j) τ ∗ cat,t(j) + Xt=1 cat,t(j)− B(j))+ Xt=1 T cat,t(i)− B(i))+. cat,t(j)− B(j) E[( T Xt=1 cat,t(i)− B)+] ≤ E[( T Xt=tini cat,t(i)− b(i))+] + K · 28 (C + 2)!4 {bx,T (i)− nx,T · b(i)})+] + O(K · ǫ6 · ln(T ) E[(bx,T (i)− nx,T · b(i))+] +Xx /∈B E[nx,T ] E[nx,T ] + O(K · ǫ6 · ln(T )) (C + 2)!4 = E[( Xx basis for (3) ≤Xx∈B + Xx pseudo-basis for (3) with det(Ax)=0 (C + 2)!4 ǫ6 · ln(T )) Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 65 (C + 3)!4 ǫ6 · ln(T )) ≤Xx∈BZ T ≤Xx∈B + 28B· = O(B· (C + 3)!4 (C + 3)!4 ǫ6 ǫ6 0 P[bx,T (i)− nx,T · b(i) ≥ u]du + O(K · T · P[bx,T (i)− nx,T · b(i) ≥ 28 (C + 3)!4 ǫ6 · ln(T )] (C + 3)!4 ǫ6 · ln(T )) · ln(T ) + O(K · · ln(T )), where we use the fact that the amounts of resources consumed at any time period are no larger than 1 for the first and second inequalities, Lemma 13 for the third inequality and inequalities (12) and (13) from Lemma 14 along with the fact that there are at least K feasible basis for (3) (corresponding to single-armed strategies) for the last equality. Plugging this back into the regret bound yields: RB(1),··· ,B(C−1),T ≤ T · T K K K ( K K ( K K = = T · k · ξx∗ µr Xt=tini Xk=1 k − E[ k · ξx∗ Xk=1 Xk=1 k −Xx∈B µr k · ξx∗ Xk=1 Xk=1 k −Xx∈B µr ≤ T · k · ξx∗ Xk=1 k · (T − Xx∈B ∆x=0 µr Xk=1 − Xx∈B ∆x>0 k · ξx∗ Xk=1 k · (tini + Xx∈B ∆x>0 µr Xk=1 − Xx∈B ∆x>0 ≤ Xx∈B ∆x>0 ∆x · E[nx,T ] + O( ≤ 210 (C + 3)!3 · λ2 · ( Xx∈B ∆x>0 µr k · ξx µr k · ξx = ǫ6 K K ( rat,t] + O( σ ·B· (C + 3)!4 · ln(T )) ǫ6 σ ·B· (C + 3)!4 · ln(T )) ǫ6 σ ·B· (C + 3)!4 ǫ6 µr k · E[nx k,T ] + O( µr k · ξx k )· E[nx,T ] + O( · ln(T )) (47) E[nx,T ]) k )· E[nx,T ] + O( σ ·B· (C + 3)!4 ǫ6 · ln(T )) E[nx,T ] +Xx /∈B E[nx,T ] + Xx pseudo-basis for (3) with det(Ax)=0 E[nx,T ]) k )· E[nx,T ] + O( σ ·B· (C + 3)!4 · ln(T )) ǫ6 σ ·B· (C + 3)!4 ǫ6 1 ∆x )· ln(T ) + O( · ln(T )) σ ·B· (C + 3)!4 ǫ6 (48) · ln(T )), where we use (14) from Lemma 14 for the second inequality, Lemma 13 for the third inequality. To derive the last inequality, we use Lemma 15 and the fact that ∆x ≤ objx∗ =PK k=1 µr k · ξx∗ k ≤PK F.6. Proof of Theorem 9. Along the same lines as for the proof of Theorem 6, we start from inequality (48) derived in the proof of Theorem 8 and apply Lemma 15 only if ∆x is big enough, taking into account the fact that: k=1 ξx∗ k ≤ 1. E[nx,T ] ≤ T. Xx∈B Specifically, we have: RB(1),··· ,B(C−1),T 66 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK ln(T ) ∆x · + 211 (C + 4)!2 ǫ6 · ∆x) }) ln(T ) ∆x · ) } + O( σ ·B· (C + 3)!4 ǫ6 · ln(T )) min(∆x · nx, 210 (C + 3)!3 · λ2 ǫ6 · ln(T )) min(∆x · nx, 210 (C + 3)!3 · λ2 ǫ6 = sup (nx)x∈B≥0 Px∈B nx≤T + O( ǫ6 { Xx∈B ∆x>0 σ ·B· (C + 3)!4 { Xx∈B ∆x>0 {Xx∈Br210 (C + 3)!3 · λ2 ǫ6 = sup (nx)x∈B≥0 Px∈B nx≤T (nx)x∈B≥0 Px∈B nx≤T ≤ sup ≤ 25 (C + 3)!2 · λ ≤ 25 (C + 3)!2 · λ ǫ3 ǫ3 · ln(T )· nx } + O( √nx } + O( {Xx∈B ·pln(T )· σ ·B· (C + 3)!4 ·pσ ·B· T · ln(T ) + O( (nx)x∈B≥0 Px∈B nx≤T sup ǫ6 σ ·B· (C + 3)!4 σ ·B· (C + 3)!4 ǫ6 ǫ6 · ln(T )) · ln(T )) · ln(T )), where we use the fact that ∆x ≤ 1 (see the proof of Theorem 8) for the second equality, we maximize over each ∆x ≥ 0 to derive the first inequality, and we use Cauchy-Schwartz for the last inequality. F.7. Proof of Theorem 10. Define b(i) = B(i)/ T for any i ∈ {1,··· , C}. If the decision maker stops pulling arms at round T at the latest, all the results derived in Section 7 hold as long as we substitute T with T and we get: min(τ ∗, T ) T · opt− E[ Xt=1 rat,t] ≤ X, where X denotes the right-hand side of the regret bound derived in either Theorem 8 or Theorem 9 and opt denotes the optimal value of (3) when b(i) is substituted with b(i) for any i ∈ {1,··· , C}. The key observation is that T · opt = T · opt, where opt denotes the optimal value of (3), because the time constraint is redundant in (3) even when b(i) is substituted with b(i) for any i ∈ {1,··· , C}. This is enough to show the claim as we get: τ ∗ Xt=1 X ≥ T · opt− E[ ≥ RB(1),··· ,B(C−1),T , rat,t] where we use Lemma 2 for the last inequality. F.8. Proof of Theorem 11. The only difference with the proofs of Theorems 8 and 9 lies in how we t=τ ∗+1 rat,t]. We have: T E[ bound E[PT Xt=τ ∗+1 Xt=0 Xi=1 ≤ = C T rat,t] ≤ E[(T − τ ∗)+] T P[τ ∗ ≤ T − t] Xt=0 Xτ =1 T−t P[ caτ ,τ (i) ≥ B(i)] Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 67 (bx,T−t(i)− nx,T−t · b(i)) ≥ t· b(i)] C T T−t nx,T +Xx∈B nx,T ≥ t· C T C T C T = = = P[ with det(Ax)=0 Xτ =1 P[tini +Xx /∈B P[tini +Xx /∈B Xt=0 Xi=1 (caτ ,τ (i)− b(i)) ≥ t· b(i)] nx,T + Xx pseudo-basis for (3) Xt=0 Xi=1 nx,T + Xx pseudo-basis for (3) Xt=0 Xi=1 Xt=0Xx∈B Xi=1 P[bx,T−t(i)− nx,T−t · b(i) ≥ t· tini +Px /∈B Xt=1 Xi=1 ≤ 2 Xt=1Xx∈B Xi=1 + 2B· (C + 4)!4 ·B2 b· ǫ6 b(i) 2·B E[nx,T ] +Px pseudo-basis for (3) E[bx,T−t(i)− nx,T−t · b(i)] · ln2(T )), t· b(i) t· b(i) with det(Ax)=0 with det(Ax)=0 = O( + C T C T + O(1) b(i) ] 2 ] E[nx,T ] where we use Lemma 13 and we bound E[bx,T−t(i) − nx,T−t · b(i)] in the same fashion as in the proof of Theorem 8 using Lemma 14. Appendix G: Proofs for Section A. G.1. Proof of Lemma 16. The proof follows the same steps as for Lemma 8. We use the shorthand k,t. Along the same lines as in Fact 1, )2 and n6=x∗ i=1 b(i))2 ǫ2 notations βk = 8 ρ·(PC we have: · ( 1 ∆k k,t =Px∈B k∈Kx,x6=x∗ nx τ ∗ k,t ≥βk ln(t)], and we can focus on bounding the second term, which can be broken down as follows: Xt=1 E[nk,τ ∗] ≤ 2βk · E[ln(τ ∗)] + E[ Ixt6=x∗ · Iat=k · In6=x∗ τ ∗ E[ Xt=1 Ixt6=x∗ · Iat=k · In6=x∗ k,t ≥βk ln(t)] τ ∗ τ ∗ τ ∗ = E[ Xt=1 Xt=1 ≤ E[ Xt=1 Xt=1 + E[ + E[ τ ∗ Iobjxt,t+Ext,t≥objx∗,t+Ex∗,t · Ixt6=x∗ · Iat=k · In6=x∗ k,t ≥βk ln(t)] Iobjxt,t≥objxt +Ext,t] Iobjx∗,t≤objx∗−Ex∗,t] Iobjx∗ <objxt +2Ext,t · Ixt6=x∗ · Iat=k · In6=x∗ k,t ≥βk ln(t)]. We study each term separately, just like in Lemma 8. Fact 15 τ ∗ E[ Xt=1 Iobjxt,t≥objxt +Ext,t] ≤ K · π2 6 . 68 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK Proof. If objxt,t ≥ objxt + Ext,t, there must exist l ∈ Kxt such that ¯rl,t ≥ µr l + ǫl,t, otherwise: objxt,t − objxt = Xl∈Kxt < Xl∈Kxt = Ext,t, l )· ξxt l (¯rl,t − µr ǫl,t · ξxt l where the inequality is strict because there must exist l ∈ Kxt such that ξxt l > 0 (at least one resource constraint is binding for a feasible basis to (3) aside from the basis x associated with Kx = ∅). We obtain: τ ∗ Iobjxt,t≥objxt E[ Xt=1 τ ∗ K K ∞ I¯rl,t≥µr Xl=1 Xt=1 +Ext,t] ≤ E[ Xl=1 Xt=1 P[¯rl,t ≥ µr ≤ K · π2 6 ≤ , l +ǫl,t] l + ǫl,t] where the last inequality is derived along the same lines as in the proof of Fact 3. Similarly, we can show that: We move on to study the last term. Fact 16 τ ∗ τ ∗ E[ Xt=1 Iobjx∗,t≤objx∗−Ex∗,t] ≤ K · π2 6 . E[ Xt=1 Iobjx∗ <objxt +2Ext,t · Ixt6=x∗ · Iat=k · In6=x∗ k,t ≥βk ln(t)] = 0. Proof. If objx∗ < objxt + 2Ext,t, xt 6= x∗, and at = k, we have: ∆xt 2 ∆k 2 ≤ < Xl∈Kxt ≤ Xl∈Kxt ξxt l ·s 2 ln(t) nl,t s 2ξxt · ξxt k ln(t) nk,t l , where we use the fact that, by definition of the load balancing algorithm and since at = k, ξxt arm k would not have been selected) and: k 6= 0 (otherwise nl,t ≥ ξxt l ξxt k nk,t, (49) for all arms l ∈ Kxt . We get: nk,t < ≤ ≤ l )2 · ln(t) · ln(t) 8 8 k · (Xl∈Kxtpξxt (∆k)2 · ξxt k · ρ· Xl∈Kxt (∆k)2 · ξxt (∆k)2 · ρ· (Xl∈Kxt ξxt l 8 ξxt l )2 · ln(t), Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 69 using the Cauchy−Schwarz inequality and the fact that a basis involves at most ρ arms. Now observe that: Xl∈Kxt i=1 cl(i) ξxt l ≤ Xl∈Kxt PC ≤PC i=1 b(i) ǫ ǫ · ξxt l as xt is a feasible basis to (8) and using Assumption 2. We obtain: n6=x∗ k,t ≤ nk,t ρ· (PC < 8· ǫ2 · (∆k)2 = βk · ln(t). i=1 b(i))2 · ln(t) G.2. Proof of Lemma 17. We first show (16) by induction on t. The base case is straightforward. Suppose that the inequality holds at time t− 1. There are three cases: while the right-hand side can only increase, hence the inequality still holds at time t, • arm k is not pulled at time t− 1, in which case the left-hand side of the inequality remains unchanged • arm k is pulled at time t − 1 after selecting xt−1 6= x∗, in which case both sides of the inequality • arm k is pulled at time t− 1 after selecting xt−1 = x∗. First observe that there must exist l ∈ Kx∗ such increase by one and the inequality still holds at time t, that nl,t−1 ≤ (t− 1)· ξx∗ l r=1 ξx∗ r PK . Suppose otherwise, we have: t− 1 = nl,t nl,t K Xl=1 ≥ Xl∈Kx∗ > Xl∈Kx∗ = t− 1, (t− 1)· l ξx∗ r=1 ξx∗ r PK a contradiction. Suppose now by contradiction that inequality (16) no longer holds at time t, we have: k ξx∗ l=1 ξx∗ nk,t−1 = nk,t − 1 > nx∗,t · PK ≥ (nx∗,t + Xx∈B,x6=x∗ = (t− 1)· ξx∗ l=1 ξx∗ k l l PK nx,t k ξx∗ l=1 ξx∗ l + Xx∈B,x6=x∗ nx,t)· PK , which implies, using the preliminary remark above, that definition of the load balancing algorithm. ξx∗ k nk,t−1 ξx∗ l nl,t−1 < max l∈Kx∗ , a contradiction given the 70 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK We conclude that inequality (16) holds for all times t and arms k ∈ Kx∗. We also derive inequality (15) as a byproduct, since, at any time t and for any arm k ∈ Kx∗: nl,t nk,t ≥ nx∗,t − Xl∈Kx∗ ,l6=k PK l − ρ· ( Xx∈B,x6=x∗ ≥ nx∗,t · (1−Pl∈Kx∗ ,l6=k ξx∗ = nx∗,t · ξx∗ l=1 ξx∗ l=1 ξx∗ k l l PK nx,t + 1) )− ρ· ( Xx∈B,x6=x∗ nx,t + 1), as a basis involves at most ρ arms. G.3. Proof of Theorem 12. The proof proceeds along the same lines as for Theorem 3. We build upon (4): K K RB(1),··· ,B(C) ≤ B · µr k · E[nk,τ ∗ ] + O(1) K ≤ B · Xk=1 Xk=1 ≤ (B − PK k · ξx∗ Xk=1 µr k − k · ξx∗ k − Xk∈Kx∗ µr E[nx∗,τ ∗] Xk=1 )· k=1 ξx∗ K k µr k · E[nk,τ ∗ ] + O(1) k · ξx∗ k + ρ2 · Xx∈B,x6=x∗ µr E[nx,τ ∗] + O(1), where we use (15) to derive the third inequality. Now observe that, by definition, at least one resource is exhausted at time τ ∗. Hence, there exists i ∈ {1,··· , C} such that the following holds almost surely: K B(i) ≤ ck(i)· nk,τ ∗ nk,τ ∗ + Xk∈Kx∗ nx,τ ∗ + Xk∈Kx∗ Xk=1 ≤ Xk /∈Kx∗ ≤ Xx∈B,x6=x∗ ≤ ρ· ( Xx∈B,x6=x∗ ≤ ρ· ( Xx∈B,x6=x∗ ck(i)· nk,τ ∗ ck(i)· nk,τ ∗ ck(i)· , k ξx∗ l=1 ξx∗ l PK nx∗,τ ∗ k=1 ξx∗ k nx,τ ∗ + 2) + nx∗,τ ∗ · Xk∈Kx∗ nx,τ ∗ + 2) + b(i)· PK b · ( Xx∈B,x6=x∗ ρ k ≥ B − nx,τ ∗ + 2), nx∗,τ ∗ k=1 ξx∗ PK where we use (16) and the fact that x∗ is a feasible basis to (3). Rearranging yields: almost surely. Plugging this last inequality back into the regret bound, we get: RB(1),··· ,B(C) ≤ ρ· Xx∈B,x6=x∗ ≤ ρ· Xx∈B,x6=x∗ + ρ) + O(1) k E[nx,t]· (PK E[nx,t]· (PK k=1 µr b k · ξx∗ i=1 ck(i)· ξx∗ k=1PC ǫ· b k + ρ) + O(1) Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 71 K = ( ≤ ( E[nx,t] + O(1) ρ·PC i=1 b(i) ǫ· b ρ·PC i=1 b(i) ǫ· b ρ3 · (PC i=1 b(i))3 ≤ 32 ǫ3 · b ρ3 · (PC i=1 b(i))3 ǫ3 · b + (ρ)2)· Xx∈B,x6=x∗ Xk=1 E[ Xx∈B k∈Kx,x6=x∗ + (ρ)2)· Xk=1 (∆k)2 )· E[ln(τ ∗)] + O(1) (∆k)2 )· ln(PC i=1 b(i)· B Xk=1 ≤ 32 · ( · ( nx 1 1 ǫ K K k,τ ∗] + O(1) + 1) + O(1), where we use the fact that x∗ is a feasible basis to (3) for the third inequality, Lemma 16 for the fourth inequality, the concavity of the logarithmic function along with Lemma 7 for the last inequality. G.4. Proof of Lemma 18. We use the shorthand notations βk = 8C · ( λ n /∈Ok,t =Px∈B k∈Kx, x /∈O k,t. Similarly as in Fact 11, we have: nx ∆k E[n /∈Ok,T ] ≤ 2βk · ln(T ) + 29 (C + 3)!4 Ixt /∈O · Iat=k · In /∈O + E[ ǫ6 T Xt=tini k,t ≥βk ln(t) · Ix∗∈Bt], )2 and, for any round t, and what remains to be done is to bound the second term, which we can break down as follows: T Iobjxt,t+Ext,t≥objx∗,t+Ex∗,t · Ixt /∈O · Iat=k · In /∈O k,t ≥βk ln(t) · Ix∗∈Bt] k,t ≥βk ln(t) · Ix∗∈Bt] E[ Xt=tini ≤ E[ ≤ E[ + E[ + E[ T T Iobjxt,t≥objxt Ixt /∈O · Iat=k · In /∈O Xt=tini Xt=tini Xt=tini Xt=tini Iobjx∗ <objxt T T +Ext,t · Ixt∈Bt] Iobjx∗,t≤objx∗−Ex∗,t · Ix∗∈Bt] +2Ext,t · Ixt /∈O · Iat=k · In /∈O k,t ≥βk ln(t)]. The study of the second term is the same as in the proof of Lemma 15. We can also bound the first term in the same fashion as in the proof of Lemma 15 since there is no reference to the load balancing algorithm in the proof of Fact 13. The major difference with the proof of Lemma 15 lies in the study of the last term. Fact 17 T Iobjxt,t≥objxt +Ext,t · Ix∈Bt] ≤ 210 K · (C + 3)!2 ǫ6 . E[ Xt=tini Proof. The only difference with the proof of Fact 13 is that the number of arms that belong to Kx for x ranging in {x ∈ B k ∈ Kx, x /∈ O} can be as big as K, as opposed to C when we are considering one basis at a time. This increases the bound by a multiplicative factor K. 72 Fact 18 T Flajolet and Jaillet: Logarithmic Regret Bounds for BwK E[ Xt=tini Iobjx∗ <objxt +2Ext,t · Ixt /∈O · Iat=k · In /∈O k,t ≥βk ln(t)] = 0. Proof. Assume that objx∗ < objxt + 2Ext,t, xt /∈ O, and at = k. We have: ∆xt 2 ∆k 2 ≤ < λ· Xl∈Kxt ≤ λ· Xl∈Kxt ξxt l,t ·s 2 ln(t) nl,t s 2ξxt l,t · ξxt nk,t k,t ln(t) , where we use the fact that, by definition of the load balancing algorithm and since at = k, ξxt arm k would not have been selected) and: k,t 6= 0 (otherwise nl,t ≥ ξxt l,t k,t · nk,t, ξxt (50) for any arm l ∈ Kxt . We get: n /∈Ok,t ≤ nk,t λ < 8( ∆k λ ∆k λ ∆k ≤ 8( ≤ 8( ≤ 8C · ( l,t)2 · ln(t) ξxt l,t · ln(t) ξxt l,t)2 · ln(t) )2 · ξxt k,t · (Xl∈Kxtqξxt k,t · C · Xl∈Kxt )2 · ξxt )2 · C · (Xl∈Kxt )2 · ln(t), λ ∆k using the Cauchy−Schwarz inequality, the fact that a basis involves at most C arms, and the fact that xt is feasible for (8) whose linear constraints include PK l=1 ξl ≤ 1 and ξl ≥ 0,∀l ∈ {1,··· , K}. We get n /∈Ok,t < βk ln(t) by defintion of βk. G.5. Proof of Theorem 13. Substituting b(i) with B(i)/B(C) for every resource i ∈ {1,··· , C}, the regret bound obtained in Theorem 3 turns into: RB(1),··· ,B(C) ≤ 16 ρ ǫ ·PC i=1 B(i) B(C) · ( Xx∈B ∆x>0 1 ∆x i=1 B(i) )· ln(PC ǫ + 1) + O(1). (51) and O∁ are defined by strict Observe that B∁ ∞ ⊂ O∁ and thus (B(1)/B(C),··· , B(C − 1)/B(C)). Hence, for B(C) large enough, B∁ B ⊂ B∞ and O ⊂ O∞. We now move on to prove each claim separately. First claim. Suppose that there exists a unique optimal basis to (3), which we denote by x∗. Then, we must have O = {x∗} = O∞ for B(C) large enough. Indeed, using the set inclusion relations shown above, we have O ⊂ O∞ = {x∗} and O can never be empty as there exists at least one optimal basis to (3) (this linear program is feasible and bounded). We get O∁ ∩B ⊂ O∁ ∞ ∩B∞ for B(C) large enough. Note moreover that, ∞ ⊂ B∁ and O∁ that are linear in the vector inequalities Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 73 for any x ∈ B, ∆x converges to ∆∞x (because both the objective value of a feasible basis and the optimal value of a linear program are Lipschitz in the right-hand side of the inequality constraint), which implies that ∆x > ∆∞ 2 > 0 when x ∈ B ∩O∁ for B(C) large enough. We conclude with (51) that: x RB(1),··· ,B(C) ≤ 32 ρ ǫ ·PC i=1 B(i) B(C) · ( Xx∈B∞ ∆∞ x >0 1 ∆x i=1 B(i) )· ln(PC ǫ + 1) + O(1), for B(C) large enough. This yields the result since B(i)/B(C) → b(i) > 0 for any resource i = 1,··· , C − 1. Second claim. Suppose that B(i) B(C) ) for any resource i ∈ {1,··· , C − 1}. Starting from (30) derived in the proof of Theorem 3 and applying Lemma 8 only if ∆x is big enough, we have: B(C) − b(i) = O( ln(B(C)) min( PK min(∆x · ∆x k=1 ξx k · E[nx,τ ∗], 16ρ·PK mini=1,··· ,C B(i) ·PC B(C) ǫ k k=1 ξx ∆x i=1 B(i) ǫ · ln(PC ρ·PC , 16 i=1 B(i) + 1) + π2 3 i=1 B(i)/B(C) ǫ ) + O(1) ∆x k=1 ξx k i=1 B(i) ρ· PK ∆x · ln(PC 1 ǫ + 1)) · RB(1),··· ,B(C) ≤ Xx∈B ∆x>0 ≤ Xx∈B ∆x>0 ρ·PC ≤ 16 + ( Xx∈B∩O∁∩O∞ + O(1) where we use: and i=1 B(i)/B(C) · ( Xx∈B∩O∁∩O∁ ∞ 1 ∆x )· ln(PC ǫ i=1 B(i) + 1) B(C) mini=1,··· ,C B(i) ·PC ǫ i=1 B(i) + O(1), ' ǫ ∆x)· K Xk=1 ξx k ∈ [ min i=1,··· ,C B(i)/B(C),PC i=1 B(i)/B(C) ] ǫ , ∆x ≤ PC i=1 B(i)/B(C) ǫ as shown in the proof of Theorem 3 (substituting b with mini=1,··· ,C B(i)/B(C)). For x ∈ B∩O∁∩O∁ ∞ have x ∈ B∞ and ∆x > ∆∞ 2 > 0 for B(C) large enough, as shown for the first claim. For x ∈ B ∩O∁ ∩O∞, we have ∆x = O(ln(B(C))/B(C)) as both the objective value of a feasible basis and the optimal value of a linear program are Lipschitz in the right-hand side of the inequality constraints. We conclude that, for B(C) large enough: , we x RB(1),··· ,B(C) ≤ 32 1 ǫ · i=1 B(i)/B(C) ρ·PC · ( Xx∈B∞∩O∁ mini=1,··· ,C B(i) · Xx∈B∩O∁∩O∞ B(C) + ǫ ∞ 1 ∆∞x )· ln(PC ǫ i=1 B(i) + 1) O(ln(B(C))) + O(1). This yields the result since B ∩ O∁ ∩ O∞ ≤ O∞ and B(i)/B(C) → b(i) > 0 for any resource i = 1,··· , C − 1. 74 Flajolet and Jaillet: Logarithmic Regret Bounds for BwK G.6. Proof of Theorem 14. The proof is along the same lines as for Theorem 13. Specifically, in a first step, we observe that all the proofs of Section 6 remain valid (up to universal constant factors) for T large enough as long as we substitute b with B/T . Indeed, for T large enough, we have B T > ǫ for all arms k ∈ {1,··· , K} under Assumption 6. In a second step, just like in the proof of Theorem 13, we show that we can substitutePx∈B ∆x>0 in the regret bound up to universal constant factors. withPx∈B∞ ∆∞ T ≤ 2 and µc k − B 1 ∆x 1 x >0 ∆∞ x 2 G.7. Proof of Theorem 15. The proof is along the same lines as for Theorem 13. Specifically, in a first step, we observe that all the proofs of Section 7 remain valid (up to universal constant factors) for T large enough as long as we substitute b with mini=1,··· ,C−1 B(i)/T . Indeed, for T large enough, we have mini=1,··· ,C−1 B(i)/T ≤ 2 and, under Assumption 8, any basis to (17) has determinannt larger than ǫ/2 in absolute value and is ǫ/2−non-degenerate by continuity of linear functions. In a second step, just like in the proof of Theorem 13, we show that we can substitutePx∈B ∆x>0 in the regret bound up to universal constant factors. withPx∈B∞ ∆∞ 1 ∆x x >0 ∆∞ x 1 References [1] Agrawal S, Devanur NR (2014) Bandits with concave rewards and convex knapsacks. Proc. 15th ACM Conf. Economics and Computation, 989 -- 1006. [2] Agrawal S, Devanur NR, Li L (2016) An efficient algorithm for contextual bandits with knapsacks, and an extension to concave objectives. Proc. 29th Annual Conf. Learning Theory, 4 -- 18. [3] Agrawal S, Goyal N (2012) Analysis of thompson sampling for the multi-armed bandit problem. Proc. 25th Annual Conf. Learning Theory, volume 23. [4] Auer P, Cesa-Bianchi N, Fischer P (2002) Finite-time analysis of the multiarmed bandit problem. Machine learn- ing 47(2-3):235 -- 256. [5] Auer P, Cesa-Bianchi N, Freund Y, Schapire RE (2002) The nonstochastic multiarmed bandit problem. SIAM J. Comput. 32(1):48 -- 77. [6] Babaioff M, Dughmi S, Kleinberg R, Slivkins A (2012) Dynamic pricing with limited supply. Proc. 13th ACM Conf. Electronic Commerce, 74 -- 91. [7] Badanidiyuru A, Kleinberg R, Singer Y (2012) Learning on a budget: posted price mechanisms for online pro- curement. Proc. 13th ACM Conf. Electronic Commerce, 128 -- 145. [8] Badanidiyuru A, Kleinberg R, Slivkins A (2013) Bandits with knapsacks. Proc. 54th IEEE Annual Symp. Foun- dations of Comput. Sci., 207 -- 216. [9] Badanidiyuru A, Langford J, Slivkins A (2014) Resourceful contextual bandits. Proc. 27th Annual Conf. Learn- ing Theory, volume 35, 1109 -- 1134. [10] Bertsimas D, Tsitsiklis JN (1997) Introduction to linear optimization, volume 6 (Athena Scientific). [11] Besbes O, Zeevi A (2012) Blind network revenue management. Oper. Res. 60(6):1537 -- 1550. [12] Combes R, Jian C, Srikant R (2015) Bandits with budgets: Regret lower bounds and optimal algorithms. Proc. 2015 ACM SIGMETRICS Int. Conf. Measurement and Modeling Computer Systems, 245 -- 257. [13] Ding W, Qin T, Zhang X, Liu T (2013) Multi-armed bandit with budget constraint and variable costs. Proc. 27th AAAI Conf. Artificial Intelligence, 232 -- 238. [14] Ghosh A, Rubinstein BIP, Vassilvitskii S, Zinkevich M (2009) Adaptive bidding for display advertising. Proc. 18th Int. Conf. World Wide Web, 251 -- 260. [15] Graczov´a D, Jacko P (2014) Generalized restless bandits and the knapsack problem for perishable inventories. Oper. Res. 62(3):696 -- 711. [16] Grotschel M, Lov´asz L, Schrijver A (2012) Geometric algorithms and combinatorial optimization, volume 2 (Springer). [17] Johnson K, Simchi-Levi D, Wang H (2015) Online network revenue management using thompson sampling. Working Paper . Flajolet and Jaillet: Logarithmic Regret Bounds for BwK 75 [18] Kleinberg R, Leighton T (2003) The value of knowing a demand curve: Bounds on regret for online posted-price auctions. Proc. 44th IEEE Annual Symp. Foundations of Comput. Sci., 594 -- 605. [19] Lai TL, Robbins H (1985) Asymptotically efficient adaptive allocation rules. Adv. Applied Math. 6(1):4 -- 22. [20] Papadimitriou CH, Tsitsiklis JN (1999) The complexity of optimal queuing network control. Math. Oper. Res. 24(2):293 -- 305. [21] Robbins H (1952) Some aspects of the sequential design of experiments. Bulleting American Math. Society 58(5):527 -- 535. [22] Slivkins A (2013) Dynamic ad allocation: Bandits with budgets. arXiv preprint arXiv:1306.0155 . [23] Tran-Thanh L, Chapman A, Rogers A, Jennings NR (2010) ǫ-first policies for budget-limited multi-armed ban- dits. Proc. 24th AAAI Conf. Artificial Intelligence, 1211 -- 1216. [24] Tran-Thanh L, Chapman A, Rogers A, Jennings NR (2012) Knapsack based optimal policies for budget-limited multi-armed bandits. Proc. 26th AAAI Conf. Artificial Intelligence, 1134 -- 1140. [25] Tran-Thanh L, Rogers A, Jennings NR (2012) Long-term information collection with energy harvesting wireless sensors: a multi-armed bandit based approach. Autonomous Agents and Multi-Agent Systems 25(2):352 -- 394. [26] Tran-Thanh L, Stavrogiannis C, Naroditskiy V, Robu V, Jennings NR, Key P (2014) Efficient regret bounds for online bid optimisation in budget-limited sponsored search auctions. Proc. 30th Conf. Uncertainty in Artificial Intelligence, 809 -- 818. [27] Trovo F, Paladino S, Restelli M, Gatti N (2016) Budgeted multi -- armed bandit in continuous action space. Work- ing Paper . [28] Weed J, Perchet V, Rigollet P (2016) Online learning in repeated auctions. Proc. 29th Annual Conf. Learning Theory, volume 49, 1562 -- 1583. [29] Wu H, Srikant S, Liu X, Jiang C (2015) Algorithms with logarithmic or sublinear regret for constrained contextual bandits. Adv. Neural Inform. Processing Systems, 433 -- 441. [30] Xia Y, Ding W, Zhang X, Yu N, Qin T (2015) Budgeted bandit problems with continuous random costs. Proc. 7th Asian Conf. Machine Learning, 317 -- 332.
1902.02526
2
1902
2019-02-14T09:18:46
Going Far From Degeneracy
[ "cs.DS", "cs.DM" ]
An undirected graph G is d-degenerate if every subgraph of G has a vertex of degree at most d. By the classical theorem of Erd\H{o}s and Gallai from 1959, every graph of degeneracy d>1 contains a cycle of length at least d+1. The proof of Erd\H{o}s and Gallai is constructive and can be turned into a polynomial time algorithm constructing a cycle of length at least d+1. But can we decide in polynomial time whether a graph contains a cycle of length at least d+2? An easy reduction from Hamiltonian Cycle provides a negative answer to this question: deciding whether a graph has a cycle of length at least d+2 is NP-complete. Surprisingly, the complexity of the problem changes drastically when the input graph is 2-connected. In this case we prove that deciding whether G contains a cycle of length at least d+k can be done in time 2^{O(k)}|V(G)|^{O(1)}. In other words, deciding whether a 2-connected n-vertex G contains a cycle of length at least d+log n can be done in polynomial time. Similar algorithmic results hold for long paths in graphs. We observe that deciding whether a graph has a path of length at least d+1 is NP-complete. However, we prove that if graph G is connected, then deciding whether G contains a path of length at least d+k can be done in time 2^{O(k)}n^{O(1)}. We complement these results by showing that the choice of degeneracy as the `above guarantee parameterization' is optimal in the following sense: For any \epsilon>0 it is NP-complete to decide whether a connected (2-connected) graph of degeneracy d has a path (cycle) of length at least (1+\epsilon)d.
cs.DS
cs
Fedor V. Fomin† Going Far From Degeneracy∗ Daniel Lokshtanov‡ Petr A. Golovach† Saket Saurabh§ Meirav Zehavi¶ Fahad Panolan† 9 1 0 2 b e F 4 1 ] S D . s c [ 2 v 6 2 5 2 0 . 2 0 9 1 : v i X r a Abstract An undirected graph G is d-degenerate if every subgraph of G has a vertex of degree at most d. By the classical theorem of Erdos and Gallai from 1959, every graph of degeneracy d > 1 contains a cycle of length at least d + 1. The proof of Erdos and Gallai is constructive and can be turned into a polynomial time algorithm constructing a cycle of length at least d + 1. But can we decide in polynomial time whether a graph contains a cycle of length at least d + 2? An easy reduction from Hamiltonian Cycle provides a negative answer to this question: Deciding whether a graph has a cycle of length at least d + 2 is NP-complete. Surprisingly, the complexity of the problem changes drastically when the input graph is 2- connected. In this case we prove that deciding whether G contains a cycle of length at least d + k can be done in time 2O(k)V (G)O(1). In other words, deciding whether a 2-connected n-vertex G contains a cycle of length at least d + log n can be done in polynomial time. Similar algorithmic results hold for long paths in graphs. We observe that deciding whether a graph has a path of length at least d + 1 is NP-complete. However, we prove that if graph G is connected, then deciding whether G contains a path of length at least d + k can be done in time 2O(k)nO(1). We complement these results by showing that the choice of degeneracy as the "above guarantee parameterization" is optimal in the following sense: For any ε > 0 it is NP-complete to decide whether a connected (2-connected) graph of degeneracy d has a path (cycle) of length at least (1 + ε)d. 1 Introduction The classical theorem of Erdos and Gallai Theorem 1 (Erdos and Gallai [12]). Every graph with n vertices and more than (n − 1)(cid:96)/2 edges ((cid:96) ≥ 2) contains a cycle of length at least (cid:96) + 1. [12] says that Recall that a graph G is d-degenerate if every subgraph H of G has a vertex of degree at most d, that is, the minimum degree δ(H) ≤ d. Respectively, the degeneracy of graph G, is dg(G) = max{δ(H) H is a subgraph of G}. Since a graph of degeneracy d has a subgraph H with at least d · V (H)/2 edges, by Theorem 1, it contains a cycle of length at least d + 1. Let us note that the degeneracy of a graph can be computed in polynomial time, see e.g. [28], and thus by Theorem 1, deciding whether a graph has a cycle of length at least d + 1 can be done in polynomial time. In this paper we revisit this classical result from the algorithmic perspective. We define the following problem. ∗The research leading to these results has received funding from the Research Council of Norway via the projects "CLASSIS" and "MULTIVAL". †Department of Informatics, University of Bergen, Norway. ‡Department of Computer Science, University of California Santa Barbara, USA. §Institute of Mathematical Sciences, HBNI, Chennai, India. ¶Ben-Gurion University, Israel. 1 Longest Cycle Above Degeneracy Input: Task: A graph G and a positive integer k. Decide whether G contains a cycle of length at least dg(G) + k. Let us first sketch why Longest Cycle Above Degeneracy is NP-complete for k = 2 even for connected graphs. We can reduce Hamiltonian Cycle to Longest Cycle Above Degeneracy with k = 2 as follows. For a connected non-complete graph G on n vertices, we construct connected graph H from G and a complete graph Kn−1 on n−1 vertices as follows. We identify one vertex of G with one vertex of Kn−1. Thus the obtained graph H has V (G) + n− 2 vertices and is connected; its degeneracy is n − 2. Then H has a cycle with dg(H) + 2 = n vertices if and only if G has a Hamiltonian cycle. Interestingly, when the input graph is 2-connected, the problem becomes fixed-parameter tractable being parameterized by k. Let us remind that a connected graph G is (vertex) 2- connected if for every v ∈ V (G), G − v is connected. Our first main result is the following theorem. Theorem 2. On 2-connected graphs Longest Cycle Above Degeneracy is solvable in time 2O(k) · nO(1). Similar results can be obtained for paths. Of course, if a graph contains a cycle of length d + 1, it also contains a simple path on d + 1 vertices. Thus for every graph G of degeneracy d, deciding whether G contains a path on dg(G) + 1 vertices can be done in polynomial time. Again, it is a easy to show that it is NP-complete to decide whether G contains a path with d+2 vertices by reduction from Hamiltonian Path. The reduction is very similar to the one we sketched for Longest Cycle Above Degeneracy. The only difference that this time graph H consists of a disjoint union of G and Kn−1. The degeneracy of H is d = n − 2, and H has a path with d + 2 = n vertices if and only if G contains a Hamiltonian path. Note that graph H used in the reduction is not connected. However, when the input graph G is connected, the complexity of the problem change drastically. We define Longest Path Above Degeneracy Input: Task: A graph G and a positive integer k. Decide whether G contains a path with at least dg(G) + k vertices. The second main contribution of our paper is the following theorem. Theorem 3. On connected graphs Longest Path Above Degeneracy is solvable in time 2O(k) · nO(1). Let us remark that Theorem 2 does not imply Theorem 3, because Theorem 2 holds only for 2-connected graphs. We also show that the parameterization lower bound dg(G) that is used in Theorems 3 and 2 is tight in some sense. We prove that for any 0 < ε < 1, it is NP-complete to decide whether a connected graph G contains a path with at least (1 + ε)dg(G) vertices and it is NP-complete to decide whether a 2-connected graph G contains a cycle with at least (1 + ε)dg(G) vertices. Related work. Hamiltonian Path and Hamiltonian Cycle problems are among the oldest and most fundamental problems in Graph Theory. In parameterized complexity the following generalizations of these problems, Longest Path and Longest Cycle, we heavily studied. The Longest Path problem is to decide, for given an n-vertex (di)graph G and an integer k, whether G contains a path of length at least k. Similarly, the Longest Cycle problem is to 2 decide whether G contains a cycle of length at least k. There is a plethora of results about parameterized complexity (we refer to the book of Cygan at al. [10] for the introduction to the field) of Longest Path and Longest Cycle (see, e.g., [5, 6, 8, 7, 13, 15, 22, 23, 24, 33]) since the early work of Monien [29]. The fastest known randomized algorithm for Longest Path on undirected graph is due to Bjorklund et al. [5] and runs in time 1.657k · nO(1). On the other hand very recently, Tsur gave the fastest known deterministic algorithm for the problem running in time 2.554k · nO(1) [32]. Respectively for Longest Cycle, the current fastest randomized algorithm runs in time 4knO(1) was given by Zehavi in [34] and the best deterministic algorithm constructed by Fomin et al. in [14] runs in time 4.884knO(1). Our theorems about Longest Path Above Degeneracy and Longest Cycle Above Degeneracy fits into an interesting trend in parameterized complexity called "above guaran- tee" parameterization. The general idea of this paradigm is that the natural parameterization of, say, a maximization problem by the solution size is not satisfactory if there is a lower bound for the solution size that is sufficiently large. For example, there always exists a satisfying assignment that satisfies half of the clauses or there is always a max-cut containing at least half the edges. Thus nontrivial solutions occur only for the values of the parameter that are above the lower bound. This indicates that for such cases, it is more natural to parameterize the problem by the difference of the solution size and the bound. The first paper about above guarantee parameterization was due to Mahajan and Raman [26] who applied this approach to the Max Sat and Max Cut problem. This approach was successfully applied to various problems, see e.g. [1, 9, 17, 18, 19, 20, 25, 27]. For Longest Path, the only successful above guarantee parameterization known prior to our work was parameterization above shortest path. More precisely, let s, t be vertices of an undirected graph G. Clearly, the length of any (s, t)-path in G is lower bounded by the shortest distance, d(s, t), between these vertices. Based on this observation, Bez´akov´a et al. in [4] introduced the Longest Detour problem that asks, given a graph G, two vertices s, t, and a positive integer k, whether G has an (s, t)-path with at least d(s, t) + k vertices. They proved that for undirected graphs, this problem can be solved in time 2O(k)nO(1). On the other hand, the parameterized complexity of Longest Detour on directed graphs is still open. For the variant of the problem where the question is whether G has an (s, t)-path with exactly d(s, t)+k vertices, a randomized algorithm with running time O∗(2.746k) and a deterministic algorithm with running time O∗(6.745k) were obtained [4]. These algorithms work for both undirected and directed graphs. Parameterization above degeneracy is "orthogonal" to the parameterization above the shortest distance. There are classes of graphs, like planar graphs, that have constant degeneracy and arbitrarily large diameter. On the other hand, there are classes of graphs, like complete graphs, of constant diameter and unbounded degeneracy. 1.1 Our approach Our algorithmic results are based on classical theorems of Dirac [11], and Erdos and Gallai [12] on the existence of "long cycle" and "long paths" and can be seen as non-trivial algorithmic extensions of these classical theorems. Let δ(G) be the minimum vertex degree of graph G. Theorem 4 (Dirac [11]). Every n-vertex 2-connected graph G with minimum vertex degree δ(G) ≥ 2, contains a cycle with at least min{2δ(G), n} vertices. Theorem 5 (Erdos and Gallai [12]). Every connected n-vertex graph G contains a path with at least min{2δ(G) + 1, n} vertices. Theorem 4 is used to prove Theorem 2 and Theorem 5 is used to prove Theorem 3. We give a high-level overview of the ideas used to prove Theorem 2. The ideas behind the proof of Theorem 3 are similar. Let G be a 2-connected graph of degeneracy d. If d = O(k), 3 we can solve Longest Cycle Above Degeneracy in time 2O(k) · nO(1) by making of use one of the algorithms for Longest Cycle. Assume from now that d ≥ c · k for some constant c, which will be specified in the proof. Then we find a d-core H of G (a connected subgraph of G with the minimum vertex degree at least d). This can be done in linear time by one of the known algorithms, see e.g. [28]. If the size of H is sufficiently large, say V (H) ≥ d + k, we use Theorem 4 to conclude that H contains a cycle with at least V (H) ≥ d + k vertices. The most interesting case occurs when V (H) < d + k. Suppose that G has a cycle of length at least d + k. It is possible to prove that then there is also a cycle of length at leat d + k that it hits the core H. We do not know how many times and in which vertices of H this cycle enters and leaves H, but we can guess these terminal points. The interesting property of the core H is that, loosely speaking, for any "small" set of terminal points, inside H the cycle can be rerouted in a such way that it will contain all vertices of H. A bit more formally, we prove the following structural result. We define a system of segments in G with respect to V (H), which is a family of internally vertex-disjoint paths {P1, . . . , Pr} in G (see Figure 1). Moreover, for every 1 ≤ i ≤ r, every path Pi has at least 3 vertices, its endpoints are in V (H) and all internal vertices of Pi are in V (G) \ V (H). Also the union of all the segments is a forest with every connected component being a path. P1 Pr H Figure 1: Reducing Longest Cycle Above Degeneracy to finding a system of segments P1, . . . , Pr; complementing the segments into a cycle is shown by dashed lines. We prove that G contains a cycle of length at least k + d if and only if • either there is a path of length at least k + d − V (H) with endpoints in V (H) and all internal vertices outside H, or • there is a system of segments with respect to V (H) such that the total number of vertices outside H used by the paths of the system, is within the interval [k + d − V (H), 2 · (k + d − V (H))]. The proof of this structural result is built on Lemma 1, which describes the possibility of routing in graphs of large minimal degree. The crucial property is that we can complement any system of segments of bounded size by segments inside the core H to obtain a cycle that contains all the vertices of H as is shown in Figure 1. Since V (H) > d, the problem of finding a cycle of length at least k + d in G boils down to one of the following tasks. Either find a path of length c(cid:48) · k with all internal vertices outside H, or find a system of segments with respect to V (H) such that the total number of vertices used by the paths of the system is c(cid:48)(cid:48) · k, here c(cid:48) and c(cid:48)(cid:48) are the constants to be specified in the proof. In the first case, we can use one of the known algorithms to find in time 2O(k) · nO(1) such a long path. In the second case, we can use color-coding to solve the problem. Organization of the paper. In Section 2 we give basic definitions and state some known fundamental results. Sections 3 -- 4 contain the proof of Theorems 3 and 2. In Section 3 we state structural results that we need for the proofs and in Section 4 we complete the proofs. In Section 5, we give the complexity lower bounds for our algorithmic results. We conclude the paper in Section 6 by stating some open problems. 4 2 Preliminaries vertices that are adjacent to v in G. For a set U ⊆ V (G), NG(U ) = ((cid:83) We consider only finite undirected graphs. For a graph G, we use V (G) and E(G) to denote its vertex set and edge set, respectively. Throughout the paper we use n = V (G) and m = E(G). For a graph G and a subset U ⊆ V (G) of vertices, we write G[U ] to denote the subgraph of G induced by U . We write G−U to denote the graph G[V (G)\U ]; for a single-element set U = {u}, we write G− u. For a vertex v, we denote by NG(v) the (open) neighborhood of v, i.e., the set of v∈S NG(v))\S. The degree of a vertex v is dG(v) = NG(v). The minimum degree of G is δ(G) = min{dG(v) v ∈ V (G)}. A d-core of G is an inclusion maximal induced connected subgraph H with δ(H) ≥ d. Every graph of degeneracy at least d contains a d-core and that can be found in linear time (see [28]). A vertex u of a connected graph G with at least two vertices is a cut vertex if G−u is disconnected. A connected graph G is 2-connected if it has no cut vertices. An inclusion maximal induced 2-connected subgraph of G is called a biconnected component or block. Let B be the set of blocks of a connected graph G and let C be the set of cut vertices. Consider the bipartite graph Block(G) with the vertex set B ∪ C, where (B, C) is the bipartition, such that B ∈ B and c ∈ C are adjacent if and only if c ∈ V (B). The block graph of a connected graph is always a tree (see [21]). A path in a graph is a self-avoiding walk. Thus no vertex appears in a path more than once. A cycle is a closed self-avoiding walk . For a path P with end-vertices s and t, we say that the vertices of V (P ) \ {s, t} are internal. We say that G is a linear forest if each component of G is a path. The contraction of an edge xy is the operation that removes the vertices x and y together with the incident edges and replaces them by a vertex uxy that is adjacent to the vertices of NG({x, y}) of the original graph. If H is obtained from G by contracting some edges, then H is a contraction of G. We summarize below some known algorithmic results which will be used as subroutines by our algorithm. Proposition 1. Longest Path and Longest Cycle are solvable in time 2O(k) · nO(1). We also need the result about the variant of Longest Path with fixed end-vertices. In the (s, t)-Longest Path, we are given two vertices s and t of a graph G and a positive integer k. The task is to decide, whether G has an (s, t)-path with at least k vertices. Using the results of Bez´akov´a et al. [3], we immediately obtain the following. Proposition 2. (s, t)-Longest Path is solvable in time 2O(k) · nO(1). 3 Segments and rerouting In this section we define systems of segments and prove structural results about them. These combinatorial results are crucial for our algorithms for Longest Path Above Degeneracy and Longest Cycle Above Degeneracy. The following rerouting lemma is crucial for our algorithms. Lemma 1. Let G be an n-vertex graph and k be a positive integer such that δ(G) ≥ max{5k − 3, n − k}. Let {s1, t1}, . . . ,{sr, tr}, r ≤ k, be a collection of pairs of vertices of G such that (i) si /∈ {sj, tj} for all i (cid:54)= j, i, j ∈ {1, . . . , r}, and (ii) there is at least one index i ∈ {1, . . . , r} such that si (cid:54)= ti. Then there is a family of pairwise vertex-disjoint paths P = {P1, . . . , Pr} in G i=1 V (Pi) = V (G), that is, the paths cover all vertices such that each Pi is an (si, ti)-path and(cid:83)r of G. 5 that each Pi has at most 3 vertices. Let T = (cid:83)r i=1 V (Pi) = V (G), then the lemma holds. Assume that (cid:83)r Proof. We prove the lemma in two steps. First we show that there exists a family P(cid:48) of pairwise vertex-disjoint paths connecting all pairs {si, ti}. Then we show that if the paths of P(cid:48) do not cover all vertices of G, it is possible to enlarge a path such that the new family of paths covers more vertices. We start by constructing a family of vertex-disjoint paths P(cid:48) = {P1, . . . , Pr} in G such that each Pi ∈ P(cid:48) is an (si, ti)-path. We prove that we can construct paths in such a way i=1{si, ti} and S = V (G) \ T . Notice that S ≥ n− 2k ≥ δ(G) + 1− 2k ≥ 3k− 2. We consecutively construct paths of P(cid:48) for i ∈ {1, . . . , r}. If si = ti, then we have a trivial (si, ti)-path. If si and ti are adjacent, then edge siti forms an (si, ti)-path with 2 vertices. Assume that si (cid:54)= ti and siti /∈ E(G). The already constructed paths contain at most r− 1 ≤ k− 1 vertices of S in total. Hence, there is a set S(cid:48) ⊆ S of at least 2k−1 of vertices that are not contained in any of already constructed paths. Since δ(G) ≥ n−k, each vertex of G has at most k − 1 non-neighbors in G. By the pigeonhole principle, there is v ∈ S(cid:48) such that siv, tiv ∈ E(G). Then we can construct the path Pi = sivti. We proved that there is a family P(cid:48) = {P1, . . . , Pr} of vertex-disjoint (si, ti)-paths in G. Among all such families, let us select a family P = {P1, . . . , Pr} covering the maximum number i=1 V (Pi) < i=1 V (Pi) ≤ 3k − 1. Since si (cid:54)= ti for some i, there is an edge uv in one of the paths. Since n ≥ δ(G) + 1 ≥ 5k − 2, there are at least 2k − 1 vertices uncovered by paths of P. Since δ(G) ≥ n − k, each vertex of G has at most k − 1 non-neighbors in G. Thus there is i=1 V (Pi)) adjacent to both u and v. But then we can extend the path containing uv by replacing uv by the path uwv. The paths of the new family cover more vertices than the paths of P, which contradicts the choice of P. i=1 V (Pi) ≥ 3k. Because the paths of P are vertex-disjoint, the union of edges of paths from P contains a k-matching. That is, there are k edges u1v1, . . . , ukvk of G such that for every i ∈ {1, . . . , k}, vertices ui, vi are consecutive in some path from P and ui (cid:54)= uj, i=1 V (Pi)). We again use the observation that w has at most k − 1 non-neighbors in G and, therefore, there is j ∈ {1, . . . , k} such that ujw, vjw ∈ E(G). Then we extend the path containing ujvj by replacing edge ujvj by the path ujwvj, contradicting the choice of P. We conclude that the paths of P cover all vertices of G. of vertices of V (G). If(cid:83)r V (G). Suppose (cid:83)r w ∈ V (G)\ ((cid:83)r Suppose (cid:83)r ui (cid:54)= vj for all non-equal i, j ∈ {1, . . . , k}. Let w ∈ V (G) \ ((cid:83)r Let G be a graph and let T ⊂ V (G) be a set of terminals. We need the following definitions. Definition 1 (Terminal segments). We say that a path P in G is a one-terminal T -segment if it has at least two vertices, exactly one end-vertex of P is in T and other vertices are not in T . Respectively, P is a two-terminal T -segment if it has at least three vertices, both end-vertices of P are in T and internal vertices of P are not in T . For every cycle C hitting H, removing the vertices of H from C turns it into a set of two-terminal T -segments for T = V (H). So here is the definition. Definition 2 (System of T -segments). We say that a set {P1, . . . , Pr} of paths in G is a system of T -segments if it satisfies the following conditions. (i) For each i ∈ {1, . . . , r}, Pi is a two-terminal T -segment, (ii) P1, . . . , Pr are internally vertex-disjoint, and (iii) the union of P1, . . . , Pr is a linear forest. Let us remark that we do not require that the end-vertices of the paths {P1, . . . , Pr} cover all vertices of T . System of segments will be used for solving Longest Cycle Above Degen- eracy. 6 For Longest Path Above Degeneracy we need to modify the definition of a system of T -segments to include the possibility that path can start or end in H. Definition 3 (Extended system of T -segments). We say that a set {P1, . . . , Pr} of paths in G is an extended system of T -segments if the following holds. (i) At least one and at most two paths are one-terminal T -segments and the other are two- terminal T -segments. (ii) P1, . . . , Pr are internally vertex-disjoint and the end-vertices of each one-terminal segment that is in V (G) \ T is pairwise distinct with the other vertices of the paths. (iii) The union of P1, . . . , Pr is a linear forest and if {P1, . . . , Pr} contains two one-terminal segments, then the vertices of these segments are in distinct components of the forest. The following lemma will be extremely useful for the algorithm solving Longest Path Above Degeneracy. Informally, it shows that if a connected graph G is of large degeneracy but has a small core H, then deciding whether G has a path of length k + d can be reduced to checking whether G has an extended system of T -segments with terminal set T = V (H) such that the total number of vertices used by the system is O(k). Lemma 2. Let d, k ∈ N. Let G be a connected graph with a d-core H such that d ≥ 5k − 3 and d > V (H) − k. Then G has a path on d + k vertices if and only if G has an extended system of T -segments {P1, . . . , Pr} with terminal set T = V (H) such that the total number of vertices contained in the paths of the system in V (G) \ V (H) is p = d + k − V (H). Proof. We put T = V (H). Suppose first that G has an extended system {P1, . . . , Pr} of T - segments and that the total number of vertices of the paths in the system outside T is p = d + k − T. Let si and ti be the end-vertices of Pi for ∈ {1, . . . , r} and assume without loss of generality that for 1 ≤ i < j ≤ r, the vertices of Pi and Pj are pairwise distinct with the possible exception ti = sj when i = j − 1. We also assume without loss of generality that P1 is a one-terminal segment and t1 ∈ T and if {P1, . . . , Pr} has two one-terminal segments, then the second such segment is Pr and sr ∈ T . Suppose that {P1, . . . , Pr} contains one one-terminal segment P1. Let sr+1 be an arbitrary i=1 V (Pi)) ≤ 2p − 1 ≤ 2k − 1 and T ≥ d + 1 ≥ 5k − 3. Consider the collection of pairs of vertices {t1, s2},{t2, s3}, . . . ,{tr, sr+1}. Notice that vertices from distinct pairs are distinct and tr (cid:54)= sr+1. By Lemma 1, there are vertex-disjoint paths P (cid:48) 1, . . . , P (cid:48) i is a (ti, si+1)-path for i ∈ {1, . . . , r}. By concatenating P1, P (cid:48) r we obtain a path in G with T + p = d + k vertices. Assume now that {P1, . . . , Pr} contains two one-terminal segments P1 and Pr. Consider the collection of pairs of vertices {t1, s2}, . . . ,{tr−1, sr}. Notice that vertices from distinct pairs are distinct and there is i ∈ {2, . . . , r} such that ti−1 (cid:54)= si by the condition (iii) of the definition of an extended system of segments. By Lemma 1, there are vertex-disjoint paths P (cid:48) r−1 i is a (ti, si+1)-path for i ∈ {1, . . . , r − 1}. By concatenating in H that cover T such that P (cid:48) P1, P (cid:48) i=1 V (Pi)). Notice that such a vertex exists, because T ∩ ((cid:83)r r in H that cover T such that P (cid:48) 1, P2, . . . , Pr, P (cid:48) vertex of T \ ((cid:83)r 1, . . . , P (cid:48) 1, . . . , P (cid:48) To show the implication in the opposite direction, let us assume that G has and (x, y)-path r−1, Pr we obtain a path in G with T + p = d + k vertices. P with d + k vertices. We distinguish several cases. Case 1: V (P ) ∩ T = ∅. Consider a shortest path P (cid:48) with one end-vertex s ∈ V (P ) and the second end-vertex t ∈ T . Notice that such a path exists, because G is connected. Denote by Px and Py the (s, x) and (s, y)-subpaths of P respectively. Because d ≥ 5k − 3, V (Px) ≥ k or V (Py) ≥ k. Assume that V (Px) ≥ k. Then the concatenation of P (cid:48) and Px is a path with at 7 least k + 1 vertices and it contains a subpath P (cid:48)(cid:48) with the end-vertex t with p + 1 vertices. We have that {P (cid:48)} is an extended system of T -segments and P (cid:48)(cid:48) has p vertices outside T . Case 2: V (P ) ∩ T (cid:54)= ∅ and E(P ) ∩ E(H) = ∅. Let S = V (P ) ∩ T . Note that k > p, because V (H) > d. Since H is an induced subgraph of G and E(P ) ∩ E(H) = ∅, V (P ) \ S ≥ (d + k)/2 − 1 ≥ 3k − 5/2 > 3p − 5/2 ≥ 2p − 2. Then for every t ∈ S, either the (t, x)-subpath Px of P contains at least p vertices outside T or the (t, y)-subpath Py of P contains at least p vertices outside T . Assume without loss of generality that Px contains at least p vertices outside T . Consider the minimal subpath P (cid:48) of Px ending at t such that V (P (cid:48)) \ T = p. Then the start vertex s of P (cid:48) is not in T . Let {t1, . . . , tr} = V (P (cid:48)) ∩ T and assume that t1, . . . , tr are ordered in the same order as they occur in P (cid:48) starting from s. In particular, tr = t. Let t0 = s. Consider the paths P1, . . . , Pr where Pi is the (ti−1, ti)-subpath of P (cid:48) for i ∈ {1, . . . , r}. Since k ≥ p, r ≤ k. We obtain that {P1, . . . , Pr} is an extended system of T -segments with p vertices outside T . Case 3: E(P )∩ E(H) (cid:54)= ∅. Then there are distinct s, t ∈ T ∩ V (P ) such that the (s, t)-subpath of P lies in H. Since P has at least p vertices outside T , there are s(cid:48), t(cid:48) ∈ V (P ) \ T such that the (s(cid:48), t(cid:48))-subpath P (cid:48) of P is a subpath with exactly p vertices outside T with s, t ∈ V (P (cid:48)). Let P1, . . . , Pr be the family of inclusion maximal subpaths of P (cid:48) containing the vertices of V (P (cid:48)) \ T such that the internal vertices of each Pi are outside T . The set {P1, . . . , Pr} is a required extended system of T -segments. The next lemma will be used for solving Longest Cycle Above Degeneracy. Lemma 3. Let d, k ∈ N. Let G be a 2-connected graph with a d-core H such that d ≥ 5k − 3 and d > V (H) − k. Then G has a cycle with at least d + k vertices if and only if one of the following holds (where p = d + k − V (H)). (i) There are distinct s, t ∈ V (H) and an (s, t)-path P in G with all internal vertices outside V (H) such that P has at least p internal vertices. (ii) G has a system of T -segments {P1, . . . , Pr} with terminal set T = V (H) and the total number of vertices of the paths outside V (H) is at least p and at most 2p − 2. Proof. We put T = V (H). First, we show that if (i) or (ii) holds, then G has a cycle with at least d + k vertices. Suppose that there are distinct s, t ∈ T and an (s, t)-path P in G with all internal vertices outside T such that P has at least p internal vertices. By Lemma 1, H has a Hamiltonian (s, t)-path P (cid:48). By taking the union of P and P (cid:48) we obtain a cycle with at least T + p = d + k vertices. Now assume that G has a system of T -segments {P1, . . . , Pr} and the total number of vertices of the paths outside T is at least p. Let si and ti be the end-vertices of Pi for i ∈ {1, . . . , r} and assume without loss of generality that for 1 ≤ i < j ≤ r, the vertices of Pi and Pj are pairwise distinct with the possible exception ti = sj when i = j − 1. Consider the collection of pairs of vertices {t1, s2}, . . . ,{tr−1, sr},{tr, s1}. Notice that vertices from distinct pairs are distinct and tr (cid:54)= s1. By Lemma 1, there are vertex-disjoint paths P (cid:48) r in H that cover T such that i is a (ti, si+1)-path for i ∈ {1, . . . , r − 1} and P (cid:48) P (cid:48) r is a (tr, s1)-path. By taking the union of P1, . . . , Pr and P (cid:48) r we obtain a cycle in G with at least T + p = d + k vertices. 1, . . . , P (cid:48) 1, . . . , P (cid:48) To show the implication in the other direction, assume that G has a cycle C with at least d + k vertices. Case 1: V (C) ∩ T = ∅. Since G is a 2-connected graph, there are pairwise distinct vertices s, t ∈ T and x, y ∈ V (C) and vertex-disjoint (s, x) and (y, t)-paths P1 and P2 such that the internal vertices of the paths are outside T ∪ V (C). The cycle C contains an (x, y)-path P with at least (d + k)/2 + 1 ≥ p vertices. The concatenation of P1, P and P2 is an (s, t)-path in G with at least p internal verices and the internal vertices are outside T . Hence, (i) holds. 8 Case 2: V (C) ∩ T = 1. Let V (C) ∩ T = {s} for some vertex s. Since G is 2-connected, there is a shortest (x, t)-path P in G − s such that x ∈ V (C) and t ∈ T . The cycle C contains an (s, x)-path P (cid:48) with at least (d + k)/2 + 1 ≥ p vertices. The concatenation of P (cid:48) and P is an (s, t)-path in G with at least p internal vertices and the internal vertices of the path are outside T . Therefore, (i) is fulfilled. Case 3: V (C) ∩ T ≥ 2. Since V (C) ≥ d and T < d, we have that V (C) \ T (cid:54)= ∅. Then we can find pairs of distinct vertices {s1, t1} . . . ,{s(cid:96), t(cid:96)} of T ∩ V (C) and segments P1, . . . , P(cid:96) of C such that (a) Pi is an (si, ti)-path for i ∈ {1, . . . , (cid:96)} with at least one internal vertex and the internal vertices of Pi are outside T , (b) for 1 ≤ i < j ≤ (cid:96), the vertitces of Pi and Pj (cid:83)(cid:96) are distinct with the possible exception ti = sj if i = j − 1 and, possibly, t(cid:96) = s1, and (c) i=1 V (Pi)\ T = V (C)\ T . If there is i ∈ {1, . . . , (cid:96)} such that Pi has at least p internal vertices, We select an inclusion minimal set of indices I ⊆ {1, . . . , (cid:96)} such that (cid:83) then (i) is fulfilled. Now assume that each Pi has at most p − 1 internal vertices; notice that p ≥ 2 in this case. Notice that because each path has at most p− 1 internal vertices, (cid:83) i∈I V (Pi) \ T ≥ p. i∈I V (Pi)\ T ≤ 2p− 2. Let I = {i1, . . . , ir} and i1 < . . . < ir. By the choice of Pi1, . . . , Pir , the union of Pi1, . . . , Pir is either the cycle C or a linear forest. Suppose that the union of the paths is C. Then I = {1, . . . , (cid:96)}, (cid:96) ≤ p and V (P )∩ T = (cid:96). We obtain that C has at most (2p− 2) + p ≤ 3p− 2 ≤ 3k − 2 < d + k vertices (the last inequality follows from the fact that d ≥ 5k − 3); a contradiction. Hence, the union of the paths is a linear forest. Therefore, {Pi1, . . . , Pir} is a system of T -segments with terminal set T = V (H) and the total number of vertices of the paths outside T is at least p and at most 2p − 2, that is, (ii) is fulfilled. We have established the fact that existence of long (path) cycle is equivalent to the existence of (extended) system of T -segments for some terminal set T with at most p ≤ k vertices from outside T . Towards designing algorithms for Longest Path Above Degeneracy and Longest Cycle Above Degeneracy, we define two auxiliary problems which can be solved using well known color-coding technique. Segments with Terminal Set A graph G, T ⊂ V (G) and a positive integers p and r. Decide whether G has a system of segments {P1, . . . , Pr} w.r.t. T such that the total number of internal vertices of the paths is p. Input: Task: Input: Task: Extended Segments with Terminal Set A graph G, T ⊂ V (G) and a positive integers p and r. Decide whether G has an extended system of segments {P1, . . . , Pr} w.r.t. T such that the total number of vertices of the paths outside T is p. Lemma 4. Segments with Terminal Set and Extended Segments with Terminal Set are solvable in time 2O(p) · nO(1). Proof. We start with the algorithm for Segments with Terminal Set. Then we show how to modify it for Extended Segments with Terminal Set. Our algorithm uses the color coding technique introduced by Alon, Yuster and Zwick in [2]. As it is usual for algorithms of this type, we first describe a randomized Monte-Carlo algorithm and then explain how it could be derandomized. Let (G, T, p, r) be an instance of Segments with Terminal Set. 9 Notice that if paths P1, . . . , Pr are a solution for the instance, that is, {P1, . . . , Pr} is a system of T -segments and the total number of internal vertices of the paths is p, then ∪r i=1 V (Pi) ≤ p + 2r. If r > p, then because each path in a solution should have at least one internal vertex, (G, T, p, r) is a no-instance. Therefore, we can assume without loss of generality that r ≤ p. Let q = p + 2r ≤ 3p. We color the vertices of G with q colors uniformly at random. Let P1, . . . , Pr be paths and G and let si, ti be the end-vertices of Pi for i ∈ {1, . . . , r}. We say that the paths P1, . . . , Pr together with the ordered pairs (si, ti) of their end-vertices form a colorful solution if the following is fulfilled: (i) {P1, . . . , Pr} is a system of T -segments, (ii) ∪r (iii) if 1 ≤ i < j ≤ r, u ∈ V (Pi) and v ∈ V (Pj), then the vertices u and v have distinct colors i=1 V (Pi) \ T = p, unless i = j − 1, u = ti and v = sj (in this case the colors can be distinct or same). It is straightforward to see that any colorful solution is a solution of the original problem. From qq > e−q all the other side, if (G, T, p, r) has a solution P1, . . . , Pr, then with probability at least q! distinct vertices of the paths of a solution are colored by distinct colors and for such a coloring, P1, . . . , Pr is a colorful solution. Since q ≤ 3p, we have that the probability is lower bounded by e−3p. This shows that if there is no colorful solution, then the probability that (G, T, p, r) is a yes-instance is at most 1 − e−3p. It immediately implies that if after trying e3p random colorings there is no colorful solution for any of them, then the probability that (G, T, p, r) is a yes-instance is at most (1 − e−3p)e3p < e−1 < 1. solution. Denote by c : V (G) → {1, . . . , q} the considered random coloring. We construct a dynamic programming algorithm that decides whether there is a colorful In the first step of the algorithm, for each non-empty X ⊆ {1, . . . , q} and distinct i, j ∈ X, we compute the Boolean function α(X, i, j) such that α(X, i, j) = true if and only if there are s, t ∈ T and an (s, t)-path P such that P is a two-terminal T -segment, V (P ) = X, c(s) = i, c(t) = j and the vertices of P are colored by pairwise distinct colors from X. We define α(X, i, j) = f alse if X < 3. For other cases, we use dynamic programming. We use a dynamic-programming algorithm to compute α(X, i, j). For each v ∈ V (G)\T and each non-empty Y ⊆ X \ {i}, we compute the Boolean function β(Y, i, v) such that β(Y, i, v) = true if and only if there is s ∈ T and an (s, v)-path P (cid:48) such that V (P (cid:48)) \ {s} ⊆ V (G) \ T , c(s) = i, V (P )\{s} = Y and the vertices of V (P )\{s} are colored by pairwise distinct colors from Y . We compute β(Y, i, v) recursively starting with one-element sets. For every Y = {h}, where h (cid:54)= i, and every v ∈ V (G)\T , we set β(Y, i, v) = true if c(v) = h and v is adjacent to a vertex of T colored i, and we set β(Y, i, v) = f alse otherwise. For Y ⊆ {1, . . . , q}\{i} of size at least two, we set β(Y, v, i) = true if c(v) ∈ Y and there is w ∈ NG(v) \ T with β(i, Y \ {c(v)}, w) = true, and β(Y, i, v) = f alse otherwise. We set α(X, i, j) = true if and only if there are t ∈ T and v ∈ NG(t) \ T such that c(t) = j and β(X \ {i, j}, i, v) = true. The correctness of computing β and α is proved by standard arguments in a straightforward way. Notice that we can compute the tables of values of β and α in time 2q · nO(1). First, we compute the values of β(Y, i, v) for all v ∈ V (G) \ T , i ∈ {1, . . . , q} and non-empty Y ⊆ {1, . . . , q} \ {i}. Then we use the already computed values of β to compute the table of values of α. Next, we use the table of values of α to check whether a colorful solution exists. We introduce the Boolean function γ0(i, X, (cid:96), j) such that for each i ∈ {1, . . . , r}, X ⊆ {1, . . . , q}, integer (cid:96) ≤ p and j ∈ X, γ0(i, X, (cid:96), j) = true if and only if there are paths P1, . . . , Pi and 10 ordered pairs (s1, t1), . . . , (si, ti) of distinct vertices of T such that each Ph is an (sh, th)-path and the following is fulfilled: (i) {P1, . . . , Pi} is a system of T -segments, (ii) ∪i (iii) if 1 ≤ f < g ≤ i, u ∈ V (Pf ) and v ∈ V (Pg), then the vertices u and v have distinct colors h=1 V (Ph) \ T = (cid:96), unless f = g − 1, u = tf and v = sg when the colors could be same, (iv) c(ti) = j. Notice, that if (cid:96) < i, then γ0(i, X, (cid:96), j) = f alse. Our aim is to compute γ0(r, X, p, j) for X ⊆ {1, . . . , q} and j ∈ {1, . . . , q}. Then we observe that a colorful solution exists if and only if there is X ⊆ {1, . . . , q} and j ∈ {1, . . . , q} such that γ0(r, X, p, j) = true. If i = 1 and (cid:96) ≥ 1, then γ0(1, X, (cid:96), j) =(cid:0) (cid:95) α(X, h, j)(cid:1) ∧(cid:0)X = (cid:96) + 2(cid:1). h∈X\{j} For (cid:96) ≥ i > 1, we use the following recurrence: (1) (2) γ0(i, X, (cid:96), j) =(cid:0) ∨(cid:0) (cid:95) (cid:95) (α(Y, h, j) ∧ γ0(i − 1, (X \ Y ) ∪ {h}, (cid:96) − Y + 2, h))(cid:1) (α(Y, h, j) ∧ γ0(i − 1, X \ Y, (cid:96) − Y + 2, h(cid:48)))(cid:1). j∈Y ⊂X,h∈Y \{j} j∈Y ⊂X,h∈Y \{j},h(cid:48)∈X\Y The correctness of (1) and (2) is proved by the standard arguments. Since the size of the table of values of α is 2q · nO(1) and the table can be constructed in time 2q · nO(1), we obtain that the values of γ0(r, X, p, j) for X ⊆ {1, . . . , q} and j ∈ {1, . . . , q} can be computed in time 3q · nO(1). Therefore, the existence of a colorful solution can be checked in time 3q · nO(1). This leads us to a Monte-Carlo algorithm for Segments with Terminal Set. We try at most e3p random colorings. For each coloring, we check the existence of a colorful solution. If such a solution exists, we report that we have a yes-instance of the problem. If after trying e3p random colorings we do not find a colorful solution for any of them, we return the answer no. As we already observed, the probability that this negative answer is false is at most (1− e−3p)e3p < e−1 < 1, that is, the probability is upper bounded by the constant e−1 < 1 that does not depend on the problem size and the parameter. The running time of the algorithm is (3e)3p · nO(1). The algorithm can be derandomized, as it was explained in [2] (we also refer to [10] for the detailed introduction to the technique), by the replacement of random colorings by a family of perfect hash functions. The currently best explicit construction of such families was done by Naor, Schulman and Srinivasan in [30]. The family of perfect hash function in our case has size e3ppO(log p) log n and can be constructed in time e3ppO(log p)n log n [30]. It immediately gives the deterministic algorithm for Segments with Terminal Set running in time (3e)3ppO(log p) · nO(1). Now we explain how the algorithm for Segments with Terminal Set can be modified for Extended Segments with Terminal Set. Let (G, T, p, r) be an instance of Extended Segments with Terminal Set. If paths P1, . . . , Pr are a solution for the instance, that is, {P1, . . . , Pr} is an extended system i=1 V (Pi) ≤ of T -segments and the total number of vertices of the paths outside T is p, then ∪r p + 2r − 1. If r > p, then because each path in a solution should have at least one vertex outside T , (G, T, p, r) is a no-instance. Therefore, we can assume without loss of generality that 11 r ≤ p. The total number of distinct vertices of the paths q ∈ {p + r, . . . , p + 2r − 1} and q ≤ 3p. We guess the value of q and color the vertices of G with q colors uniformly at random. Let P1, . . . , Pr be paths and G and let si, ti be the end-vertices of Pi for i ∈ {1, . . . , r}. We say that the paths P1, . . . , Pr together with the ordered pairs (si, ti) of their end-vertices form a colorful solution if the following is fulfilled: (i) {P1, . . . , Pr} is an extended system of T -segments, (ii) if {P1, . . . , Pr} has one one-terminal segment, then this is P1 and t1 ∈ T , and if {P1, . . . , Pr} has two one-terminal segments, then these are P1, Pr and t1, sr ∈ T , i=1 V (Pi) \ T = p, (iii) ∪r (iv) if 1 ≤ i < j ≤ r, u ∈ V (Pi) and v ∈ V (Pj), then the vertices u and v have distinct colors unless i = j − 1, u = ti and v = sj (in this case the colors could be distinct or same), and if {P1, . . . , Pr} contains two one-terminal segments, then there is i ∈ {2, . . . , r} such that ti−1 and si have distinct colors. In the same way as before, any colorful solution is a solution of the original problem and if after trying e3p random colorings there is no colorful solution for any of them, then the probability that (G, T, p, r) is a yes-instance is at most (1 − e−3p)e3p < e−1 < 1. solution. Denote by c : V (G) → {1, . . . , q} the considered random coloring. We construct a dynamic programming algorithm that decides whether there is a colorful First, we construct the tables of values of the Boolean functions α and β defined above exactly in the same way as in the algorithm for Segments with Terminal Set. Now we consider the following two possibilities. We check the existence of a colorful solution such that {P1, . . . , Pr} has one one-terminal segment P1. We introduce the Boolean function γ1(i, X, (cid:96), j) for each i ∈ {1, . . . , r}, X ⊆ {1, . . . , q}, integer (cid:96) ≤ p and j ∈ X such that γ1(i, X, (cid:96), j) = true if and only if there are paths P1, . . . , Pi and ordered pairs (s1, t1), . . . , (si, ti) of distinct vertices of T such that each Ph is (sh, th)-path for h ∈ {1, . . . , i} and the following is fulfilled: (i) {P1, . . . , Pi} is an extended system of T -segments with one one-terminal segment P1 and t1 ∈ T , h=1 V (Ph) \ T = (cid:96), (ii) ∪i (iii) if 1 ≤ f < g ≤ i, u ∈ V (Pf ) and v ∈ V (Pg), then the vertices u and v have distinct colors unless f = g − 1, u = tf and v = sg when the colors could be same, (iv) c(ti) = j. As with γ0, γ1(i, X, (cid:96), j) = f alse if (cid:96) < i. A colorful solution exists if and only if there is X ⊆ {1, . . . , q} and j ∈ {1, . . . , q} such that γ1(r, X, p, j) = true. If i = 1 and (cid:96) ≥ 1, then γ1(1, X, (cid:96), j) =(cid:0) (cid:95) β(X \ {j}, j, v)(cid:1) ∧(cid:0)X = (cid:96) + 1(cid:1). (3) (4) v∈V (G)\T For (cid:96) ≥ i > 1, we use the same recurrence as (2): γ1(i, X, (cid:96), j) =(cid:0) ∨(cid:0) (cid:95) (cid:95) (α(Y, h, j) ∧ γ1(i − 1, (X \ Y ) ∪ {h}, (cid:96) − Y + 2, h))(cid:1) (α(Y, h, j) ∧ γ1(i − 1, X \ Y, (cid:96) − Y + 2, h(cid:48)))(cid:1). j∈Y ⊂X,h∈Y \{j} j∈Y ⊂X,h∈Y \{j},h(cid:48)∈X\Y 12 j=1V (Pj) and the vertices of ∪r Again, it is standard to prove correctness of (3) and (4) and the existence of a colorful solution can be checked in time 3q · nO(1). Now we check the existence of a colorful solution such that {P1, . . . , Pr} has two one-terminal segments P1 and Pr. It is possible to write down a variant of the dynamic programming algo- rithm tailored for this case, but it is more simple to reduce this case to the already considered. Recall that we are interested in a colorful solution with the property that there is i ∈ {2, . . . , r} such that the vertices of ∪i−1 j=iV (Pj) are colored by distinct colors. We obtain that a colorful solution that we are looking for can be seen as disjoint union of two partial colorful solutions {P1, . . . , Pi−1} and {Pi, . . . , Pr} such that each of them has one one- terminal segment. To find them, we use the function γ1 constructed above. We guess the value of i ∈ {2, . . . , r}. Recall that we are looking for a solution that uses all colors from {1, . . . , q}. We construct the tables of values of γ1(i− 1, X, (cid:96), j) and γ1(r− i + 1, X(cid:48), (cid:96)(cid:48), j(cid:48)). It remains to ob- serve that a colorful solution exists if and only if there X ⊆ {1, . . . , q}, j ∈ X, j(cid:48) ∈ {1, . . . , q}\ X and (cid:96) ∈ {1, . . . , p − 1} such that γ1(i − 1, X, (cid:96), j) ∧ γ1(r − i + 1,{1, . . . , q} \ X, p − (cid:96), j(cid:48)) = true. This implies that the existence of a colorful solution with two one-terminal segments can be checked in time 3q · nO(1). As with Segments with Terminal Set, we obtain the Monte-Carlo algorithm running in time (2e)3p · nO(1) and then we can derandomize it to obtain the deterministic algorithm with running time (3e)3ppO(log p) · nO(1). 4 Putting all together: Final proofs Proof of Theorem 3. Let G be a connected graph of degeneracy at least d and let k be a positive integer. If d ≤ 5k − 4, then we check the existence of a path with d + k ≤ 6k − 4 vertices using Proposition 1 in time 2O(k) · nO(1). Assume from now that d ≥ 5k − 3. Then we find a d-core H of G. This can be done in linear time using the results of Matula and If V (H) ≥ d + k, then by Theorem 5, H, and hence G, contains a path with Beck [28]. min{2d + 1,V (H)} ≥ d + k vertices. Assume that V (H) < d + k. By Lemma 2, G has a path with d + k vertices if and only if G has paths P1, . . . , Pr such that {P1, . . . , Pr} is an extended system of T -segments for T = V (H) and the total number of vertices of the paths outside T is p = d + k − T. Since the number of vertices in every graph is more than its minimum degree, we have that T > d, and thus p < k. For each r ∈ {1, . . . , p}, we verify if such a system exists in time 2O(k) · nO(1) by making use of Lemma 4. Thus the total running time of the algorithm is 2O(k) · nO(1). Proof of Theorem 2 Let G be a 2-connected graph of degeneracy at least d and let k ∈ N. If d ≤ 5k − 4, then we check the existence of a cycle with at least d + k ≤ 6k − 4 vertices using Proposition 1 in time 2O(k) · nO(1). Assume from now on that d ≥ 5k − 3. Then we find a d-core H of G in linear time using the results of Matula and Beck [28]. We claim that if V (H) ≥ d + k, then H contains a cycle with at least d + k vertices. If H is 2-connected, then this follows from Theorem 4. Assume that H is not a 2-connected graph. By the definition of a d-core, H is connected. Observe that V (H) ≥ d + 1 ≥ 5k − 2 ≥ 3. Hence, H has at least two blocks and at least one cut vertex. Consider the block graph Block(H) of H. Recall that the vertices of Block(H) are the blocks and the cut vertices of H and a cut vertex c is adjacent to a block B if and only if c ∈ V (B). Recall also that Block(H) is a tree. We select an arbitrary block R of H and declare it to be the root of Block(H). Let S = V (G) \ V (H). Observe that S (cid:54)= ∅, because G is 2-connected and H is not. Let F1, . . . , F(cid:96) be the components of G[S]. We contract the edges of each component and denote the obtained vertices by u1, . . . , u(cid:96). Denote by G(cid:48) the obtained graph. It is straightforward to verify that G(cid:48) 13 has no cut vertices, that is, G(cid:48) is 2-connected. For each i ∈ {1, . . . , (cid:96)}, consider ui. This vertex has at least 2 neighbors in V (H). We select a vertex vi ∈ NG(cid:48)(ui) that is not a cut vertex of H or, if all the neighbors of ui are cut vertices, we select vi be a cut vertex at maximum distance from R in Block(H). Then we contract uivi. Observe that by the choice of each vi, the graph G(cid:48)(cid:48) obtained from G(cid:48) by contracting u1v1, . . . , u(cid:96)v(cid:96) is 2-connected. We have that G(cid:48)(cid:48) is a 2-connected graph of minimum degree at least d with at least d + k vertices. By Theorem 4, G(cid:48)(cid:48) has a cycle with at least min{2d,V (G(cid:48)(cid:48))} ≥ d + k vertices. Because G(cid:48)(cid:48) is a contraction of G, we conclude that G contains a cycle with at least d + k vertices as well. From now we can assume that V (H) < d + k. By Lemma 3, G has a cycle with d + k vertices if and only if one of the following holds for p = d + k − T where T = V (H). (i) There are distinct s, t ∈ T and an (s, t)-path P in G with all internal vertices outside T such that P has at least p internal vertices. (ii) G has a system of T -segments {P1, . . . , Pr} and the total number of vertices of the paths outside T is at least p and at most 2p − 2. Notice that p ≤ k (because d − T ≤ 0). We verify whether (i) holds using Proposition 2. To do it, we consider all possible choices of distinct s, t. Then we construct the auxiliary graph Gst from G by the deletion of the vertices of T \ {s, t} and the edges of E(H). Then we check whether Gst has an (s, t)-path of length at least p+1 in time 2O(k)·nO(1) applying Proposition 2. Assume that (i) is not fulfilled. Then it remains to check (ii). For every r ∈ {1, . . . , p}, we verify the existence of a system of T -segments {P1, . . . , Pr} in time 2O(k) · nO(1) using Lemma 4. We return the answer yes if we get the answer yes for at least one instance of Segments with Terminal Set and we return no otherwise. 5 Hardness for Longest Path and Cycle above Degeneracy In this section we complement Theorems 3 and 2 by some hardness observations. Proposition 3. 1 Longest Path Above Degeneracy is NP-complete even if k = 2 and Longest Cycle Above Degeneracy is NP-complete even for connected graphs and k = 2. Proof. To show that Longest Path Above Degeneracy is NP-complete for k = 2, consider the graph G(cid:48) that is a disjoint union of a non-complete graph G with n vertices and a copy the complete (n − 1)-vertex graph Kn−1. Because G is not a complete graph, dg(G(cid:48)) ≤ n − 2. Therefore, dg(G(cid:48)) = n − 2, because dg(Kn−1) = n − 2. Observe that G(cid:48) has a path with dg(G(cid:48)) + 2 = n vertices if and only if G is Hamiltonian. Since Hamiltonian Path is a well- known NP-complete problem (see [16]), the claim follows. Similarly, for Longest Cycle Above Degeneracy, consider G(cid:48) that is a union of a connected non-complete graph G with n vertices and Kn−1 with one common vertex. We have that G(cid:48) has a cycle with dg(G(cid:48)) + 2 = n vertices if and only if G has a Hamiltonian cycle. Using the fact that Hamiltonian Cycle is NP-complete [16], we obtain that Longest Cycle Above Degeneracy is NP-complete for connected graphs and k = 2. Recall that a graph G has a path with at least dg(G) + 1 vertices and if dg(G) ≥ 2, then G has a cycle with at least dg(G) + 1 vertices. Moreover, such a path or cycle can be constructed in polynomial (linear) time. Hence, Proposition 3 gives tight complexity bounds. Neverthe- less, the construction used to show hardness for Longest Path Above Degeneracy uses a disconnected graph, and the graph constructed to show hardness for Longest Cycle Above 1Proposition 3 and its proof was pointed to us by Nikolay Karpov. 14 Degeneracy has a cut vertex. Hence, it is natural to consider Longest Path Above De- generacy for connected graphs and Longest Cycle Above Degeneracy for 2-connected graphs. We show in Theorems 3 and 2 that these problems are FPT when parameterized by k in these cases. Here, we observe that the lower bound dg(G) that is used for the parameterization is tight in the following sense. Proposition 4. For any 0 < ε < 1, it is NP-complete to decide whether a connected graph G contains a path with at least (1 + ε)dg(G) vertices and it is NP-complete to decide whether a 2-connected graph G contains a cycle with at least (1 + ε)dg(G) vertices. Proof. Let 0 < ε < 1. First, we consider the problem about a path with (1 + ε)dg(G) vertices. We reduce Hamil- tonian Path that is well-known to be NP-complete (see [16]). Let G be a graph with n ≥ 2 vertices. We construct the graph G(cid:48) as follows. • Construct a copy of G. • Let p = 2(cid:100) n • For each v ∈ V (G), construct an edge vu1. • Let q = (cid:100)(1 + ε)(p − 1) − (n + p)(cid:101). Construct vertices w1, . . . , wq and edges u1w1, wqu2 ε(cid:101) and construct p pairwise adjacent vertices u1, . . . , up. and wi−1wi for i ∈ {2, . . . , q}. ε(cid:101) − n − 1 − ε(cid:101) ≥ (cid:100)n − 1 − ε(cid:101) ≥ 1 as Notice that q = (cid:100)(1 + ε)(p − 1) − (n + p)(cid:101) = (cid:100)2ε(cid:100) n n ≥ 2. Observe also that G is connected. We claim that G has a Hamiltonian path if and only if G(cid:48) has a path with at least (1 + ε)dg(G(cid:48)) vertices. Notice that dg(G(cid:48)) = p − 1 and V (G(cid:48)) = n + p + q = (cid:100)(1 + ε)dg(G(cid:48))(cid:101). Therefore, we have to show that G has a Hamiltonian path if and only if G(cid:48) has a Hamiltonian path. Suppose that G has a Hamiltonian path P with an end-vertex v. Consider the path Q = vu1w1 . . . wqu2u3 . . . up. Clearly, the concatenation of P and Q is a Hamiltonian path in G(cid:48). Suppose that G(cid:48) has a Hamiltonian path P . Since u1 is a cut vertex of G(cid:48), we obtain that P has a subpath that is a Hamiltonian path in G. Consider now the problem about a cycle with at least (1 + ε)dg(G) vertices. We again reduce Hamiltonian Path and the reduction is almost the same. Let G be a graph with n ≥ 2 vertices. We construct the graph G(cid:48) as follows. • Construct a copy of G. • Let p = 2(cid:100) n • For each v ∈ V (G), construct edges vu1 and vu2. • Let q = (cid:100)(1 + ε)(p − 1) − (n + p)(cid:101). Construct vertices w1, . . . , wq and edges u2w1, wqu3 ε(cid:101) and construct p pairwise adjacent vertices u1, . . . , up. and wi−1wi for i ∈ {2, . . . , q}. As before, we have that q ≥ 1. Notice additionally that p ≥ 3, i.e., the vertex u3 exists. It is straightforward to see that G(cid:48) is 2-connected. We claim that G has a Hamiltonian path if and only if G(cid:48) has a cycle with at least (1 + ε)dg(G(cid:48)) vertices. We have that dg(G(cid:48)) = p − 1 and V (G(cid:48)) = (cid:100)(1 + ε)dg(G(cid:48))(cid:101). Hence, we have to show that G has a Hamiltonian path if and only if G(cid:48) has a Hamiltonian cycle. Suppose that G has a Hamiltonian path P with end-vertices x and y. Consider the path Q = xu2w1 . . . wqu3u4 . . . upy. Clearly, P and Q together form a Hamiltonian cycle in G(cid:48). Suppose that G(cid:48) has a Hamiltonian cycle C. Since {u1, u2} is a cut set of G(cid:48), we obtain that C contains a path that is a Hamiltonian path of G. 15 6 Conclusion We considered the lower bound dg(G) + 1 for the number of vertices in a longest path or cycle in a graph G. It would be interesting to consider the lower bounds given in Theorems 4 and 5. More precisely, what can be said about the parameterized complexity of the variants of Long Path (Cycle) where given a (2-connected) graph G and k ∈ N, the task is to check whether G has a path (cycle) with at least 2δ(G)+k vertices? Are these problems FPT when parameterized by k? It can be observed that the bound 2δ(G) is "tight". That is, for any 0 < ε < 1, it is NP-complete to decide whether a connected (2-connected) G has a path (cycle) with at least (2 + ε)δ(G) vertices. See also [31] for related hardness results. Acknowledgement We thank Nikolay Karpov for communicating to us the question of find- ing a path above the degeneracy bound and Proposition 3. References [1] N. Alon, G. Gutin, E. J. Kim, S. Szeider, and A. Yeo, Solving MAX-r-SAT above a tight lower bound, in Proceedings of the 21st Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), SIAM, 2010, pp. 511 -- 517. 3 [2] N. Alon, R. Yuster, and U. Zwick, Color-coding, J. ACM, 42 (1995), pp. 844 -- 856. 9, 11 [3] I. Bez´akov´a, R. Curticapean, H. Dell, and F. V. Fomin, Finding detours is fixed- parameter tractable, CoRR, abs/1607.07737 (2016). 5 [4] , Finding detours is fixed-parameter tractable, in 44th International Colloquium on Automata, Languages, and Programming, ICALP 2017, vol. 80 of LIPIcs, Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2017, pp. 54:1 -- 54:14. 3 [5] A. Bjorklund, T. Husfeldt, P. Kaski, and M. Koivisto, Narrow sieves for param- eterized paths and packings, CoRR, abs/1007.1161 (2010). 3 [6] H. L. Bodlaender, On linear time minor tests with depth-first search, J. Algorithms, 14 (1993), pp. 1 -- 23. 3 [7] J. Chen, J. Kneis, S. Lu, D. Molle, S. Richter, P. Rossmanith, S.-H. Sze, and F. Zhang, Randomized divide-and-conquer: improved path, matching, and packing algo- rithms, SIAM J. Comput., 38 (2009), pp. 2526 -- 2547. 3 [8] J. Chen, S. Lu, S.-H. Sze, and F. Zhang, Improved algorithms for path, matching, and packing problems, in Proceedings of the18th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), SIAM, 2007, pp. 298 -- 307. 3 [9] R. Crowston, M. Jones, G. Muciaccia, G. Philip, A. Rai, and S. Saurabh, Polynomial kernels for lambda-extendible properties parameterized above the Poljak-Turzik bound, in IARCS Annual Conference on Foundations of Software Technology and Theoreti- cal Computer Science (FSTTCS), vol. 24 of Leibniz International Proceedings in Informat- ics (LIPIcs), Dagstuhl, Germany, 2013, Schloss Dagstuhl -- Leibniz-Zentrum fuer Informatik, pp. 43 -- 54. 3 [10] M. Cygan, F. V. Fomin, (cid:32)L. Kowalik, D. Lokshtanov, D. Marx, M. Pilipczuk, M. Pilipczuk, and S. Saurabh, Parameterized Algorithms, Springer, 2015. 3, 11 16 [11] G. A. Dirac, Some theorems on abstract graphs, Proc. London Math. Soc. (3), 2 (1952), pp. 69 -- 81. 3 [12] P. Erdos and T. Gallai, On maximal paths and circuits of graphs, Acta Math. Acad. Sci. Hungar, 10 (1959), pp. 337 -- 356 (unbound insert). 1, 3 [13] F. V. Fomin, D. Lokshtanov, F. Panolan, and S. Saurabh, Efficient computation of representative families with applications in parameterized and exact algorithms, J. ACM, 63 (2016), pp. 29:1 -- 29:60. 3 [14] F. V. Fomin, D. Lokshtanov, F. Panolan, S. Saurabh, and M. Zehavi, Long directed ( s, t)-path: FPT algorithm, Inf. Process. Lett., 140 (2018), pp. 8 -- 12. 3 [15] H. N. Gabow and S. Nie, Finding a long directed cycle, ACM Transactions on Algo- rithms, 4 (2008). 3 [16] M. R. Garey and D. S. Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness, W. H. Freeman, 1979. 14, 15 [17] S. Garg and G. Philip, Raising the bar for vertex cover: Fixed-parameter tractabil- ity above a higher guarantee, in Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), SIAM, 2016, pp. 1152 -- 1166. 3 [18] G. Gutin, E. J. Kim, M. Lampis, and V. Mitsou, Vertex cover problem parameterized above and below tight bounds, Theory of Computing Systems, 48 (2011), pp. 402 -- 410. 3 [19] G. Gutin, L. van Iersel, M. Mnich, and A. Yeo, Every ternary permutation constraint satisfaction problem parameterized above average has a kernel with a quadratic number of variables, J. Computer and System Sciences, 78 (2012), pp. 151 -- 163. 3 [20] G. Z. Gutin and V. Patel, Parameterized traveling salesman problem: Beating the average, SIAM J. Discrete Math., 30 (2016), pp. 220 -- 238. 3 [21] F. Harary, A characterization of block-graphs, Canad. Math. Bull., 6 (1963), pp. 1 -- 6. 5 [22] F. Huffner, S. Wernicke, and T. Zichner, Algorithm engineering for color-coding with applications to signaling pathway detection, Algorithmica, 52 (2008), pp. 114 -- 132. 3 [23] J. Kneis, D. Molle, S. Richter, and P. Rossmanith, Divide-and-color, in Proceedings of the 34th International Workshop Graph-Theoretic Concepts in Computer Science (WG), vol. 4271 of Lecture Notes in Computer Science, Springer, 2008, pp. 58 -- 67. 3 [24] I. Koutis, Faster algebraic algorithms for path and packing problems, in Proceedings of the 35th International Colloquium on Automata, Languages and Programming (ICALP), vol. 5125 of Lecture Notes in Comput. Sci., Springer, 2008, pp. 575 -- 586. 3 [25] D. Lokshtanov, N. S. Narayanaswamy, V. Raman, M. S. Ramanujan, and S. Saurabh, Faster parameterized algorithms using linear programming, ACM Trans. Al- gorithms, 11 (2014), pp. 15:1 -- 15:31. 3 [26] M. Mahajan and V. Raman, Parameterizing above guaranteed values: Maxsat and max- cut, J. Algorithms, 31 (1999), pp. 335 -- 354. 3 [27] M. Mahajan, V. Raman, and S. Sikdar, Parameterizing above or below guaranteed values, J. Computer and System Sciences, 75 (2009), pp. 137 -- 153. 3 17 [28] D. W. Matula and L. L. Beck, Smallest-last ordering and clustering and graph coloring algorithms, J. ACM, 30 (1983), pp. 417 -- 427. 1, 4, 5, 13 [29] B. Monien, How to find long paths efficiently, in Analysis and design of algorithms for com- binatorial problems (Udine, 1982), vol. 109 of North-Holland Math. Stud., North-Holland, Amsterdam, 1985, pp. 239 -- 254. 3 [30] M. Naor, L. J. Schulman, and A. Srinivasan, Splitters and near-optimal derandom- ization, in Proceedings of the 36th Annual Symposium on Foundations of Computer Science (FOCS 1995), IEEE, 1995, pp. 182 -- 191. 11 [31] I. Schiermeyer, Problems remaining np-complette for sparse or dense graphs, Discus- siones Mathematicae Graph Theory, 15 (1995), pp. 33 -- 41. 16 [32] D. Tsur, Faster deterministic parameterized algorithm for k-path, CoRR, abs/1808.04185 (2018). 3 [33] R. Williams, Finding paths of length k in O∗(2k) time, Inf. Process. Lett., 109 (2009), pp. 315 -- 318. 3 [34] M. Zehavi, A randomized algorithm for long directed cycle, Inf. Process. Lett., 116 (2016), pp. 419 -- 422. 3 18
1802.10488
1
1802
2018-02-28T15:49:11
An Approximate Pareto Set for Minimizing the Maximum Lateness and Makespan on Parallel Machines
[ "cs.DS" ]
We consider the two-parallel machines scheduling problem, with the aim of minimizing the maximum lateness and the makespan. Formally, the problem is defined as follows. We have to schedule a set J of n jobs on two identical machines. Each job i in J has a processing time p_i and a delivery time q_i. Each machine can only perform one job at a given time. The machines are available at time t=0 and each of them can process at most one job at a given time. The problem is to find a sequence of jobs, with the objective of minimizing the maximum lateness L_max and the makespan C_max. With no loss of generality, we consider that all data are integers and that jobs are indexed in non-increasing order of their delivery times: q_1 >= q_2 >= ... >= q_n. This paper proposes an exact algorithm (based on a dynamic programming) to generate the complete Pareto Frontier in a pseudo-polynomial time. Then, we present an FPTAS (Fully Polynomial Time Approximation Scheme) to generate an approximate Pareto Frontier, based on the conversion of the dynamic programming. The proposed FPTAS is strongly polynomial. Some numerical experiments are provided in order to compare the two proposed approaches.
cs.DS
cs
An Approximate Pareto Set for Minimizing the Maximum Lateness and Makespan on Parallel Machines Gais Alhadi1, Imed Kacem2, Pierre Laroche3, and Izzeldin M. Osman4 1 8 1 0 2 b e F 8 2 ] S D . s c [ 1 v 8 8 4 0 1 . 2 0 8 1 : v i X r a Abstract-We consider the two-parallel machines scheduling problem, with the aim of minimizing the maximum lateness and the makespan. Formally, the problem is defined as follows. We have to schedule a set J of n jobs on two identical machines. Each job i ∈ J has a processing time pi and a delivery time qi. Each machine can only perform one job at a given time. The machines are available at time t = 0 and each of them can process at most one job at a given time. The problem is to find a sequence of jobs, with the objective of minimizing the maximum lateness Lmax and the makespan Cmax. With no loss of generality, we consider that all data are integers and that jobs are indexed in non-increasing order of their delivery times: q1 ≥ q2 ≥ . . . ≥ qn. This paper proposes an exact algorithm (based on a dynamic programming) to generate the complete Pareto Frontier in a pseudo-polynomial time. Then, we present an FPTAS (Fully Polynomial Time Approximation Scheme) to generate an approximate Pareto Frontier, based on the conversion of the dynamic programming. The proposed FPTAS is strongly polynomial. Some numerical experiments are provided in order to compare the two proposed approaches. I. INTRODUCTION We consider the two-parallel machines scheduling prob- lem, with the aim of minimizing the maximum lateness and makespan. Formally, the problem is defined as follows. We have to schedule a set J of n jobs on two identical machines. Each job i ∈ J has a processing time pi and a delivery time qi. The machines are available at time t=0 and each of them can process at most one job at a time. The problem is to find a sequence of jobs, with the objective of minimizing the maximum lateness Lmax and the makespan Cmax. With no loss of generality, we consider that all data are integers and that jobs are indexed in non-increasing order of their delivery times q1 ≥ q2 ≥ . . . ≥ qn. For self-consistency, we recall some necessary definitions related to the approximation area. An algorithm A is called a ρ−approximation algorithm for a given problem, if for any instance I of that problem the algorithm A yields, within a polynomial time, a feasible solution with an objective value A(I) − OP T (I) ≤ .OP T (I), where A(I) such that: is 1Gais Alhadi a member Sciences, University Computer [email protected] Pierre Kacem2 Imed and of Faculty of Gezira, Wad-Madani, of Mathematical and Sudan LCOMS the Metz, [email protected] Laboratory, France of F-57045 [email protected], Laroche3 of are Lorraine, University members Izzeldin M. Osman4 is from Sudan University of Science and Technology, Khartoum, Sudan [email protected] it OP T (I) is the optimal value of I and ρ is the performance guarantee or the worst-case ratio of the approximation al- gorithm A. It can be a real number greater or equal to 1 for the minimization problems ρ = 1 +  (that leads to inequality A(I) ≤ (1 + )OP T (I)), or it can be real number from the interval [0, 1] for the maximization problems ρ = 1−  (that it leads to inequality A(I) ≥ (1− )OP T (I)). The Pareto-optimal solutions are the solutions that are not dominated by other solutions. Thus, we can consider that the solution is Pareto-optimal if there does not exist another solution that is simultaneously the best for all the objectives. Noteworthy, Pareto-optimal solutions represent a range of reasonable optimal solutions for all possible functions based on the different objectives. A schedule is called Pareto-optimal if it is not possible to decrease the value of one objective without increasing the value of the other. It is noteworthy that during the last decade the multi-objective scheduling problems have attracted numerous researchers from all the world and have been widely studied in the litera- ture. For the scheduling problems on serial-batch machine, Geng et al.[17] studied scheduling problems with or without precedence relations, where the objective is to minimize makespan and maximum cost. They have provided highly efficient polynomial-time algorithms to generate all Pareto optimal points. An approximate Pareto set of minimal size that approximates within an accuracy  for multi-objective optimization problems have been studied by Bazgan et al.[2]. They proposed a 3-approximation algorithm for two objec- tives and also proposed a study of the greedy algorithm performance for a three-objective case when the points are given explicitly in the input. They showed that the three- objective case is NP-hard. Chen and Zou [5] proposed a runtime analysis of a (µ + 1) multi-objective evolutionary algorithm for three multi-objective optimization problems with unknown attributes. They showed that when the size of the population is less than the total number of Pareto-vector, the (µ + 1) multi-objective evolutionary algorithm cannot obtain the expected polynomial runtime for the exact discrete multi- objective optimization problems. Thus, we must determine the size of the population equal to the total number of leading ones, trailing zeros. Furthermore, the expected polynomial runtime for the exponential discrete multi-objective optimiza- tion problem can be obtained by the ratio of n/2 to µ − 1 over an appropriate period of time. They also showed that the (µ + 1) multi-objective evolutionary algorithm can be solved efficiently in polynomial runtime by obtaining an − adaptive to produce all Pareto front. Florios and Mavrotas [6] used AUGMECON2, a multi-objective mathematical programming method (which is suitable for general multi-objective integer programming problems), the Pareto-optimal solutions for multi-objective traveling salesman and set covering problems. They showed that the performance of the algorithm is slightly better than it already exists. Moreover, they showed that their results can be helpful for other multi-objective mathematical programming methods or even multi-objective meta-heuristics. In [10], Sabouni and Jolai proposed an optimal method for the problem of scheduling jobs on a single batch processing machine to minimize the makespan and the maximum lateness. They showed that the proposed method is optimal when the set with maximum lateness objective has the same process- ing times. They also proposed an optimal method for the group that has the maximum lateness objective and the same processing times. Geng et al.[3] considered the scheduling problem on an unbounded p-batch machine with family jobs to find all Pareto-optimal points for minimizing makespan and maximum lateness. They presented a dynamic programming algorithm to solve the studied problem. He et al.[4] showed that the Pareto optimization scheduling problem on a single bounded serial-batching machine to minimize makespan and maximum lateness is solvable in O(n6). They also presented an O(n3)- time algorithm to find all Pareto optimal solutions where the processing times and deadlines are agreeable. For the bi-criteria scheduling problem, He et al.[8] showed that the problem of minimizing maximum cost and makespan is solv- able in O(n5) time. The authors presented a polynomial-time algorithm in order to find all Pareto optimal solutions. Also, He et al.[9] showed that the bi-criteria batching problem of minimizing maximum cost and makespan is solvable in O(n3) time. The bi-criteria scheduling problem on a parallel-batching machine to minimize maximum lateness and makespan have been considered in [11]. The authors presented a polynomial- time algorithm in order to find all Pareto optimal solutions. Allahverdi and Aldowaisan [13] studied the no-wait flow-shop scheduling problem with bi-criteria of makespan or maximum lateness. They also proposed a dominance relation and a branch-and-bound algorithm and showed that these algorithms are quite efficient. The remainder of this paper is organized as follows. In Section 2, we describe the proposed dynamic programming (DP) algorithm. Section 3, provides the description and the analysis of the FPTAS. In Section 4, we present a practical example for DP and FPTAS. Finally, Section 5 concludes the paper. II. DYNAMIC PROGRAMMING ALGORITHM The following dynamic programming algorithm A, can be applied to solve exactly this problem. This algorithm A generates iteratively some sets of states. At every iteration i, a set χi composed of states is generated (0 ≤ i ≤ n). Each state [k, Lmax, Cmax] in χi can be associated to a feasible partial schedule for the first i jobs. Let variable k ∈ {0, 1} denote the most loaded machine, Lmax denote the maximum lateness and Cmax denote the maximum completion time – add j=1 pj − Cmax) if (Cmax ≥(cid:80)i [k,max{Lmax,(cid:80)i – add [1 − k,max{Lmax,(cid:80)i qi},(cid:80)i qi},Cmax] to χi else j=1 pj − Cmax] to χi j=1 pj − Cmax + j=1 pj − Cmax + 2 of the corresponding schedule. The dynamic programming algorithm can be described as follows. ALGORITHM A 1) Set χ1 = {[1, p1 + q1, p1]}. 2) For i ∈ {2, 3, ..., n}, a) χi = φ. b) For every state [k, Lmax, Cmax] in χi−1 : • (schedule job i on machine k) add [k,max{Lmax,Cmax + pi + qi},Cmax + pi] to χi • (schedule job i on machine 1 − k) c) For every k, for every Cmax: keep only one state with the smallest possible Lmax. d) Remove χi−1. dominated states. 3) Return the Pareto front of χn, by only keeping non- Remark: To destroy the symmetry, we start by χ1 = {[1, p1 + q1, p1]} (i.e., we perform job 1 on the first machine). III. APPROXIMATE PARETO FRONTIER The main idea of the Approximate Pareto Frontier is to remove a special part of the states generated by the dynamic programming algorithm A. Therefore, the modified algorithm A(cid:48) described in Lemma III.1 produces an approximation solution instead of the optimal solution. Given an arbitrary  > 0, we define the following parameters: and δ1 = P/2 n , δ2 = (P + qmax)/3 n . where qmax is the maximum delivery time and P is the total sum of processing times. Let L∗ max be the optimal solutions for our two objectives. Let LM AX and CM AX be the upper bounds for the two considered criteria (scheduling all the jobs on the same machine), such that, max and C∗ 0 ≤ LM AX = P + qmax ≤ 3L∗ max 0 ≤ CM AX = P ≤ 2C∗ max We divide the intervals [0, CM AX] and [0, LM AX] into equal sub-intervals respectively of lengths δ1 and δ2. Then, an FPTAS is defined by following the same procedure as in the dynamic programming, except the fact that it will keep only one representative state for every couple of the defined subintervals produced from [0, CM AX] and [0, LM AX]. Thus, our FPTAS will generate approximate sets χ# i of states • 2nd (cid:48) [k ,max{L max,(cid:80)i Case: (cid:48) [k, Lmax, Cmax] max + qi},C (cid:48) (cid:48) max] j=1 pj − C ∈ (cid:48) [k (cid:48) (cid:48) ,L Since max,C there max] max] ∈ χ# (cid:48)#, L (cid:48)# (cid:48)# i−1, such that: [k max, C ≤ max + (i − 1)max{δ1, δ2} (cid:48)# (cid:48) L L max − (i − 1)δ1 ≤ C max ≤ C max (cid:48) (cid:48)# C max + (i − 1)δ1. χi−1, (cid:48) 3 = exists and • Sub-case 2.1:(cid:80)i Consequently, two sub-cases can occur: max ≤ C (cid:48)# (cid:48)# max j=1 pj − C (cid:48)# max,(cid:80)i (cid:48)#, max{L j=1 pj−C (cid:48)# Here, the state [k max] at iteration i. However, it may be re- is created by algorithm A moved when reducing the state subset. Let [α, λ, µ] be the state j=1 pj − in χ# i max + qi}, C (cid:48)# C (cid:48)# max]. Hence, we have: that is in the same box as [k max,(cid:80)i (cid:48)#, max{L max +qi},C (cid:48)# (cid:48)# (cid:48) λ ≤ max{L (cid:48)# max, i(cid:88) j=1 pj − C max + qi} + δ2 (cid:48)# i(cid:88) ≤ max{L (cid:48) −(C (cid:48) max + (i − 1) max{δ1, δ2}, max − (i − 1)δ1) + qi} + δ2 max + qi} i(cid:88) pj − C (cid:48) ≤ max{L (cid:48) max, pj j=1 j=1 +(i − 1) max{δ1, δ2} + δ2 ≤ Lmax + (i − 1) max{δ1, δ2} + δ2 < Lmax + i. max{δ1, δ2} Moreover, max + δ1 ≤ C (cid:48)# (cid:48) max + (i − 1)δ1 + δ1 = Cmax + iδ1. µ ≤ C And, (4) (5) (6) instead of χi. The following lemma shows the closeness of the result generated by the FPTAS compared to the dynamic programming. Lemma III.1. For every state [k, Lmax, Cmax] ∈ χi there max] ∈ χ# exists at least one approximate state [m, L# such that: max, C # i max ≤ Lmax + i. max{δ1, δ2}, L# and Cmax − i.δ1 ≤ C # max ≤ Cmax + i.δ1. Proof. By induction on i. First, for i = 0 we have χ# i = χ1. Therefore, the statement is trivial. Now, assume that the lemma holds true up to level i−1. Consider an arbitrary state [k, Lmax, Cmax] ∈ χi. Algorithm A introduces this state into χi when job i is added to some feasible state for the first i − 1 jobs. Let [k (cid:48) (cid:48) max] be , L max, C the above feasible state. Three cases can be distinguished: max + pi + qi}, j=1 pj − C , max{L , max{L max,(cid:80)i 1) [k, Lmax, Cmax] = [k (cid:48) max,C (cid:48) (cid:48) (cid:48) (cid:48) (cid:48) (cid:48) max + pi] C qi}, C (cid:48) max] 2) [k, Lmax, Cmax] = [k 3) [k, Lmax, Cmax] = [1 − k (cid:48) max] max + qi},(cid:80)i j=1 pj − C C (cid:48) (cid:48) max,(cid:80)i (cid:48) max + j=1 pj − (cid:48) , max{L (cid:48) , max{L We will prove the statement for level i in the three cases. (cid:48) max,C (cid:48) max + (cid:48) [k ∈ exists χi−1, • 1st Case: [k, Lmax, Cmax] = [k pi + qi}, C (cid:48) max + pi] (cid:48) (cid:48) there max,C ,L Since max] max] ∈ χ# (cid:48)# (cid:48)#, L (cid:48)# i−1, such that: max, C [k max + (i − 1) max{δ1, δ2} ≤ (cid:48) (cid:48)# L L max + (i − 1)δ1. max ≤ C max − (i − 1)δ1 ≤ C max (cid:48)# (cid:48) C (cid:48)#, max{L (cid:48)# (cid:48)# Consequently, max + pi + max, C qi}, C (cid:48) is created by algorithm A at iteration i. However, it may be removed when reducing the state subset. Let [α, λ, µ] be the state in χ# that is in the same box as the i (cid:48)# max + pi]. Hence, sate [k we have: max + pi + qi}, C (cid:48)# (cid:48)# max + pi] (cid:48)#, max{L the state [k (cid:48)# max, C and (cid:48) λ ≤ max{L ≤ max{L (cid:48)# max, C (cid:48) max, C max + pi + qi} + δ2 (cid:48)# max + pi + qi} (cid:48) +(i − 1). max{δ1, δ2} + δ2 ≤ Lmax + i. max{δ1, δ2} In addition, µ ≤ C ≤ C (cid:48)# max + pi + δ1 max + (i − 1)δ1 + pi + δ1 = Cmax + iδ1. (cid:48) and, µ ≥ C max + pi − δ1 ≥ C (cid:48)# ≥ Cmax − iδ1. (cid:48) max − (i − 1)δ1 + pi − δ1 (2) (3) Consequently, [α, λ, µ] is an approximate state verifying the two conditions. (1) µ ≥ C max − δ1 ≥ C (cid:48)# (cid:48) max − (i − 1)δ1 − δ1 = Cmax − iδ1. Consequently, [α, λ, µ] is an approximate state verifying the two conditions. • Sub-case 2.2:(cid:80)i qi},(cid:80)i Here, j=1 pj − C (cid:48)# max > C (cid:48)#, max{L j=1 pj − C the state [1 − k j=1 pj − C (cid:48)# max] is created by algorithm A (cid:48)# max + at iteration i. However, it may be removed when reducing the state subset. Let [α, λ, µ] be the state in χ# that is in the same box as [1−k (cid:48)#, max{L j=1 pj−C i (cid:48)# (cid:48)# max]. Hence, we have: max,(cid:80)i j=1 pj−C (cid:48)# (cid:48) (cid:48)# (cid:48)# max max,(cid:80)i max+qi},(cid:80)i λ ≤ max{L (cid:48)# max, i(cid:88) j=1 pj − C max + qi} + δ2 (cid:48)# i(cid:88) ≤ max{L (cid:48) −(C (cid:48) max + (i − 1) max{δ1, δ2}, max + (i − 1)δ1) + qi} + δ2 max + qi} i(cid:88) pj − C (cid:48) ≤ max{L (cid:48) max, j=1 j=1 +(i − 1) max{δ1, δ2} + δ2 ≤ Lmax + (i − 1) max{δ1, δ2} + δ2 < Lmax + i. max{δ1, δ2} Moreover, i(cid:88) j=1 µ ≤ pj − C (cid:48)# max + δ1 pj (7) (8) (cid:48) max − (i − 1)δ1, then the following relation max ≥ C (cid:48)# i(cid:88) Since C holds µ ≤ (since(cid:80)i And, j=1 pj − C i(cid:88) µ ≥ (cid:48) max ≤ C (cid:48) max). pj − C max − δ1 ≥ C (cid:48)# max − δ1 (cid:48)# j=1 ≥ Cmax − (i − 1)δ1 − δ1 = Cmax − iδ1. (10) max,(cid:80)i (cid:48) Thus, [α, λ, µ] verifies the necessary conditions. max + qi},(cid:80)i (cid:48) (cid:48) , [1 − k (cid:48) max] exists and (cid:48) [k • 3rd Case: [k, Lmax, Cmax] = max{L j=1 pj − C j=1 pj − C (cid:48) (cid:48) Since ,L max,C there max] max] ∈ χ# (cid:48)#, L (cid:48)# (cid:48)# i−1, such that: [k max, C ≤ max + (i − 1) max{δ1, δ2} (cid:48)# (cid:48) L L max − (i − 1)δ1 ≤ C max ≤ C max (cid:48)# (cid:48) C Consequently, two sub-cases can occur: max + (i − 1)δ1. χi−1, ∈ (cid:48) • Sub-case 3.1:(cid:80)i qi},(cid:80)i j=1 pj − C max ≥ C (cid:48)# (cid:48)#,max{L max,(cid:80)i (cid:48)# max j=1 pj − C Here, the state [1 − k j=1 pj − C (cid:48)# max + at iteration i. However, it may be removed when reducing the state subset. Let [α, λ, µ] be the state in χ# that is in the same box as i (cid:48)# max] is created by algorithm A (cid:48)# (cid:48) pj − C (cid:48) max + (i − 1)δ1 + δ1 ≤ Cmax + iδ1 µ ≥ pj − C max − δ1 (cid:48)# j=1 (9) (11) (12) (13) max,(cid:80)i (cid:48)# [1−k (cid:48)#,max{L Hence, we have: j=1 pj−C i(cid:88) λ ≤ max{L (cid:48)# max, pj − C 4 max +qi},(cid:80)i (cid:48)# j=1 pj−C (cid:48)# max]. max + qi} + δ2 (cid:48)# i(cid:88) j=1 i(cid:88) j=1 ≤ max{L (cid:48) max + (i − 1)max{δ1, δ2}, max − (i − 1)δ1) + qi} + δ2 (cid:48) −(C pj j=1 ≤ max{L (cid:48) max, pj −C (cid:48) max + qi} + (i − 1) max{δ1, δ2} + δ2 ≤ Lmax + (i − 1) max{δ1, δ2} + δ2 ≤ Lmax + i max{δ1, δ2} and µ ≤ pj − C (cid:48)# max + δ1 (cid:48) max − (i − 1)δ1) + δ1 pj − (C ≤ Cmax + iδ1. j=1 In the other hand, we have i(cid:88) ≤ i(cid:88) j=1 i(cid:88) i(cid:88) j=1 (cid:48) max + (i − 1)δ1) − δ1 ≥ pj − (C ≥ Cmax − iδ1. j=1 Thus, [α, λ, µ] fulfills the conditions. • Sub-case 3.2:(cid:80)i j=1 pj − C (cid:48)# max,(cid:80)i (cid:48)# max < C (cid:48)# max j=1 pj−C (cid:48)#, max{L (cid:48)# Here, the state [k max] at iteration i. However, it may be re- is created by algorithm A moved when reducing the state subset. Let [α, λ, µ] be the state j=1 pj − in χ# i max + qi},C (cid:48)# C (cid:48)# max]. Hence, we have: that is in the same box as [k max,(cid:80)i (cid:48)#, max{L max +qi},C (cid:48)# (cid:48)# (cid:48) i(cid:88) λ ≤ max{L (cid:48)# max, pj − C max + qi} (cid:48)# j=1 +δ2 ≤ max{L −(C ≤ max{L (cid:48) (cid:48) max + (i − 1) max{δ1, δ2}, max − (i − 1)δ1) + qi} + δ2 max + qi} i(cid:88) pj − C (cid:48) max, (cid:48) j=1 +(i − 1) max{δ1, δ2} + δ2 ≤ Lmax + (i − 1) max{δ1, δ2} + δ2 ≤ Lmax + i max{δ1, δ2} i(cid:88) j=1 pj (14) In the other hand, we have µ ≥ C pj − C max − δ1 (cid:48)# (cid:48)# max − δ1 ≥ i(cid:88) i(cid:88) j=1 pj − C (15) (16) 5 max. We can see that max/C∗ C A(cid:48) the FPTAS algorithms are finding solutions closer to the optimal ones when the number of jobs is increasing. Cmax values are closer to the optimal than Lmax values, which is not a surprise, as Lmax depends on Cmax. Worth to mention, our FPTAS with  = 0.3 gives better results than with  = 0.9, which is consistent with the theory. We have also studied the influence of processing and delivery times, in Table I and II. These tables present average results for our benchmark, considering the 5 sets of instances. Results are presented for  = 0.3; the analysis is the same with  = 0.9. Table I shows that instances composed of jobs with various processing times lead to optimal solutions with a bigger Pareto front, as seen in column 2. At the opposite, columns 3 to 5 show that our FPTAS algorithm is not really influenced by this parameter. Table II shows that delivery times ranges have more influence on the results : the size of the Pareto front of non-dominated solutions grows faster. Our FPTAS algorithm has the same behavior, and we can see that the results are more close to the optimal with smaller values of qi. and µ ≤ C max + δ1 ≤ C (cid:48)# (cid:48) max + (i − 1)δ1 + δ1 ≤ Cmax + iδ1. ≥ (cid:48) max − iδ1 = Cmax − iδ1. j=1 Therefore, [α, λ, µ] fulfills the conditions. In conclusion, level the third case, and this completes our inductive proof. the statement holds also for i in Based on the lemma, we deduce easily that for every non- dominated state [k, Lmax, Cmax] ∈ χn, it must remain a close state [m, L# max] ∈ χ# n such that: max, C # max ≤ Lmax + n. max{δ1, δ2} ≤ (1 + ).Lmax, L# and max ≤ Cmax + n.δ1 ≤ (1 + ).Cmax. C # Table I: Quality of FPTAS as a function of processing time ranges (for  = 0.3) Moreover, it is clear that the FPTAS runs polynomially in n and 1/. The overall complexity of our FPTAS is O(n3/2). IV. RESULTS The following results have been obtained after testing the performance of the proposed algorithms. The code has been done in Java and the experiments were performed on an Intel(R) Core(TM)-i7 with 8GB RAM. We randomly generate five sets of instances, with different numbers of jobs and various processing and delivery times: • number of jobs: from 5 to 25, 26 to 50, 51 to 75, 76 to 100 and 100 to 200 • processing times : from 1 to 20, 1 to 100 and 1 to 1000 • delivery times : from 1 to 20, 1 to 100 and 1 to 1000 That gave us 135 instances in each set of instances. Finally, the FPTAS has been tested with two values of : 0.3 and 0.9. To ensure the consistency of running times, each test has been run three times. Figure 1 presents a comparison of FPTAS and Dynamic Programming. The left part of this figure shows the average size of the Pareto Front (i.e. the number of solutions) found by the Dynamic Programming algorithm and our FPTAS with the two  values we used. The sizes are given for our five sets of instances, from small instances (5-25 instances) to bigger ones (100-200 jobs). We can see that the number of solutions decreases as the number of jobs increases. With a lot of jobs, it is more likely to obtain very similar solutions, a lot of them being dominated by others. At the opposite, the number of jobs has no real influence on the Pareto front sizes found by our FPTAS algorithm, whatever the value of . quality of the two objectives of our study: LA(cid:48) On the right part of the same figure are given the average max and max/L∗ pi range 1-20 1-100 1-500 DP size of Pareto front 2.26 4.07 5.65 FPTAS size of Pareto front 1.23 1.84 1.73 max CA(cid:48) max/C∗ 1.0006 1.0008 1.0005 max LA(cid:48) max/L∗ 1.003 1.007 1.004 Table II: Quality of FPTAS as a function of delivery time ranges (for  = 0.3) qi range 1-20 1-100 1-500 DP size of Pareto front 2.02 3.03 6.93 FPTAS size of Pareto front 1.25 1.57 1.99 max CA(cid:48) max/C∗ 1.0007 1.0007 1.0005 max LA(cid:48) max/L∗ 1.001 1.002 1.008 Computing times are given in Tables III, IV and V. They compare our Dynamic Programming algorithm and our FP- TAS, considering two  values : 0.3 and 0.9. All values are in milliseconds. Table III shows that all algorithms are slower when the number of states is growing. Table IV shows an interesting result: while the Dynamic Programming algorithm becomes slower when the processing times ranges are growing, the FPTAS has an opposite behavior. The FPTAS with  = 0.3 is even slower than the exact algorithm for the smallest range of processing times. Table V shows that the delivery times ranges have a smaller influence on the Dynamic Programming algorithm: computing times are growing, but slower than the delivery times ranges. The FPTAS computing times are also growing in function of the delivery times ranges. Note that tables IV and V are based on mean values from all the set of instances. 6 Size of Pareto Front Quality of Cmax and Lmax Figure 1: Quality of our FPTAS algorithm with  = 0.3 and  = 0.9 Table III: Average computing times vs size of instances (ms) #jobs 5-25 26-50 51-75 76-100 100-200 DP 67 1278 7917 24937 164332 FPTAS  = 0.3 0.9 5.4 22 58 281  = 0.9, 0.3 0.9 3.4 7.8 32 times, small delivery times and big  make the FPTAS faster and vice versa). In our future works, the study of the multiple-machine schedul- ing problems seems to be a challenging perspective in the extension of our work. REFERENCES Table IV: Average computing times (ms) vs processing time ranges piranges 1-20 1-100 1-500 DP 91 2668 116362 FPTAS  = 0.3 144 51 25  = 0.9, 15 7 5 V. CONCLUSIONS AND PERSPECTIVES The two-parallel machines scheduling problem has been considered to minimize the maximum lateness and the makespan. We have proposed an exact algorithm (based on dynamic algorithm) to generate the complete Pareto Frontier in a pseudo-polynomial time. Then, we present an FPTAS (Fully Polynomial Time Approximation Scheme) to generate an approximate Pareto Frontier, based on the conversion of the exact dynamic programming. For the proposed algorithms, we randomly generated several instances with different ranges, and, for each job Ji, its processing time pi and delivery time qi are sets to be integer numbers.The results of the experiments showed that the proposed algorithms for the considered prob- lem are very efficient. It is clear that optimizing the maximum lateness (Lmax) implies to minimize implicitly the makespan (Cmax). Moreover, the values of  and processing and delivery times play an important role in the results (i.e., big processing Table V: Average computing times (ms) vs delivery time ranges qiranges 1-20 1-100 1-500 DP 31447 40482 47190 FPTAS  = 0.3 26 46 149  = 0.9, 5 7 15 [1] G. Sapienza, G. Brestovac, R. Grgurina, and T. Seceleanu. "On applying multiple criteria decision analysis in embedded systems design." Design automation for embedded systems,20(3), Vol 20(3), pp 211–238 (2016). [2] C. Bazgan, F. Jamain, and D. Vanderpooten. "Approximate Pareto sets of minimal size for multi-objective optimization problems." .Operations Research Letters, Vol 43(1), pp 1–6 (2015). [3] Z. Geng and J. Yuan. "Pareto optimization scheduling of family jobs on a p-batch machine to minimize makespan and maximum lateness." Theoretical Computer Science, Vol 570, pp 22–29 (2015). [4] C. He, H. Lin, and Y. Lin. "Bounded serial-batching scheduling for minimizing maximum lateness and makespan." Discrete Optimization, Vol 16, pp 70–75 (2015). [5] Y. Chen and X. Zou. "Runtime analysis of a multi-objective evolutionary algorithm for obtaining finite approximations of Pareto fronts." Informa- tion Sciences, Vol 262, pp 62–77 (2014). [6] K. Florios and G. Mavrotas. "Generation of the exact Pareto set in Multi-Objective Traveling Salesman and Set Covering Problems." Applied Mathematics and Computation, Vol 237, pp 1–19 (2014). [7] Q. Feng, J. Yuan, H. Liu, and C. He. "A note on two-agent scheduling on an unbounded parallel-batching machine with makespan and maximum lateness objectives." Applied Mathematical Modelling, Vol 37(10–11), pp 7071–7076 (2013). [8] C. He, H. Lin, Y. Lin, and J. Tian. "Bicriteria scheduling on a series- batching machine to minimize maximum cost and makespan." Central European Journal of Operations Research, pp 1–10 (2013). [9] C. He, X. M. Wang, Y. X. Lin, and Y. D. Mu. "An Improved Algorithm for a Bicriteria Batching Scheduling Problem." RAIRO-Operations Research, Vol 47(1), pp1–8 (2013). [10] M. T. Y. Sabouni and F. Jolai. "Optimal methods for batch processing problem with makespan and maximum lateness objectives." Applied Mathematical Modelling, Vol 34(2), pp 314–324 (2010). [11] C. He, Y. Lin, and J. Yuan. "Bicriteria scheduling on a batching machine to minimize maximum lateness and makespan." Theoretical Computer Science, Vol 381(1-3), pp 234–240 (2007). [12] D. Sarkar and J. M. Modak. "Pareto-optimal solutions for multi-objective optimization of fed-batch bioreactors using nondominated sorting genetic algorithm." Chemical Engineering Science, Vol 60(2), pp 481–492 (2005). [13] A. Allahverdi and T. Aldowaisan. "No-wait flowshops with bicriteria of makespan and maximum lateness." European Journal of Operational Research,Vol 152(1), pp 132–147 (2004). [14] C. M. Sil and E. C. Biscaia. "Genetic algorithm development for multi- objective optimization of batch free-radical polymerization reactors." Computers & chemical engineering, Vol 27(8), pp 1329–1344 (2003). [15] P. Kumar. "A Framework for Multi-objective Optimization and Multi- criteria Decision Making for Design of Electrical Drives." Universiteit Delft. (2008). [16] S. Chakhar and J. Martel. "Multi-Criteria Evaluation Functions Inside Geographical Information Systems Towards a Spatial Decision Support System."(2006). [17] Z. Geng and J. Yuan. "Scheduling with or without precedence relations on a serial-batch machine to minimize makespan and maximum cost." submitted, 2017 7
1705.05105
3
1705
2017-05-24T19:52:38
Assembling sequences of DNA using an on-line algorithm based on DeBruijn graphs
[ "cs.DS" ]
The problem of assembling DNA fragments starting from imperfect strings given by a sequencer, classified as NP hard when trying to get perfect answers, has a huge importance in several fields, because of its relation with the possibility of detecting similarities between animals, dangerous pests in crops, and so on. Some of the algorithms and data structures that have been created to solve this problem are Needleman Wunsch algorithm, DeBruijn graphs and greedy algorithms working on overlaps graphs; these try to work out the problem from different approaches that give place to certain advantages and disadvantages to be discussed. In this article we first expose a summary of the research done on already created solutions for the DNA assembly problem, to present later an on-line solution to the same matter, which, despite not considering mutations, would have the capacity of using only the necessary amount of readings to assemble an user specified amount of genes.
cs.DS
cs
Assembling sequences of DNA using an on-line algorithm based on DeBruijn graphs Andres Felipe Zapata Palacio Juan Manuel Ciro Restrepo Universidad Eafit Colombia [email protected] Universidad Eafit Colombia [email protected] Mauricio Toro Universidad Eafit Colombia [email protected] ABSTRACT The problem of assembling DNA fragments starting from imperfect strings given by a sequencer, classified as NP-hard when trying to get perfect answers [4], has a huge importance in several fields, because of its relation with the possibility of detecting similarities between animals, and so on. Some of the dangerous pests in crops, algorithms and data structures that have been created to solve this problem are Needleman–Wunsch algorithm, De bruijn graphs and greedy algorithms working on overlaps graphs; these try to work out the problem from different approaches that give place to certain advantages and disadvantages to be discussed. In this article we first expose a summary of the research done on already created solutions for the DNA assembly problem, to present later an on-line solution to the same matter, which, despite not considering mutations, would have the capacity of using only the necessary amount of readings to assemble an user specified amount of genes. Author Keywords DNA assembly, DeBruijn graphs, eulerian walks, on-line algorithms, complexity. ACM Classification Keywords Applied computing→ Life and medical sciences→Computational biology→Recognition of genes and regulatory elements; INTRODUCTION As many other sciences, the biology progress has been markedly accelerated by the use of computational and the statistical analysis in many fields; one of assembly of DNA sequences. This specific problem has undergone a lot of variation in its constraints, from the hand work at the very beginning to the length of the reads of real time devices for DNA sequencing. These devices, however, do not sequence the DNA in a predictable way, because the reads length is not enough to cover the whole DNA and it is not currently possible to start them, one exactly after another. Algorithms for genome assembly are then playing a crucial role in order to get entire genes. PROBLEM Currently, the DNA sequencers turn DNA in strings within the alphabet {A, G, T, C}, that represents its Nitrogenous bases. However, because a sequencer can not read a whole DNA directly, the DNA of a single creature is given in many fragments, which must be matched and conjugated on-line, it is, while the sequencer is still working. Because of that, the solution has to work with the data introduced in real-time by the sequencer, and produce results before the reading process is finished. (It would take too much time and memory to wait for the reading to be completed) The objective of this work is then finding one solution to process the reads of a sequencer with such characteristics, finding the DNA strand of the examined living being and extracting the genes found in the partially assembled DNA sequence. The program will finish when the sequencer stops reading, when the number of genes required are found or when the limit time of computation is spent. RELATED WORK De Bruijn graph and Eulerian walks [7] One algorithm created to solve the genome assembly problem is based on traversing a Bruijn graph following an Eulerian path (​a trail in a graph which visits every edge exactly once[9])​. A Bruijn graph is a directed graph that represents each k-mer (Substring of length k) of the genome with nodes containing its prefix and suffix (k-1)-mers and then establishing an edge A → B for every A and B where B has a prefix that is also a suffix of A, that is, there is an overlap between A and B. After building such a graph the genome can be obtained by following the aforementioned Eulerian path of the graph. ALGORITHM This algorithm uses one DeBruijn graph as in the Figure 1, to store the k-mers of each fragment read: The program reads each DNA fragment given and updates the DeBruijn graph:, getting the right and left K-1mers for each kmer, inserting them into the graph (if they are not already added) and then setting a directed edge from the left to the right one. Also, it is necessary to discard the possibility that the right K1-mer (the one to which the edge "arrives") is initial, this aspect is going to be clarified later. Once the graph is updated, the next step is to traverse it. It is done by following the next K-1mers of each initial K-1mer (each K-1mer to which no other K-1mer points), until a K-1mer without next is found. This process gave us a set of partially assembled strands. The last step is processing every strand and finding the genes in it. At first the program goes over the strand and saves the indexes of the start and stop codons, after that it "greedily" matches the first start codon found with the first stop codon (a gen has been found) and the start codons in between are removed, that because there can be many start codons before a stop codon and the "correct" one is the one that produces the largest gen. If one gen is found, the program checks if it is already found(the found genes are stored in a HashSet so that it is easy to check) if that is not the case, the gen is printed in the screen and stored in that HashSet. DATA STRUCTURES graph that The representation had to suffice are basically three: Each K- 1 mer needs to be added at most once, the graph must be able to be efficiently traversed, and, as a consequence of the former, the initial nodes should be able to be found easily. At a first glance, a HashMap<K-1mer, nextK-1mer> seems to be a good option: It is O(1) for inserting, and also allows to get the "next" of each K-1mer in constant time, but when it there is no straightforward way to do that. Keeping in mind the HashMap advantages we implemented a bijection between each K-1mer and an index using a bidirectional HashMap, so that getting the index of a K-1mer and the K-1mer of an index are both performed in O(1) constant time. That indexing makes it possible to the graph as an one-dimensional "adjacency represent every edge A → B is represented as array" where array[indexof A] = indexof B. The array is one-dimensional since A and B are guaranteed to be unique , which causes that edge to be unique, and the only outgoing edge from A. to finding the initial nodes data-structure-level needings comes the Figure 1: graphic representation of a DeBruijn graph​. Global alignment of two genetic sequences [3] Needleman-Wunsch and Christian Wunsch implemented in 1970 an algorithm that aligns protein and nucleic acid sequences. This computation allows you to compare two sequences and determine how different or similar they are the one of the another. the alphabet(set of This algorithm needs some inputs: symbols that make up the sequences), the two strings that contains the two sequences, a function that determines a mark of similarity between each pair of symbols that make up the alphabet, and the mark of no matching a symbol. Greedy shortest common superstring [4] Another approach to the genome assembly problem, simplified to finding the shortest common superstring, are greedy algorithms, which are quick at the cost of not guaranteeing that the found superstring is the shortest one. More precisely, the greedy approximations can compute in O(n log n) time a superstring that in the worst case is, however, "only β times ( where 2 ≤ β ≤ 4) longer than the shortest common superstring"[6]. The strategy behind the greedy approach is basically building and "greedily" reducing an overlaps graph. This graph is a directed weighted graph, where A → B shows that A overlaps B, and the weight of the edge indicates the number of overlapped characters. The reduction, on the other hand, merges (eliminating redundancy) the nodes attached to the edge with the greatest weight at each iteration, randomly choosing if there is more than one edge labeled with that weight and concatenating the remaining nodes after all edges have been merged. Comparing biological sequence information [5] BLAST is an informatic program that computes the statistical level of similarity between a given nucleotide sequence and all the sequences stored in its database, using an heuristic algorithm. Although the heuristic does not ensures the answer is correct, in most of the cases, BLAST works not only successfully, but also efficiently. To find the initial nodes the the strategy is pretty simple: every K-1mer, at the beginning, is a "possible initial", and each time an edge A → B is added, B stops being an initial. We save that information in a 1D boolean array, indexed the same way, and which values are all True at the beginning. In the end those K-1mers whose values in their corresponding indices are still True are the initial nodes: Figure 2: Strategy used to determine the initial nodes. the same edge or This implementation assures us that K-1mer will not be stored twice. Shown below, there is a summary of the complexity of the operations gotten by using this implementation. V: number of K-1mers stored in the graph Operation Complexity Get the index of one K-1mer Get the K-1mer referred by one index Get the next K-1mer of one K-1mer Check whether a K-1mer is an initial node Get all the initial nodes of the graph Traverse the graph(starting at every initial node) O(1) O(1) O(1) O(1) O(V) O(V) Table 1: Complexity of operations on the proposed implementation of the graph. 01) COMPLEXITY Since the length of the K-mer is 201, the graph is going to store K1-mers of 200. When the graph is being updated, for each K-mer in the read of length L, two K-1mers are taken, . After that, theY new K-1 mers are that inserted and their edges added to the graph, both operations in constant time. ​Updating the graph is then​ Once the graph is updated it has to be traversed in order to find the genes. First, we get all the initials O(V), and then (L)O ( − 2 * 2 L . is ) (V ) = O (2V ) the specific lengths of all reads. It traverse the graph from every initial. Since the group of K-1mers pointed by each initial are disjoint every K-1mer is visited only once and then ​the complexity of traversing the graph is O + V = O (V together, the complexity of processing ​N Putting it all lectures is developed next: For the sake of simplicity we use the average read length is fair instead of considering that they were going to be used altogether in a summatory and, because of that, the final value does not change. Let A be the average read length. Each time the graph is traversed every already-added node is visited, that would be A for the first read, plus A + A for the second one and so on. In the nth lecture, the amount of traveled nodes would be: A + 2 + 3 + . + N A A A .. Factoring A we get: ( + 2 + . + N * A 1 .. ) Which, using Gauss summation, can be reduced to: N(N+1) * A = 2 AN² + AN 2 2 + ) (AN² = AN² + AN = O AN) O(AN²) Now, applying Big O product, constant and sum rules we get: O ( That would be the complexity of traversing the graph N times. The complexity of updating the graph is way more simple: it walks each read completely, which is O(AN). The overall complexity, adding the cost of traversing and updating the graph is O(AN + AN²), and, using the product ​we conclude that the complexity of rule once again, processing N reads is O(AN²) where A is the average read length. Operation Complexity Update the graph with a read of length L O(L) Traverse the graph when it has V K-1mers added O(V) Update and traverse the graph N times, with N reads of average length A Table 2: Complexity of the operations used by the algorithm. O(AN²) IMPLEMENTATION The program execution requires three arguments: the filename where the DNA fragments are stored, the number of genes to be found and the computing timeout. Figure 3: Help menu when the arguments are incorrects A fourth parameter is optional, represented by the flag -c; this argument allows the user to write the start and stop codons, separated by commas. Figure 4: Starting the program with the -c argument If the flag -c is not written, the default start codon is ATG and the default stop codons are TGA, TAA and TAG. During the program execution, the found genes are printed in the screen one by one. Figure 5: Final results of the execution At the end of the execution, the program prints the number of found fragments and the computing time expressed in milliseconds. The code can be found at: https://svn.riouxsvn.com/edya-dnassembly RESULTS WITH TWO SMALL DNAS The implementation was tested at assembling mitochondrial genes from two species: Acipenser transmontanus (White sturgeon) and Acanthisitta chloris (rifleman). The memory and time results are shown below: Species: Acipenser transmontanus Number of requested genes 15 30 45 60 Execution time(ms) 38 70 132 284 Memory(MB) 62,8 T​able 3: Time and memory results from the tests with mitochondrial Acipenser transmontanus DNA 23,2 29,4 35,3 Species: Acanthisitta chloris Number of requested genes Execution time(ms) 15 53 30 45 60 126 212 249 Memory(MB) 25,9 42,8 60,8 62,6 Table 4: Time and memory results from the tests with mitochondrial Acanthisitta chloris DNA Figure 6: Results of time for both tests. Figure 7: Memory used by both tests. CONCLUSIONS The problem of assembling DNA sequences from a group of fragments using an on-line algorithm is a wide problem for which every assumption, made or not, can influence in high degree the difficulty or ease on the solution. This project's difficulty was increased by the fact that the algorithm had to be on-line, but also reduced because mutations were not considered. REFERENCES 1. Anon. 2017. Computational genomics https://en.wikipedia.org/wiki/Computational_genomics Retrieved March 12, 2017. 2. Anon. 2017. ​Algoritmo Needleman-Wunsch 3. Anon. 2017. Neeedlman-Wunsch Algorithm http://algoritmoneedleman-wunsch-bio-alevaca.blogspot.c om.co/​ Retrieved March 12, 2017. https://es.wikipedia.org/wiki/Algoritmo_Needleman-Wun sch​ Retrieved March 12, 2017. https://en.wikipedia.org/wiki/BLAST​ ​Retrieved March 12, 2017. 4. Anon. 2017. BLAST 5. Ben Langmead. Assembly & shortest common superstring. Retrieved March 11, 2017 from http://www.cs.jhu.edu/~langmea/resources/lecture_notes/ assembly_scs.pdf 6. Alan Frieze and Wojciech Szpankowski. 1997. Greedy algorithms for the shortest common superstring that are asymptotically optimal. (April 1997). Retrieved March 11, 2017 from https://www.math.cmu.edu/~af1p/Texfiles/super.pdf 7. Lisandra Aguilar Bultet and Laurent Falquet. 2015. Sequencing and de novo assembly of bacterial genomes: an approach to study new pathogens. ​Revista de Salud Animal, 37(2), 125-132​ (August 2015). Retrieved March 12, 2017 from http://scielo.sld.cu/scielo.php?script=sci_arttext&pid=S02 53-570X2015000200008 8. Anon. 2017. K-mer. ​https://en.wikipedia.org/wiki/K-mer Retrieved March 12, 2017. 9. Anon. 2017. Eulerian path. https://en.wikipedia.org/wiki/Eulerian_path​ Retrieved March 12, 2017. 10.Ben Langmead. De Bruijn Graph assembly. Retrieved April 14, 2017 from http://www.cs.jhu.edu/~langmea/resources/lecture_notes/ assembly_dbg.pdf from DNAs under, or The results of time and memory were totally satisfactory and it is certain that the software performs well assembling slightly above 20000 genes nucleobases long. We also conclude that it is impossible to assembly genes with 100% of correctness by using on-line algorithms, specially because there is no way to make predictions about start or stop codons that are yet to come in further reads. Thanks to this project, we got started in the world of scientific computing, using our programming knowledge for solving a computational genomic problem: assembling a DNA sequence and finding the genes using an on-line algorithm. This approach to the world of science shows us the large number of problems where the use of computing can make a difference. Science and computing are nowadays meant to walk together in order to find answers and solutions for the benefit of mankind. ACKNOWLEDGEMENT Special thanks to ​Ben Langmead from the John Hopkins School of engineering, whose courses and online-sources gave us the theoretical framework for this project. Also to Santiago Passos Patiño and Juan David Arcila from EAFIT university, the space to discuss different approaches to solve the proposed problem. FUTURE WORK The future works could be focused on reducing the computation time, because we are still solving some important subproblems more improvement would be modifying the algorithm in order to consider mutations and the statistical models behind this. than once. Another for
1705.09177
2
1705
2018-06-06T16:22:13
On the (parameterized) complexity of recognizing well-covered (r,l)-graphs
[ "cs.DS", "cs.CC" ]
An $(r, \ell)$-partition of a graph $G$ is a partition of its vertex set into $r$ independent sets and $\ell$ cliques. A graph is $(r, \ell)$ if it admits an $(r, \ell)$-partition. A graph is well-covered if every maximal independent set is also maximum. A graph is $(r,\ell)$-well-covered if it is both $(r,\ell)$ and well-covered. In this paper we consider two different decision problems. In the $(r,\ell)$-Well-Covered Graph problem ($(r,\ell)$WCG for short), we are given a graph $G$, and the question is whether $G$ is an $(r,\ell)$-well-covered graph. In the Well-Covered $(r,\ell)$-Graph problem (WC$(r,\ell)$G for short), we are given an $(r,\ell)$-graph $G$ together with an $(r,\ell)$-partition of $V(G)$ into $r$ independent sets and $\ell$ cliques, and the question is whether $G$ is well-covered. We classify most of these problems into P, coNP-complete, NP-complete, NP-hard, or coNP-hard. Only the cases WC$(r,0)$G for $r\geq 3$ remain open. In addition, we consider the parameterized complexity of these problems for several choices of parameters, such as the size $\alpha$ of a maximum independent set of the input graph, its neighborhood diversity, its clique-width, or the number $\ell$ of cliques in an $(r, \ell)$-partition. In particular, we show that the parameterized problem of deciding whether a general graph is well-covered parameterized by $\alpha$ can be reduced to the WC$(0,\ell)$G problem parameterized by $\ell$. In addition, we prove that both problems are coW[2]-hard but can be solved in XP-time.
cs.DS
cs
On the (parameterized) complexity of recognizing well-covered (r, (cid:96))-graphs∗ Konrad K. Dabrowski‡ Sancrey Rodrigues Alves† Sulamita Klein¶ Ignasi Sau(cid:107) ∗∗ Uéverton S. Souza†† Luerbio Faria§ 8 1 0 2 n u J 6 ] S D . s c [ 2 v 7 7 1 9 0 . 5 0 7 1 : v i X r a Abstract An (r, (cid:96))-partition of a graph G is a partition of its vertex set into r independent sets and (cid:96) cliques. A graph is (r, (cid:96)) if it admits an (r, (cid:96))-partition. A graph is well-covered if every maximal independent set is also maximum. A graph is (r, (cid:96))-well-covered if it is both (r, (cid:96)) and well-covered. In this paper we consider two different decision problems. In the (r, (cid:96))-Well-Covered Graph problem ((r, (cid:96))wc-g for short), we are given a graph G, and the question is whether G is an (r, (cid:96))-well-covered graph. In the Well-Covered (r, (cid:96))-Graph problem (wc-(r, (cid:96))g for short), we are given an (r, (cid:96))-graph G together with an (r, (cid:96))-partition, and the question is whether G is well- covered. This generates two infinite families of problems, for any fixed non-negative integers r and (cid:96), which we classify as being P, coNP-complete, NP-complete, NP- hard, or coNP-hard. Only the cases wc-(r, 0)g for r ≥ 3 remain open. In addition, we consider the parameterized complexity of these problems for several choices of parameters, such as the size α of a maximum independent set of the input graph, its neighborhood diversity, its clique-width, or the number (cid:96) of cliques in an (r, (cid:96))- partition. In particular, we show that the parameterized problem of determining whether every maximal independent set of an input graph G has cardinality equal to k can be reduced to the wc-(0, (cid:96))g problem parameterized by (cid:96). In addition, we prove that both problems are coW[2]-hard but can be solved in XP-time. Keywords: well-covered graph; (r, (cid:96))-graph; coNP-completeness; FPT-algorithm; pa- rameterized complexity; coW[2]-hardness. ∗This work was supported by FAPERJ, CNPq, CAPES Brazilian Research Agencies, EPSRC (EP/K025090/1), the Leverhulme Trust (RPG-2016-258), and the French ANR projects DEMOGRAPH (ANR-16-CE40-0028) and ESIGMA (ANR-17-CE40-0028). †FAETEC, Fundação de Apoio à Escola Técnica do Estado do Rio de Janeiro, Brazil. [email protected]. ‡Department of Computer [email protected]. Science, Durham University, Durham, United Kingdom. §UERJ, DICC, Universidade do Estado do Rio de Janeiro, Brazil. [email protected]. ¶UFRJ, COPPE-Sistemas, Universidade Federal do Rio de Janeiro, Brazil. [email protected]. (cid:107)CNRS, LIRMM, Université de Montpellier, Montpellier, France. [email protected]. ∗∗Departamento de Matemática, Universidade Federal do Ceará, Fortaleza, Brazil. ††UFF, IC, Universidade Federal Fluminense, Niterói, Brazil. [email protected]. 1 1 Introduction One of the most important combinatorial problems is Maximum Independent Set (MIS), where the objective is to find a maximum sized subset S ⊆ V of pairwise non- adjacent vertices in a graph G = (V, E). Maximum independent sets appear naturally in a wide range of situations, and MIS also finds a number of "real world" relevant applications. Unfortunately, the decision version of MIS is an NP-complete problem [23], and thus it cannot be solved in polynomial time unless P = NP. In spite of the fact that finding a maximum independent set is a computationally hard problem, a maximal independent set of a graph can easily be found in linear time. Indeed, a naive greedy algorithm for finding maximal independent sets consists simply of selecting an arbitrary vertex v to add to a set S, and updating the current graph by removing the closed neighborhood N [v] of v. This algorithm always outputs a maximal independent set in linear time, but clearly not all choices lead to a maximum independent set. Well-covered graphs were first introduced by Plummer [29] in 1970. Plummer defined that "a graph is said to be well-covered if every minimal point cover is also a minimum cover". This is equivalent to demanding that all maximal independent set have the same cardinality. Therefore, well-covered graphs can be equivalently defined as the class of graphs for which the naive greedy algorithm discussed above always outputs a maximum independent set. The problem of recognizing a well-covered graph, which we denote by Well- Covered Graph, was proved to be coNP-complete by Chvátal and Slater [3] and independently by Sankaranarayana and Stewart [33]. On the other hand, the Well- Covered Graph problem is in P when the input is known to be a perfect graph of bounded clique size [12] or a claw-free graph [26, 35]. Let r, (cid:96) ≥ 0 be two fixed integers. An (r, (cid:96))-partition of a graph G = (V, E) is a partition of V into r independent sets S1, . . . , Sr and (cid:96) cliques K1, . . . , K(cid:96). For convenience, we allow these sets to be empty. A graph is (r, (cid:96)) if it admits an (r, (cid:96))- partition. Note that the notion of (r, (cid:96))-graphs is a generalization of that of r-colorable graphs. A P versus NP-complete dichotomy for recognizing (r, (cid:96))-graphs was proved by Brand- städt [1]: the problem is in P if max{r, (cid:96)} ≤ 2, and NP-complete otherwise. The class of (r, (cid:96))-graphs and its subclasses have been extensively studied in the literature. For instance, list partitions of (r, (cid:96))-graphs were studied by Feder et al. [17]. In another paper, Feder et al. [18] proved that recognizing graphs that are both chordal and (r, (cid:96)) is in P. A graph is (r, (cid:96))-well-covered if it is both (r, (cid:96)) and well-covered. In this paper we 2 analyze the complexity of the (r, (cid:96))-Well-Covered Graph problem, which consists of deciding whether a graph is (r, (cid:96))-well-covered. In particular, we give a complete classification of the complexity of this problem. Additionally, we analyze the complexity of the Well-Covered-(r, (cid:96))-Graph prob- lem, which consists of deciding, given an (r, (cid:96))-graph G = (V, E) together with an (r, (cid:96)) partition, whether G is well-covered or not. We classify the complexity of this problem for every pair (r, (cid:96)), except for the cases when (cid:96) = 0 and r ≥ 3, which we leave open. We note that similar restrictions have been considered in the literature. For instance, Kolay et al. [24] recently considered the problem of removing a small number of vertices from a perfect graph so that it additionally becomes (r, (cid:96)). To the best of our knowledge, this is the first time in the literature that a deci- sion problem obtained by "intersecting" two recognition NP-complete and coNP-complete properties has been studied. From our results, the (r, (cid:96))wc-g problem has a very pecu- liar property, namely that some cases of the problem are in NP, but other cases are in coNP. And if P (cid:54)= NP, there are some cases where the decision problem is neither in NP nor in coNP. In addition, according to the state of the art for the Well-Covered Graph prob- lem, to the best of our knowledge this is the first work that associates the hardness of Well-Covered Graph with the number of independent sets and the number of cliques of an (r, (cid:96))-partition of the input graph. This shows an important structural property for classifying the complexity of subclasses of well-covered graphs. As a by-product of this paper, an infinite class of decision problems was classified as being both NP-hard and coNP-hard. Hence, unless P = NP these decision problems are neither in NP nor in coNP. More formally, in this paper we focus on the following two decision problems. (r, (cid:96))-Well-Covered Graph ((r, (cid:96))wc-g ) Input: A graph G. Question: Is G (r, (cid:96))-well-covered? Well-Covered (r, (cid:96))-Graph (wc-(r, (cid:96))g ) Input: An (r, (cid:96))-graph G, together with a partition of V (G) into Question: r independent sets and (cid:96) cliques. Is G well-covered? We establish an almost complete characterization of the complexity of the (r, (cid:96))wc-g and wc-(r, (cid:96))g problems. Our results are shown in the following tables, where r (resp. (cid:96)) 3 corresponds to the rows (resp. columns) of the tables, and where coNPc stands for coNP-complete, NPh stands for NP-hard, NPc stands for NP-complete, and (co)NPh stands for both NP-hard and coNP-hard. The symbol '?' denotes that the complexity of the corresponding problem is open. (r, (cid:96))wc-g 0 1 2 ≥ 3 wc-(r, (cid:96))g 0 1 2 ≥ 3 0 − P P NPh 0 − P P ? 1 P P 2 P P ≥ 3 NPc NPc coNPc (co)NPh coNPc (co)NPh (co)NPh (co)NPh 1 P P 2 P P ≥ 3 P P coNPc coNPc coNPc coNPc coNPc coNPc We note the following simple facts, which we will use to fill the above tables: Fact 1. If (r, (cid:96))wc-g is in P, then wc-(r, (cid:96))g is in P. Fact 2. If wc-(r, (cid:96))g is coNP-hard, then (r, (cid:96))wc-g is coNP-hard. Note that wc-(r, (cid:96))g is in coNP, since a certificate for a NO-instance consists just of two maximal independent sets of different size. On the other hand, for (r, (cid:96))wc-g we have the following facts, which are easy to verify: Fact 3. For any pair of integers (r, (cid:96)) such that the problem of recognizing an (r, (cid:96))-graph is in P, the (r, (cid:96))wc-g problem is in coNP. Fact 4. For any pair of integers (r, (cid:96)) such that the wc-(r, (cid:96))g problem is in P, the (r, (cid:96))wc-g problem is in NP. In this paper we prove that (r, (cid:96))wc-g with (r, (cid:96)) ∈ {(0, 1), (1, 0), (0, 2), (1, 1), (2, 0), (1, 2)} can be solved in polynomial time, which by Fact 1 yields that wc-(r, (cid:96))g with (r, (cid:96)) ∈ {(0, 1), (1, 0), (0, 2), (1, 1), (2, 0), (1, 2)} can also be solved in polynomial time. On the other hand, we prove that wc-(2, 1)g is coNP-complete, which by Fact 2 and Fact 3 yields that (2, 1)wc-g is also coNP-complete. Furthermore, we also prove that wc-(0, (cid:96))g and wc-(1, (cid:96))g are in P, and that (r, (cid:96))wc-g with (r, (cid:96)) ∈ {(0, 3), (3, 0), (1, 3)} are NP-hard. Finally, we state and prove a "monotonicity" result, namely Theorem 1, 4 stating how to extend the NP-hardness or coNP-hardness of wc-(r, (cid:96))g (resp. (r, (cid:96))wc- g) to wc-(r + 1, (cid:96))g (resp. (r + 1, (cid:96))wc-g), and wc-(r, (cid:96) + 1)g (resp. (r, (cid:96) + 1)wc-g). Together, these results correspond to those shown in the above tables. In addition, we consider the parameterized complexity of these problems for several choices of the parameters, such as the size α of a maximum independent set of the input graph, its neighborhood diversity, its clique-width or the number (cid:96) of cliques in an (r, (cid:96))- partition. We obtain several positive and negative results. In particular, we show that the parameterized problem of determining whether every maximal independent set of an input graph G has cardinality equal to k can be reduced to the wc-(0, (cid:96))g problem parameterized by (cid:96). In addition, we prove that both problems are coW[2]-hard, but can be solved in XP-time. The rest of this paper is organized as follows. We start in Section 2 with some basic preliminaries about graphs, parameterized complexity, and width parameters. In Section 3 we prove our results concerning the classical complexity of both problems, and in Section 4 we focus on their parameterized complexity. We conclude the paper with Section 5. 2 Preliminaries Graphs. We use standard graph-theoretic notation, and we refer the reader to [13] for any undefined notation. A graph G = (V, E) consists of a finite non-empty set V of vertices and a set E of unordered pairs (edges) of distinct elements of V . If uv ∈ E(G), then u, v are said to be adjacent, and u is said to be a neighbor of v. A clique (resp. independent set) is a set of pairwise adjacent (resp. non-adjacent) vertices. A vertex cover is a set of vertices containing at least one endpoint of every edge in the graph. The open neighborhood N (v) or neighborhood, for short, of a vertex v ∈ V is the set of vertices adjacent to v. The closed neighborhood of a vertex v is defined as N [v] = N (v) ∪ {v}. A v∈S N [v] = V . Given S ⊆ V and dominating set is a set of vertices S ⊆ V such that(cid:83) v ∈ V , the neighborhood NS(v) of v in S is the set NS(v) = N (v) ∩ S. Throughout the paper, we let n denote the number of vertices in the input graph for the problem under consideration. Parameterized complexity. We refer the reader to [10,14,19,27] for basic background on parameterized complexity, and we recall here only some basic definitions. A param- eterized problem is a language L ⊆ Σ∗ × N. For an instance I = (x, k) ∈ Σ∗ × N, k is called the parameter. A parameterized problem is fixed-parameter tractable (FPT) if there exists an algorithm A, a computable function f, and a constant c such that given an instance I = (x, k), A (called an FPT-algorithm) correctly decides whether I ∈ L in time bounded by f (k)Ic. 5 Within parameterized problems, the class W[1] may be seen as the parameterized equivalent to the class NP of classical optimization problems. Without entering into details (see [10, 14, 19, 27] for the formal definitions), a parameterized problem being W[1]-hard can be seen as a strong evidence that this problem is not FPT. The canonical example of a W[1]-hard problem is Independent Set parameterized by the size of the solution1. The class W[2] of parameterized problems is a class that contains W[1], and so the problems that are W[2]-hard are even more unlikely to be FPT than those that are W[1]- hard (again, see [10, 14, 19, 27] for the formal definitions). The canonical example of a W[2]-hard problem is Dominating Set parameterized by the size of the solution2. For i ∈ [1, 2], to transfer W[i]-hardness from one problem to another, one uses an fpt-reduction, which given an input I = (x, k) of the source problem, computes in time f (k)Ic, for some computable function f and a constant c, an equivalent instance I(cid:48) = (x(cid:48), k(cid:48)) of the target problem, such that k(cid:48) is bounded by a function depending only on k. Hence, an equivalent definition of W[1]-hard (resp. W[2]-hard) problem is any prob- lem that admits an fpt-reduction from Independent Set (resp. Dominating Set) parameterized by the size of the solution. Even if a parameterized problem is W[1]-hard or W[2]-hard, it may still be solvable in polynomial time for fixed values of the parameter; such problems are said to belong to the complexity class XP. Formally, a parameterized problem whose instances consist of a pair (x, k) is in XP if it can be solved by an algorithm with running time f (k)xg(k), where f, g are computable functions depending only on the parameter and x represents the input size. For example, Independent Set and Dominating Set parameterized by the solution size are easily seen to belong to XP. Width parameters. A tree-decomposition of a graph G = (V, E) is a pair (T,X ), where T = (I, F ) is a tree, and X = {Bi}, i ∈ I is a family of subsets of V (G), called bags and indexed by the nodes of T , such that 1. each vertex v ∈ V appears in at least one bag, i.e.,(cid:83) i∈I Bi = V ; 2. for each edge e = {x, y} ∈ E, there is an i ∈ I such that x, y ∈ Bi; and 3. for each v ∈ V the set of nodes indexed by {i i ∈ I, v ∈ Bi} forms a subtree of T . The width of a tree-decomposition is defined as maxi∈I{Bi− 1}. The treewidth of G, denoted by tw(G), is the minimum width of a tree-decomposition of G. 1Given a graph G and a parameter k, the problem is to decide whether there exists an independent 2Given a graph G and a parameter k, the problem is to decide whether there exists a dominating set set S ⊆ V (G) such that S ≥ k. S ⊆ V (G) such that S ≤ k. 6 The clique-width of a graph G, denoted by cw(G), is defined as the minimum number of labels needed to construct G, using the following four operations: 1. Create a single vertex v with an integer label (cid:96) (denoted by (cid:96)(v)); 2. Take the disjoint union (i.e., co-join) of two graphs (denoted by ⊕); 3. Join by an edge every vertex labeled i to every vertex labeled j for i (cid:54)= j (denoted by η(i, j)); 4. Relabel all vertices with label i by label j (denoted by ρ(i, j)). An algebraic term that represents such a construction of G and uses at most k labels is said to be a k-expression of G (i.e., the clique-width of G is the minimum k for which G has a k-expression). Graph classes with bounded clique-width include cographs [2], distance-hereditary graphs [20], graphs of bounded treewidth [9], graphs of bounded branchwidth [32], and graphs of bounded rank-width [22]. 3 Classical complexity of the problems We start with a monotonicity theorem that will be very helpful to fill the tables presented in Section 1. The remainder of this section is divided into four subsections according to whether (r, (cid:96))wc-g and wc-(r, (cid:96))g are polynomial or "hard" problems. Theorem 1. Let r, (cid:96) ≥ 0 be two fixed integers. Then it holds that: (i) if wc-(r, (cid:96))g is coNP-complete then wc-(r + 1, (cid:96))g and wc-(r, (cid:96) + 1)g are coNP- complete; (ii) if (r, (cid:96))wc-g is NP-hard (resp. coNP-hard) then (r, (cid:96) + 1)wc-g is NP-hard (resp. coNP-hard); (iii) supposing that r ≥ 1, if (r, (cid:96))wc-g is NP-hard (resp. coNP-hard) then (r + 1, (cid:96))wc-g is NP-hard (resp. coNP-hard). Proof. (i) This follows immediately from the fact that every (r, (cid:96))-graph is also an (r + 1, (cid:96))-graph and an (r, (cid:96) + 1)-graph. (ii) Let G be an instance of (r, (cid:96))wc-g. Let H be an (r, (cid:96) + 1)wc-g instance defined as the disjoint union of G and a clique Z with V (Z) = {z1, . . . , zr+1}. Clearly G is well-covered if and only if H is well-covered. If G is an (r, (cid:96))-well-covered graph then H is an (r, (cid:96) + 1)-well-covered graph. Suppose H is an (r, (cid:96) + 1)-well-covered graph, with 7 a partition into r independent sets S1, . . . , Sr and (cid:96) + 1 cliques K1, . . . , K(cid:96)+1. Each independent set Si can contain at most one vertex of the clique Z. Therefore, there must be a vertex zi in some clique Kj. Assume without loss of generality that there is a vertex of Z in K(cid:96)+1. Then K(cid:96)+1 cannot contain any vertex outside of V (Z), so we may assume that K(cid:96)+1 contains all vertices of Z. Now S1, . . . , Sr, K1, . . . , K(cid:96) is an (r, (cid:96))-partition of G, so G is an (r, (cid:96))-well-covered graph. Hence, H is a YES-instance of (r, (cid:96) + 1)wc-g if and only if G is a YES-instance of (r, (cid:96))wc-g. (iii) Let G be an instance of (r, (cid:96))wc-g. Let G(cid:48) be an (r + 1, (cid:96))wc-g instance obtained from G by adding (cid:96) + 1 isolated vertices. (This guarantees that every maximal independent set in G(cid:48) contains at least (cid:96) + 1 vertices.) Since r ≥ 1, it follows that G(cid:48) is an (r, (cid:96))-graph if and only if G is. Clearly G(cid:48) is well-covered if and only if G is. Next, find an arbitrary maximal independent set in G(cid:48) and let p be the number of vertices in this set. Note that p ≥ (cid:96)+1. Let H be the join of G(cid:48) and a set of p independent vertices Z = {z1, . . . , zp}, i.e., NH (zi) = V (G(cid:48)) for all i. Every maximal independent set of H is either Z or a maximal independent set of G(cid:48) and every maximal independent set of G(cid:48) is a maximal independent set of H. Therefore, H is well-covered if and only if G(cid:48) is well-covered. Clearly, if G(cid:48) is an (r, (cid:96))-graph then H is an (r + 1, (cid:96))-graph. Suppose H is an (r + 1, (cid:96))-graph, with a partition into r + 1 independent sets S1, . . . , Sr+1 and (cid:96) cliques K1, . . . , K(cid:96). Each clique set Ki can contain at most one vertex of Z. Therefore there must be a vertex zi in some independent set Sj. Suppose that there is a vertex of Z in Sr+1. Then Sr+1 cannot contain any vertex outside of Z. Without loss of generality, we may assume that Sr+1 contains all vertices of Z. Now S1, . . . , Sr, K1, . . . , K(cid:96) is an (r, (cid:96))-partition of G, so G is an (r, (cid:96))-graph. Thus H is a YES-instance of (r + 1, (cid:96))wc-g if and only if G is a YES-instance of (r, (cid:96))wc-g. 3.1 Polynomial cases for wc-(r, (cid:96))g Theorem 2. wc-(0, (cid:96))g and wc-(1, (cid:96))g are in P for every integer (cid:96) ≥ 0. Proof. It is enough to prove that wc-(1, (cid:96))g is in P. Let V = (S, K1, K2, K3, . . . , K(cid:96)) be a (1, (cid:96))-partition for G. Then each maximal independent set I of G admits a partition I = (IK, S \ NS(IK)), where IK is an independent set of K1 ∪ K2 ∪ K3 ∪ ···∪ K(cid:96). Observe that there are at most O(n(cid:96)) choices for an independent set IK of K1∪ K2∪ K3∪···∪ K(cid:96), which can be listed in time O(n(cid:96)), since (cid:96) is constant and (K1, K2, K3, . . . , K(cid:96)) is given. For each of them, we consider the independent set I = IK ∪ (S \ NS(IK)). If I is not maximal (which may happen if a vertex in (K1 ∪ K2 ∪ K3 ∪ ···∪ K(cid:96)) \ IK has no neighbors in I), we discard this choice of IK. Hence, we have a polynomial number O(n(cid:96)) of maximal independent sets to check in order to decide whether G is a well-covered graph. 8 3.2 Polynomial cases for (r, (cid:96))wc-g Fact 5. The graph induced by a clique or by an independent set is well-covered. The following corollary is a simple application of Fact 5. Corollary 1. G is a (0, 1)-well-covered graph if and only if G is a (0, 1)-graph. Similarly, G is a (1, 0)-well-covered graph if and only if G is a (1, 0)-graph. The following is an easy observation. Lemma 1. (0, 2)wc-g can be solved in polynomial time. Proof. By definition, a graph G = (V, E) is a (0, 2)-graph if and only if its vertex set can be partitioned into two cliques, and this can be tested in polynomial time. It follows that every (0, 2)-graph has maximum independent sets of size at most 2. Let G be a (0, 2)-graph with (0, 2)-partition (K1, K2). If V is a clique, then G is a (0, 1)-well- covered graph, and hence a (0, 2)-well-covered graph. If V is not a clique, then G is a (0, 2)-well-covered graph if and only if G has no universal vertex. In the next three lemmas we give a characterization of (1, 1)-well-covered graphs in terms of their graph degree sequence. Note that (1, 1)-graphs are better known in the literature as split graphs. Lemma 2. Let G = (V, E) be a (1, 1)-well-covered graph with (1, 1)-partition V = (S, K), where S is a independent set and K is a clique. If x ∈ K, then NS(x) ≤ 1. Proof. Suppose that G is a (1, 1)-well-covered graph with (1, 1)-partition V = (S, K), where S is a independent set and K is a clique. Let I be a maximal independent set of G such that x ∈ I ∩ K. Suppose for contradiction that NS(x) ≥ 2, and let y, z ∈ NS(x). Since y, z ∈ S, NG(y), NG(z) ⊆ K. Since K is a clique, vertex x is the only vertex of I in K. Hence, we have that NG(y) ∩ (I \ {x}) = NG(z) ∩ (I \ {x}) = ∅. Therefore I(cid:48) = (I \ {x}) ∪ {y, z} is an independent set of G such that I(cid:48) = I + 1. Thus, I is a maximal independent set that is not maximum, so G is not well-covered. Thus, NS(x) ≤ 1. Lemma 3. A graph G is a (1, 1)-well-covered graph if and only if it admits a (1, 1)- partition V = (S, K) such that either for every x ∈ K, NS(x) = 0, or for every x ∈ K, NS(x) = 1. Proof. Let G be a (1, 1)-well-covered graph. By Lemma 2 we have that, given a vertex x ∈ K, either NS(x) = 0 or NS(x) = 1. Suppose for contradiction that there are two vertices x, y ∈ K such that NS(x) = 0 and NS(y) = 1. Let z be the vertex of S 9 adjacent to y. Let I be a maximal independent set containing vertex y. Note that the vertex x is non-adjacent to every vertex of I \ {y} since there is at most one vertex of I in K. The same applies to the vertex z. Hence, a larger independent set I(cid:48), with size I(cid:48) = I+1, can be obtained from I by replacing vertex y with the non-adjacent vertices x, z, i.e., I is a maximal independent set of G that is not maximum, a contradiction. Thus, either for every x ∈ K, NS(x) = 0, or for every x ∈ K, NS(x) = 1. Conversely, suppose that there is a (1, 1)-partition V = (S, K) of G such that either for every x ∈ K, NS(x) = 0, or for every x ∈ K, NS(x) = 1. If K = ∅, then G is (1, 0) and then G is well-covered. Hence we assume K (cid:54)= ∅. If for every x ∈ K, NS(x) = 0, then every maximal independent set consists of all the vertices of S and exactly one vertex v ∈ K. If for every x ∈ K, NS(x) = 1, then every maximal independent set is either I = S, or I = {x} ∪ (S \ NS(x)) for some x ∈ K. Since NS(x) = 1 we have I = 1 + S − 1 = S, and hence G is a (1, 1)-well-covered graph. Corollary 2. (1, 1)wc-g can be solved in polynomial time. Proof. Since we can check in polynomial time whether G is a (1, 1) graph [1], and one can enumerate all (1, 1)-partitions of a split graph in polynomial time, we can solve the (1, 1)wg-g problem in polynomial time. The next lemma shows that (1, 1)-well-covered graphs can be recognized from their degree sequences. sequence of V is either (k, k, k, . . . , k, i1, i2, . . . , is, 0, 0, 0, . . . , 0) with (cid:80)s Lemma 4. G is a (1, 1)-well-covered graph if and only if there is a positive integer k such that G is a graph with a (1, 1)-partition V = (S, K) where K = k, such that the degree j=1(ij) = k, or (k − 1, k − 1, k − 1, . . . , k − 1, 0, 0, 0, . . . , 0), where the subsequences k, . . . , k (resp. k − 1, . . . , k − 1) have length k. Proof. Let G be a (1, 1)-well-covered graph. Then G admits a (1, 1)-partition V = (S, K) where k := K, k ≥ 0. If k = 0, then the degree sequence is (0, 0, 0, . . . , 0). If k ≥ 1, then by Lemma 3 either for every x ∈ K, NS(x) = 0, or for every x ∈ K, NS(x) = 1. If for every x ∈ K, NS(x) = 0, then the degree sequence of G is (k − 1, k − 1, k − 1, . . . , k − 1, 0, 0, 0, . . . , 0). If for every x ∈ K, NS(x) = 1, then the degree sequence of G is (k, k, k, . . . , k, i1, i2, . . . , is, 0, 0, 0, . . . , 0), with(cid:80)s 0, 0, 0, . . . , 0), or (k − 1, k − 1, k − 1, . . . , k − 1, 0, 0, 0, . . . , 0), such that(cid:80)s Suppose that there is a positive integer k such that G is a graph with (1, 1)-partition V = (S, K) where K = k, with degree sequence either (k, k, k, . . . , k, i1, i2, . . . , is, j=1(ij) = k. If the degree sequence of G is (k, k, k, . . . , k, i1, i2, . . . , is, 0, 0, 0, . . . , 0), then the vertices of K are adjacent to k − 1 vertices of K and exactly one of S, since the vertices with j=1(ij) = k. 10 degree i1, i2, . . . , is, have degree at most k and the vertices with degree 0 are isolated. If the degree sequence of G is (k − 1, k − 1, k − 1, . . . , k − 1, 0, 0, 0, . . . , 0), then the vertices of K are adjacent to k − 1 vertices of K and none of S and the vertices with degree 0 are isolated. By Lemma 3 we have that G is a well-covered graph. Ravindra [31] gave the following characterization of (2, 0)-well-covered graphs. Proposition 3 (Ravindra [31]). Let G be a connected graph. G is a (2, 0)-well-covered graph if and only if G contains a perfect matching F such that for every edge e = uv in F , G[N (u) ∪ N (v)] is a complete bipartite graph. We now prove that Proposition 3 leads to a polynomial-time algorithm. Lemma 5. (2, 0)wc-g can be solved in polynomial time. Proof. Assume that G is connected and consider the weighted graph (G, ω) with ω : E(G) → {0, 1} satisfying ω(uv) = 1, if G[N (u) ∪ N (v)] is a complete bipartite graph, and 0 otherwise. By Proposition 3, G is well-covered if and only if (G, ω) has a weighted perfect matching with weight at least n/2, and this can be decided in polynomial time [15]. Lemma 6. (1, 2)wc-g can be solved in polynomial time. Proof. We can find a (1, 2)-partition of a graph G (if such a partition exists) in polynomial time [1]. After that, we use the algorithm for wc-(1, (cid:96))g given by Theorem 2. Below we summarize the cases for which we have shown that wc-(r, (cid:96))g or (r, (cid:96))wc-g can be solved in polynomial time. Theorem 4. (r, (cid:96))wc-g with (r, (cid:96)) ∈ {(0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0)} and wc- (r, (cid:96))g with r ∈ {0, 1} or (r, (cid:96)) = (2, 0) can be solved in polynomial time. Proof. The first part follows from Corollary 1, Lemma 1, Corollary 2, Lemma 6, and Lemma 5, respectively. The second part follows from Theorem 2, and Lemma 5 together with Fact 1. 3.3 coNP-complete cases for wc-(r, (cid:96))g We note that the well-Covered Graph instance G constructed in the reduction of Chvátal and Slater [3] is a (2, 1)-graph, directly implying that wc-(2, 1)g is coNP- complete. Indeed, Chvátal and Slater [3] take a 3-sat instance I = (U, C) = ({u1, u2, u3, . . . , un}, {c1, c2, c3, . . . , cm}), and construct a Well-Covered Graph instance G = 11 1: and Slater's Chvátal [3] Well-Covered Graph instance Figure G = (V, E) obtained from the satisfiable 3-sat instance I = (U, C) = ({u1, u2, u3},{(u1, u2, u3), (u1, u2, u3), (u1, u2, u3)}), where {c1, c2, . . . , cm} is a clique of G. Observe that I is satisfiable if and only if G is not well-covered, since there is a maximal independent set with size n + 1 (e.g. {c1, u1, u2, u3}) and there is a maximal independent set of size n (e.g. {u1, u2, u3}). Note also that G is a (2, 1)-graph with (2, 1)-partition V = ({u1, u2, . . . , un},{u1, u2, . . . , un},{c1, c2, . . . , cm} ). (V, E) = ( {u1, u2, u3, . . . , un, u1, u2, u3, . . . , un, c1, c2, c3, . . . , cm}, {xcj : x occurs in cj} ∪ {uiui : 1 ≤ i ≤ n} ∪ {cicj : 1 ≤ i < j ≤ m} ). Note that {cicj : 1 ≤ i < j ≤ m} is a clique, and that {u1, u2, u3, . . . , un}, and {u1, u2, u3, . . . , un} are independent sets. Hence, G is a (2, 1)-graph. An illustration of this construction can be found in Figure 1. This discussion can be summarized as follows. Proposition 5 (Chvátal and Slater [3]). wc-(2, 1)g is coNP-complete. As (2, 1)-graphs can be recognized in polynomial time [1], we obtain the following. Corollary 3. (2, 1)wc-g is coNP-complete. 3.4 NP-hard cases for (r, (cid:96))wc-g Now we prove that (0, 3)wc-g is NP-complete. For this purpose, we slightly modify an NP-completeness proof of Stockmeyer [34]. Stockmeyer's [34] NP-completeness proof of 3-coloring considers a 3-sat in- stance I = (U, C) = ( {u1, u2, u3, . . . , un},{c1, c2, c3, . . . , cm} ), and constructs a 3-coloring instance G = (V, E) = ({u1, u2, u3, . . . , un, u1, u2, u3, . . . , un} ∪ {v1[j], v2[j], v3[j], v4[j], v5[j], v6[j] : i ∈ {1, 2, 3, . . . , n}} ∪ {v1[j]v2[j], v2[j]v4[j], v4[j]v1[j], v4[j]v5[j], v5[j]v6[j], v6[j]v3[j], : j ∈ {1, 2, 3, . . . , m}} ∪ {v1[j]x, v2[j]y, v3[j]z : cj = (x, y, z)} ∪ {t1ui, v3[j]v5[j] t1 ¯ui : i ∈ {1, 2, 3, . . . , n}} ∪ {t2v6[j] : j ∈ {1, 2, 3, . . . , m}} ); see Figure 2(a). Lemma 7. (0, 3)wc-g is NP-complete. {1, 2, 3, . . . , m}} ∪ {t1, t2},{uiui ∈ j : Proof. As by Theorem 2 the Well-Covered Graph problem can be solved in poly- nomial time on (0, 3)-graphs, by Fact 4 (0, 3)wc-g is in NP. 12 u1u1u2u2u3u3c1c2c3 Figure 2: (a) Stockmeyer's [34] 3-coloring instance G obtained from the 3-sat instance I = (U, C) = ({u1, u2, u3},{(u3, u2, u1), (u1, u2, u3)}). (b) The graph G(cid:48) obtained from G by adding a vertex xuv with NG(cid:48)(xuv) = {u, v} for every edge uv of G not belonging to a triangle. Let I = (U, C) be a 3-sat instance. We produce, in polynomial time in the size of I, a (0, 3)wc-g instance H, such that I is satisfiable if and only if H is (0, 3)-well-covered. Let G = (V, E) be the graph of [34] obtained from I, and let G(cid:48) be the graph obtained from G by adding to V a vertex xuv for every edge uv of G not belonging to a triangle, and by adding to E edges uxuv and vxuv; see Figure 2(b). Finally, we define H = G(cid:48) as the complement of G(cid:48). Note that, by [34], I is satisfiable if and only if G is 3-colorable. Since xuv is adjacent to only two different colors of G, clearly G is 3-colorable if and only if G(cid:48) is 3-colorable. Hence, I is satisfiable if and only if H is a (0, 3)-graph. We prove next that I is satisfiable if and only if H is a (0, 3)-well-covered graph. Suppose that I is satisfiable. Then, since H is a (0, 3)-graph, every maximal indepen- dent set of H has size 3, 2, or 1. If there is a maximal independent set I in H with size 1 or 2, then I is a maximal clique of G(cid:48) of size 1 or 2. This contradicts the construction of G(cid:48), since every maximal clique of G(cid:48) is a triangle. Therefore, G is well-covered. Suppose that H is (0, 3)-well-covered. Then G(cid:48) is 3-colorable, so G is also 3-colorable. Thus, by [34], I is satisfiable. We next prove that (3, 0)wc-g is NP-hard. For this, we again use the proof of Stockmeyer [34], together with the following theorem. Proposition 6 (Topp and Volkmann [36]). Let G = (V, E) be an n-vertex graph, V = {v1, v2, v3, . . . , vn}, and let H be obtained from G such that V (H) = V ∪ 13 v3[1]v2[1]v5[1]v4[1]v6[1]v1[1]v1[2]v4[2]v5[2]v2[2]v3[2]v6[2]v3[1]v2[1]v5[1]v4[1]v6[1]v1[1]v1[2]v4[2]v5[2]v2[2]v3[2]v6[2]NFT/FT/FT/FT/FT/FT/Ft1t2u1u1u2u2u3u3NFT/FT/FT/FT/FT/FT/Ft1t2u1u1u2u2u3u3(a)(b) {u1, u2, u3, . . . , un} and E(H) = E ∪ {viui : i ∈ {1, 2, 3, . . . , n}}. Then H is a well- covered graph where every maximal independent set has size n. Proof. Observe that every maximal independent set I of H has a subset IG = I ∩ V . Let U ⊆ {1, 2, 3, . . . , n} be the set of indices i such that vi ∈ I. Since I is maximal, the set {ui : i ∈ {1, 2, 3, . . . , n} \ U} must be contained in I, so I = n. Lemma 8. (3, 0)wc-g is NP-hard. Proof. Let I = (U, C) be a 3-sat instance; let G = (V, E) be the graph obtained from I in Stockmeyer's [34] NP-completeness proof for 3-coloring; and let H be the graph obtained from G by the transformation described in Proposition 6. We prove that I is satisfiable if and only if H is a (3, 0)-well-covered graph. Suppose that I is satisfiable. Then by [34] we have that G is 3-colorable. Since a vertex v ∈ V (H) \ V (G) has just one neighbor, there are 2 colors left for v to extend a 3-coloring of G, and so H is a (3, 0)-graph. Hence, by Proposition 6, H is a (3, 0)-well-covered graph. Suppose that H is a (3, 0)-well-covered graph. Then we have that G is a (3, 0)-graph. By [34], I is satisfiable. Note that Theorem 1 combined with Lemma 7 does not imply that (1, 3)wc-g is NP-complete. Lemma 9. (1, 3)wc-g is NP-complete. Proof. As by Theorem 2 the Well-Covered Graph problem can be solved in poly- nomial time on (1, 3)-graphs, by Fact 4 (1, 3)wc-g is in NP. Let I = (U, C) be a 3-sat instance. Without loss of generality, I has more than two clauses. We produce a (1, 3)wc-g instance H polynomial in the size of I, such that I is satisfiable if and only if H is (1, 3)-well-covered. Let G = (V, E) be the graph of Stockmeyer [34] obtained from I (see Figure 2(a)), and let H be the graph obtained from G (the complement of the graph G) by adding one pendant vertex pv for each vertex v of G. Note that V (H) = V (G) ∪ {pv : v ∈ V (G)}, E(H) = E(G) ∪ {pvv : v ∈ V (G)}, and NH (pv) = {v}. First suppose that I is satisfiable. Then by [34], G is a (3, 0)-graph, and G is a ). Thus it follows that (0, 3)-graph with partition into cliques V (G) = (K1 (S = {pv : v ∈ V (G)}, K1 G In addition, from Proposition 6 and by the construction of H, H is a well-covered graph. Hence H is (1, 3)-well-covered. ) is a (1, 3)-partition of V (H). , K2 G , K2 G , K3 G G , K3 G Conversely, suppose that H is (1, 3)-well-covered, and let V (H) = (S, K1, K2, K3) be a (1, 3)-partition for H. Then we claim that no vertex pv ∈ V (H) \ V (G) belongs to Ki, i ∈ {1, 2, 3}. Indeed, suppose for contradiction that pv ∈ Ki for some i ∈ {1, 2, 3}. 14 Then, Ki ⊆ {pv, v}. Hence, H \ Ki is a (1, 2)-graph and G \ {v} is an induced subgraph of a (2, 1)-graph. But by construction of G, G \ {v} (for any v ∈ V (G)) contains at least one 2K3 (that is, two vertex-disjoint copies of K3) as an induced subgraph, which is a contradiction given that 2K3 is clearly a forbidden subgraph for (2, 1)-graphs. Therefore, {pv : v ∈ V (G)} ⊆ S, and since {pv : v ∈ V (G)} is a dominating set of H, S = {pv : v ∈ V (G)}. Thus, G is a (0, 3)-graph with partition V (G) = (K1, K2, K3), and therefore G is a (3, 0)-graph, i.e., a 3-colorable graph. Therefore, by [34], I is satisfiable. Corollary 4. If r ≥ 3 and (cid:96) = 0, then (r, (cid:96))wc-g is NP-hard. If r ∈ {0, 1} and (cid:96) ≥ 3, then (r, (cid:96))wc-g is NP-complete. Proof. (r, (cid:96))wc-g is NP-hard in all of these cases by combining Theorem 1, and Lem- mas 7, 8 and 9. For r ∈ {0, 1} and (cid:96) ≥ 3, the Well-Covered Graph problem can be solved in polynomial time on (r, (cid:96))-graphs, so by Fact 4 (r, (cid:96))wc-g is in NP. Below we summarize the cases for which we have shown that wc-(r, (cid:96))g or (r, (cid:96))wc-g is computationally hard. Theorem 7. The following classification holds: 1. wc-(r, (cid:96))g with r ≥ 2 and (cid:96) ≥ 1 are coNP-complete; 2. (0, (cid:96))wc-g and (1, (cid:96))wc-g with (cid:96) ≥ 3 are NP-complete; 3. (2, 1)wc-g and (2, 2)wc-g are coNP-complete; 4. (r, (cid:96))wc-g with r ≥ 0 and (cid:96) ≥ 3 is NP-hard; 5. (r, (cid:96))wc-g with r ≥ 3 and (cid:96) ≥ 0 is NP-hard; 6. (r, (cid:96))wc-g with r ≥ 2 and (cid:96) ≥ 1 is coNP-hard. Proof. Statement 1 follows from Proposition 5 and Theorem 1(i). Statement 2 follows from Corollary 4. Statement 3 follows from Statement 1, Facts 2 and 3 and the fact that recognizing (r, (cid:96))-graphs is in P if max{r, (cid:96)} ≤ 2 [1]. Statement 4 follows from Statement 2 and Theorem 1(ii)-(iii). Statement 5 follows from Lemma 8 and Theorem 1(ii)-(iii). Finally, Statement 6 follows from Corollary 3 and Theorem 1(ii)-(iii). 15 4 Parameterized complexity of the problems In this section we focus on the parameterized complexity of the Well-Covered Graph problem, with special emphasis on the case where the input graph is an (r, (cid:96))-graph. Recall that the results presented in Section 2 show that wc-(r, (cid:96))g is para-coNP-complete when parameterized by r and (cid:96). Thus, additional parameters should be considered. Henceforth we let α (resp. ω) denote the size of a maximum independent set (resp. maximum clique) in the input graph G for the problem under consideration. Note that wc-(r, (cid:96))g parameterized by r, (cid:96), and ω generalizes wc-(r, 0)g, whose complexity was left open in the previous sections. Therefore, we focus on the complexity of wc-(r, (cid:96))g parameterized by r, (cid:96), and α, and on the complexity of the natural parameterized version of Well-Covered Graph, defined as follows: k-Well-Covered Graph Input: A graph G and an integer k. Parameter: k. Question: Does every maximal independent set of G have size exactly k? The next lemma provides further motivation to study of the wc-(0, (cid:96))g problem, as it shows that k-Well-Covered Graph (on general graphs) can be reduced to the wc-(0, (cid:96))g problem parameterized by (cid:96). Lemma 10. The k-Well-Covered Graph problem can be fpt-reduced to the wc- (0, (cid:96))g problem parameterized by (cid:96). Proof. Consider an arbitrary input graph G with vertices u1, . . . , un. First, we find an arbitrary maximal (with respect to set-inclusion) independent set I in G. Without loss of generality we may assume that I = k and I = {u1, . . . , uk}. Let (cid:96) = k + 1. We construct a (0, (cid:96))-graph G(cid:48) with vertex set {vi,j : i ∈ {1, . . . , (cid:96)}, j ∈ {1, . . . , n}} as follows: • For all i ∈ {1, . . . , (cid:96)} add edges to make Vi := {vi,j : j ∈ {1, . . . , n}} into a clique. • For all j ∈ {1, . . . , n} add edges to make Wj := {vi,j : i ∈ {1, . . . , (cid:96)}} into a clique. • For all pairs of adjacent vertices ua, ub in G, add edges between vi,a and vj,b for all i, j ∈ {1, . . . , (cid:96)} (so that Va is complete to Vb). Note that the sets Vi partition G(cid:48) into (cid:96) cliques, so G(cid:48) is indeed a (0, (cid:96))-graph, where (cid:96) = k + 1. 16 The graph G(cid:48) has a maximal independent set of size k, namely {v1,1, . . . , vk,k}, so G(cid:48) is well-covered if and only if every maximal independent set in G(cid:48) has size exactly k. Every maximal independent set in G(cid:48) has at most one vertex in any set Vi and at most one vertex in any set Wj, since Vi and Wj are cliques. As there are (cid:96) = k + 1 sets Vi, it follows that every independent set in G(cid:48) contains at most k + 1 vertices. If G(cid:48) contains an independent set {vi1,j1, . . . , vix,jx} for some x then {uj1, . . . , ujx} is an independent set in G. If G contains an independent set {uj1, . . . , ujx} for some x then {v1,j1, . . . , vmin(x,k+1),jmin(x,k+1) } is an independent set in G(cid:48). Therefore G contains a maximal independent set smaller than k if and only if G(cid:48) contains a maximal independent set smaller than k and G contains a (not necessarily maximal) independent set of size at least k + 1 if and only G(cid:48) contains a maximal independent set of size exactly k + 1. It follows that G(cid:48) is well-covered if and only if G is. As (cid:96) = k + 1, this completes the proof. Recall that the Well-Covered Graph problem is coNP-complete [3,33]. In order to analyze the parameterized complexity of the problem, we will need the following definition. Definition 1. The class coW[2] is the class of all parameterized problems whose com- plement is in W[2]. For an overview of parameterized complexity classes, see [11, 19]. We are now ready to show the next result. Theorem 8. The wc-(0, (cid:96))g problem parameterized by (cid:96) is coW[2]-hard. Proof. Red-Blue Dominating Set (RBDS) is a well-known W[2]-complete prob- lem [14], which consists of determining whether a given bipartite graph G = (R ∪ B, E) admits a set D ⊆ R of size k (the parameter) such that D dominates B (that is, every vertex in B has a neighbor in D). To show the coW[2]-hardness of our problem, we present an fpt-reduction from Red-Blue Dominating Set to the problem of deter- mining whether a given (0, (cid:96))-graph is not well-covered, where (cid:96) = k + 1. m}, . . . , Rk = {rk From an instance (G, k) of RBDS we construct a (0, (cid:96))-graph G(cid:48) as follows. m}, R2 = Replace the set R = {r1, r2, . . . , rm} by k copies: R1 = {r1 {r2 m}, where each new vertex has the same neigh- borhood as the corresponding vertex did in G. Add edges to make B, as well as each Ri for 1 ≤ i ≤ k, induce a clique. For each i ∈ {1, . . . , k}, create a vertex si, and add all possible edges between si and the vertices in Ri. Let G(cid:48) be the result- ing graph. Note that the vertex set of G(cid:48) can be partitioned into (cid:96) = k + 1 cliques: B, R1 ∪ {s1}, R2 ∪ {s2}, . . . , Rk ∪ {sk}. 1 , rk 2 , . . . , rk 1, r2 2, . . . , r2 1, r1 2, . . . , r1 17 Clearly, for every b ∈ B, the set {s1, s2, . . . , sk} ∪ {b} is an independent set of G(cid:48) of size k + 1. Note that such an independent set is maximum, as it contains one vertex from each of the k + 1 cliques that partition V (G(cid:48)). In addition, any maximal independent set of G(cid:48) has size at least k, since every maximal independent set contains either si or a vertex of Ri. At this point, we claim that G has a set D ⊆ R of size k which dominates B if and only if G(cid:48) has a maximal independent set of size k (i.e., G(cid:48) is not well-covered). If D = {ri1, ri2, . . . , rik} is a subset of R of size k which dominates B in G, then } is a maximal independent set of G(cid:48), implying that G(cid:48) is not , . . . , rk ik D(cid:48) = {r1 , r2 i2 well-covered. i1 Conversely, if G(cid:48) is not well-covered then there exists in G(cid:48) a maximal independent set D(cid:48) of size k. Note that D(cid:48) ∩ B = ∅ and each vertex in B has at least one neighbor in D(cid:48), as otherwise D(cid:48) would not be a maximal independent set of size k. Therefore, by letting D be the set of vertices in R that have copies in D(cid:48) ∩ {R1 ∪ R2 ∪ . . . ∪ Rk}, we find that D is a subset of R of size at most k which dominates B in G. From the previous theorem we immediately obtain the following corollaries. Corollary 5. The k-Well-Covered Graph problem is coW[2]-hard. Proof. This follows immediately from Lemma 10 and Theorem 8. Corollary 6. Unless FPT = coW[2], the wc-(r, (cid:96))g problem cannot be solved in time f (α + (cid:96))ng(r) for any computable function f. Proof. This follows from the fact that an algorithm running in time f (α + (cid:96))ng(r), would be an FPT-algorithm for wc-(0, (cid:96))g parameterized by (cid:96), and from the coW[2]-hardness of the problem demonstrated in Theorem 8. In contrast to Corollary 6, Lemma 11 shows that the wc-(r, (cid:96))g problem can be solved in time 2rαnO((cid:96)). Lemma 11. The wc-(r, (cid:96))g problem can be solved in time 2rαnO((cid:96)). In particular, it is FPT when (cid:96) is fixed and r, α are parameters. Proof. Note that each of the r independent sets S1, . . . , Sr of the given partition of V (G) must have size at most α. On the other hand, any maximal independent set of G contains at most one vertex in each of the (cid:96) cliques. The algorithm exhaustively constructs all i=1 Si, and then choose at most one vertex in each clique. For each choice, we just have to verify whether the constructed set is a maximal independent set, and then check that all the constructed maximal independent sets have the same size. The claimed running time 1≤i≤r Si, maximal independent sets of G as follows: we start by guessing a subset of(cid:83)r follows. In fact, in the statement of the lemma, one could replace rα with(cid:80) which yields a stronger result. 18 Although wc-(1, (cid:96))g parameterized by (cid:96) is coW[2]-hard (see Theorem 8), Theorem 2 shows that the problem is in XP. Corollary 7. The wc-(1, (cid:96))g problem can be solved in time nO((cid:96)). In other words, it is in XP when parameterized by (cid:96). Proof. This follows from Theorem 2 by considering (cid:96) to not be a constant. Table 1 summarizes the results presented so far. Note that, by Ramsey's Theo- rem [30], when both ω and α are parameters the input graph itself is a trivial kernel. Table 1: Parameterized complexity of wc-(r,(cid:96))g. Param.\Class r (cid:96) r, (cid:96) r, (cid:96), ω r, (cid:96), α ω, α (0, (cid:96)) -- coW[2]-h XP coW[2]-h XP FPT Trivial coW[2]-h XP (1, (cid:96)) -- coW[2]-h XP coW[2]-h XP FPT Trivial coW[2]-h XP (r, (cid:96)) para-coNP-h para-coNP-h para-coNP-h Open (generalizes wc-(3,0)g) coW[2]-h, no f (α + (cid:96))ng(r) algo. unless FPT=coW[2], algo. in time 2rαnO((cid:96)) FPT FPT FPT Ramsey's Thm. Ramsey's Thm. Ramsey's Thm. 4.1 Taking the neighborhood diversity as the parameter Neighborhood diversity is a structural parameter based on a special way of partitioning a graph into independent sets and cliques. Therefore, it seems a natural parameter to consider for our problem, since an (r, (cid:96))-partition of a graph G is also a partition of its vertex set into cliques and independent sets. Definition 2 (Lampis [25]). The neighborhood diversity nd(G) of a graph G = (V, E) is the minimum integer t such that V can be partitioned into t sets V1, . . . , Vt where for every v ∈ V (G) and every i ∈ {1, . . . , t}, either v is adjacent to every vertex in Vi or it is adjacent to none of them. Note that each part Vi of G is either a clique or an independent set. 19 Another natural parameter to consider is the vertex cover number, because well- covered graphs can be equivalently defined as graphs in which every minimal vertex cover has the same size. However, neighborhood diversity is stronger than vertex cover, in the sense that every class of graphs with bounded vertex cover number is also a class of graphs with bounded neighborhood diversity, but the reverse is not true [25]. Thus, for our analysis, it is enough to consider the neighborhood diversity as the parameter. In addition, neighborhood diversity is a graph parameter that captures more precisely than vertex cover number the property that two vertices with the same neighborhood are "equivalent". It is worth mentioning that an optimal neighborhood diversity decomposition of a graph G can be computed in time O(n3); see [25] for more details. Lemma 12. The Well-Covered Graph problem is FPT when parameterized by neighborhood diversity. Proof. Given a graph G, we first obtain a neighborhood partition of G with minimum width using the polynomial-time algorithm of Lampis [25]. Let t := nd(G) and let V1, . . . , Vt be the partition of V (G). As we can observe, for any pair u, v of non-adjacent vertices belonging to the same part Vi, if u is in a maximal independent set S then v also belongs to S, otherwise S cannot be maximum. On the other hand, if N [u] = N [v] then for any maximal independent set Su such that u ∈ Su there exists another maximal independent set Sv such that Sv = Su\{u}∪{v}. Hence, we can contract each partition Vi that is an independent set into a single vertex vi with weight τ (vi) = Si, and contract each partition Vi that is a clique into a single vertex vi with weight τ (vi) = 1, in order to obtain a graph Gt with V (Gt) = t, where the weight of a vertex vi of Gt means that any maximal independent set of G uses either none or exactly τ (v) vertices of Vi. At this point, we just need to analyze whether all maximal independent sets of Gt have the same weight (sum of the weights of its vertices), which can be done in time 2tnO(1). Corollary 8. The Well-Covered Graph problem is FPT when parameterized by the vertex cover number n − α. 4.2 Taking the clique-width as the parameter In the 90's, Courcelle proved that for every graph property Π that can be formulated in monadic second order logic (MSOL1), there is an f (k)nO(1) algorithm that decides if a graph G of clique-width at most k satisfies Π (see [4 -- 6,8]), provided that a k-expression is given. LinEMSOL is an extension of MSOL1 which allows searching for sets of vertices which are optimal with respect to some linear evaluation functions. Courcelle et al. [7] 20 showed that every graph problem definable in LinEMSOL is linear-time solvable on graphs with clique-width at most k (i.e., FPT when parameterized by clique-width) if a k-expression is given as input. Using a result of Oum [28], the same result follows even if no k-expression is given. Theorem 9. The Well-Covered Graph problem is FPT when parameterized by clique-width. Proof. Given S ⊆ V (G), first observe that the property "S is a maximal independent set" is MSOL1-expressible. Indeed, we can construct a formula ϕ(G, S) such that "S is a maximal independent set" ⇔ ϕ(G, S) as follows: [(cid:64) u, v ∈ S : edge(u, v)] ∧ [(cid:64) S(cid:48) : (S ⊆ S(cid:48)) ∧ ((cid:64) x, y ∈ S(cid:48) : edge(x, y))] Since ϕ(G, S) is an MSOL1-expression, the problem of finding goal(S) : ϕ(G, S) for goal ∈ {max, min} is definable in LinEMSOL. Thus we can find max(S) and min(S) satisfying ϕ(G, S) in time f (cw(G))nO(1). Finally, G is well-covered if and only if max(S) = min(S). Corollary 9. The Well-Covered Graph problem is FPT when parameterized by treewidth. Proof. This follows from the fact that graphs with treewidth bounded by k have clique- width bounded by a function of k [9]. Corollary 10. For any fixed r and (cid:96), the (r,(cid:96))-Well-Covered Graph problem is FPT when parameterized by clique-width. Proof. As r and (cid:96) are constants, the problem of determining whether G is an (r, (cid:96))-graph is also MSOL1-expressible. Note that, since for every graph G we have cw(G) ≤ nd(G) + 1 [25], Lemma 12 is also a corollary of Theorem 9. Nevertheless, the algorithm derived from the proof of Lemma 12 is much simpler and faster than the one that follows from the meta-theorem of Courcelle et al. [7]. 5 Further research Concerning the complexity of the (r, (cid:96))wc-g and wc-(r, (cid:96))g problems, note that the only remaining open cases are wc-(r, 0)g for r ≥ 3 (see the tables in Section 1). We do not even know if there exists some integer r ≥ 3 such that wc-(r, 0)g is coNP-complete, although we conjecture that this is indeed the case. 21 As another avenue for further research, it would be interesting to provide a com- plete characterization of well-covered tripartite graphs, as has been done for bipartite graphs [16, 31, 37]. So far, only partial characterizations exist [21, 38]. Acknowledgement. We would like to thank the anonymous reviewers for helpful remarks that improved the presentation of the manuscript. References [1] A. Brandstädt. Partitions of graphs into one or two independent sets and cliques. Discrete Mathematics, 152(1-3):47 -- 54, 1996. [2] A. Brandstädt, F. F. Dragan, H.-O. Le, and R. Mosca. New graph classes of bounded clique-width. Theory of Computing Systems, 38(5):623 -- 645, 2005. [3] V. Chvátal and P. J. Slater. A note on well-covered graphs. Annals of Discrete Mathematics, 55:179 -- 181, 1993. [4] B. Courcelle. The monadic second-order logic of graphs. I. recognizable sets of finite graphs. Information and Computation, 85(1):12 -- 75, 1990. [5] B. Courcelle. The expression of graph properties and graph transformations in monadic second-order logic. Handbook of Graph Grammars, 1:313 -- 400, 1997. [6] B. Courcelle and J. Engelfriet. Graph Structure and Monadic Second-Order Logic: A Language-Theoretic Approach. Cambridge University Press, 1st edition, 2012. [7] B. Courcelle, J. A. Makowsky, and U. Rotics. Linear time solvable optimiza- tion problems on graphs of bounded clique-width. Theory of Computing Systems, 33(2):125 -- 150, 2000. [8] B. Courcelle and M. Mosbah. Monadic second-order evaluations on tree- decomposable graphs. Theoretical Computer Science, 109(1 -- 2):49 -- 82, 1993. [9] B. Courcelle and S. Olariu. Upper bounds to the clique width of graphs. Discrete Applied Mathematics, 101(1 -- 3):77 -- 114, 2000. [10] M. Cygan, F. V. Fomin, L. Kowalik, D. Lokshtanov, D. Marx, M. Pilipczuk, M. Pilipczuk, and S. Saurabh. Parameterized Algorithms. Springer, 2015. [11] R. de Haan and S. Szeider. Machine Characterizations for Parameterized Com- plexity Classes Beyond Para-NP. In Proc. of the 41st International Conference on Current Trends in Theory and Practice of Computer Science (SOFSEM), volume 8939 of LNCS, pages 217 -- 229, 2015. 22 [12] N. Dean and J. S. Zito. Well-covered graphs and extendability. Discrete Mathemat- ics, 126(1 -- 3):67 -- 80, 1994. [13] R. Diestel. Graph Theory, 4th Edition, volume 173 of Graduate texts in mathematics. Springer, 2012. [14] R. G. Downey and M. R. Fellows. Fundamentals of Parameterized Complexity. Texts in Computer Science. Springer, 2013. [15] J. Edmonds. Paths, trees and flowers. Canadian Journal of Mathematics, 17:449 -- 467, 1965. [16] O. Favaron. Very well-covered graphs. Discrete Mathematics, 42:177 -- 187, 1982. [17] T. Feder, P. Hell, S. Klein, and R. Motwani. List partitions. SIAM Journal on Discrete Mathematics, 16(3):449 -- 478, 2003. [18] T. Feder, P. Hell, S. Klein, L. T. Nogueira, and F. Protti. List matrix partitions of chordal graphs. Theoretical Computer Science, 349(1):52 -- 66, 2005. [19] J. Flum and M. Grohe. Parameterized Complexity Theory. Springer, 2006. [20] M. C. Golumbic and U. Rotics. On the clique-width of some perfect graph classes. International Journal of Foundations of Computer Science, 11(03):423 -- 443, 2000. [21] H. Haghighi. A generalization of Villarreal's result for unmixed tripartite graphs. Bulletin of the Iranian Mathematical Society, 40(6):1505 -- 1514, 2014. [22] M. Kamiński, V. V. Lozin, and M. Milanič. Recent developments on graphs of bounded clique-width. Discrete Applied Mathematics, 157(12):2747 -- 2761, 2009. [23] R. M. Karp. Reducibility among combinatorial problems. Complexity of Computer Computations, pages 85 -- 103, 1972. [24] S. Kolay, F. Panolan, V. Raman, and S. Saurabh. Parameterized algorithms on perfect graphs for deletion to (r, (cid:96))-graphs. In Proc. of the 41st International Sym- posium on Mathematical Foundations of Computer Science (MFCS), volume 58 of LIPIcs, pages 75:1 -- 75:13, 2016. [25] M. Lampis. Algorithmic meta-theorems for restrictions of treewidth. Algorithmica, 64(1):19 -- 37, 2012. [26] M. Lesk, M. D. Plummer, and W. R. Pulleyblank. Equi-matchable graphs. Graph Theory and Combinatorics. Academic Press, pages 239 -- 254, 1984. 23 [27] R. Niedermeier. Invitation to Fixed-Parameter Algorithms, volume 31. Oxford University Press, 2006. [28] S.-I. Oum. Approximating rank-width and clique-width quickly. ACM Transactions on Algorithms, 5(1):10:1 -- 10:20, 2008. [29] M. D. Plummer. Some covering concepts in graphs. Journal of Combinatorial Theory, 8(1):91 -- 98, 1970. [30] F. P. Ramsey. On a problem of formal logic. Proceedings of the London Mathematical Society, s2-30(1):264 -- 286, 1930. [31] G. Ravindra. Well-covered graphs. Journal of Combinatorics, Information & System Sciences, 2(1):20 -- 21, 1977. [32] N. Robertson and P. D. Seymour. Graph minors. X. obstructions to tree- decomposition. Journal of Combinatorial Theory, Series B, 52(2):153 -- 190, 1991. [33] R. S. Sankaranarayana and L. K. Stewart. Complexity results for well-covered graphs. Networks, 22(3):247 -- 262, 1992. [34] L. Stockmeyer. Planar 3-colorability is polynomial complete. ACM SIGACT News, 5(3):19 -- 25, 1973. [35] D. Tankus and M. Tarsi. Well-covered claw-free graphs. Journal of Combinatorial Theory, Series B, 66(2):293 -- 302, 1996. [36] J. Topp and L. Volkmann. Well covered and well dominated block graphs and unicyclic graphs. Mathematica Pannonica, 1(2):55 -- 66, 1990. [37] R. H. Villarreal. Unmixed bipartite graphs. Revista Colombiana de Matemáticas, 41(2):393 -- 395, 2007. [38] R. Zaare-Nahandi and R. J. Golzari. Unmixed r-partite graphs. Bulletin of the Iranian Mathematical Society, in press, 2017. 24
1606.00001
1
1606
2016-05-30T21:04:19
Graph isomorphism testing boosted by path coloring
[ "cs.DS" ]
A method for improving the efficiency of graph isomorphism testing is presented. The method uses the structure of the graph colored by vertex hash codes as a means of partitioning vertices into equivalence classes, which in turn reduces the combinatorial burden of isomorphism testing. Unrolling the graph into a tree at each vertex allows structurally different regular graphs to be discriminated, a capability that the color refinement algorithm cannot do.
cs.DS
cs
Graph isomorphism testing boosted by path coloring Thomas E. Portegys, Dialectek, [email protected] Abstract A method for improving the efficiency of graph isomorphism testing is presented. The method uses the structure of the graph colored by vertex hash codes as a means of partitioning vertices into equivalence classes, which in turn reduces the combinatorial burden of isomorphism testing. Unrolling the graph into a tree at each vertex allows structurally different regular graphs to be discriminated, a capability that the color refinement algorithm cannot do. Key words: graph isomorphism, graph hashing, color refinement, vertex partitioning, equivalence classes. Introduction Numerous uses can be found for unique and concise graph identifiers: graphs could then be counted, sorted, compared and verified more easily. For example, chemical compounds could be specified by identifying their constituent molecules represented by graphs of spatial and bonding relationships between atoms. However, a problem with developing a method for identifying graphs is that graphs are very general objects. Uniquely identifying vertices and edges solves the problem but begs the question, since the problem then becomes how to arrive at these identifiers in a uniform fashion (Sayers and Karp, 2004). A method developed by Portegys (2008) identifies vertices by computing an MD5 hash (Rivest, 1992) for a tree of nodes rooted at each vertex. A vertex tree is composed by unrolling reachable vertices. Once each vertex is hashed, the vertex hashes are sorted and hashed to yield a hash for the graph, a technique similar to that used by Melnik and Dunham (2001) and Bhat (1980). The vertex hashing can be seen as a coloring process, along the lines of the well-known color refinement algorithm (Arvind et al., 2015; Grohe et al., 2014). Given a graph G, the color refinement algorithm (or naive vertex classification) iteratively computes a sequence of colorings Ci of V (G). The initial coloring C0 is uniform. Then, Ci+1(u) = {{ Ci(a) : a ∈ N(u) }}, (1) where {{. . .}} is a multiset operator. Note that C1(u) = C1(v) iff the two vertices have the same degree. Thus the coloring begins with a uniform coloring of the vertices of the graph and refines it step by step so that, if two vertices have equal colors but differently colored neighborhoods (with the multiplicities of colors counted), then these vertices get new different colors in the next refinement step. The algorithm terminates as soon as no further refinement is possible. Graphs are isomorphic if there is a consistent mapping between their vertices (Karp, 1972). For isomorphism testing of graphs G and H, the color refinement algorithm concludes that G and H are non-isomorphic if the multisets of colors occurring in these graphs are different. If this happens, the conclusion is correct. However, not all non-isomorphic graphs are distinguishable, or amenable, to color refinement. The simplest example is given by any two non-isomorphic regular graphs of the same degree with the same number of vertices, such as those shown in Figure 1. Figure 1 – Regular non-isomorphic graphs. Graph isomorphism testing, a problem that has long been believed to be of non-polynomial complexity (NP), has recently been the subject of renewed attention (Babai, 2015). Graph isomorphism is also of practical use in a number of areas, including mathematical chemistry and electronic design automation. A number of isomorphism testing algorithms are in use, e.g. the Ullman (1976) and Schmidt-Druffel (1976) algorithms. The Ullmann algorithm is one of the most commonly used for graph isomorphism because of its generality and effectiveness (Cordella, et. al., 2001). Graph coloring partitions vertices into equivalence classes of identical colors, which can reduce the complexity of isomorphism testing significantly. While the color refinement algorithm uses vertex degree as a shallow means of grouping vertices, using deep vertex hashing as a coloring method produces a finer discrimination of structure such that non- isomorphic regular graphs can be differentiated. For example, the hashes for the graphs depicted in Figure 1 will be different. Description This section describes the hashing algorithm. Graph format Using a pseudo-C++ notation, the following define a graph vertex and edge: Vertex { int label; Edge edges[]; }; Edge { int label; Vertex source; Vertex target; bool directed; }; This general scheme allows for a number of graph variations: labeled/unlabeled (using null labels), directed/undirected (for undirected, source and target are synonymous), and multigraphs. Algorithm The following object is used to construct MD5 hash codes based on vertex graph neighborhoods: VertexCoder { Vertex vertex; vector<Vertex *> vertexBranch; unsigned char code[MD5_SIZE]; void encode(bool hashLabels); void expand(); void contract(); }; The algorithm iteratively expands each vertex in the graph into tree of coder objects representing the vertices and edges in its neighborhood. Branching terminates when a duplicate vertex appears in a branch, at which point the terminal coder takes on the hashed value of the distance of the first appearance of the vertex in the branch. The graph hash code is then constructed by sorting and hashing the vertex codes. // Encode graph. // The boolean argument allows labels to be included in the // hash calculation. void encode(bool hashLabels) { if (vertex != NULL) { expand(); } int numChildren = children.size(); for (i = 0; i < numChildren; i++) { children[i]->coder->encode(hashLabels); children[i]->coder->contract(); } sort(children); input = new unsigned char[HASH_INPUT_SIZE]; if (vertex != NULL) { if (hashLabels) { append(input, vertex->label); } if (numChildren > 0) { for (i = 0; i < numChildren; i++) { edge = children[i]->edge; if (hashLabels) { append(input, edge->label); } if (edge->directed) { if (edge->source == vertex) { append(input, 1); } else { append(input, 0); } } else { append(input, 2); } } } else { for (i = 0; i < vertexBranch.size(); i++) { if (vertex == vertexBranch[i]) { break; } } i++; append(input, i); } } for (i = 0; i < numChildren; i++) { append(input, children[i]->coder->code); } code = MD5hash(input); } // Expand coder. void expand() { vector<Vertex *> childVertexBranch; Vertex *childVertex; VertexCoder *child; for (i = 0; i < vertexBranch.size(); i++) { if (vertex == vertexBranch[i]) { return; } childVertexBranch.push_back(vertexBranch[i]); } childVertexBranch.push_back(vertex); for (i = 0; i < vertex->edges.size(); i++) { if (vertex == vertex->edges[i]->source) { childVertex = vertex->edges[i]->target; } else { childVertex = vertex->edges[i]->source; } child = new VertexCoder(childVertex, childVertexBranch); children.push_back(child); } } // Contract coder. void contract() { for (i = 0; i < children.size(); i++) { delete children[i]->coder; delete children[i]; } children.clear(); } Since each of N vertices unrolls a tree of potentially N nodes, the algorithm complexity is O(N2). A proof of the algorithm appears challenging, but is currently underway. These initial results are provided with the hope of eliciting further insights. Example The method is illustrated through an example. Consider the simple directed graph shown in Figure 2. The vertices and edges are labeled for illustrative purposes, but the algorithm works for unlabeled vertices and edges as well as undirected edges. Figure 2 – A simple directed graph. Before the first call to encode(), the coder is configured as in Figure 3. This configuration reveals nothing about the edges in the graph, and thus must always be expanded. Figure 3 – Initial coder configuration. After the first expansion, the coder appears as in Figure 4. The (f) and (b) notation on the edges represent a directed edge in the source graph in the forward and backward direction respectively. Note that for vertex 0, there are 2 forward edges to vertices 1 and 2. For vertex 1, there is a forward and backward edge to vertex 2, and a backward edge to vertex 0. Vertex 2 has a forward and backward edge to vertex 1, and a backward edge to vertex 0. Although Figure 4 shows expanded vertices concurrently, in actuality a vertex is removed through contraction after its hash values is obtained by its parent. The expansion continues until each branch reaches a duplicate vertex. Figure 4 – First expansion. Figure 5 depicts how the terminal coder values for two branches in the expansion tree are assigned. On the left branch, the terminal is assigned a value of 1, as it is a duplicate of the first coder (shown double-bordered), which 1 distant from the root. Likewise the right terminal is a duplicate of the second coder and is assigned a value of 2. If the terminal coder has no duplicate, it is assigned the length of the branch as a value. Figure 5 – Branch terminal coder values. Results To highlight the potency of vertex partitioning using a coloring algorithm such as hashing, a comparison with brute force isomorphism testing is given in Table 1. For each isomorphism test, a graph with random edge connections and random vertex and edge labels is generated. Its isomorph is created by adding to each vertex and edge label the maximum label value of the original graph plus one. The number of search combinations to test isomorphism was measured. The relatively small graphs rapidly explodes in complexity for the brute force method, while the hashed method remains remarkably flat. Vertices x edges 5x5 5x10 10x10 10x20 15x15 Brute force Hashed 14.1 16.2 5465.9 1593.8 5108975 15.5 26.9 29.6 43.2 44.2 Table 1 – Isomorphism testing comparison. The results presented in Portegys (2008) validated the ability of the algorithm to uniquely hash unique graphs. Here we focused on the ability of the hash algorithm to discriminate regular graphs in comparison to the color refinement algorithm. A graph generation package (Johnsonbaugh and Kalin, 1991) was used to generate pairs of regular graphs with varying number of vertices and degrees. Each pair consisted of graphs having the equal quantities of vertices and equal degree. Some pairs were by chance isomorphic and others were non-isomorphic. The color refinement algorithm, as expected, classified all the pairs as isomorphic. The hash algorithm correctly distinguished all isomorphic and non- isomorphic pairs. Conclusion A method for boosting the efficiency of graph isomorphism testing has been presented. The method is able to discriminate graphs that elude the color refinement algorithm. The method builds on a previously developed technique for identifying graphs using MD5 hashing. The C++ code can be found here: http://sourceforge.net/projects/graph-hashing/ References V. Arvind, J. Köbler J., G. Rattan, O. Verbitsky (2015). Graph Isomorphism, Color Refinement, and Compactness. ECCC TR15-032. L. Babai (2015). Graph Isomorphism in Quasipolynomial Time. http://arxiv.org/abs/1512.03547 K. V. S. Bhat (1980). Refined vertex codes and vertex partitioning methodology for graph isomorphism testing. IEEE Trans. Systems Man Cybernet, 10(10) (1980) 610-615. L. P. Cordella, P. Foggia, C. Sansone, and M. Vento (2001). An Improved Algorithm for Matching Large Graphs. Proceedings of International Workshop on Graph-based Representation in Pattern Recognition, Ischia, Italy, pp. 149 - 159. M. Grohe, K. Kersting, M. Mladenov, E. Selman (2014). Dimension Reduction via Colour Refinement. In: Schulz, A.S., Wagner, D. (eds.) ESA 2014. LNCS, vol. 8737, pp. 505-516. Springer, Heidelberg. R. Johnsonbaugh and M. Kalin (1991). A graph generation software package. Proceedings of the twenty-second SIGCSE technical symposium on Computer science education. ACM New York, NY, USA. pp. 151-154. R. M. Karp (1972). Reducibility among combinatorial problems, in: R. E. Miller and J. W. Thatcher (Eds.), Complexity of Computer Computations (Plenum, New York) 85-103. S. Melnik (2001). RDF API draft: Cryptographic digests of RDF models and statements, http://www-db.stanford.edu/~melnik/rdf/api.html#digest. T. E. Portegys (2008). General Graph Identification by Hashing. http://arxiv.org/abs/1512.07263 R. Rivest (1992). RFC 1321 The MD5 Message-Digest Algorithm, http://tools.ietf.org/html/rfc1321. C. Sayers and A. H. Karp (2004). RDF Graph Digest Techniques and Potential Applications. Mobile and Media Systems Laboratory, HP Laboratories Palo Alto, HPL- 2004-95. D. C. Schmidt and L. E. Druffel (1976). A Fast Backtracking Algorithm to Test Directed Graphs for Isomorphism Using Distance Matrices. Journal of the Association for Computing Machinery, 23, pp. 433-445. J. R. Ullmann (1976). An Algorithm for Subgraph Isomorphism. Journal of the Association for Computing Machinery, vol. 23, pp. 31-42.
1712.07504
1
1712
2017-12-20T14:53:56
On Counting Perfect Matchings in General Graphs
[ "cs.DS" ]
Counting perfect matchings has played a central role in the theory of counting problems. The permanent, corresponding to bipartite graphs, was shown to be #P-complete to compute exactly by Valiant (1979), and a fully polynomial randomized approximation scheme (FPRAS) was presented by Jerrum, Sinclair, and Vigoda (2004) using a Markov chain Monte Carlo (MCMC) approach. However, it has remained an open question whether there exists an FPRAS for counting perfect matchings in general graphs. In fact, it was unresolved whether the same Markov chain defined by JSV is rapidly mixing in general. In this paper, we show that it is not. We prove torpid mixing for any weighting scheme on hole patterns in the JSV chain. As a first step toward overcoming this obstacle, we introduce a new algorithm for counting matchings based on the Gallai-Edmonds decomposition of a graph, and give an FPRAS for counting matchings in graphs that are sufficiently close to bipartite. In particular, we obtain a fixed-parameter tractable algorithm for counting matchings in general graphs, parameterized by the greatest "order" of a factor-critical subgraph.
cs.DS
cs
On Counting Perfect Matchings in General Graphs Daniel Stefankovic∗ Eric Vigoda† John Wilmes† December 21, 2017 Abstract Counting perfect matchings has played a central role in the theory of counting problems. The per- manent, corresponding to bipartite graphs, was shown to be #P-complete to compute exactly by Valiant (1979), and a fully polynomial randomized approximation scheme (FPRAS) was presented by Jerrum, Sinclair, and Vigoda (2004) using a Markov chain Monte Carlo (MCMC) approach. However, it has remained an open question whether there exists an FPRAS for counting perfect matchings in general graphs. In fact, it was unresolved whether the same Markov chain defined by JSV is rapidly mixing in general. In this paper, we show that it is not. We prove torpid mixing for any weighting scheme on hole patterns in the JSV chain. As a first step toward overcoming this obstacle, we introduce a new algorithm for counting matchings based on the Gallai–Edmonds decomposition of a graph, and give an FPRAS for counting matchings in graphs that are sufficiently close to bipartite. In particular, we obtain a fixed-parameter tractable algorithm for counting matchings in general graphs, parameterized by the greatest "order" of a factor-critical subgraph. 1 Introduction Counting perfect matchings is a fundamental problem in the area of counting/sampling problems. For an undirected graph G = (V, E), let P denote the set of perfect matchings of G. Can we compute (or estimate) P in time polynomial in n = V ? For which classes of graphs? A polynomial-time algorithm for the corresponding decision and optimization problems of determining if a given graph contains a perfect matching or finding a matching of maximum size was presented by Edmonds [2]. For the counting problem, a classical algorithm of Kasteleyn [9] gives a polynomial-time algorithm for exactly computing P for planar graphs. For bipartite graphs, computing P is equivalent to computing the permanent of n × n (0, 1)-matrices. Valiant [14] proved that the (0, 1)-Permanent is #P-complete. Subsequently attention turned to the Markov Chain Monte Carlo (MCMC) approach. A Markov chain where the mixing time is polynomial in n is said to be rapidly mixing, and one where the mixing time is exponential in Ω(n) is referred to as torpidly mixing. A rapidly mixing chain yields an FPRAS (fully polynomial-time randomized approximation scheme) for the corresponding counting problem of estimating P [8]. For dense graphs, defined as those with minimum degree > n/2, Jerrum and Sinclair [6] proved rapid mixing of a Markov chain defined by Broder [1], which yielded an FPRAS for estimating P. The Broder chain walks on the collection Ω = P∪N of perfect matchings P and near-perfect matchings N ; a near-perfect matching is a matching with exactly 2 holes or unmatched vertices. Jerrum and Sinclair [6], more generally, proved rapid mixing when the number of perfect matchings is within a poly(n) factor of the number of near-perfect matchings, i.e., P/N ≥ 1/poly(n). A simple example, referred to as a "chain of boxes" which is illustrated in Figure 1, shows that the Broder chain is torpidly mixing. This example was a useful testbed for catalyzing new approaches to solving the general permanent problem. Jerrum, Sinclair and Vigoda [7] presented a new Markov chain on Ω = P ∪N with a non-trivial weighting scheme on the matchings based on the holes (unmatched vertices). They proved rapid mixing for any bipartite graph with the requisite weights used in the Markov chain, and they presented a polynomial-time algorithm ∗University of Rochester, USA. Email: [email protected] †Georgia Institute of Technology, USA. Email: {vigoda,wilmesj}@gatech.edu 1 to learn these weights. This yielded an FPRAS for estimating P for all bipartite graphs. That is the current state of the art (at least for polynomial-time, or even sub-exponential-time algorithms). Could the JSV-Markov chain be rapid mixing on non-bipartite graphs? Previously there was no example for which torpid mixing was established, it was simply the case that the proof in [7] fails. We present a relatively simple example where the JSV-Markov chain fails for the weighting scheme considered in [7]. More generally, the JSV-chain is torpidly mixing on our class of examples for any weighting scheme based on the hole patterns, see Theorem 2.2 in Section 2 for a formal statement following the precise definition of the JSV-chain. A natural approach for non-bipartite graphs is to consider Markov chains that exploit odd cycles or blossoms in the manner of Edmonds' algorithm. We observe that a Markov chain which considers all blossoms for its transitions is intractable since sampling all blossoms is NP-hard, see Theorem 3.1. On the other hand, a chain restricted to minimum blossoms is not powerful enough to overcome our torpid mixing examples. See Section 3 for a discussion. Finally we utilize the Gallai–Edmonds graph decomposition into factor-critical graphs [2, 3, 4, 12] to present new algorithmic insights that may overcome the obstacles in our classes of counter-examples. In Section 4, we describe how the Gallai–Edmonds decomposition can be used to efficiently estimate P, the number of perfect matchings, in graphs whose factor-critical subgraphs have bounded order (Theorem 4.2), as well as in the torpid mixing example graphs (Theorem 4.3). Although all graphs are explicitly defined in the text below, figures depicting these graphs are deferred to the appendix, 1.1 Markov Chains Consider an ergodic Markov chain with transition matrix P on a finite state space Ω, and let π denote the unique stationary distribution. We will usually assume the Markov chain is time reversible, i.e., that it satisfies the detailed balance condition π(x)P (x, y) = π(y)P (x, y) for all states x, y ∈ Ω. (cid:80) For a pair of distributions µ and ν on Ω we denote their total variation distance as dTV(µ, ν) = x∈Ω µ(x) − ν(x). The standard notion of mixing time Tmix is the number of steps from the worst starting state X0 = i to reach total variation distance ≤ 1/4 of the stationary distribution π, i.e., we write Tmix = maxi∈Ω min{t : dTV(P t(i,·), π) ≤ 1/4}. We use conductance to obtain lower bounds on the mixing time. For a set S ⊂ Ω its conductance is 1 2 defined as: Φ(S) = x∈S,y /∈S π(x)P (x, y) . x∈S π(x) (cid:80) (cid:80) Let Φ∗ = minS⊂Ω:π(S)≤1/2 Φ(S). Then (see, e.g., [13, 10]) Tmix ≥ 1 4Φ∗ . (1) 1.2 Factor-Critical Graphs A graph G = (V, E) is factor-critical if for every vertex v ∈ V , the graph induced on V \ {v} has a perfect matching. (In particular, V is odd.) Factor-critical graphs are characterized by their "ear" structure. The quotient G/H of a graph G by a (not necessarily induced) subgraph H is derived from G by deleting all edges in H and contracting all vertices in H to a single vertex vH (possibly creating loops or multi-edges). An ear of G relative a subgraph H of G is simply a cycle in G/H containing the vertex vH . C0 ∪ ··· ∪ Cr such that C0 is a single vertex, and Ci is an odd-length ear in G relative to (cid:83) Theorem 1.1 (Lov´asz [11]). A graph G is factor-critical if and only if there is a decomposition G = j<i Cj, for all 0 < i ≤ r. Furthermore, if G is factor critical, there exists such a decomposition for every choice of vertex C0, and the order r of the decomposition is independent of all choices. 2 Since the number of ears in the ear decomposition of a factor-critical graph depends only on the graph, and not on the choice made in the decomposition, we say the order of the factor-critical graph G is the number r of ears in any ear decomposition of G. Factor-critical graphs play a central role in the Gallai–Edmonds structure theorem for graphs. We state an abridged version of the theorem below. Given a graph G, let D(G) be the set of vertices that remain unmatched in at least one maximum matching of G. Let A(G) be the set of vertices not in D(G) but adjacent to at least one vertex of D(G). And let C(G) denote the remaining vertices of G. Theorem 1.2 (Gallai–Edmonds Structure Theorem). The connected components of D(G) are factor-critical. Furthermore, every maximum matching of G induces a perfect matching on C(G), a near-perfect matching on each connected component of D(G), and matches all vertices in A(G) with vertices from distinct connected components of D(G). 2 The Jerrum–Sinclair–Vigoda Chain Ω = P ∪(cid:83) We recall the definition of the original Markov chain proposed by Broder [1]. The state space of the chain is u,v N (u, v) where P is the collection of perfect matchings and N (u, v) are near-perfect matchings with holes at u and v (i.e., vertices u and v are the only unmatched vertices). The transition rule for a matching M ∈ Ω is as follows: 1. If M ∈ P, randomly choose an edge e ∈ M and transition to M \ {e}. 2. If M ∈ N (u, v), randomly choose a vertex x ∈ V . If x ∈ {u, v} and u is adjacent to v, transition to M ∪ {(u, v)}. Otherwise, let y ∈ V be the vertex matched with x in M , and randomly choose w ∈ {u, v}. If x is adjacent to w, transition to the matching M ∪ {(x, w)} \ {(x, y)}. The chain XB is symmetric, so its stationary distribution is uniform. In particular, when P/Ω is at least inverse-polynomial in n, we can efficiently generate uniform samples from P via rejection sampling, given access to samples from the stationary distribution of XB. In order to sample perfect matchings even when Ω/P is exponentially large, Jerrum, Sinclair, and Vigoda [7] introduce a new chain XJSV that changes the stationary distribution of XB by means of a Metropo- lis filter. The new stationary distribution is uniform across hole patterns, and then uniform within each hole pattern, i.e., for every M ∈ Ω, the stationary probability of M is proportional to 1/N (u, v) if M ∈ N (u, v), and proportional to 1/P if M ∈ P. We define XJSV in greater detail. For M ∈ Ω, define the weight function (cid:40) 1P 1 N (u,v) w(M ) = if M ∈ P if M ∈ N (u, v) (2) Definition 2.1. The chain XJSV has the same state space as XB. The transition rule for a matching M ∈ Ω is as follows: 1. First, choose a matching M(cid:48) ∈ Ω to which M may transition, according to the transition rule for XB 2. With probability min{1, w(M(cid:48))/w(M )}, transition to M(cid:48). Otherwise, stay at M . In their paper, Jerrum, Sinclair, and Vigoda [7] in fact analyze a more general version of the chain XJSV that allows for arbitrary edge weights in the graph. They show that the chain is rapidly mixing for bipartite graphs G. (They also study the separate problem of estimating the weight function w, and give a "simulating annealing" algorithm that allows the weight function w to be estimated by gradually adjusting edge weights to obtain an arbitrary bipartite graph G from the complete bipartite graph.) Their analysis of the mixing time uses a canonical paths argument that crucially relies on the bipartite structure of the graph. However, it remained an open question whether a different analysis of the same chain XJSV, perhaps using different canonical paths, might generalize to non-bipartite graphs. We rule out this approach. In fact, we rule out a more general family of Markov chains for sampling perfect matchings. We say a Markov chain is "of XJSV type" if it has the same state space as XJSV, with transitions as defined in 3 Definition 2.1, for some weight function w(M ) (not necessarily the same as in Eq. (2)) depending only the hole pattern of the matching M . Theorem 2.2. There exists a graph G on n vertices such that for any Markov chain X of XJSV type on G, either the stationary probability of P is at most exp(−Ω(n)), or the mixing time of X is at least exp(Ω(n)). The graph G of Theorem 2.2 is constructed from several copies of a smaller gadget H, which we now define. Definition 2.3. The chain of boxes gadget Bk of length k is the graph on 4k vertices depicted in Figure 1. To construct Bk, we start with a path P2k−1 = v0, v1, . . . , v2k of length 2k − 1. Then, for every even edge {v2i, v2i+1} on the path, we add two additional vertices ai, bi, along with edges to form a path v2i, ai, bi, v2i+1 of length 3. Figure 1: The "chain of boxes" gadget Bk, which has 2k perfect matchings, but only a single matching in N (v0, v2k+1). Observation 2.4. The chain of boxes gadget Bk has 2k perfect matchings, but only one matching in N (v0, v2k+1). Definition 2.5. The torpid mixing gadget Hk is the graph depicted in Figure 2. To construct H, first take a C12 and label two antipodal vertices as a and b. Add an edge between a and b, and label the two vertices farthest from a and b as u and v. Label the neighbor of u closest to a as w1, and the other neighbor of u as w2. Label the neighbor of v closest to a as z1 and the other neighbor of v as z2. Finally, add four chain-of-boxes gadgets Bk, identifying the vertices v0 and v2k of the gadgets with w1 and a, with a and z1, with w2 and b, and with b and z2, respectively. Note that in Figures 2 and 3, one "box" from each copy of Bk in the torpid mixing gadget is left undrawn, for visual clarity. Lemma 2.6. The torpid mixing gadget H = Hk has 16k + 4 vertices and exactly 2 perfect matchings. Furthermore, NH (u, v) = 1 and NH (x1, v) ≥ 2k. Proof. A matching M ∈ NH (u, v) is depicted in Figure 2. We argue that M is the only matching in N (u, v). First note that x1 must be matched with either w1 or a. Either choice forces the matching on the "chain of boxes" above x1 remain identical to M . But then if x1 is matched with a, there are no vertices to which w1 can be matched. So x1 must be matched with w1, and the choice of edge for x2, y1, and y2 is forced symmetrically, giving the matching M . Similarly, there are exactly two perfect matchings of H. Vertex u is matched with either w1 or w2, and either choice determines all other edges. In particular, if u is matched with w1, then x1 must be matched with a, and y1 with z1, and so on along the entire 12-cycle containing u and v. The edges on the four "chains of boxes" are then also completely determined. The other case, when u is matched with w2, is symmetric. We now argue that NH (x1, v) ≥ 2k. Starting from the matching M(cid:48) ∈ NH (x1, v) depicted in Figure 3, each of the k copies of C4 in the chain of boxes above x1 can be independently alternated, giving 2k distinct matchings in NH (x1, v). The torpid mixing gadget already suffices on its own to show that the Markov chain XXJSV defined in [7] is torpidly mixing. In particular, the conductance out of the set NH (x1, v) ⊆ Ω(H) is 2−Ω(k). In order to prove the stronger claim of Theorem 2.2, that every Markov chain of XJSV-type fails to efficiently sample perfect matchings, we construct a slightly larger graph from copies of the torpid mixing gadgets. 4 v0a0b0v1v2a1b1v3...v2kakbkv2k+1 Figure 2: The torpid mixing gadget Hk. The unique matching M ∈ N (u, v) is depicted with thick edges. Definition 2.7. The counterexample graph Gk is the graph depicted in Figure 4. It is defined by replacing every third edge of the twelve-cycle C12 with the gadget Hk defined in Figure 2. Specifically, let {ui, vi} be the 3i-th edge of C12 for i ∈ {1, . . . , 4}. We delete each edge {ui, vi} and replace it with a copy of H, identifying the vertices u and v of H with vertices ui and vi of C12. The resulting graph is Gk. Thus, of the 12 original vertices in C12, 8 of the corresponding vertices in Gk participate in a copy of the gadget H, and 4 do not. These 4 vertices of Gk which do not participate in any copy of the gadget H are labeled t1, . . . , t4 in cyclic order, and the copies of the gadget H are labeled H1, . . . H4 in cyclic order, with H1 coming between t1 and t2, and so on. Thus, t1 is adjacent to u1 and v4, ti is adjacent to ui and vi−1 for i ∈ {2, . . . , 4}, and Hi contains both ui and vi. In particular, Gk has 4V (H) + 4 = 64k + 8 vertices. The perfect and near-perfect matchings of Gk are naturally divided into four intersecting families. For i ∈ {1, . . . , 4} we define Si to be the collection of (perfect and near-perfect) matchings M ∈ Ω(Gk) such that the restriction of M to Hi has two holes, at ui and vi, i.e., such that the vertices ui and vi either have holes in M or are matched outside of Hi. Lemma 2.8. The counterexample graph Gk has exactly 8 perfect matchings. Of these, 4 are in S1 ∩ S3 \ (S2 ∪ S4) and 4 are in S2 ∩ S4 \ (S1 ∪ S3). Proof. The graph Gk has exactly 8 perfect matchings. To obtain a matching in S1 ∩ S3 \ (S2 ∪ S4), we may without loss of generality start by matching the vertices in H1 and H3 according to a matching in NH1 (u1, v1) or NH3(u3, v3), respectively. We must then match t1 with u1, t2 with v1, t3 with u3, and t4 with v3. Finally, we must match the remaining vertices according to a perfect matching on each of H2 and H4. By Lemma 2.6, there are two perfect matchings on each of H2 and H4, and a unique matching in each of NH1 (u1, v1) and NH3 (u3, v3), so indeed there are four matchings in (S1 ∩ S3) \ (S2 ∪ S4). Similarly, there are exactly four matchings in (S2 ∩ S4) \ (S1 ∪ S3). To see that there are no other perfect matchings, let M be an arbitrary perfect matching of Gk. Then t1 is matched either with u1 or v4. Suppose t1 is matched with u1. Then v4 is matched within H4. Since H4 has an even number of vertices, u4 must also be matched within H4, and hence M induces a perfect matching on H4. Continuing in a similar fashion, M must also induce a perfect matching on H2. Then the restriction of M to H1 or H3 has holes at u1 and v1, and at u3 and v3, respectively, so M ∈ S1∩S3\(S2∪S4). Symmetrically, if t1 is matched with v4 then M ∈ S2 ∩ S4 \ (S1 ∪ S3). In the proof below, we use the notation N (M ) denote the collection of matchings with the hole pattern as M . That is, N (M ) = P if M ∈ P, and N (M ) = N (u, v) if M ∈ N (u, v). 5 uw1x1ax2w2y1z1vz2y2............ Figure 3: A matching M(cid:48) ∈ N (x1, v). There are exponentially many matchings with the same hole pattern, obtained by alternating the 4-cycles above x1. Figure 4: The "counterexample graph" Gk on which XJSV is torpidly mixing. The boxes labeled Hk represent copies of the torpid mixing gadget of Definition 2.5. Proof of Theorem 2.2. Let Gk be the counterexample graph of Definition 2.7. We will show that the set S1 ∪ S3 ⊆ Ω(Gk) has poor conductance, unless the stationary probability of PGk is small. We will write A = S1 ∪ S3 and A = Ω(Gk) \ (S1 ∪ S3). Let M ∈ A and M(cid:48) ∈ A be such that P (M, M(cid:48)) > 0. We claim that neither M nor M(cid:48) are perfect matchings. Assume without loss of generality that M ∈ S1. If M ∈ S1 is a perfect matching, then M ∈ P2 and so M ∈ S3. The only legal transitions from M to Ω\ S1 are those that introduce additional holes within H1, but none of these transitions to a matching outside of S3. Hence, M cannot be perfect. But if M(cid:48) is perfect, then M(cid:48) ∈ P1, and so M(cid:48) induces a perfect matching on S1. But then the transition from M to M(cid:48) must simultaneously affect u1 and v1, and no such transition exists. We denote by ∂A the set of matchings M(cid:48) ∈ A such that there exists a matching M ∈ A with P (M, M(cid:48)) > 0. We claim that for every matching M(cid:48) ∈ A, we have N (M (cid:48)) ∩ ∂A ≤ 2k−1N (M (3) Let M(cid:48) ∈ ∂A, and let M ∈ A be such that P (M, M(cid:48)) > 0. Suppose first that M ∈ S1. Label the vertices of H1 as in Figure 2, identifying u1 with u and v1 with v. Let N be the matching on H = H1 induced by M , and let N(cid:48) be the matching on H1 induced by M(cid:48). We have N ∈ NH (u1, v1). But by Lemma 2.6, we have NH (u1, v1) = 1, i.e., N is exactly the matching depicted in Figure 2. The only transitions that (cid:48)) . 6 x1v............t1u1v1t2u2v2t3u3v3t4u3v3HkHkHkHk remove the hole at u are the two that shift the hole to x1 or x2, and the only transitions that remove the hole at v are the two that shift the hole to y1 or y2. So, without loss of generality, by the symmetry of Gk, we have N(cid:48) ∈ NH (x1, v1). By Lemma 2.6, NH (x1, v1) ≥ 2k, but only one matching in NH (x1, v1) has a legal transition to N . Therefore, if we replace the restriction of M(cid:48) to H1 with any other matching in NH (x1, v1), we obtain another matching M(cid:48)(cid:48) ∈ N (M(cid:48)), but M(cid:48)(cid:48) has no legal transition to any matching in N (M ). Hence, only a 2−k-fraction of N (M(cid:48)) has a legal transition to S1, and similarly only a 2−k-fraction of N (M(cid:48)) has a legal transition to S3. In particular, we have proved Eq. (3). From Eq. (3), it immediately follows that the stationary probability of ∂A is (cid:88) (cid:88) π(∂A) = (cid:48)) = π(M M(cid:48)∈∂A M(cid:48)∈A (cid:48)) π(M N (M(cid:48)) ∩ ∂A N (M(cid:48)) = 2−k+1π(A) (4) We now compute (cid:88) M∈A,M (cid:48) P (M,M (cid:48)∈A )>0 π(M )P (M, M (cid:48)) = (cid:88) M∈A,M (cid:48) P (M,M (cid:48)∈A )>0 (cid:48))P (M (cid:48) , M ) ≤ π(∂(A)) π(M < 2−k+1π(A), where we first use the detailed balance condition and then Eq. (4). Now by (1) and the definition of conductance, we have 1 4τX < Φ(A) < 2−k π(A) π(A) . In particular, if τX < 2k/2−2, then π(A) > 2k/2+1π(A). Suppose this is the case. By Lemma 2.8, half In particular, π(PGk ) ≤ 2π(A) < 2−k/2+2. Hence, either of the perfect matchings of Gk belong to A. the stationary probability of P is at most 2−k/2+2 = exp(−Ω(n)), or the mixing time of X is at least 2k/2−2 = exp(Ω(n)). We remark that the earlier Markov chain studied by Broder [1] and Jerrum and Sinclair [6] is also torpidly mixing on the counterexample graph of Definition 2.7, since the ratio of near-perfect matchings to perfect matchings is exponential [6]. 3 Chains Based on Edmonds' Algorithm Given that Edmonds' classical algorithm for finding a perfect matching in a bipartite graph requires the careful consideration of odd cycles in the graph, it is reasonable to ask whether a Markov chain for counting perfect matchings should also somehow track odd cycles. In this section, we briefly outline some of the difficulties of such an approach. A blossom of length k in a graph G equipped with a matching M is simply an odd cycle of length 2k + 1 in which k of the edges belong to M . Edmonds' algorithm finds augmenting paths in a graph by exploring the alternating tree rooted at an unmatched vertex, and contracting blossoms to a vertex as they are encountered. Given a blossom B containing an unmatched vertex u, there is an alternating path of even length to every vertex v ∈ B. Rotating B to v means shifting the hole at u to v by alternating the u-v path in B. Adding rotation moves to a Markov chain in the style of XJSV is an attractive possible solution to the obstacles presented in the previous section. Indeed, if it were possible to rotate the 7-cycle containing u and a in the graph in Figure 2, it might be possible to completely avoid problematic holes at x1 or x2. The difficulty in introducing such an additional move the Markov chain XJSV is in defining the set of feasible blossoms that may be rotated, along with a probability distribution over such blossoms. In order to be useful, we must be able to efficiently sample from the feasible blossoms at a given near-perfect matching M . Furthermore, the feasible blossoms must respect time reversibility: if B is feasible when the hole is at u ∈ B, then it must also be feasible after rotating the hole to v ∈ B; reversibility of the Markov chain is 7 Figure 5: After rotating the blossom so that the hole is moved from u to v, the blossom is no longer "minimal". needed so that we understand its stationary distribution. Finally, the feasible blossoms must be rich enough to avoid the obstacles outlined in the previous section. The set of "minimum length" blossoms at a given hole vertex u satisfies the first criterion of having an efficient sampling algorithm. But it is easy to see that if only minimum length blossoms are feasible, then the obstacles outlined in the previous section will still apply (simply by adding a 3-cycle at every vertex). Moreover, families blossoms characterized by minimality may struggle to satisfy the second criterion of time- reversibility. In Figure 5, there is a unique blossom containing u, but after rotating the hole to v, it is no longer minimal. On the other hand, the necessity of having an efficient sampling algorithm for the feasible blossoms already rules out the simplest possibility, namely, the uniform distribution over all blossoms containing a given hole vertex u. Indeed, if we could efficiently sample from the uniform distribution over all blossoms containing a given vertex u, then by an entropy argument we could find arbitrarily large odd cycles in the graph, which is NP-hard. Theorem 3.1. Let Sampling Blossoms problem be defined as follows. The input is an undirected graph G and a near-perfect matching M with holes at w, r ∈ V (G). The output is a uniform sample from the uniform distribution of blossoms containing w. Unless NP=RP there is no randomized polynomial-time sampler for Sampling Blossoms. Proof. We reduce from the problem of finding the longest s-t-path in a directed graph H (ND29 in [5]). We construct an instance of Sampling Blossoms, that is, G and M as follows. For every v ∈ V (H) we add two vertices v0, v1 into V (G) and also add {v0, v1} into M . For every edge (u, v) ∈ E(H) we add edge {u1, v0} into E(G). Finally we add w, r into V (H) and {w, s0},{t1, w} into E(H). Note that there is one-to-one correspondence between blossoms that contain w in G and s-t-paths in H. We now modify G to "encourage longer paths". We replace each {v0, v1} edge in G by a chain of boxes (with (cid:96) boxes) and replace {v0, v1} in M by the unique perfect matching of the chain of boxes. In the modified graph G for every s-t-path p in H there are now 2k(cid:96) blossoms that contain w in G, where k is the number of vertices in p. Taking (cid:96) = n2 a uniformly random blossom that contains w in G will with probability 1− o(1) correspond to a longest s-t-path in H (the number of s-t-paths is bounded by (n+1)n = 2O(n log n) and hence the fraction of blossoms corresponding to non-longest s-t-paths is 2O(n log n)2−n2 = o(1)). 4 A Recursive Algorithm We now explore a new recursive algorithm for counting matchings, based on the Gallai–Edmonds decompo- sition. In the worst case, this algorithm may still require exponential time. However, for graphs that have additional structural properties, for example, those that are "sufficiently close to bipartite" in a sense that will be made precise, our recursive algorithm runs in polynomial time. In particular, it will run efficiently on examples similar to those used to prove torpid mixing of Markov chains in the previous section. We now state the algorithm. It requires as a subroutine an algorithm for computing the permanent of the bipartite adjacency matrix of a bipartite graph G up to accuracy ε. We denote this subroutine by Permanent(G, ε). The Permanent subroutine requires time polynomial in V (G) and 1/ε using the algorithm of Jerrum, Sinclair, and Vigoda [7], but we use it as a black-box. We first argue the correctness of the algorithm. 8 uv Algorithm 1 Recursive algorithm for approximately counting the number of perfect matchings in a graph 1: procedure Recursive-Count(G, ε) 2: If V (G) = ∅, return 1. Choose u ∈ V (G). Compute the Gallai–Edmonds decomposition of G − u. for all v ∈ D(G − u) do Hv ← the connected component of G − u containing v mv ← Recursive-Count(Hv − v, ε/(2n)) end for mC ← Recursive-Count(C(G − u), ε/3) Let X = A(G − u) ∪ {u}, and let Y be the set of connected components in D(G − u). Let G(cid:48) be the bipartite graph on (X, Y ) defined as follows: for every x ∈ X and H ∈ Y , if x has any neighbors in H in G(cid:48), add an edge {x, H} in G(cid:48) with weight 3: 4: 5: 6: 7: 8: 9: 10: w(x, H) = return mC ∗ Permanent(G(cid:48), ε/3) 11: 12: end procedure (cid:88) mv . v∈N (x)∩H Theorem 4.1. Algorithm 1 computes the number of perfect matchings in G to within accuracy ε. Proof. We show that the algorithm is correct for graphs on n vertices, assuming it is correct for all graphs on at most n − 1 vertices. We claim that permanent of the incidence matrix of G(cid:48) defined on line 10 equals the number of perfect matchings in G. Indeed, every perfect matching M of G induces a maximum matching Mu on G − u. By the Gallai–Edmonds theorem, Mu matches each element of A(G(cid:48)) with a vertex from a distinct component of D(G(cid:48)), leaving one component of D(G(cid:48)) unmatched. Vertex u must therefore be matched in M with a vertex from the remaining component of D(G(cid:48)). Therefore, M induces a perfect matching M(cid:48) on G(cid:48). Now let Hx ∈ Y be the vertex of G(cid:48) matched to x for each x ∈ X. Then the number of distinct matchings of G inducing the same matching M(cid:48)(cid:48) on G(cid:48)(cid:48) is exactly (cid:89) with Hx defined as above, we obtain(cid:81) x∈X (cid:88) v∈N (x)∩Hx (cid:89) x∈X mv = w(x, Hx) which is the contribution of M(cid:48) to the permanent of G(cid:48). Similarly, from an arbitrary matching M(cid:48) of G(cid:48), Hence, it suffices to to compute the permanent of the incidence matrix of G(cid:48) up to accuracy ε. We know the entries of the incidence matrix up to accuracy ε/(2n), and (1 + ε/(2n))n/2 < 1 + ε/3 for ε sufficiently small. Therefore, it suffices to compute the permanent of our approximation of the incidence matrix up to accuracy ε/3 to get overall accuracy better than ε. x∈X w(x, Hx) matchings of G, proving the claim. The running time of Algorithm 1 is sensitive to the choice of vertex u on line 3. If u can be chosen so that each component of D(G − u) is small, then the algorithm is an efficient divide-and-conquer strategy. More generally, if u can be chosen so that each component of D(G− u) is in some sense "tractable", then an efficient divide-and conquer strategy results. In particular, since it is possible to exactly count the number of perfect matchings in a factor-critical graph of bounded order in polynomial time, we obtain an efficient algorithm for approximately counting matchings in graphs whose factor-critical subgraphs have bounded order. This is the sense in which Algorithm 1 is efficient for graphs "sufficiently close" to bipartite. Theorem 4.2. Suppose every factor-critical subgraph of G has order at most k. Then the number of perfect matchings in G can be counted to within accuracy ε in time 2O(k)poly(n, 1/ε). The essential idea of the proof is to first observe that a factor-critical graph can be shrunk to a graph with O(k) edges having the same number of perfect matchings after deleting any vertex. The number of 9 perfect matchings can then be counted by brute force in time 2O(k)poly(n). This procedure replaces the recursive calls on line 6 of the algorithm. Proof. We first observe that if H is a factor-critical graph of order k with n vertices, then the number of perfect matchings in H − v can be counted exactly in time 2O(k)poly(n) for every vertex v. Writing du for the degree of a vertex u, we have (du − 2) = 2(k − 1), (5) (cid:88) u∈V (H) since adding one ear to a graph adds some number of vertices of degree 2, and increases the degree of two existing vertices by one each, or one vertex by two. Fix v ∈ H, and suppose there is a vertex u of degree 2 in H − v, with neighbors w1 and w2. Let H(cid:48) denote the multigraph obtained from H − v by contracting the edges from u to w1 and w2, so H(cid:48) has two fewer vertices than H, and has a vertex w with the same multiset of neighbors as w1 and w2 (excluding v). Then there is a bijection between the perfect matchings of H(cid:48) and of H − v; each perfect matching of H(cid:48) lifts to a matching of H − v with a hole at u and exactly one of w1 or w2, and each perfect matching of H − v projects to a perfect matching of H(cid:48) by ignoring the matched edge at u. Hence, we may contract away all degree-2 vertices of H − v, and obtain a graph with the same number of perfect matchings in which every vertex (save at most two of degree 1, the former neighbors of v) has degree at least 3. Then since the contraction does not change the sum in Eq. (5), we have (cid:48)) − 2) ≤ (cid:88) 3(V (H du ≤ 2(k − 1) + 2V (H (cid:48)) u∈V (H(cid:48)) and hence H(cid:48) has O(k) edges, and the perfect matchings of H(cid:48) can be enumerated in time 2O(k). Now we modify Algorithm 1 to run in time 2O(k)poly(n, 1/ε). First, we delete all edges not appearing in any perfect matching, call Recursive-Count(Gi, ε/(2n)) on each connected component Gi, and multiply the results of all of these calls to estimate the number of perfect matchings in G. We have C(Gi − u) = ∅ for each such component Gi and every vertex u ∈ V (Gi), since edges leaving C(Gi − u) cannot appear in any matching of Gi − u. Therefore, the recursive call on line 8 of the algorithm can be eliminated. On line 6, instead of computing mv by a recursive call, we instead use the procedure described above to compute it in time 2O(k). Hence, Algorithm 1 requires O(n) calls to a procedure that takes time 2O(k). The other lines of Algorithm 1 require only polynomial time in n and 1/ε, so in all Algorithm 1 requires time 2O(k)poly(n, 1/ε). We note that Theorem 4.2 is proved by eliminating recursive calls in the algorithm. Although the recursive calls of Algorithm 1 can be difficult to analyze, they can also be useful, as we now demonstrate by showing that Algorithm 1 runs as-is in polynomial time on the counterexample graph of Definition 2.7, for appropriate choice of the vertex u on the line 3 of the algorithm. Theorem 4.3. Algorithm 1 runs in polynomial time on the counterexample graph of Definition 2.7, for appropriate choice of the vertex u on the line 3 of the algorithm Proof. After deleting the vertices u and v from the torpid mixing gadget H in Figure 2, no odd cycles remain the graph H. Let U denote the set of all four copies of the vertices u and v appearing in the counterexample graph G, so U = 8. With every recursive call Recursive-Count(G(cid:48), ε(cid:48)), if U ∩ V (G(cid:48)) (cid:54)= ∅, we choose u ∈ U ∩V (G(cid:48)). Hence, after 8 recursive calls, there are no odd cycles remaining in G(cid:48), and each factor-critical subgraph is a single vertex. When U ∩ V (G(cid:48)) = ∅, we choose u so that A(G(cid:48) − u) = Ω(n)-for example taking u at one end of a chain of boxes-so that the overall recursive depth is O(1). Acknowledgements This research was supported in part by NSF grants CCF-1617306, CCF-1563838, CCF-1318374, and CCF- 1717349. The authors are grateful to Santosh Vempala for many illuminating conversations about Markov chains and the structure of factor-critical graphs. 10 References [1] A. Z. Broder. How hard is it to marry at random? (On the approximation of the permanent), Proceed- ings of the 18th Annual ACM Symposium on Theory of Computing (STOC), 50–58, 1986. Erratum in Proceedings of the 20th Annual ACM Symposium on Theory of Computing, p. 551, 1988. [2] J. Edmonds. Paths, trees, and flowers. Canadian Journal of Mathematics, 17:449–467, 1965. [3] T. Gallai. Kritische Graphen II. Magyar Tud. Akad. Mat. Kutat´o Int. Kozl., 8:273–395, 1963. [4] T. Gallai. Maximale systeme unabhangiger kanten. Magyar Tud. Akad. Mat. Kutat´o Int. Kozl., 9:401– 413, 1964. [5] M. R. Garey and D. S. Johnson. Computers and Intractability: A Guide to the Theory of NP- Completeness. W. H. Freeman & Co., New York, NY, 1979. [6] M. Jerrum and A. Sinclair. Approximating the permanent. SIAM Journal on Computing, 18(6):1149– 1178, 1989. [7] M. Jerrum, A. Sinclair, and E. Vigoda. A polynomial-time approximation algorithm for the permanent of a matrix with non-negative entries. Journal of the ACM, 51(4):671–697, 2004. [8] M. R. Jerrum, L. G. Valiant, and V. V. Vazirani. Random generation of combinatorial structures from a uniform distribution. Theoret. Comput. Sci., 43(2-3):169–188, 1986. [9] P. W. Kasteleyn. Graph theory and crystal physics. In Graph Theory and Theoretical Physics, pages 43–110. Academic Press, London, 1967. [10] D. A. Levin, Y. Peres, and E. L. Wilmer. Markov Chains and Mixing Times. American Mathematical Society, Providence, RI, 2009. [11] L. Lov´asz. A note on factor-critical graphs. Studia Sci. Math. Hungar, 7(11):279–280, 1972. [12] A. Schrijver. Theory of Linear and Integer Programming. Wiley, 1998. [13] A. J. Sinclair. Algorithms for Random Generation and Counting: A Markov Chain Approach, Birkhauser, 1988. [14] L. G. Valiant. The complexity of computing the permanent. Theoretical Computer Science, 8(2):189–201, 1979. 11
1612.06962
2
1612
2017-10-11T03:24:57
Stochastic Runtime Analysis of a Cross Entropy Algorithm for Traveling Salesman Problems
[ "cs.DS", "cs.AI", "cs.NE" ]
This article analyzes the stochastic runtime of a Cross-Entropy Algorithm on two classes of traveling salesman problems. The algorithm shares main features of the famous Max-Min Ant System with iteration-best reinforcement. For simple instances that have a $\{1,n\}$-valued distance function and a unique optimal solution, we prove a stochastic runtime of $O(n^{6+\epsilon})$ with the vertex-based random solution generation, and a stochastic runtime of $O(n^{3+\epsilon}\ln n)$ with the edge-based random solution generation for an arbitrary $\epsilon\in (0,1)$. These runtimes are very close to the known expected runtime for variants of Max-Min Ant System with best-so-far reinforcement. They are obtained for the stronger notion of stochastic runtime, which means that an optimal solution is obtained in that time with an overwhelming probability, i.e., a probability tending exponentially fast to one with growing problem size. We also inspect more complex instances with $n$ vertices positioned on an $m\times m$ grid. When the $n$ vertices span a convex polygon, we obtain a stochastic runtime of $O(n^{3}m^{5+\epsilon})$ with the vertex-based random solution generation, and a stochastic runtime of $O(n^{2}m^{5+\epsilon})$ for the edge-based random solution generation. When there are $k = O(1)$ many vertices inside a convex polygon spanned by the other $n-k$ vertices, we obtain a stochastic runtime of $O(n^{4}m^{5+\epsilon}+n^{6k-1}m^{\epsilon})$ with the vertex-based random solution generation, and a stochastic runtime of $O(n^{3}m^{5+\epsilon}+n^{3k}m^{\epsilon})$ with the edge-based random solution generation. These runtimes are better than the expected runtime for the so-called $(\mu\!+\!\lambda)$ EA reported in a recent article, and again obtained for the stronger notion of stochastic runtime.
cs.DS
cs
Stochastic Runtime Analysis of a Cross-Entropy Algorithm for Traveling Salesman Problems Zijun Wua,1,∗, Rolf H. Mohringb,2,∗∗, Jianhui Laic, aBeijing Institute for Scientific and Engineering Computing (BISEC), Pingle Yuan 100, bBeijing Institute for Scientific and Engineering Computing (BISEC), Pingle Yuan 100, cCollege of Metropolitan Transportation, Beijing University of Technology, Pingle Yuan Beijing, P. R. China Beijing, P. R. China 100, Beijing, P. R. China Abstract This article analyzes the stochastic runtime of a Cross-Entropy Algorithm mimicking an Max-Min Ant System with iteration-best reinforcement. It investigates the impact of magnitude of the sample size on the runtime to find optimal solutions for TSP instances. For simple TSP instances that have a {1, n}-valued distance function and a unique optimal solution, we show that sample size N ∈ ω(ln n) results in a stochastically polynomial runtime, and N ∈ O(ln n) results in a stochastically exponential runtime, where "stochastically" means with a probability of 1 − In particular, for N ∈ ω(ln n), n−ω(1), and n represents number of cities. we prove a stochastic runtime of O(N · n6) with the vertex-based random solution generation, and a stochastic runtime of O(N · n3 ln n) with the edge- based random solution generation. These runtimes are very close to the best known expected runtime for variants of Max-Min Ant System with best-so- far reinforcement by choosing a small N ∈ ω(ln n). They are obtained for ∗Principal corresponding author ∗∗Corresponding author Corresponding author Email addresses: [email protected] (Zijun Wu), [email protected] (Rolf H. Mohring), [email protected] (Jianhui Lai) 1The author is also affiliated with the School of Applied Mathematics and Physics at Beijing University of Technology 2The author is a professor emeritus of mathematics at Berlin University of Technology Preprint submitted to Theoretical Computer Science October 12, 2017 the stronger notion of stochastic runtime, and analyze the runtime in most cases. We also inspect more complex instances with n vertices positioned on an m × m grid. When the n vertices span a convex polygon, we obtain a stochastic runtime of O(n4m5+) with the vertex-based random solution generation, and a stochastic runtime of O(n3m5+) for the edge-based random solution generation. When there are k ∈ O(1) many vertices inside a convex polygon spanned by the other n − k vertices, we obtain a stochastic runtime of O(n4m5+ + n6k−1m) with the vertex-based random solution generation, and a stochastic runtime of O(n3m5+ + n3km) with the edge-based random solution generation. These runtimes are better than the expected runtime for the so-called (µ+λ) EA reported in a recent article, and again obtained for the stronger notion of stochastic runtime. Keywords: probabilistic analysis of algorithms, stochastic runtime analysis of evolutionary algorithms, Cross Entropy algorithm, Max-Min Ant System, (µ+λ) EA. 1. Introduction The Cross Entropy (CE) algorithm is a general-purpose evolutionary al- gorithm (EA) that has been applied successfully to many NP-hard combi- natorial optimization problems, see e.g. It was initially designed for rare event simulation by Rubinstein [2] in 1997, and thereafter formulated as an optimization tool for both continuous and discrete optimization (see [3]). the book [1] for an overview. CE has much in common with the famous ant colony optimization (ACO, see [4]) and the estimation of distribution algorithms (EDAs, see [5]). They all belong to the so-called model-based search paradigm (MBS), see [6]. In- stead of only manipulating solutions, which is very typical in traditional heuristics like Genetic Algorithms [7] and Local Search [8] and others, MBS algorithms attempt to optimize the solution reproducing mechanism. In each iteration, they produce new solutions by sampling from a probabilistic dis- tribution on the search space. The distribution is often called a model in the literature (see e.g. [6] and [9]). This model evolves iteratively by incorpo- rating information from some elite solutions occurring in the search history, so as to asymptotically model the spread of optimal solutions in the search 2 space. See the recent Thesis [9] for more details on MBS algorithms and their mathematical properties. An important issue for MBS algorithms is to determine a suitable size for the sampling in each iteration. A large sample size makes each iteration unwieldy, however a small sample size may mislead the underlying search due to the randomness in the sampling. Sample size reflects the iterative complexity (computational complexity in each iteration). Whether a large sample size is harmful depends on the required optimization time (i.e., the total number of iterations required to reach an optimal solution). This article aims to shed a light on this issue by theoretically analyzing the relation between sample size and optimization time for a CE variant that includes also some essential features of the famous Max-Min Ant System (MMAS [10]). To this end, a thorough runtime analysis is needed. The theoretical runtime analysis of EAs has gained rapidly growing in- terest in recent years, see e.g. [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], and [25]. In the analysis, an oracle-based view of computation is adopted, i.e., the runtime of an algorithm is expressed as the total number of solutions evaluated before reaching an optimal solution. Since the presence of randomness, the runtime of an EA is often conveyed in expectation or with high probability. Due to the famous No Free Lunch Theorem [26], the analysis must be problem-specific. The first steps towards this type of analysis were made for the so-called (1+1) EA [11] on some test problems that use pseudo boolean functions as cost functions, e.g., OneMax [15], LeadingOnes [27] and BinVar [11]. Recent research addresses prob- lems of practical importance, such as the computing a minimum spanning trees (MST) [28], matroid optimization [29], traveling salesman problem [30], the shortest path problem [23], the maximum satisfiability problem [31] and the max-cut problem [32]. Runtime analysis generally considers two cases: expected runtime analysis and stochastic runtime analysis. Expected runtime is the average runtime of an algorithm on a particular problem, see, e.g., the runtime results of (1 + 1) EA reported in [11]. Expected runtime reflects the oracle-based average per- formance of an algorithm. A mature technique for expected runtime analysis is the so-called drift analysis [12]. However, this technique requires that the algorithm has a finite expected runtime for the underlying problem. By [33], drift analysis is not applicable to the traditional CE [3]. An algorithm with a smaller expected runtime need not be more efficient, see [34] for details. In contrast, stochastic runtime provides a better under- 3 standing of the performance of a (randomized) EA. Stochastic runtime is a runtime result conveyed with an overwhelming probability guarantee (see, e.g., the classic runtime result of 1-ANT in [15]), where an overwhelming probability means a probability tending to 1 superpolynomially fast in the problem size. It therefore reflects the efficiency of an algorithm for most cases in the sense of uncertainty. This article is concerned with stochastic runtime analysis, aiming to figure out the relation between stochastic runtime and magnitude of the sample size. Runtime analysis of CE algorithms has been initiated in [33], where Wu and Kolonko proved a pioneering stochastic runtime result for the traditional CE on the standard test problem LeadingOnes. As a continuation of the study of [33], Wu et al [34] further investigated the stochastic runtime of the traditional CE on another test problem OneMax. The runtime results reported in [33] and [34] showed that sample size plays a crucial role in efficiently finding an optimal solution. In particular, Wu et al [34] showed that if the problem size n is moderately adapted to the sample size N , then the stochastic runtime of the traditional CE on OneMax is O(n1.5+ 4 3 ) for arbitrarily small  > 0 and a constant smoothing parameter ρ > 0, which beats the best-known stochastic runtime O(n2) reported in [13] for the classic 1-ANT algorithm, although 1-ANT employs a much smaller sample size (i.e., sample size equals one). Moreover, by imposing upper and lower bounds on the sampling probabilities as was done in MMAS [10], Wu et al [34] showed further that the stochastic runtime of the resulting CE can be significantly improved even in a very rugged search space. The present article continues the stochastic runtime analysis of [34], but now in combinatorial optimization with a study of CE on the traveling sales- man problem (TSP). We emphasize the impact of the magnitude of N on the stochastic runtime, put ρ = 1, and consider a CE variant resembling an MMAS with iteration-best reinforcement under two different random solu- tion generation mechanisms, namely, a vertex-based random solution gener- ation and an edge-based random solution generation. Stochastic runtime for MMAS with iteration-best reinforcement on sim- ple problems like OneMax has been studied in [20] and [25]. In particular, Neumann et al [20] showed that to obtain a stochastically polynomial run- time for OneMax, N/ρ ∈ Ω(ln n) is necessary. We shall not only extend this to TSP for the case of ρ = 1, but also prove that N ∈ ω(ln n) is already sufficient to guarantee a stochastically polynomial runtime for simple TSP instances. 4 TSP is a famous NP-complete combinatorial optimization problem. It concerns finding a shortest Hamiltonian cycle on a weighted complete graph. Existing algorithms exactly solving TSP generally have a prohibitive com- plexity. For instance, the Held-Karp algorithm [35] solves the problem with a complexity of O(n22n). A well-known polynomial time approximation al- gorithm for metric TSP is the so-called Christofides algorithm [36], which finds a solution with a cost at most 3/2 times the cost of optimal solutions. As mentioned in [37], this is still the best known approximation algorithm for the general metric TSP so far. For Euclidean TSP there exists a famous polynomial-time approximation scheme (PTAS) by Arora, see [38]. To de- sign a superior approximation algorithm, researchers in recent years tend to study TSP instances with particular structures, see, e.g., [39]. Due to the prohibitive running time of exact algorithms, heuristics are frequently employed in practice so as to efficiently compute an acceptable solution for a TSP problem, e.g., the Lin-Kernighan (LK) algorithm [40]. As a popular heuristic, CE has also been applied in practice to solve TSP instances, see [41] and [3]. The implementation there shows that CE can also efficiently compute an acceptable solution. In view of the high complexity of general TSP, we consider in our analysis two classes of TSP instances with a particular structure. The first kind of instances has been used in [19] and [42] for analyzing the expected runtime of some MMAS variants with best-so-far reinforcement. These TSP instances have polynomially many objective function values and a unique optimal so- lution. Moreover, on these TSP instances, solutions containing more edges from the optimal solution have a smaller cost than those with fewer such edges. For more details on these instances, see Section 5. For these simple instances, we prove in Theorem 2 that with a probability 1 − e−Ω(n), the runtime is O(n6+) with the vertex-based random solution generation, and O(n3+ ln n) with the edge-based random solution generation, for any constant  ∈ (0, 1) and N ∈ Ω(n). For the case of N ∈ ω(ln n), we show that the runtimes (resp., O(n6N and n3(ln n)N ) are even smaller with probability 1 − n−ω(1), see Corollary 1. These results are very close to the known expected runtime O(n6 + n ln n ) for (1 + 1) MMAA reported in [19], and the expected runtime O(n3 ln n + n ln Arb reported in [42] (where ρ ∈ (0, 1) is an evaporation rate), if N ∈ ω(ln n) is suitably small. But they give the stronger guarantee of achieving the optimal solution in the respective runtime with an overwhelming probability. Moreover, we show ρ ) for MMAS∗ ρ 5 a stochastically exponential runtime for a suitable choice of N ∈ O(ln n), see Theorem 3. This generalizes the finding in [20] for OneMax to TSP instances. Therefore, N ∈ Ω(ln n) is necessary, and N ∈ ω(ln n) is sufficient for a stochastically polynomial runtime for simple TSP instances. We also inspect more complex instances with n vertices positioned on an m×m grid, and the Euclidean distance as distance function. These instances have been employed in [43] and [30] for analyzing the expected runtime of (µ+λ) EA and randomized local search (RLS). When the n vertices span a convex polygon without vertices in the interior of the polygon (so they are the corners of that polygon), we prove a stochastic runtime of O(n4m5+) for the vertex-based random solution generation, and a stochastic runtime of O(n3m5+) for the edge-based random solution generation, see Theorem 4 for details. Similarly, the  in the stochastic runtimes can be removed by slightly decreasing the probability guarantee, see Corollary 2. When the vertices span a convex polygon with k ∈ O(1) vertices in the interior, we show a stochastic runtime of O(n4m5+ + n6k−1m) with the vertex-based random solution generation, and a stochastic runtime of O(n3m5+ + n3km) with the edge-based random solution generation, see Theorem 5 for details. These runtimes are better than the expected runtime for the so-called (µ+λ) EA and RLS reported in the recent paper [30]. The remainder of this paper is arranged as follows. Section 2 defines the traditional CE and related algorithms, Section 3 defines the traveling sales- man problem and provides more details of the used CE variants, Section 4 shows some important facts on the two random solution generation methods, and Section 5 reports the stochastic runtime results on the TSP instances. A short conclusion and suggestions for future work are given in Section 6. Notations for runtime Our analysis employs some commonly used notations from complexity theory. We use O(f (n)) to denote the class of functions which are bounded from above by the function f (n), i.e., those functions g(n) with g(n) ≤ c·f (n) for large enough n and some constant c ≥ 0 not depending on n. Similarly, Ω(f (n)) is the class of functions that are bounded from below by f (n), i.e., for any g(n) ∈ Ω(f (n)) there exists a constant c > 0 not depending on n such that g(n) ≥ c · f (n) for large enough n. Class Θ(f (n)) is the inter- section of Ω(f (n)) and O(f (n)). Class o(f (n)) is the class of functions g(n) with g(n)/f (n) → 0 as n → ∞, and class ω(f (n)) is the class of functions 6 g(n) with g(n)/f (n) → +∞ as n → ∞. Obviously, o(f (n)) ⊂ O(f (n)) and ω(f (n)) ⊂ Ω(f (n)). 2. The general cross entropy algorithm and related algorithms We now introduce the traditional CE algorithm. The CE variant we will analyze inherits the framework of this traditional version. To compare our results with those in the literature, we shall give also details about some related algorithms. 2.1. The traditional cross entropy algorithm Algorithm 1 lists the traditional CE that was proposed in [3], adapted to an abstract notion of combinatorial optimization problems. The algorithm assumes a combinatorial minimization problem (S, f ), where S is a finite search space of "feasible" solutions and f is the cost function. Every feasible solution s ∈ S is composed of elements from a fixed finite set A, the ground set of the problem, i.e., we assume S ⊆ An for some integer n ∈ N. Further- more there is a product distribution on the product space An that induces a distribution on S ⊆ An. The distribution on An can usually be represented as a vector (or matrix) of real-valued probabilities. The convex combination of the two distributions in Step 6 of Algorithm 1 then corresponds to a convex combination of the two vectors (or matrices). Specific to the TSP, the ground set A can be the set of nodes or edges, n is the number of nodes, and a feasible solution is a sequence of elements from A that forms a Hamiltonian cycle. The product distribution for the TSP is represented as an n×n matrix. When we consider the set of nodes as our ground set A, each row i of the matrix is a marginal distribution that specifies choice probabilities for all nodes following the current node i. A random Hamiltonian cycle is sequentially constructed from the product distribution by allowing only nodes not yet visited as continuations in each step, see Algorithm 2 for more details. When we consider the set of edges as A, marginals of the product distri- bution will be represented by the same n×n matrix where the sum of the (i, j)-th and (j, i)-th entries reflects the probability that the edge {i, j} oc- curs in a random solution. A random Hamiltonian cycle is still constructed sequentially and only edges leading to a feasible solution are taken in each step, see Algorithm 3 for details. 7 Algorithm 1 The general Cross-Entropy algorithm Input: an initial distribution Π0 on the solution space, a fixed smoothing param- eter ρ ∈ (0, 1], a sample size N ∈ N+, an elite size M ∈ N+ with M ≤ N 1: t = 0; 2: loop 3: 4: 5: t 6: 7: 8: end loop t independently generate N random solutions X(1) current distribution Πt; sort these N solutions in non-decreasing order as f (X[1] f (X[N ] learn an empirical distribution Wt X[1] t , . . . , X[M ] set Πt+1 = (1 − ρ)Πt + ρWt; t = t + 1; ) according to the cost function f ; ; t , . . . , X(N ) t with the t ) ≤ ··· ≤ from the M best solutions Traditionally, CE sets a small elite ratio α ∈ (0, 1) and uses the best (cid:98)α · N(cid:99) solutions in Step 5 to build the empirical distribution Wt. Here, we use the elite size M instead. This does not intrinsically change the original algorithm. Steps 3 and 5 depend on the detailed definition of the underlying problem. We shall give details to them in Subsection 3.2. Step 6 of Algorithm 1 plays a crucial role in the different theoretical anal- yses of the algorithm, see, e.g., [44], [33], [45], [9], [34]. The occurrence of good solutions are probabilistically enforced by incorporating the new infor- mation Wt into Πt+1. This idea, somehow, coincides with the reinforcement learning in [46]. The smoothing parameter ρ reflects the relative importance of the new information Wt in the next sampling. It balances global ex- ploration and local exploitation to a certain degree. A larger ρ makes the algorithm concentrate more on the particular area spanned by the elite solu- tions X[1] t , . . . , X[M ] , while a smaller ρ gives more opportunities to solutions t outside that area. However, balancing global exploration and local exploitation through tun- ing ρ is ultimately limited. Wu and Kolonko [33] proved that the famous "genetic drift" [47] phenomenon also happens in this algorithmic scheme, i.e., the sampling (Step 3) eventually freezes at a single solution and that solution needs not to be optimal. This means that the algorithm gradually 8 loses the power of global exploration. As a compensation for global exploration, Wu et al [34] proved that a moderately large sample size N might be helpful. The results there showed that a moderately large N configured with a large ρ (e.g., ρ = 1) can make the algorithm very efficient. Although a large N introduces a high computational burden in each iteration, the total number of iterations required for getting an optimal solution is considerably reduced. Wu et al [34] also indicated another way to compensate the global ex- ploration, i.e., imposing a lower bound πmin ∈ (0, 1) and an upper bound πmax ∈ (0, 1) on the sampling distributions in each iteration. This idea is originated from MMAS [10]. In each iteration t, after applying Step 6, the entries of distribution Πt+1 that are out of the range [πmin, πmax] are reset to that range by assigning to them the nearest bounds, see (6) in Section 3 for more details. Wu et al [34] have proved that this can make CE more efficient even in the case of a rugged search space. To follow these theoretical suggestions made in [34], we shall in our stochastic runtime analysis use a CE that modifies the traditional CE (Al- gorithm 1) accordingly. We shall see that these modifications make the CE very efficient for the considered TSP instances. 2.2. Related evolutionary algorithms Related evolutionary algorithms for TSP whose runtime has been exten- sively studied are RLS [28], (µ + λ) EA [30], and those theoretical abstrac- tions of MMAS [10] including MMAS∗ bs [17], (1+1) MMAA [19]. We now give algorithmic details of them. In order to facilitate the comparison, their runtimes for TSP instances will be discussed in Section 5. (µ + λ) EA is an extension of the famous (1 + 1) EA [11]. (µ + λ) EA In each iteration, randomly chooses µ solutions as the initial population. (µ+λ) EA randomly chooses λ parents from current population, then produces λ children by applying randomized mutation to each of the selected parents, and forms the next population by taking the best µ solutions from these µ + λ solutions in the end of current iteration. The expected runtime of (µ + λ) EA on TSP instances is studied in [30], where Sutton et al uses a Poisson distribution to determine the number of randomized mutations (2- opt move or jump operation) should be taken by a selected parent in each iteration. RLS is a local search technique [48]. It employs a randomized neighbor- hood. In each iteration, it randomly chooses a number of components of the 9 best solution found so far and then changes these components. The expected runtime of RLS for TSP instances is also studied in [30], where the neighbor- hood is taken to be a k-exchange neighborhood with k randomly determined by a Poisson distribution. (1+1) MMAA is a simplified version of the famous MMAS [10], where the sample size is set to 1 and pheromones are updated only with the best solution found so far (best-so-far reinforcement) in each iteration. In each iteration of (1+1) MMAA, the ant which constructed the best solution found so far deposits an amount πmax of pheromones on the traversed edges, and an amount πmin of pheromones on the non-traversed edges, and the pheromones are updated by linearly combining the old and these newly added pheromones as in Algorithm 1. The expected runtime of (1+1) MMAA on simple TSP instances is studied in [19]. The expected runtime of its variant MMAS∗ on simple TSP instances is studied in [42]. Arb 3. The traveling salesman problem and details of the CE variant Now, we formally define TSP, and give more details of the CE variant we will analyze. 3.1. The traveling salesman problem and edge set E = (cid:8){i, j} i ∈ V, j ∈ V, i (cid:54)= j(cid:9). A Hamiltonian cycle is a We consider an undirected graph G = (V, E) with vertex set V = {1, . . . , n} sequence {{il, il+1} l = 1, . . . , n} of edges such that a) i1 = in+1; b) (i1, . . . , in) is a permutation of {1, 2, . . . , n}. This definition actually considers E as the ground set A. As mentioned above, we can also put A = V and represent Hamiltonian cycles in a more com- pact way as permutations of V. Note that a Hamiltonian cycle corresponds to n different permutations, whereas a permutation corresponds to a unique Hamiltonian cycle. However, the two representations are intrinsically the same. We shall use them interchangeably in the sequel. To facilitate our discussion, we shall refer to a Hamiltonian cycle by just referring to one of the n corresponding permutations, and denote by S the set of all possible permutations. We employ the convention that two permutations are said 10 to be same iff they form the same underlying Hamiltonian cycle. The no- tation {k, l} ∈ s shall mean that the edge {k, l} belongs to the underlying Hamiltonian cycle of the solution (permutation) s. Once a distance function d : E (cid:55)→ R+ is given, the (total traveling) cost f (s) of a feasible solution s = (i1, i2, . . . , in) ∈ S is then calculated by n−1(cid:88) f (s) := d(ij, ij+1) + d(in, i1). (1) j=1 We denote by S∗ ⊆ S the set of feasible solutions (Hamiltonian cycles) that minimize the cost (1). 3.2. Details of the CE variant The CE variant we consider in the analysis completely inherits the struc- ture of Algorithm 1, and additionally employs a component from MMAS. We now formalize the sampling distribution, and define Steps 3 and 5 in more detail. As mentioned, we represent a sampling distribution (a product distribution on An) for the TSP by a matrix Π = (πi,j)n×n, such that a) (cid:80)n j=1 πi,j = 1, for all i = 1, . . . , n, b) πi,i = 0 for all i = 1, . . . , n, c) πi,j = πj,i for each edge {i, j} ∈ E. For each edge {i, j} ∈ E, πi,j reflects the probability that a Hamilton cycle continues with vertex j when it is in vertex i. In the sequel, we write the sampling distribution Πt in iteration t as (πt i,j)n×n, where the superscript t of πt i,j indicates the iteration. The initial distribution Π0 = (π0 i,j)n×n is, without loss of generality, set to be the uniform distribution, i.e., π0 i,j = π0 n−1 for all edges {i, j} ∈ E. j,i = 1 We shall consider two random solution generation methods, a vertex-based random solution generation and an edge-based random solution generation. Algorithm 2 lists the vertex-based random solution generation method. This method uses V as the ground set A. A product distribution of An is therefore represented as a matrix Π = (πi,j)n×n satisfying a)-c) above, i.e., each row of Π represents a sampling distribution on A = V. Directly sampling from Π may produce infeasible solutions from An − S. To avoid that, Algorithm 2 starts with a randomly fixed initial node, and then sequentially extends 11 a partial solution with an unvisited vertex until a complete permutation is obtained. This method is efficient and rather popular in practice, see, e.g., [41] and [4]. Here, "s + (v)" means that appends a vertex v to the end of a partial solution s. Algorithm 2 Vertex-based random solution generation Input: a distribution Π = (πi,j)n×n a permutation of 1, 2, . . . , n Output: 1: s = ∅, and Vunivisted = V ; 2: randomly select v from V, s = s + (v), and Vunvisited = Vunvisited − {v}; 3: while (Vunvisited (cid:54)= ∅) do select a random vertex v(cid:48) from Vunvisited with a probability 4: ; πv,k (2) (cid:80) P[v(cid:48) s] = πv,v(cid:48) k∈Vunvisited set s = s+(v(cid:48)), Vunvisited = Vunvisited − {v(cid:48)}; v = v(cid:48); 5: 6: 7: end while 8: return s; The edge-based random solution generation is listed in Algorithm 3. The idea is from [42]. This method considers edge set E as the ground set A. A feasible solution is then a sequence of edges that form a Hamiltonian cycle, i.e. S ⊆ En. To unify the notation of feasible solutions, Algorithm 3 translates its outcomes into permutations. As the actual ground set is E, a product distribution is an n× n(n−1) 2 matrix such that each row is a marginal specifying a sampling distribution on E. Algorithm 3 only considers those with identical marginals, a product distribution can be therefore fully characterized by one of its marginals and is therefore again represented by an n × n matrix Π = (πi,j)n×n as above. An edge {i, j} ∈ E is then sampled from Π with l=1 πk,l = 2πi,j/n since each row of Π sums up to 1. A random sequence ∈ En is generated by independently sampling from Π n times. To avoid infeasible solutions, Algorithm 3 considers in every sampling only edges that are admissible by the edges selected before. Given a set B of edges such that the subgraph (V,B) does neither contain a probability (πi,j + πj,i)/(cid:80)n (cid:80)n k=1 12 cycle nor a vertex of degree ≥ 3, an edge e(cid:48) ∈ E is said to be admissible by B if and only if the subgraph (V,B ∪ {e(cid:48)}) still does neither contain a cycle nor a vertex of degree ≥ 3. We denote by Badmissible the set of edges /∈ B that are admissible by B. Algorithm 3 Edge-based random solution generation Input: a distribution Π = (πi,j)n×n a permutation of 1, 2, . . . , n Output: 1: B = ∅, Badmissible = E; 2: while (B ≤ n − 1) do select an edge {i, j} from Badmissible with a probability 3: P[e s] = (cid:80){k,l}∈Badmissible πi,j + πj,i ; (3) πk,l + πl,k set B =B∪{{i, j}}; update Badmissible; 4: 5: 6: end while 7: let s = (1, i2, i3, . . . , in) with {1, i2},{ij, ij+1} ∈ B for j = 2, . . . , n−1; 8: return s; The N random solutions X(1) in iteration t are then generated by N runs of Algorithm 2 or Algorithm 3 with the current distribution Πt = (πt i,j)n×n is then calculated from the M elite solutions by setting i,j)n×n. The empirical distribution Wt = (wt , . . . , X(N ) t t (cid:80)M k=1 1{e(cid:48)∈E e(cid:48)∈X[k] t }({i, j}) wt i,j = where 1A(·) is the indicator function of set A = {e(cid:48) ∈ E e(cid:48) ∈ X[k] {i, j} ∈ E. The next distribution Πt+1 = (πt+1 , (4) t } for each i,j )n×n is therefore obtained as M i,j = (1 − ρ)πt πt+1 i,j + ρwt i,j (5) for each {i, j} ∈ E. We continue with the suggestions made in [34]. In the CE variant, we shall use a moderately large N and a large ρ = 1. To fully use the best elite 13 πmin πt+1 i,j πmax πt+1 i,j = if πt+1 if πt+1 if πt+1 i,j < πmin, i,j ∈ [πmin, πmax], i,j > πmax, (6) solutions, we take M = 1. To prevent premature convergence (i.e., a possible stagnation at a non-optimal solution), we employ a feature from MMAS [10], called max-min calibration, in the construction of Πt+1,. We choose a lower bound πmin ∈ (0, 1) and an upper bound πmax ∈ (0, 1), and, after applying (5), adjust Πt+1 by for any edge {i, j} ∈ E. Note that the max-min calibration is the only step that does not occur in the general CE (i.e., Algorithm 1). This setting turns CE into an MMAS with iteration-best reinforcement, i.e., only the iteration-best solution X[1] is allowed to change the 'pheromones' t Πt. Stutzle and Hoos [10] indicated in an empirical study that the practi- cal performance of iteration-best reinforcement is comparable to best-so-far reinforcement for TSP instances. Thus, it should also be worthwhile to com- pare the theoretical runtime of iteration-best reinforcement with the known expected runtimes of best-so-far reinforcement for TSP instances presented in, e.g., [19] and [42]. 4. Properties of the random solution generation methods Before we start with our runtime analysis, we shall discuss some relevant properties of the two random solution generation methods, which concern the probability of producing a k-exchange move of the iteration-best solution in the next sampling. Formally, a k-exchange move on a Hamiltonian cycle is an operation that removes k edges from the cycle and adds k new edges to obtain again a cycle. A k-opt move is a k-exchange move reducing the total travel cost. Figure 1a shows an example of a 2-exchange move, in which edges {i, j},{k, l} are removed, and edges {i, l},{k, j} are added.Figure 1b shows an example of a 3-exchange move. In our analysis, we shall consider only iteration-best reinforcement with ρ = 1 and the max-min calibration (6). The empirical distribution Wt = i,j)n×n for each iteration t ∈ N in this particular case therefore satisfies (wt πt+1 i,j = πt+1 j,i = min{1, πmax} = πmax max{0, πmin} = πmin if edge {i, j} ∈ X[1] t , otherwise, (7) (cid:40) 14 (a) A 2-exchange move (b) A 3-exchange move Figure 1: Examples for edge exchange moves for every edge {i, j} ∈ E and iteration t ∈ N. Furthermore, Πt+1 = Wt. Since Πt+1 is biased towards the iteration-best solution X[1] t , k-exchanges of X[1] t with a large k are unlikely to happen among the N draws from Πt+1 by either of the two generation methods. Thus, an optimal solution is more likely to be reached by a sequence of repeatedly k-exchange moves with small k from iteration-best solutions. Therefore, it is necessary to estimate the probabilities of producing a k-exchange of X[1] in the two generation methods, t especially for the case of small k. 4.1. Probabilities of producing k-exchanges in the vertex-based random solu- tion generation The probability of producing k-exchanges with k = 2, 3 in the vertex- based random solution generation has been studied in Zhou [19]. With πmin = n2 and πmax = 1 − 1 1 n , Zhou [19] proved for (1 + 1) MMAA that with a probability of Ω(1/n5), Algorithm 2 produces a random solution having more t (the best solution found so far) provided that x∗ edges from s∗ than x∗ t is not t (cid:54)= s∗, then there exists either optimal. Zhou [19] actually showed that if x∗ a 2-opt move or a 3-opt move for x∗ t , and Algorithm 2 produces an arbitrary 2-exchange of x∗ t with a probability of Ω(1/n3), and an arbitrary 3-exchange of x∗ n(n−2) and consider iteration-best reinforcement, a similar result holds in our case. Claim 1 below gives a lower bound on the probability of producing a k-exchange move of the iteration-best solution in the next round with the vertex-based random solution generation. t with a probability of Ω(1/n5). Although we use πmin = 1 15 ijklijklwv Claim 1. Let M = 1, ρ = 1, and consider a k-exchange move of X[1] for some t integer k = 2, 3, . . . , n. Then, Algorithm 2 produces the given k-exchange move with a probability Ω(1/n2k−1) in every of the N draws in iteration t + 1. i,j (or, equivalently, πt Proof. Recall that in Algorithm 2, the probability (2) to select a continuing edge {i, j} is always bounded from below by πt j,i) for each iteration t ∈ N, since each row of Πt sums up to 1. Given a k-exchange move of X[1] t , one possibility to generate it from Πt+1 = Wt by Algorithm 2 is that one of the new edges is added in the last step. This happens with a e·n2k−1 , where e ≈ 2.71828 probability at least 1 is Euler's number, 1 n represents the probability to select the starting vertex, n(n−2) is the common lower bound of the probability to select the remaining k − 1 new edges, and 1 − 1 n is the common lower bound of the probability to select one of the remaining n − k edges from X[1] t . (cid:3)k−1 ·(cid:0)1 − 1 (cid:1)n−k ≥ 1 n ·(cid:2) 1 1 n(n−2) n Because of Claim 1, every 2-exchange of X[1] t is produced from Πt+1 by Algorithm 2 with a probability Ω(1/n3), and every 3-exchange is produced by Algorithm 2 with a probability Ω(1/n5). Note that for any k = 2, 3, . . . , if a k-opt move of X[1] t occurs among the N draws in the next sampling, t+1) < f (X[1] then f (X[1] t ) must hold. Thus, if we take a moderately large sample size, say N = Θ(n5+) for some  > 0, with a probability 1 − (1 − Ω(n−5))Ω(5+) = 1− e−Ω(n), f (X[1] t ) will hold, provided that there still exists a 2-opt or 3-opt move from X[1] t . t+1) < f (X[1] Claim 2. Suppose that M = 1, ρ = 1. Then, for iteration t + 1, the probability that Algorithm 2 produces a solution with a cost not larger than X[1] in one t application is in Ω(1). Proof. Observe that the probability that X[1] is reproduced in one application of Algorithm 2 is larger than (1 − 1/n)n−1 ∈ Ω(1), which implies that the t cost of the generated random solution is not larger than f (X[1] t ). Note that if X[1] t next sampling, then f (Xt+1)[1] ≤ f (X[1] Ω(ln n), then f (X[1] O(1/n). Particularly, when N ∈ Ω(n) for some  > 0, f (X[1] with an overwhelming probability 1 − e−Ω(n). is reproduced at least once among the N draws in the t ). Thus, if the sample size N ∈ t ) with a probability 1 − (1 − Ω(1))N = 1 − t+1) ≤ f (X[1] t ) t+1) ≤ f (X[1] 16 4.2. Probabilities of producing k-exchanges in the edge-based random solution generation i,j = πt j,i = πmin or πt i,j = πt Recall that in each iteration t, either πt The behavior of the edge-based random solution generation is comprehen- sively studied in [42]. Kotzing et al [42] proved for MMAS∗ Arb and a constant k ∈ O(1) that, with a probability of Ω(1), Algorithm 3 produces a random solution that is obtained by a k-exchange move from the best solution found so far. j,i = πmax for any edge {i, j} ∈ E. For convenience, we will call an edge {i, j} ∈ E with i,j = πt πt j,i = πmax a high edge, and otherwise a low edge. Kotzing et al [42] an arbitrary fixed step conditioned on the event that l ≤ √ showed the probability of the event that Algorithm 3 chooses a high edge in n low edges have been chosen in some l steps before this step is 1 − O(1/n). Our setting is only slightly different with from theirs, i.e., we use πmin = 1 n(n−2) but they put πmin = 1 n(n−1). Thus, the result should also hold here. Claim 3 below formally asserts this, readers may also refer to [42] for a similar proof. √ Claim 3. Assume M = 1, ρ = 1. Then, the probability of choosing a high edge at any fixed step in Algorithm 3 is at least 1 − 12/n if at most n low edges have been chosen before that step and there exists at least one high admissible edge to be added. Proof. We now fix a step n−m for some m = 0, 1, . . . , n−1, and assume that l ≤ √ n low edges have been chosen before this step. Obviously, we still need to add m + 1 ≥ 1 edges to obtain a complete solution. We now estimate the numbers of admissible high and low edges in this step. Note that every of the l low edges blocks at most 3 of the m+l remaining high edges (at most two which are incident to the end points of the low edge, and at most one that may introduce a cycle). So at least m+l − 3l = m−2l ≥ m−3l high edges are available for adding in this step. Of course, it may happen that there is no admissible high edges in this step. However, we are not interested in such a case. We consider only the case that there exists at least one admissible high edge in this step, i.e. the number of admissible high edges in this step is at least max{1, m − 3l}. Note also that the n−m edges added before partition the subgraph of G = (V, E) with vertices V and edges from the partial solution constructed so far into exactly m connected components (here, we see an isolated vertex also as a connected component). For any two of the components, there are at most 4 admissible edges connecting them. 17 (cid:1),(cid:0)n Therefore, there are at most min{4(cid:0)m (cid:1)} admissible low edges. Observing l ≤ √ 1− min{4(cid:0)m (cid:1),(cid:0)n n, the probability of choosing a high edge in this step is bounded from below by (cid:40) ≥ (8) 2 2 2 2 √ if m > 3 n, √ if m ≤ 3 n, max{1, m − 3l} where the first inequality is obtained by observing that πmin πmax (cid:1)} (cid:18)m (cid:19) 2m2 (m−3l)n(n−2) ≥ 1− 3 1− (n−2) 1− 12 n−2 (cid:18)n (cid:19) } ≤ min{2m2, (cid:18)n (cid:19) , 2 n(n−2), and 2m2 m−3l ≤ 2 m− 3 1 √ n m2 } ≤ 2m2, 2 ≤ 3n. min{4 2 τmax = 1 − 1/n, πmin = 1 With Claim 3, we can show that, for any t ∈ N and any fixed k ∈ O(1), the probability of the event that a k-exchange of X[1] is produced by one t application of Algorithm 3 is Ω(1), see Claim 4. Here, we shall use a different proof from the one presented by Kotzing et al [42], which appears to us as problematic. Claim 4. Let M = 1, ρ = 1. For any k ∈ O(1), with probability Ω(1), the random solution produced by Algorithm 3 is a k-exchange of X[1] t . Proof. Let k ∈ O(1) be arbitrarily fixed, and M be the set of all k-element subsets of {1, 2, . . . , n/2} (where we assume without loss of generality that n is even). Obviously, M ∈ Θ(nk) since k ∈ O(1). Let M ∈ M be an arbi- trarily fixed k-element subset. The probability of the event that Algorithm 3 selects k new edges (low edges) at steps i ∈ M and n − k edges (high edges) from X[1] t at other steps, is bounded from below by (cid:0)1 − O( )(cid:1)n−k(cid:89) i∈M 1 n ((cid:0)n−i+1 (cid:1) − (n − i + k + 1))πmin 2 n(n − 1)πmin + (n − i + k + 1)πmax ≥ Θ( 1 nk ), (9) where 1 − O(1/n) is a lower bound for the probability of selecting an edge t . In each step i ∈ M, the edges chosen before partition the graph from X[1] into n−i+1 connected components, and for any two of the components there exists at least 2 edges connecting them without introducing a cycle. Hence, that the number of admissible high edges in this case is at most n− i + k + 1 (cid:1) admissible edges in each step i ∈ M. Notice also there are at least(cid:0)n−i+1 2 18 ((n−i+1 )−(n−i+k+1))πmin n(n−1)πmin+(n−i+k+1)πmax (n − i+k+1 is the maximal number of high edges that have not been chosen of (9) is just the lower before). Therefore, each factor bound of the probability for choosing an admissible edge not belonging to X[1] t in a step i ∈ M. As a result, the probability of the random event that Algorithm 3 pro- t with k ∈ O(1) in any of the N independent draws nk ) ∈ Ω(1), duces a k-exchange of X[1] in iteration t+1 is bounded from below by M·Θ( 1 since new edges can also be added in steps l ≥ n/2. 2 nk ) = Θ(nk)·Θ( 1 Notice that in the edge-based random solution generation, for any k = 2, 3, . . . , n, any two k-exchanges of X[1] t are generated with the same proba- bility, since the generation does not require adding the edges in a particular order. Therefore, by Claim 4, for any k ∈ O(1), any specified k-exchange of X[1] t will be produced with a probability Θ(1/nk). Since reproducing X[1] t can be seen as a 0-exchange of X[1] t , we can thus derive the following conclusion. Claim 5. Let M = 1, ρ = 1. With probability Ω(1), the random solution generated by Algorithm 3 has a cost not larger than that of X[1] t . for some k < nδ. Claim 6 shows that it is unlikely that the random solution generated by t . This Algorithm 3 is "very" different from the last iteration-best solution X[1] will be fundamental for deriving the runtime lower bound. Claim 6. Let M = 1, ρ = 1. For any δ ∈ (0, 1], with an overwhelming probability 1− e−ω(nmin{δ,1/4}/2), the random solution generated by Algorithm 3 is a k-exchange move from X[1] t Proof. Let δ ∈ (0, 1] be arbitrarily fixed, and put γ = min{δ, 1/4}. To prove the claim, we just need to show that with an overwhelming probability, the random solution generated by Algorithm 3 is a k-exchange of X[1] for some k ≤ nγ ≤ n1/4. This is again implied by the fact that with an overwhelming t probability, at most nγ/2 low edges are chosen within the first T := n − 3nγ 4 steps in Algorithm 3, since the best case nγ/2 + 3nγ is still smaller than nγ. By Claim 3, for any k ≤ nγ/2 and any m ≤ T, Algorithm 3 chooses 4 high edges with a probability at least 1 − 12/n at step m if at most k edges have been chosen before step m, since there exist at least n − m − 3k ≥ 4 − 3nγ/2 ≥ 3 admissible high edges at step m. 3nγ 19 Let P denote the probability of the random event that at most nγ/2 low edges are chosen within T steps, and Q the probability of the random event that at least nγ/2 + 1 low edges are chosen within the same T steps. Then P = 1 − Q. We shall bound Q from above, which will give a lower bound for P. Let E be the random event that at least nγ/2 + 1 low edges are chosen within T steps. Then Q = P[E]. For each l = 1, . . . , nγ/2 + 1, we define a random variable vl denoting the first step m ≤ T such that l low edges are chosen within m steps. Obviously, E implies the random event E1 that v1 < v2 < ··· < vnγ/2+1 ≤ T. Thus, Q ≤ P[E1], and P ≥ 1 − P[E1]. Observe that P[E1] = (cid:88) a1<a2<···<a nγ/2+1 ≤T P[v1 = a1, . . . , vnγ/2+1 = anγ/2+1], and v1 = a1, . . . , vnγ/2+1 = anγ/2+1 is equivalent to the random event that before step a1 only high edges are chosen, that at any step between al and al+1 only high edges are chosen for any l with 1 ≤ l ≤ nγ/2, and that at steps a1, . . . , anγ/2+1 only low edges are chosen. Thus, we have by Claim 3 that P[v1 = a1, . . . , vnγ/2+1 = anγ/2+1] ≤(cid:0)12 (cid:1)nγ/2+1, n since at each step al, there exists at least one admissible high edge and we do not care about what happens after step vnγ/2+1. There are at most (cid:0) anγ/2+1. Therefore, P ≥ 1 − P[E1] ≥ 1 −(cid:0) have(cid:0) (cid:1) different combinations for a1 < a2 < ··· < (cid:1)nγ/2+1 = e−ω(nγ/2). Hence, P ≥ 1 − e−ω(nγ/2) is overwhelm- (cid:1)nγ/2+1. By Stirling's formula, and observing that nγ/1 + 1 ∈ o(T ), T ∈ Θ(n), we n nγ/2+1 (cid:1)(cid:0) 12 T T nγ/2+1 T (cid:1)(cid:0) 12 n nγ/2+1 ingly large. 5. Main results We shall now analyze the stochastic runtime of our two different random solution generation methods for two classes of TSP instances that have been well studied in the literature. 20 5.1. Stochastic runtime analysis for simple instances following distance function d : E → R on a graph with n vertices. We first consider a class of simple TSP instances that is defined by the 1 if {i, j} = {i, i + 1} for each i = 1, 2, . . . , n − 1, if {i, j} = {n, 1}, (10) d({i, j}) = 1 n otherwise. Obviously, TSP instances with this distance function have a unique optimal solution s∗ = (1, 2, . . . , n) (in the sense of the underlying Hamiltonian cycle), and s∗ has a cost of n. The cost of an arbitrary feasible solution s equals k + (n − k) · n, where k is the number of edges ∈ s that are also in s∗. We shall refer to these instances as G1 in the sequel. The class G1 has been used in [19] and [42] for analyzing the expected runtime of variants of MMAS. Zhou [19] proved that the (1 + 1) MMAA algorithm has an expected runtime of O(n6 + n ln n ) on G1 in the case of non- visibility (i.e., without the greedy distance information in the sampling), and has an expected runtime of O(n5 + n ln n ) in the case of visibility (i.e., with considering the greedy distance information in the sampling). Kotzing et al [42] continued the study in [19]. They investigated the expected runtime of (1 + 1) MMAA and its variant MMAS∗ Arb on G1 and other TSP instances on which both (1 + 1) MMAA and MMAS∗ Arb have exponential expected runtime. MMAS∗ Arb differs with (1 + 1) MMAA only in the random solution generation. MMAS∗ Arb uses Algorithm 3 as its random solution generation method, while (1 + 1) MMAA used Algorithm 2. Kotzing et al [42] proved that MMAS∗ Arb has an expected runtime of O(n3 ln n + n ln n ) on G1. ρ ρ Theorem 1 shows a stochastic runtime of O(n6+) for the CE variant with the add-on, i.e., Algorithm 1 with max-min calibration (6), the vertex-based random solution generation, and a stochastic runtime of O(n4+) for the edge-based random solution generation. These results are comparable with the above known expected runtimes. Although we are not able to get strictly superior runtimes, our results are actually stronger and more informative. ρ Theorem 1 (Stochastic runtime of Algorithm 1 with max-min calibration on G1). Assume that we set M = 1, ρ = 1, and use Algorithm 1 with the max-min calibration (6) for the values πmin = 1 n(n−2), πmax = 1 − 1 n. Then a) if we use the vertex-based random solution generation method (Algo- rithm 2), and take a sample size N ∈ Ω(n5+) for any constant  ∈ 21 (0, 1), then with a probability at least 1− e−Ω(N/n5) the optimal solution s∗ can be found within n iterations; b) if we use the edge-based random solution generation method (Algorithm 3), and take a sample size N ∈ Ω(n3+) for a constant  ∈ (0, 1), then with a probability at least 1 − e−Ω(N/n3), the optimal solution can be found within n iterations. Proof. We prove the Theorem by showing that the probability of the random event that before the optimal solution is met, the number of edges shared by the iteration-best and optimal solution strictly increases is overwhelmingly large. This implies that the optimal solution is found within n iterations, since the optimal solution has only n edges. Furthermore, the runtimes presented in the Theorem hold. We only discuss the case of a), b) follows with an almost identical argument. By [19] (see also proof of Theorem 2), if X[1] t is not optimal, it has at least either a 2-opt move or a 3-opt move. Note that for G1, any k-opt move of the iteration-best solution increases the number of its edges shared with the optimal solution. By Claim 1, any 2-opt move is generated by Algorithm 2 with probability Ω(n−3), and any 3-opt move is generated with probability Ω(n−5). Thus, if X[1] t+1 shares more edges with t t with a probability at least 1 − (1 − n−5)N = the optimal solution than X[1] 1−e−Ω(N/n5) ∈ 1−e−Ω(n) if N ∈ Ω(n5+) for any  > 0. Thus, this repeatedly happens within polynomially many number of iterations with overwhelming probability 1 − e−Ω(N/n5). This completes the proof. is not optimal, X[1] The stochastic runtimes of Theorem 1 are derived for a relatively large sample size, namely N = Ω(n5+) and N = Ω(n3+). Actually, Theorem 1 may still hold for a smaller sample size. Theorem 2 partially asserts this. It states that the total number of iterations required to reach the optimal solution for both generation schemes may increase considerably if a smaller sample size is used. However, the stochastic runtime does not increase. In- terestingly, one can obtain a smaller stochastic runtime with a small sample size for the edge-based random solution generation. Theorem 2 (Stochastic runtime of Algorithm 1 on G1 for a small sample size). Assume the conditions in Theorem 1, but set N ∈ Ω(n) for any  ∈ (0, 1). Then: 22 a) For the vertex-based random solution generation, Algorithm 1 finds the optimal solution s∗ within n6 iterations with a probability of 1− e−Ω(N ). b) For the edge-based random solution generation, Algorithm 1 finds the optimal solution s∗ within n3 ln n iterations with a probability of 1 − e−Ω(N ). Proof of Theorem 2. The proof shares a similar idea with that of Theorem 1. However, we consider here the random event that the number of edges shared by the iteration-best and optimal solution does not decrease and strictly increases enough times within a specified polynomial number of iterations. For a), we shall consider the first n6 iterations. By Claim 2, the number of edges shared by the iteration-best and optimal solution does not decrease with a probability 1 −(cid:0)1 − Ω(1)(cid:1)N = 1 − e−Ω(N ) (N ∈ Ω(n)). Therefore, (cid:81)n6 the number does not decrease within the first n6 iterations with probability t=0(1−e−Ω(N )) = 1−e−Ω(N ). By Claim 1, for every consecutive n5 iterations, 1 −(cid:0)(1 − n−5)N(cid:1)n5 if the starting iteration-best solution is not optimal, then with probability = 1 − e−Ω(N ), the number will strictly increase at least once within these n5 iterations. Therefore, with overwhelming probability 1− e−Ω(N ), the optimal solution will be reached within the period of the first n6 iterations, since there are n many consecutive n5 iterations within that period. b) can be proved by a similar way with a). We shall consider the first n3 ln n iterations. By Claim 4, with probability 1− (1− Ω(1))N = 1− e−Ω(N ), the number of shared edges does not decrease in consecutive two iterations. To complete the proof, we need an extra fact on 2, 3-exchanges. t found so far has n−k edges from the optimal solution s∗, then the probability of the t+1 has at least n−k+1 edges from s∗, is in Ω(k/n3). We shall use a event that s∗ different but simpler proof to show that this also holds in our case of iteration- best reinforcement. And with this fact, if X[1] n, then with probability 1 − ((1 − k · n−3)N )n3/k = 1 − e−Ω(N ), the number of edges shared by the iteration-best solution and s∗ will strictly increase at least once within the period [t, t + n3/k]. This implies that s∗ is sampled within the first n3 ln n iterations with overwhelming probability 1 − e−Ω(N ), since n3 ln n iterations can be partitioned into n many consecutive phases [0, n2), [n2, n2 +n3/(n−1)), [n2 +n3/(n−1), n2 +n3/(n−1)+n3/(n−2)), . . . . We now prove that fact. (cid:84) s∗ = n−k for some 0 < k ≤ Kotzing et al [42] showed for MMAS∗ Arb that if the best solution s∗ t 23 We first show that when X[1] 2-opt move or a 3-opt move for X[1] t that X[1] t e∗ = {i, i + 1} be an edge in s∗ but not in X[1] graph is exactly incident to two edges of s∗ and X[1] there exists an edge e0 ∈ X[1] incident to i, an edge e(cid:48) and e0, e(cid:48) {i, v}, and e(cid:48) t ∩ s∗ = n− k with k > 0, then there exists a (see also [19] for a similar proof). Assume contains exactly n − k edges from s∗ for some integer k > 0. Let t . Note that each node of the t , respectively. Therefore 0 ∈ X[1] incident to i+1, 0 are not in s∗. Figure 2 shows an example, where e0 is either {i, u} or 0 = {i+1, w} or 0 is either {i+1, w} or {i+1, y}. If e0 = {i, u} and e(cid:48) t t 0 = {i+1, y}, then there exists a 2-opt move of X[1] Figure 2: Demonstration of adding a new edge. The solid edges represent the cycle X[1] t . if e0 = {i, v} and e(cid:48) t which 0 of distance n and adds e∗ and another edge (either {u, w} or removes e0, e(cid:48) {v, y}) of distance at most n + 1 together. If e0 = {i, u}, e(cid:48) 0 = {i+1, y} or 0 = {i+1, w}, there is a 3-opt move of X[1] e0 = {i, v}, e(cid:48) t which removes e0, e(cid:48) 0, and an edge e1 /∈ s∗, and adds edge e∗ and another two edges, this replacing 3 edges of distance n by 3 edges of distance at most 2n+1 together. Here, observe the fact that adding e∗ to X[1] results in graph containing a cycle, and there must be an edge e1 ∈ X[1] t on that cycle that does not belong to s∗. We choose this edge as the edge e1. Therefore, for each e∗ of the k remaining edges in s∗ that are not in X[1] t , there exists a 2-opt or 3-opt move of X[1] By Claim 4, for any l ∈ O(1), the probability of producing an l-exchange t of the iteration-best solution X[1] t by Algorithm 3 in iteration t + 1 is Ω(1). Since any two l-exchanges are produced with the same probability, the prob- ability of producing a particular l-exchange in iteration t + 1 is Ω(1/nl). As a result, Algorithm 3 produces for each edge e∗ ∈ s∗ − X[1] t a 2-opt or 3-opt move of X[1] t that adds edge e∗ with probability at least Ω(1/n3). t and removing e0, e(cid:48) 0 from X[1] t that adds e∗. 24 ii+1e∗uvwye1 Note that the generation of a 2-exchange (or a 3-exchange) with two newly added edges e2, e3 by Algorithm 3 includes two mutually exclusive cases (3! cases for a 3-exchange): e2 is chosen before e3, or e3 is chosen before e2. It is not difficult to see that these two cases (3! cases for 3-exchange) have the same probability. Therefore, the probability of the event that Algorithm 3 t that e∗ as one of the newly added edges generates a 2-opt or 3-opt move of X[1] and selects e∗ before the other newly added edges, is bounded from below t has k such e∗ and the corresponding k by Ω(1/3!n3) = Ω(1/n3). Since X[1] events are also mutually exclusive, we obtain that the probability that X[1] t+1 t has exactly n − k edges from s∗ for has more edges from s∗ than X[1] a constant k > 0 is Ω(k/n3) if X[1] t Corollary 1 further improves the stochastic runtime for an even smaller sample size. It can be proved by an argument similar to the proof of Theorem 1, where we observe that (1− (1− p(n))ω(ln n))nl = 1− n−ω(1) for any constant l > 0 and probability p(n) ∈ Ω(1), and that 1 − e−ω(ln n) = 1 − n−ω(1). Corollary 1. Assume the conditions in Theorem 1, but let N ∈ ω(ln n). Then: a) For the vertex-based random solution generation, Algorithm 1 finds the optimal solution s∗ within n6 iterations with a probability of 1− n−ω(1). Particularly, if N = (ln n)2, the runtime is n6(ln n)2 with probability 1 − n−ω(1). b) For the edge-based random solution generation, Algorithm 1 finds the optimal solution s∗ within n3 ln n iterations with a probability of 1 − n−ω(1). Particularly, if N = (ln n)2, the runtime is n3(ln n)3 with prob- ability 1 − n−ω(1). Theorem 2 tells that, for any  ∈ (0, 1), a sample size of N ∈ Θ(n) is already sufficient for iteration-best reinforcement to efficiently find an optimal solution of simple TSP instances with an overwhelming probability. Corollary 1 further shows that N ∈ ω(ln n) even leads to a better runtime with a slightly smaller but still overwhelming probability. Theorem 3 below shows that with an overwhelming probability, the runtime of iteration-best reinforcement will be exponential if N ∈ O(ln n), even if the instances are as simple as those in G1. 25 Theorem 3. Assume the conditions of Theorem 1, but set N < 1 220 ln n. Then, with probability 1 − e−Ω(n1/200), Algorithm 1 with edge-based solution generation does not find the optimal solution s∗ within eΘ(n1/300) iterations. Proof. We prove the Theorem by inspecting the probability of the random event that, before the optimal solution is found, the cost of the iteration- best solution X[1] t will oscillate for exponentially many iterations with an overwhelming probability. We shall consider this in the last stages of the optimization process. Let T0 be the first iteration which samples a solution containing at least n − n1/4 + n1/5 edges from the optimal solution. We show that with an overwhelming probability, the number of common edges in the iteration-best and optimal solution will drop below n− n1/4 + n1/5 and the optimal solution is not sampled before that. This will imply the conclusion of Theorem 3, since, with an overwhelming probability, this phenomenon can repeatedly occur exponentially many times before optimal solution is found. To that end, we need to show the following: 1) For any 1/4 > δ > 0, if X[1] t contains at least n − nδ edges from the optimal solution, then with a probability O( 1√ n), the random solution generated by Algorithm 3 will contain more edges from the optimal solution than X[1] t in iteration t + 1; 2) For any 1/4 > δ > 0, if X[1] t contains at least n − nδ edges from the optimal solution, then with a probability Ω(1) (at least e−5), the random solution generated by Algorithm 3 will contain fewer edges from the optimal solution than X[1] t in iteration t + 1. T0 However, we first use these two facts and show them afterwards. By Claim 6, with probability 1−e−ω(n1/20), X[1] contains at most n−n1/4+ n1/5 + n1/10 edges from the optimal solution, since the random event that the number of common edges from the iteration-best and optimal solution increases more than n1/10 in one iteration implies an occurrence of a Ω(n1/10)- exchange. Similarly, by Claim 6 again, with probability 1 − e−ω(n1/200), the iteration-best solution contains k ∈ [n − n1/4 + n1/5 − n1/6+1/100, n − n1/4 + n1/5 + n1/10 + n1/6+1/100] edges from the optimal solution in each iteration t ∈ [T0, T0 + n1/6]. This means that the optimal solution is not found in the period [T0, T0 + n1/6] with an overwhelming probability. With the help of 1) and 2), we are now to show that within this period, the number of edges 26 shared by the iteration-best and optimal solution is significantly reduced with an overwhelming probability. This will complete the proof. To facilitate our discussion, we call an iteration a successful iteration if its iteration-best solution contains more edges from the optimal solution than the last iteration-best solution, and an iteration a failure iteration if its iteration-best solution contains fewer edges from the optimal solution than the last iteration-best solution. 6− 1 44 ), since N < 1 n1/3 ), since N < 1 By 1) and the subsequent discussion, the expected number of success- ful iterations within [T0, T0 + n1/6] is O( ln n 220 ln n. Thus, by the Chernoff bound, with probability 1 − e−Ω(n1/6), at most n1/100 suc- cessful iterations can occur within [T0, T0 + n1/6]. By 2) and the subse- quent discussion, the expected number of failure iterations in [T0, T0 + n1/6] is Ω(n 1 220 ln n. By the Chernoff bound, it happens that with probability 1 − e−Ω(n1/6), at least n1/7 failure iterations will occur in [T0, T0 + n1/6]. Since a successful iteration can add at most n1/100 edges from the optimal solution with probability 1 − e−ω(n1/200), it totally adds at most n1/100 × n1/100 = n1/50 edges from the optimal solution to the iteration-best solution within [T0, T0 +n1/6] with probability 1−e−ω(n1/200). Note that within [T0, T0 + n1/6], with probability 1 − e−Ω(n1/6), at least n1/7 × 1 = n1/7 "good" edges are removed from the iteration-best solution. Therefore, with over- whelming probability 1 − e−Ω(n1/200), X[1] T0+n1/6 will contain at most n − n1/4 + n1/5 + n1/10 − n1/7 + n1/50 < n − n1/4 + n1/5 contains at most n− n1/4 + n1/5 + edges from the optimal solution, since X[1] T0 n1/10 iterations with probability 1 − e−Ω(n1/20). As a result, with probability 1−e−Ω(n1/200), the number of common edges in the iteration-best and optimal solution will again be smaller than n− n1/4 + n1/5 in some iteration after T0, and the optimal solution is not found before that. And this will repeatedly happen eΘ(n1/300) times with probability 1 − e−Ω(n1/200). By taking k = 2 and considering the(cid:0)n (cid:1) 2-exchanges that happen in the first To finish the proof, we now formally prove 1) and 2). We first consider 2). √ n − 3 n steps in the proof of Claim 4, one can show a tighter probability √ e5 for producing 2-exchanges of X[1] lower bound 1 t by Algorithm 3. Here, we observe that the probability of choosing a high edge at a step before n− 3 n is at least 1 − 3/(n − 2), see the proof of Claim 3. 2 Note that if 2-exchanges deleting 2 edges from the optimal solution hap- pen N times in an iteration, then the iteration will be a failure iteration. 27 By the above and the fact that any two k-exchanges happen with the same probability, a failure iteration then occurs with a probability at least (cid:32) (cid:1) (cid:33)N (cid:0)n−nδ (cid:1) (cid:0)n 2 2 1 e5 (cid:32) ≥ 1 e5 (cid:1) (cid:33) 1 (cid:0)n−nδ (cid:1) (cid:0)n 2 2 220 ln n ∈ Ω(n−1/44), where δ ∈ (0, 1/4) and N < 1 220 ln n. This asserts 2). 1) follows with a similar discussion. Since X[1] t is assumed to contain at least n − nδ edges from the optimal solution for some δ ∈ (0, 1/4), and since Ω(nδ)-exchanges happen with an overwhelmingly small probability, we need to consider only O(nδ)-exchanges when we estimate the probability of a successful iteration. For each k ∈ Ω(nδ), the proportion of failure k-exchanges is bounded from below by (cid:0)n−nδ (cid:1) (cid:0)n (cid:1) = e− 2knδ k n + o(1) ≥ e−2n−1/2 + o(1), k since 0 < δ < 1/4, and k-exchanges removing k edges shared by the iteration- best and optimal solution are not "successful" k-exchanges. Since for any k ∈ Ω(nδ), any two k-exchanges happen with the same probability, and since the sum of the probabilities of successful and failure k-exchanges is smaller than 1, we conclude that successful O(nδ)-exchanges happen with a probability smaller than 1−e2n−1/2 ∈ O( 1√ n). Therefore, a successful iteration happens with a probability 1−(1−O( 1√ n))N ∈ O( ln n√ n ) since N < 1 220 ln n. Theorem 3 generalizes the finding of [20] to simple TSP instances. It formally states that for ρ = 1, N ∈ Ω(ln n) is necessary to efficiently find an optimal solution to TSP. By Theorem 3, Theorem 1, Theorem 2 and its Corollary 1, we have clearly analyzed the impact of the size of N on the resulting stochastic runtime for the simple TSP instances in the case of that ρ = 1. N ∈ ω(ln n) is sufficient to find the optimal solution in a stochastically polynomial runtime, and the degree of the polynomial may increase with N , but the probability guaranteeing the runtime is also increasing with N . 5.2. Stochastic runtime analysis for grid instances Now, we consider more general TSP instances. Herein, the n vertices are positioned on an m × m grid for some integer m ∈ N+. The vertices are positioned in a way that no three of them are collinear. Figure 3 gives an 28 Figure 3: A grid instance example of such an instance where m = 5 and n = 8. The weight of an edge {l, k} ∈ E in this case is defined as the usual Euclidean distance d(l, k) between vertex l and vertex k for every l, k = 1, . . . , n. In this section, we shall refer to these TSP instances as grid instances. Grid instances have been studied in [43] and [30]. Sutton and Neumann [43] investigated the expected runtime of (1+1) EA and RLS for these in- stances. As a continuation of [43], Sutton et al [30] further proved that the more extensive algorithm (µ + λ) EA finds an optimal solution for the instances expectedly in O((µ/λ)n3m5+nm5+(µ/λ)n4k(2k−1)!) iterations if every of the λ selected parents is mutated by taking a random number of consecutive 2-exchange moves, and expectedly in O((µ/λ)n3m5+nm5+(µ/λ)n2k(k−1)!) iterations with a mixed mutation operator, where k denotes the number of vertices that are not on the boundary of the convex hull of V. Sutton et al [30] also studied general Euclidean TSP instances (without collinearity) and showed similar results in terms of the maximum distance value dmax, the minimum distance value dmin, k and the minimum angle in the triangles formed by the vertices. Before we present our stochastic runtime, we summarize some structural properties of grid instances (some just follow from properties of general Eu- clidean instances). We say that two different edges {i, j} and {k, l} intersect with each other if there exists a point p such that p /∈ {i, j, k, l} locates on both of the two edges, see, e.g., Figure 4a. We say that a solution is 29 01234554321 intersection-free if the corresponding Hamiltonian cycle does not contain in- tersections, see, e.g., Figure 4b. (a) intersection (b) intersection free Figure 4: Example for intersections Obviously, the triangle inequality [49] holds for grid instances. Therefore, removing an intersection by a (unique) 2-exchange move in a solution strictly reduces the total traveling cost, see Figure 4a. Lemma 1 states the well known fact that an optimal solution of grid instances is intersection-free. Lemma 1. Optimal solutions of grid instances are intersection-free. Figure 5: Example for a 2-opt move We now restrict 2-opt moves to 2-exchange moves that remove an inter- section. For example, removing edges {i, j},{k, l} in Figure 5 and adding new edges {i, l},{k, j} form such a 2-opt move. Lemma 2 below says that for grid instances, removing one intersection may reduce the total traveling cost Ω(m−4) if it is applicable. We omit the simple proof here. Interested readers may refer to [30] for a proof. Lemma 2. If a feasible solution to a grid instance contains intersections, then removing the intersection can reduce the total traveling cost Ω(m−4). 30 ikljpikljijklp The convex hull Y(V ) of the vertex set V is the smallest convex set in R2 that contains V . Its boundary is a convex polygon spanned by some vertices with possibly other vertices in the interior of that polygon. Let V b denote the set of vertices on the boundary of Y(V ). Figure 6 illustrates this. Figure 6: Example of a convex hull Quintas and Supnick [50] proved that if a solution s is intersection-free, then the solution respects the hull-order, i.e., any two vertices in the sub- sequence of s induced by the boundary (the outer polygon) of Y(V ) are consecutive in s if and only if they are consecutive on the boundary of Y(V ). Therefore, if V b = V, i.e., all of the vertices are on the convex hull, then every intersection-free solution is optimal. Theorem 4 below analyzes the stochastic runtime of Algorithm 1 for grid instances for the case that V = V b. It states that the stochastic runtime is O(n4·m5+) for the vertex-based random solution generation, and O(n3·m5+) for the edge-based random solution generation. Corollary 2 further improves the runtime by sacrificing the probability guarantee. These stochastic run- times are close to the expected runtime O(n3·m5) for RLS reported by Sutton et al [43] and [30]. Theorem 4. Consider a TSP instance with n vertices located on an m × m grid such that no three of them are collinear. Assume that V b = V , i.e., every vertex in V is on the convex hull V b, that we apply the max-min calibration n(n−2), ρ = 1, M = 1 and N ∈ Ω(m) for some (6) with πmax = 1− 1 constant  > 0. Then: n, πmin = 1 a) With an overwhelming probability of 1 − e−Ω(N ), Algorithm 1 finds the optimal solution within at most n4 · m5 iterations with the vertex-based random solution generation. b) With an overwhelming probability of 1 − e−Ω(N ), Algorithm 1 finds an optimal solution within at most n3 · m5 iterations with edge-based ran- dom solution generation. 31 Proof of Theorem 4. Note that under the conditions of Theorem 4, every intersection free solution is optimal. By Lemma 2, we know that a 2-opt move reduces the total traveling cost by Ω(m−4). Therefore, n·m5 consecutive 2-opt moves turn a feasible solution into an optimal one, since the worst solution in this case has a total traveling cost smaller than n·m and the optimal solution has total traveling cost larger than n. Notice also that m≥ n/2, since the n vertices are positioned on the m× m grid and no three of them are collinear. With these facts, we prove the Theorem by a similar argument to the one used in the proof of Theorem 2. Again, we consider the random event that the cost of the iteration best solution does not increase within a specified period of polynomially many iterations and strictly decreases sufficiently many times within that period. For a), we consider the first n4m5 iterations. For b), we consider the first n3m5 iterations. For a) : By Claim 2, with probability (1− (1− Ω(1))N )n4m5 = 1− e−Ω(N ), the cost of the iteration-best solution does not increase within n4m5 itera- tions. By Claim 1, for a phase consisting of consecutive n3 iterations, with probability 1 − (1 − n−3)N·n3 = 1 − e−Ω(N ), in at least one iteration of that phase an intersection is removed from the iteration-best solution, provided the phase starts with an iteration-best solution containing at least one in- tersection. Since the first n4m5 iterations can have nm5 such phases, a) follows. b) follows with an almost identical discussion. We therefore omit the proof. Corollary 2. Consider a TSP instance with n vertices located on an m× m grid such that no three of them are collinear. Assume that V b = V , i.e., every vertex in V is on the convex hull V b, that we apply the max-min calibration (6) with πmax = 1 − 1 n(n−2), ρ = 1, M = 1 and N ∈ ω(ln m). Then: a) With probability 1 − m−ω(1), Algorithm 1 finds the optimal solution within at most n4 · m5 iterations with the vertex-based random solu- tion generation. n , πmin = 1 b) With probability 1−m−ω(1), Algorithm 1 finds an optimal solution within at most n3 · m5 iterations with the edge-based random solution genera- tion. Now, we consider the more interesting case that V − V b = k ∈ O(1), i.e., k vertices are not on the convex hull. Note that we can turn an arbitrary 32 intersection-free solution to an optimal solution only by rearranging the po- sitions of those k interior points in that solution, and this requires at most k consecutive jump moves (see [30] for a proof). A jump move δi,j transforms a solution into another solution by shifting positions i, j as follows. Solution s is transformed into solution δi,j(s) by moving the vertex at position i into po- sition j while vertices at positions between i and j are shifted appropriately, e.g., δ2,5(i1, i2, i3, i4, i5, i6, i7) = (i1, i3, i4, i5, i2, i6, i7) and δ5,2(i1, i2, i3, i4, i5, i6, i7) = (i1, i5, i2, i3, i4, i6, i7). It is not difficult to see that a jump move δi,j can be simulated by either a 2-exchange move (in the case that i−j = 1) or a 3-exchange move (in all other cases). Therefore, we can actually turn an intersection-free solution into an optimal one by a sequence of at most k consecutive 2-exchange or 3-exchange moves. Furthermore, a sequence of k consecutive 2-exchange or 3-exchange moves can be simulated by a κ-exchange move with an integer κ ≤ 3k. This means that any intersection-free solution can be turned into an optimal solution by a κ-exchange move with κ ≤ 3k. We shall call such a κ- exchange move in the sequel a 3k-opt move, although κ may be smaller than n6k−1 ) by 3k. Recall that a 3k-opt move is produced with a probability of Ω( Algorithm 2 (see Claim 1), and with a probability of Ω( 1 n3k ) by Algorithm 3 (see Lemma 6 of [42], or Claim 4) in any of the N independent draws in iteration t, if X[1] t−1 is intersection-free and not optimal. As a result, we obtain by a similar proof as above Theorem 5 below. Theorem 5. Consider a TSP instance with n vertices located on an m × m grid such that no three of them are collinear. Assume that V − V b = k ∈ O(1) (k vertices are not on the convex hull V b), that we apply the max-min calibration 6 with πmax = 1 − 1 n(n−2), and set ρ = 1, M = 1, for some constant  > 0. Then: n , πmin = 1 1 a) If we set N ∈ Ω(n3 · m), then with an overwhelming probability of 1 − e−Ω(N/n3), Algorithm 1 finds an optimal solution within at most n · m5 + n6k−4 iterations with the vertex-based random solution generation; b) If we set N ∈ Ω(n2 · m), then with an overwhelming probability of 1 − e−Ω(N/n2), Algorithm 1 finds an optimal solution within at most n·m5 +n3k−2 iterations with the edge-based random solution generation. 33 Proof of Theorem 5. We only prove a). b) can be derived by a very similar argument. We define two random events as following: E1 : for each t ≤ n · m5 + n6k−4, f (X[1] E2 : for each t ≤ n· m5 + n6k−4, if X[1] t−1 is not intersection-free, then a 2-opt t−1) ≥ f (X[1] t ); move happens in iteration t. By a similar argument as the one for Theorem 4, we obtain that P[E1∩E2] ≥ 1−e−Ω(N/n3). Let η be a random variable denoting the number of iterations for t−1 is intersection-free. Notice that, conditioned on E1∩E2, η ≥ n·m5 which X[1] implies that an optimal solution occurs within n · m5 + n6k−4 iterations. Conditioned on E1 ∩ E2 and η < n · m5, there are at least Ω(n6k−4) itera- tions in which Xt−1 is intersection-free, since each X[1] t−1 is either intersection- free or not intersection-free. Note also that in each iteration in which X[1] t−1 intersection-free and not optimal, a 3k-opt move that turns X[1] t−1 into an op- timal solution happens with probability of at least 1 − (1 − Ω( n6k−1 ))N . This means for any fixed t ∈ N, if X[1] t−1 is intersection-free, then the probability of the event that X[1] n6k−1 ))N . t Therefore, for any fixed Ω(n6k−4) iterations in which the iteration-best solu- tion X[1] t−1 is intersection-free and not optimal, the probability of the event that the corresponding Ω(n6k−4) X[1] t 's are still not optimal, is bounded from above by (1 − Ω( n6k−1 ))N·n6k−4 = e−Ω(N/n3). This means that, conditioned on E1 ∩ E2 and η < n · m5, an optimal solution occurs within n · m5 + n6k−4 iterations with a probability of 1 − e−Ω(N/n3). As a result, an optimal solution occurs within the first n · m5 + n6k−4 iterations with a probability of 1 − e−Ω(N/n3). is optimal is bounded from below by 1− (1− Ω( 1 1 1 Theorem 5 shows a stochastic runtime of n3m5+ +n6k−1m for Algorithm 1 equipped with the vertex-based solution generation, and a stochastic run- time of n3m5+ + n3km for Algorithm 1 equipped with edge-based solution generation, in the case of that V − V b = k ∈ O(1). This is much better than the expected runtime O(µ · n3m5+nm5+µ · n4k(2k−1)!) for (µ+λ) EA with sequential 2-opt mutations reported by Sutton et al [30]. However, we are not able to analyze the stochastic runtime in the case that 34 k ∈ ω(1), since k ∈ ω(1) interior points may require super-polynomially many iterations to turn an intersection-free solution into an optimal solution when a polynomial sample size is used. 6. Conclusion We have analyzed the stochastic runtime of a CE algorithm on two classes of TSP instances under two different random solution generation methods. The stochastic runtimes are comparable with corresponding expected run- times reported in the literature. Our results show that the edge-based random solution generation method makes the algorithm more efficient for TSP instances in most cases. More- over, N ∈ Ω(ln n) is necessary for efficiently finding an optimal solution with iteration-best reinforcement. For simple instances, N ∈ ω(ln n) is sufficient to efficiently find an optimal solution with an overwhelming probability, and N ∈ O(ln n) results in an exponential runtime with an overwhelming proba- bility. However, for more difficult instances, one may need to use a relatively large sample size. Our stochastic runtimes are better than the expected runtimes of the (µ + λ) EA on the grid instances. The EA randomly changes local structures of some of its current solutions by a Poisson distributed number of consecu- tive 2-exchange moves in every iteration, while our algorithm refrains from local operations on current solutions and only refreshes solutions by sam- pling from an evolving distribution. The solution reproducing mechanism in the EA stays the same throughout the optimization, only the current solu- tions in every iteration vary. However, the solution reproducing mechanism (sampling distribution) of our algorithm also evolves. This is the essential difference of MBS with traditional EAs. The comparison of our results with the expected runtimes in [30] therefore show that using a self-adaptive dy- namic solution reproducing mechanism is helpful (in efficiently finding an optimal solution) when the search space becomes rugged. The stochastic runtimes in Theorem 4 are only valid for instances with a bounded number of interior points. In the future, it should be interesting to analyze the case that V − V b ∈ ω(1). This might also give more insight to the problem of RP v.s. P [51]. Our analysis is actually a kind of worst-case analysis, which is rather pessimistic. We analyze the optimization progress by only checking some very particular random events. This may not only underestimate the probability 35 of finding an optimal solution with our algorithm, but also overestimate the required number of iterations. In the future, it should be of great interest to consider a smoothed runtime analysis over an -neighborhood of the n nodes in the real plane as has been done for the Simplex method by Spielman and Teng in their famous paper [52]. Acknowledgment We thank the anonymous reviewers for their numerous useful suggestions on improving the scientific quality and English presentation of this article. References [1] R. Y. Rubinstein, D. P. Kroese, The cross-entropy method: a unified approach to combinatorial optimization, Monte-Carlo simulation and machine learning, Springer Science & Business Media, 2004. [2] R. Y. Rubinstein, Optimization of computer simulation models with rare events, European Journal of Operational Research 99 (1) (1997) 89–112. [3] R. Y. Rubinstein, The cross-entropy method for combinatorial and con- tinuous optimization, Methodology and computing in applied probabil- ity 1 (2) (1999) 127–190. [4] M. Dorigo, T. Stutzle, Ant colony optimization, Cambridge, Mas- sachusetts: A Bradford Book, MIT Press, 2004. [5] M. Hauschild, M. Pelikan, An introduction and survey of estimation of distribution algorithms, Swarm and Evolutionary Computation 1 (3) (2011) 111–128. [6] M. Zlochin, M. Birattari, N. Meuleau, M. Dorigo, Model-based search for combinatorial optimization: A critical survey, Annals of Operations Research 131 (1-4) (2004) 373–395. [7] D. Whitley, A genetic algorithm tutorial, Statistics and computing 4 (2) (1994) 65–85. [8] H. R. Louren¸co, O. C. Martin, T. Stutzle, Iterated local search, Springer, 2003. 36 [9] Z. Wu, Model-based heuristics for combinatorial optimization: a math- ematical study of their asymptotic behavior, Ph.D. thesis, Institut fur Angewandte Stochastik und Operations Research (IASOR), Technical University of Clausthal (2015). [10] T. Stutzle, H. H. Hoos, MAX-MIN ant system, Journal of Future Gen- eration Computer Systems 16 (2000) 889–914. [11] S. Droste, T. Jansen, I. Wegener, On the analysis of the (1+1) evolution- ary algorithm, Theoretical Computer Science 276 (1-2) (2002) 51–81. [12] J. He, X. Yao, Drift analysis and average time complexity of evolutionary algorithms, Artificial Intelligence 127 (1) (2001) 57–85. [13] F. Neumann, C. Witt, Runtime analysis of a simple ant colony optimiza- tion algorithm, Tech. rep., Departmant of Computer Science, University of Dortmund, Germany (2006). [14] C. Witt, Runtime analysis of the (µ +1) ea on simple pseudo-boolean functions, Evolutionary Computation 14 (1) (2006) 65–86. [15] F. Neumann, C. Witt, Runtime analysis of a simple ant colony opti- mization algorithm, Algorithmica 54 (2) (2009) 243–255. [16] B. Doerr, F. Neumann, D. Sudholt, C. Witt, Runtime analysis of the 1- ant ant colony optimizer, Theoretical Computer Science 412 (17) (2011) 1629–1644. [17] W. J. Gutjahr, G. Sebastiani, Runtime analysis of ant colony optimiza- tion with best-so-far reinforcement, Methodology & Computing in Ap- plied Probability 10 (3) (2008) 409–433. [18] Y. Zhou, J. He, A runtime analysis of evolutionary algorithms for con- strained optimization problems, IEEE Transactions on Evolutionary Computation 11 (5) (2007) 608–619. [19] Y. Zhou, Runtime analysis of an ant colony optimization algorithm for tsp instances, Evolutionary Computation IEEE Transactions on 13 (5) (2009) 1083–1092. 37 [20] F. Neumann, D. Sudholt, C. Witt, A few ants are enough:aco with iteration-best update, in: Genetic and Evolutionary Computation Con- ference, GECCO 2010, Proceedings, Portland, Oregon, Usa, July, 2010, pp. 63–70. [21] P. S. Oliverto, C. Witt, Improved time complexity analysis of the simple genetic algorithm, Theoretical Computer Science 605 (15) (2015) 21–41. [22] D. Sudholt, C. Thyssen, Runtime analysis of ant colony optimization for shortest path problems, Journal of Discrete Algorithms 10 (10) (2012) 165–180. [23] A. Lissovoi, C. Witt, Runtime analysis of ant colony optimization on dy- namic shortest path problems, Theoretical Computer Science 561 (2015) 73–85. [24] Y. Chen, X. Zou, Runtime analysis of a multi-objective evolutionary al- gorithm for obtaining finite approximations of pareto fronts, Information Sciences 262 (2014) 62–77. [25] D. Sudholt, C. Witt, Update strength in edas and aco: How to avoid genetic drift, in: Genetic and Evolutionary Computation Conference, 2016, pp. 61–68. [26] D. H. Wolpert, W. G. Macready, No free lunch theorems for optimiza- tion, IEEE Transactions on Evolutionary Computation 1 (1) (1997) 67– 82. [27] F. Neumann, D. Sudholt, C. Witt, Analysis of different mmas aco algo- rithms on unimodal functions and plateaus, Swarm Intelligence 3 (2009) 35–68. [28] F. Neumann, I. Wegener, Randomized local search, evolutionary algo- rithms, and the minimum spanning tree problem, Theoretical Computer Science 378 (2007) 32–40. [29] J. Reichel, M. Skutella, Evolutionary algorithms and matroid optimiza- tion problems, Algorithmica 57 (1) (2010) 187–206. [30] A. M. Sutton, F. Neumann, S. Nallaperuma, Parameterized runtime analyses of evolutionary algorithms for the planar euclidean traveling salesperson problem, Evolutionary Computation 22 (4) (2014) 595–628. 38 [31] A. M. Sutton, J. Day, F. Neumann, A parameterized runtime analysis of evolutionary algorithms for max-2-sat, in: Conference on Genetic & Evolutionary Computation, 2012, pp. 433–440. [32] Y. Zhou, X. Lai, K. Li, Approximation and parameterized runtime anal- ysis of evolutionary algorithms for the maximum cut problem., IEEE Transactions on Cybernetics 45 (8) (2015) 1491–1498. [33] Z. Wu, M. Kolonko, Asymptotic properties of a generalized cross entropy optimization algorithm, IEEE Transactions on Evolutionary Computa- tion 18 (5) (2014) 658 – 673. [34] Z. Wu, M. Kolonko, R. H. Mohring, Stochastic runtime analysis of the cross entropy algorithm, IEEE Transactions on Evolutionary Computa- tion, DOI: 10.1109/TEVC.2017.2667713. [35] M. Held, R. M. Karp, A dynamic programming approach to sequencing problems, Journal of the Society for Industrial and Applied Mathematics 10 (1) (1962) 196–210. [36] N. Christofides, Worst-case analysis of a new heuristic for the travelling salesman problem, Tech. rep., Graduate School of Industrial Adminis- tration, CMU (1976). [37] M. T. Goodrich, R. Tamassia, Algorithm Design and Applications, Wi- ley, 2015. [38] S. Arora, Polynomial time approximation schemes for Euclidean travel- ing salesman and other geometric problems, Journal of the ACM 45 (5) (1988) 753–782. [39] J. S. B. Mitchell, A constant-factor approximation algorithm for tsp with pairwise-disjoint connected neighborhoods in the plane, in: Twenty- Sixth Symposium on Computational Geometry, 2010, pp. 183–191. [40] S. Lin, B. W. Kernighan, An effective heuristic algorithm for the traveling-salesman problem, Operations Research 21 (2) (1973) 498–516. [41] P. T. D. Boer, D. P. Kroese, S. Mannor, R. Y. Rubinstein, A tutorial on the cross-entropy method, Annals of Operations Research 134 (1) (2005) 19–67. 39 [42] T. Kotzing, F. Neumann, H. Roglin, C. Witt, Theoretical analysis of two aco approaches for the traveling salesman problem, Swarm Intelligence 6 (1) (2012) 1–21. [43] A. M. Sutton, F. Neumann, A parameterized runtime analysis of evolu- tionary algorithms for the euclidean traveling salesperson problem, in: Proceedings of the Twenty-Sixth Conference on Artificial Intelligence (AAAI'12), AAAI press, 2012, pp. 1105–1111. [44] A. Costa, O. D. Jones, D. Kroese, Convergence properties of the cross- entropy method for discrete optimization, Operations Research Letters 35 (5) (2007) 573–580. [45] Z. Wu, M. Kolonko, Absorption in model-based search algorithms for combinatorial optimization, in: Evolutionary Computation (CEC), 2014 IEEE Congress on, IEEE, 2014, pp. 1744–1751. [46] M. Thomas, Machine learning, New Delhi: McGraw Hill Education In- dia, 1997. [47] H. Asoh, H. Muhlenbein, On the mean convergence time of evolutionary algorithms without selection and mutation, in: Parallel Problem Solving from Nature-PPSN III, Springer, 1994, pp. 88–97. [48] M. Pirlot, General local search methods, European Journal of Opera- tional Research 92 (3) (1996) 493–511. [49] M. A. Khamsi, W. A. Kirk, An introduction to metric spaces and fixed point theory, John Wiley,, 2001. [50] L. V. Quintas, F. Supnick, On some properties of shortest Hamiltonian circuits, American Mathematical Monthly 72 (9) (1965) 977–980. [51] W. Gasarch, Classifying problems into complexity classes, Advances in Computers 95 (2015) 239–292. [52] D. A. Spielman, S. H. Teng, Smoothed analysis of algorithms: Why the simplex algorithm usually takes polynomial time, Journal of the Acm 51 (3) (2004) 385–463. 40
1503.01203
2
1503
2015-04-02T08:31:44
On the Number of Minimal Separators in Graphs
[ "cs.DS", "cs.DM", "math.CO" ]
We consider the largest number of minimal separators a graph on n vertices can have at most. We give a new proof that this number is in $O( ((1+\sqrt{5})/2)^n n )$. We prove that this number is in $\omega( 1.4521^n )$, improving on the previous best lower bound of $\Omega(3^{n/3}) \subseteq \omega( 1.4422^n )$. This gives also an improved lower bound on the number of potential maximal cliques in a graph. We would like to emphasize that our proofs are short, simple, and elementary.
cs.DS
cs
On the Number of Minimal Separators in Graphs Serge Gaspers1,2 and Simon Mackenzie1,2 1 The University of New South Wales, Australia, {sergeg,simonwm}@cse.unsw.edu.au 2 NICTA, Australia Abstract. We consider the largest number of minimal separators a graph on n vertices can have at most. -- We give a new proof that this number is in O (cid:16)(cid:16) 1+√5 -- We prove that this number is in ω (1.4521n), improving on the pre- 2 (cid:17)n · n(cid:17). vious best lower bound of Ω(3n/3) ⊆ ω(1.4422n). This gives also an improved lower bound on the number of potential maximal cliques in a graph. We would like to emphasize that our proofs are short, simple, and elementary. 1 Introduction For a graph G = (V, E), and two vertices a, b ∈ V , a vertex subset S ⊆ V \ {a, b} is an (a, b)-separator if a and b are in different connected components of G − S, the graph obtained from G by removing the vertices in S. An (a, b)-separator is minimal if it does not contain another (a, b)-separator as a subset. A vertex subset S ⊂ V is a minimal separator in G if it is a minimal (a, b)-separator for some pair of distinct vertices a, b ∈ V . By sep(G), we denote the number of minimal separators in the graph G. By sep(n), we denote the maximum number of minimal separators, taken over all graphs on n vertices. Potential maximal cliques are closely related to minimal separators, especially in the context of chordal graphs. A graph is chordal if every induced cycle has length 3. A triangulation of a graph G is a chordal supergraph of G obtained by adding edges. A graph H is a minimal triangulation of G if it is a triangulation of G and G has no other triangulation that is a subgraph of H. A vertex set is a potential maximal clique in G if it is a maximal clique in at least one minimal triangulation of G. By pmc(G), we denote the number of potential maximal cliques in the graph G. By pmc(n), we denote the maximum number of potential maximal cliques, taken over all graphs on n vertices. Minimal separators and potential maximal cliques have been studied ex- tensively [1,2,3,10,12,15,16,19,20,21]. Upper bounds on sep(n) are used to up- per bound the running time of algorithms for enumerating all minimal sepa- rators [1,16,20]. Bounds on both sep(n) and pmc(n) are used in analyses of 2 Serge Gaspers and Simon Mackenzie a b ... Fig. 1. Melon graphs have Ω(3n/3) minimal separators. algorithmic running times for computing the treewidth and minimum fill-in of a graph [3,10,12], and for computing a maximum induced subgraph isomorphic to a graph from a family of bounded treewidth graphs [11]. Our results. Fomin et al. [10] proved that sep(n) ∈ O (1.7087n). Fomin and Villanger [12] improved the upper bound and showed that sep(n) ∈ O (ρn · n), where ρ = 1+√5 2 = 1.6180 . . . 3. We prove the same upper bound with simpler arguments. As for lower bounds, it is known [10] that sep(n) ∈ Ω(3n/3); see Fig. 1. We improve on this lower bound by giving an infinite family of graphs with ω (1.4521n) minimal separators. This answers an open question raised numerous times (see, e.g., [9,10]), for example by Fomin and Kratsch [9, page 100], who state It is an open question, whether the number of minimal separators in every n-vertex graph is O∗(3n/3). Here, the O∗-notation is similar to the O-notation, but hides polynomial factors. As a corollary, we have that there is an infinite family of graphs, all with ω(1.4521n) potential maximal cliques. This answers another open question on lower bounds for potential maximal cliques. For example, Fomin and Villanger [11] state There are graphs with roughly 3n/3 ≈ 1.442n potential maximal cliques [10]. Let us remind that by the classical result of Moon and Moser [18] (see also Miller and Muller [17]) that the number of maxi- mal cliques in a graph on n vertices is at most 3n/3. Can it be that the right upper bound on the number of potential maximal cliques is also roughly 3n/3? By Theorem 3.2, this would yield a dramatic improvement for many moderate exponential algorithms. 3 The bound stated in [12] is O(1.6181n ), but this stronger bound can be derived from their proof. On the Number of Minimal Separators in Graphs 3 Preliminaries. We use standard graph notation from [4]. For an edge uv in a graph G, we denote by G/uv the graph obtained from G by contracting the edge uv, i.e., making u adjacent to NG({u, v}) and removing v. 2 Upper bound on the number of minimal separators Measure and Conquer is a technique developed for the analysis of exponential time algorithms [7]. Its main idea is to assign a cleverly chosen (sometimes, by solving mathematical programs [5,13,14]) potential function to the instance -- a so-called measure -- to track several features of an instance in solving it. While developed in the realm of exponential-time algorithms, it has also been used to upper bound the number of extremal vertex sets in graphs (see, e.g., [6,8]). Our new proof upper bounding sep(n) uses a measure that takes into ac- count the number of vertices of the graph and the difference in size between the separated components of the graph. This simple trick allows us to avoid several complications from [12], including the use of an auxiliary lemma (Lemma 3.1 in [12]), fixing the size of the separators, the discussion of "full components", and distinguishing between separators of size at most n/3 and at least n/3. Theorem 1. sep(n) = O(ρn ·n), where ρ = 1+√5 2 = 1.6180... is the golden ratio. Proof. Let G = (V, E) be any graph on n vertices with a ∈ V . For d ≤ V , an [a, d]-separation is a partition (A, S, B) of V such that -- a ∈ A, -- G[A] is connected, -- S is a minimal (a, b)-separator for some b ∈ B, and -- A ≤ B − d. Let sepa(G, d) denote the number of [a, d]-separations in G. By symmetry, sepa(G, 0) upper bounds the number of minimal separators in G up to a fac- tor O(V ). To upper bound sepa(G, d), we will use the measure µ(G, d) = V − d. The theorem will follow from the claim that sepa(G, d) ≤ ρµ(G,d) for 0 ≤ d ≤ V . If µ(G, d) = 0, then d = V and sepa(G, d) = 0 since there is no A ⊆ V with A ≤ 0 and a ∈ A. If dG(a) = 0, then there is at most one [a, d]-separation, which is ({a}, ∅, V \ {a}). Therefore, assume µ(G, d) ≥ 1, a has at least one neighbor, and assume the claim holds for smaller measures. Consider a vertex u ∈ N (a). For every [a, d]-separation (A, S, B), either u ∈ S or u ∈ A. Therefore, we can upper bound the [a, d]-separations (A, S, B) counted in sepa,b(G, d) with u ∈ S by ρµ(G−{u},d) = ρµ(G,d)−1, and those with u /∈ S by ρµ(G/au,d+1) = ρµ(G,d)−2. It remains to observe that ρµ(G,d)−1 + ρµ(G,d)−2 = ρµ(G,d). ⊓⊔ 4 Serge Gaspers and Simon Mackenzie 3 Lower bound on the maximum number of minimal separators In the melon graph in Fig. 1, each horizontal layer implies a choice between 3 vertices. Each of those choices also 'costs' 3 vertices. The new construction improves the bound by adding a vertical choice on top of the horizontal choice. This is achieved by 'sacrificing' one of the horizontal choices. This allows us to chose which layer to sacrifice, at the cost of 6 vertices. If it has more than 3·3 = 9 layers, then this will give a larger range of choices than if we hadn't eliminated that layer. Theorem 2. sep(n) ∈ ω(1.4521n). Proof. We prove the theorem by exhibiting a family of graphs {G1, G2, . . . } and lower bounding their number of minimal separators. Let I = {1, . . . , 6} and J = {1, . . . , 24}. The graph G1 is constructed as follows (see Fig. 2). It has vertex set V = {a, b} ∪ {vi,j : i ∈ I, j ∈ J}. We denote by Vi the vertex set {vi,j : j ∈ J}. The edge set E of G1 is obtained by first adding the paths (a, v1,j, v2,j, v3,j) and (v4,j, v5,j, v6,j, b) for all j ∈ J, and then adding the edges {v3,jv4,k : j, k ∈ J and j 6= k}. The graph Gℓ, ℓ ≥ 2, is obtained from ℓ disjoint copies of G1, merging the copies of a, and merging the copies of b. Let us now lower bound the minimal (a, b)-separators Sj in G1 that do not contain any vertex from {v1,j, v2,j, v3,j, v4,j, v5,j, v6,j} for some j ∈ J. Each such separator contains a vertex from {v1,k, v2,k, v3,k}, for k ∈ K \ {j}, since (a, v1,k, v2,k, v3,k, v4,j, v5,j, v6,j, b) is a path in G1, and it contains a vertex from {v4,k, v5,k, v6,k}, for k ∈ K \{j}, since (a, v1,j, v2,j, v3,j, v4,k, v5,k, v6,k, b) is a path in G1. Due to minimality, the separators in Sj contain no other vertices. Thus, we have that Sj = 32·(J−1). We also note that Sj ∩ Sk = ∅ if j 6= k. Therefore, the number of minimal separators of G1 is at least4 J · 32·(J−1) > 2.1271 · 1023. Minimal (a, b)-separators for Gℓ are obtained by taking the union of minimal separators for the different copies of G1. Their number is therefore at least 6·J ∈ ω(1.4521n), where n = ℓ · 6 · J + 2 is (J · 32·(J−1))ℓ = (J · 32·(J−1)) ⊓⊔ the number of vertices of Gℓ. n−2 Based on results from [2], Bouchitt´e and Todinca [3] observed that the num- ber of potential maximal cliques in a graph is at least the number of minimal separators divided by the number of vertices n. Therefore, we arrive at the fol- lowing corollary of Theorem 2. Corollary 1. pmc(n) ∈ ω(1.4521n). 4 There are also minimal (a, b)-separators that are completely contained in V1 ∪ V2 ∪ V3 or V4 ∪ V5 ∪ V6, but their number does not affect our bound in the first 10 decimal digits in the base of the exponent. On the Number of Minimal Separators in Graphs 5 a b ... ... Fig. 2. The graph G1 has 24 horizontal layers; only 4 are depicted. 4 Conclusion We have given a simpler proof for the best known asymptotic upper bound on sep(n), and we have improved the best known lower bound from Ω(3n/3) to ω(1.4521n), thereby reducing the gap between the current best lower and upper bound. Before our work, it seemed reasonable to believe that sep(n) could be asymptotically equal to the best known lower bound. We showed that this is not the case, and we believe there is room to further improve the lower bound. Acknowledgments NICTA is funded by the Australian Government through the Department of Communications and the Australian Research Council through the ICT Cen- tre of Excellence Program. Serge Gaspers is the recipient of an Australian Research Council Discovery Early Career Researcher Award (project number DE120101761) and a Future Fellowship (project number FT140100048). References 1. Anne Berry, Jean Paul Bordat, and Olivier Cogis. Generating all the minimal separators of a graph. International Journal of Foundations of Computer Science, 11(3):397 -- 403, 2000. 2. Vincent Bouchitt´e and Ioan Todinca. Treewidth and minimum fill-in: grouping the minimal separators. SIAM Journal on Computing, 31:212 -- 232, 2001. 3. Vincent Bouchitt´e and Ioan Todinca. Listing all potential maximal cliques of a graph. Theoretical Computer Science, 276(1-2):17 -- 32, 2002. 4. Reinhard Diestel. Graph Theory. Springer, 2010. 5. David Eppstein. Quasiconvex analysis of multivariate recurrence equations for backtracking algorithms. ACM Transactions on Algorithms, 2(4):492 -- 509, 2006. 6. Fedor V. Fomin, Serge Gaspers, Artem V. Pyatkin, and Igor Razgon. On the minimum feedback vertex set problem: Exact and enumeration algorithms. Algo- rithmica, 52(2):293 -- 307, 2008. 7. Fedor V. Fomin, Fabrizio Grandoni, and Dieter Kratsch. A measure & conquer approach for the analysis of exact algorithms. Journal of the ACM, 56(5):1 -- 32, 2009. 6 Serge Gaspers and Simon Mackenzie 8. Fedor V. Fomin, Fabrizio Grandoni, Artem V. Pyatkin, and Alexey A. Stepanov. Combinatorial bounds via measure and conquer: Bounding minimal dominating sets and applications. ACM Transactions on Algorithms, 5(1):1 -- 17, 2008. 9. Fedor V. Fomin and Dieter Kratsch. Exact Exponential Algorithms. Springer, 2010. 10. Fedor V. Fomin, Dieter Kratsch, Ioan Todinca, and Yngve Villanger. Exact algorithms for treewidth and minimum fill-in. SIAM Journal on Computing, 38(3):1058 -- 1079, 2008. 11. Fedor V. Fomin and Yngve Villanger. Finding induced subgraphs via minimal triangulations. In Proceedings of the 27th International Symposium on Theoretical Aspects of Computer Science (STACS 2010), volume 5 of LIPIcs, pages 383 -- 394. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2010. 12. Fedor V. Fomin and Yngve Villanger. Treewidth computation and extremal com- binatorics. Combinatorica, 32(3):289 -- 308, 2012. 13. Serge Gaspers. Exponential Time Algorithms: Structures, Measures, and Bounds. VDM Verlag Dr. Mueller e.K., 2010. 14. Serge Gaspers and Gregory B. Sorkin. A universally fastest algorithm for Max 2-Sat, Max 2-CSP, and everything in between. Journal of Computer and System Sciences, 78(1):305 -- 335, 2012. 15. Pinar Heggernes. Minimal triangulations of graphs: A survey. Discrete Mathemat- ics, 306(3):297 -- 317, 2006. 16. Ton Kloks and Dieter Kratsch. Listing all minimal separators of a graph. SIAM Journal on Computing, 27(3):605 -- 613, 1998. 17. R. E. Miller and D. E. Muller. A problem of maximum consistent subsets. IBM Research Report RC-240, J. T. Watson Research Center, Yorktown Heights, NY, 1960. 18. John W. Moon and Leo Moser. On cliques in graphs. Israel Journal of Mathemat- ics, 3:23 -- 28, 1965. 19. Andreas Parra and Petra Scheffler. Characterizations and algorithmic applica- tions of chordal graph embeddings. Discrete Applied Mathematics, 79(1-3):171 -- 188, 1997. 20. Hong Shen and Weifa Liang. Efficient enumeration of all minimal separators in a graph. Theoretical Computer Science, 180(1-2):169 -- 180, 1997. 21. Yngve Villanger. Improved exponential-time algorithms for treewidth and min- imum fill-in. In Proceedings of the 7th Latin American Theoretical Informatics Symposium (LATIN 2006), volume 3887 of Lecture Notes in Computer Science, pages 800 -- 811. Springer-Verlag, Berlin, 2006.
1808.08419
3
1808
2018-11-05T17:04:10
The Complexity of $(\Delta + 1)$Coloring inCongested Clique, Massively Parallel Computation,and Centralized Local Computation
[ "cs.DS" ]
We present new randomized algorithms that improve the complexity of the classic $(\Delta+1)$-coloring problem, and its generalization $(\Delta+1)$-list-coloring, in three well-studied models of distributed, parallel, and centralized computation: Distributed Congested Clique: We present an $O(1)$-round randomized algorithm for $(\Delta+1)$-list coloring in the congested clique model of distributed computing. This settles the asymptotic complexity of this problem. It moreover improves upon the $O(\log^\ast \Delta)$-round randomized algorithms of Parter and Su [DISC'18] and $O((\log\log \Delta)\cdot \log^\ast \Delta)$-round randomized algorithm of Parter [ICALP'18]. Massively Parallel Computation: We present a $(\Delta+1)$-list coloring algorithm with round complexity $O(\sqrt{\log\log n})$ in the Massively Parallel Computation (MPC) model with strongly sublinear memory per machine. This algorithm uses a memory of $O(n^{\alpha})$ per machine, for any desirable constant $\alpha>0$, and a total memory of $\widetilde{O}(m)$, where $m$ is the size of the graph. Notably, this is the first coloring algorithm with sublogarithmic round complexity, in the sublinear memory regime of MPC. For the quasilinear memory regime of MPC, an $O(1)$-round algorithm was given very recently by Assadi et al. [SODA'19]. Centralized Local Computation: We show that $(\Delta+1)$-list coloring can be solved with $\Delta^{O(1)} \cdot O(\log n)$ query complexity, in the centralized local computation model. The previous state-of-the-art for $(\Delta+1)$-list coloring in the centralized local computation model are based on simulation of known LOCAL algorithms.
cs.DS
cs
The Complexity of (∆ + 1) Coloring in Congested Clique, Massively Parallel Computation, and Centralized Local Computation Yi-Jun Chang U. Michigan Manuela Fischer Mohsen Ghaffari ETH Zurich ETH Zurich [email protected] [email protected] [email protected] Jara Uitto ETH Zurich & U. Freiburg Yufan Zheng U. Michigan [email protected] [email protected] Abstract In this paper, we present new randomized algorithms that improve the complexity of the classic (∆+1)-coloring problem, and its generalization (∆+1)-list-coloring, in three well-studied models of distributed, parallel, and centralized computation: Distributed Congested Clique: We present an O(1)-round randomized algorithm for (∆ + 1)-list coloring in the congested clique model of distributed computing. This settles the asymptotic complexity of this problem. It moreover improves upon the O(log∗ ∆)-round randomized algorithms of Parter and Su [DISC'18] and O((log log ∆) · log∗ ∆)-round ran- domized algorithm of Parter [ICALP'18]. Massively Parallel Computation: We present a (∆ + 1)-list coloring algorithm with round complexity O(√log log n) in the Massively Parallel Computation (MPC) model with strongly sublinear memory per machine. This algorithm uses a memory of O(nα) per machine, for any desirable constant α > 0, and a total memory of eO(m), where m is the size of the graph. Notably, this is the first coloring algorithm with sublogarithmic round complexity, in the sublinear memory regime of MPC. For the quasilinear memory regime of MPC, an O(1)-round algorithm was given very recently by Assadi et al. [SODA'19]. Centralized Local Computation: We show that (∆ + 1)-list coloring can be solved with ∆O(1)·O(log n) query complexity, in the centralized local computation model. The previous state-of-the-art for (∆ + 1)-list coloring in the centralized local computation model are based on simulation of known LOCAL algorithms. The deterministic O(√∆poly log ∆ + log∗ n)-round LOCAL algorithm of Fraigniaud et al. [FOCS'16] can be implemented in the centralized local computation model with query complexity ∆O(√∆poly log ∆)·O(log∗ n); the randomized O(log∗ ∆) + 2O(√log log n)-round LOCAL algorithm of Chang et al. [STOC'18] can be implemented in the centralized local computation model with query complexity ∆O(log∗ ∆) · O(log n). 1 Introduction, Related Work, and Our Results In this paper, we present improved randomized algorithms for vertex coloring in three models of distributed, parallel, and centralized computation: the congested clique model of distributed computing, the massively parallel computation model, and the centralized local computation model. We next overview these results in three different subsections, while putting them in the context of the state of the art. The next section provides a technical overview of the known algorithmic tools as well as the novel ingredients that lead to our results. (∆ + 1)-coloring and (∆ + 1)-list Coloring. Our focus is on the standard ∆ + 1 vertex coloring problem, where ∆ denotes the maximum degree in the graph. All our results work for the gener- alization of the problem to (∆ + 1)-list coloring problem, defined as follows: each vertex v in the graph G = (V, E) is initially equipped with a set of colors Ψ(v) such that Ψ(v) = ∆ + 1. The goal is to find a proper vertex coloring where each vertex v ∈ V is assigned a color in Ψ(v) such that no two adjacent vertices are colored the same. 1.1 Congested Clique Model of Distributed Computing Models of Distributed Computation. There are three major models for distributed graph algorithms, namely LOCAL, CONGEST, and CONGESTED-CLIQUE. In the LOCAL model [Lin92, Pel00], the input graph G = (V, E) is identical to the communication network and each v ∈ V hosts a processor that initially knows deg(v), a unique Θ(log n)-bit ID(v), and global graph parameters n = V and ∆ = maxv∈V deg(v). Each processor is allowed unbounded computation and has access to a stream of private random bits. Time is partitioned into synchronized rounds of communication, in which each processor sends one unbounded message to each neighbor. At the end of the algorithm, each v declares its output label, e.g., its own color. The CONGEST model [Pel00] is a variant of LOCAL where there is an O(log n)-bit message size constraint. The CONGESTED-CLIQUE model, introduced in [LPSPP05], is a variant of CONGEST that allows all-to-all communication: Each vertex initially knows its adjacent edges of the input graph G = (V, E). In each round, each vertex is allowed to transmit n − 1 many O(log n)-bit messages, one addressed to each other vertex. model. It is worth noting that the CONGESTED-CLIQUE model has been receiving extensive atten- tion recently, see e.g., [PST11, DLP12, BHP12, Len13, DKO14, Nan14, HPS14, HP15, CHKK+16, HPP+15, BKKL17, Gal16, CLT18, Gha16, Gha17, GGK+18, PS18, Par18, BK18]. In this paper, our new distributed result is an improvement for coloring in the CONGESTED-CLIQUE State of the Art for Coloring in LOCAL and CONGEST. Most prior works on distributed coloring focus on the LOCAL model. The current state-of-the-art randomized upper bound for the (∆ + 1)-list coloring problem is O(log∗ ∆) + O(Detd(poly log n)) = O(Detd(poly log n)) of [CLP18] (which builds upon the techniques of [HSS18]), where Detd(n′) = 2O(√log log n′) is the determinis- tic complexity of (deg +1)-list coloring on n′-vertex graphs [PS96]. In the (deg +1)-list coloring problem, each v has a palette of size deg(v) + 1. This algorithm follows the graph shattering frame- work [BEPS16, Gha16]. The pre-shattering phase takes O(log∗ ∆) rounds. After that, the remaining uncolored vertices form connected components of size O(poly log n). The post-shattering phase then applies a (deg +1)-list coloring deterministic algorithm to color all these vertices. State of the Art for Coloring in CONGESTED-CLIQUE. Hegeman and Pemmaraju [HP15] gave algorithms for O(∆)-coloring in the CONGESTED-CLIQUE model, which run in O(1) rounds if ∆ ≥ Θ(log4 n) and in O(log log n) rounds otherwise. It is worth noting that O(∆) coloring is 1 a significantly more relaxed problem in comparison to ∆ + 1 coloring. For instance, we have long known a very simple O(∆)-coloring algorithm in LOCAL-model algorithm with round complexity 2O(√log log n) [BEPS16], but only recently such a round complexity was achieved for ∆ + 1 coloring [CLP18, HSS18]. Our focus is on the much more stringent ∆ + 1 coloring problem. For this problem, the LOCAL model algorithms of [CLP18, HSS18] need messages of O(∆2 log n) bits, and thus do not extend to CONGEST or CONGESTED-CLIQUE. For CONGESTED-CLIQUE model, the main challenge is when ∆ > √n, as otherwise, one can simulate the algorithm of [CLP18] by leveraging the all-to- all communication in CONGESTED-CLIQUE which means each vertex in each round is capable of communicating O(n log n) bits of information. Parter [Par18] designed the first sublogarithmic-time (∆+1) coloring algorithm for CONGESTED-CLIQUE, which runs in O(log log ∆ log∗ ∆) rounds. The algorithm of [Par18] is able to reduce the maximum degree to O(√n) in O(log log ∆) iterations, and each iteration invokes the algorithm of [CLP18] on instances of maximum degree O(√n). Once the maximum degree is O(√n), the algorithm of [CLP18] can be implemented in O(log∗ ∆) rounds in CONGESTED-CLIQUE. Subsequent to [Par18], the upper bound was improved to O(log∗ ∆) in [PS18]. Parter and Su [PS18] observed that the algorithm of [Par18] only takes O(1) iterations if we only need to reduce the degree to n1/2+ǫ, for some constant ǫ > 0, and they achieved this by modifying the internal details of [CLP18] to reduce the required message size to O(∆8/5 log n). Our Result. For the CONGESTED-CLIQUE model, we present a new algorithm for (∆ + 1)-list coloring in the randomized congested clique model running in O(1) rounds. This improving on the previous best known O(log∗ ∆)-round algorithm of Parter and Su [PS18] and settles the asymptotic complexity of the problem. Theorem 1.1. There is an O(1)-round algorithm that solves the (∆ + 1)-list coloring problem in CONGESTED-CLIQUE, with success probability 1 − 1/poly(n). The proof is presented in two parts: If ∆ ≥ log4.1 n, the algorithm of Theorem 3.2 solves the (∆ + 1)-list coloring problem in O(1) rounds; otherwise, the algorithm of Theorem 4.7 solves the problem in O(1) rounds. 1.2 Massively Parallel Computation Model. The Massively Parallel Computation (MPC) model was introduced by Karloff et al. [KSV10], as a theoretical abstraction for practical large-scale parallel processing settings such as MapRe- duce [DG04], Hadoop [Whi12], Spark [ZCF+10], and Dryad [IBY+07], and it has been receiving increasing more attention over the past few years [KSV10, GSZ11, LMSV11, BKS13, ANOY14, BKS14, HP15, AG15, RVW16, IMS17, CLM+18, Ass17, ABB+19, GGK+18, HLL18, BFU18a, ASW18, BEG+18b, ASS+18]. In the MPC model, the system consists of a number of machines, each with S bits of memory, which can communicate with each other in synchronous rounds through a complete communication network. Per round, each machine can send or receive at most S bits in total. Moreover, it can perform some poly(S) computation, given the information that it has. In the case of graph problems, we assume that the graph G is partitioned among the machines using a simple and globally known hash function such that each machine holds at most S bits, and moreover, for each vertex or potential edge of the graph, the hash function determines which machines hold that vertex or edge. Thus, the number of machines is Ω(m/S) and ideally not too much higher, where m denotes the number of edges. At the end, each machine should know the output of the vertices that it holds, e.g., their color. 2 State of the Art for Coloring. The CONGESTED-CLIQUE algorithms discussed above can be used to obtain MPC algorithms with the same asymptotic round complexity if machines have memory of S = Ω(n log n) bits. In particular, the work of Parter and Su [PS18] leads to an O(log∗ ∆)-round MPC algorithm for machines with S = Ω(n log n) bits. However, this MPC algo- rithm would have two drawbacks: (A) it uses Ω(n2 log n) global memory, and thus would require (n2 log n)/S machines, which may be significantly larger than O(m)/S. This is basically because the algorithm makes each vertex of the graph learn some eΘ(n) bits of information. (B) It is limited to machines with S = Ω(n log n) memory, and it does not extend to the machines with strongly sublinear memory, which is gaining more attention recently due to the increase in the size of graphs. We note that for the regime of machines with super-linear memory, very recently, Assadi, Chen, and Khanna [ACK19] gave an O(1)-round algorithm which uses only O(n log3 n) global memory.1 However, this algorithm also relies heavily on S = Ω(n log3 n) memory per machine and cannot be run with weaker machines that have strongly sublinear memory. Our Result. We provide the first sublogarithmic-time algorithm for (∆ + 1) coloring and (∆ + 1)- list coloring in the MPC model with strongly sublinear memory per machine: Theorem 1.2. There is an MPC algorithm that, in O(log∗ ∆ +√log log n) = O(√log log n) rounds, w.h.p. computes a (∆ + 1) list-coloring of an n-vertex graph with m edges and maximum degree ∆ and that uses O(nα) memory per machine, for an arbitrary constant α > 0, as well as a total memory of eO(m). The proof is presented in Section 3.3. 1.3 Centralized LOCAL Computation Model. This Local Computation Algorithms (LCA) model is a centralized model of computation that was introduced in [RTVX11]; an algorithm in this model is usually called an LCA. In this model, there is a graph G = (V, E) where the algorithm is allowed to make the following queries: Degree Query: Given ID(v), the oracle returns deg(v). Neighbor Query: Given ID(v) and an index i ∈ [1, ∆], if deg(v) ≤ i, the oracle returns ID(u), where u is the ith neighbor of v; otherwise, the oracle returns ⊥. It is sometimes convenient to assume that there is a query that returns the list of all neighbors of v. This query can be implemented using one degree query and deg(v) neighbor queries. For randomized algorithms, we assume that there is an oracle that given ID(v) returns an infinite-length random sequence associated with the vertex v. Similarly, for problems with input labels (e.g., the color lists in the list coloring problem), the input label of a vertex v can be accessed given ID(v). Given a distributed problem P, an LCA A accomplishes the following. Given ID(v), the algorithm A returns A(v) = the output of v, after making a small number of queries. It is required that the output of A at different vertices are consistent with one legal solution of P. The complexity measure for an LCA is the number of queries. It is well-known [PR07] that any τ -round LOCAL algorithm A can be transformed into an LCA A′ with query complexity ∆τ . The LCA A′ simply simulates the LOCAL algorithm A by querying all radius-τ neighborhood of the given vertex v. See [LM17] for a recent survey about the state-of-the-art in the centralized local model. 1Here "global memory" refers to the memory used for communication. Of course we still need O(m) memory to store the graph. 3 State of the Art LCA for Coloring The previous state-of-the-art for (∆ + 1)-list coloring in the centralized local computation model are based on simulation of known LOCAL algorithms. The deterministic O(√∆poly log ∆ + log∗ n)-round LOCAL algorithm of [FHK16, BEG18a]2 can be implemented in the centralized local computation model with query complexity ∆O(√∆poly log ∆) · O(log∗ n); the randomized O(log∗ ∆) + 2O(√log log n)-round LOCAL algorithm of [CLP18] can be implemented in the centralized local computation model with query complexity ∆O(log∗ ∆)·O(log n). Our Result. We show that (∆ + 1)-list coloring can be solved with ∆O(1) · O(log n) query com- plexity. Note that ∆O(1) · O(log n) matches a "natural barrier" for randomized algorithms based on the graph shattering framework, as each connected component in the post-shattering phase has this size ∆O(1) · O(log n). Theorem 1.3. There is an centralized local computation algorithm that solves the (∆ + 1)-list coloring problem with query complexity ∆O(1) · O(log n), with success probability 1 − 1/poly(n). The proof is presented in Section 4.3. 2 Technical Overview: Tools and New Ingredients In this section, we first review some of the known technical tools that we will use in our algorithms, and then we overview the two new technical ingredients that lead to our improved results (in combination with the known tools). Notes and Notations. When talking about randomized algorithms, we require the algorithm to succeed with high probability (w.h.p.), i.e., to have success probability at least 1 − 1/poly(n). For each vertex v, we write N (v) to denote the set of neighbors of v. If there is an edge orientation, N out(v) refers to the set of out-neighbors of v. We write N k(v) = {u ∈ V dist(u, v) ≤ k}. We use subscript to indicate the graph G under consideration, e.g., NG(v) or N out G (v). In the course of our algorithms, we slightly abuse the notation to also use Ψ(v) to denote the set of available colors of v. i.e., the subset of Ψ(v) that excludes the colors already taken by its neighbors in N (v). The number of excess colors at a vertex is the number of available colors minus the number of uncolored neighbors. Moreover, we make an assumption that each color can be represented using O(log n) bits. This is without loss of generality (in all of the models under consideration in our paper), since otherwise we can hash the colors down to this magnitude, as we allow a failure probability of 1/poly(n) for randomized algorithms. 2.1 Tools Lenzen's Routing. The routing algorithm of Lenzen [Len13] for CONGESTED-CLIQUE allows us to deliver all messages in O(1) rounds, as long as each vertex v is the source and the destination of at most O(n) messages. This is a very useful (and frequently used) communication primitive for designing CONGESTED-CLIQUE algorithms. Lemma 2.1 (Lenzen's Routing). Consider a graph G = (V, E) and a set of point-to-point routing requests, each given by the IDs of the corresponding source-destination pair. As long as each vertex v is the source and the destination of at most O(n) messages, namely O(n log n) bits of information, we can deliver all messages in O(1) rounds in the CONGESTED-CLIQUE model. 2Precisely, the complexity is O(√∆ log2.5 ∆ + log∗ n) in [FHK16], and this has been later improved to O(√∆ log ∆ log∗ ∆ + log∗ n) in [BEG18a]. 4 The Shattering Framework. Our algorithm follows the graph shattering framework [BEPS16], which first performs some randomized process (known as pre-shattering) to solve "most" of the prob- lem, and then performs some clean-up steps (known as post-shattering) to solve the remaining part of the problem. Typically, the remaining graph is simpler in the sense of having small components and having a small number of edges. Roughly speaking, at each step of the algorithm, we specify an invariant that all vertices must satisfy in order to continue to participate. Those bad vertices that violate the invariant are removed from consideration, and postponed to the post-shattering phase. We argue that the bad vertices form connected components of size ∆O(1) · O(log n) with probability 1 − 1/poly(n); we use this in designing LCA. Also, the total number of edges induced by the bad vertices is O(n). Therefore, using Lenzen's routing, in CONGESTED-CLIQUE we can gather all information about the bad vertices to one distinguished vertex v⋆, and then v⋆ can color them locally. More precisely, we have the following lemma [BEPS16, FG17]; see Appendix B for the proof. Lemma 2.2 (The Shattering Lemma). Let c ≥ 1. Consider a randomized procedure that generates a subset of vertices B ⊆ V . Suppose that for each v ∈ V , we have Pr[v ∈ B] ≤ ∆−3c, and this holds even if the random bits not in N c(v) are determined adversarially. Then, the following is true. 1. With probability 1 − n−Ω(c′), each connected component in the graph induced by B has size at most (c′/c)∆2c log∆ n. 2. With probability 1 − O(∆c) · exp(−Ω(n∆−c)), the number of edges induced by B is O(n). Round Compression in CONGESTED-CLIQUE and MPC by Information Gathering. Sup- pose we are given a τ -round LOCAL algorithm A on a graph of maximum degree ∆. A direct simulation of A on CONGESTED-CLIQUE costs also τ rounds. However, if each vertex v already knows all information in its radius-τ neighborhood, then v can locally compute its output in zero rounds. In general, this amount of information can be as high as Θ(n2), since there could be Θ(n2) edges in the radius-τ neighborhood of v. For the case of ∆τ = O(n), it is possible to achieve an exponential speed-up in the round complexity in the CONGESTED-CLIQUE, compared to that of LOCAL. In particular, in this case, each vertex v can learn its radius-τ neighborhood in just O(log τ ) rounds in CONGESTED-CLIQUE. Roughly speaking, after k rounds, we are able to sim- ulate the product graph G2k , which is the graph where any two vertices with distance at most 2k in graph G are adjacent. This method is known as graph exponentiation [LW10], and it has been applied before in the design of algorithms in CONGESTED-CLIQUE and MPC models, see e.g., [Gha17, GU19, PS18, Par18, ASS+18]. Round Compression via Opportunistic Information Gathering. Our goal is to achieve the O(1) round complexity in CONGESTED-CLIQUE, so an exponential speed-up compared to the LOCAL model will not be enough. Consider the following "opportunisitc" way of simulating a LOCAL algorithm A in the CONGESTED-CLIQUE model. Each vertex u sends its local information (which has O(∆ log n) bits) to each vertex v ∈ V with some fixed probability p = O(1/∆), independently, and it hopes that there exists a vertex v ∈ V that gathers all the required information to calculate the outcome of A at u. To ensure that for each u, there exists such a vertex v w.h.p., it suffices that p∆τ n . We note that a somewhat similar idea was key to the O(1)-round MST algorithm of [JN18] for CONGESTED-CLIQUE. ≫ log n Lemma 2.3, presented below, summarizes the criteria for this method to work; see Appendix C for the proof of the lemma. Denote ℓin as the number of bits needed to represent the random bits and the input for executing A at a vertex. Denote ℓout as the number of bits needed to represent 5 the output of A at a vertex. We assume that each vertex v initially knows a set N∗(v) ⊆ N (v) such that throughout the algorithm A, each vertex v only receives information from vertices in N∗(v). We write ∆∗ = maxv∈v N∗(v). Note that it is possible that u ∈ N∗(v) but v /∈ N∗(u). In this case, during the execution of A, all messages sent via the edge {u, v} are from u to v. Denote N k ∗ (v) as the set of all vertices u such that there is a path (v = w0, w1, . . . , wx−1 = u) such that x ≤ k and wi ∈ N∗(wi−1) for each i ∈ [1, x − 1]. Intuitively, if A takes τ rounds, then all information needed for vertex v ∈ V to calculate its output is the IDs and the inputs of all vertices in N τ Lemma 2.3 (Opportunistic Speed-up). Let A be a τ -round LOCAL algorithm on G = (V, E). There is an O(1)-round simulation of A in in CONGESTED-CLIQUE, given that (i) ∆τ ∗ log(∆∗ + ℓin/ log n) = O(log n), (ii) ℓin = O(n), and (iii) ℓout = O(log n). ∗ (v). 2.2 Our New Technical Ingredients, In a Nutshell The results in our paper are based on the following two novel technical ingredients, which are used in combination with the known tools mentioned above: (i) a new graph partitioning algorithm for coloring and (ii) a sparsification of the CLP coloring algorithm [CLP18]. We note that the first ingredient suffices for our CONGESTED-CLIQUE result for graphs with maximum degree at least poly(log n), and also for our MPC result. This ingredient is presented in Section 3. The second ingredient, which is also more involved technically, is used for extending our CONGESTED-CLIQUE result to graphs with smaller maximum degree, as well as for our LCA result. This ingredient is presented in Section 4. Here, we provide a brief overview of these ingredients and how they get used in our results. Ingredient 1 -- Graph Partitioning for Coloring. We provide a simple random partitioning that significantly simplifies and extends the one in [Par18, PS18]. The main change will be that, besides partitioning the vertices randomly, we also partition the colors randomly. In particular, this new procedure partitions the vertices and colors in a way that allows us to easily apply CLP in a black box manner. Concretely, our partitioning breaks the graph as well as the respective palettes randomly into many subgraphs B1, . . . , Bk of maximum degree O(√n) and size O(√n), while ensuring that each vertex in these subgraphs receives a random part of its palette with size close to the maximum degree of the subgraph. The palettes for each part are disjoint, which allows us to color all parts in parallel. There will be one left-over subgraph L, with maximum degree O(∆3/4), as well as sufficiently large remaining palettes for each vertex in this left-over subgraph. Application in CONGESTED-CLIQUE: Since each subgraph has O(n) edges, all of B1, . . . , Bk can be colored, in parallel, in O(1) rounds, using Lenzen's routing (Lemma 2.1). The left-over part L is handled by recursion. We show that when ∆ > log4.1 n, we are done after O(1) levels of recursion. Application in Low-memory MPC: We perform recursive calls on not only on L but also on B1, . . . , Bk. After O(1) levels of recursion, the maximum degree can be made O(nβ), for any given constant β > 0, which enables us to run the CLP algorithm on a low memory MPC. We note that the previous partitioning approach [Par18, PS18] is unable to reduce the maximum degree to below √n; this is a significant limitation that our partitioning overcomes. 6 Ingredient 2 -- Sparsification of the CLP Algorithm. In general, to calculate the output of a vertex v in a τ -round LOCAL algorithm A, the output may depend on all of the τ -hop neighborhood of v and we may need to query ∆τ vertices. To efficiently simulate A in CONGESTED-CLIQUE or to transform A to an LCA, a strategy is to "sparsify" the algorithm A so that the number of vertices a vertex has to explore to decide its output is sufficiently small. This notion of sparsification is a key idea behind some recent algorithms [Gha17, GU19]. In the present paper, a key technical ingredient is providing such a sparsification for the (∆ + 1) coloring algorithm of CLP [CLP18]. The pre-shattering phase of the CLP algorithm [CLP18] consists of three parts: (i) initial coloring, (ii) dense coloring, and (iii) color bidding. Parts (i) and (ii) take O(1) rounds;3 part (iii) takes τ = O(log∗ ∆) rounds. In this paper, we sparsify the color bidding part of the CLP algorithm. We let each vertex v sample O(poly log ∆) colors from its palette at the beginning of this procedure, and we show that with probability 1− 1/poly(∆), these colors are enough for v to correctly execute the algorithm. Based on the sampled colors, we can do an O(1)-round pre-processing step to let each vertex v identify a subset of neighbors N∗(v) ⊆ N (v) of size ∆∗ = O(poly log ∆) neighbors N∗(v) ⊆ N (v), and v only needs to receive messages from neighbors in N∗(v) in the subsequent steps of the algorithm. Application in CONGESTED-CLIQUE: For the case ∆ = O(poly log n), the parameters τ = O(log∗ ∆) and ∆∗ = O(poly log ∆) = O(poly(log log n)) satisfy the condition for applying the opportunistic speedup lemma (Lemma 2.3), and so the pre-shattering phase of the CLP algorithm can be simulated in O(1) rounds in CONGESTED-CLIQUE. Application in Centralized Local Computation: With sparsification, the pre-shattering phase of the CLP algorithm can be transformed into an LCA with ∆O(1) · ∆τ ∗ = ∆O(1) queries. The recent work [ACK19] on (∆ + 1)-coloring in MPC is also based on some form of palette sparsification, as follows. They showed that if each vertex samples O(log n) colors uniformly at random, then w.h.p., the graph still admits a proper coloring using the sampled colors. Since we only need to consider the edges {u, v} where u and v share a sampled color, this effectively reduces the degree to O(log2 n). For an MPC algorithm with O(n) memory per processor, the entire sparsified graph can be sent to one processor, and a coloring can be computed there, using any coloring algorithm, local or not. This sparsification is not applicable for our setting. In particular, in our sparsified CLP algorithm, we need to ensure that the coloring can be computed by a LOCAL algorithm with a small locality volume; this is because the final coloring is constructed distributedly via the opportunistic speedup lemma (Lemma 2.3). 3 Coloring of High-degree Graphs via Graph Partitioning In this section, we describe our graph partitioning algorithm, which is the first new technical ingredient in our results. As mentioned in Section 2.2, this ingredient on its own leads to our CONGESTED-CLIQUE result for graphs with ∆ = Ω(poly(log n)) and also our MPC result, as we will explain in Section 3.2 and Section 3.3, respectively. The algorithm will be applied recursively, but it is required that the failure probability is at most 1− 1/poly(n) in all recursive calls, where n is the number of vertices in the original graph. Thus, in this section, n does not refer to the number of vertices in the current subgraph G = (V, E) under consideration. 3In the preliminary versions (arXiv:1711.01361v1 and STOC'18) of [CLP18], dense coloring takes O(log∗ ∆) time. This time complexity has been later improved to O(1) in a revised full version of [CLP18] (arXiv:1711.01361v2). 7 3.1 Graph Partitioning The Graph Partitioning Algorithm. The graph partitioning is parameterized by two constants γ and λ satisfying γ ≥ 2 and λ = 1 3γ+2 . Consider a graph G = (V, E) with maximum degree ∆. Note that G is a subgraph of the n-vertex original graph, and so n ≥ V . Each vertex v ∈ V has a palette Ψ(v) of size Ψ(v) ≥ max{degG(v), ∆′} + 1, where ∆′ = ∆ − ∆λ. Denote G[S] as the subgraph induced by the vertices S ⊆ V . For each vertex v ∈ V , denote degS(v) as N (v)∩ S. The algorithm is as follows, where we set k = √∆. 2 + 2 Vertex Set: The partition V = B1 ∪ ··· ∪ Bk ∪ L is defined by the following procedure. Including each v ∈ V to the set L with probability q = Θ(cid:16)q log n ∆1/4(cid:17). Each remaining vertex joins one of B1, . . . , Bk uniformly at random. Note that Pr[v ∈ Bi] = p(1 − q), where p = 1/k = 1/√∆. Palette: Denote C = Sv∈V Ψ(v) as the set of all colors. The partition C = C1 ∪ ··· ∪ Ck is defined by having each color c ∈ C joins one of C1, . . . , Ck uniformly at random. Note that Pr[c ∈ Ci] = p. We require that with probability 1− 1/poly(n), the output of the partitioning algorithm satisfies the following properties, assuming that ∆ = ω(logγ n). i) Size of Each Part: It is required that E(G[Bi]) = O(V ), for each i ∈ [k]. Also, it is required that L = O(qV ) = O( √log n ∆1/4 ) · V . ii) Available Colors in Bi: For each i ∈ {1, . . . , k} and v ∈ Bi, the number of available colors in v in the subgraph Bi is gi(v) := Ψ(v) ∩ Ci. It is required that gi(v) ≥ max{degBi(v), ∆i − ∆λ i } + 1, where ∆i := maxv∈Bi degBi(v). iii) Available Colors in L: For each v ∈ L, define gL(v) := Ψ(v)− (degG(v)− degL(v)). It is re- quired that gL(v) ≥ max{degL(v), ∆L−∆λ L}+1 for each v ∈ L, where ∆L := maxv∈L degL(v). Note that gL(v) represents a lower bound on the number of available color in v after all of B1, . . . , Bk have been colored. iv) Remaining Degrees: The maximum degrees of Bi and L are degBi(v) ≤ ∆i = O(√∆) and √log n ∆1/4 ) · ∆. For each vertex individually, we have degBi(v) ≤ degL(v) ≤ ∆L = O(q∆) = O( max{O(log n), O(1/√∆) · deg(v)} and degL(v) ≤ max{O(log n), O(q) · deg(v)}. Intuitively, we will use this graph partitioning in the following way. First compute the de- composition of the vertex set and the palette, and then color each Bi using colors in Ci. Since E(G[Bi]) = O(V ) = O(n), in the CONGESTED-CLIQUE model we are able to send the entire graph G[Bi] to a single distinguished vertex v⋆ i can compute a proper coloring of G[Bi] locally. This procedure can be done in parallel for all i. If E(G[L]) = O(n), then similarly we can let a vertex to compute a proper coloring of G[L]; otherwise we apply the graph partitioning recursively on G[L], with the same parameter n. Lemma 3.1. Suppose Ψ(v) ≥ max{degG(v), ∆′} + 1 with ∆′ = ∆− ∆λ, and V > ∆ = ω(logγ n), where γ and λ are two constants satisfying γ ≥ 2 and λ = 1 3γ+2 . The two partitions V = B1 ∪···∪ Bk ∪ L and C =Sv∈V Ψ(v) = C1 ∪···∪ Ck satisfy the required properties, with probability 1 − 1/poly(n). i , and then v⋆ 2 + 2 8 Proof. We prove that the properties i), ii), iii), and iv) hold with high probability. Note that for some of the bounds, it is straightforward to observe that they hold in expectation. i) Size of Each Part: We first show that E(G[Bi]) = O(V ), for each i ∈ [k], with probability 1 − 1/poly(n). To have E(G[Bi]) = O(V ), it suffices to have degBi(v) = O(p∆) for each v, and Bi = O(pV ), since p = 1/√∆. Recall that we already have E[degBi(v)] ≤ (1 − q)p∆ < p∆ and E[Bi] = (1 − q)pV < pV , so we only need to show that these parameters concentrate at their expected values with high probability. This can be established by a Chernoff bound, as follows. Note that we have ǫ1 < 1 and ǫ2 < 1. In particular, the inequality ǫ1 < 1 holds because of the assumption ∆ = ω(logγ n) ≥ ω(log2 n). Pr[degBi(v) ≤ (1 + ǫ1)(1 − q)p∆] = 1 − exp(−Ω(ǫ2 where ǫ1 = Θ s log n (1 − q)p∆! = Θ s log n p∆ ! . 1(1 − q)p∆)) = 1 − O(1/poly(n)), 2(1 − q)pV )) = 1 − O(1/poly(n)), Pr[Bi ≤ (1 + ǫ2)(1 − q)pV ] = 1 − exp(−Ω(ǫ2 where ǫ2 = Θ s log n ∆1/4 (cid:17), where ∆L = maxv∈L degL(v). Similarly, we already have (1 − q)pV ! = Θ s log n pV ! . Next, we show the analogous results for L, i.e., with probability 1 − 1/poly(n), both L/V √log n E[degL(v)] ≤ q∆ and E[L] = qV , and remember that q = O( ∆1/4 ), so we only need to show that these parameters concentrate at their expected values with high probability, by a Chernoff bound. and ∆L/∆ are O(q) = O(cid:16)√log n Pr[degL(v) ≤ (1 + ǫ3)q∆] = 1 − exp(−Ω(ǫ2 where ǫ3 = Θ s log n q∆ ! . 3q∆)) = 1 − O(1/poly(n)), Pr[L ≤ (1 + ǫ4)qV ] = 1 − exp(−Ω(ǫ2 where ǫ4 = Θ slog n qV ! . 4qV )) = 1 − O(1/poly(n)), Similarly, we have ǫ3 < 1 and ǫ4 < 1. In particular, ǫ3 < 1 because ∆ = ω(logγ n) ≥ ω(log2 n). ii) Available Colors in Bi: Now we analyze the number of available color for each set Bi. Recall that for each v ∈ Bi, the number of available colors in v in the subgraph Bi is gi(v) := Ψ(v) ∩ Ci. We need to prove the following holds with probability 1− 1/poly(n): (i) Ψ(v)∩ Ci ≥ degBi(v) + 1, and (ii) Ψ(v)∩Ci ≥ ∆i−∆λ i +1, where ∆i := maxv∈Bi degBi(v). We will show that with probability 1− 1/poly(n), we have Ψ(v)∩ Ci ≥ ∆i + 1 for each Bi and each v ∈ Bi, and this implies the above (i) and (ii). Recall that ∆′ = ∆(cid:0)1 − ∆−(1−λ)(cid:1), q = Θ(cid:16)√log n selecting q ≥ 3ǫ1 = Θ(cid:16)√log n ∆1/4 (cid:17), we have ∆1/4 (cid:17) ≫ ∆−(1−λ),4 and ǫ1 = Θ(cid:16)√log n ∆1/4 (cid:17). By (1 − ǫ1)p∆′ = (1 − ǫ1)(cid:16)1 − ∆−(1−λ)(cid:17) p∆ ≥ (1 + ǫ1)(1 − q)p∆ + 1. 4The assumptions γ ≥ 2 and λ = 1 2 + 2 3γ+2 imply that λ ∈ (1/2, 3/4], and so ∆−(1−λ) ≤ ∆−1/4 ≪ q. 9 We already know that ∆i ≤ (1 + ǫ1)(1 − q)p∆ with probability 1 − 1/poly(n). In order to have Ψ(v) ∩ Ci ≥ ∆i + 1, we only need to show that Ψ(v) ∩ Ci ≤ (1 − ǫ1)p∆′ with probability 1− 1/poly(n). For the expected value, we know that E[Ψ(v)∩ Ci] = pΨ(v) ≥ p∆′. By a Chernoff bound, we have Pr[Ψ(v) ∩ Ci ≤ (1 − ǫ1)p∆′] = 1 − exp(−Ω(ǫ2 1p∆′)) = 1 − O(1/poly(n)). iii) Available Colors in L: Next, we consider the number of available colors in L. We show that with probability 1 − 1/poly(n), for each v ∈ L, we have gL(v) ≥ max{degL(v), ∆L − ∆λ L} + 1, where gL(v) = Ψ(v) − (degG(v) − degL(v)). It is straightforward to see that gL(v) ≥ degL(v) + 1, since gL(v) = (Ψ(v) − degG(v)) + degL(v) ≥ 1 + degL(v). Thus, we only need to show that gL(v) ≥ ∆L − ∆λ In this proof, without loss of generality we assume degG(v) = Ψ(v) − 1 ≥ ∆′.5 Since E[degL(v)] = q degG(v) ≥ q∆′, by a Chernoff bound, we have L + 1. Pr[degL(v) ≥ (1 − ǫ3)q∆′] = 1 − exp(−Ω(ǫ2 3q∆′)) = 1 − O(1/poly(n)) Remember that ǫ3 = Θ(cid:16)q log n q∆′(cid:17), and we already know that ǫ3 < 1. Using this concentration bound, the following calculation holds with probability 1 − 1/poly(n). q∆ (cid:17) = Θ(cid:16)q log n gL(v) ≥ (1 − ǫ3)q∆′ ≥ q∆′ − O(cid:16)pq∆′ log n(cid:17) ≥ q∆ − q∆λ − O(cid:16)pq∆ log n(cid:17) . Combining this with ∆L ≤ (1 + ǫ3)q∆ = q∆ + O(√q∆ log n), we obtain gL(v) ≥ ∆L − q∆λ − O(√q∆ log n). Note that q∆λ + O(√q∆ log n) = o(cid:0)(q∆)λ(cid:1) = o(cid:0)∆λ L(cid:1),6 and so we finally obtain gL(v) ≥ ∆L − ∆λ iv) Remaining Degrees: The degree upper bounds of ∆i and ∆L follow immediately from the concentration bounds on degBi(v) and degL(v) calculated in the proof of i). The bounds degBi(v) ≤ max{O(log n), O(1/√∆) · deg(v)} and degL(v) ≤ max{O(log n), O(q) · deg(v)} can be derived by a L + 1. straightforward application of Chernoff bound. 3.2 Congested Clique Algorithm for High-Degree Graphs In this section, we show that the (∆ + 1)-list coloring problem can be solved in O(1) rounds in the CONGESTED-CLIQUE model when the degrees are assumed to be sufficiently high. The formal statement is captured in Theorem 3.2. First, we show that the partitioning algorithm can indeed be implemented in the CONGESTED-CLIQUE model. Then, we show how to color the parts resulting from the graph partitioning efficiently. The proof of Theorem 3.2 is completed by showing that only O(1) recursive applications of the partitioning are required. 5If this is not the case, we can increase the degree of v in a vacuous way by adding dummy neighbors to it. For instance, we can add a clique of size ∆ next to v (to be simulated by v), remove a large enough matching from this clique and instead connect the endpoints to v. 6The bound √q∆ log n ≪ (q∆)λ can be derived from the assumptions λ = 1 2 log1/2 n ≪ (q∆) 2 n) =⇒ √q∆ log n = (q∆) 2 n) = ω(log 4 log 4 γ+ 1 1 3 q∆ = Θ(∆ 3 1 2 + 2 2 (q∆) 1 3γ+2 and ∆ = ω(logγ n), as follows: 1 2 ( 3 4 γ+ 1 2 )−1 = (q∆)λ. 10 Implementation of the Graph Partitioning. The partitions can be computed in O(1) rounds on CONGESTED-CLIQUE. Partitioning the vertex set V is straightforward, as every vertex can make the decision independently and locally, whereas it is not obvious how to partition C to make all vertices agree on the same partition. Note that we can assume C ≤ (∆ + 1)V ; if C is greater than (∆ + 1)V initially, then we can let each vertex decrease its palette size to ∆ + 1 by removing some colors in its palette, and we will have C ≤ (∆ + 1)V after removing these colors. A straightforward way of partitioning C is to generate Θ(C log n) random bits at a vertex v locally, and then v broadcasts this information to all other vertices. Note that it takes O(log k) = O(log V ) = O(log n) bits to encode which part of C1 ∪ ··· ∪ Ck each c ∈ C is in. A direct implementation of the approach cannot be done in O(1) rounds, due to the message size constraint of CONGESTED-CLIQUE, as each vertex can send at most Θ(n log n) bits in each round. To solve this issue, observe that it is not necessary to use total independent random bits for each c ∈ C, and Θ(log n)-wise independence suffices. More precisely, suppose X is the summation of n K-wise independent 0-1 random variables with mean p, and so µ = E[X] = np. A Chernoff bound with K-wise Independence [SSS95] guarantees that Pr[X ≥ (1 + q)µ] ≤ exp(cid:0)− min{K, q2µ}(cid:1) . In order to guarantee a failure probability of 1/poly(n) in all applications of Chernoff bound in Lemma 3.1, it suffices that K = Θ(log n). Therefore, to compute the decomposition C = C1 ∪ ···∪ Ck with K-wise independent random bits, we only need O(K · log(C log k)) = O(log2 n) total independent random bits. Broadcasting O(log2 n) bits of information to all vertices can be done in O(1) rounds via Lenzen's routing (Lemma 2.1). The Algorithm of (∆ + 1)-list coloring on High-degree Graphs. We next present our CONGESTED-CLIQUE-model coloring algorithm for high-degree graphs, using the partitioning ex- plained above. Theorem 3.2. Suppose ∆ = Ω(log4+ǫ n) for some constant ǫ > 0. There is an algorithm that solves (∆ + 1)-list coloring in CONGESTED-CLIQUE in O(1) rounds. Proof. We show that a constant-depth recursive applications of Lemma 3.1 suffices to give an O(1)- round CONGESTED-CLIQUE (∆ + 1)-list coloring algorithm for graphs with ∆ = Ω(log4+ǫ n), for any constant ǫ > 0. Consider the graph G = (V, E). First, we apply the graph partitioning algorithm of Lemma 3.1 to partition vertices V into subsets B1, . . . , Bk, L with parameter n = V , and k = √∆. After that, let arbitrary k = √∆ vertices to be responsible for coloring each G[Bi]. Each of these k vertices, in parallel, gathers all information of G[Bi] from vertices Bi, and then computes a proper coloring of G[Bi], where each vertex v ∈ Bi uses only the palette Ψ(v) ∩ Ci. The existence of such a proper coloring is guaranteed by Property (ii). Using this approach, we can color all vertices in V \ L in O(1) rounds using Lenzen's routing. Note that Property (i) guarantees that E(G[Bi]) = O(n). Finally, each vertex v ∈ L removes the colors that have been taken by its neighbors in V \L from its palette Ψ(v). In view of Property (iii), after this operation, the number of available colors for each v ∈ L is at least gL(v) ≥ max{degL(v), ∆L − ∆λ L} + 1. Now the subgraph G[L] satisfies all conditions required to apply Lemma 3.1, so long as ∆L = ω(logγ n). We will see that this condition is always met in our application. We then recursively apply the algorithm of the lemma on the subgraph induced by vertices L with the same parameter n. The recursion stops once we reach a point that E(G[L]) = O(n), and so we can apply Lenzen's routing to let one vertex v gather all information of G[L] and compute its proper coloring. 11 Now we analyze the number of iterations needed to reach a point that E(G[L]) = O(n). Here we use γ = 2 and λ = 3/4.7 Define V1 = V and ∆1 = ∆ as the vertex set and the maximum degree for the first iteration. Let V = B1 ∪ ··· ∪ Bk ∪ L be the outcome of the first iteration, and define V2 = L and ∆2 = ∆L. Similarly, for i > 2, we define Vi and ∆i based on the set L in the outcome of the graph partitioning algorithm for the (i − 1)th iteration. We have the following formulas. ∆1 = ∆ ∆i = ∆i−1 · O √log n i−1 ! Vi = Vi−1 · O √log n i−1 ! V1 = n ∆1/4 ∆1/4 by Property iv) by Property i) Let α > 0 be chosen such that ∆ = ∆1 = (log n)2+α, and assume α = Ω(1) and i = O(1). We can calculate the value of ∆i and Vi as follows. ∆i = O(cid:16)(log n)2+α·(λ)i−1(cid:17) Vi = n · O(cid:16)(log n)α((λ)i−1−1)(cid:17) Thus, given that α = Ω(1) and i = O(1), the condition of ∆i = ω(logγ n) = ω(log2 n) for applying Lemma 3.1 must be met. Next, we analyze the number of iterations it takes to make ∆iVi sufficiently small. In the CONGESTED-CLIQUE model, if ∆iVi = O(n), then we are able to compute a proper coloring of Vi in O(1) rounds by information gathering. Let us write ∆ = log2+α n, where α = 2 + β. The lemma statement implies that β = Ω(1). Note that the condition for ∆iVi = O(n) can be re-written as Combining this with α = 2 + β, a simple calculation shows that this condition is met when 2α(cid:0)1 − (λ)i−1(cid:1) ≥ 2 + α. 3β (cid:19) / log (4/3) . i ≥ log(cid:18) 8(β + 2) 3β (cid:17) / log (4/3) = O(1), and so our algorithm takes only O(1) Since β = Ω(1), we have log(cid:16) 8(β+2) iterations. In particular, when β ≥ 10.8, i.e., ∆ = Ω(log12.8 n), we have ∆4V4 = O(n), and so 3 iterations suffice. Since each iteration can be implemented in CONGESTED-CLIQUE in O(1) rounds, overall we get an algorithm with round complexity O(1). Remark 3.3. Similar to the proof of Theorem 3.2, the graph partitioning algorithm also leads memory. This gives an simple alternate proof (with a slightly worse memory size) of the main result to an O(1)-round MPC coloring algorithm with S = eO(n) memory per processor and eO(m) total of [ACK19] that (∆ + 1)-coloring can be solved with S = eO(n) memory per processor. 7We choose γ = 2 (the smallest possible) to minimize the degree requirement in Theorem 3.2. 12 3.3 Massively Parallel Computation with Strongly Sublinear Memory We now show how to apply Lemma 3.1 as well as the CLP algorithm of [CLP18], as summarized in the following lemma, to prove Theorem 1.2. Lemma 3.4 ([CLP18, Par18]). Let G be an n-vertex graph with m edges and maximum degree Then the list-coloring problem can be solved w.h.p. in O(√log log n) rounds of low-memory MPC ∆. Suppose any vertex v has a palette Ψ(v) that satisfies Ψ(v) ≥ max(cid:8)degG(v) + 1, ∆ − ∆3/5(cid:9). with local memory O(nα) for an arbitrary constant α ∈ (0, 1) and total memory eO(cid:0)Pv degG(v)2(cid:1) if ∆2 = O (nα). The proof of Lemma 3.4 almost immediately follows from [CLP18, Par18]; there are only few changes that have to be made in order to turn their CONGESTED-CLIQUE algorithm into a low- memory MPC algorithm. The details are deferred to Appendix E. Proof of Theorem 1.2. We present a recursive algorithm based on the randomized partitioning al- gorithm of Lemma 3.1. If ∆ = poly(log n) then the conditions of Lemma 3.4 are satisfied trivially; we can solve the problem in O(log∗ ∆ + √log log n) = O(√log log n) rounds of low-memory MPC with total memory eO(n · ∆2) = eO(m). Otherwise, we execute the following algorithm. Randomized Partitioning: Let G be the graph that we want to color. We apply the randomized partitioning algorithm of Lemma 3.1 to G, which gives us sets B1, . . . , Bk and L, as well as color sets C1, . . . , Ck. The goal is now to first color B1, . . . , Bk with colors from C1, . . . , Ck, respectively. i=1 Bi. Then, for every vertex in L, we remove all colors already used by neighbors in B from the palettes, leaving us with a list-coloring problem of the graph induced by L with maximum degree ∆L. Since the colors in the sets Ci are disjoint, this gives a proper coloring of B :=Sk In the following, we first describe how to color each set Bi with colors in Ci, and then how to solve the remaining list-coloring problem in L. For the parameters in Lemma 3.1, we use γ = 6 and λ = 3/5.8 i = O(nα), then, List-Coloring Problem in Bi: by Lemma 3.1 ii), Bi satisfies the conditions of Lemma 3.4 We thus can apply the algorithm of Lemma 3.4 to Bi. Otherwise, we recurse on Bi. Note that this is possible since, by Lemma 3.1 ii) applied to G, Bi satisfies the conditions of Lemma 3.1. If the maximum degree ∆i in Bi satisfies ∆2 L = O(nα), then, List-Coloring Problem in L: by Lemma 3.1 iii) applied to G, L satisfies the conditions of Lemma 3.4. We thus can apply the algorithm of Lemma 3.4 to L. Otherwise, we recurse on L. Note that this is possible since by Lemma 3.1 iii), L satisfies the conditions of Lemma 3.1. If the maximum degree ∆L in L satisfies ∆2 Number of Iterations: Since the maximum degree in L reduces by a polynomial factor in every step, after at most O(1/α) steps, the resulting graph has maximum degree at most O(nα/2), where we satisfy the conditions of Lemma 3.4, and hence do not recurse further. Note that when recursing on sets Bi, the degree drop is even larger, and hence the same reasoning applies to bound the number of iterations. 8The choice λ = 3/5 is to ensure that the number of available colors for each vertex in each subgraph meets the palette size constraint specified in Lemma 3.4. 13 Memory Requirements: It is obvious that the recursive partitioning of the input graph G does not incur any overhead in the memory, neither local nor global. Now, let H be the set of all graphs H on which we apply the algorithm of Lemma 3.4. As we only apply this algorithm when the maximum degree ∆H of H is O(nα/2) or poly(log n), we clearly have ∆2 H = O(nα), so the algorithm Lemma 3.4 is guaranteed to run with local memory O(nα). number of edges in the input graph G, as promised in Theorem 1.2. First, observe that due to the First, assume that the graph G has been partitioned at least three times to get to H. By Lemma 3.1 iv), the degree of any vertex v in H is either O(1) or at most It remains to show how to guarantee the total memory requirement of eO(m), where m is the specifications of Lemma 3.4, we can write the total memory requirement asPH∈HPv∈H (degH(v))2. degG(v) · O(cid:16)∆− 1 4 )2(cid:17) = degG(v) · O(cid:16)∆−37/64(cid:17) < O(cid:16)pdegG(v)(cid:17) . 4(cid:17) · O(cid:16)∆− 1 4(cid:17) · O(cid:16)∆− 1 Note that in the above calculation we assume v always goes to the left-over part L in all three iterations. If v goes to Bi, then the degree shrinks faster. Remember that we set q = O(∆−1/4). Hence, we require a total memory of 4· 3 4·( 3 eO XH∈HXv∈H (degH(v))2! = eO XH∈HXv∈H degG(v)! = eO Xv∈G degG(v)! = eO(m) . Note that the algorithm can be easily adapted to always perform at least three partitioning steps if ∆H is bounded from below by a sufficiently large poly(log n), because then the conditions of Lemma 3.1 are satisfied. On the other hand, if ∆H = poly(log n), it is follows immediately that eO(cid:0)Pv(degH(v))2(cid:1) = poly(log n) = eO(1). Put together, we havePH∈HPv∈H (degH(v))2 = eO(m). 4 Distributed Coloring with Palette Sparsification In this section, we present our sparsification for the LOCAL-model coloring algorithm of CLP [CLP18], which is the second novel technical ingredient in our results. As a consequence, this sparsifi- cation gives us (i) an LCA solving (∆ + 1) list coloring with query complexity ∆O(1) · O(log n) and (ii) an O(1)-round CONGESTED-CLIQUE algorithm solving (∆ + 1) list coloring for the case ∆ = O(poly log n), using the speedup lemma (Lemma 2.3). The Chang-Li-Pettie Coloring Algorithm. We will not sparsify the entire algorithm of [CLP18]. The algorithm of [CLP18] is based on the graph shattering framework. Each vertex successfully col- ors itself with probability 1 − 1/poly(∆) during the pre-shattering phase of [CLP18], and so by the shattering lemma (Lemma 2.2), the remaining uncolored vertices VBad form connected components of size ∆O(1)O(poly log n).9 The post-shattering phase then applies a deterministic (deg +1)-list coloring algorithm to color them. Lemma 2.2 guarantees that the number of edges within VBad is O(n), and so they can be colored in O(1) rounds in the CONGESTED-CLIQUE model. Similarly, dealing with VBad only adds an ∆O(1) · O(log n)-factor overhead for LCA. Thus, we only need to focus on the pre-shattering phase, which consists of the following three steps. Initial Coloring Step: This step is an O(1)-round procedure that generates excess colors at ver- tices that are locally sparse. 9In the analysis of [CLP18], this can also be made O(poly log n), regardless of ∆. 14 Dense Coloring Step: This step is an O(1)-round procedure that colors most of the locally dense vertices. Color Bidding Step: This step is an O(log∗ ∆)-round procedure that colors most of the remaining uncolored vertices, using the property that these vertices have large number of excess colors. For our LCA and CONGESTED-CLIQUE algorithms, the plan is to run the initial coloring step and the dense coloring step by a direct simulation, which costs O(1) rounds. Then, we will give a sparsified version of the color bidding step where each vertex v only need to receive the information from O(poly log ∆) of its neighbors to decide its output. In view of the above, we will use part of the algorithm A Black Box Coloring Algorithm. of [CLP18] as a black box. The specification of this black box is as follows. Consider an instance of the (∆ + 1)-list coloring on the graph G = (V, E). The black box algorithm colors a subset of V such that the remaining uncolored vertices are partitioned into three subsets VGood, VBad, and R meeting the following conditions. Good Vertices: The edges within VGood are oriented as a DAG, and each vertex v ∈ VGood is associated with a parameter pv ≤ Ψ(v) − deg(v) satisfying the conditions p⋆ = minv∈V pv ≥ ∆/ log ∆ and Pu∈N out(v) 1/pu ≤ 1/C, where C > 0 can be any specified constant.10 Recall that N out(v) refers to the set of out-neighbors of v. Bad Vertices: The probability that a vertex v ∈ V joins VBad is 1 − 1/poly(∆). In particular, in view of Lemma 2.2, with probability 1 − 1/poly(n), they form connected components of size ∆O(1) · O(log n), and the number of edges within the bad vertices is O(n). Remaining Vertices: The subgraph induced by R has a constant maximum degree. Lemma 4.1 follows from [CLP18], after some minor modifications. For the sake of completeness we show the details of how we obtain Lemma 4.1 from the results in [CLP18] in Appendix D. Note that for the case of CONGESTED-CLIQUE, as long as ∆ = O(√n), Lemma 4.1 can be implemented in O(1) rounds. Lemma 4.1 ([CLP18]). Consider an instance of the (∆ + 1)-list coloring on the graph G = (V, E). There is an O(1)-round LOCAL algorithm that colors a subset of vertices such that the remaining uncolored vertices are partitioned into three subsets VGood, VBad, and R meeting the above conditions, and the algorithm uses O(∆2 log n)-bit messages. 4.1 A Sparsified Color Bidding Algorithm In view of Lemma 4.1, we focus on the subgraph induced by VGood, and denote it as G0 = (V0, E0). The graph G0 is a directed acyclic graph. The set of available colors for v is denoted as Ψ0(v). Our goal is to give a proper coloring of G0. An important property of G0 is that each vertex v ∈ V is associated with a parameter pv ≤ Ψ0(v) − degG0(v) such thatPu∈N out(v) 1/pu ≤ 1/C0, where C0 can be any specified large constant. Intuitively, pv gives the lower bound of the number of excess colors at vertex v. It is guaranteed that p⋆ = minv∈V0 pv ≥ ∆/ log ∆. Parameters C0 and p⋆ are initially known to all vertices in V0. 10Here Ψ(v) is the set of available colors at v, i.e., the colors in the palette of v that have not been taken by v's neighbors. Here deg(v) refers to the number of uncolored neighbors of v in VGood. We use outdeg(v) to refer to the number of out-neighbors of v. Intuitively, pv ≤ Ψ(v) − deg(v) is a lower bound on the number of excess colors at v. 15 Review of the Color Bidding Algorithm. The above conditions might look a bit strange, but it allows us to find a proper coloring in O(log∗ ∆) rounds in the LOCAL model by applying O(log∗ ∆) iterations of the procedure ColorBidding [CLP18], as follows. 1. Each color c ∈ Ψ(v) is added to Sv with probability 2. If there exists a color c⋆ ∈ Sv that is not selected by any vertex in N out(v), v colors itself c⋆. We give a very high-level explanation about how this works. For the first iteration we use C = C0. Intuitively, for each color c ∈ Sv, the probability that c is selected by an out-neighbor of v is independently. 2Ψ(v) C Xu∈N out(v) C/(2Ψ(u)) ≤ Xu∈N out(v) C/(2pu) ≤ 1/2. In the calculation we use the inequalityPu∈N out(v) 1/pu ≤ 1/C0 that is guaranteed by Lemma 4.1. The probability that v fails to color itself is roughly 1/2Sv, which is exponentially small in C0, as in expectation Sv = C0/2. Thus, for the next iteration we may use a parameter C that is exponentially small in C0, and so after O(log∗ ∆) iterations, we are done. Parameters. Let β > 0 be a constant to be determined. Let p⋆ ∈ [∆/ log ∆, ∆] be the parameter specified in the conditions for Lemma 4.1. The C-parameters used in the algorithms C0, . . . , Ck−1 are defined as follows. For the base case, C0 is the parameter C specified in the conditions for Lemma 4.1. Given that Ci has been defined, we set Ci+1 = 2(cid:24)(cid:18)min(cid:26) 1 2 exp(Ci/6)Ci, logβ p⋆(cid:27)(cid:19) /2(cid:25) − 2. In other words, Ci+1 is the result of rounding min(cid:8) 1 2 exp(Ci/6)Ci, logβ p⋆(cid:9) down to the nearest even number. The number of iterations k is chosen as the smallest index such that Ck−1 = 2(cid:6)logβ p⋆/2(cid:7)− 2. It is clear that k = O(log∗ ∆), as p⋆ ≤ ∆ + 1. We will use this sequence C0, . . . , Ck−1 in our sparsified color bidding algorithm. This sequence is slightly different than the one used in [CLP18]. The last number in the sequence used in [CLP18] is set to be √p⋆, but here we set it to be O(poly log p⋆). Having a larger C-parameter leads to a smaller failure probability, but it comes at a cost that we have to sample more colors, and this means that each vertex needs to communicate with more neighbors to check for conflict. Overview of the Proof. We first review the analysis of the multiple iterations of ColorBidding in [CLP18], and then we discuss how we sparsify this algorithm. The proof in [CLP18] maintains an invariant Ii(v) for each vertex v that is uncolored at the beginning of each iteration i, as follows.11 Ii(v) : Xu∈N out G (v) 1/pu ≤ 1/Ci. We will use the same pu because the number of excess colors of a vertex never decreases. By Lemma 4.1, this invariant is met for i = 0. The vertices u not satisfying the invariant Ii(v) are considered bad, and are removed from consideration. The analysis of [CLP18] shows that 11In this section, G refers the current graph under consideration, i.e., it excludes all vertices that have been colored or removed in previous iterations. We use G0 to refer to the original graph. 16 1. Suppose all vertices u in G at the beginning of the ith iteration satisfy the Ii(u). Then at end of this iteration, for each vertex u, with probability 1 − 1/poly(∆), either u has been successfully colored, or Ii+1(u) is satisfied. 2. For the last iteration, Given that all vertices u in G satisfy Ik−1(u), then v is successfully colored at iteration k with probability 1 − 1/poly(∆). By the shattering lemma (Lemma 2.2), all vertices that remain uncolored at the end of the algorithm induce a subgraph with O(n) edges. In particular, in CONGESTED-CLIQUE we are able to color them in O(1) additional rounds. To sparsify the algorithm, our strategy is to let each vertex sample the colors needed in all iterations at the beginning of the algorithm. It is straightforward to see that each vertex only needs to use O(poly log ∆) colors throughout the algorithm, with probability 1 − 1/poly(∆). After sampling the colors, if u finds that v ∈ N out(u) do not share any sampled color, then there is no need for u to communicate with v. This effectively reduces the maximum degree to ∆′ = O(poly log ∆). If ∆ = O(poly log n), then ∆′ = O(poly(log log n)), which is enough to apply the opportunistic speedup lemma (Lemma 2.3). There is one issue needed to be overcome. That is, verifying whether Ii(u) is met has to be done on the original graph G, as we have to go over all vertices v ∈ N out G (u), regardless of whether u and v have shared sampled colors. One way to deal with this issue is to simply not remove the vertices u violating Ii(u), but if we do it this way, then when we calculate the failure probability of a vertex v, we have to apply a union bound over all vertices u within radius τ = O(log∗ ∆) to v that u does not violate the invariant for each iteration. Due to this union bound, we can only upper bound the size of the connected components of bad vertices by ∆O(log∗ ∆) · O(log n), so this does not lead to an improved LCA.12 To resolve this issue, we observe that the invariant Ii(u) might be too strong for our purpose, since intuitively if v ∈ N out(u) does not share any sampled colors with u, then v should not be able to affect u throughout the algorithm. In this paper, we will consider an alternate invariant I′i(u) that can be checked in the sparsified graph. More precisely, in each iteration, each vertex v will do a two-stage sampling to obtain two color sets Sv ⊆ Tv ⊆ Ψ(v). The set Sv has size C/2, and the set Tv has size logβ ∆, where β > 0 is a constant to be determined. The alternate invariant I′i(v) is defined as This invariant I′i(v) can be checked by having v communicating only with its neighbors that share a sampled color with v. Intuitively, if Ii(v) holds, then I′i(v) holds with probability 1 − 1/poly(∆). It is also straightforward to see that I′i(v) implies that v has a high probability of successfully coloring itself in this iteration, as Sv is a size-(Ci/2) uniformly random subset of Tv. In subsequent discussion, we say that v is rich if I′i(v) is met. Other than not satisfying I′i(v), there are two other bad events that we need to consider: • (Informally) v has too many neighbors that share a sampled color with v; in this case, we say that v is overloaded. This is a bad event since the goal of the palette sparsification is to reduce the number of neighbors that v needs to receive information from. 12We remark that this is only an issue for LCA, and this is not an issue for application in CONGESTED-CLIQUE. In the shattering lemma (Lemma 2.2), for the parameters ∆ = O(poly log n) and c = O(log∗ ∆), we can still bound the number of edges within the bad vertices B by O(n). 17 I′i(v) :(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Tv \ [u∈N out G (v) Su(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≥ Tv/3. • Most of the sampled colors of v reserved for iteration i have already be taken by the neighbors of v during the previous iterations 1, . . . , i − 1, so v does not have enough colors to correctly run the algorithm for the ith iteration; in this case, we say that v is lazy. The Sparsified Color Bidding Algorithm. We are now in a position to describe the sparsified version of ColorBidding. For the sake of clarity we use the following notations to describe the palette of a vertex u. Recall that Ψ0(u) refers to the palette of u initially in the original graph G0. At the beginning of an iteration, we write Ψ+(u) to denote the set of available colors at u, and write Ψ−(u) to denote the set of colors already taken by vertices in NG0(u). Note that Ψ+(u) = Ψ0(u) \ Ψ−(u). The function SampleColors describe how we sample the colors Su and Tu in an iteration. Intu- itively, we use k1 = C/2 and k2 = logβ p⋆ as the target set sizes. The set R represents a length-K sequence of colors that u pre-sampled for the ith iteration, where K = log3+β p⋆, and R(j) repre- sents the jth color of R. We will later see that R is generated in such a way that each R(j) is a uniformly random color chosen from Ψ0(u), where Ψ0(u) is the set of available colors of v initially in G0. The set S− represents the set Ψ−(u) which consists of the colors already taken by the vertices in NG0(u) before iteration i. Function SampleColors(k1, k2, S−, R) T ← ∅; for j ← 1 to k2 log3 p⋆ do c ← R(j); if c /∈ S− then T ← T ∪ {c}; if T = k1 then T1 ← T ; if T = k2 then return (T1, T ); return (∅, ∅); end The procedure SparsifiedColorBidding is the sparsified version of ColorBidding. In this proce- dure, it is straightforward to verify that the outcome Sv ← T1 and Tv ← T of SampleColors(C/2, logβ p⋆, Ψ−(v), Rv) satisfies either one of the following: • Sv = ∅ and Tv = ∅. This happens when most of the pre-sampled colors for this iteration have been taken by the neighboring vertices. We will later show that this occurs with probability 1/poly(∆). • Given that each Rv(j) is a uniformly random color of Ψ0(v), we have: (i) Sv is a size-(C/2) uniformly random subset of Tv, and (ii) Tv is a size-(cid:0)logβ p⋆(cid:1) uniformly random subset of Ψ0(v) \ Ψ−(v). That is, these two sets Sv and Tv are sampled uniformly randomly from the set of available colors of v, i.e., Ψ0(v) \ Ψ−(v). The condition for v to be overloaded is defined in the procedure SparsifiedColoring. Intu- R(i′) itively, v is said to be overloaded at iteration i if the colors in R(i) u , for too many neighbors u ∈ NG0(v); this is undesirable as we want the degree of the sparsified graph v have appeared inS0≤i′≤i 18 to be small. Procedure SparsifiedColorBidding(G, C, Ψ−, {Rv}v∈V0 ) for each vertex v ∈ V (G) do simultaneously 1. (Sv, Tv) ← SampleColors(C/2, logβ p⋆, Ψ−(v), Rv). If v is overloaded, reset (Sv, Tv) ← (∅, ∅). We call v lazy if Sv = ∅. 2. v collects information about Su from all neighbors u ∈ N out G (v) Su(cid:12)(cid:12)(cid:12) ≥ Tv/3, i.e., at most 2/3 of colors v sampled in Tv are 3. If(cid:12)(cid:12)(cid:12)Tv \Su∈N out selected in Su of some neighbors u ∈ N out or (ii) v is lazy, then v marks itself Bad and it skips the next step. 4. If there is a color c ∈ Sv that is not inSu∈N out If v is lucky with c, v colors itself c. Tie is broken arbitrarily. G (v) Su, we call v lucky with color c. G (v), then we call v rich. If (i) v is not rich G (v). end The procedure SparsifiedColoring represents the entire coloring algorithm, which consists of k = O(log∗ ∆) iterations of SparsifiedColorBidding. The notation G[U ] refers to the subgraph induced by U . Note that the set U does not include the vertices that are marked Bad, i.e., once a vertex v marked itself Bad, it stops attempting to color itself; but a Bad vertex might still need to provide information to other vertices in subsequent iterations. Procedure SparsifiedColoring() G ← G0; K ← log3+β ∆; for i ← 0 to k − 1 do /* Obviously k = O(log∗ p⋆ − log∗ C0) = O(log∗ ∆). */ 1. G ← G[U ], where U consists of the yet uncolored vertices in G that are not Bad. 2. Each vertex v ∈ V (G0) generates a color sequence R(i) following rule: for each j = 1, . . . , K, R(i) random, independently. v (j) is a color in Ψ0(v), chosen uniformly at v (1), . . . , R(i) v (K) by the u }0≤i′≤i from each 3. Each vertex v ∈ V (G) gathers the information about {R(i′) neighbor u ∈ NG0(v). 4. If there exist three indices i′ ∈ [0, i], j ∈ [1, K], and j′ ∈ [1, K] such that v (j) = R(i′) R(i) more than K 2 log ∆ significant neighbors, we call v overloaded. 5. Each vertex v ∈ V (G) gathers the information about the colors that have been taken by the vertices in NG0(v). Let Ψ−(v) be the set of these colors. 6. Call SparsifiedColorBidding(G, Ci, Ψ−, {R(i) u (j′), we say u ∈ NG0(v) is a significant neighbor of v ∈ V (G). If v has v }v∈V0 ). end It is straightforward to see that SparsifiedColoring can be implemented in such a way that after an O(1)-round pre-processing step, each vertex v is able to identify O(poly log ∆) neighbors such that v only need to receive information from these vertices during SparsifiedColoring. In the pre-processing step, we let each vertex v sample the color sequences R(i) for each 0 ≤ i ≤ k − 1, v and let each vertex v learn the set of colors sampled by NG0(v). Based on this information, before the first iteration begins, v is able to identify at most K 2 log ∆ = O(poly log ∆) neighbors of v for each iteration i such that v is sure that v does not need to receive information from all other neighbors during the ith iteration. See Section 4.3 for details. For the rest of Section 4.1, we focus on the analysis of SparsifiedColoring. For each iteration i, recall that Ψ+(v) = Ψ0(v) \ Ψ−(v) is the set of available colors at v at the beginning of this iteration. For a vertex v ∈ V0, and its neighbor u ∈ NG0(v), we say that u is a c-significant 19 neighbor of v in iteration i if c = R(i′) u (j) for some i′ ∈ [1, i] and j ∈ [1, k]. Consider the beginning of the ith iteration of the for-loop in SparsifiedColoring. In the graph G = (V, E) ← G[U ] under consideration in this iteration, we say that a vertex v ∈ V is (C, D)-honest if the following two conditions are met. G (v) 1/pu ≤ 1/C. (i) Pu∈N out iteration. (ii) For each color c ∈ Ψ0(v), v has at most D c-significant neighbors u ∈ NG0(v) in the previous Clearly all vertices are (C0, 0)-honest in G = G0 at the beginning of iteration i = 0. Lemma 4.2 shows that (C, D)-honest vertices are well-behaved. Lemma 4.2. Consider the ith iteration of SparsifiedColorBidding in SparsifiedColoring. Let U be the set of yet uncolored vertices after this iteration. Suppose a vertex v is (C, D)-honest, with C ≤ logβ p⋆ and D ≤ 2K · k = O(K log∗ ∆), at the beginning of this iteration, then The following holds. i) Pr[v does not successfully color itself] ≤ exp(−C/6) + exp(−Ω(logβ ∆)). ii) Pr[v marks itself Bad] ≤ exp(−Ω(logβ ∆)). iii) Pr[at the beginning of the next iteration, v ∈ U or v is not (C′, D′)-honest] ≤ exp(−Ω(logβ ∆)), where C′ = min(cid:8) 1 2 exp(C/6)C, logβ p⋆(cid:9) and D′ = D + 2K. The probability calculation only relies on the distribution of random bits generated in N 2 G0 iteration, i.e., {R(i) N 2 G0 (v) in this (v). In particular, the result holds even if random bits generated outside (v) are determined adversarially. u }u∈N 2 G0 Note that Lemma 4.2 only relies on the assumption that the vertex v under consideration is (C, D)-honest, and the lemma works even many of neighboring of v are not (C, D)-honest. This is in contrast to most of the analysis of graph shattering algorithms where the analysis relies on the assumption that all vertices at the beginning of each iteration to satisfy certain invariants. Based on Lemma 4.2, we show that SparsifiedColoring colors a vertex with a sufficiently high probability that enables us to apply the shattering lemma. Lemma 4.3. The algorithm SparsifiedColoring gives a partial coloring of G0 such that the probability that a vertex v does not successfully color itself with a color in Ψ0(v) is O(k) · exp(cid:16)−Ω(logβ ∆)(cid:17) ≪ 1/poly(∆), and this holds even if the random bits generated outside N 2 G0 (v) are determined adversarially. Proof. We consider the sequence D0 = 0 and Di+1 = Di + 2K. Suppose the algorithm does not color a vertex v, then v must falls into one of the following cases. • There is an index i ∈ [0, k − 2] such that v is (Ci, Di)-honest at the beginning of iteration i, but v is not (Ci+1, Di+1)-honest at the beginning of iteration i + 1. By Lemma 4.2 (iii), this • There is an index i ∈ [0, k − 1] such that v is (Ci, Di)-honest at the beginning of iteration i, but v marks itself Bad in iteration i. By Lemma 4.2 (ii), this occurs with probability at most occurs with probability at most (k − 1) · exp(cid:0)−Ω(logβ ∆)(cid:1). k · exp(cid:0)−Ω(logβ ∆)(cid:1). 20 • For the last iteration i = k−1, the vertex v is (Ck−1.Dk−1)-honest at the beginning of iteration k − 1, but v does not successfully colors itself by a color in its palette. in iteration k − 1. By Lemma 4.2 (iii), this occurs with probability at most exp(cid:0)−Ω(logβ ∆)(cid:1). Note that our analysis only relies on the distribution of random bits generated in N 2 (v), which G0 is guaranteed by Lemma 4.2. That is, even if the adversary is able to decide the random bits of vertices outside of N 2 (v) throughout the algorithm SparsifiedColoring, the probability that v G0 does not successfully color itself is still at most O(k) · exp(cid:0)−Ω(logβ ∆)(cid:1). 4.2 Analysis for the Sparsified Color Bidding Algorithm v , Erich v v , Elazy , and Elucky In this section, we prove Lemma 4.2. We focus on the ith iteration of the algorithm, where the vertex v is (C, D)-honest, and there is no guarantee about the (C, D)-honesty of all other vertices. For this vertex v, we write Eoverload to denote the event that v is overloaded, lazy, rich, and lucky. Note that a lucky vertex must be rich and not lazy, and an overloaded vertex must be lazy. In this proof we frequently use this inequality ∆ + 1 ≥ Ψ0(v) ≥ Ψ+(v) ≥ pv ≥ p⋆ = Ω(∆/ log ∆). Our analysis only considers the random bits generated by vertices within N 2 (v) in G0 this iteration. Claim 4.4. The probability that v has more than D′ = D + 2K c-significant neighbors u ∈ NG0(v) for some color c ∈ Ψ0(v) in this iteration i is at most exp(−Ω(log3+β ∆)), and this implies that Pr[Eoverload v v ] ≤ exp(−Ω(log3+β ∆)). Proof. Since v is (C, D)-honest, our plan is to show that for each color c ∈ Ψ0(v), the number of new c-significant neighbor u ∈ NG0(v) brought by the color sequences in the ith iteration R(i) u , is at most 2K with probability 1 − exp(−Ω(log3+β ∆)). ur }, Y =P1≤r≤s Xj. Then Y is an upper bound on the number of new c-significant neighbors. Since v is (C, D)-honest, the total number of c-significant neighbors is at most D + Y . To prove this claim, it suffices to bound the probability of Y > 2K. Note that X1, . . . , Xs are independent, and Write NG0(v) = {u1, . . . , us}, and let Xr = 1{color c appears in R(i) E[Y ] = X1≤r≤s E[Xr] ≤ X1≤r≤s 1 −(cid:18)1 − 1 Ψ0(ur)(cid:19)K! ≤ s · K ∆ + 1 ≤ K∆ ∆ + 1 < K. By a Chernoff bound, we have Pr[Y ≥ 2K] ≤ exp(−Ω(K)) = exp(−Ω(log3+β ∆)). By a union bound over all c ∈ Ψ0(v) we are done. Given that v has no more than D′ c-significant neighbors in this iteration for every color c ∈ Ψ0(v), we infer that v has at most R(i) u D′ ≤ K · D′ = K · (D + 2K) ≪ K 2 log ∆ significant neighbors, which implies that v is not overloaded. Hence we also have Pr[Eoverload exp(−Ω(log3+β ∆)). Claim 4.5. Pr[Elazy v v ] ≤ exp(−Ω(log2+β ∆)). ] ≤ Proof. Remember that v is lazy if either (i) v is overloaded, or (ii) SampleColors gives (∅, ∅). In view of Claim 4.4, we only need to show that with probability at most exp(−Ω(log2+β ∆)), SampleColors gives (∅, ∅). 21 Consider the sampling process in SampleColors, and suppose that we are in the middle of the process, and T is the current set of colors we have obtained. Suppose T = r currently, i.e., we have selected r colors from Ψ+(v). The probability that the next color Rj we consider is different from these r colors in T is at least Ψ0(v) ≥ Ψ+(v) − logβ p⋆ Ψ+(v) − r Ψ0(v) ≥ Ω(∆/ log ∆) ∆ + 1 = Ω(1/ log ∆). Remember that Ψ+(v) ≥ pv = Ω(∆/ log ∆) and logβ p⋆ = O(logβ ∆). Also remember that SampleColors gives (∅, ∅) if after we go over all k2 log3 p⋆ = log3+β p⋆ elements in the sequence R, the size of T is still less than k2 = logβ p⋆. The probability that this event occurs is at most Pr[Binomial(n′, p′) < t′] < Pr[Binomial(n′, p′) < n′p′/2], where n′ = log3+β p⋆ = Θ(log3+β ∆), p′ = Ω(1/ log ∆), and t′ = logβ p⋆ = Θ(logβ ∆) ≪ n′p′. By a Chernoff bound, this event occurs with probability at most exp(−Ω(n′p′)) = exp(−Ω(log2+β ∆)). Claim 4.6. Pr[Erich v ] ≤ exp(−Ω(logβ ∆)). G (v) Su(cid:12)(cid:12)(cid:12) ≥ Tv/3. automatically rich. Thus, in subsequent discussion we assume v is not lazy. We write N out Proof. Recall that v is rich if (cid:12)(cid:12)(cid:12)Tv \Su∈N out {u1, . . . , us} and let Xr = Tv ∩ Sur. To prove the lemma, it suffices to show that for Y =Ps we have Pr[Y ≥ 2 We consider the random variable Xr = Tv ∩ Sur. For notational simplicity, we write u = ur. If u is lazy, then Xr = 0. Suppose u is not lazy. The set Su ⊆ Ψ+(u) is the result of randomly choosing distinct C/2 colors c1, . . . , cC/2 from Ψ+(u), one by one. For each j ∈ [1, C/2], define Zu,j as the indicator random variable that cj ∈ Tv. Then Xr =PC/2 j=1 Zu,j. We have the following observation. In the process, when we pick the jth color, regardless of the already chosen colors c1, . . . , cj−1, the probability that the color picked is in Tj is at most If v is lazy, then Tv = ∅, so v is G (v) = r=1 Xr, 3Tv] ≤ exp(−Ω(logβ p⋆))). Tv Tv E[Zu,j] ≤ Tv Ψ+(u) − (C/2) ≤ Ψ+(u)−(j−1) ≤ pu − (C/2) ≤ Tv Ψ+(u)−(C/2) . Thus, we have 1.1Tv , pu since C/2 ≤ (logβ p⋆)/2 = O(poly log ∆) and pu = Ω(∆/ log ∆). Therefore, in order to bound Y = X1 + ··· + Xs from above, we can assume w.l.o.g. each Xr is the sum of C/2 i.i.d. random variables, and each of them is a bernoulli random variable with p = 1.1Tv , and so Y is the summation of s · (C/2) independent 0-1 random variables. Since v is G (v) 1/pu ≤ 1/C. The expected value of Y can be upper bounded as pu (C, D)-honest, we havePu∈N out follows. E[Y ] ≤ By a Chernoff bound, we obtain PrhErich v i ≤ Pr(cid:20)Y ≥(cid:18) 1 1.1 · 4 3(cid:19)(cid:18) 1.1 1.1 2 Tv. C G (u) 1.1Tv pv ≤ 2 Xv∈N out 2 Tv(cid:19)(cid:21) ≤ exp(cid:18)−Ω(cid:18)1.1 2 Tv(cid:19)(cid:19) ≤ exp(cid:16)−Ω(cid:16)logβ p⋆(cid:17)(cid:17) . Using the above three claims, we now prove the three conditions specified in Lemma 4.2. 22 Proof of i). Conditioning on Erich of Tv/3 specific colors from Tv ⊆ Ψ+(v). Remember that Erich Tv/3, and if any one of them is in Sv, then v successfully colors itself. Also remember that Sv is a size-(C/2) subset of Tv chosen uniformly at random. Thus, implies that(cid:12)(cid:12)(cid:12)Tv \Su∈N out , v is lucky with some color unless it fails to select any G (v) Su(cid:12)(cid:12)(cid:12) ≥ v ∩ Elazy v v Pr[Elucky v Erich v ∩ Elazy v ≤ exp(−C/6). 3Tv C/2(cid:1) ] ≤ (cid:0) 2 3(cid:19)C/2 (cid:0)TvC/2(cid:1) ≤(cid:18) 2 By Claim 4.5 and Claim 4.6, we have: ] ≤ Pr[Elucky ≤ exp(−C/6) + exp(−Ω(logβ p⋆)). v ∩ Elazy Erich Pr[Elucky v v v ] + Pr[Elazy v ] + Pr[Erich v ] Proof of ii). This also follows from By Claim 4.5 and Claim 4.6. Pr[v marks itself Bad] = Pr[Erich ≤ Pr[Erich v v ∪ Elazy v ] ] + Pr[Elazy v ] ≤ exp(−Ω(logβ p⋆)). ur Proof of iii). Define Y as the summation of 1/pu over all vertices u ∈ N out G (v) such that u /∈ U in the next iteration. We prove that the probabilities of (a) Y ≤ 1/C′ and (b) v has more than D′ c-significant neighbors u ∈ NG0(v) in this iteration are both at most exp(−Ω(logβ ∆)). G (v) = ur ∪ Elazy {u1, . . . , us}. Consider the event E∗r = Elucky that ur does not join U in the next iteration, i.e., ur successfully colors itself or marks itself Bad. For (b), it follows from Claim 4.4. For the rest of the proof, we deal with (a). Write N out ∪ Erich For each r ∈ [1, s], define the random variable Zr as follows. Let Zr = 0 if the event Elucky ∪ ur ∪ Elazy Erich r=1 Zr. Note that E[Y ] ≤ exp(−C/6) · (1/C), because Pr[E∗r ] = Pr[Elucky occurs, and Zr = 1/pur otherwise. Clearly we have Y =Ps ur ∩ Elazy as calculated above in the proof of Condition (i). Since v is (C, D)-honest, we havePu∈N out C′ = min(cid:8) 1 G (v) 1/pu ≤ 1/C. Combining these two inequalities, we obtain that E[Y ] ≤ exp(−C/6) · (1/C). Recall that Next, we prove the desired concentration bound on Y . Each variable Zr is within the range ] ≤ exp(−C/6), ] ≤ Pr[Elucky ur ∩ Elazy ∩ Erich Erich ur ur ur ur ur ur ur [ar, br], where ar = 0 and br = 1/pur . We have 2 exp(C/6)C, logβ p⋆(cid:9), and so E[Y ] ≤ 1/(2C′). u ≤ Xu∈N out G (v) Recall E[Y ] ≤ 1/(2C′). By Hoeffding's inequality, we obtain Pr[Y ≥ 1/C′] ≤ exp(cid:18) −2/(2C′)2 (br − ar)2 ≤ Xu∈N out sXr=1 1/p2 G (v) r=1(br − ar)2(cid:19) . Ps 1/(pu · p⋆) ≤ 1/(Cp⋆). By assumptions specified in the lemma, (1/C′)2 = Ω(1/ log2β p⋆) and 1/Ps Ω(Cp⋆) = Ω(p⋆/ logβ p⋆). Thus, Pr[Y ≥ 1/C′] ≤ exp(−Ω(p⋆ log−3β p⋆)) ≤ exp(−Ω(pp⋆)) ≪ exp(−Ω(logβ p⋆)). r=1(br − ar)2 = 23 There is a subtle issue regarding the applicability of Hoeffding's inequality. The variables {X1, . . . , Xk} are not independent, but we argue that we are still able to apply Hoeffding's in- equality. Assume that N out(v) = (u1, . . . , us) is sorted in reverse topological order, and so for each 1 ≤ a ≤ s, we have N out(ua)∩{ua, . . . , us} = ∅. We reveal the random bits in the following manner. First of all, we reveal the set Tu for all vertices u. Now the event regarding whether a vertex is rich or is lazy has been determined. Then, for r = 1 to s, we reveal the set {Su u = ur or u ∈ N out(ur)}. This information is enough for us to decide the outcome of Zr. Note that in this process, condi- tioning on arbitrary outcome of Z1, . . . , Zr−1 and all random bits revealed prior to revealing the set Sur , The probability that E∗r occurs is still at most exp(−C/6). 4.3 Implementation for the Sparsified Color Bidding Algorithm In this section, we present an implementation of SparsifiedColoring in the LOCAL model such that after an O(1)-round pre-processing step, each vertex v is able to identify a O(poly log ∆)-size subset N∗(v) ⊆ NG0(v) of neighboring vertices such that v only needs to receive information from these vertices during SparsifiedColoring. Fixing All Random Bits. Instead of having each vertex v generate the color sequence R(i) v at it- eration i, we determined all of {R(i) v }0≤i≤k−1 in the pre-processing step. After fixing these sequences, we can regard SparsifiedColoring as a deterministic LOCAL algorithm, where {R(i) v }v∈V0, 0≤i≤k−1 can be seen as the input for the algorithm. To gather this information, we need to use messages of k · K · O(log n) = O(poly log ∆) · O(log n) bits, where k = O(log∗ ∆) is the number of iterations, and K is the length of the color sequence R(i) v for an iteration. Determining the Set N∗(v). We show how to let each vertex v determine a O(poly log ∆)-size set N∗(v) ⊆ NG0(v) based on the following information {R(i) u }u∈NG0 (v), 0≤i≤k−1. such that v only needs to receive messages from N∗(v) during the execution of SparsifiedColoring. We make the following two observations. 1. In order for v to execute SparsifiedColorBidding at iteration i correctly, v does not need to u }u∈NG0 (v), 0≤i′≤i do not overlap with receive information from u ∈ NG0(v) if all colors in {R(i′) the colors in R(i) u . In other words, v only needs information from its significant neighbors. 2. If v is overloaded at iteration i, then v knows that it is lazy in this iteration, and so the outcome of SparsifiedColorBidding at iteration i is that v sets Sv = Tv = ∅, and v marks itself Bad. The above two observations follow straightforwardly from the description of SparsifiedColoring. Therefore, we can define the set N∗(v) as follows. Add u ∈ NG0(v) to N∗(v) if there exists an index i ∈ [0, k − 1] such that (i) u is a significant neighbor of v at iteration i, and (ii) v is not overloaded at iteration i. By the definition of overloaded vertices, we know that if v is not overloaded at iteration i, then v has at most K 2 log ∆ = O(poly log ∆) significant neighbors for iteration i. Thus, N∗(v) = O(poly log ∆). Note that the set N∗(v) can be locally calculated at v during the pre-processing step. 24 Summary. Algorithm SparsifiedColoring can be implemented in LOCAL in the following way. Pre-Processing Step. This step is randomized, and it takes one round and uses messages of O(poly log ∆) · O(log n) bits. After this step, each vertex has calculated a set N∗(v) with N∗(v) = O(poly log ∆). Main Steps. This is a deterministic O(log∗ ∆)-round procedure. During the procedure, each ver- tex v only receives messages from N∗(v). The output of each vertex is a color (or a special symbol ⊥ indicating that v is uncolored), which can be represented by ℓout = O(log n) buts. The input of each vertex consists of its color sequences for all iterations, which can be repre- sented in ℓin = O(poly log ∆) · O(log n) bits. Using the above implementation of SparsifiedColoring, we show that there is an LCA that solves (∆ + 1)-list coloring with ∆O(1) · O(log n) queries. Proof of Theorem 1.3. Consider the following algorithm for solving (∆ + 1)-list coloring. 1. Run the O(1)-round algorithm of Lemma 4.1. After that, each vertex v has four possible status: (i) v has been colored, (ii) v is in VGood, (iii) v is in VBad, or v is in R. This can be done with ∆O(1) queries. 2. The set R induces a subgraph with constant maximum degree. The LCA for (deg +1)-list coloring in [FHK16] implies that each v ∈ R only needs O(log∗ n) queries of vertices in R to compute its color. 3. By Lemma 4.1, each connected component in VBad has size ∆O(1)·O(log n). We let each vertex v ∈ VBad learns the component S it belongs to, and apply a deterministic algorithm to color S. 4. All vertices in VGood run the algorithm SparsifiedColoring. This adds an (∆ · ∆k ∗)-factor in the query complexity, where ∆∗ = maxv∈V0 N∗(v) = O(poly log ∆), and k = O(log∗ ∆) is the number of iterations of SparsifiedColoring. Note that in SparsifiedColoring, when we query a vertex v, the set N∗(v) can be calculated from the random bits in NG0(v) ∪ {v}. 5. By Lemma 4.3 and Lemma 2.2, the vertices left uncolored after SparsifiedColoring induces connected components of size ∆O(1) · O(log n). Similarly, we let each uncolored vertex v learns the component S it belongs to, and apply a deterministic algorithm to color S. By the standard procedure for converting an LOCAL algorithm to an LCA, it is straightforward to implement the above algorithm as an LCA with query complexity ∆O(1) · ∆k ∗ ·(cid:16)∆O(1) · O(log n)(cid:17) = ∆O(1) · O(log n). Next, we show that by applying SparsifiedColoring with the speedup lemma (Lemma 2.3), we can solve (∆ + 1)-list coloring in CONGESTED-CLIQUE in O(1) rounds when ∆ = O(poly log n). Theorem 4.7. Suppose ∆ = O(poly log n). There is an algorithm that solves (∆ + 1)-list coloring in CONGESTED-CLIQUE in O(1) rounds. 25 Proof. Recall from Lemma 2.1 that one round in LOCAL with messages of at most O(n log n) bits can be simulated in O(1) rounds in CONGESTED-CLIQUE. The first step of the algorithm is to run the black box algorithm for Lemma 4.1, which takes O(1) rounds in LOCAL with messages of size O(∆2 log n) ≪ O(n log n). The set R trivially induces a subgraph with O(n) edges. By Lemma 2.2, VBad induces a subgraph with O(n) edges. We use Lemma 2.1 to color them in O(1) rounds. Now we focus on VGood. We execute the algorithm SparsifiedColoring using the above implementation. The pre-processing step takes O(1) rounds in LOCAL with messages of size O(poly log ∆)·O(log n) ≪ O(n log n). For the main steps, we apply the speedup lemma (Lemma 2.3) with τ = O(log∗ ∆), ℓout = O(log n), ℓin = O(poly log ∆) · O(log n), and ∆∗ = O(poly log ∆). Since we assume ∆ = O(poly log n), this satisfies the criterion for Lemma 2.3, and so this procedure can be executed on CONGESTED-CLIQUE in O(1) rounds. The algorithm SparsifiedColoring does not color all vertices in VGood. However, by Lemma 4.3 and Lemma 2.2, we know that these uncolored vertices induces a subgraph with O(n) edges. We use Lemma 2.1 to color them in O(1) rounds. References [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 Proceedings 30th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), 2019. [ACK19] Sepehr Assadi, Yu Chen, and Sanjeev Khanna. Sublinear Algorithms for (∆ + 1) Vertex Coloring. In Proceedings 30th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), 2019. [AG15] Kook Jin Ahn and Sudipto Guha. Access to data and number of iterations: Dual primal algorithms for maximum matching under resource constraints. In Proc. SPAA, pages 202 -- 211, 2015. [ANOY14] Alexandr Andoni, Aleksandar Nikolov, Krzysztof Onak, and Grigory Yaroslavtsev. Parallel In Proc. Symposium on Theory of Computation algorithms for geometric graph problems. (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, Clifford Stein, Zhao Song, Zhengyu Wang, and Peilin Zhong. Parallel graph connectivity in log diameter rounds. In Proceedings 59th IEEE Symposium on Foundations of Computer Science (FOCS), pages 674 -- 685, 2018. [ASW18] Sepehr Assadi, Xiaorui Sun, and Omri Weinstein. Massively parallel algorithms for finding well-connected components in sparse graphs. arXiv preprint arXiv:1805.02974, 2018. [BEG18a] Leonid Barenboim, Michael Elkin, and Uri Goldenberg. Locally-iterative distributed (∆+ 1)-coloring below Szegedy-Vishwanathan barrier, and applications to self-stabilization and to restricted-bandwidth models. In Proceedings of the 2018 ACM Symposium on Principles of Distributed Computing, pages 437 -- 446. ACM, 2018. [BEG+18b] Mahdi Boroujeni, Soheil Ehsani, Mohammad Ghodsi, MohammadTaghi HajiAghayi, and Saeed Seddighin. Approximating edit distance in truly subquadratic time: quantum and MapReduce. In Proc. Symposium on Discrete Algorithms (SODA), pages 1170 -- 1189, 2018. 26 [BEPS16] Leonid Barenboim, Michael Elkin, Seth Pettie, and Johannes Schneider. The locality of dis- tributed symmetry breaking. J. ACM, 63(3):20:1 -- 20:45, 2016. [BFU18a] 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. [BFU18b] Sebastian Brandt, Manuela Fischer, and Jara Uitto. Matching and MIS for uniformly sparse graphs in MPC with low memory. manuscript, 2018. [BHP12] Andrew Berns, James Hegeman, and Sriram V Pemmaraju. Super-fast distributed algo- rithms for metric facility location. In Automata, Languages, and Programming, pages 428 -- 439. Springer, 2012. [BK18] Leonid Barenboim and Victor Khazanov. Distributed symmetry-breaking algorithms for con- gested cliques. In Computer Science - Theory and Applications - 13th International Computer Science Symposium in Russia, CSR 2018, Moscow, Russia, June 6-10, 2018, Proceedings, pages 41 -- 52, 2018. [BKKL17] Ruben Becker, Andreas Karrenbauer, Sebastian Krinninger, and Christoph Lenzen. Near- Optimal Approximate Shortest Paths and Transshipment in Distributed and Streaming Models. In Andréa W. Richa, editor, 31st International Symposium on Distributed Computing (DISC 2017), volume 91 of Leibniz International Proceedings in Informatics (LIPIcs), pages 7:1 -- 7:16. Schloss Dagstuhl -- Leibniz-Zentrum fuer Informatik, 2017. [BKS13] Paul Beame, Paraschos Koutris, and Dan Suciu. Communication steps for parallel query pro- cessing. In Proceedings of the 32Nd ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems (PODS), pages 273 -- 284, 2013. [BKS14] Paul Beame, Paraschos Koutris, and Dan Suciu. Skew in parallel query processing. In Pro- ceedings of the 33rd ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems (PODS), pages 212 -- 223, 2014. [CHKK+16] Keren Censor-Hillel, Petteri Kaski, Janne H. Korhonen, Christoph Lenzen, Ami Paz, and Jukka Suomela. Algebraic methods in the congested clique. Distributed Computing, 2016. [CLM+18] Artur Czumaj, Jakub Lacki, Aleksander Madry, Slobodan Mitrovic, Krzysztof Onak, and Piotr In Proc. Symposium on Sankowski. Round compression for parallel matching algorithms. Theory of Computation (STOC), pages 471 -- 484, 2018. [CLP18] Yi-Jun Chang, Wenzheng Li, and Seth Pettie. An optimal distributed (∆ + 1)-coloring algo- rithm? In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2018, pages 445 -- 456, New York, NY, USA, 2018. ACM. [CLT18] Keren Censor-Hillel, Dean Leitersdorf, and Elia Turner. Sparse matrix multiplication with bandwidth restricted all-to-all communication. CoRR, abs/1802.04789, 2018. [DG04] Jeffrey Dean and Sanjay Ghemawat. MapReduce: Simplified data processing on large clus- In Proceedings of the 6th Conference on Symposium on Operating Systems Design & ters. Implementation (OSDI), pages 10 -- 10, Berkeley, CA, USA, 2004. USENIX Association. [DKO14] Andrew Drucker, Fabian Kuhn, and Rotem Oshman. On the power of the congested clique model. In Proc. Principles of Distributed Computing (PODC), pages 367 -- 376. ACM, 2014. [DLP12] Danny Dolev, Christoph Lenzen, and Shir Peled. "tri, tri again": Finding triangles and small subgraphs in a distributed setting. In Distributed Computing, pages 195 -- 209. Springer, 2012. [DP09] Devdatt P. Dubhashi and Alessandro Panconesi. Concentration of Measure for the Analysis of Randomized Algorithms. Cambridge University Press, 2009. 27 [DR98] Devdatt P. Dubhashi and Desh Ranjan. Balls and bins: A study in negative dependence. J. Random Structures and Algs., 13(2):99 -- 124, 1998. [FG17] Manuela Fischer and Mohsen Ghaffari. Sublogarithmic distributed algorithms for Lovász local lemma with implications on complexity hierarchies. In Proceedings 31st International Sympo- sium on Distributed Computing (DISC), pages 18:1 -- 18:16, 2017. [FHK16] Pierre Fraigniaud, Marc Heinrich, and Adrian Kosowski. Local conflict coloring. In Proceedings 57th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 625 -- 634, 2016. [Gal16] Francois Le Gall. Further algebraic algorithms in the congested clique model and applications to graph-theoretic problems. In DISC, 2016. [GGK+18] Mohsen Ghaffari, Themis Gouleakis, Christian Konrad, Slobodan Mitrović, and Ronitt Rubin- feld. Improved massively parallel computation algorithms for mis, matching, and vertex cover. In Proc. Principles of Distributed Computing (PODC). arXiv:1802.08237, 2018. [Gha16] Mohsen Ghaffari. An improved distributed algorithm for maximal independent set. In Pro- ceedings 27th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 270 -- 277, 2016. [Gha17] Mohsen Ghaffari. Distributed MIS via all-to-all communication. In Proc. Principles of Dis- tributed Computing (PODC), pages 141 -- 149, 2017. [GSZ11] Michael T. Goodrich, Nodari Sitchinava, and Qin Zhang. Sorting, searching, and simulation in the MapReduce framework. In Proc. ISAAC, pages 374 -- 383. Springer, 2011. [GU19] Mohsen Ghaffari and Jara Uitto. Sparsifying Distributed Algorithms with Ramifications in Massively Parallel Computation and Centralized Local Computation. In Proceedings 30th An- nual ACM-SIAM Symposium on Discrete Algorithms (SODA), 2019. [HLL18] Nicholas J. A. Harvey, Christopher Liaw, and Paul Liu. Greedy and local ratio algorithms in the MapReduce model. In Proceedings of the 30th on Symposium on Parallelism in Algorithms and Architectures (SPAA), pages 43 -- 52, New York, NY, USA, 2018. ACM. [Hoe63] Wassily Hoeffding. Probability inequalities for sums of bounded random variables. Journal of the American Statistical Association, 58(301):13 -- 30, 1963. [HP15] James W Hegeman and Sriram V Pemmaraju. Lessons from the congested clique applied to MapReduce. Theoretical Computer Science, 608:268 -- 281, 2015. [HPP+15] James W. Hegeman, Gopal Pandurangan, Sriram V. Pemmaraju, Vivek B. Sardeshmukh, and Michele Scquizzato. Toward optimal bounds in the congested clique: Graph connectivity and MST. In Proc. Principles of Distributed Computing (PODC), pages 91 -- 100. ACM, 2015. [HPS14] James W Hegeman, Sriram V Pemmaraju, and Vivek B Sardeshmukh. Near-constant-time dis- tributed algorithms on a congested clique. In Distributed Computing, pages 514 -- 530. Springer, 2014. [HSS18] David G Harris, Johannes Schneider, and Hsin-Hao Su. Distributed (∆ + 1)-coloring in sublog- arithmic rounds. J. ACM, 65(4):19:1 -- 19:21, 2018. [IBY+07] Michael Isard, Mihai Budiu, Yuan Yu, Andrew Birrell, and Dennis Fetterly. Dryad: Distributed data-parallel programs from sequential building blocks. SIGOPS Operating Systems Review, 41(3):59 -- 72, 2007. 28 [IMS17] Sungjin Im, Benjamin Moseley, and Xiaorui Sun. Efficient massively parallel methods for dynamic programming. In Proc. Symposium on Theory of Computation (STOC), pages 798 -- 811, 2017. [JN18] Tomasz Jurdzinski and Krzysztof Nowicki. MST in O(1) rounds of congested clique. In Pro- ceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2018, New Orleans, LA, USA, January 7-10, 2018, pages 2620 -- 2632, 2018. [KSV10] Howard J. Karloff, Siddharth Suri, and Sergei Vassilvitskii. A model of computation for MapRe- duce. In Proc. Symposium on Discrete Algorithms (SODA), pages 938 -- 948, 2010. [Len13] Christoph Lenzen. Optimal deterministic routing and sorting on the congested clique. In Proceedings 33rd ACM Symposium on Principles of Distributed Computing (PODC), pages 42 -- 50, 2013. [Lin92] Nathan Linial. Locality in distributed graph algorithms. SIAM J. Comput., 21(1):193 -- 201, 1992. [LM17] Reut Levi and Moti Medina. A (centralized) local guide. Bulletin of EATCS, 2(122), 2017. [LMSV11] Silvio Lattanzi, Benjamin Moseley, Siddharth Suri, and Sergei Vassilvitskii. Filtering: a method for solving graph problems in MapReduce. In Proc. SPAA, pages 85 -- 94, 2011. [LPSPP05] Zvi Lotker, Boaz Patt-Shamir, Elan Pavlov, and David Peleg. Minimum-weight spanning tree construction in O(log log n) communication rounds. SIAM Journal on Computing, 35(1):120 -- 131, 2005. [LW10] Christoph Lenzen and Roger Wattenhofer. Brief announcement: Exponential speed-up of local algorithms using non-local communication. In Proceedings of the 29th ACM SIGACT-SIGOPS Symposium on Principles of Distributed Computing (PODC), pages 295 -- 296. ACM, 2010. [Nan14] Danupon Nanongkai. Distributed approximation algorithms for weighted shortest paths. In Proc. Symposium on Theory of Computation (STOC), 2014. [Par18] Merav Parter. (∆+1) coloring in the congested clique model. In Proceedings of the International Colloquium on Automata, Languages and Programming (ICALP), 2018. [Pel00] David Peleg. Distributed Computing: A Locality-Sensitive Approach. SIAM, 2000. [Pem01] Sriram V. Pemmaraju. Equitable coloring extends chernoff-hoeffding bounds. In Michel Goe- mans, Klaus Jansen, José D. P. Rolim, and Luca Trevisan, editors, Approximation, Random- ization, and Combinatorial Optimization: Algorithms and Techniques, pages 285 -- 296, Berlin, Heidelberg, 2001. Springer Berlin Heidelberg. [PR07] Michal Parnas and Dana Ron. Approximating the minimum vertex cover in sublinear time and a connection to distributed algorithms. Theoretical Computer Science, 381(1):183 -- 196, 2007. [PS96] Alessandro Panconesi and Aravind Srinivasan. On the complexity of distributed network de- composition. J. Algor., 20(2):356 -- 374, 1996. [PS18] Merav Parter and Hsin-Hao Su. (∆ + 1) coloring in O(log∗ ∆) congested-clique rounds. In Proceedings of the International Symposium on Distributed Computing (DISC), 2018. [PST11] Boaz Patt-Shamir and Marat Teplitsky. The round complexity of distributed sorting. In Proc. Principles of Distributed Computing (PODC), pages 249 -- 256, 2011. [RTVX11] Ronitt Rubinfeld, Gil Tamir, Shai Vardi, and Ning Xie. Fast local computation algorithms. In Proceedings of the First Symposium on Innovations in Computer Science (ICS), pages 223 -- 238, 2011. See also CoRR abs/1104.1377. 29 [RVW16] Tim Roughgarden, Sergei Vassilvitskii, and Joshua R. Wang. Shuffles and circuits: (on lower bounds for modern parallel computation). In Proc. SPAA, pages 1 -- 12, 2016. [SSS95] Jeanette P. Schmidt, Alan Siegel, and Aravind Srinivasan. Chernoff-Hoeffding bounds for applications with limited independence. SIAM Journal on Discrete Mathematics, 8(2):223 -- 250, 1995. [Whi12] Tom White. Hadoop: The Definitive Guide. O'Reilly Media, Inc., 2012. [ZCF+10] Matei Zaharia, Mosharaf Chowdhury, Michael J. Franklin, Scott Shenker, and Ion Stoica. In 2nd USENIX Workshop on Hot Topics in Spark: Cluster computing with working sets. Cloud Computing (HotCloud), 2010. A Probabilistic Tools In this section we review some probabilistic tools used in this paper. Chernoff Bound. Let X be the summation of n independent 0-1 random variables with mean p. Multiplicative Chernoff bounds give the following tail bound of X with mean µ = np. Pr[X ≥ (1 + δ)µ] ≤(exp(−δ2µ ) 3 exp(−δµ 3 ) if δ ∈ [0, 1] if δ > 1. Note that these bounds hold even when X is the summation of n negatively correlated 0-1 random variables [DR98, DP09] with mean p, i.e., total independent is not required. These bounds also hold when µ > np is an overestimate of E[X]. Chernoff Bound with k-wise Independence. Suppose X is the summation of n k-wise in- dependent 0-1 random variables with mean p. We have µ ≥ E[X] = np and the following tail bound [SSS95]. In particular, when k = Ω(δ2µ), we obtain the same asymptotic tail bound as that of Chernoff bound with total independence. Pr[X ≥ (1 + δ)µ] ≤ exp(cid:0)− min{k, δ2µ}(cid:1) . Chernoff Bound with Bounded Independence. Suppose X is the summation of n indepen- i=1 Xi. dent 0-1 random variables with bounded dependency d, and let µ ≥ E[X], where X = Pn Then we have [Pem01]: Pr[X ≥ (1 + δ)µ] ≤ O(d) · exp(−Ω(δ2µ/d)). i=1 Xi, and each Xi is an indepen- dent random variable bounded by the interval [ai, bi]. Let µ ≥ E[X]. Then we have the following concentration bound [Hoe63]. Hoeffding's Inequality. Consider the scenario where X =Pn Pr[X ≥ (1 + δ)µ] ≤ exp(cid:18) −2(δµ)2 i=1(bi − ai)2(cid:19) . Pn 30 B Proof of the Shattering Lemma In this section, we prove the shattering lemma (Lemma 2.2). Let c ≥ 1. Consider a randomized procedure that generates a subset of vertices B ⊆ V . Suppose that for each v ∈ V , we have Pr[v ∈ B] ≤ ∆−3c, and this holds even if the random bits not in N c(v) are determined adversarially. Then, the following is true. 1. With probability at least 1 − n−Ω(c′), each connected component in the graph induced by B has size at most (c′/c)∆2c log∆ n. 2. With probability 1 − O(∆c) · exp(−Ω(n∆−c)), the number of edges induced by B is O(n). Proof. Statement (1) is well-known; see e.g., [BEPS16, FG17]. Here we provide a proof for State- ment (2). For each edge e = {u, v}, write Xe to be the indicator random variable such that Xe = 1 if u ∈ B and v ∈ B. Let X = Pe∈E Xe. It is clear that Pr[Xe] ≤ 2∆−3c, and so µ = E[X] ≤ n∆1−3c ≪ n. By a Chernoff bound with bounded dependence d = 2∆c the probability that X > n is O(∆c) · exp(−Ω(n∆−c)). C Fast Simulation of LOCAL Algorithms in CONGESTED-CLIQUE In this section, we prove Lemma 2.3. Let A be a τ -round LOCAL algorithm on G = (V, E). We show that there is an O(1)-round simulation of A in in CONGESTED-CLIQUE, given that (i) ∆τ ∗ log(∆∗ + ℓin/ log n) = O(log n), (ii) ℓin = O(n), and (iii) ℓout = O(log n). Proof. Assume A is in the following canonical form. Each vertex first generates certain amount of local random bits, and then collects all information in its τ -neighborhood. The information includes not only the graph topology, but also IDs, inputs, and the random bits of these vertices. After gathering this information, each vertex locally computes its output based on the information it gathered. Consider the following procedure in CONGESTED-CLIQUE for simulating A. In the first phase, for each ordered vertex pair (u, v), with probability p to be determined, u sends all its local infor- mation to v. The local information can be encoded in Θ(∆∗ log n + ℓin) bits. This includes the local input of u, the local random bits needed for u to run A, and the list of IDs in N∗(u) ∪ {u}. In the second phase, for each ordered vertex pair (u, v), if v has gathered all the required information to calculate the output of A at u, then v sends to u the output of A at u. At first sight, the procedure seems to take ω(1) rounds because of the O(log n)-bit message size constraint of CONGESTED-CLIQUE. However, if we set p = Θ(cid:16) 1 ∆∗+ℓin/ log n(cid:17), the expected number of O(log n)-bit messages sent from or received by a vertex is np · Θ(∆∗ + ℓin/ log n) = O(n). More precisely, let Xu be the number vertices v ∈ V to which u sends its local information in the first phase; similarly, let Yv be the number of vertices u ∈ V sending their local information to a v. We have E[Xu] = np, for each u ∈ V , and E[Yv] = np, for each v ∈ V . By a Chernoff bound, so long as np = Ω(log n), with probability 1 − exp(−Ω(np)) = 1/poly(n), we have Xu = O(np), for each u ∈ V , and Yv = O(np), for each v ∈ V . That is, the number of O(log n)-bit messages sent from or received by a vertex is at most np · Θ(∆∗ + ℓin/ log n) = O(n), w.h.p. We verify that np = Ω(log n). Condition (i) implicitly requires ∆∗ = O(log n), and Condition (ii) requires ℓin = O(n). Therefore, np = Θ(cid:16) n ∆+ℓin/ log n(cid:17) = Ω(log n). Thus, we can route all messages in O(1) rounds using Lenzen's routing (Lemma 2.1), and so the first phase can be done in O(1) rounds. 31 Denote Eu,v as the event that v ∈ V that receives messages from all vertices in N τ Condition (iii) guarantees that ℓout = O(log n), and so the messages in the second phase can be sent directly in O(1) rounds. What remains to do is to show that for each u ∈ V , w.h.p., there is a vertex v ∈ V that receives messages from all vertices in N τ ∗ (u) during the first phase, and so v is able to calculate the output of u locally. ∗ (u) during the first phase, and denote Eu as the event that at least one of {Eu,v v ∈ V } occurs. We have ∗. Thus, Pr[Eu] ≥ 1 − (1 − p∆τ Pr[Eu,v] ≥ p∆τ Condition (i) guarantees that ∆τ log(∆∗ + ℓin/ log n) = O(log n). By setting p = ǫ/(∆∗ + ℓin/ log n) for some sufficiently small constant ǫ, we haves ∆τ 2 log n, and it implies ∗ )n = 1 − exp(−Ω(√n)). Thus, the simulation gives ∗ ≥ 1/√n. Therefore, Pr[Eu] ≥ 1 − (1 − p∆τ p∆τ the correct output for all vertices w.h.p. ∗ log p ≥ − 1 ∗ , since N τ ∗ (u) ≤ ∆τ ∗ )n. We remark that the purpose of the condition ℓout = O(log n) is only to allow the messages in the second phase to be sent directly in O(1) rounds. With a more careful analysis and using Lenzen's routing , the condition ℓout = O(log n) can be relaxed to ℓout = O(n), though in our application we only need ℓout = O(log n). D Proof of Lemma 4.1 In this section, we briefly review the algorithm of [CLP18] and show how to obtain Lemma 4.1 from [CLP18]. The algorithm uses a sparsity sequence defined by ǫ1 = ∆−1/10, ǫi = √ǫi−1 for i > 1, and ℓ = Θ(log log ∆) is the largest index such that 1 ǫℓ ≥ K for some sufficiently large constant K. The algorithm first do an O(1)-round procedure (initial coloring step) to color a fraction of the vertex set V , and denote V ⋆ as the set of remaining uncolored vertices. The set V ⋆ is decomposed into ℓ + 1 subsets (V1, . . . , Vℓ, Vsp) according to local sparsity. The algorithm then applies another O(1)-round procedure (dense coloring step) to color a fraction of vertices in V1 ∪ ··· ∪ Vℓ. The remaining uncolored vertices in V ⋆ after the above procedure (initial coloring step and dense coloring step) are partitioned into three subsets: U , R, and Vbad.13 The set R induces a constant-degree graph. The set Vbad satisfies the property that each vertex is added to Vbad with probability ∆−Ω(c), where c can be any given constant, independent on the runtime. The vertices in U satisfy the following properties. Excess Colors: We have V1 ∩ U = ∅. Each v ∈ Vi ∩ U , with i > 1, has Ω(ǫ2 i−1∆) excess colors. Each v ∈ Vsp ∩ U has Ω(ǫ2 ℓ ∆) = Ω(∆) excess colors. The number of excess colors at a vertex v is defined by the number of available colors of v minus the number of uncolored neighbors of v. Number of Neighbors: For each v ∈ U , and for each i ∈ [2, ℓ], the number of uncolored neighbors i−1∆). The number of uncolored neighbors of v in Vsp ∩ U is of v in Vi ∩ U is O(ǫ5 of course at most ∆ = O(ǫ2.5 i ∆) = O(ǫ2.5 ℓ ∆), since ǫℓ is a constant. At this moment, the two sets Vbad and R satisfy the required condition specified in Lemma 4.1. In what follows, we focus on U . Orientation. We orient the graph induced by the uncolored vertices in U as follows. For any edge {u, v}, we orient it as (u, v) if one of the following is true: (i) u ∈ Vsp but v /∈ Vsp, (ii) u ∈ Vi 13The algorithm in [CLP18] for coloring layer-1 large blocks has two alternatives. Here we always use the one that puts the remaining uncolored vertices in one of R or Vbad, where each vertex is added to Vbad with probability ∆−Ω(c). 32 and v ∈ Vj with i > j, (iii) u and v are within the same part in the partition V ⋆ = V1 ∪ . . . Vℓ ∪ Vsp and ID(v) < ID(u). This results in a directed acyclic graph. We write N out(v) to denote the set of out-neighbors of v in this graph. Lower Bound of Excess Colors. In view of the above, there exist universal constants η > 0 and C > 0 such that the following is true. For each i ∈ [2, ℓ] and each uncolored vertex v ∈ Vi\ Vbad, we set pv = ηǫ2 ℓ ∆. By selecting a sufficiently small η, the number pv is always a lower bound on the number of excess colors at v. i−1∆. For each v ∈ Vsp \ Vbad, we set pv = ηǫ2 j=2 O(ǫ2.5 ). ℓ ℓ ∆), since ǫℓ is a constant. number of excess colors in each out-neighbor. The Number of Excess Colors is Large. Recall that to color the graph quickly we need the number of excess colors to be sufficiently large with respect to out-degree. If v ∈ Vi ∩ U with i−1∆). In this case, pv/N out(v) = Ω(ǫ−0.5 i−1 ). In this case, i ≥ 2, it satisfies N out(v) =Pi j−1∆) = O(ǫ2.5 If v ∈ Vsp ∩ U , then of course N out(v) ≤ ∆ = O(ǫ2 pv/N out(v) = Ω(ǫ−0.5 However, due to the high variation on the palette size in our setting, pv/N out(v) is not a good measurement for the gap between the number of excess colors and out-degree at v. The inverse of the expressionPu∈N out(v) 1/pu turns out to be a better measurement, as it takes into account the There is a constant C > 0 such that for each uncolored vertex v ∈ V ⋆ \ (Vbad ∪ R), we have Pu∈N out(v) 1/pu ≤ 1/C. The calculation is as follows. iXj=2 ℓ+1Xj=2 then Xu∈N out(v) then Xu∈N out(v) If v ∈ Vi ∩ U (i > 1), j−1∆ ǫ2 O ǫ2.5 O ǫ2.5 j−1∆! = j−1∆! = j−1∆ ǫ2 j−1) = O(ǫ0.5 i−1) < 1/C. iXj=2 ℓ+1Xj=2 O(ǫ0.5 j−1) = O(ǫ0.5 ℓ ) < 1/C. If v ∈ Vsp ∩ U , 1/pu = 1/pu = O(ǫ0.5 For a specific example, if v is an uncolored vertex in V2\Vbad, then pv = ηǫ2 bound on the number of excess colors at v, and v has out-degree N out(v) = O(ǫ2.5 and we have Pu∈N out(v) 1/pu = O(ǫ0.5 between the number of excess colors and the out-degree at v is Ω(∆0.05). 1∆ = η∆0.8 is the lower 1 ∆) = O(∆0.75), 1 ) = O(∆−0.05) < 1/C. Intuitively, this means that the gap j ∆), but the number of out-neighbors of v is at most O(ǫ2.5 Summary. Currently the graph induced by U satisfies the following conditions. Each vertex v is associated with a parameter pv = ηǫ2 j ∆ (for some j ∈ [1, ℓ]) such that the number of excess colors at v is at least pv = Ω(ǫ2 j ∆). In particular, we always havePu∈N out(v) 1/pu = O(ǫ0.5 j ) < 1/C, where C > 0 is a universal constant. The current pv-values for vertices in U almost satisfy the required condition for VGood specified in Lemma 4.1. Lower Bound of p⋆. Define p⋆ as the minimum pv-value among all uncolored vertices v ∈ V ⋆. 1∆ = η∆0.8, but in Lemma 4.1 it is required that p⋆ ≥ Currently we only have p⋆ ≥ ηǫ2 ∆/ log ∆. Lower Bound of C. Currently we have Pu∈N out(v) 1/pu ≤ 1/C for some universal constant C, For the rest of the section, we show that there is an O(1)-round that is able to improve the lower bound of p⋆ to p⋆ ≥ ∆/ log ∆ and increase the parameter C to any specified constant. The procedure will colors a fraction of vertices in U and puts some vertices in U to the set Vbad. We but in Lemma 4.1 it is required that C > 0 can be any given constant. 33 first consider improving the lower bound of p⋆. This is done by letting all vertices whose pv- value are too small (i.e., less than ∆/ log ∆) to jointly run Lemma D.1. For these vertices, we have Pu∈N out(v) 1/pu ≤ O(cid:16)log−1/4 ∆(cid:17),14 and so we can use C = Ω(cid:16)log1/4 ∆(cid:17) in Lemma D.1. The algorithm of Lemma D.1 takes only O(1) rounds. All participating vertices that still remain uncolored join Vbad. Lemma D.1 ([CLP18]). Consider a directed acyclic graph, where vertex v is associated with a parameter pv ≤ Ψ(v)− deg(v) We write p⋆ = minv∈V pv. Suppose that there is a number C = Ω(1) such that all vertices v satisfy Pu∈N out(v) 1/pu ≤ 1/C. Let d⋆ be the maximum out-degree of the graph. There is an O(log∗(p⋆) − log∗(C))-time algorithm achieving the following. Each vertex v remains uncolored with probability at most exp(−Ω(√p⋆)) + d⋆ exp(−Ω(p⋆)). This is true even if the random bits generated outside a constant radius around v are determined adversarially. Now the lower bound on p⋆ is met. We show how to increase the C-value to any given constant we like in O(1) rounds. We apply Lemma D.2 using the current p⋆ and C. After that, we can set the new C-value to be C′ = C · exp(C/6)/(1 + λ), after putting each vertex v not meeting the following condition to Vbad: Sum of 1/pu over all remaining uncolored vertices u in N out(v) is at most 1/C′ = 1 + λ exp(C/6)C . If λ is chosen as a small enough constant, we have C′ > C. After a constant number of iterations, we can increase the C-value to any constant we like. Now, all conditions in Lemma 4.1 are met for the three sets R, Vbad, and VGood ← U . Lemma D.2 ([CLP18]). There is an one-round algorithm meeting the following conditions. Let v be any vertex. Let d be the summation of 1/pu over all vertices u in N out(v) that remain uncolored after the algorithm. Then the following holds. Pr(cid:20)d ≥ 1 + λ exp(C/6)C(cid:21) ≤ exp(cid:0)−2λ2p⋆ exp(−C/3)/C(cid:1) + d⋆ exp(−Ω(p⋆)). E The CLP Algorithm in the Low-Memory MPC Model In this section, we show which changes have to be made to [CLP18] to get a low-memory MPC algorithm, thus proving Lemma 3.4. There are two main issues in the low-memory MPC model that we need to take care of. First, the total memory of the system is limited to Θ(m + n), where m and n are the number of edges and vertices in the input graph, respectively. Second, the local memory per machine is restricted to O(nα), for an arbitrary constant α > 0. These two restrictions force us to be careful about the amount of information sent between the machines. In particular, no vertex can receive messages from more than O(nα) other vertices in one round (as opposed to the CONGESTED-CLIQUE, where a vertex can receive up to O(n) messages per round). The key feature of our partitioning algorithm is that we can reduce the coloring problem to several instances of coloring graphs with maximum degree ∆ = O(nα/2). Given this assumption, we can implement the CLP algorithm in the low-memory MPC model almost line by line as done by Parter [Par18, Appendix A.2] for the CONGESTED-CLIQUE. Therefore, here we simply point out the differences in the algorithm and refer the reader to the paper by Parter for further technical details. 14Each vertex v is associated with a parameter pv = ηǫ2 j ∆, and we have Pu∈N out(v) 1/pu = O(ǫ0.5 j ) = O(p1/4 v ). 34 Dense Vertices. Put briefly, a vertex is γ-dense, if a (1 − γ)-fraction of the edges incident on it belong to at least (1 − γ) · ∆ triangles. An γ-almost clique is a connected component of γ-dense vertices that have at most γ · ∆ vertices outside the component. Each such component has a weak diameter of at most 2. These components can be computed in 2 rounds by each vertex learning its 2-hop neighborhood. This process is performed O(log log ∆) times in parallel which incurs a factor of O(log log ∆) in the memory requirements, which is negligible. Furthermore, the algorithm requires running a coloring algorithm within the dense components. Since the component size is at most ∆ ≪ ∆2, we can choose one vertex in the component as a leader and the leader vertex can locally simulate the coloring algorithm without breaking the local memory restriction. Memory Bounds. Once the 2-hop neighborhoods of nodes have been learned, no more memory overhead is required. Since we have ∆ ≪ nα/2, learning the 2-hop neighborhoods does not violate the local memory restriction of O(nα). For the total memory bound, storing the 2-hop neighborhoods requires at most eO(Pv(degG(v))2) memory. Post-Shattering and Clean-up. Another step that we cannot use as a black box is a subroutine that colors a graph that consists of connected components of O(poly log n) size. Regardless of the component sizes being small, all vertices over all components might not fit the memory of a single machine. Hence, similarly to the CLP algorithm in the LOCAL model, we use the best deterministic list coloring algorithm to color the components. For general graphs, currently the best runtime in the LOCAL model is obtained by applying the algorithm by Panconesi and Srinivasan [PS96] with runtime of 2O(√log n′), where n′ = O(poly log n) is the maximum size of the small components. We can improve this bound exponentially in the MPC model by using the known graph exponentiation technique [Len13, BFU18b] and obtain a runtime of O(√log log n). The graph exponentiation technique works as follows. Suppose that every vertex knows all the vertices and the topology of its 2i−1-hop neighborhood in round i−1 for some integer i ≥ 0. Then, in round i, every vertex can communicate the topology of its 2i−1-hop neighborhood to all the vertices in its 2i−1-hop neighborhood. This way, every vertex learns its 2i-hop neighborhood in round i and hence, every vertex can simulate any 2i-round LOCAL algorithm in i rounds. We observe that, in the components of O(poly log n) size, the 2i-hop neighborhood of any vertex for any i fits into the memory of a single machine since the number of vertices in the neighborhood is clearly bounded by O(poly log n). The same observation yields that the total memory of O(m) suffices. 35
1904.12596
3
1904
2019-11-16T16:09:05
Graph Planarity Testing with Hierarchical Embedding Constraints
[ "cs.DS" ]
Hierarchical embedding constraints define a set of allowed cyclic orders for the edges incident to the vertices of a graph. These constraints are expressed in terms of FPQ-trees. FPQ-trees are a variant of PQ-trees that includes F-nodes in addition to P- and to Q-nodes. An F-node represents a permutation that is fixed, i.e., it cannot be reversed. Let $G$ be a graph such that every vertex of $G$ is equipped with a set of FPQ-trees encoding hierarchical embedding constraints for its incident edges. We study the problem of testing whether $G$ admits a planar embedding such that, for each vertex $v$ of $G$, the cyclic order of the edges incident to $v$ is described by at least one of the FPQ-trees associated with~$v$. We prove that the problem is fixed-parameter tractable for biconnected graphs, where the parameters are the treewidth of $G$ and the number of FPQ-trees associated with every vertex of $G$. We also show that the problem is NP-complete if parameterized by the number of FPQ-trees only, and W[1]-hard if parameterized by the treewidth only. Besides being interesting on its own right, the study of planarity testing with hierarchical embedding constraints can be used to address other planarity testing problems. In particular, we apply our techniques to the study of NodeTrix planarity testing of clustered graphs. We show that NodeTrix planarity testing with fixed sides is fixed-parameter tractable when parameterized by the size of the clusters and by the treewidth of the multi-graph obtained by collapsing the clusters to single vertices, provided that this graph is biconnected.
cs.DS
cs
Graph Planarity Testing with Hierarchical Embedding Constraints Giuseppe Liottaa, Ignaz Rutterb, Alessandra Tappinia,∗ aDipartimento di Ingegneria, Universit`a degli Studi di Perugia, Italy bDepartment of Computer Science and Mathematics, University of Passau, Germany Abstract Hierarchical embedding constraints define a set of allowed cyclic orders for the edges incident to the vertices of a graph. These constraints are expressed in terms of FPQ-trees. FPQ-trees are a variant of PQ-trees that includes F-nodes in addition to P- and to Q-nodes. An F-node represents a permutation that is fixed, i.e., it cannot be reversed. Let G be a graph such that every vertex of G is equipped with a set of FPQ-trees encoding hierarchical embedding constraints for its incident edges. We study the problem of testing whether G admits a planar embedding such that, for each vertex v of G, the cyclic order of the edges incident to v is described by at least one of the FPQ-trees associated with v. We prove that the problem is fixed-parameter tractable for biconnected graphs, where the parameters are the treewidth of G and the number of FPQ- trees associated with every vertex of G. We also show that the problem is NP-complete if parameterized by the number of FPQ-trees only, and W[1]-hard if parameterized by the treewidth only. Besides being interesting on its own right, the study of planarity testing with hierarchical embedding constraints can be used to address other planarity testing problems. In particular, we apply our techniques to the study of NodeTrix planarity testing of clustered graphs. We show that NodeTrix planarity testing with fixed sides is fixed-parameter tractable when parameterized by the size of the clusters and by the treewidth of the multi-graph obtained by collapsing the clusters to single vertices, provided that this graph is biconnected. Keywords: Graph Algorithms, Fixed Parameter Tractability, Planarity Testing, Embedding Constraints, NodeTrix Planarity ∗Corresponding author Email addresses: [email protected] (Giuseppe Liotta), [email protected] (Ignaz Rutter), [email protected] (Alessandra Tappini) 1 1. Introduction The study of graph planarity testing and of its variants is at the heart of graph algorithms and of their applications in various domains (see, e.g., [1]). Among the most studied variants we recall, for example, upward planarity test- ing, rectilinear planarity testing, clustered planarity testing, and HV-planarity testing (see, e.g., [2, 3, 4, 5, 6, 7]). This paper studies a problem of graph planarity testing subject to embedding constraints. In its more general terms, graph planarity with embedding constraints ad- dresses the problem of testing whether a graph G admits a planar embedding where the cyclic order of the edges incident to (some of) its vertices is totally or partially fixed. For example, Angelini et al. [8] and Jel´ınek et al. [9] study the case when the planar embedding of a subgraph H of G is given as part of the input. Angelini et al. [8] present a linear-time solution to the problem of testing whether G admits a planar embedding that extends the given embedding of H. Jel´ınek et al. [9] show that if the planarity test fails, an obstruction taken from a collection of minimal non-planar instances can be produced in polynomial time. A different planarity testing problem with embedding constraints is studied by Dornheim [10], who considers the case that G is given with a distinguished set of cycles and it is specified, for each cycle, that certain edges must lie inside or outside the cycle. He proves NP-completeness in general and describes a polynomial-time solution when the graph is biconnected and any two cycles share at most one vertex. Da Lozzo and Rutter [11] give an approximation algorithm for a restricted version of the problem. The research in this paper is inspired by a seminal work of Gutwenger et al. [12] who study the graph planarity testing problem subject to hierarchical em- bedding constraints. Hierarchical embedding constraints specify for each vertex v of G which cyclic orders of the edges incident to v are admissible in a con- strained planar embedding of G. The term "hierarchical" reflects the fact that these constraints describe ordering relationships both between sets of edges in- cident to a same vertex and, recursively, between edges within a same set. For example, Fig. 1 shows a vertex v, its incident edges, and a set of hierarchical embedding constraints on these edges. The edges in the figure are partitioned into four sets, denoted as E1, E2, E3, and E4; the embedding constraints al- low only two distinct clockwise cyclic orders for these edge-sets, namely either E1E2E3E4 (Fig. 1(a)) or E1E3E2E4 (Fig. 1(b)). Within each set, the hierar- chical embedding constraints of Fig. 1 allow the edges of E1, E2, and E3 to be arbitrarily permuted with one another, while the edges of E4 are partitioned into three subsets E(cid:48) 4 must always appear between 4 and E(cid:48)(cid:48)(cid:48) E(cid:48) 4 can be ar- bitrarily permuted, while the edges of E(cid:48)(cid:48) 4 have only two possible orders that are the reverse of one another. 4 in the clockwise order around v. Also, the edges of E(cid:48) 4 and the edges of E(cid:48)(cid:48)(cid:48) 4, E(cid:48)(cid:48) 4 , and E(cid:48)(cid:48)(cid:48) 4 such that E(cid:48)(cid:48) Hierarchical embedding constraints can be conveniently encoded by using FPQ-trees, a variant of PQ-trees that includes F-nodes in addition to P-nodes and to Q-nodes. An F-node encodes a permutation that cannot be reversed. For example, the hierarchical embedding constraints of Fig. 1 can be represented by 2 (a) (b) Figure 1: (a)-(b) Two examples of a vertex v with hierarchical embedding constraints and the corresponding FPQ-trees. two FPQ-trees denoted as T and T (cid:48) in Fig. 1(a) and 1(b), respectively. The leaves of T and T (cid:48) are the elements of E1, E2, E3, E(cid:48) 4 . In the figure, F-nodes are depicted as shaded boxes, Q-nodes as white boxes, and P-nodes as circles. The F-node of the FPQ-tree T in Fig. 1(a) enforces the cyclic order E1E2E3E4 around v, while the F-node of the FPQ-tree T (cid:48) in Fig. 1(b) enforces the cyclic order E1E3E2E4. Both in T and in T (cid:48), the Q-node that is adjacent to the F-node enforces E(cid:48)(cid:48) in clockwise order around v. The constraints by which the edges of E1, E2, E3, and E(cid:48) 4 can be arbitrarily permuted around v are encoded by P-nodes in T and in T (cid:48). 4 to appear between E(cid:48) 4 and E(cid:48)(cid:48)(cid:48) 4, E(cid:48)(cid:48) 4 , and E(cid:48)(cid:48)(cid:48) 4 Gutwenger et al. [12] study the planarity testing problem with hierarchical embedding constraints by allowing at most one FPQ-tree per vertex. In this paper we generalize their study and allow more than one FPQ-tree associated with each vertex. Besides being interesting on its own right, this generalization can be used to model and study other graph planarity testing problems. As a proof of concept, we apply our results to the study of NodeTrix planarity testing of clustered graphs. Before listing our results, we recall here that NodeTrix representations have been introduced to visually explore flat clustered graphs by Henry et al. [13] in one of the most cited papers of the InfoVis conference [14]. See also [13, 15, 16, 17]. A flat clustered graph G is a graph whose vertex set is partitioned into 3 E4E(cid:48)(cid:48)4E(cid:48)4E1E2E3E(cid:48)(cid:48)(cid:48)4E(cid:48)4E3E1E2E(cid:48)(cid:48)(cid:48)4E(cid:48)(cid:48)4F-nodeQ-nodeP-nodeLegend:TvE4E(cid:48)(cid:48)4E(cid:48)4E1E3E2E(cid:48)(cid:48)(cid:48)4E(cid:48)4E2E1E3E(cid:48)(cid:48)(cid:48)4E(cid:48)(cid:48)4T(cid:48)v (a) (b) Figure 2: (a) A non-planar flat clustered graph G. Clusters are highlighted in blue and green. (b) A planar NodeTrix representation of G. subsets called clusters. A NodeTrix representation of G represents its clusters as adjacency matrices, while the edges connecting different matrices are rep- resented as simple curves (see for example Figure 2). The NodeTrix planarity testing problem asks whether G admits a NodeTrix representation without edge crossings. The question can be asked both in the "fixed sides" scenario and in the "free sides" scenario. The fixed sides scenario specifies, for each edge e connecting two matrices M and M(cid:48), the sides (Top, Bottom, Left, Right) of M and M(cid:48) to which e must be incident; in the free sides scenario the testing algo- rithm can choose the sides to which e is incident. NodeTrix planarity testing is known to be NP-complete in both scenarios [16, 17, 18]. Our main results are the following. • We show that FPQ-Choosable Planarity Testing is NP-complete even if the number of FPQ-trees associated with each vertex is bounded by a constant, and it remains NP-complete even if the FPQ-trees only contain P-nodes. This contrasts with the result of Gutwenger et al. [12] who prove that FPQ-Choosable Planarity Testing can be solved in linear time when each vertex is equipped with at most one FPQ-tree. We also prove that FPQ-Choosable Planarity Testing is W[1]-hard parameterized by treewidth, and that it remains W[1]-hard even when the FPQ-trees only contain P-nodes. • The above results imply that FPQ-Choosable Planarity Testing is not fixed-parameter tractable if parameterized by treewidth only or by the number of FPQ-trees per vertex only. For a contrast, we show that FPQ- Choosable Planarity Testing becomes fixed-parameter tractable for biconnected graphs when parameterized by both the treewidth and the number of FPQ-trees associated with every vertex. • We show that there is a strict interplay between the FPQ-Choosable Planarity Testing problem and the problem of testing whether a flat clustered graph G is NodeTrix planar. Indeed, we prove that NodeTrix 4 v1v2v3v4v5v6v7v8v9v10v11v6v7v9v8v10v1v2v4v3v5v11 planarity testing with fixed sides is fixed-parameter tractable when pa- rameterized by the size of the clusters of G and by the treewidth of the multi-graph obtained by collapsing the clusters of G to single vertices, pro- vided that this graph is biconnected. If we consider the vertex degree of G as an additional parameter, the fixed-parameter tractability immediately extends to NodeTrix planarity testing with free sides. From a technical point of view, our algorithmic approach is based on a combined usage of different data structures, namely SPQR-trees [19], FPQ- trees, and sphere-cut decomposition trees [20, 21, 22]. It may be worth recalling that a polynomial-time solution for NodeTrix planarity testing with fixed sides was known only when the size of each cluster is bounded by a constant and the treewidth of the graph obtained by collapsing the clusters to single vertices is two [17]. The rest of the paper is organized as follows. Section 2 reports prelimi- nary definitions. Section 3 introduces the FPQ-Choosable Planarity Test- ing problem, Section 4 studies its computational complexity, in Section 5 we describe a fixed-parameter tractability approach for FPQ-Choosable Pla- narity Testing, and in Section 6 we analyze the interplay between FPQ- Choosable Planarity Testing and NodeTrix Planarity testing. Concluding remarks and open problems are given in Section 7. 2. Preliminaries We assume familiarity with graph theory and algorithms, and we only briefly recall some of the basic concepts that will be used extensively in the rest of the paper (see also [23, 24]). A PQ-tree is a tree-based data structure that represents a family of permu- tations on a set of elements [25]. In a PQ-tree, each element is represented by one of the leaf nodes, and each non-leaf node is a P-node or a Q-node. The children of a P-node can be permuted arbitrarily, while the order of the children of a Q-node is fixed up to reversal. Given a graph G together with a fixed com- binatorial embedding, we can associate with each vertex v a PQ-tree Tv whose leaves represent the edges incident to v. Tree Tv encodes a set of permutations for its leaves: Each of these permutations is in a bijection with a cyclic order of the edges incident to v. If there is a permutation πv of the leaves of Tv that is in a bijection with a cyclic order σv of the edges incident to v, we say that Tv represents σv, or equivalently that σv is represented by Tv. An FPQ-tree is a PQ-tree where, for some of the Q-nodes, the reversal of the permutation described by their children is not allowed. To distinguish these Q-nodes from the regular Q-nodes, we call them F-nodes. It may be worth recalling that Gutwenger et al. [12] call this data structure "embedding constraint", and that their "gc-nodes" correspond to P-nodes, "mc-nodes" to Q-nodes, and "oc-nodes" to F-nodes. Let G be a biconnected planar (multi-)graph. An SPQR-decomposition of G describes the structure of G in terms of its triconnected components by means 5 (a) (b) (c) Figure 3: (a) A biconnected planar graph G. (b) An SPQR-decomposition tree of G. The skeletons of S-, P-, and R- nodes are inside gray boxes, while Q-nodes are depicted as letters. (c) The embedding tree of v2. of a tree called the SPQR-decomposition tree, and denoted as T (see, e.g., [19, 24]). Tree T can be computed in linear time and it has three types of internal nodes that correspond to different arrangements of the components of G. If the components are arranged in a cycle, they correspond to an S-node of T ; if they share two vertices and are arranged in parallel, they correspond to a P-node of T ; if they are arranged in a triconnected graph, they correspond to an R- node of T . The leaves of T are Q-nodes, and each of them corresponds to an edge of G. To simplify the description and without loss of generality, we shall assume that every S-node of T has exactly two children. For each node µ of T , the skeleton of µ is an auxiliary graph that represents the arrangement of the triconnected components of G corresponding to µ, and it is denoted by skel(µ). Each edge of skel(µ) is called a virtual edge, and the end-points of a (possibly virtual) edge are called poles. Every virtual edge corresponds to a subgraph of G called the pertinent graph, that is denoted by Gµ. Tree T encodes all possible planar combinatorial embeddings of G. These embeddings are determined by P- and R-nodes, since the skeletons of S- and Q-nodes have a unique embedding. Indeed, the skeleton of a P-node consists of parallel edges that can be arbitrarily permuted, while the skeleton of an R-node is triconnected, and hence it has a unique embedding up to a flip. Figure 3(a) shows a biconnected planar multi- graph G and Figure 3(b) illustrates an SPQR-decomposition tree of G. Note that the planar combinatorial embeddings that are given by the SPQR- decomposition tree of a biconnected graph G give constraints on the cyclic order of edges around each vertex of G. These constraints can be encoded by associating a PQ-tree to each vertex v of G, called the embedding tree of v and denoted as T  v (see, e.g., [26]). For example, Figure 3(c) shows the embedding tree T  of the vertex v2 in Figure 3(a). Note that edges f and h (i and j, resp.) v2 belong to an R-node (a P-node, resp.) in the SPQR-decomposition tree of G, hence the corresponding leaves are connected to a Q-node (a P-node, resp.) in T  v2 . 6 v1v2v3v4v5abcdefghijiv1v4v1v2v4v3v1v2v5v2v1v5v2bcafghedjPPPRSfheijTv2 3. The FPQ-choosable Planarity Testing Problem Let G = (V, E) be a (multi-)graph, let v ∈ V , and let Tv be an FPQ- tree whose leaf set is E(v), i.e., the set of the edges incident to v. We define consistent(Tv) as the set of cyclic orders of the edges incident to v in E that are represented by the FPQ-tree Tv. An FPQ-choosable graph is a pair (G, D) where G = (V, E) is a (multi-) graph, and D is a mapping that associates each vertex v ∈ V with a set D(v) of FPQ-trees whose leaf set is E(v). Given a planar embedding E of G, we denote by E(v) the cyclic order of edges incident to v in E. An assignment A is a function that assigns to each vertex v ∈ V an FPQ-tree in D(v). We say that A is compatible with G if there exists a planar embedding E of G such that E(v) ∈ consistent(A(v)) for all v ∈ V . In this case, we also say that E is consistent with A. An FPQ-choosable graph (G, D) is FPQ-choosable planar if there exists an assignment of FPQ-trees that is compatible with G. Figure 4(a) shows an FPQ-choosable planar graph G, whose vertices are equipped with the following sets of FPQ-trees: D(u1) = {Tα}, D(u2) = {Tβ, Tγ}, D(u3) = {Tδ}, and D(u4) = {Tε}. There are two possible assignments that differ from one another for the chosen FPQ-tree in the set D(u2). As illustrated in Figures 4(b) and 4(c), the first assignment is compatible with G, while there is no planar embedding that is consistent with the second assignment. The FPQ-Choosable Planarity Testing problem receives as input an FPQ-choosable graph (G, D) and it asks whether (G, D) is FPQ-choosable pla- nar, i.e., it asks whether there exists an assignment that is compatible with G. In the rest of the paper we are going to assume that G is a biconnected (multi-) graph. Clearly G must be planar or else the problem becomes trivial. Also, any assignment that is compatible with G must define a planar embedding of G among those described by an SPQR-decomposition tree of G. Therefore, a preliminary step for an algorithm that tests whether (G, D) is FPQ-choosable planar is to intersect each FPQ-tree Tv ∈ D(v) with the embedding tree T  v of v, so that the cyclic order of the edges incident to v satisfies both the constraints given by Tv and the ones given by T  (See, v . e.g., [26] for details about the operation of intersection between two PQ-trees, whose extension to the case of FPQ-trees is straightforward since F-nodes are just a more constrained version of Q-nodes). Therefore, from now on we shall assume that the FPQ-trees of D have been intersected with the corresponding embedding trees and, for ease of notation, we shall still denote with D(v) the set of FPQ-trees associated with v and resulting from the intersection. We also remove the null-tree, which represents the empty set of permutations, from the sets D(v). Clearly, a necessary condition for the FPQ-choosable planarity of (G, D) is that D(v) is not the empty set for every v ∈ G. 7 (a) (b) (c) Figure 4: (a) An FPQ-choosable planar graph (G, D). (b) A planar embedding of G that is consistent with assignment {A(u1) = Tα, A(u2) = Tγ , A(u3) = Tδ, A(u4) = Tε}; the assignment is compatible with G. (c) A non-planar embedding of G that is consistent with assignment {A(u1) = Tα, A(u2) = Tβ , A(u3) = Tδ, A(u4) = Tε}; there is no planar embedding that is consistent with A. 4. Complexity of FPQ-choosable Planarity Testing As we are going to show, FPQ-Choosable Planarity Testing is fixed- parameter tractable when parameterized by treewidth and number of FPQ-trees per vertex. One may wonder whether the problem remains fixed-parameter tractable if parameterized by the treewidth only or by the number of FPQ- trees per vertex only. The following two theorems answer this question in the negative. Theorem 1. FPQ-Choosable Planarity Testing with a bounded number of FPQ-trees per vertex is NP-complete. It remains NP-complete even when the FPQ-trees have only P-nodes. Proof. We denote with n the number of vertices of the input graph and we assume that for each vertex v of the input, D(v) ∈ O(n). We generate all pos- sible assignments by performing O(n log n) non-deterministic guess operations and, for each assignment, we decide whether it is compatible with the input graph by applying the linear-time algorithm of Gutwenger et al. [12]. It follows that FPQ-Choosable Planarity Testing is in NP. In order to show that FPQ-Choosable Planarity Testing is NP-hard, we use a reduction from the problem of deciding whether a triconnected cubic 8 u2u3u4u1512344634132212515TδTαTεTβTγ656u2u3u4u1512344634132251TδTαTεTγ65665215Tβu2u3u4u1344634132TδTαTε1526 graph admits a 3-edge-coloring. The 3-edge-coloring problem for a cubic graph asks whether it is possible to assign a color in the set {red, green, blue} to each edge of the graph so that no two edges of the same color share a vertex. The problem is known to be NP-complete for triconnected cubic non-planar graphs [27]. Note that a triconnected cubic graph admits a 3-edge-coloring if and only if it admits a 3-edge-coloring for any choice of rotation system and outer face, hence we perform the construction starting from a triconnected cubic graph with an arbitrary choice of rotation system and outer face, which makes it possible to talk about edge crossings in the graph. For any given triconnected cubic graph G we construct an FPQ-choosable graph (G(cid:48), D(cid:48)) with D(v(cid:48)) ≤ 6 for each vertex v(cid:48) of G(cid:48), that is FPQ-choosable planar if and only if G has a 3-edge-coloring. Since every vertex of (G(cid:48), D(cid:48)) is equipped with at most six FPQ-trees, the statement will follow. See Figure 5 for an example. The construction that maps any triconnected cubic graph G into an FPQ- choosable graph (G(cid:48), D(cid:48)) is as follows. Each vertex v of G is associated with a vertex v(cid:48) in G(cid:48), and each edge e = (u, v) of G is associated in G(cid:48) with three parallel edges e1, e2, and e3, whose end-vertices are u(cid:48) and v(cid:48). See for example Figure 6(a) and 6(b). Each crossing c of G(cid:48) is replaced with a dummy vertex vc. Note that every vertex of G(cid:48) has either degree 4 or 9, since we can assume that each crossing is the intersection of exactly two edges (otherwise a small perturbation can be applied). Each vertex vc of G(cid:48) having degree 4 is equipped with one FPQ-tree Tvc consisting of a P-node whose leaves represent the four edges incident to vc. Each vertex v(cid:48) of G(cid:48) having degree 9 is equipped with a set D(cid:48)(v(cid:48)) of FPQ-trees. Each FPQ-tree in D(cid:48)(v(cid:48)) consists of a P-node ρ connected to three Q-nodes χe1 , χe2 , and χe3, which have three leaves each, denoted as , p2 p1 . See for example Figure 6(c), that shows an FPQ-tree of the vertex ei ei v(cid:48) in Figure 6(b). Observe that every FPQ-tree in D(cid:48)(v(cid:48)) can be defined as the union of three trees T1, T2, and T3, such that each Ti consists of node ρ, node χei, and the three leaves of χei (1 ≤ i ≤ 3). For example, T1, T2, and T3 are highlighted in Figure 6(c). Consider a Q-node χei and the cyclic order σi of its incident , p3 If the leaves of Ti appear as p1 in σi, we say that Ti edges in Ti. ei ei , p2 has a red configuration; if they appear as p1 , we say that Ti has a ei ei , p1 green configuration; if they appear as p2 , we say that Ti has a blue ei ei configuration. For example, in Figure 6(c) T1 has a red configuration, T2 has a green configuration, and T3 has a blue configuration. Let e1, e2, and e3 be the three edges incident to a vertex v in the triconnected cubic graph G and let v(cid:48) be its corresponding vertex in (G(cid:48), D(cid:48)). For each 3- edge-coloring of G, there is a bijection between an FPQ-tree Tv(cid:48) in D(cid:48)(v(cid:48)) and the colors of the three edges incident to v. Namely, for a 3-edge-coloring of G where ei is red, we impose a red configuration to Ti in Tv(cid:48); if ei is green, we impose a green configuration to Ti; if ei is blue, we impose a blue configuration to Ti. We say that Ti matches the color of ei and that Tv(cid:48) matches the color of the edges incident to v. For example, the FPQ-tree of Figure 6(c) matches the color of the edges incident to v in Figure 6(a), because T1 matches the color of e1, T2 matches the color of e2 and T3 matches the color of e3. Since there , p2 ei , p3 ei , p3 ei , p3 ei 9 (a) (b) (c) Figure 5: (a) A triconnected cubic non-planar graph G with a proper 3-edge-coloring. (b) The corresponding FPQ-choosable graph (G(cid:48), D(cid:48)); the dummy vertices are black squares, and the FPQ-tree associated with vc is inside a gray circle. D(cid:48)(v(cid:48)) and D(cid:48)(u(cid:48)) are shown in (c). 10 wuvw(cid:48)u(cid:48)v(cid:48)abcdefghijklmnovcppllpdefghibacdefighcbadfegihbacdfeighabcedfgihcbaedfghiabcD(cid:48)(v(cid:48))jklghinmojklighonmjlkgihnmojlkighmnokjlgihonmkjlghimnoD(cid:48)(u(cid:48)) (a) (b) (c) Figure 6: (a) A vertex u of a triconnected cubic graph G and its incident edges e1 = (u, v), e2, and e3. (b) Three parallel edges of G(cid:48) that are associated with edge e1 of G. (c) An FPQ-tree Tu(cid:48) associated with vertex u(cid:48): T1 has a red configuration, T2 has a green configuration, and T3 has a blue configuration. are six possible permutations of the three colors around v in G, we have that D(cid:48)(v(cid:48)) = 6 in (G(cid:48), D(cid:48)). We now prove that if G admits a 3-edge-coloring, (G(cid:48), D(cid:48)) is FPQ-choosable planar. Let v be any vertex of G with incident edges e1, e2, e3, and let v(cid:48) be the vertex that corresponds to v in (G(cid:48), D(cid:48)). We define an assignment A for (G(cid:48), D(cid:48)) where A(v(cid:48)) is the FPQ-tree Tv(cid:48) ∈ D(cid:48)(v(cid:48)) that matches the color of the edges incident to v. For every vertex vc of (G(cid:48), D(cid:48)) of degree 4, A(vc) is the only FPQ-tree associated with vc, hence the cyclic order of the edges around vc is totally free. We show that there exists a planar embedding of G(cid:48) that is consistent with A. Since Tu(cid:48) matches the color of the edges incident to u in G and Tv(cid:48) matches the color of the edges incident to v in G, the leaves of Tu(cid:48) and the leaves of Tv(cid:48) representing the edges (possibly subdivided by dummy vertices) connecting u(cid:48) and v(cid:48) can be ordered so to avoid edge crossings. If, for example, edge e = (u, v) is red in G, we have that Tu(cid:48) has a subtree T (cid:48) and Tv(cid:48) has a subtree T (cid:48)(cid:48) such that both T (cid:48) and T (cid:48)(cid:48) match the red color. The sets of leaves of T (cid:48) and T (cid:48)(cid:48) represent the same set of edges, and they appear in reverse order around u(cid:48) and around v(cid:48) in a planar embedding of G(cid:48). It follows that if G admits a 3-edge-coloring, (G(cid:48), D(cid:48)) is FPQ-choosable planar. Suppose for a converse that (G(cid:48), D(cid:48)) is FPQ-choosable planar. There exists an assignment A that is compatible with G(cid:48). Assignment A defines the cyclic order of the edges incident to each vertex in a planar embedding of G(cid:48). Recall that for any two vertices u(cid:48) and v(cid:48) having degree 9, they are connected by three parallel edges (possibly subdivided by dummy vertices), where e is the edge of G in a bijection with these three edges. Since A is compatible with G(cid:48), the two FPQ-trees Tu(cid:48) = A(u(cid:48)) and Tv(cid:48) = A(v(cid:48)) both contain two subtrees T (cid:48) and T (cid:48)(cid:48) such that: (i) T (cid:48) and T (cid:48)(cid:48) have the same set of three leaves; (ii) these three leaves 11 e1e2e3uve11e12e13u(cid:48)e21e31e32e33v(cid:48)e23e22p1e1p2e1p3e1p1e2p3e2p2e2p1e3p2e3p3e3χe1χe2χe3ρT1T2T3 Figure 7: An FPQ-tree with only P-nodes associated with a vertex of degree 18 in G(cid:48). represent edges of G(cid:48) that correspond to e1, e2, and e3; (iii) T (cid:48) and T (cid:48)(cid:48) have the same red (green, blue) configuration. We color edges e1, e2, and e3 with the red (green, blue) color depending on the color configuration of T (cid:48) and of T (cid:48)(cid:48). By iterating this procedure over all triplets of edges we have that around every vertex of degree 9 in G(cid:48) there are three consecutive triplets of edges such that the edges of each triplet all have the same color and no two triplets have the same color. A 3-edge-coloring of G is therefore obtained by giving every edge e of G the same color as the one of the corresponding triplet e1, e2, and e3 in G(cid:48). It follows that if (G(cid:48), D(cid:48)) is FPQ-choosable planar then G has a 3-edge-coloring. In order to prove that the problem remains NP-complete if the FPQ-trees associated with the vertices have only P-nodes, we construct an FPQ-choosable graph (G(cid:48), D(cid:48)) in a slightly different way from the one described above. In particular, each edge of G is associated with six parallel edges in G(cid:48), and each vertex v(cid:48) having degree 18 in G(cid:48) is equipped with six FPQ-trees as the one in Figure 7. In this case each FPQ-tree associated with a vertex v(cid:48) of G(cid:48) having degree 18 is the union of three trees T1, T2, and T3, such that each of their three pairs of leaves are connected to a P-node, which enforces each pair of leaves to appear consecutively. If Ti (1 ≤ i ≤ 3) has a red configuration, the , p4 ) must be consecutive, as well as the leaves (p3 , p2 two leaves (p1 ), and the ei ei ei ei , p6 ); if Ti has a green configuration the two leaves (p1 leaves (p5 , p6 ) must be ei ei ei ei ), and the leaves (p5 consecutive, as well as the leaves (p3 , p4 , p2 ); if Ti has a ei ei ei ei blue configuration the two leaves (p1 , p4 ) must be consecutive, as well as the ei ei , p2 leaves (p3 ). This guarantees that any two adjacent ei ei vertices u(cid:48) and v(cid:48) of G(cid:48) are such that if Tu(cid:48) and Tv(cid:48) match the same color, there is a cyclic order represented by Tu(cid:48) and Tv(cid:48) such that the edges incident to u(cid:48) and the edges incident to v(cid:48) do not cross. Conversely, if they match different 2 colors these edges must cross. ), and the leaves (p5 ei , p6 ei We remark that Theorem 1 also holds if the number of FPQ-trees per vertex is bounded by a constant larger than six, indeed it is possible to associate each edge of the given triconnected cubic graph G with a suitable number of parallel 12 p1e1p2e1p3e1p4e1p5e1p6e1p1e2p6e2p3e2p2e2p5e2p4e2p1e3p4e3p3e3p6e3p5e3p2e3χe1χe2χe3ρT1T2T3 edges and each vertex of G with a suitable number of FPQ-trees. We now prove that FPQ-Choosable Planarity Testing parameterized by treewidth is W[1]-hard. Theorem 2. FPQ-Choosable Planarity Testing parameterized by treewidth is W[1]-hard. It remains W[1]-hard even when the FPQ-trees have only P-nodes. If h = 0, the triplet e(cid:48) 1, e(cid:48) 2, e(cid:48) 1, e(cid:48) 2, e(cid:48) 2, and e(cid:48) 3 is labeled with no color. Proof. We use a parameterized reduction from the list coloring problem, which is defined as follows. Given a graph G = (V, E) and a set L containing a list L(v) of colors for each vertex v ∈ V , is there a proper vertex coloring with c(v) ∈ L(v) for each v? We denote as c(v) the color of v in a proper vertex coloring. The list coloring problem parameterized by treewidth is known to be W[1]-hard even for planar graphs [28, Theorem 14.29]. For any given instance (G, L) of list coloring such that G is a planar graph whose treewidth is at most t, we construct an FPQ-choosable graph (G(cid:48), D(cid:48)) that is FPQ-choosable planar if and only if (G, L) is a yes instance of list coloring. Note that (G, L) is a yes instance of list coloring if and only if it is a yes instance for any planar embedding of G, hence we perform the reduction to FPQ-Choosable Planarity Testing starting from any instance (G, L) with an arbitrary planar embedding of G. Starting from a planar embedding of graph G, we construct a planarly embedded multi-graph G(cid:48) by replacing each edge of G with bundles of edges as follows. Also refer to Figure 8. Each vertex v of G becomes vertex v(cid:48) in G(cid:48), and each edge e = (u, v) of G 3 in G(cid:48). Let h = L(u) ∩ L(v) in is split into three parallel edges e(cid:48) 1, e(cid:48) (G, L). If h = 1 the triplet e(cid:48) 3 is labeled with the color in common between u and v. If h > 1, we create 3(h − 1) additional parallel edges in G(cid:48) between u(cid:48) and v(cid:48), and we label each of the 3h triplets of edges with one of the colors shared by u and v. Observe that G(cid:48) is a planar multi-graph with a given planar embedding and its treewidth is the same as the treewidth of G. We construct the set D(cid:48) of FPQ-trees associated with the vertices of G(cid:48) starting from the set L of colors associated with the vertices of G as follows. Let v be a vertex of G, let L(v) be its color list, and let v(cid:48) be the corresponding vertex in G(cid:48). Denote as deg(v(cid:48)) the degree of v(cid:48) in G(cid:48). We equip v(cid:48) in G(cid:48) with L(v) FPQ-trees, each encoding a color of L(v) in (G, L); we denote as Tc(v(cid:48)) the FPQ-tree associated with v(cid:48) in G(cid:48) and encoding color c ∈ L(v). Let k = deg(v(cid:48))/3 (note that k is a positive integer since deg(v(cid:48)) mod 3 = 0). If k = 1, deg(v) = 1 in G, and there is at most one color c such that c ∈ L(u)∩L(v), where u is the neighbor of v in G. Each FPQ-tree Tc(v(cid:48)) consists of a node ρ whose leaves represent the triplet of edges incident to v(cid:48). Node ρ is a Q-node if v shares color c with its neighbor, otherwise ρ is a P-node (observe that there are at least L(v)− 1 FPQ-trees associated with v(cid:48) with the same set of nodes). For example, in Figure 8(c), for vertex z(cid:48) we have k = 1; the triplet of edges incident to z(cid:48) is labeled with color 3, and the FPQ-tree T3(z(cid:48)) consists of a node ρ with three leaves. Node ρ is a Q-node because color 3 ∈ L(z) ∩ L(z) in G. If k > 1, each FPQ-tree of D(cid:48)(v(cid:48)) consists of a P-node ρ connected to k nodes ν1, . . . , νk having three leaves each. The leaves of each νi (1 ≤ i ≤ k) represent a 13 (a) (b) (c) Illustration of the reduction from list coloring to FPQ-Choosable Planarity Figure 8: Testing. (a) An instance (G, L) of list coloring. The circled colors indicate a valid coloring of G. (b) The corresponding FPQ-choosable graph (G(cid:48), D(cid:48)); some FPQ-trees of D(cid:48) are shown in (c). 14 wuvz12345671122233344455566772zw(cid:48)u(cid:48)v(cid:48)fedghijklpqrstαγbaz(cid:48)mno1222344567z(cid:48)sαD(cid:48)(u(cid:48))D(cid:48)(v(cid:48))prqghiprqghiprqghistαsαpqrstαpqrstαD(cid:48)(w(cid:48))fdeihglkjbγfdeiglkjabγahfdeiglkjbγahD(cid:48)(z(cid:48))onm132254312ρν1ν2ν3tt 2, e(cid:48) 1, e(cid:48) triplet e(cid:48) 3 of edges connecting v(cid:48) to some other vertex u(cid:48) of G(cid:48); this triplet either encodes a color in L(v) ∩ L(u) or it encodes no color if L(v) ∩ L(u) = ∅. Also, if the color c associated with Tc(v(cid:48)) is such that c ∈ L(v)∩ L(u), node νi is a Q-node; it is a P-node otherwise. For example, in Figure 8(c) we have k > 1 for vertex v(cid:48). The FPQ-tree T1(v(cid:48)) encodes the color 1 of L(v); v(cid:48) has three triplets of incident edges and node ρ of T1(v(cid:48)) has three children whose leaves represent these three triplets. Since color 1 belongs to both L(u) and L(v) in Figure 8(a), the node ν1 of T1(v(cid:48)) whose leaves represent the triplet of edges p, q, r of G(cid:48) is a Q-node. Conversely, the nodes ν2 and ν3 of T1(v(cid:48)) associated with the triplets labeled with colors 2 and 3 of L(v) are P-nodes. Note that D(cid:48)(v(cid:48)) = L(v) for each vertex v of G and each vertex v(cid:48) of G(cid:48), thus we have that the size of (G(cid:48), D(cid:48)) is polynomial in the size of (G, L). We now prove that (G, L) admits a proper vertex coloring with c(v) ∈ L(v) for each v if and only if (G(cid:48), D(cid:48)) is FPQ-choosable planar. Suppose first that (G, L) admits a proper vertex coloring. Let v be any vertex of G, let c(v) be the chosen color for v, and let v(cid:48) be the image of v in (G(cid:48), D(cid:48)). Assignment A for (G(cid:48), D(cid:48)) is defined such that A(v(cid:48)) = Tc(v)(v(cid:48)). We show that there exists a planar embedding of G(cid:48) that is consistent with A. Since any pair of adjacent vertices u and v in G is such that c(u) (cid:54)= c(v), the two FPQ-trees A(u(cid:48)) = Tc(u)(u(cid:48)) and A(v(cid:48)) = Tc(v)(v(cid:48)) contain pairs of nodes whose leaves correspond to triplets of edges connecting u(cid:48) and v(cid:48). Each of these triplets are connected to a P-node either in A(u(cid:48)) or in A(v(cid:48)) (or in both), hence they can be ordered so to avoid edge crossings in G(cid:48). It follows that if (G, L) is a yes instance of list coloring, then (G(cid:48), D(cid:48)) is FPQ-choosable planar. Suppose now that (G(cid:48), D(cid:48)) is FPQ-choosable planar. There exists an assign- ment A that defines the cyclic order of the edges incident to each vertex in a planar embedding of G(cid:48). Let u(cid:48) and v(cid:48) be any two adjacent vertices of G(cid:48). FPQ- trees A(v(cid:48)) = Tc1(v(cid:48)) and A(u(cid:48)) = Tc2(u(cid:48)) are such that the edges represented by their leaves can be drawn in G(cid:48) without crossings, hence they correspond to different colors c1 and c2 for v and u, and thus c(v) (cid:54)= c(u). It follows that if (G(cid:48), D(cid:48)) is FPQ-choosable planar, then (G, L) is a yes instance of list color- ing. It follows that FPQ-Choosable Planarity Testing parameterized by treewidth is W[1]-hard. The proof that the problem remains W[1]-hard even if the FPQ-trees asso- ciated with the vertices have only P-nodes is a slight variant of the argument above. Namely, we construct an FPQ-choosable graph (G(cid:48), D(cid:48)) such that each vertex v of G becomes vertex v(cid:48) in G(cid:48), and each edge e = (u, v) of G is split into 6-tuples of parallel edges in G(cid:48). If h = L(u) ∩ L(v) = 0, the six paral- lel edges between u and v are labeled with no color. If h = 1 the 6-tuple of parallel edges is labeled with the color in common between u and v. If h > 1, we create 6(h − 1) additional parallel edges between u(cid:48) and v(cid:48). Similarly tothe previous case, we label each of these 6-tuples of edges with one of the colors in L(u) ∩ L(v). Each vertex v(cid:48) in G(cid:48) is equipped with L(v) FPQ-trees, each encoding a color of L(v). If k = deg(v(cid:48))/6 = 1, each FPQ-tree Tc(v(cid:48)) consists of a P-node ρ connected to three P-nodes whose leaves represent the six edges incident to v(cid:48); see for example Figure 9(c). If k > 1 each FPQ-tree associated 15 (a) (b) (c) (d) Figure 9: (a) An edge (u, v) of an instance of list coloring. (b) The corresponding FPQ- choosable graph. (c) The FPQ-tree T2(u(cid:48)) of D(cid:48)(u(cid:48)) associated with color 2. (d) The FPQ-tree T2(v(cid:48)) of D(cid:48)(v(cid:48)) associated with color 2. Note that they contain only P-nodes. with vertex v(cid:48) of G(cid:48) consists of a P-node ρ connected to k P-nodes ν1, . . . , νk, each of which is connected to three P-nodes. Each of these three P-nodes has two leaves; see for example Figure 9(d). If v shares a color c with an adjacent vertex u, the FPQ-tree Tc(v(cid:48)) contains a P-node νl (1 ≤ l ≤ k) whose leaves represent the 6-tuple of edges connecting v(cid:48) with u(cid:48) that is labeled with color c. Each of these three pairs of leaves is connected to a P-node, which enforces each pair of leaves to appear consecutively. In particular, in Tc(v(cid:48)) the two leaves i ), and the leaves (e5 i ) must be consecutive, as well as the leaves (e3 i , e2 (e1 i , e6 i ) (1 ≤ i ≤ deg(v)), while in Tc(u(cid:48)) the two leaves (e5 j ) must be consecutive, as j ) (1 ≤ j ≤ deg(u)). This guaran- well as the leaves (e3 tees that two adjacent vertices v(cid:48) and u(cid:48) of G(cid:48) are such that if their FPQ-trees encode the same color c1, the edges incident to v(cid:48) and the edges incident to u(cid:48) must respect cyclic orders that do not allow to connect them without edge crossings. On the other hand, in an FPQ-tree Tc2(u(cid:48)) encoding a color c2 dif- ferent from c1, the pairs of leaves that must be consecutive are the same as the ones of Tc1(v(cid:48)), which allows to connect the corresponding edges of G(cid:48) without edge crossings. By this argument, we can conclude that the FPQ-Choosable Planarity Testing is W[1]-hard even if the FPQ-trees associated with the 2 vertices have only P-nodes. j ), and the leaves (e1 i , e4 j , e2 j , e6 j , e4 The results of this section imply the following. Corollary 1. FPQ-Choosable Planarity Testing is not fixed-parameter tractable if parameterized by treewidth only or by the number of FPQ-trees per vertex only. It remains fixed-parameter tractable even if the FPQ-trees consist of P-nodes. 16 ue1v122e2e11u(cid:48)e21e31v(cid:48)e41e51e61e12e22e32e42e52e62e51e41e21e31e61e112ρT2(u(cid:48))e11e61e21e31e41e51e52e42e22e32e62e122ρν1ν2T2(v(cid:48)) Figure 10: Illustration for the proof of Lemma 1. 5. Fixed Parameter Tractability of FPQ-choosable Planarity Testing This section is organized as follows. We first introduce the notions of bound- aries and of extensible orders, and state two technical lemmas. Next, we de- fine the concepts of pertinent FPQ-tree, skeletal FPQ-tree and admissible tu- ple, which are fundamental in the algorithm description. Finally, we present a polynomial-time testing algorithm for FPQ-choosable graphs having bounded branchwidth and such that the number of FPQ-trees associated with each ver- tex is bounded by a constant. Note that, if a graph has bounded branchwidth b it has treewidth at most(cid:4) 3 2 b(cid:5) − 1 [29]. Boundaries and Extensible Orders: Let T be an FPQ-tree, let yield(T ) denote the set of its leaves, and let L be a proper subset of yield(T ). We denote by σ a cyclic order of the leaves of an FPQ-tree, and we say that σ ∈ consistent(T ) if the FPQ-tree T represents σ. We say that L is a consecutive set if the leaves in L are consecutive in every cyclic order represented by T . Let e be an edge of T , and let T (cid:48) and T (cid:48)(cid:48) be the two subtrees obtained by removing e from T . If either yield(T (cid:48)) or yield(T (cid:48)(cid:48)) are a subset of a consecutive set L, then we say that e is a split edge of L. The subtree that contains the leaves in L is the split subtree of e. A split edge e is maximal if there exists no split edge e(cid:48) such that the split subtree of e(cid:48) contains e. Lemma 1. Let T be an FPQ-tree, let L be a consecutive proper subset of yield(T ), and let S be the set of maximal split edges of L. Then either S = 1, or S > 1 and there exists a Q-node (or an F-node) χ of T such that χ has degree at least S + 2 and the elements of S appear consecutive around χ. Proof. Assume that S > 1. Let e and f be two maximal split edges of L, and let Te and Tf be the split subtrees of e and f , respectively. Let further χe denote the endpoint of e that is not in Te. The endpoint χf is defined likewise. Refer to Figure 10 for an illustration. Suppose for the sake of contradiction that χe and χf are distinct. Let g denote the first edge on the path from χe to χf . By the maximality of e and f , the edge g is not a split edge. It follows that there is an edge e(cid:48) incident to χe that is different from g and that is not a split edge. Likewise, we find an edge f(cid:48) incident to χf that is different from the first edge on the path from χf to χe and that is not a split edge. But then g is an edge of a tree T such that one of the two subtrees it separates has leaves in L and leaves that are not in L. It 17 χeχffegTeTfLL¬L¬L follows that L is not a consecutive set. This is a contradiction to the assumption that χe and χf are distinct. It follows that the edges in S are all incident to a single vertex χ. If χ has degree S, then L is not a proper subset of the leaves, and if it has degree S+1, then also its remaining edge is a split edge, which contradicts the maximality of the split edges in S. Hence deg(χ) ≥ S + 2. If χ were a P-node, this would 2 contradict the assumption that L is a consecutive set. If S = 1, the split edge in S is called the boundary of L. If S > 1, the Q-node (or the F-node) χ defined in the statement of Lemma 1 is the boundary of L. Since F-nodes are a more constrained version of Q-nodes, when we refer to boundary Q-nodes we also take into account the case in which they are F- nodes. Figure 11(a) shows an FPQ-choosable graph (G, D) and two FPQ-trees Tu ∈ D(u) and Tv ∈ D(v). The three red edges b, c, and d of G define a consecutive set Lu in Tu; the edges e and f define a consecutive set Lv in Tv. The boundary of Lu in Tu is a Q-node, while the boundary of Lu in Tu is an edge. We denote as B(L) the boundary of a set of leaves L. If B(L) is a Q- node, we associate B(L) with a default orientation (i.e., a flip) that arbitrarily defines one of the two possible permutations of its children. We call this default orientation the clockwise orientation of B(L). The other possible permutation of the children of B(L) corresponds to the counter-clockwise orientation. Let L(cid:48) = L ∪ {(cid:96)}, where (cid:96) is a new element. Let σ ∈ consistent(T ), and let σL(cid:48) be a cyclic order obtained from σ by replacing the elements of the consecutive set yield(T )\L by the single element (cid:96). We say that a cyclic order σ(cid:48) of L(cid:48) is extensible if there exists a cyclic order σ ∈ consistent(T ) with σL(cid:48) = σ(cid:48). In this case, we say that σ is an extension of σ(cid:48). Note that if the boundary of L is a Q-node χ, then any two extensions of σ(cid:48) induce the same clockwise or counter-clockwise orientation of the edges incident to χ. An extensible order σ is clockwise if the orientation of χ is clockwise; σ is counter-clockwise otherwise. If the boundary of L is an edge, we consider any extensible order as both clockwise and counter-clockwise. Let L and L be two disjoint consecutive sets of leaves that have the same boundary Q-node χ in T . Let σ and σ be two extensible orders of L and L, respectively. We say that σ and σ are incompatible if one of them is clockwise and the other one is counter-clockwise. Lemma 2. Let T be an FPQ-tree, let L1 ∪ ··· ∪ Lk be a partition of yield(T ) into consecutive sets, and let σ1, . . . , σk be extensible orders of L1, . . . , Lk. There exists an order Σ of yield(T ) represented by T such that ΣLi = σi if and only if no pair σi, σj (1 ≤ i, j ≤ k) is incompatible. Proof. The only-if direction is clear. For the if-direction, assume that no pair is incompatible. Note that, since Li is consecutive, so is yield(T ) \ Li. We denote by Ti the subtree of T that is obtained by replacing the consecutive set yield(T ) \ Li by a single leaf (cid:96). Note that Ti (1 ≤ i ≤ k) is a subtree of T and the set {T1, . . . , Tk} forms a partition of the edges of T . Observe that σi 18 (a) (b) (c) Figure 11: (a) Two different types of boundaries: A boundary Q-node in Tu and a boundary edge in Tv. (c) The skeletal FPQ-trees Skelµ(Tu) of Pertµ(Tu) and Skelµ(Tv) of Pertµ(Tv). (b) The pertinent FPQ-trees Pertµ(Tu) of Tu and Pertµ(Tv) of Tv. defines a cyclic order of the edges around each node of Ti. Moreover, if Ti and Tj overlap, then they do so in the boundary of Li and Lj, which must hence be a Q-node χ. Since no pair is incompatible, it follows that they induce the same cyclic order Σ of the edges around χ. Thus, together the σi determine a unique order in consistent(T ) such that ΣLi = σi. 2 Pertinent FPQ-trees, Skeletal FPQ-trees, and Admissible Tuples: Let (G, D) be an FPQ-choosable graph, let T be an SPQR-decomposition tree of G and let v be a pole of a node µ of T , let Tv ∈ D(v) be an FPQ-tree associated with v, let Eext be the set of edges that are incident to v and not contained in µ(v) = E(v) \ Eext. Note that there is a bijection between the Gµ, and let E(cid:63) edges E(v) of G and the leaves of Tv, hence we shall refer to the set of leaves of Tv as E(v). Also note that E(cid:63) µ(v) is represented by a consecutive set of leaves in Tv, because in every planar embedding of G the edges in E(cid:63) µ(v) must appear consecutively in the cyclic order of the edges incident to v. The pertinent FPQ-tree of Tv, denoted as Pertµ(Tv), is the FPQ-tree ob- tained from Tv by replacing the consecutive set Eext with a single leaf (cid:96). In- formally, the pertinent FPQ-tree of v describes the hierarchical embedding con- straints for the pole v within the pertinent graph Gµ. For example, in Fig- ure 11(b) a pertinent graph Gµ with poles u and v is highlighted by a shaded region; the pertinent FPQ-tree Pertµ(Tu) of Tu and the pertinent FPQ-tree 19 kdabcefuvboundaryboundaryTughijhgTvijkqmnopkabcdqoppafemnpkdabcefuvabcdghija(cid:96)fekqmnopkqopmn(cid:96)Pertµ(Tu)Pertµ(Tv)Gµ(cid:96)1(cid:96)(cid:96)2(cid:96)3Skelµ(Tu)(cid:96)2(cid:96)(cid:96)1(cid:96)3Skelµ(Tv) νi Pertµ(Tv) of Tv are obtained by the FPQ-trees Tu and Tv of Figure 11(a). Let ν1, . . . , νk be the children of µ in T . Observe that the edges E(cid:63) (v) of each Gνi (1 ≤ i ≤ k) form a consecutive set of leaves of Aµ(v) = Pertµ(Tv). The skeletal FPQ-tree of Pertµ(Tv), denoted by Skelµ(Tv), is the tree obtained (v) (1 ≤ i ≤ k) by from Pertµ(Tv) by replacing each of the consecutive sets E(cid:63) νi a single leaf (cid:96)i. See for example, Figure 11(c). Observe that each Q-node of Skelµ(Tu) corresponds to a Q-node of Pertµ(Tu), and thus to a Q-node of Tu; also, distinct Q-nodes of Skelµ(Tu) correspond to distinct Q-nodes of Pertµ(Tu), and thus to distinct Q-nodes of Tu. For each Q-node χ of Tu that is a boundary of µ or of one of its children νi, there is a corresponding Q-node in Skelµ(Tu) that inherits its default orientation from Tu. Let (G, D) be an FPQ-choosable graph, let T be an SPQR-decomposition tree of G, let µ be a node of T , and let u and v be the poles of µ. We denote with (Gµ, Dµ) the FPQ-choosable graph consisting of the pertinent graph Gµ and the set Dµ that is defined as follows: Dµ(z) = D(z) for each vertex z of Gµ that is not a pole, and Dµ(v) = {Pertµ(Tv) Tv ∈ D(v)} if v is a pole of µ. A tuple (cid:104)Tu, Tv, ou, ov(cid:105) ∈ D(u) × D(v) × {0, 1} × {0, 1} is admissible for Gµ if there exists an assignment Aµ of (Gµ, Dµ) and a planar embedding Eµ of Gµ consistent with Aµ such that Aµ(u) = Pertµ(Tu), Aµ(v) = Pertµ(Tv), B(E(cid:63) µ(u)) is clockwise (counter-clockwise) in Tu if ou = 0 (ou = 1), and B(E(cid:63) µ(v)) is clockwise (counter-clockwise) in Tv if ov = 0 (ov = 1). We say that a tuple is admissible for µ if it is admissible for Gµ. We denote by Ψ(µ) the set of admissible tuples for Gµ. FPT Algorithm: In order to test if (G, D) is FPQ-choosable planar, we root the SPQR-decomposition tree T at an arbitrary Q-node and we visit T from the leaves to the root. At each step of the visit, we equip the currently visited node µ with the set Ψ(µ). If we encounter a node µ such that Ψ(µ) = ∅, we return that (G, D) is not FPQ-choosable planar; otherwise the planarity test returns an affirmative answer. If the currently visited node µ is a leaf of T , we set Ψ(µ) = D(u)× D(v)×{0, 1}×{0, 1}, because its pertinent graph is a single edge. If µ is an internal node, Ψ(µ) is computed from the sets of admissible tuples of the children of µ. The next lemmas describe how to compute Ψ(µ) depending on whether µ is an S-, P-, or R-node. Lemma 3. Let µ be an S-node with children ν1 and ν2. Given Ψ(ν1) and Ψ(ν2), the set Ψ(µ) can be computed in O(D2 max log(Dmax)) time, where Dmax = maxv∈V D(v). Proof. Let u and v be the poles of µ, and let w be the pole in common between Gν1 and Gν2 . We show that (cid:104)Tu, Tv, ou, ov(cid:105) ∈ Ψ(µ) if and only if there exist a tree Tw ∈ D(w) and an ow ∈ {0, 1}, such that (cid:104)Tu, Tw, ou, ow(cid:105) ∈ Ψ(ν1) and (cid:104)Tw, Tv, ow, ov(cid:105) ∈ Ψ(ν2). If (cid:104)Tu, Tv, ou, ov(cid:105) ∈ Ψ(µ), then there exist an assignment Aµ of (Gµ, Dµ) and a planar embedding Eµ of Gµ consistent with Aµ such that Aµ(u) = Pertµ(Tu), Aµ(v) = Pertµ(Tv), B(E(cid:63) µ(u)) is clockwise (counter-clockwise) in Tu if ou = 0 (ou = 1), and B(E(cid:63) µ(v)) is clockwise (counter-clockwise) in Tv if ov = 0 (ov = 1). 20 ν1 ν1 ν1 ν1 ν1 ν2 (w) and E(cid:63) ν2 (w)) and B(E(cid:63) Let Eν1 and Eν2 be the embeddings of Gν1 and Gν2 induced by Eµ, respectively, and let Tw = Aµ(w). Observe that E(cid:63) (w) are disjoint consecutive sets of Tw sharing the same boundary in Tw. Also, observe that Eµ(w) is an ν1 extension of both Eν1(w) and Eν2 (w). By Lemma 2, Eν1 (w) and Eν2(w) are not incompatible, and hence B(E(cid:63) (w)) are both clockwise or both counter-clockwise. We set ow = 0 if they are both clockwise, and ow = 1 otherwise. For every vertex x of Gν1 different from w, we set Aν1(x) = Aµ(x); for w we set Aν1(w) = Pertν1(Tw). Since Eν1 is consistent with Aν1 and Eν1(u) = Eµ(u), B(E(cid:63) (u)) is clockwise (counter-clockwise) in Tu if ou = 0 (if ou = 1). By observing that B(E(cid:63) (w)) is clockwise (counter-clockwise) if ow = 0 (if ow = 1), we have that (cid:104)Tu, Tw, ou, ow(cid:105) ∈ Ψ(ν1). The same argument can be used to show that (cid:104)Tu, Tw, ou, ow(cid:105) ∈ Ψ(ν2). It follows that if (cid:104)Tu, Tv, ou, ov(cid:105) ∈ Ψ(µ), there exist a tree Tw ∈ D(w) and an ow ∈ {0, 1} such that (cid:104)Tu, Tw, ou, ow(cid:105) ∈ Ψ(ν1) and (cid:104)Tw, Tv, ow, ov(cid:105) ∈ Ψ(ν2). For the converse, assume that there exist a tree Tw ∈ D(w) and an ow ∈ {0, 1}, such that θ1 = (cid:104)Tu, Tw, ou, ow(cid:105) ∈ Ψ(ν1) and θ2 = (cid:104)Tw, Tv, ow, ov(cid:105) ∈ Ψ(ν2). By definition, there exist assignments Aν1 and Aν2 of (Gν1, Dν1 ) and (Gν2, Dν2) respectively, and two planar embeddings Eν1 and Eν2 that are consis- tent with Aν1 and Aν2 respectively, such that Aν1(u) = Pertν1 (Tu), Aν1(w) = Pertν1(Tw), B(E(cid:63) (u)) is clockwise (counter-clockwise) in Tu if ou = 0 (ou = 1), B(E(cid:63) (w)) is clockwise (counter-clockwise) in Tw if ow = 0 (ow = 1), Aν2(w) = Pertν2(Tw), Aν2 (v) = Pertν2 (Tv), B(E(cid:63) (w)) is clockwise (counter-clockwise) in Tw if ow = 0 (ow = 1), and B(E(cid:63) (v)) is clockwise (counter-clockwise) in Tv if ov = 0 (ov = 1). We define an assignment Aµ and a planar embedding Eµ of Gµ consistent with Aµ such that Aµ(u) = Pertµ(Tu), Aµ(v) = Pertµ(Tv), B(E(cid:63) µ(u)) is clockwise (counter-clockwise) in Tu if ou = 0 (ou = 1), and B(E(cid:63) µ(v)) is clockwise (counter-clockwise) in Tv if ov = 0 (ov = 1). Embedding Eµ of Gµ is obtained by merging Eν1 and Eν2 as follows. For every vertex x of Gν1 dif- ferent from w, we set Eµ(x) = Eν1(x), for every vertex y of Gν2 different from w, we set Eµ(y) = Eν2(y). For w, since ow has the same value in θ1 and in θ2, hence B(E(cid:63) (w)) are not incompatible. By Lemma 2, there exists an order of the leaves of Tw that is an extension of both Eν1(w) and Eν2 (w): Let Eµ(w) be this order. Assignment Aµ for (Gµ, Dµ) is defined as follows. For every vertex x of Gν1 different from w, we set Aµ(x) = Aν1(x); for every vertex y of Gν2 different from w, we set Aµ(y) = Aν2 (y); for w we set Aµ(w) = Tw. Since Eµ is consistent with Aµ, Eµ(u) = Eν1 (u), and Eµ(v) = Eν2(v), B(E(cid:63) µ(u)) is clockwise (counter-clockwise) in Tu if ou = 0 (if ou = 1), and B(E(cid:63) µ(v)) is clockwise (counter-clockwise) in Tv if ov = 0. Fur- thermore, since E(cid:63) µ(v), Aµ(u) = Pertµ(Tu) and It follows that if there exist a tree Tw ∈ D(w) and an ν1 Aµ(v) = Pertµ(Tv). ow ∈ {0, 1} such that (cid:104)Tu, Tw, ou, ow(cid:105) ∈ Ψ(ν1) and (cid:104)Tu, Tw, ou, ow(cid:105) ∈ Ψ(ν2), then (cid:104)Tu, Tv, ou, ov(cid:105) ∈ Ψ(µ). Set Ψ(µ) is computed from Ψ(ν1) and Ψ(ν2) by looking for pairs of tuples (cid:104)Tu, Tw, ou, ow(cid:105) ∈ Ψ(ν1), (cid:104)Tw, Tv, ow, ov(cid:105) ∈ Ψ(ν2) sharing the same Tw and the same value of ow. By ordering Ψ(ν1) and Ψ(ν2), Ψ(µ) is computed in O(D2 2 (w)) and B(E(cid:63) (u) = E(cid:63) µ(u) and E(cid:63) ν2 (v) = E(cid:63) ν1 ν2 ν2 ν2 max log(Dmax)) time. 21 Lemma 4. Let µ be a P-node with children ν1, ν2, . . . , νk. Given Ψ(ν1), Ψ(ν2), max · n) time, where Dmax = . . . , Ψ(νk), the set Ψ(µ) can be computed in O(D2 maxv∈V D(v). Proof. Let u and v be the poles of µ. Let Skelµ(Tu) and Skelµ(Tv) be the skeletal FPQ-trees of Pertµ(Tu) and of Pertµ(Tv), respectively. It can be proved that a tuple (cid:104)Tu, Tv, ou, ov(cid:105) ∈ Ψ(µ) if and only if the following two conditions are satisfied: (i) There exists a planar embedding Eµ of skel(µ) and a pair of skeletal FPQ-trees Skelµ(Tu) and Skelµ(Tv) such that Eµ(u) ∈ consistent(Skelµ(Tu)) and Eµ(v) ∈ consistent(Skelµ(Tv)); (ii) For each child νi of µ (1 ≤ i ≤ k), there exist an orientation ou of B(E(cid:63) (v)) such that (cid:104)Tu, Tv, ou, ov(cid:105) ∈ Ψ(νi). (u)) and an orientation ov of B(E(cid:63) νi νi Let u and v be the poles of µ. Let Skelµ(Tu) and Skelµ(Tv) be the skeletal FPQ-trees of Pertµ(Tu) and of Pertµ(Tv), respectively. We first show that a tuple (cid:104)Tu, Tv, ou, ov(cid:105) ∈ Ψ(µ) if and only if the following two conditions are satisfied: (i) There exists a planar embedding Eµ of skel(µ) and a pair of skeletal FPQ- trees Skelµ(Tu) and Skelµ(Tv) such that Eµ(u) ∈ consistent(Skelµ(Tu)) and Eµ(v) ∈ consistent(Skelµ(Tv)); (ii) For each child νi of µ (1 ≤ i ≤ k), there exist an orientation ou of B(E(cid:63) (v)) such that (cid:104)Tu, Tv, ou, ov(cid:105) ∈ Ψ(νi). and an orientation ov of B(E(cid:63) νi νi (u)) νi If (cid:104)Tu, Tv, ou, ov(cid:105) ∈ Ψ(µ), then there exist an assignment Aµ of (Gµ, Dµ) and a planar embedding Eµ of Gµ consistent with Aµ. Let Skelµ(Tu) and Skelµ(Tv) be the skeletal FPQ-trees obtained from Aµ(u) and from Aµ(v), respectively. By definition of skeletal FPQ-tree, the planar embedding Eµ and the pair of skeletal FPQ-trees Skelµ(Tu) and Skelµ(Tv) satisfy Condition (i). Let Eνi be the embedding of Gνi induced by Eµ (1 ≤ i ≤ k). E(cid:63) (u) is a consecutive set (v) is a consecutive set of Pertµ(Tv). Note that Eµ(u) of Pertµ(Tu) and E(cid:63) is an extension of Eνi(u) and that Eµ(v) is an extension of Eνi(v). We can νi therefore define an assignment Aνi for (Gνi, Dνi) as follows: For every vertex w of Gνi different from the poles of Gνi, we set Aνi(w) = Aµ(w); for the poles of Gνi we set Aνi(u) = Pertνi(Tu) and Aνi (v) = Pertνi(Tv). Note that Eνi is consistent with Aνi . Thus, there exist values ou ∈ {0, 1} and ov ∈ {0, 1} such that (cid:104)Tu, Tv, ou, ov(cid:105) ∈ Ψ(νi) and hence Condition (ii) is satisfied. It follows that if (cid:104)Tu, Tv, ou, ov(cid:105) ∈ Ψ(µ), both Condition (i) and Condition (ii) are satisfied. Suppose now that Condition (i) and Condition (ii) are satisfied. By Condi- tion (i), the planar embedding Eµ and the pair of skeletal FPQ-trees Skelµ(Tu) and Skelµ(Tv) describe how to arrange the children around u and v in a planar embedding of skel(µ), since the union of all E(cid:63) µ(u) and µ(v) (1 ≤ i ≤ k). By Condition (ii) νi the union of all E(cid:63) there exist an assignment Aνi of (Gνi, Dνi) and a planar embedding Eνi that is νi consistent with Aνi . A planar embedding Eµ of Gµ is obtained by merging all the Eνi. More precisely, for every vertex w of Gνi different from the poles, we set Eµ(w) = Eνi(w). Concerning the poles u and v, observe that there exists (u) coincides with E(cid:63) (v) coincides with E(cid:63) 22 an order of the leaves of Tu that is a common extension of all Eνi(u), and an order of the leaves of Tv that is a common extension of all Eνi (v): Let Eµ(u) and Eµ(v) be these orders. Also, for every vertex w of Gνi different from u and v, we set Aµ(w) = Aνi(w). For the poles u and v we set Aµ(u) = Pertµ(Tu) and Aµ(v) = Pertµ(Tv), respectively. Thus obtaining an embedding Eµ that is consistent with Aµ. It follows that if Condition (i) and Condition (ii) are satisfied, then (cid:104)Tu, Tv, ou, ov(cid:105) ∈ Ψ(µ). We test these conditions by solving a 2SAT problem. We create a Boolean variable xχ for each boundary Q-node χ of either Skelµ(Tu) or Skelµ(Tv) that encodes the orientation of χ as clockwise or counter-clockwise. For ease of notation, we also define xχ when χ is not a Q-node but an edge. In this case, we simply treat this as a placeholder for true, i.e., both xχ and ¬xχ are true. In the following, we identify the Q-nodes of Skelµ(Tu) with the Q-nodes of Tu they correspond to. We claim that the two conditions can be encoded as 2SAT formulas over the variables xχ. Concerning Condition (i), we note that we seek for an ordering σ of the virtual edges such that σ ∈ consistent(skelµ(Tu)) and its reversal σr satisfies σr ∈ consistent(skelµ(Tv)). This can be modeled as an instances of Simulta- neous PQ-Ordering [26] that has two nodes skelµ(Tu) and skelµ(Tv) and a reversing arc (skelµ(Tu), skelµ(Tv)) with the identity as mapping. Then the so- lutions to this instance are exactly the pairs of circular orderings represented by the respective trees that are the reversal of each other. The existence of a cor- responding 2SAT formula that describes the constraints on the orientations of the Q-nodes then follows immediately from the work of Blasius and Rutter [26, Lemma 4], who refer to these formulas as Q-constraints. Concerning Condition (ii), consider a child νi and let χ and χ(cid:48) denote the boundaries of νi in Tu and Tv, respectively. Observe that the subset of val- ues (oχ, oχ(cid:48)) ∈ {0, 1}2 for which (cid:104)Tu, Tv, oχ, oχ(cid:48)(cid:105) ∈ Ψ(νi) is a subset of {0, 1}2, and it can hence be encoded as the satisfying assignments of a 2SAT formula ϕi over variables xχ and xχ(cid:48). Let now χ and χ(cid:48) denote the boundaries of µ in Tu and Tv, respectively. It follows that (cid:104)Tu, Tv, ou, ov(cid:105) ∈ Ψ(µ) if and only if there i=1 ϕi such that xχ = ou and xχ(cid:48) = ov. These values of ou and ov can be computed by using a linear-time 2SAT algo- rithm. Since the number of virtual edges is O(n), so is the number of Q-nodes, and therefore the number of variables. Therefore, for each pair of trees (Tu, Tv) the 2SAT formula can be constructed and solved in O(n) time. This implies the 2 time complexity in the statement. exists a satisfying assignment of ϕµ ∧(cid:86)h Lemma 5. Let µ be an R-node with children ν1, ν2, . . . , νk. Given Ψ(ν1), Ψ(ν2), µ) time, where . . . Ψ(νk), the set Ψ(µ) can be computed in O(D Dmax = maxv∈V D(v), b is the branchwidth of Gµ, and nµ is the number of vertices of Gµ. max · n2 3 2 b µ + n3 Proof. Since µ is an R-node, skel(µ) has only two possible planar embeddings. Let u and v be the poles of µ. Let νi (1 ≤ i ≤ k) be a child of µ that corre- sponds to a virtual edge (x, y) of T and let Tx ∈ Dµ(x). Recall that E(cid:63) (x) is a νi 23 µ νi (x). consecutive set of leaves in Tx. If B(E(cid:63) (x)) in Tx is a Q-node χ, by Lemma 1 there are at least two edges incident to χ that do not belong to E(cid:63) It νi follows that an orientation ox of χ determines an embedding of skel(µ). We call the pair (Tx, ox) compliant with a planar embedding Eµ of skel(µ) if ei- ther the boundary is an edge, or if the orientation of the boundary Q-node χ determines the embedding Eµ of skel(µ). We denote by ΨEµ(νi) the subset of tuples (cid:104)Tx, Ty, ox, oy(cid:105) ∈ Ψ(νi) such that Tx with orientation ox and Ty with orientation oy are both compliant with Eµ. Similarly ΨEµ(µ) is the subset of tu- ples (cid:104)Tu, Tv, ou, ov(cid:105) ∈ Ψ(µ) whose pairs (Tu, ou) and (Tv, ov) are both compliant with Eµ. We show how to compute ΨEµ(µ) from the sets ΨEµ(νi) of the children νi of µ (1 ≤ i ≤ k). Set ΨE(cid:48) (µ) is computed analogously. Note that the set ΨEµ(νi) can be extracted by scanning Ψ(νi) and selecting only those admissible tuples whose pairs (Tx, ox) and (Ty, oy) are both compliant with Eµ. Since Gµ has branchwidth b, skel(µ) is planar, it has branchwidth at most b, and we can execute a sphere-cut decomposition of width at most b [20] of the planar embedding Eµ of skel(µ). Such a decomposition recursively divides skel(µ) into two subgraphs, each of which is embedded inside a topological disc having at most b vertices on its frontier. The decomposition is described by a rooted binary tree, called the sphere-cut decomposition tree and denoted as Tsc. The root of Tsc is associated with skel(µ); the leaves of Tsc are the edges of skel(µ); any internal node β of Tsc is associated with the subgraph of skel(µ) induced by the leaves of the subtree rooted at β. Tree Tsc is such that when removing any of its internal edges, the two subgraphs induced by the leaves in the resulting subtrees share at most b vertices. We denote as skel(β) the subgraph associated with a node β of Tsc and with Dβ the topological disc that separates skel(β) from the rest of skel(µ). Note that skel(β) has at most b vertices on the frontier of Dβ. In particular, if β is the root of Tsc, skel(β) coincides with skel(µ) and the vertices of skel(β) on the frontier of Dβ are exactly the poles u and v of µ. We compute ΨEµ(µ) by visiting Tsc bottom-up. We equip each node β of Tsc with a set of tuples ΨEµ(β), each one consisting of at most b pairs of elements (Tx, ox) such that (Tx, ox) is compliant with Eµ, and (Tx, ox) belongs to some ΨEµ (νi). The set of tuples associated with the root of Tsc is therefore the set ΨEµ (µ). Let β be the currently visited node of Tsc. If β is a leaf, it is associated with an edge representing a child νi of µ in T and ΨEµ(β) = ΨEµ (νi). 1, . . . , wi 1, w1 c , . . . , wr If β is an internal node of Tsc, we compute ΨEµ (β) from the sets of tu- ples ΨEµ(β1) and ΨEµ (β2) associated with the two children β1 and β2 of β. c} be the set of vertices of skel(β1) that lie Let B1 = {w1 c} be the set of on the frontier of Dβ1 , and let B2 = {w1 2, w1 vertices of skel(β2) that lie on the frontier of Dβ2; see Figure 12 for an il- 2} be the set of vertices of lustration. Let {w1 1, . . . , wi B1 ∪ B2. Also, let B = {w1 c} be the set of vertices that lie on the fron- tier of Dβ1 ∩ Dβ2; note that B consists of at most b vertices, i.e., r ≤ b, and B ⊆ B1 ∪ B2. A tuple (cid:104)Tw1 (cid:105) ∈ , . . . , owi ) (1 ≤ l ≤ i, 1 ≤ h ≤ r) ΨEµ (β1) consists of pairs (Twl , . . . , Twr ) and pairs (Twh 1, w1 c , . . . , wr , ow1 , owh c , . . . , wr c , w1 2, . . . , wj 2, . . . , wj c , . . . , wr , . . . , Twi , ow1 c , . . . , owr c 1 , Tw1 c 1 1 , owl 1 1 c 1 c c 24 Figure 12: An example illustrating two topological discs Dβ1 and Dβ2 containing two sub- c}, graphs skel(β1) and skel(β2). B1 = {w1 c , . . . , wr B = {w1 c}, B2 = {w1 2, . . . , wj 1, . . . , wi c , . . . , wr 2, w1 1, w1 c}. c , . . . , wr c c c 2 2 2 2 2 , ow1 , owq , Tw1 , . . . , owr , . . . , Twj , . . . , Twr ) and pairs (Twh that are compliant with Eµ. Similarly, a tuple (cid:104)Tw1 , , ow1 (cid:105) ∈ ΨEµ(β2) consists of pairs (Twq . . . , owj , owh ) (1 ≤ q ≤ j, 1 ≤ h ≤ r) that are compliant with Eµ. We store the tuples of ΨEµ (β1) in a table τ1 where each entry is a tuple and each column contains a pair (Tx, ox). A table τ2 is built analogously to store the tuples ΨEµ(β2). We sort τ1 and τ2 according to the columns associated with the pairs (Twh , owh ) (1 ≤ h ≤ r) and we obtain a new table τ by performing a join operation on the columns that τ1 and τ2 have in common; we then select those tuples whose ) are compliant with Eµ. Finally, we compute the set ΨEµ(β), by pairs (Twh ) , owq projecting τ on the columns associated with the pairs (Twl (1 ≤ l ≤ i, 1 ≤ q ≤ j). ) and (Twq , owh , owl 2 c c c 1 1 2 2 c c c c max max log(Db Observe that τ1 consists of O(D(i+r) Sorting of the two tables can be executed in O(Db 3 2 b max) time. Also, selecting those tuples of τ for which (Twh max ) tuples, and table τ2 consists of O(D(j+r) max ) tuples. The join operation between τ1 and τ2 gives rise to a table τ that has ) tuples; since i + r ≤ b, j + r ≤ b, and i + j ≤ b, we have that O(D(i+j+r) 2i + 2j + 2r ≤ 3b and thus i + j + r ≤ 3 2 b. max)) time, since i + r ≤ b, and j + r ≤ b. The join operation on the sorted tables can be executed in O(D ) is compliant with Eµ can be done in O(nµ) time per tuple by looking at the cyclic c in Eµ (1 ≤ h ≤ r). It follows that the set ΨEµ (β) order of the edges incident to wh max · nµ) time. Since this procedure is for a node β can be computed in O(D repeated for every internal node of Tsc, since Tsc has O(nµ) nodes, and since µ) time, we have that computing the set ΨEµ (µ) Tsc can be constructed in O(n3 max · n2 3 2 b µ + n3 can be executed in O(D µ) time (see, e.g., [21, 22] for an algorithm to compute Tsc). Since ΨE(cid:48) (µ) is computed by an analogous procedure, the time 2 complexity in the statement follows. , owh 3 2 b µ c c Theorem 3. Let (G, D) be a biconnected FPQ-choosable (multi-)graph such that G = (V, E) and V = n. Let D(v) be the set of FPQ-trees associated max · n2 + n3)-time algorithm to test with vertex v ∈ V . There exists an O(D 3 2 b 25 Dβ1Dβ2wi1w11w12wj2w1cwrc whether (G, D) is FPQ-choosable planar, where b is the branchwidth of G and Dmax = maxv∈V D(v). Proof. While visiting T , we check the existence of the admissible tuples for a node µ of T as shown by Lemmas 3, 4, or 5, depending on whether µ is an S-, P-, or R-node. Recall that for any Q-node µ that is not the root of T and that has poles u and v, we have Ψ(µ) = D(u)× D(v)×{0, 1}×{0, 1}. It follows that the tuples that are admissible for a Q-node can be computed in O(D2 max) time max · n) time for all Q-nodes of T . The admissible tuples for and, hence, in O(D2 max log(Dmax)· n) time, the admissible all S-nodes of T can be computed in O(D2 max· n2) time, and the admissible tuples for all P-nodes can be computed in O(D2 max · n2 + n3) time. Recall that 3 2 b tuples for all R-nodes can be computed in O(D the SPQR-decomposition tree of a biconnected n-vertex graph can be computed 2 in O(n) time [19]. We remark that our algorithmic approach cannot be extended to simply connected graphs, since it is based on the SPQR-decomposition of the input graph G, that expects G to be biconnected. 6. FPQ-choosable Planarity Testing and NodeTrix Planarity Testing The study of FPQ-Choosable Planarity Testing can be applied also to address other planarity testing problems that can be modeled in terms of hier- archical embedding constraints. As a proof of concept, in this section we study the interplay between FPQ-Choosable Planarity Testing and NodeTrix planarity testing. A flat clustered graph is a graph for which subsets of its vertices are grouped into clusters and no vertex belongs to two clusters. For example, Figure 2(a) depicts a flat clustered graph with two clusters. In a NodeTrix representation, each cluster is represented as an adjacency matrix, while the inter-cluster edges are simple curves connecting the corresponding matrices [13, 15, 16, 17]. If no inter-cluster edges cross, the NodeTrix representation is said to be planar. For example, Figure 2(b) shows a planar NodeTrix representation of the flat clustered graph of Figure 2(a). A NodeTrix graph with fixed sides is a flat clustered graph G that admits a NodeTrix representation where, for each inter-cluster edge e, the sides of the matrices to which e is incident are specified as part of the input. If instead the sides are not specified, G is a NodeTrix graph with free sides. If G admits a planar NodeTrix representation, then we say that G is NodeTrix planar. NodeTrix planarity testing is NP-complete both in the fixed sides scenario and in the free sides scenario, even when the size of the matrices is bounded by a constant [16, 18]. On the positive side, it is proved in [17] that one can test in polynomial time whether a flat clustered graph is NodeTrix planar with fixed sides if the size of the matrices is bounded by a constant and if the graph obtained by collapsing each cluster into a vertex has treewidth at most two. We extend this last result to graphs having bounded treewidth (provided that the size of the clusters is 26 (a) (b) (c) Figure 13: (a) A matrix Mi; (b) the matrix FPQ-tree TMi ; (c) the gadget W v replacing TMi . bounded). To this aim we model NodeTrix planarity testing with fixed sides as a problem of FPQ-Choosable Planarity Testing. Let G be a NodeTrix graph with fixed sides and with clusters C1, . . . , CnC . Each permutation of the vertices of Ci (1 ≤ i ≤ nC) corresponds to a matrix Mi in some NodeTrix representation of G. Note that even if the side of Mi to which each inter-cluster edge is incident to is fixed, it is still possible to arbitrarily permute the edges incident to a same side and to a same vertex. For example, we can permute the two edges f and g incident to the right side of the matrix in Figure 13(a). It follows that all the possible cyclic orders of the edges incident to Mi can be described by means of an FPQ-tree, that we shall call the matrix FPQ-tree of Mi, denoted as TMi . Namely, TMi consists of an F-node χc connected to 4Mi P-nodes represent- ing the vertices of Ci; see, e.g., Figure 13(b). These P-nodes around χc appear 1, . . . , xρMi, in the clockwise order that is defined by Mi, namely xτ xβMi, . . . , xβ 1 , where τ , ρ, β, and λ represent the top, right, bot- tom, and left side of Mi, respectively. Any inter-cluster edge incident to a v (1 ≤ v ≤ Mi, vertex v of Mi corresponds to a leaf of TMi adjacent to xs s ∈ {τ, ρ, β, λ}). 1 , . . . , xτMi, xρ 1 , xλMi, . . . , xλ The constraint graph of a NodeTrix graph with fixed sides G, denoted as GC, is the FPQ-choosable multi-graph defined as follows. Graph GC has nC vertices, each one corresponding to one of the clusters of G, and in GC there is an edge (u, v) for each inter-cluster edge that connects the two clusters corresponding to u and to v in G. Each vertex v of GC is associated with a set D(v) of Cv! FPQ-trees. More precisely, for each permutation π of the vertices of Cv, let M π v be the matrix associated with Cv. For each such a permutation, we equip v with the matrix FPQ-tree of M π v . Figure 14(a) shows a NodeTrix graph with fixed sides G whose constraint graph is depicted in Figure 14(b). In Figure 14(b), each vertex vi of GC (1 ≤ i ≤ 4) represents a 3 × 3 matrix Mi of the graph G of Figure 14(a); hence, vi is associated with six FPQ-trees, one for each possible permutation of the rows 27 aijhgfedck123hajigfedckχcxτ1xτ2xτ3xβ1xβ2xβ3xλ1xλ2xλ3xρ1xρ2xρ3kcdefghijat1t2t3r1r2r3b3b2b1l3l1l2 (a) (b) (c) (d) (e) (f) (g) (h) Figure 14: (a) A NodeTrix graph with fixed sides G; (b) the constraint graph GC of G; (c)-(h) the FPQ-trees associated with the vertex v1 of GC . 28 abcdefghijklmABCDEFGHIJKLM2M1M3M4abcfekgdhimjlv1v2v3v4aTα1fedcbaTβ1fdecbaTγ1efdbcaTδ1edfbcaTε1dfecbaTη1defbc and the columns of Mi. For example, the FPQ-trees of v1 are those depicted in Figure 14(c)-(h). Theorem 4. Let G be a flat clustered n-vertex graph whose clusters have size at most k. Let t be the treewidth of G. If the constraint graph of G is biconnected, 4 t · n2 + n3)-time algorithm to test whether G is NodeTrix there exists an O(k! 9 planar with fixed sides. Proof. Let nC be the number of vertices of GC. We show that G is NodeTrix planar with fixed sides if and only if GC is FPQ-choosable planar. This, together with the observation that nC ∈ O(n), Theorem 3, and the fact that if a graph has bounded branchwidth b it has treewidth at most(cid:4) 3 2 b(cid:5) − 1 [29], implies the statement. If GC is FPQ-choosable planar, there exists a tuple of FPQ-trees θnC that is admissible for GC. Therefore, one can associate each vertex of GC with its FPQ-tree in θnC , execute the embedding constrained planarity testing algorithm by Gutwenger et al. [12] and obtain a positive answer. By this technique, each FPQ-tree Tu is replaced by a gadget W u that is built as follows. Each F-node χ is replaced with a wheel Hχ whose external cycle has a vertex for each edge incident to χ. Each vertex of Hχ has an edge, called spoke, that is incident to it and that is embedded externally to the wheel. For example, Figure 13(c) shows the gadget corresponding to the FPQ-tree of Figure 13(b). Each P-node ρ of Tu is represented in the gadget W u as a vertex vρ that has a spoke for each edge of ρ. For example, the P-node ρ with incident edges f and g of Figure 13(b) is represented in Figure 13(c) with a vertex vρ with two spokes f and g. By performing this replacement for each FPQ-tree of θnC and by connecting the spokes of the gadgets that correspond to the same edge, we obtain a graph GC. Gutwenger et al. [12] show that GC is planar with the embedding constraints if and only if GC is a planar graph. In order to obtain a planar NodeTrix representation, we compute a planar embedding of GC and replace each gadget W u (corresponding to cluster Cu) by a matrix as follows. Let W u x be a wheel of W u, and let t1, t2, . . . , tCu, r1, r2, . . . , rCu, bCu, . . . , b2, b1, lCu, . . . , l2, and l1 be the spokes that are encountered by walking clockwise along the cycle of W u x with a matrix Mu whose vertices are placed according to the permutation v1, . . . , vCu. The spokes of W u that are adjacent to ti (i = 1, . . . ,Cu) are connected to vi on the top side of Mu, analogously for the spokes that are adjacent to ri, bi, and li, are connected to vi on the right, bottom, or left side of Mu, respectively. x . Replace W u By performing this replacement for each gadget of GC, we obtain a planar NodeTrix representation G of the FPQ-choosable planar graph GC. It follows that, if GC is FPQ-choosable planar, G is NodeTrix planar with fixed sides. We now show that if G is NodeTrix planar with fixed sides, then GC is FPQ- choosable planar. Let Γ be a planar NodeTrix representation of G. Replace each matrix Mv of Γ by a vertex v, and connect to it all the inter-cluster edges that are incident to Mv. We obtain a planar drawing Γ(cid:48) such that the cyclic order of the edges incident to each vertex v of Γ(cid:48) reflects the cyclic order of the edges 29 incident to matrix Mv in Γ. Such an order corresponds to one of the Cv! FPQ- trees associated with v in GC (Cv is the number of rows and columns of Mv). Therefore, GC is FPQ-choosable planar 2 Corollary 2. Let G be a flat clustered n-vertex graph whose clusters have size at most k and whose vertices have degree at most d. Let t be the treewidth of G. 4 t·n2 +n3)- If the constraint graph of G is biconnected, there exists an O((k!4kd) 9 time algorithm to test whether G is NodeTrix planar with free sides. Proof. The number of possible configurations in which the inter-cluster edges are incident to the matrices is k!4kd. Therefore, by Theorem 4 the statement 2 follows. 7. Concluding Remarks and Open Problems In this paper we have studied the problem of testing when a graph G is pla- nar subject to hierarchical embedding constraints. These constraints are given as part of the input by equipping each vertex of G with a set of FPQ-trees. While the problem is NP-complete even for sets of FPQ-trees having cardinal- ity bounded by a constant and it is W[1]-hard parameterized by tree-with, for biconnected graphs it becomes fixed-parameter tractable if parameterized by both the treewidth and by the maximum number of FPQ-trees associated with a vertex. Besides being interesting on its own right, FPQ-Choosable Pla- narity Testing can be used to model and study other graph planarity testing problems. As a proof of concept, we have applied our results to the study of NodeTrix planarity testing of clustered graphs. We mention three open problems that in our opinion are worth future studies. • Theorem 1 is based on a reduction that associates six FPQ-trees to each vertex of a suitable instance of FPQ-Choosable Planarity Testing. It would be interesting to study the complexity of FPQ-Choosable Pla- narity Testing when every vertex is associated with less than six FPQ- trees. We recall that FPQ-Choosable Planarity Testing can be solved in polynomial time if Dmax = 1 [12]. • It would be interesting to improve the time complexity stated by Theo- rem 3. • It would be interesting to extend Theorem 3 to simply connected graphs. • It would be interesting to apply our approach to other problems of pla- narity testing related with hybrid representations of clustered graphs in- cluding, for example, intersection-link representations and (k, p)-planar representations (see, e.g., [30, 31]). Funding. This work was partially supported by: (i) MIUR, the Italian Min- istry of Education, University and Research, under grant 20174LF3T8 AHeAD: 30 efficient Algorithms for HArnessing networked Data; (ii) Dipartimento di In- gegneria dell'Universit`a degli Studi di Perugia, under grants RICBASE2017WD and RICBA18WD: "Algoritmi e sistemi di analisi visuale di reti complesse e di grandi dimensioni"; (iii) German Science Foundation (DFG), under grant Ru 1903/3-1. References [1] M. Patrignani, Planarity testing and embedding, in: Handbook on Graph Drawing and Visualization., 2013, pp. 1 -- 42. [2] T. Blasius, I. Rutter, A new perspective on clustered planarity as a com- binatorial embedding problem, Theor. Comput. Sci. 609 (2016) 306 -- 315. doi:10.1016/j.tcs.2015.10.011. [3] P. F. Cortese, G. Di Battista, Clustered planarity, in: Proceedings of the 21st ACM Symposium on Computational Geometry, Pisa, Italy, June 6-8, 2005, 2005, pp. 32 -- 34. doi:10.1145/1064092.1064093. [4] W. Didimo, G. Liotta, M. Patrignani, Hv-planarity: Algorithms and com- plexity, J. Comput. Syst. Sci. 99 (2019) 72 -- 90. doi:10.1016/j.jcss. 2018.08.003. [5] Q. Feng, R. F. Cohen, P. Eades, Planarity for clustered graphs, in: Al- gorithms - ESA '95, Third Annual European Symposium, Corfu, Greece, September 25-27, 1995, Proceedings, 1995, pp. 213 -- 226. doi:10.1007/ 3-540-60313-1\_145. [6] A. Garg, R. Tamassia, Upward planarity testing, Order 12 (2) (1995) 109 -- 133. [7] A. Garg, R. Tamassia, On the computational complexity of upward and rectilinear planarity testing, SIAM J. Comput. 31 (2) (2001) 601 -- 625. doi: 10.1137/S0097539794277123. [8] P. Angelini, G. Di Battista, F. Frati, V. Jel´ınek, J. Kratochv´ıl, M. Pa- trignani, I. Rutter, Testing planarity of partially embedded graphs, ACM Trans. Algorithms 11 (4) (2015) 32:1 -- 32:42. doi:10.1145/2629341. [9] V. Jel´ınek, J. Kratochv´ıl, I. Rutter, A Kuratowski-type theorem for pla- narity of partially embedded graphs, Comput. Geom. 46 (4) (2013) 466 -- 492. doi:10.1016/j.comgeo.2012.07.005. [10] C. Dornheim, Planar graphs with topological constraints, J. Graph Algo- rithms Appl. 6 (1) (2002) 27 -- 66. doi:10.7155/jgaa.00044. [11] G. Da Lozzo, I. Rutter, Approximation algorithms for facial cycles in planar embeddings, in: W. Hsu, D. Lee, C. Liao (Eds.), Proceedings of the 29th International Symposium on Algorithms and Computation (ISAAC'18), 31 Vol. 123 of LIPIcs, Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2018, pp. 41:1 -- 41:13. doi:10.4230/LIPIcs.ISAAC.2018.41. [12] C. Gutwenger, K. Klein, P. Mutzel, Planarity testing and optimal edge insertion with embedding constraints, J. Graph Algorithms Appl. 12 (1) (2008) 73 -- 95. doi:10.7155/jgaa.00160. [13] N. Henry, J. Fekete, M. J. McGuffin, NodeTrix: A hybrid visualization of social networks, IEEE Trans. Vis. Comput. Graph. 13 (6) (2007) 1302 -- 1309. doi:10.1109/TVCG.2007.70582. [14] Citevis: Visualizing citations among infovis conference papers. URL http://www.cc.gatech.edu/gvu/ii/citevis [15] V. Batagelj, F. Brandenburg, W. Didimo, G. Liotta, P. Palladino, M. Pa- trignani, Visual analysis of large graphs using (X,Y)-Clustering and hybrid visualizations, IEEE Trans. Vis. Comput. Graph. 17 (11) (2011) 1587 -- 1598. doi:10.1109/TVCG.2010.265. [16] G. Da Lozzo, G. Di Battista, F. Frati, M. Patrignani, Computing Node- Trix representations of clustered graphs, Journal of Graph Algorithms and Applications 22 (2) (2018) 139 -- 176. doi:10.7155/jgaa.00461. [17] E. Di Giacomo, G. Liotta, M. Patrignani, I. Rutter, A. Tappini, NodeTrix planarity testing with small clusters, Algorithmica 81 (9) (2019) 3464 -- 3493. doi:10.1007/s00453-019-00585-6. [18] J. J. Besa Vial, G. Da Lozzo, M. T. Goodrich, Computing k-modal em- beddings of planar digraphs, in: 27th Annual European Symposium on Al- gorithms, ESA 2019, September 9-11, 2019, Munich/Garching, Germany, 2019, pp. 19:1 -- 19:16. doi:10.4230/LIPIcs.ESA.2019.19. [19] G. Di Battista, R. Tamassia, On-line planarity testing, SIAM Journal on Computing 25 (5) (1996) 956 -- 997. doi:10.1137/S0097539794280736. [20] F. Dorn, E. Penninkx, H. L. Bodlaender, F. V. Fomin, Efficient exact algorithms on planar graphs: Exploiting sphere cut decompositions, Algo- rithmica 58 (3) (2010) 790 -- 810. doi:10.1007/s00453-009-9296-1. [21] Q. Gu, H. Tamaki, Optimal branch-decomposition of planar graphs in doi: O(n 3) time, ACM Trans. Algorithms 4 (3) (2008) 30:1 -- 30:13. 10.1145/1367064.1367070. [22] P. D. Seymour, R. Thomas, Call routing and the ratcatcher, Combinatorica 14 (2) (1994) 217 -- 241. doi:10.1007/BF01215352. [23] S. Arumugam, A. Brandstadt, T. Nishizeki, K. Thulasiraman, Handbook of graph theory, combinatorial optimization, and algorithms, Chapman and Hall/CRC, 2016. 32 [24] G. Di Battista, P. Eades, R. Tamassia, I. G. Tollis, Graph Drawing, Pren- tice Hall, Upper Saddle River, NJ, 1999. [25] K. S. Booth, G. S. Lueker, Testing for the consecutive ones property, in- terval graphs, and graph planarity using PQ-tree algorithms, J. Comput. Syst. Sci. 13 (3) (1976) 335 -- 379. doi:10.1016/S0022-0000(76)80045-1. [26] T. Blasius, I. Rutter, Simultaneous PQ-ordering with applications to con- strained embedding problems, ACM Trans. Algorithms 12 (2) (2016) 16:1 -- 16:46. doi:10.1145/2738054. [27] I. Holyer, The NP-completeness of edge-coloring, SIAM J. Comput. 10 (4) (1981) 718 -- 720. doi:10.1137/0210055. [28] M. Cygan, F. V. Fomin, L. Kowalik, D. Lokshtanov, D. Marx, M. Pilipczuk, M. Pilipczuk, S. Saurabh, Parameterized Algorithms, Springer, 2015. doi: 10.1007/978-3-319-21275-3. [29] N. Robertson, P. D. Seymour, Graph minors. X. obstructions to tree- decomposition, J. Comb. Theory, Ser. B 52 (2) (1991) 153 -- 190. doi: 10.1016/0095-8956(91)90061-N. [30] P. Angelini, G. Da Lozzo, G. Di Battista, F. Frati, M. Patrignani, I. Rutter, Intersection-link representations of graphs, Journal of Graph Algorithms and Applications 21 (4) (2017) 731 -- 755. doi:10.7155/jgaa.00437. [31] E. Di Giacomo, W. J. Lenhart, G. Liotta, T. W. Randolph, A. Tappini, (k, p)-planarity: A relaxation of hybrid planarity, in: WALCOM: Algorithms and Computation - 13th International Conference, WALCOM 2019, Guwa- hati, India, February 27 - March 2, 2019, Proceedings, 2019, pp. 148 -- 159. doi:10.1007/978-3-030-10564-8\_12. 33
1204.4835
1
1204
2012-04-21T19:36:06
Succinct Indices for Range Queries with applications to Orthogonal Range Maxima
[ "cs.DS" ]
We consider the problem of preprocessing $N$ points in 2D, each endowed with a priority, to answer the following queries: given a axis-parallel rectangle, determine the point with the largest priority in the rectangle. Using the ideas of the \emph{effective entropy} of range maxima queries and \emph{succinct indices} for range maxima queries, we obtain a structure that uses O(N) words and answers the above query in $O(\log N \log \log N)$ time. This is a direct improvement of Chazelle's result from FOCS 1985 for this problem -- Chazelle required $O(N/\epsilon)$ words to answer queries in $O((\log N)^{1+\epsilon})$ time for any constant $\epsilon > 0$.
cs.DS
cs
Succinct Indices for Range Queries with applications to Orthogonal Range Maxima(cid:63) Arash Farzan1, J. Ian Munro2, and Rajeev Raman3 1 Max-Planck-Institut fur Informatik, Saarbucken, Germany. 2 University of Waterloo, Canada. 3 University of Leicester, UK. Abstract. We consider the problem of preprocessing N points in 2D, each endowed with a priority, to answer the following queries: given a axis-parallel rectangle, determine the point with the largest prior- ity in the rectangle. Using the ideas of the effective entropy of range maxima queries and succinct indices for range maxima queries, we ob- tain a structure that uses O(N ) words and answers the above query in O(lg N lg lg N ) time. This is a direct improvement of Chazelle's result from 1985 [11] for this problem -- Chazelle required O(N/) words to answer queries in O((lg N )1+) time for any constant  > 0. 1 Introduction Range searching is one of the most fundamental problems in computer science with important applications in areas such as computational geometry, databases and string processing. The input is a set of N points in general position in Rd (we focus on the case d = 2), where each point is associated with satellite data, and an aggregation function defined on the satellite data. We wish to preprocess the input to answer queries of the following form efficiently: given any 2D axis- aligned rectangle R, return the value of the aggregation function on the satellite data of all points in R. Researchers have considered range searching with respect to diverse aggregation functions such as emptiness checking, counting, reporting, minimum/maximum, etc. [18]. In this paper, we consider the problem of range maximum searching (the minimum variant is symmetric), where the satellite data associated with each point is a numerical priority, and the aggregation function is "arg max", i.e., we want to report the point with the maximum priority in the given query rectangle. This aggregation function is the canonical one to study, among those of the "commutative semi-group" class [13, 11]. Our primary concern is the space requirement of the data structure -- we aim for linear-space data structures, namely those that occupy O(N ) words -- and seek to minimize query time subject to this constraint. The space usage is a fundamental concern in geometric data structures due to very large data vol- umes; indeed, space usage is a main reason why range searching data structures like quadtrees, which have poor worst-case query performance, are preferred in (cid:63) Work done while Farzan was employed by, and Raman was visiting, MPI. many practical applications over data structures such as range trees, which have asymptotically optimal query performance. Space efficient solutions to range searching date to the work of Chazelle [11] over a quarter century ago, and Nekrich [19] gives a nice survey of much of this work. Recently there has been a flurry of activity on various aspects of space-efficient range reporting, and for some aggregation functions there has even been attention given to the constant term within the space usage [5, 19]. We now formalize the problem studied by our paper, as well as those of [11, 9, 16]. We assume input points are in rank space: the x-coordinates of the n points are {0, . . . , N − 1} = [N ], and the y-coordinates are given by a permutation υ : [N ] → [N ], such that the points are (i, υ(i)) for i = 0, . . . , N − 1. The priorities of the points are given by another permutation π such that π(i) is the priority of the point (i, υ(i)). The reduction to rank space can be performed in O(lg N ) time with a linear space structure even if the original and query points are points in R2 [13, 11]. The query rectangle is specifed by two points from [N ] × [N ] and includes the boundaries (see Fig. 1(R)). Analogous to previous work, we also assume the word-RAM model with word size Θ (lg N ) bits4. Fig. 1. 2-sided and 4-sided range maximum queries. The numbers with the points represent their priorities, and the unshaded points are the answers. Range maximum searching is a well-studied problem (see Table 1). Chazelle [11] gave a few space/time tradeoffs covering a broad spectrum. To the best of our knowledge, the solution with the lowest query time that uses only O(N ) words is still that of Chazelle [11], who gave a query time that is polylogarithmic in N . More precisely, he gave a data structure of size O( 1  N ) words with query time O(lg1+ N ) for any fixed  > 0. Other recent results on the range maximum problem are as follows. Karpinski et al. [16] studied the problem of 3D five-sided range emptiness queries which is closely related to range maximum searching in 2D. As observed in [9], their solution yields a query time of (lg lg N )O(1) with an index of size N (lg lg N )O(1) words. Chan et al. [9] currently give the best query time of O (lg lg N ), but this is at the expense of using O (N lg N ) words, for any fixed  > 0. However, there has been no improvement in the running time for linear-space data structures. In this paper, we improve Chazelle's long-standing 4 lg x = log2x 894613275894613275 (cid:16) Citation Chazelle'88 [11] Chan et al.'10 [9] Karpinski et al.'09 [16] O Chazelle'88 [11] Chazelle'88 [11] NEW O (N ) Size (in words) O (N lg N ) O (N lg N ) N (lg lg N )O(1)(cid:17)  N(cid:1) O(cid:0) 1 O (N lg lg N ) Query time O (lg N ) O (lg lg N ) O(cid:0)(lg lg N )2(cid:1) O(cid:0)lg1+ N(cid:1) O (lg N lg lg N ) O (lg N lg lg N ) Table 1. Space/time tradeoffs for 2D range maximum searching in the word RAM. result by giving a data structure of O(N ) words and reducing the query time from polylogarithmic to "almost" logarithmic, namely, O (lg N lg lg N ). Although our primary focus is on 4-sided queries, which specify a rectangle that is bounded from all sides, we also need to consider 2-sided and 3-sided queries, which are "open" on two and one side respectively (thus a 2-sided query is specified by a single point (i, j) -- see Fig. 1(L) -- and a 3-sided query by two points (i, j) and (k, l) where either i = k or j = l). Our solution recursively divides the points into horizontal and vertical slabs, and a query rectangle is decomposed into smaller 2-sided, 3-sided, and 4-sided queries. A key intermediate result is the data structure for 2-sided queries. The 2-sided sub-problems are partitioned into smaller sub-problems, which are stored in a "compressed" format that is then "decompressed" on demand. The "compression" uses the idea that to answer 2-sided range maxima queries on a problem of size m, one need not store the entire total order of priorities using Θ (m lg m) bits: O (m) bits suffice, i.e., the effective entropy [14] of 2-sided queries is low. This does not help immediately, since Θ (m lg m) bits are needed to store the coordinates of the points compris- ing these sub-problems: to overcome this bottleneck we use ideas from succinct indices [2] -- namely, we separate the storage of point coordinates from the data structure for answering range-maximum queries. The latter data structure does not store point coordinates but instead obtains them as needed from a global data structure. We solve 3-sided and 4-sided subqueries by recursion, or by using structures for range maximum queries on matrices [22, 6]. When recursing, we cannot afford the space required to store the structures for rank space reduction for each such subproblem: a further key idea is to use a single global structure to map references to points within recursive subproblems back to the original points. By reusing ideas from the data structure for 2-sided queries, we obtain two stand-alone results on succinct indices for 2-sided range maxima queries. In a succinct index, we wish to answer queries on some data, and it is assumed that the succinct index is not charged for the space required to store the data itself, but only for any additional space it requires to answer the queries. However, the succinct index can access the data only through a specific interface (see [2] for a discussion of the advantages of succinct indices). In our case, given N points in rank space, together with priorities, we wish to answer 2-sided range-maximum queries under the condition that the point coordinates are stored "elsewhere" -- the data structure is not "charged" for the space needed to store the points "elsewhere" -- and are assumed to be available to the data structure in one of two ways: -- Through an orthogonal range reporting query. Here, we assume that a query that results in k points being reported takes T (N, k) time. We assume that T is such that T (N, O(k)) = O(T (N, k)). -- As in Bose et al. [4], we assume that the point coordinates are stored in read-only memory, permitting random access to the coordinates of the i-th point. However, the ordering of the points is specified by the data structure, which we call the permuted-point model.5 In both cases, we are able to achieve O(N )-bit indices with fast query time, namely O(lg lg N · (lg N + T (N, lg N ))) time, and O(lg lg N ) time, respectively. The paper is organized as follows. We first describe some building blocks used in Section 2. Section 3 is devoted to our main result, and Section 4 describes the succinct index results. 2 Preliminaries Our result builds upon a number of relatively new results, all of which are essential in one way or the other to obtain the final bound. In order to support mapping between recursive sub-problems, we use the following primitives on a set S of N points in rank space. A range counting query reports the number of points within a query rectangle: Lemma 1 ([15]). Given a set of N points in rank space in two dimensions, there is a data structure with O(N ) words of space that supports range counting queries in O (lg N/ lg lg N ) time. A range reporting structure supports the operation of listing the coordinates of all points within a query rectangle. We use the following consequence of a result of Chan et al. [9]: Lemma 2 ([9]). Given a set of N points in rank space in two dimensions, there is a data structure with O(N ) words of space that supports range reporting queries in O (1 + k) lg1/3 N time where k is the number of points reported. (cid:16) (cid:17) The range selection problem is as follows: given an input array A of size N , to preprocess it so that given a query (i, j, k), with 1 ≤ i ≤ j ≤ N , we return an index i1 such that A[i1] is the k-th smallest of the elements in the subarray A[i], A[i + 1], . . . , A[j]. Lemma 3 ([7]). Given an array of size N , there is a data structure with O(N ) words of space that supports range selection queries in O(lg N/ lg lg N ) time. 5 Clearly, a succinct index for this problem is interesting only if it uses o(N ) words = o(N lg N ) bits of space, so if the points are stored in arbitrary order in read-only memory, the succinct index cannot itself store the permutation that re-orders the points. 3 The data structure In this section we show our main result: Theorem 1. Given N points in two-dimensional rank space, and their prior- ities, there is a data structure that occupies O(N ) words of space and answers range maximum queries in O(lg N lg lg N ) time. We first give an overview of the data structure. We begin by storing all the points (using their input coordinates) once each in the structures of Lemmas 1 and 2. We also store an instance of the data structure of Lemma 3 once each for the arrays X and Y , where X[i] = ν(i) and Y [i] = ν−1(i) for i ∈ N (X stores the y-coordinates of the points in order of increasing x-coordinate, and Y the x-coordinates in order of increasing y-coordinate). These four "global" data structures use O(N ) words of space in all. We recursively decompose the problem `a la Afshani et al. [1]. Let n be the recursive problem size (initially n = N ). Given a problem of size n, we divide the problem into n/k mutually disjoint horizontal slabs of size n by k, and n/k mutually disjoint vertical slabs of size k by n. A horizontal and vertical slab intersect in a square of size k × k. We recurse on each horizontal or vertical slab: observe that each horizontal or vertical slab has exactly k points in it, and is treated as a problem of size k -- i.e. it is logically comprised of two permutations υ and π on [k] (Fig. 2(L); Sec. 3.1). Clearly, given a slab in a problem of size n containing k points, we require some kind of mapping between the coordinates in the slab (which in one dimension will be from [n]) and the recursive problem in order to view the slab as a problem of size k. A key to the space-efficiency of our data structure is that this mapping is not explicitly stored, and is achieved through a slab-rank operation. The slab-select problem is a generalization of the inverse of the slab-rank problem (Sec. 3.2). The given query rectangle is decomposed into a number of disjoint 2-sided, 3-sided and 4-sided queries, based upon the decomposition of the input into slabs. There are three kinds of terminal queries which do not generate further recursive problems: all 2-sided queries are terminal, 4-sided queries whose sides are slab boundaries are terminal, and all queries that reach slabs at the bottom of the recursion are terminal. The problems (or data structures) that involve answering terminal queries (or are used to answer terminal queries) are also termed terminal. Each terminal query produces some candidate points: the set of all candidate points must contain the final answer. A key invariant needed to achieve the space bound is that all terminal problems of size n -- except those at the bottom of the recursion -- use space o(n lg n) bits (Sec. 3.1). Clearly, since storing the input permutation representing the point sets in terminal problems takes Θ(n lg n) bits, we do not store them explicitly. Instead, the terminal data structures are succinct indices -- the points that comprise them are accessed by means of queries to a single global data structure. The terminal 4-sided problems use an index due to [6], while the 2-sided problems reduce the range maximum query to planar point location. Although there is a succinct index for planar point location [4], this essentially assumes that the points that comprise the planar subdivision are stored explicitly ("elsewhere") and permuted in a manner specified by their data structure. In our case, if the points are repre- sented explictly, they would occupy Θ(N lg N/ lg lg N ) words across all recursive problems. A key to our approach is an implicit representation of the planar sub- division in the recursive problems, relevant parts of which are recomputed from a "compressed" representation at query time (Sec. 3.4); the other key step is to note that O(n) bits suffice to encode the priority information needed to answer 2-sided queries in a problem of size n (Sec. 3.3). 3.1 A recursive formulation and its space usage The recursive structure is as follows. Let L = lg N , and consider a recursive problem of size n (at the top level n = N ). We assume that N is a power of 2, as are a number of expressions which represent the size of recursive problems. This can readily be achieved by replacing real-valued parameters x ≥ 1 by 2(cid:98)lg x(cid:99) or 2(cid:100)lg x(cid:101) without affecting the asymptotic complexity. Unless we have reached the bottom of the recursion, we partition the input range [n] × [n] into nL and also into mutually disjoint mutually disjoint vertical slabs of width k = horizontal slabs of height k = nL -- each such slab contains k points and can be logically viewed as a recursive problem of size k (see Fig. 2(L)). Observe that the input is divided into (n/k)2 = n/L squares of size k × k, each representing the intersection of a horizontal slab with a vertical one. We need to answer either 2-sided, 3-sided or 4-sided queries on this problem. √ √ The data structures associated with the current recursive problem are: data structure which uses O (n lg n) bits of space and has query time O(cid:0)(lg n)2(cid:1). -- for problems at the bottom of the recursion, we store an instance of Chazelle's -- For 2-sided queries (which are terminal) in non-terminal problems we use √ the data structure with space usage O(n lg n) bits described in Sec. 3.4. -- 3- and 4-sided queries, all of whose sides are slab boundaries, are square- aligned : they exactly cover a rectangular sub-array of squares. For such queries, we use a O(n)-bit data structure comprising. • A n/k × n/k matrix containing the (top-level) x and y coordinates and priority of the maximum point (if any) in each square. This uses O(n/L· L) = O(n) bits. • The data structure of [22, 6] for answering 2D range maximum queries on the elements in the above matrix. This also uses O(n) bits. Finally, each recursive problem has O(lg N ) = O(L) bits of "header" informa- tion, containing, e.g., the bounding box of the problem in the top-level coordinate system. Ignoring the header information, the space usage is given by: S(n) = 2(cid:112)n/LS( √ nL) + O(n(cid:112)lg n), (cid:113) (cid:18) ) + O 2rN (cid:19) lg(N 1/2r L1−1/2r ) . which after r levels of recursion becomes: S(N ) = 2r N 1−1/2r L1−1/2r S(N 1/2r L1−1/2r level, the problems are of size O(cid:0)(lg N )2(cid:1) and Ω(cid:0)(lg N )1.5(cid:1) and the second term The recursion is terminated for the first level r where 2r ≥ lg N/ lg lg N . At this in the space usage becomes O(N lg N ) bits. Applying S(n) = O(n lg n) for the base case, we see that the first term is O((lg N/ lg lg N )· N · lg lg N ) = O(N lg N ) bits, and the space used by the header information is indeed negligible. Fig. 2. The recursive decomposition of the input (L) and queries (R). In (R), shaded problems are terminal problems. The 4-sided query is decomposed into a square-aligned 4-sided query in the middle and four recursive 3-sided queries, two in horizontal slabs and two in vertical slabs. The 3-sided query is decomposed into two 2-sided queries in vertical slabs, a square-aligned 3-sided query and one recursive 3-sided query in a horizontal slab. We now discuss the time complexity. In general, we have to answer either 2-sided, 3-sided or 4-sided queries on a slab. Note that (see Fig. 2(R)): -- A 2-sided query is terminal and generates one candidate. -- A 3-sided query results in at most one recursive 3-sided query on a slab (generating no candidates) at most two 2-sided queries on slabs, and at most one square-aligned 3-sided query (generating one candidate). -- A 4-sided query either results in a recursive 4-sided query on a slab (gener- ating no candidates) or generates at most one square-aligned 4-sided query (generating one candidate), plus up to four 3-sided queries in slabs. Since each 3-sided query only generates one recursive 3-sided query, the number of recursive problems solved, and hence the number of candidates, is O(r) = O(lg lg N ). The time complexity will depend on the cost of mapping query points and candidates between the problems and their recursive sub-problems and the cost of solving the terminal problems; the former is discussed next. 3.2 The slab-rank and slab-select problems The input to each recursive problem of size n is given in local coordinates (i.e. from [n] × [n]). Upon decomposing the query to this problem, we need to solve the following slab-rank problem (with a symmetric variant for vertical slabs):  Given a point p = (i∗, j∗) in top-level coordinates, which is mapped to (i, j) in a recursive problem of size n, such that (i, j) that lies in a horizontal slab of size n× k, map (i, j) to the appropriate position (i(cid:48), j(cid:48)) in the size k problem represented by this slab. We formalize the "inverse" slab-select problem as follows: Given a rectangle R in the coordinate system of a recursive problem, return the top-level coordinates of all points that lie within R. The following lemma assumes and builds upon the four "global" data structures mentioned after the statement to Theorem 1. Lemma 4. The slab-rank problem can be solved in O(lg N/ lg lg N ) time, and the slab-select problem in O(lg N/ lg lg N ) time as well, provided that R contains at most O(cid:0)√ lg N(cid:1) points. Proof. We first consider the slab-rank problem. Without loss of generality, as- sume that the given (i, j) is in a horizontal n × k slab. To translate j to j(cid:48), we only need to subtract the appropriate multiple of k in O(1) time. To map i to i(cid:48), we need to count the number of points in the slab with x-coordinate smaller than i (see Fig. 3(L)). Since the top-level coordinates of the point (i, j) are known, and the top-level coordinates of the slab are also stored in the "header" of the slab by assumption, top-level coordinates of all sides of the query are known. As all input points are stored in a global instance of the data structure of Lemma 1, counting the number of points can be performed by an orthogonal range counting query in O(lg N/ lg lg N ) time. Fig. 3. Slab-rank (left) and slab-select (right). The slab-select problem is solved in a similar manner, and is most easily explained with reference to Fig. 3(R). We are given a recursive sub-problem P and a rectangle R within P , and we know P 's bounding box in the top- level problem (as shown on the far right). Our aim is to retrieve the top-level coordinates of the image of R in the top-level problem. Suppose that the local RRPPA x and y coordinates of R are xl, xr, yb and yt. Then we perform a orthogonal range count (Lemma 1) in the area A, which lies under P but within P 's x- coordinates. This takes O(lg N/ lg lg N ) time, and let z be the value returned. We then select the z +yb and z +yt-th smallest y-coordinates within X[xl], . . . , X[xr] by Lemma 3, also taking O(lg N/ lg lg N ) time. The (top-level) y-coordinates of the points returned (shown shaded in the middle) are R's boundaries in the top-level coordinate system. A similar query on Y [yb], . . . , Y [yt] gives the other lg N(cid:1) points in this boundaries of R in the top-level coordinate system. The O(cid:0)√ rectangle are then retrieved in O(cid:0)(lg N )5/6(cid:1) = o(lg N/ lg lg N ) time by Lemma 2.(cid:117)(cid:116) Remark 1. In all applications of the slab-rank result, the top-level coordinates of (i, j) will be known, as (i, j) will either be a vertex of the original input query, or is the result of intersecting a horizontal (or vertical) line through the vertex of a recursive problem (whose top-level coordinates are inductively known) with a vertical (or horizontal) line defining a recursive sub-problem. 3.3 Encoding 2-sided queries In this section we show Lemma 5. Although the reduction of 2-sided range max- ima queries at point q (RM Q(q) hereafter) to orthogonal planar point location is not new, the observation about the amount of priority information needed to answer RM Q is new (and essential). This lemma shows that although storing the permutation π itself requires Θ(n lg n) bits, the "effective entropy" [14] of the permutation with respect to 2-sided range maximum queries is much lower, generalizing the equivalent statement regarding 1D range-maximum queries [12, 21]. Lemma 5. Given a set S of n points from R2 and relative priorities given as a permutation π on [n], the query RM Q(q) can be reduced to point location of q in a collection of at most n horizontal semi-open line segments, whose left endpoints are points from S, and whose right endpoints have x-coordinate equal to the x- coordinate of some point from S. Further, given at most 2(n − r) + lg(cid:0)n bits of extra information, the collection of line segments can be reconstructed from S, where r is the number of redundant points -- those that are never the answer to any query -- in S, and this bound is tight. (cid:1) ≤ 3n r Proof. Assume the points are in general position and that the 2-sided query is open to the top and left. Associate each point p = (x(p), y(p)) ∈ S with a hor- izontal semi-open line of influence, possibly of length zero, whose left endpoint (included in the line) is p itself, and is denoted by Inf (p), and contains all points q such that y(q) = y(p), x(q) ≥ x(p) and RM Q(q) = p. It can be seen that (see e.g. [17]) the answer to RM Q(q) for any q ∈ R2 can be obtained by shooting a vertical ray upward from q until the first line Inf (p) is encountered; the answer to RM Q(q) is then p (if no line is encountered then there is no point in the 2-sided region specified by q). See Fig. 4 for an example. Fig. 4. (Left) Example for Lemma 5. The horizontal lines are the lines of influence. Vertical dotted lines show where a point has terminated the line of influence of another point. The arrow shows how point location in the lines of influence answers the 2-sided query with lower right hand corner at q, returning the point with priority 7. (Right) Example showing tightness of space bound -- points along the diagonal are A(cid:96) and the queries at p and q illustrate how 1D RMQ queries can be answered and redundancy of elements tested, respecitvely. The set Inf (S) = {Inf (p)p ∈ S} can be computed by sweeping a vertical line from left to right. At any given position x = t of the sweep line, the sweep line will intersect Inf (S(cid:48)) for some set S(cid:48) (initially S(cid:48) = ∅). If S(cid:48) = pi1 , . . . , pir such that y(pi1 ) > . . . > y(pir ) then it follows that π(i1) < . . . < π(ir) (the current lines of influence taken from top to bottom represent points with increasing priorities). Upon reaching the next point ps such that y(pij ) < y(ps) < y(pij+1), either (i) π(s) < π(ij) -- in this case Inf (ps) is empty -- or (ii) π(k) > π(ij). In the latter case, it may be that π(k) > π(ij+1), . . . π(ij+k) for some k ≥ 0, which would mean that Inf (pij+1), . . . , Inf (pij+k ) are terminated, with their right endpoints being x(ps). To construct Inf (S), therefore, only O(n) bits of information are needed: for each point, one bit is needed to indicate whether case (i) or (ii) holds, and in the latter case, the value of k needs to be stored. However, k can be stored in unary using k + 1 bits, and the total value of k, over the course of the entire sweep, is at most (n − r), giving a total of at most 2(n − r) bits. The bit-string that indicates whether case (i) or (ii) holds can be stored in (cid:1)(cid:109) ≤ n bits. (cid:108) lg(cid:0) n n−r To show that this is tight, we consider the 1D range maximum with redundant entries problem, defined as follows. Given an array A of size n, of which r entries are redundant, answer the following two queries: firstly, given an index i, state whether A[i] is redundant, and secondly, given indices 1 ≤ i ≤ j ≤ n, return the index of the largest value in a query interval A[i], . . . , A[j] (ignoring redundant values). Given n, r, it is easy to see that 2(n − r) + lg(cid:0)n these queries without accessing A. This is because there are(cid:0)n (cid:1) − O(lg n) (cid:1) choices for the bits are required to encode the answers to the above queries, namely, to answer r r 846132759qqp (cid:0)2(n−r) (cid:1) partial orders among the n−r n−r+1 positions of the redundant elements, and for each choice of the positions of the redundant elements there are Cn−r = 1 values in A that can be distinguished by 1D range maximum queries [12, 21]. We associate the values in A with a set of n points A(cid:96) placed on a slanted line (in increasing x-coordinate order), and give each point in A(cid:96) a priority equal to the corresponding entry in A. The point associated with each redundant value in A is given a priority of −∞. In addition we place an n + 1st point z that dominates all of the points in A(cid:96) (and hence is included in any query that also includes a point from A(cid:96)), whose priority is greater than −∞ but less than the smallest priority associated with a non-redundant entry of A (see Fig. 4(R)). The 1D range maximum query problem with redundant entries can can be solved via 2-sided 2D range maximum queries that include only z and the appropriate sub- range of A(cid:96). Also, we can determine if an entry in A is redundant by making a 2-sided query that includes only the corresponding point from A(cid:96) and z; the (cid:117)(cid:116) point is redundant iff the answer to such a query is z. Remark 2. It can be shown that 2(n − r) + lg(cid:0)n (cid:1) ≤ n lg 5 + o(n), which is at r most 2.33n bits for large n. 3.4 Data structures for 2-sided queries In this section we show the following lemma: Lemma 6. Given a recursive sub-problem of size n, we can answer 2-sided queries on this problem in O(lg N ) time using O(n lg n) bits of space. √ √ This lemma assumes and builds upon the four "global" data structures metioned after the statement to Theorem 1. We view the given problem of size n, on which we need to support 2-sided queries, as point location in a collection of O(n) horizontal line segments as in Lemma 5, but with a limited space budget of O(n lg n) bits. We therefore need to devise an implicit representation of these problems. We begin with an overview of the process. Let T be the set of n points in the sub-problem we are considering. We start with an explicit representation of Inf (T ) and choose a parameter λ = Θ(cid:0)√ called the skeleton, requires O((n/λ) lg n) = O(cid:0)n lg n(cid:1). We select O(n/λ) lines of lg n(cid:1) bits. Furthermore, we influence that partition the plane into rectangular regions with O(λ) points (from T ) and parts of line segments (from Inf (T )) [3, 10] and store a standard point location data structure on the selected lines of influence. This data structure, √ store O(λ) bits of information with each region (including the O(λ)-bit encoding of priority information from Lemma 5). The query proceeds as follows. Given a query point q, we first perform a point location query on the skeleton to determine the region R in which q lies. We now need to reconstruct the original point location structure within R, and perform a slab-select to determine the points of T that lie within this region. This, together with the priority information, allows us to partially -- but not fully, since lines of influence may originate from outside R -- reconstruct the point location structure within R. To handle lines of influence starting outside R, we do a binary search with O(lg λ) steps, where in each step we need to perform a slab-select, giving the claimed bound. The details are as follows. √ lg n and Preprocessing. As noted above, we first create Inf (T ), take λ = select a set of points T (cid:48) ⊆ T with the following properties: (a) T (cid:48) = O(n/λ); (b) the vertical decomposition, whereby we shoot vertical rays upward and downward from each endpoint of each segment in Inf (T (cid:48)) until they hit another segment (see Fig. 5), of the plane induced by Inf (T (cid:48))6 decomposes the plane into O(n/λ) rectangular regions each of which has at most O(λ) points from T and parts of line segments from Inf (T ) in it. T (cid:48) always exists and can be found by plane sweep [3, Section 3],[10, Section 4.3]. The skeleton is any standard point location data structure on Inf (T (cid:48)). Let R be any region, and let Left(R) (Right(R)) be the set of line segments from Inf (T ) that intersect the left (right) boundaries of R, and let P (R) be the set of points from T in R. We store the following bit strings for R: 1. For each line segment (cid:96) ∈ Left(R), ordered top-to-down by y-axis, a bit that indicates whether the right endpoint of (cid:96) is in R or not; similarly for (cid:96) ∈ Right(R), a bit indicating whether (cid:96) begins in R or not. 2. If the left boundary of R is adjacent to other regions R1, R2, . . . (taken from top to bottom) and li ≥ 0 represents the number of line segments from Left(R) that also intersect Ri, then we store a bit-string 0l1 10l21 . . .. A similar bit-string is stored for the right boundary of R. 3. For each point in P (R) and each line segment in Left(R), a bit-string of length P (R) + Left(R) whose i-th bit indicates whether the i-th largest y-coordinate in P (R) ∪ Left(R) is from P (R) or L(R). The purpose of (1) and (2) is to trace a line segment as it crosses multiple regions: if a line segment crosses from a region R(cid:48) to a region R(cid:48)(cid:48) on its right, then given its position in Right(R(cid:48)), we can deduce its position in Left(R(cid:48)(cid:48)) and vice-versa. However, there is no useful bound on the number of regions a single line segment may cross, so we store the following information: 4. Suppose that a line segment (cid:96) = Inf (p) for some p ∈ T crosses m ≥ λ regions. Then, in every λth region that (cid:96) crosses, we explicitly store the region containing p, and p's local coordinates. As in (1), for each region R, we store one bit for each (cid:96) ∈ Right(R), (cid:96) = Inf (p) , indicating whether or not R holds information about p. 5. Finally, for each point p ∈ P (R), we store the sequence of bits from Lemma 5, which indicates whether p has a non-empty Inf (p) and if so, for how many lines from Left(R) ∪ Inf (P (R)), p is a right endpoint (p cannot be a right endpoint of any other line in Inf (T ), by the construction of the skeleton). 6 Note that the extent of a line segment in Inf (T (cid:48)) is defined, as originally, wrt points in T , and not wrt the points in T (cid:48). √ As noted previously, the skeleton takes O(n lg n) bits, within our budget. We now add up the space required for (1)-(5). By construction, the sum of Left(R), Right(R) and P (R) is O(n) summed over all regions R. The space bound for (1) and (3) is therefore O(n) bits. The number of 1s in the bit string of (3), summed over all regions, is O(n/λ), as there are O(n/λ) regions and the graph which indicates adjacency of regions is planar; the number of 0s is O(n) lg n) as before. The space used by (4) is O(n portions of line segments in the regions we store O(lg n) bits. Finally, the space used for (5) is O(n) bits by Lemma 5. √ lg n) bits again, as for every O( √ Query algorithm. Suppose that we are given a query point q in a sub-problem of size n and need to answer RM Q(q) (assume that we have q's local and top- level coordinates). The query algorithm proceeds as follows: (a) Do a planar point location in the skeleton, and find a region R in which the point q lies. Perform slab-select on R to get P (R). (b) As we know how many segments from Left(R) lie vertically between any pair of points in P (R), when we are given the data in (5) above, we are able to determine whether the x-coordinate of a given point p in P (R) is the right endpoint of a line from either Left(R) or Inf (P (R)). Thus, we have enough information to determine Inf (p) for all p ∈ P (R) (at least until the right boundary of R). Furthermore, for each line in Left(R) that terminates in R, we also know (the top-level coordinates of) its right endpoint. (c) Using the top-level coordinates of q, we determine the nearest segment from Inf (P (R)) that is above q. ∗ ∗ ∗ ∗ ∗ ∗ (d) Using the top-level coordinates of q we also find the set of segments from (R). Left(R) whose right endpoints are not to the left of q. Let this set be Left (R) that is above q. Un- We now determine the nearest segment from Left (R) = O(λ), since the segments in Left fortunately, although Left (R) originate in points outside R, we do not have their y-coordinates. Hence, we need to perform the following binary search on Left (d1) Take the line segment (cid:96) ∈ Left (R) with median y-coordinate, and sup- pose that (cid:96) = Inf (p). The first task is to find the region Rp containing p, as follows. Use (2) to determine which of the adjacent regions of R (cid:96) intersects, say this is R(cid:48). If (cid:96) ends in R(cid:48), or R(cid:48) = Rp and we are done. Otherwise, use (1) to locate (cid:96) in Left(R(cid:48)) and continue. (d2) Once we have found Rp, we perform a slab-select on R(cid:48) to determine P (Rp), and sort P (Rp) by y-axis. Then we perform (c) above on P (Rp), thus determining which points of P (Rp) have lines of influence that reach the right boundary of Rp. Using this we can now determine the (top- level) coordinates of p. (R): (d3) We compare the top-level y-coordinates of p and q and recurse. (e) We take the lower of the lines found in (d) and (e) and use it to return a candidate. Observe that we have the top-level coordinates of this candidate. We now derive the time complexity of a 2-sided query. Step (a) takes O(lg n) for the point location, and O(lg N/ lg lg N ) for the slab-select. Step (b) can √ be done in O(lg n) = O(lg N ) time by running the plane sweep algorithm of Lemma 5 (recall that P (R) = O( lg n) -- a quadratic algorithm will suffice). √ Step (c) likewise can be done by a simple plane sweep in O(lg n) time. Step (d1) lg n) times before Rp is found since every λ-th region is iterated at most O( intersected by (cid:96) contains information about p. Each iteration of (d1) takes O(1) time: operations on the bit-strings are done either by table lookup if the bit- string is short (O(λ) bits), or else using rank and select operations [20], if the bit string is long (as e.g. the bit-string in (2) may be) -- these entirely standard tricks are not described in detail. Step (d2) takes O(lg N/ lg lg N ) time as before. Steps (d1)-(d3) are performed O(lg λ) = O(lg lg N ) times, so this takes O(lg N ) time overall. Step (e) is trivial. We have thus shown Lemma 6. 3.5 Putting things together As noted in Section 3.1, the space usage of our data structure is O(N ) words. Coming to the running time, we solve O(lg lg N ) 2-sided queries using Lemma 6, giving a time of O(lg N lg lg N ). The O(lg lg N ) square-aligned queries are solved in O(1) time each. The O(1) terminal problems at the bottom of the recursion are solved using Chazelle's algorithm in O((lg lg N )2) time. Any candidate given in local coordinates is converted to top-level coordinates in O(lg N/ lg lg N ) time, or O(lg N ) time overall. We simply sequentially scan all O(lg lg N ) candidates to find the answer. This proves Theorem 1. 4 A succinct index for 2-sided queries In this section, we give a succinct index for 2-sided range maxima queries over N points in rank space. This is in essence a stand-alone variant of Lemma 6 and reuses its structure. As noted earlier, we consider the case where the point coordinates are stored "elsewhere" and are assumed to be accessible in one of two ways, repeated here for convenience: -- Through an orthogonal range reporting query. Here, we assume that a query that results in k points being reported takes T (N, k) time. We assume that T is such that T (N, O(k)) = O(T (N, k)). -- The permuted-point model of [4], where we assume that the point coor- dinates are stored in read-only memory, permitting random access to the coordinates of the i-th point. However, the ordering of the points is specified by the data structure. Note that the priority information, unlike the coordinates, is encoded within the index. 4.1 Succinct index in the orthogonal range reporting model Lemma 7. Let λ ≥ 2 be some parameter. There is a succinct index of size O(N +(N lg N )/λ)) bits such that RM Q(q) queries can be answered in O(lg N + lg λ(λ + T (N, λ)) time. Proof. The proof follows closely the proof of Lemma 6, except that the distinc- tion between local and top-level coordinates vanishes, and the slab-select oper- ation is replaced by the assumed orthogonal range reporting query. The space complexity of the skeleton and associated bit-strings is exactly as in Lemma 6. For the time complexity, the planar point location to find the region R contain- ing the query point q is O(lg N ) time. Finding P (R) takes T (N, λ) time, and each of the O(lg λ) iterations of the binary search takes O(λ + T (N, λ)) time. (cid:117)(cid:116) Choosing λ = lg N in the above, we get: Corollary 1. There is a succinct index of O(N ) bits such that RM Q(q) queries can be answered in O(lg lg N · (lg N + T (N, lg N ))) time. 4.2 Succinct index in the permuted-point model Lemma 8. There is a succinct index of N lg 5 + o(N ) = 2.33N + o(N ) bits for answering RM Q(q) queries on a set of N points in O(lg lg N ) time in the permuted-point model. Proof. (sketch) Let S be the set of input points. We again solve RM Q(q) queries by planar point location on Inf (S). We consider the regions of the vertical de- composition induced by Inf (S) as nodes in a planar graph (the dual graph of the set of regions), with edges between adjacent cells (see Fig 5). Using the pla- Fig. 5. Vertical decomposition of the plane induced by a collection of line segments, and a part of the dual graph. nar separator theorem, for any parameter λ ≥ 1, there is a collection of O(n/λ) cells such that the removal of this collection of cells this graph can be decom- posed into connected components of size O(λ2) each (this approach is used by Bose et al. [4] and Chan and Patra¸scu [10] for example). As in [4] we use a two-level decomposition, first decomposing the vertical decomposition of Inf (S) using λ = (lg N )2, and then decomposing the connected components themselves using λ(cid:48) = (lg lg N )2. The key difference to Lemma 6 is that the boundaries of the cells can be relatively compactly described. For instance, for each separator cell in the top-level decomposition, we can specify the points in S that define its four sides using O(lg N ) bits, and still use only o(N ) bits. In the second-level decomposition, this information is stored in O(lg lg N ) bits per separator cell (again o(N ) bits overall), as the relevant point will either belong to the same top-level connected component of size O((lg N )4), or else the relevant informa- tion will be stored in one of the top-level separator cells that form its boundary. The leading-order term comes from storing the N lg 5 + o(N ) bits of priority information needed to answer queries within the connected components. As in [4], we also permute the points in a manner aligned with the decomposition, which allows us to reconstruct the appropriate part of the planar point location rapidly. The planar point location in the top level is performed using Chan's data structure [8] taking O(lg lg N ) time. Note that a third level of decomposi- tion, this time into connected components of size O((lg lg lg N )3) is needed to achieve "decompression" of the relevant parts of the point location structure in (cid:117)(cid:116) O(lg lg N ) time. 5 Conclusions We have introduced a new approach to producing space-efficient data structures for orthogonal range queries. The main idea has been to partition the problem into smaller sub-problems, which are stored in a "compressed" format that are then "decompressed" on demand. We applied this idea to give the first linear- space data structure for 2D range maxima that improves upon Chazelle's 1985 linear-space data structure. References 1. P. Afshani, L. Arge, and K. D. Larsen. Orthogonal range reporting: query lower bounds, optimal structures in 3-D, and higher-dimensional improvements. In J. Snoeyink, M. de Berg, J. S. B. Mitchell, G. Rote, and M. Teillaud, editors, Symposium on Computational Geometry, pages 240 -- 246. ACM, 2010. 2. J. Barbay, M. He, J. I. Munro, and S. S. Rao. Succinct indexes for strings, binary relations and multi-labeled trees. In N. Bansal, K. Pruhs, and C. Stein, editors, SODA, pages 680 -- 689. SIAM, 2007. 3. M. A. Bender, R. Cole, and R. Raman. Exponential structures for efficient cache- oblivious algorithms. In P. Widmayer, F. T. Ruiz, R. M. Bueno, M. Hennessy, S. Eidenbenz, and R. Conejo, editors, ICALP, volume 2380 of Lecture Notes in Computer Science, pages 195 -- 207. Springer, 2002. 4. P. Bose, E. Y. Chen, M. He, A. Maheshwari, and P. Morin. Succinct geometric In C. Mathieu, editor, SODA, pages indexes supporting point location queries. 635 -- 644. SIAM, 2009. 5. P. Bose, M. He, A. Maheshwari, and P. Morin. Succinct orthogonal range search structures on a grid with applications to text indexing. In F. K. H. A. Dehne, M. L. Gavrilova, J.-R. Sack, and C. D. T´oth, editors, WADS, volume 5664 of Lecture Notes in Computer Science, pages 98 -- 109. Springer, 2009. 6. G. S. Brodal, P. Davoodi, and S. S. Rao. On space efficient two dimensional range minimum data structures. In M. de Berg and U. Meyer, editors, ESA (2), volume 6347 of Lecture Notes in Computer Science, pages 171 -- 182. Springer, 2010. 7. G. S. Brodal and A. G. Jørgensen. Data structures for range median queries. In Y. Dong, D.-Z. Du, and O. H. Ibarra, editors, ISAAC, volume 5878 of Lecture Notes in Computer Science, pages 822 -- 831. Springer, 2009. 8. T. M. Chan. Persistent predecessor search and orthogonal point location on the word ram. In D. Randall, editor, SODA, pages 1131 -- 1145. SIAM, 2011. 9. T. M. Chan, K. G. Larsen, and M. Patra¸scu. Orthogonal range searching on the ram, revisited. In Proceedings of the 27th annual ACM symposium on Computa- tional geometry, SoCG '11, pages 1 -- 10, New York, NY, USA, 2011. ACM. 10. T. M. Chan and M. Patrascu. Transdichotomous results in computational geom- etry, I: Point location in sublogarithmic time. SIAM J. Comput., 39(2):703 -- 729, 2009. 11. B. Chazelle. A functional approach to data structures and its use in multidimen- sional searching. SIAM J. Comput., 17(3):427 -- 462, 1988. Prel. vers. FOCS 85. 12. J. Fischer and V. Heun. Space-efficient preprocessing schemes for range minimum queries on static arrays. SIAM J. Comput., 40(2):465 -- 492, 2011. 13. H. N. Gabow, J. L. Bentley, and R. E. Tarjan. Scaling and related techniques In Proc. 16th Annual ACM Symposium on Theory of for geometry problems. Computing, pages 135 -- 143. ACM, 1984. 14. M. J. Golin, J. Iacono, D. Krizanc, R. Raman, and S. S. Rao. Encoding 2d range maximum queries. In T. Asano, S.-I. Nakano, Y. Okamoto, and O. Watanabe, editors, ISAAC, volume 7074 of Lecture Notes in Computer Science, pages 180 -- 189. Springer, 2011. 15. J. J´aJ´a, C. W. Mortensen, and Q. Shi. Space-efficient and fast algorithms for multidimensional dominance reporting and counting. In R. Fleischer and G. Trip- pen, editors, ISAAC, volume 3341 of Lecture Notes in Computer Science, pages 558 -- 568. Springer, 2004. 16. M. Karpinski and Y. Nekrich. Space efficient multi-dimensional range reporting. In H. Q. Ngo, editor, COCOON, volume 5609 of Lecture Notes in Computer Science, pages 215 -- 224. Springer, 2009. 17. C. Makris and A. K. Tsakalidis. Algorithms for three-dimensional dominance searching in linear space. Inf. Process. Lett., 66(6):277 -- 283, 1998. 18. D. P. Mehta and S. Sahni, editors. Handbook of Data Structures and Applications. Chapman & Hall/CRC, 2009. 19. Y. Nekrich. Orthogonal range searching in linear and almost-linear space. Comput. Geom., 42(4):342 -- 351, 2009. 20. N. Rahman and R. Raman. Rank and select operations on binary strings. In M.-Y. Kao, editor, Encyclopedia of Algorithms. Springer, 2008. 21. J. Vuillemin. A unifying look at data structures. Communications of the ACM, 23(4):229 -- 239, 1980. 22. H. Yuan and M. J. Atallah. Data structures for range minimum queries in multi- dimensional arrays. In M. Charikar, editor, SODA, pages 150 -- 160. SIAM, 2010.
1908.00491
1
1908
2019-08-01T16:36:43
On Cycle Transversals and Their Connected Variants in the Absence of a Small Linear Forest
[ "cs.DS", "cs.CC", "cs.DM", "math.CO" ]
A graph is $H$-free if it contains no induced subgraph isomorphic to $H$. We prove new complexity results for the two classical cycle transversal problems Feedback Vertex Set and Odd Cycle Transversal by showing that they can be solved in polynomial time on $(sP_1+P_3)$-free graphs for every integer $s\geq 1$. We show the same result for the variants Connected Feedback Vertex Set and Connected Odd Cycle Transversal. We also prove that the latter two problems are polynomial-time solvable on cographs; this was already known for Feedback Vertex Set and Odd Cycle Transversal. We complement these results by proving that Odd Cycle Transversal and Connected Odd Cycle Transversal are NP-complete on $(P_2+P_5,P_6)$-free graphs.
cs.DS
cs
On Cycle Transversals and Their Connected Variants in the Absence of a Small Linear Forest⋆ Konrad K. Dabrowski1, Carl Feghali2, Matthew Johnson1, Giacomo Paesani1, Daniël Paulusma1, and Paweł Rzążewski3 1 Department of Computer Science, Durham University, UK {konrad.dabrowski,matthew.johnson2,giacomo.paesani,daniel.paulusma}@durham.ac.uk 2 Department of Informatics, University of Bergen, Norway [email protected] 3 Faculty of Mathematics and Information Science, Warsaw University of Technology, Warsaw, Poland [email protected] Abstract. A graph is H-free if it contains no induced subgraph isomorphic to H. We prove new complexity results for the two classical cycle transversal problems Feedback Vertex Set and Odd Cycle Transversal by showing that they can be solved in polynomial time on (sP1 + P3)-free graphs for every integer s ≥ 1. We show the same result for the variants Connected Feedback Vertex Set and Connected Odd Cycle Transversal. We also prove that the latter two problems are polynomial-time solvable on cographs; this was already known for Feedback Vertex Set and Odd Cycle Transversal. We complement these results by proving that Odd Cycle Transversal and Connected Odd Cycle Transversal are NP-complete on (P2 +P5, P6)-free graphs. 1 Introduction Graph transversal problems play a central role in Theoretical Computer Science. To define the notion of a graph transversal, let H be a family of graphs, G = (V, E) be a graph and S ⊆ V be a subset of vertices of G. The graph G − S is obtained from G by removing all vertices of S and all edges incident to vertices in S. We say that S is an H-transversal of G if G − S is H-free, that is, if G − S contains no induced subgraph isomorphic to a graph of H. In other words, S intersects every induced copy of every graph of H in G. Let Cr and Pr denote the cycle and path on r vertices, respectively. Then S is a vertex cover, feedback vertex set, or odd cycle transversal if S is an H- transversal for, respectively, H = {P2} (that is, G − S is edgeless), H = {C3, C4, . . .} (that is, G − S is a forest), or H = {C3, C5, . . .} (that is, G − S is bipartite). Usually the goal is to find a transversal of minimum size in some given graph. In this paper we focus on the decision problems corresponding to the three transversals defined above. These are the Vertex Cover, Feedback Vertex Set and Odd Cycle Transversal problems, which are to decide whether a given graph has a vertex cover, feedback vertex set or odd cycle transversal, respectively, of size at most k for some given positive integer k. Each of these three problems is well studied and is well known to be NP-complete. We may add further constraints to a transversal. In particular, we may require a transversal of a graph G to be connected, that is, to induce a connected subgraph of G. The corresponding decision problems for the three above transversals are then ⋆ The research in this paper received support from the Leverhulme Trust (RPG-2016- 258). The last author was supported by Polish National Science Centre grant no. 2018/31/D/ST6/00062. An extended abstract of this paper appeared in the proceedings of FCT 2019 [13]. called Connected Vertex Cover, Connected Feedback Vertex Set and Con- nected Odd Cycle Transversal, respectively. Garey and Johnson [15] proved that Connected Vertex Cover is NP-complete even on planar graphs of maximum degree 4 (see, for example, [14,31,36] for NP- completeness results for other graph classes). Grigoriev and Sitters [18] proved that Connected Feedback Vertex Set is NP-complete even on planar graphs with maximum degree 9. More recently, Chiarelli et al. [10] proved that Connected Odd Cycle Transversal is NP-complete even on graphs of arbitrarily large girth and on line graphs. As all three decision problems and their connected variants are NP-complete, we can consider how to restrict the input to some special graph class in order to achieve tractability. Note that this approach is in line with the aforementioned results in the literature, where NP-completeness was proven on special graph classes. It is also in line with with, for instance, polynomial-time results for Connected Vertex Cover by Escoffier, Gourvès and Monnot [12] (for chordal graphs) and Ueno, Kajitani and Gotoh [35] (for graphs of maximum degree at most 3 and trees). Just as in most of these papers, we consider hereditary graph classes, that is, graph classes closed under vertex deletion. Hereditary graph classes form a rich framework that captures many well-studied graph classes. It is not difficult to see that every hereditary graph class G can be characterized by a (possibly infinite) set FG of for- bidden induced subgraphs. If FG = 1, say F = {H}, then G is said to be monogenic, and every graph G ∈ G is said to be H-free. Considering monogenic graph classes can be seen as a natural first step for increasing our knowledge of the complexity of an NP-complete problem in a systematic way. Hence, we consider the following research question: How does the structure of a graph H influence the computational complexity of a graph transversal problem for input graphs that are H-free? Note that different graph transversal problems may behave differently on some class of H-free graphs. However, the general strategy for obtaining complexity results is to first try to prove that the restriction to H-free graphs is NP-complete whenever H contains a cycle or the claw (the 4-vertex star). This is usually done by showing, respectively, that the problem is NP-complete on graphs of arbitrarily large girth (length of a shortest cycle) and on line graphs, which form a subclass of claw-free graphs. If this is the case, then we are left to consider the case when H does not contain a cycle, implying that H is a forest, and does not contain a claw either, implying that H is a linear forest, that is, the disjoint union of one or more paths. 1.1 The Graph H Contains a Cycle or Claw It follows from Poljak's construction [30] that Vertex Cover is NP-complete on graphs of arbitrarily large girth. Hence, Vertex Cover is NP-complete on H-free graphs if H contains a cycle. However, Vertex Cover becomes polynomial-time solv- able when restricted to claw-free graphs [25,32]. In contrast, the other five problems Connected Vertex Cover, (Connected) Feedback Vertex Set and (Con- nected) Odd Cycle Transversal are all NP-complete on graphs of arbitrarily large girth and on line graphs; see Table 1. Hence, for these five problems, it remains to consider only the case when H is a linear forest. 1.2 The Graph H Is a Linear Forest In this paper, we focus on proving new complexity results for Feedback Vertex Set, Connected Feedback Vertex Set, Odd Cycle Transversal and Connected 2 Odd Cycle Transversal on H-free graphs. It follows from Section 1.1 that we may assume that H is a linear forest. Below we first discuss the known polynomial- time solvable cases. As we will use algorithms for Vertex Cover and Connected Vertex Cover as subroutines for our new algorithms, we include these two problems in our discussion. For every s ≥ 1, Vertex Cover (by combining the results of [1,34]) and Con- nected Vertex Cover [10] are polynomial-time solvable on sP2-free graphs.4 More- over, Vertex Cover is also polynomial-time solvable on (sP1 + P6)-free graphs, for every s ≥ 0 [20], as is the case for Connected Vertex Cover on (sP1 + P5)-free graphs [24]. Their complexity on Pr-free graphs is unknown for r ≥ 7 and r ≥ 6, respectively. Both Feedback Vertex Set and Odd Cycle Transversal are polynomial- time solvable on permutation graphs [4], and thus on P4-free graphs. Recently, Okrasa and Rzążewski [29] proved that Odd Cycle Transversal is NP-complete on P13- free graphs. A small modification of their construction yields the same result for Con- nected Odd Cycle Transversal. The complexity of Feedback Vertex Set and Connected Feedback Vertex Set is unknown when restricted to Pr-free graphs for r ≥ 5. For every s ≥ 1, both problems and their connected variants are polynomial-time solvable on sP2-free graphs [10], using the price of connectivity for feedback vertex set [2,21].5 1.3 Our Results In Section 3 we prove that Connected Feedback Vertex Set and Connected Odd Cycle Transversal are polynomial-time solvable on P4-free graphs, just as is the case for Feedback Vertex Set and Odd Cycle Transversal. In Section 4 we prove that for every s ≥ 1, these four problems are all polynomial-time solvable on (sP1 + P3)-free graphs; see also Table 1. Finally, in Section 5, we show that Odd Cycle Transversal and Connected Odd Cycle Transversal are NP-complete on (P2 + P5, P6)-free graphs, that is, graphs that are both (P2 + P5)-free and P6-free. To prove our polynomial-time results, we rely on two proof ingredients. The first one is that we use known algorithms for Vertex Cover and Connected Vertex Cover restricted to H-free graphs as subroutines in our new algorithms. The second is that we consider the connected variant of the transversal problems in a more general form. For Connected Vertex Cover this variant is defined as follows: Connected Vertex Cover Extension Instance: a graph G = (V, E), a subset W ⊆ V and a positive integer k. Question: does G have a connected vertex cover SW with W ⊆ SW and SW ≤ k? Note that Connected Vertex Cover Extension becomes the original problem if W = ∅. We define the problems Connected Feedback Vertex Set Extension and Connected Odd Cycle Transversal Extension analogously. We will prove all our results for connected feedback vertex sets and connected odd cycle transversals for the extension versions. These extension versions will serve as auxiliary problems for some of our inductive arguments, but this approach also leads to slightly stronger results. 4 The graph G + H is the disjoint union of graphs G and H and sG is the disjoint union of s copies of G; see Section 2. 5 The price of connectivity concept was introduced by Cardinal and Levy [9] for vertex cover; see also, for example, [6,7,8]. 3 Vertex Cover Feedback Vertex Set Odd Cycle Transversal girth p NP-c [30] P NP-c [30] NP-c [33] NP-c [10] NP-c [10] NP-c [28] NP-c [28] NP-c [10] NP-c [10] Con. Feedback Vertex Set Con. Odd Cycle Transversal NP-c [10] NP-c [10] Con. Vertex Cover line graphs sP2-free P4-free sP1 + Pr-free [25,32] P [1,34] P P: s ≥ 0, r = 6 [20] P [10] P [4] P: s ≥ 0, r = 3∗ P [10] P [4] P: s ≥ 0, r = 3∗ P [10] P P [10] P∗ P [10] P∗ P: s ≥ 0, r = 5 [24] P: s ≥ 0, r = 3∗ P: s ≥ 0, r = 3∗ Table 1: The complexities of the three connected transversal problems together with the original transversal problems on graphs of girth at least p for every (fixed) constant p ≥ 3, on line graphs, and on H-free graphs for various linear forests H. In particular, Feedback Vertex Set can be shown to be NP-complete on graphs of arbitrarily large girth by using Poljak's construction (see [3,26]). We also note that Munro [28] showed that Feedback Vertex Set is NP-complete even on line graphs of planar cubic bipartite graphs. Unreferenced results directly follow from other results in the table, and results marked with ∗ are new results proven in this paper. Our two other new results, namely that Odd Cycle Transversal and Connected Odd Cycle Transversal are NP-complete on (P2 + P5, P6)-free graphs, are not included in the table. Remark 1. For any connected extension variant of these problems on H-transversals, we may assume that the input graph G is connected. If it is not, then either all but at most one connected component of G is H-free and does not intersect W , in which case it need not be considered, or the answer is immediately no. It is easy to check H-freeness for the three problems we consider. Remark 2. Note that one could also define extension versions for any original transversal problem (that is, where there is no requirement for the transversal to be connected). However, such extension versions will be polynomially equivalent. Indeed, we can solve the extension version on the input (G, W, k) by considering the original problem on the input (G − W, max{0, k − W }) and adding W to the solution. How- ever, due to the connectivity condition, we cannot use this approach for the connected variants. Remark 3. It is known that Vertex Cover is polynomial-time solvable on (P1+H)- free graphs whenever this is the case on H-free graphs. This follows from a well-known observation, see, for example, [27]: one can solve the complementary problem of finding a maximum independent set in a (P1 + H)-free graph by solving this problem on each H-free graph obtained by removing a vertex and all of its neighbours. However, this trick does not work for Connected Vertex Cover. Moreover, it does not work for Feedback Vertex Set and Odd Cycle Transversal and their connected variants either. 2 Preliminaries Let G = (V, E) be a graph. For a set S ⊆ V , we write G[S] to denote the subgraph of G induced by S. We say that S is connected if G[S] is connected. We write G − S to denote the graph G[V \ S]. A subset D ⊆ V is a dominating set of G if every vertex of V \ D is adjacent to at least one vertex of D. An edge uv of a graph G = (V, E) is dominating if {u, v} is a dominating set. The complement of G is the graph G = (V, {uv uv 6∈ E and u 6= v}). The neighbourhood of a vertex u ∈ V is the set NG(u) = {v uv ∈ E} and for U ⊆ V , we let NG(U ) = Su∈U N (u) \ U . We omit 4 the subscript when there is no ambiguity. We denote the degree of a vertex u ∈ V by deg(u) = NG(u). Let G = (V, E) be a graph and let S ⊆ V . Then S is a clique if the vertices of S are pairwise adjacent and an independent set if the vertices of S are pairwise non-adjacent. A graph is complete if its vertex set is a clique. We let Kr denote the complete graph on r vertices. Let T ⊆ V with S ∩ T = ∅. Then S is complete to T if every vertex of S is adjacent to every vertex of T , and S is anti-complete to T if there are no edges between S and T . In the first case, we also say that S is complete to G[T ] and in the second case anti-complete to G[T ]. A graph is bipartite if its vertex set can be partitioned into at most two independent sets. A bipartite graph is complete bipartite if its vertex set can be partitioned into two independent sets X and Y such that X is complete to Y . If X or Y has size 1, the complete bipartite graph is said to be a star. Note that every edge of a complete bipartite graph is dominating. Let G1 and G2 be two vertex-disjoint graphs. The union operation creates the disjoint union G1 + G2 of G1 and G2, that is, the graph with vertex set V (G1)∪V (G2) and edge set E(G1) ∪ E(G2). We denote the disjoint union of r copies of G1 by rG1. The join operation adds an edge between every vertex of G1 and every vertex of G2. A graph G is a cograph if G can be generated from K1 by a sequence of join and union operations. A graph is a cograph if and only if it is P4-free (see, for example, [5]). The following lemma is well known, but we include a short proof for completeness. Lemma 1. Every connected P4-free graph on at least two vertices has a spanning complete bipartite subgraph which can be found in polynomial time. Proof. Let G be a connected P4-free graph on at least two vertices. Then G is the join of two graphs G[X] and G[Y ]. Hence, G has a spanning complete bipartite subgraph with partition classes X and Y . Note that this implies that G is disconnected. In order to find a (not necessarily unique) spanning complete bipartite subgraph of G with partition classes X and Y in polynomial time, we put the vertices of one connected ⊓⊔ component of G in X and all the other vertices of G in Y . Grzesik et al. [20] gave a polynomial-time algorithm for finding a maximum indepen- dent set of a P6-free graph in polynomial time. As the complement V (G) \ I of every independent set I of a graph G is a vertex cover, their result implies that Vertex Cover is polynomial-time solvable on P6-free graphs. Using the folklore trick men- tioned in Remark 3 (see also, for example, [24,27]) their result can also be formulated as follows. Theorem 1 ([20]). For every s ≥ 0, Vertex Cover can be solved in polynomial time on (sP1 + P6)-free graphs. We recall also that Connected Vertex Cover is polynomial-time solvable on (sP1 + P5)-free graphs [24]. We will need the extension version of this result. Its proof is based on a straightforward adaption of the proof for Connected Vertex Cover on (sP1 + P5)-free graphs [24].6 Theorem 2 ([24]). For every s ≥ 0, Connected Vertex Cover Extension can be solved in polynomial time on (sP1 + P5)-free graphs. 6 See Appendix A, where we include a proof for reviewing purposes. 5 3 The Case H = P4 Recall that Brandstädt and Kratsch [4] proved that Feedback Vertex Set and Odd Cycle Transversal can be solved in polynomial time on permutation graphs, which form a superclass of the class of P4-free graphs. Hence, we obtain the following proposition. Proposition 1 ([4]). Feedback Vertex Set and Odd Cycle Transversal can be solved in polynomial time on P4-free graphs. In this section, we prove that the (extension versions of the) connected variants of Feedback Vertex Set and Odd Cycle Transversal are also polynomial-time solvable on P4-free graphs. We make use of Proposition 1 in the proofs. Theorem 3. Connected Feedback Vertex Set Extension can be solved in polynomial time on P4-free graphs. Proof. Let G = (V, E) be a P4-free graph on n vertices and let W be a subset of V . By Remark 1, we may assume that G is connected. By Lemma 1, in polynomial time we can find a spanning complete bipartite subgraph G′ = (X, Y, E′), and we note that, by definition, every edge in G′ is dominating. Below, in Step 1, in polynomial time we compute a smallest connected feedback vertex set of G that contains W and intersects both X and Y . In Step 2, in polynomial time we compute a smallest connected feedback vertex set of G that contains W and that is a subset of either X or Y (if such a set exists). Then the smallest set found is a smallest connected feedback vertex set of G that contains W . Step 1. Compute a smallest connected feedback vertex set S of G such that W ⊆ S, S ∩ X 6= ∅ and S ∩ Y 6= ∅. We perform Step 1 as follows. Consider two vertices u ∈ X and v ∈ Y . We shall describe how to find a smallest connected feedback vertex set of G that contains W ∪{u, v}. We find a smallest feedback vertex set S′ in G − (W ∪ {u, v}). As G − (W ∪ {u, v}) is P4- free, this takes polynomial time by Proposition 1. Then S′ ∪ W ∪ {u, v} is a smallest feedback vertex set of G that contains W ∪ {u, v} and is connected, since uv is a dominating edge. By repeating this polynomial-time procedure for all O(n2) possible choices of u and v, we will find S in polynomial time. Step 2. Compute a smallest connected feedback vertex set S of G such that S ⊆ X or S ⊆ Y . For Step 2 we describe only the S ⊆ X case, as the S ⊆ Y case is symmetric. Thus we may assume that W ⊆ X, otherwise no such set exists. Clearly, we may also assume that G[Y ] contains no cycles. If G[Y ] contains an edge it follows that S = X, otherwise G − S would contain a triangle. Suppose instead that Y is an independent set. If Y = 1, then X \ S must be an independent set, otherwise G − S contains a triangle. So S is a smallest connected vertex cover of G[X] that contains W . As G[X] is P4-free, we can find such an S in polynomial time by Theorem 2. If Y ≥ 2, then X \ S ≤ 1, as otherwise G − S contains a 4-cycle. Thus, we check, in polynomial time, if there exists a vertex x ∈ X \ W , such that X \ {x} is connected. If so, S = X \ {x}. ⊓⊔ Theorem 4. Connected Odd Cycle Transversal Extension can be solved in polynomial time on P4-free graphs. Proof. We only provide an outline, as the proof follows that of Theorem 3. We perform the same two steps. In Step 1, we need to find a smallest odd cycle transversal S′ in 6 G − (W ∪ {u, v}) and can again apply Proposition 1. In Step 2, we again note that if G[Y ] contains an edge, then S = X. Suppose that Y is an independent set. Then G − S contains no odd cycles if and only if X \ S is independent, so S is a smallest connected vertex cover of G[X] that contains W . (That is, the Y = 1 case from the proof of Theorem 3 can be used for all values of Y , as we are no longer concerned ⊓⊔ with whether G − S might contain cycles of even length.) 4 The Case H = sP1 + P3 In this section, we will prove that Feedback Vertex Set and Odd Cycle Transversal and their connected variants can be solved in polynomial time on (sP1 +P3)-free graphs. We need three structural results. First, let us define a function c on the non-negative integers by c(s) := max{3, 2s − 1}. We will use this function c throughout the remainder of this section, starting with the following lemma. Lemma 2. Let s ≥ 0 be an integer. Let G be a bipartite (sP1 + P3)-free graph. If G has a connected component on at least c(s) vertices, then there are at most s − 1 other connected components of G and each of them is on at most two vertices. Proof. First note that the s = 0 case of the lemma is trivially true, as every connected component of a bipartite P3-free graph has at most two vertices. Suppose, for contradiction, that G has a connected component C1 on at least c(s) vertices and a connected component C2 on at least three vertices. As C1 is bipartite and contains at least 2s − 1 vertices, C1 contains a independent set of s vertices that induce sP1. As C2 is bipartite and contains at least three vertices, C2 has a vertex v of degree at least 2, and so v and two of its neighbours induce a P3. Thus G is not (sP1 + P3)-free, a contradiction. Similarly, if G contains a connected component C1 on at least c(s) ≥ 3 vertices, then this component contains an induced P3. Since G is (sP1 + P3)-free, G can contain at most s − 1 connected components other than C1. ⊓⊔ The internal vertices and leaves of a tree are the vertices of degree at least 2 and degree 1, respectively. Lemma 3. Let s ≥ 0 be an integer. Let T be an (sP1 + P3)-free tree. Then T has at most 4s internal vertices. Proof. Let U be the set of internal vertices of T . Suppose that U ≥ 4s + 1 ≥ 1. We will show that this leads to a contradiction. As a path with at least 4s + 1 internal vertices contains an induced sP1 + P3, we may assume that T is not a path and so has at least three leaves. Hence V (T ) ≥ 4s + 4. Let X and Y be the two bipartition sets of T , and assume without loss of generality that X ≥ 2s + 2. For Z ∈ {X, Y }, let LZ and UZ be the leaves and internal vertices of T that belong to Z. If there is a vertex in Y of degree at least 2 that is anti-complete to a set of s vertices of X, then T contains an induced sP1 + P3, a contradiction. Therefore we may assume that every vertex of Y either has degree at least X − s + 1 7 or is in LY . Then X + UY + LY − 1 = X + Y − 1 = V (T ) − 1 = E(T ) = X v∈Y ≥ X v∈UY deg(v) (X − s + 1) + LY = (X − s + 1)UY + LY = XUY − sUY + UY + LY . Thus we have X − 1 ≥ XUY − sUY and we rearrange to see that UY ≤ X − 1 X − s = 1 + s − 1 X − s . Since X ≥ 2s + 2, we have that UY < 2. First suppose UY = 0. Then UX ≤ 1 and LX = 0, or UX = 0 and LX ≤ 1. Both cases contradict the assumption that X has at least 2s + 2 vertices. Now suppose UY = 1. Then, by our assumption that U ≥ 4s + 1, we have that UX ≥ 4s and so LY ≥ UX ≥ 4s. Now it is easy to find ⊓⊔ an induced sP1 + P3 (see Fig. 1), and this contradiction completes the proof. LY z LX UY UX y x ≥ 4s Fig. 1: The structure of the tree T in the proof of Lemma 3 in the case when UY = 1. The set LX is an independent set of vertices that each are adjacent to the unique vertex y ∈ UY . The set LY is partitioned into independent sets of vertices that have the same neighbour in UX . The vertices y, x, z, together with s vertices of Ly not adjacent to x, induced an sP1 + P3 in T (which leads to the desired contradiction in the proof). The bound of 4s in Lemma 3 is not tight but, as we shall see later, it suffices for our purposes. 8 Lemma 4. Let s ≥ 0 be an integer. Let G be a connected (sP1 + P3)-free graph, and let U be a set of vertices in G. Then there is a set of vertices R in G such that G[R∪U ] is connected and R ≤ 2s2 − 2s + 3. Proof. If G[U ] is connected, then let R = ∅. Otherwise, since G cannot now be a complete graph, it contains an induced path P on three vertices in G. The number of connected components of G[U ] that do not contain a vertex that is either in P or adjacent to a vertex of P in G is at most s−1, otherwise G contains an induced sP1+P3. Let R contain the vertices of P and the internal vertices of shortest paths in G from P to each set of vertices that induces a connected component of G[U ]. As at most s − 1 of these shortest paths have more than zero internal vertices, and as each contains at most 2s internal vertices (any longer path contains an induced sP1 + P3), it follows that R ≤ 3 + 2s(s − 1) = 2s2 − 2s + 3. As G[R ∪ U ] is connected, the lemma is ⊓⊔ proved. We now prove our four results. For the connected variants, we consider the more general extension versions. Theorem 5. For every s ≥ 0, Feedback Vertex Set can be solved in polynomial time on (sP1 + P3)-free graphs. Proof. Let s ≥ 0 be an integer, and let G = (V, E) be an (sP1 + P3)-free graph. We must show how to find a smallest feedback vertex set of G. We will in fact show how to find a largest induced forest of G, the complement of a smallest feedback vertex set. The proof is by induction on s. If s = 0, then we can use Proposition 1. We now assume that s ≥ 1 and that we have a polynomial-time algorithm for finding a largest induced forest in ((s − 1)P1 + P3)-free graphs. Our algorithm performs the following two steps in polynomial time. Together, these two steps cover all possibilities. Step 1. Compute a largest induced forest F such that every connected component of F has at least c(s) vertices. By Lemma 2 we know that F will be connected, and so by Lemma 3 F will be a tree with at most 4s internal vertices. We consider every possible choice U of a non-empty set of at most 4s vertices. There are O(n4s) choices. If U induces a tree, we will find a largest induced tree whose internal vertices all belong to U . This can be found by adding to U the largest possible set of vertices that are independent and belong to the set R of vertices in G − U that each have exactly one neighbour in U . That is, we need a largest independent set in G[R] and, by Theorem 1, such a set can be found in polynomial time. Step 2. Compute a largest induced forest F such that F has a connected component with at most c(s) − 1 vertices. We consider every possible choice of a non-empty set T of at most c(s) − 1 vertices and discard those that do not induce a tree. There are O(nc(s)−1) choices for T . Let U = N (T ), and let G′ = G − (T ∪ U ). Then G′ is ((s − 1)P1 + P3)-free. Thus we can find a largest induced forest F ′ of G′ in polynomial time and F ′ + G[T ] is a largest ⊓⊔ induced forest of G among those that have G[T ] as a connected component. Theorem 6. For every s ≥ 0, Connected Feedback Vertex Set Extension can be solved in polynomial time on (sP1 + P3)-free graphs. Proof. There are similarities to the proof of Theorem 5, but more arguments are needed. Let s ≥ 0 be an integer, let G = (V, E) be a connected (sP1 + P3)-free graph and let W be a subset of V . We must show how to find a smallest connected feedback vertex set of G that contains W in polynomial time. We show how to solve 9 the complementary problem in polynomial time: how to find a largest induced forest F of G that does not include any vertex of W and V \ F is connected. We will say that an induced forest F is good if it has these two properties. Our algorithm performs the following three steps in polynomial time. Together, these three steps cover all possibilities. Step 1. Compute a largest good induced forest F such that there is a connected com- ponent of F that has at least c(s) vertices. By Lemma 2 we know that F has exactly one connected component on at least c(s) and there are at most s− 1 other connected components of F , each on at most two ver- tices. By Lemma 3, the connected component on at least c(s) vertices has at most 4s internal vertices. We consider O(n4s+2(s−1)) choices of a non-empty set U of at most 4s vertices that induces a tree and a set U ′ of at most 2(s − 1) vertices that induces a disjoint union of vertices and edges such that U ∪U ′ does not intersect W , U is disjoint from U ′ and no vertex of U has a neighbour in U ′. Let R be the set of vertices that each have exactly one neighbour in U and no neighbour in U ′, but do not belong to W . We then add to U ∪ U ′ the largest possible set L of vertices that are independent and belong to the set R such that G − (L ∪ U ∪ U ′) is connected. This is achieved by taking the complement of the smallest connected vertex cover of G − (U ∪ U ′) that contains V \ (R ∪ U ∪ U ′). By Theorem 2, this can be done in polynomial time. Step 2. Compute a largest good induced forest F such that F has at most s − 1 connected components and each connected component has at most c(s) − 1 vertices. Since the number of vertices in F is bounded by the constant (s − 1)(c(s) − 1), we can simply check all sets containing at most that many vertices to see if they induce such a good forest. Step 3. Compute a largest good induced forest F such that F has at least s connected components and each connected component has at most c(s) − 1 vertices. We consider O(ns(c(s)−1)) choices of a non-empty set L of at most s(c(s) − 1) vertices. We reject L unless G[L] is a good induced forest on s connected components with no connected component of more than c(s) − 1 vertices. Assuming our choice of L is correct, the connected components of G[L] will become connected components of G[F ]. Let U = N (L) and note that no vertex of U is in F . If G − U is a good forest, then we are done. Otherwise we consider every set R of at most 2s2 − 2s + 3 vertices of G − (L ∪ U ∪ W ) such that G[R ∪ U ∪ W ] is connected; see also Fig. 2. We note that if there is a largest induced forest F such that the connected components of G[L] are also connected components of G[F ], then Lemma 4 applied to G − F implies that such a set R exists. Let S = R ∪ U ∪ W . If G − S is a forest, then we are done. Otherwise note that G − (L ∪ S) is the disjoint union of one or more complete graphs: G − (L ∪ S) cannot contain an induced P3, as it is anti-complete to L which contains an induced sP1. As G is connected, each of the complete graphs in G − (L ∪ S) contains at least one vertex that is adjacent to some vertex of S. Hence in polynomial time we can find a set S′ of vertices containing all but min{2, X} vertices from each of the complete graphs X in such a way that G[S ∪ S′] is connected. Then G − (S ∪ S′) is a largest good induced forest that contains L and no vertex of R ∪ U . After considering each of the O(n2s2 −2s+3) choices for R, in polynomial time we find a largest good induced forest that contains L and no vertex of U . After considering each of the O(ns(c(s)−1)) choices for L, we find in polynomial time a largest good induced forest that has at least s connected components, each with at most c(s)−1 vertices. ⊓⊔ 10 W s L U = N (L) G − (L ∪ U ∪ W ) Fig. 2: The decomposition of the (sP1 + P3)-free graph G, as given in Step 3 of the algorithm from the proof of Theorem 6. Theorem 7. For every s ≥ 0, Odd Cycle Transversal can be solved in polyno- mial time on (sP1 + P3)-free graphs. Proof. Let s ≥ 0 be an integer, and let G = (V, E) be an (sP1 + P3)-free graph. We must describe how to find a smallest odd cycle transversal of G. If s = 0, then we can use Proposition 1. We now assume that s ≥ 1 and use induction. We will in fact describe how to solve the complementary problem and find a largest induced bipartite subgraph of G. The proof is by induction on s and our algorithm performs two steps in polynomial time, which together cover all possibilities. Step 1. Compute a largest induced bipartite subgraph B such that every connected component of B has at least c(s) vertices. By Lemma 2, we know that B will be connected. Hence, B has a unique bipartition, which we denote {X, Y }. We first find a largest induced bipartite subgraph B that is a star: we consider each vertex x and find a largest induced star centred at x by finding a largest independent set in N (x). This can be done in polynomial time by Theorem 1. Next, we find a largest induced bipartite subgraph B that is not a star. We consider each of the O(n2) choices of edges xy of G and find a largest induced connected bipartite subgraph B such that x ∈ X and y ∈ Y and neither x nor y has degree 1 in B (since B is not a star, it must contain such a pair of vertices). Note that the number of vertices in X non-adjacent to y is at most s − 1, otherwise B induces an sP1 + P3. Similarly there are at most s − 1 vertices in Y non-adjacent to x. We consider each of the O(n2s−2) possible pairs of disjoint sets X ′ and Y ′, which are each independent sets of size at most s − 1 such that X ′ ∪ Y ′ is anti-complete to {x, y}. We will find a largest induced bipartite subgraph with partition classes X and Y such that {x} ∪ X ′ ⊆ X and {y} ∪ Y ′ ⊆ Y and every vertex in X \ X ′ is adjacent to y and every vertex in Y \ Y ′ is adjacent to x. That is, we must find a largest independent 11 set in both N (x) \ N ({y} ∪ Y ′) and N (y) \ N ({x} ∪ X ′); see Fig. 3 for an illustration. This can be done in polynomial time, again by applying Theorem 1. N (y) \ N ({x} ∪ X ′) ≤ s − 1 x y X ′ Y ′ N (x) \ N ({y} ∪ Y ′) ≤ s − 1 Fig. 3: An illustration of Step 1 of the algorithm in the proof of Theorem 7. Full and dotted lines indicate when two sets are complete or anti-complete to each other, respectively. The absence of a full or dotted lines indicates that edges may or may not exist between two sets. Step 2. Compute a largest induced bipartite subgraph B such that B has a connected component with at most c(s) − 1 vertices. We consider each of the O(nc(s)−1) possible choices of a non-empty set L of at most c(s) − 1 vertices and discard those that do not induce a bipartite graph. We will find the largest B that has G[L] as a connected component. Let U = N (L), and let G′ = G − (L ∪ U ). As G′ is ((s − 1)P1 + P3)-free, we can find a largest induced bipartite subgraph B′ of G′ in polynomial time and B′ + G[L] is a largest induced bipartite ⊓⊔ subgraph among those that have G[L] as a connected component. Theorem 8. For every s ≥ 0, Connected Odd Cycle Transversal Extension can be solved in polynomial time on (sP1 + P3)-free graphs. Proof. Let s ≥ 0 be an integer, let G = (V, E) be a connected (sP1 + P3)-free graph and let W be a subset of V . We must describe how to find a smallest connected odd cycle transversal of G that contains W . We will solve the complementary problem: how to find a largest induced bipartite graph of G that does not include any vertex of W and whose complement is connected. We will say that an induced bipartite graph B is good if it has these two properties. Our algorithm consists of three steps, which can each be performed in polynomial time and which together cover all the possible cases. Step 1. Compute a largest good induced bipartite subgraph B such that B has a bi- partition {X, Y } in which one set, say X, has size X ≤ s. (Note that this includes the case when every connected component of B has at most two vertices and B has at most s connected components.) We consider O(ns) choices of an independent set X of at most s vertices of G that does not intersect W . We wish to find Y , the largest possible independent set in G−(W ∪X) such that G − (X ∪ Y ) is connected. By Theorem 2, we can do this in polynomial time 12 by computing a minimum connected vertex cover of G−X that contains W and taking its complement (in G − X). Step 2. Compute a largest good induced bipartite subgraph B such that B has at least s connected components and each connected component has at most two vertices. Note that 2 ≤ c(s) − 1. The algorithm mimics Step 3 of the algorithm in the proof of Theorem 6, but checks for a good bipartite graph instead of a good forest. Step 3. Compute a largest good induced bipartite subgraph B such that there is a connected component of B that has at least three vertices and B has a bipartition {X, Y } with X ≥ s + 1 and Y ≥ s + 1. It is in this case that we must do most of the work in proving the theorem, and here we will need ideas beyond those already met in this section. As B contains a connected component on at least three vertices, it will contain an induced P3 and so X ≥ 1 and Y ≥ 1. We consider O(n2s+2) choices of disjoint independent sets X ′ and Y ′ that each contain s+1 vertices of G and do not intersect W . If G[X ′ ∪ Y ′] contains an induced P3, our aim is to compute a largest good induced bipartite graph B with bipartition {X, Y } such that X ′ ⊆ X and Y ′ ⊆ Y ; otherwise we discard the choice of X ′, Y ′. We define (see also Fig. 4) a partition of V \ (X ′ ∪ Y ′): U = (N (X ′) ∩ N (Y ′)) ∪ W VX = N (X ′) \ (Y ′ ∪ N (Y ′) ∪ W ) VY = N (Y ′) \ (X ′ ∪ N (X ′) ∪ W ) Z = V \ (X ′ ∪ Y ′ ∪ N (X ′) ∪ N (Y ′) ∪ W ) There are a number of steps where our procedure branches as we consider all possible ways of choosing whether or not to add certain vertices to B. Note that assuming our choice of X ′ and Y ′ is correct, no vertex of U can be in B. If we decide that a vertex will not be in B, we will then add it to U . X ′ VY W U Z N (X ′) ∩ N (Y ′) Y ′ VX Fig. 4: The decomposition of G in Step 3. Full and dotted lines indicate when two sets are complete or anti-complete to each other, respectively. The absence of a full or dotted lines indicates that edges may or may not exist between two sets. The circles in VX and VY represent disjoint unions of complete graphs. Step 3.1. Reduce Z to the empty set. Notice that Z does not contain an independent set on more than s−1 vertices otherwise 13 G[X ′ ∪ Y ′ ∪ Z] would contain an induced sP1 + P3. We consider O(n2s−2) choices of disjoint independent sets ZX and ZY that are each subsets of Z and each contain at most s − 1 vertices. We move the vertices of ZX and ZY by adding them to X ′ and Y ′, respectively. We move the vertices of Z \ (ZX ∪ ZY ) by adding them to U . If after this process is complete there are vertices in VX ∪ VY with neighbours in both X ′ and Y ′, we move these vertices by adding them to U . We note that now: -- Z is the empty set, -- VX still contains vertices with neighbours in X ′ but not in Y ′, -- VY still contains vertices with neighbours in Y ′ but not in X ′, and -- U contains vertices that will not be in B. So our task is to decide how best to add vertices of VX to Y ′ and vertices of VY to X ′, but first there is another step: as G − B must be connected, and G[U ] is a subgraph of G − B, we choose some vertices that will not be in B, but will connect together the connected components of G[U ]. This will not be possible if the vertices of U belong to more than one connected component of G − (X ′ ∪ Y ′). Hence, in that case we discard this choice of ZX , ZY . Step 3.2. Make G[U ] connected. We consider O(n2s2 −2s+3) choices of sets R of vertices of G − (X ′ ∪ Y ′) such that each contains at most 2s2 − 2s + 3 vertices. If G[R ∪ U ] is connected, we move the vertices of R by adding them to U , and so G[U ] becomes connected. Note that since all vertices of U are in the same connected component of G − (X ′ ∪ Y ′), Lemma 4 implies that at least one such set R can be found. Step 3.3. Add vertices from VX to Y ′ and from VY to X ′. We note that G[VX ] is P3-free, as no vertex of VX has a neighbour in Y ′, Y ′ ≥ s, and G is (sP1 + P3)-free. By symmetry, G[VY ] is P3-free. Thus both G[VX ] and G[VY ] are disjoint unions of complete graphs. Note that B can contain at most one vertex from each of these complete graphs. We consider two subcases. Step 3.3a. Compute a largest good induced bipartite subgraph B with bipartition {X, Y } such that X ′ ⊆ X, Y ′ ⊆ Y and G − B contains no edges between VX and VY . As G − B must be connected, each clique of VX and VY that contains at least two vertices must contain a vertex adjacent to U (otherwise such a set B cannot exist). Thus we can form X from X ′ by adding to X ′ one vertex from each clique of VY and form Y by adding to Y ′ one vertex from each clique of VX in such a way that G − B is connected. (If we do this, it is possible that G − B will contain an edge from VX to VY , but then this solution is at least as large as one where such edges are avoided.) Step 3.3b. Compute a largest good induced bipartite subgraph B with bipartition {X, Y } such that X ′ ⊆ X, Y ′ ⊆ Y and G − B has an edge xy where x ∈ VX , y ∈ VY . We consider O(n2) choices of an edge xy, x ∈ VX , y ∈ VY . Let vX ∈ X ′ be a neighbour of x and note that vX , x and y induce a P3 in G. Therefore x must be complete to all but at most s − 1 cliques of VY . By symmetry, y must be complete to all but at most s − 1 cliques of VX . A clique in VX or VY is bad if it is not complete to y or x, respectively. Note that the cliques containing x and y may be bad. We move x and y to U . We consider O(n2s−2) choices of a set S of at most 2s − 2 vertices that each belong to a distinct bad clique and move each to X ′ or Y ′ if they are in VY or VX respectively. We move the other vertices of the bad cliques to U . If the vertices of U are not in the same connected component of G − (X ′ ∪ Y ′), we discard this choice of S. We consider O(n2s2−2s+3) choices of sets R′ of vertices of G − (X ′ ∪ Y ′) such that each contains 14 at most 2s2 − 2s + 3 vertices. If G[R′ ∪ U ] is connected we move the vertices of R′ to U , so G[U ] becomes connected. Since the vertices of U are in the same connected component of G − (X ′ ∪ Y ′), Lemma 4 implies that at least one such set R′ can be found. Note that some cliques might have been completely removed from VX and VY by the choice of R′. It only remains to pick one vertex from each remaining clique of VX and VY , and add these vertices to Y ′ or X ′, respectively to finally obtain B. As all vertices in these cliques are adjacent to x or y we know that G − B will be connected. ⊓⊔ 5 The Case H = P6 In this section we prove that Odd Cycle Transversal and Connected Odd Cy- cle Transversal are NP-hard on (P2 + P5, P6)-free graphs. We do this by modifying the construction used in [29] for proving that these two problems are NP-complete on P13-free segment graphs. Theorem 9. Odd Cycle Transversal and Connected Odd Cycle Transver- sal are NP-complete on (P2 + P5, P6)-free graphs. Proof. Both problems are readily seen to belong to NP. To prove NP-hardness we reduce from Vertex Cover, which is known to be NP-complete [16]. Let (G, k) be an instance of Vertex Cover. Let n and m be the number of vertices and edges, respectively, in G. Let v1, . . . , vn be the vertices of G. We construct a graph G∗ from G as follows. 1. For i ∈ {1, . . . , n} create vertices ai, bi, ci, xi and yi. Let A, B, C, X and Y be the sets of, respectively, ai, bi, ci, xi and yi vertices. 2. For i, j ∈ {1, . . . , n}, add the edges xiyj and biyj (so we make Y complete to both X and B). 3. For each i ∈ {1, . . . , n}, add edges xiai, xibi, aibi, bici, ciyi (a vertex gadget, see also Fig. 5(a) and note that bi is adjacent to yi by the previous step). 4. For each edge vivj in G with i < j, add a vertex di,j adjacent to both xi and yj (an edge gadget, see also Fig. 5(b)). Let D be the set of di,j vertices. ai bi ci di,j xi yi xi yj (a) Vertex gadget (b) Edge gadget Fig. 5: The two gadgets used in the proof of Theorem 9. We first claim that the following statements are equivalent: (i) G has a vertex cover of size at most k; (ii) G∗ has an odd cycle transversal of size at most n + k; (iii) G∗ has a connected odd cycle transversal of size at most n + k. 15 The implication (iii) ⇒ (ii) is trivial. Below we prove (i) ⇒ (iii) and (ii) ⇒ (i). (i) ⇒ (iii). Suppose that G has a vertex cover Q of size at most k. We define the set S = [ vi∈Q {xi, yi} ∪ [ vi /∈Q {bi} and observe that S = 2Q + (n − Q) = n + Q ≤ n + k and that S is connected. We claim that S is an odd cycle transversal of G∗. This can be seen as follows. The only induced odd cycles in G∗ are the three triangles in each vertex gadget and the triangle in each edge gadget. By construction of S, for every i ∈ {1, . . . , n}, either S contains both xi and yi or S contains bi, thus every triangle in every vertex gadget intersects S. Furthermore, since Q is a vertex cover of G, for every edge gadget {xi, yj, di,j}, either xi ∈ S or yj ∈ S. Therefore S intersects every odd cycle in G∗. (ii) ⇒ (i). Suppose that G∗ has an odd cycle transversal S of size at most n+k. Consider an edge gadget on {xi, yj, di,j}. If di,j ∈ S then S′ := (S \ {di,j}) ∪ {xi} is an odd cycle transversal of G with S′ ≤ S. We may therefore assume that S contains no vertices of D. For i ∈ {1, . . . , n}, the vertex bi intersects all odd cycles in the vertex gadget on {ai, bi, ci, xi, yi}. If bi /∈ S then S ∩ {ai, bi, ci, xi, yi} ≥ 2 since S intersects all induced odd cycles of the vertex gadget. Note that {xi, yi} intersects all odd cycles of the vertex gadget. Therefore, if S ∩ {ai, bi, ci, xi, yi} ≥ 2, then S′ := (S \ {ai, bi, ci}) ∪ {xi, yi} is an odd cycle transversal of G∗ with S′ ≤ S. We may therefore assume that for every i ∈ {1, . . . , n}, either bi ∈ S or {xi, yi} ⊆ S and there are no other vertices in S. Let BS = B ∩ S, XS = S ∩ X and YS = S ∩ Y . Then S = BS + SX + SY = n + SX . Let Q = Sxi∈S{vi}. Then Q = SX = S − n ≤ n + k − n = k. We claim that Q is a vertex cover of G. This can be seen as follows. Consider an edge vivj of G (without loss of generality assume i < j). Then {xi, yj, di,j } ∩ S ≥ 1, as S is an odd cycle transversal of G∗. By assumption on S, di,j /∈ S and if yj ∈ S then xj ∈ S. It follows that xi ∈ S or xj ∈ S and so vi ∈ Q or vj ∈ Q. We conclude that Q is a vertex cover of G of size at most k. It only remains to show that G∗ is (P2 + P5, P6)-free. Suppose, for contradiction, that H ∈ {P2 +P5, P6} is an induced subgraph of G∗. Every vertex in A∪C ∪D has degree 2 and its two neighbours are adjacent. Therefore no vertex in V (H) ∩ (A ∪ C ∪ D) is an internal vertex of a path of H. That is, if x ∈ V (H) ∩ (A ∪ C ∪ D) then x has degree 1 in H. Furthermore, A ∪ C ∪ D is an independent set in G∗. Hence, if H = P2 + P5, then at most one vertex of the P2 connected component of H can be in A ∪ C ∪ D. We conclude that G∗[V (H) ∩ (B ∪ X ∪ Y )] contains an induced subgraph H ′ on four vertices that is isomorphic to P1 + P3 if H = P2 + P5 or P4 if H = P6. Since Y is an independent set and B ∪ X is a perfect matching, H ′ must contain at least one vertex of B ∪ X and at least one vertex of Y . As Y is complete to B ∪ X, we find that H ′ contains either C4 or K1,3 as a (not necessarily induced) subgraph, a contradiction. ⊓⊔ This completes the proof. The proof of Theorem 9 gives a slightly stronger result if we assume the Exponential Time Hypothesis (ETH). The ETH is one of standard assumptions in complexity theory which, along with the sparsification lemma, implies that 3-Sat with n variables and m clauses cannot be solved in 2o(n+m) time [22,23]. The number of vertices in the graph G∗ constructed in the proof of Theorem 9 is 5n + m. Thus an algorithm solving (Connected) Odd Cycle Transversal on (P2 +P5, P6)-free graphs with n vertices in time 2o(n) could be used to solve Vertex Cover on graphs with n vertices and m edges in 2o(n+m) time. However, such a fast algorithm for Vertex Cover does not exist unless the ETH fails [11]. Thus we get the following statement. 16 Corollary 1. Odd Cycle Transversal and Connected Odd Cycle Transver- sal cannot be solved in 2o(n) time on (P2 + P5, P6)-free graphs with n vertices, unless the ETH fails. 6 Conclusions We proved polynomial-time solvability of Feedback Vertex Set and Odd Cycle Transversal on H-free graphs when H = sP1 + P3 and polynomial-time solvability of their connected variants on H-free graphs, when H = P4 or H = sP1 + P3; see also Table 1, where we place these results in the context of known results for these problems on H-free graphs. We also showed that Odd Cycle Transversal and Connected Odd Cycle Transversal are NP-complete on (P2 + P5, P6)-free graphs. Natural cases for future work are the cases when H = sP1 + P4 for s ≥ 1 and H = P5 for all four problems (in particular the case when H = P5 is the only open case for Odd Cycle Transversal and Connected Odd Cycle Transversal restricted to Pr-free graphs). Note that Lemma 2 does not hold on (sP1 + P4)-free graphs: the disjoint union of any number of arbitrarily large stars is even P4-free. Recall that Vertex Cover and Connected Vertex Cover are polynomial- time solvable even on (sP1 + P6)-free graphs [20] and (sP1 + P5)-free graphs [24], respectively, for every s ≥ 0. In contrast to the case for Odd Cycle Transversal and Connected Odd Cycle Transversal, it is not known whether there is an integer r for which any of the problems Vertex Cover, Feedback Vertex Set or their connected variants is NP-complete on Pr-free graphs. Determining whether such an r exists is an interesting open problem. We note that a similar complexity study has also been undertaken for the indepen- dent variants of the problems Feedback Vertex Set and Odd Cycle Transver- sal.7 In particular, Independent Feedback Vertex Set and Independent Odd Cycle Transversal are polynomial-time solvable on P5-free graphs [3], but their complexity status is unknown on P6-free graphs. It is not known whether there is an integer r such that Independent Feedback Vertex Set or Independent Odd Cycle Transversal is NP-complete on Pr-free graphs. We conclude that in order to make any further progress, we must better understand the structure of Pr-free graphs. This topic has been well studied in recent years, see also for example [17,19]. However, more research and new approaches will be needed. References 1. E. Balas and C. S. Yu. On graphs with polynomially solvable maximum-weight clique problem. Networks, 19(2):247 -- 253, 1989. 2. R. Belmonte, P. van 't Hof, M. Kamiński, and D. Paulusma. The price of connectivity for feedback vertex set. Discrete Applied Mathematics, 217:132 -- 143, 2017. 3. M. Bonamy, K. K. Dabrowski, C. Feghali, M. Johnson, and D. Paulusma. Independent feedback vertex set for P5-free graphs. Algorithmica, 81(4):1342 -- 1369, 2019. 4. A. Brandstädt and D. Kratsch. On the restriction of some NP-complete graph problems to permutation graphs. Proc. FCT 1985, LNCS, 199:53 -- 62, 1985. 5. A. Brandstädt, V. B. Le, and J. P. Spinrad. Graph Classes: A Survey, volume 3 of SIAM Monographs on Discrete Mathematics and Applications. SIAM, 1999. 6. E. Camby. Price of connectivity for the vertex cover problem and the dominating set problem: Conjectures and investigation of critical graphs. Graphs and Combinatorics, 35(1):103 -- 118, 2019. 7 Independent Vertex Cover can be seen as 2-Colouring, with the additional restric- tion that one of the colours can be used at most k times. This problem is polynomial-time solvable. 17 7. E. Camby, J. Cardinal, S. Fiorini, and O. Schaudt. The price of connectivity for vertex cover. Discrete Mathematics & Theoretical Computer Science, 16(1):207 -- 224, 2014. 8. E. Camby and O. Schaudt. The price of connectivity for dominating set: Upper bounds and complexity. Discrete Applied Mathematics, 177:53 -- 59, 2014. 9. J. Cardinal and E. Levy. Connected vertex covers in dense graphs. Theoretical Computer Science, 411(26 -- 28):2581 -- 2590, 2010. 10. N. Chiarelli, T. R. Hartinger, M. Johnson, M. Milanič, and D. Paulusma. Minimum connected transversals in graphs: New hardness results and tractable cases using the price of connectivity. Theoretical Computer Science, 705:75 -- 83, 2018. 11. M. Cygan, F. V. Fomin, L. Kowalik, D. Lokshtanov, D. Marx, M. Pilipczuk, M. Pilipczuk, and S. Saurabh. Parameterized Algorithms. Springer, 1st edition, 2015. 12. B. Escoffier, L. Gourvès, and J. Monnot. Complexity and approximation results for the connected vertex cover problem in graphs and hypergraphs. Journal of Discrete Algorithms, 8(1):36 -- 49, 2010. 13. C. Feghali, M. Johnson, G. Paesani, and D. Paulusma. On cycle transversals and their connected variants in the absence of a small linear forest. Proc. FCT 2019, LNCS, 11651:258 -- 273, 2019. 14. H. Fernau and D. F. Manlove. Vertex and edge covers with clustering properties: Com- plexity and algorithms. Journal of Discrete Algorithms, 7(2):149 -- 167, 2009. 15. M. R. Garey and D. S. Johnson. The rectilinear Steiner tree problem is NP-complete. SIAM Journal on Applied Mathematics, 32(4):826 -- 834, 1977. 16. M. R. Garey, D. S. Johnson, and L. J. Stockmeyer. Some simplified NP-complete graph problems. Theoretical Computer Science, 1(3):237 -- 267, 1976. 17. P. A. Golovach, M. Johnson, D. Paulusma, and J. Song. A survey on the computational complexity of colouring graphs with forbidden subgraphs. Journal of Graph Theory, 84(4):331 -- 363, 2017. 18. A. Grigoriev and R. Sitters. Connected feedback vertex set in planar graphs. Proc. WG 2009, LNCS, 5911:143 -- 153, 2010. 19. C. Groenland, K. Okrasa, P. Rzążewski, A. Scott, P. Seymour, and S. Spirkl. H-colouring Pt-free graphs in subexponential time. Discrete Applied Mathematics, in press. 20. A. Grzesik, T. Klimošová, M. Pilipczuk, and M. Pilipczuk. Polynomial-time algorithm for maximum weight independent set on P6-free graphs. Proc. SODA 2019, pages 1257 -- 1271, 2019. 21. T. R. Hartinger, M. Johnson, M. Milanič, and D. Paulusma. The price of connectivity for cycle transversals. European Journal of Combinatorics, 58:203 -- 224, 2016. 22. R. Impagliazzo and R. Paturi. On the complexity of k-SAT. Journal of Computer and System Sciences, 62(2):367 -- 375, 2001. 23. R. Impagliazzo, R. Paturi, and F. Zane. Which problems have strongly exponential complexity? Journal of Computer and System Sciences, 63(4):512 -- 530, 2001. 24. M. Johnson, G. Paesani, and D. Paulusma. Connected vertex cover for (sP1 + P5)-free graphs. Algorithmica, in press. 25. G. J. Minty. On maximal independent sets of vertices in claw-free graphs. Journal of Combinatorial Theory, Series B, 28(3):284 -- 304, 1980. 26. N. Misra, G. Philip, V. Raman, and S. Saurabh. On parameterized independent feedback vertex set. Theoretical Computer Science, 461:65 -- 75, 2012. 27. R. Mosca. Stable sets for (P6, K2,3)-free graphs. Discussiones Mathematicae Graph Theory, 32:387 -- 401, 2012. 28. A. Munaro. Boundary classes for graph problems involving non-local properties. Theo- retical Computer Science, 692:46 -- 71, 2017. 29. K. Okrasa and P. Rzążewski. Subexponential algorithms for variants of homomorphism problem in string graphs. Proc. WG 2019, LNCS, 11789, to appear. 30. S. Poljak. A note on stable sets and colorings of graphs. Commentationes Mathematicae Universitatis Carolinae, 15:307 -- 309, 1974. 31. P. L. K. Priyadarsini and T. Hemalatha. Connected vertex cover in 2-connected planar graph with maximum degree 4 is NP-complete. International Journal of Mathematical, Physical and Engineering Sciences, 2(1):51 -- 54, 2008. 32. N. Sbihi. Algorithme de recherche d'un stable de cardinalité maximum dans un graphe sans étoile. Discrete Mathematics, 29(1):53 -- 76, 1980. 18 33. E. Speckenmeyer. Untersuchungen zum Feedback Vertex Set Problem in ungerichteten Graphen. PhD thesis, Universität Paderborn, 1983. 34. S. Tsukiyama, M. Ide, H. Ariyoshi, and I. Shirakawa. A new algorithm for generating all the maximal independent sets. SIAM Journal on Computing, 6(3):505 -- 517, 1977. 35. S. Ueno, Y. Kajitani, and S. Gotoh. On the nonseparating independent set problem and feedback set problem for graphs with no vertex degree exceeding three. Discrete Mathematics, 72(1 -- 3):355 -- 360, 1988. 36. T. Watanabe, S. Kajita, and K. Onaga. Vertex covers and connected vertex covers in 3-connected graphs. Proc. IEEE International Sympoisum on Circuits and Systems 1991, 2:1017 -- 1020, 1991. A The Proof of Theorem 2 This appendix is for reviewing purposes only. We will adapt, in a straightforward way, the proof from [24] for showing that Connected Vertex Cover is polynomial- time solvable on (sP1 + P5)-free graphs for every s ≥ 1. We need the following definitions and lemmas. Let G = (V, E) be a graph. The contraction of an edge uv ∈ E deletes the vertices u and v and replaces them by a new vertex made adjacent to precisely those vertices that were adjacent to u or v in G (without introducing self-loops or multiple edges). Recall that a linear forest is the disjoint union of one or more paths. The following lemma is a straightforward observation. Lemma 5. Let H be a linear forest and let G be a connected H-free graph. Then the graph obtained from G after contracting an edge is also connected and H-free. We need the following lemmas given in [24]. Lemma 6 ([24]). Let s ≥ 0 and let G be a connected (sP1 + P5)-free graph. Then G has a connected dominating set D that is either a clique or has size at most 2s2 + s+ 3. Moreover, D can be found in O(n2s2+s+3) time. Lemma 7 ([24]). Let J be an independent set in a connected graph G such that J has a vertex y that is adjacent to every vertex of G − J. Let J ′ consist of those vertices of J \ {y} that have two adjacent neighbours in G − J (or equivalently, in G). Then a subset S of the vertex set of G is a connected vertex cover of G that contains J if and only if S \ J ′ is a connected vertex cover of G − J ′ that contains J \ J ′. We also need an auxiliary problem defined in [24]. Let G be a connected graph, let J ⊆ VG be a subset of the vertex set of G and let y be a vertex of J. We call say that a triple (G, J, y) is cover-complete if it has the following three properties: (a) J is an independent set; (b) y is adjacent to every vertex of G − J; (c) the neighbours of each vertex in J \ {y} form an independent set in G − J. This leads to the following optimization problem: Connected Vertex Cover Completion Instance: a cover-complete triple (G, J, y). Question: find a smallest connected vertex cover S of G such that J ⊆ S. We also need the following two lemmas. Lemma 8 ([24]). Let (G, {y}, y) be a cover-complete triple, where G is an (sP1 +P5)- free graph for some s ≥ 0. Then it is possible to compute a smallest connected vertex cover of G that contains y in O(ns+14) time. 19 Lemma 9 ([24]). For every s ≥ 0, Connected Vertex Cover Completion can be solved in O(n2s+19) time for cover-complete triples (G, J, y), where G is an (sP1 + P5)-free graph. We are now ready to prove Theorem 2, which we restate below. The proof mimics the proof of [24] and as mentioned at the start of this section, we include it only for reviewing purposes. Theorem 2 (restated). For every s ≥ 0, Connected Vertex Cover Extension can be solved in polynomial time on (sP1 + P5)-free graphs. Proof. Let G be an (sP1 + P5)-free graph on n vertices for some s ≥ 0 and let W ⊆ V (G) be a subset of vertices of G. We may assume without loss of generality that G is connected. By Lemma 6 we can first compute in O(n2s2+s+3) time a connected dominating set D that either has size at most 2s2 + s + 3 or is a clique. We note that, if D is a clique, any vertex cover of G contains all but at most one vertex of D. This leads to a case analysis where we guess the subset D∗ ⊆ D \ W of vertices not in a smallest connected vertex cover of G that contains W . That is, we choose a set of at most one vertex if D is a clique and a set of at most D \ W vertices otherwise, and eventually look at all such sets. As D \ W ≤ D ≤ 2s2 + s + 3 if D is not a clique, the number of guesses is O(n2s2+s+3). For each guess of D∗, we compute a smallest connected vertex cover SD∗ that contains all vertices of (D \ D∗) ∪ W and no vertex of D∗. Then, at the end, we return one that has minimum size overall. In particular we note that, since D is a connected dominating set of G, D ∪ W is also a connected dominating set of G. Let D∗ be a guess. Before we start our case analysis we first prove the following claim. Claim 1. We may assume, at the expense of an O(n16s3+4) factor in the running time, that D \ D∗ is connected. We prove Claim 1 as follows. Suppose D\D∗ is not connected. Recall that G[D] is either a complete graph or has size at most 2s2+s+3. In the first case, G[D\D∗] is connected. Hence, the second case applies so D has size at most 2s2 + s + 3. Let v ∈ D \ D∗. As G is (sP1 + P5)-free, G is also P5+2s-free. Hence, for each u ∈ D \ (D∗ ∪ {v}), every connected vertex cover of G contains a path of at most 5 + 2s − 1 vertices that connects u to v. We will guess all these u − v-paths (using only vertices from G − D∗) and add their vertices to D. As the number of paths is at most 2s2 + s + 2, this branching adds an O(n(5+2s−3)(2s2+s+2)) = O(n16s3+4) factor to our running time and increases our set D by at most 24s3 extra vertices. We have proven Claim 1. We distinguish two cases. Case 1. D∗ = ∅. We compute a minimum vertex cover S′ of G − (D ∪ W ) in polynomial time by Theorem 1. To be more precise, this takes O(ns+14) time by using the same arguments as in the proof of Lemma 8 (see [24]). Clearly S′ ∪ D ∪ W is a vertex cover of G. As D is a connected dominating set, S′ ∪ D ∪ W is even a connected vertex cover of G. Let S∅ = S′ ∪ D ∪ W . As S′ is a minimum vertex cover of G − (D ∪ W ), S∅ is a smallest connected vertex cover of G that contains all vertices of D ∪ W . We remember S∅. Note that S∅ is found in O(ns+14) time. Case 2. 1 ≤ D∗ ≤ D (recall that D ≤ 2s2 + s + 3). Recall that we are looking for a smallest connected vertex cover of G that contains every vertex of (D \ D∗) ∪ W , but does not contain any vertex of D∗. Hence D∗ must be an independent set, disjoint from W , and G − D∗ must be connected (if one of 20 these conditions is false, then we stop considering the guess D∗). Moreover, a vertex cover that contains no vertex of D∗ must contain all vertices of NG(D∗). Hence we can safely contract not only any edge between two vertices of (D \ D∗) ∪ W , but also any edge between two vertices in NG(D∗) or between a vertex of (D \ D∗) ∪ W and a vertex in NG(D∗). We perform edge contractions recursively and as long as possible while remembering all the edges that we contract. This takes O(n) time. Let G∗ be the resulting graph. Note that the set D∗ still exists in G∗, as we did not contract any edges with an endpoint in D∗. By Claim 1, the set D \ D∗ in G corresponds to exactly one vertex of G∗. We denote this vertex by y. The set W of G corresponds to an independent set of G∗. We denote this set by W ∗. We observe the following equivalence, which is obtained after uncontracting all the contracted edges. Claim 2. Every smallest connected vertex cover of G∗ that contains {y}∪W ∗ and that does not contain any vertex of D∗ corresponds to a smallest connected vertex cover of G that contains (D \ D∗) ∪ W and that does not contain any vertex of D∗, and vice versa. As we obtained G∗ in O(n) time, and we can also uncontract all contracted edges in O(n) time, Claim 2 tells us that we may consider G∗ instead of G. As G is connected and (sP1 + P5)-free, G∗ is also connected and (sP1 + P5)-free by Lemma 5. We write J ∗ = NG∗ (D∗) ∪ W ∗ and note that y belongs to NG∗ (D∗) ⊆ J ∗ as D is connected in G. We now consider the graph G∗ − D∗. As G − D∗ is connected, G∗ − D∗ is connected. By Claim 2, our new goal is to find a smallest connected vertex cover of G∗ − D∗ that contains J ∗. By our procedure, J ∗ is an independent set of G∗ − D∗. As D dominates G, we find that D \ D∗ dominates every vertex of G − D∗ that is not adjacent to a vertex of D∗. Hence the vertex y, which corresponds to the set D \ D∗, is adjacent to every vertex of (G∗ − D∗) − J ∗ in the graph G∗ − D∗. Let J ⊆ J ∗ consist of y and those vertices in J ∗ whose neighbourhood in G∗ −D∗ is an independent set. As y is adjacent to every vertex of (G∗ − D∗) − J ∗ in G∗ − D∗, and we can remember the set J ∗ \ J, we can apply Lemma 7 and remove J ∗ \ J. That is, it suffices to find a smallest connected vertex cover of the graph G′ = (G∗ −D∗)−(J ∗ \J) that contains J. As J ∗ is an independent set of G∗ − D∗, we find that J is an independent set of G′. By definition, y ∈ J. As y is adjacent to every vertex of (G∗ − D∗) − J ∗ in G∗ − D∗, we find that y is adjacent to every vertex in G′ − J. By definition, the neighbours of each vertex in J \ {y} form an independent set in G′ − J. Hence the triple (G′, J, y) is cover-complete. This means that we can apply Lemma 9 to find in O(n2s+19) time a smallest connected vertex cover S′ of G′ that contains J. We translate S′ in constant time into a smallest connected vertex cover S∗ of G∗ − D∗ that contains J ∗ by adding J ∗ \ J to S′. We translate S∗ in O(n) time into a smallest connected vertex cover SD∗ of G that contains (D \ D∗) ∪ W but no vertex of D∗ by uncontracting any contracted edges. It takes O(n2s+19) time to find the set SD∗ . As mentioned, at the end we pick a smallest set of the sets SD∗ . This set is then a smallest connected vertex cover of G that contains W . As there are O(n2s2+s+3 · n16s3+4) such sets, each of which is found in O(n2s+19) time, the total running time is O(n21s3+26). The correctness of our algorithm follows immediately from the above ⊓⊔ case analysis and the description of the cases. Note that the algorithm given in Theorem 2 not only solves the decision problem, but also finds a minimum connected vertex cover of a given (sP1 + P5)-free graph in polynomial time. 21
1309.1645
1
1309
2013-09-06T14:06:14
Fast ranking algorithm for very large data
[ "cs.DS" ]
In this paper, we propose a new ranking method inspired from previous results on the diffusion approach to solve linear equation. We describe new mathematical equations corresponding to this method and show through experimental results the potential computational gain. This ranking method is also compared to the well known PageRank model.
cs.DS
cs
Fast ranking algorithm for very large data Dohy Hong Alcatel-Lucent Bell Labs Route de Villejust 91620 Nozay, France {dohy.hong}@alcatel-lucent.com 3 1 0 2 p e S 6 ] S D . s c [ 1 v 5 4 6 1 . 9 0 3 1 : v i X r a Abstract—In this paper, we propose a new ranking method inspired from previous results on the diffusion approach to solve linear equation. We describe new mathematical equations corresponding to this method and show through experimental results the potential computational gain. This ranking method is also compared to the well known PageRank model. Keywords-Large sparse matrix, Iteration, Fixed point, PageR- ank, Ranking. I. INTRODUCTION Inspired from the previous research results on the diffusion approach [2], [4] to solve fixed point problem in linear algebra, we propose here a new data ranking definition and algorithm. This result can be seen as a mix of PageRank solution [5], diffusion approach [2] and path diversity idea [3]. In Section II, we define the notations and the theoretical framework. Section III show the first experimental results, including the comparison to PageRank ranking. II. ALGORITHM DESCRIPTION A. Notations We will use the following notations: • P ∈ IRN ×N a real matrix; • I ∈ IRN ×N the identity matrix; • Ji the matrix with all entries equal to zero except for the i-th diagonal term: (Ji)ii = 1; • Ω = {1, .., N }; • I = {i1, i2, .., in, ...} the sequence of nodes for the update (diffusion): ik ∈ Ω; • E = (1, .., 1)T ∈ IRN ; • L1-norm: if X ∈ IRN , X = PN We assume that P is the matrix associated to the directed the graph on Ω, for instance, transition matrix multiplied by the damping factor [5]). the PageRank matrix (i.e. i=1 xi; B. Fast ranking algorithm The proposed ranking algorithm is based on the iteration of the double equations on history Hn and fluid Fn vectors: H0 = 0 Hn = Hn−1 + Jin ((int)Fn−1) and F0 = α.(1, .., 1)T Fn = Fn−1 + (P − I)Jin ((int)Fn−1). (1) (2) The above equations can be easily interpreted as: we apply exactly the algorithm of D-iteration [2], but we only diffuse the integer part of fluids. The Jacobi iterations of the above equations are defined by: Hn = Hn−1 + (int)Fn−1 Fn = Fn−1 + (P − I)((int)Fn−1). If P is a non negative matrix with spectral radius less than unity, it is obvious to see that Fn and Hn converge (Hn is non- decreasing bounded by PageRank vector) in a finite number of steps (if not, Hn would be unbounded) and the proposed ranking (FR) method is based on H∞+F∞. F∞ can be seen as a tie-breaker, but one may also use H∞. One may also consider a personalized PageRank flavour extension replacing F0 by any other initial vector V . One of this approach’s advantage is to be not very dependent on the choice of the damping factor, both for the ranking and the computation speed (cf. Table II). To solve the above equations, we will apply the diffusion approach [2]. This means in particular that this computation method will be naturally suited for the asynchronous parallel computation, as it was for D-iteration. Note that if one would diffuse all fluid retained in F∞, H∞ would be exactly the PageRank vector. The motivations of using (int)Fn−1 instead of Fn−1 are: • ranking quality improvement: indeed, as it has been shown in [3], we think that the original PageRank vector may be too much influenced by what we could call self- estimation. In presence of loops (self-loop or loops of longer length), a part of scores that are inherited will be returned to the sender, which is not necessarily the desired property; • computation/convergence acceleration cf. Figure 1; • computation/convergence acceleration for the ranking up- dates when the graph (or matrix P) evolves in time. If α goes to infinity, the proposed ranking vector converges to PageRank vector. Therefore, PageRank can be seen as a particular case α → ∞ of our model where α tunes the desired influence of loops on the ranking score. Finally, we have also the following interesting bound on the error: Theorem 1: (1−d) αN H∞ is an approximation of the PageRank vector with L1-norm error bounded by 1/(α − 1). Proof: The proof is based on the monotone property of the diffusion. If we denote by H(αE, β) the limit of FI with initial condition αE and diffusion of the β-integer part of Fn: (int)(Fn/β) × β, then we have H(αE, 1) = αH(E, 1/α) = α2H(E/αE, 1/α2) etc. Let’s call X the PageRank vector. Then, X can be obtained from the diffusion of F (αE, 1) plus H(αE, 1). Note that the diffusion of F (αE, 1) can be denoted by H(F (αE, 1), 0) (implying X = H((1−d)/N E, 0) = (1− d)/N H(E, 0)). Now using H(F (αE, 1), 0) ≤ H(E, 0), we have: H(αE, 1) ≤ αN (1 − d) and X = H(αE, 1) + H(F (αE, 1), 0) H(αE, 1) ≤ αN (1 − d) X ≤ H(αE, 1) + H(E, 0). Then applying FI in 1/α-integer part and the same inequality recursively, we obtain: H(αE, 1) ≤ αN (1 − d) X ≤H(αE, 1) + H(E, α−1) + H(α−1E, α−2) + ... Therefore H(αE, 1) ≤ αN (1 − d) And X ≤H(αE, 1) (cid:0)1 + α−1 + α−2 + ...(cid:1) = α α − 1 H(αE, 1) 0 ≤ αN (1 − d) X − H(αE, 1) ≤ 1 α − 1 H(αE, 1) which can be rewritten as: 0 ≤ X − (1 − d) αN H(αE, 1) ≤ 1 (1 − d) α − 1 αN H(αE, 1). Since H(αE, 1) ≤ αN/(1 − d), we have: X − (1 − d) αN (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) H(αE, 1) (cid:12) (cid:12) ≤ 1 α − 1 . This means that choosing α = 1000 would gives an error very close to 0.1% for norm L1 but also for each coordinate (the exact bound is 1/999 = 0.001001001...). Note that we also have: (1 − d) (cid:12) (cid:12) X − (cid:12)(cid:12) ≤ 1 αN − (cid:12) (cid:12) (H(αE, 1) + F (αE, 1)) (cid:12)(cid:12) 1 − d F (E, α−1). α − 1 III. EXPERIMENTAL EVALUATION N For the experimental evaluation purpose, we took the web graph imported from the dataset uk-2007-05 @1000000 (available on [1]) which has 41,247,159 links on 106 nodes. Below we vary N from 103 to 106 extracting from the the information on the first N nodes. Few graph dataset properties are summarized in Table I: • L: number of non-null entries (links) of P ; • D: number of dangling nodes (0 out-degree nodes); N 103 104 105 106 L/N 12.9 12.5 31.4 41.2 D/N 0.041 0.008 0.027 0.046 E/N 0.032 0.145 0.016 0 O/N 0.236 0.114 0.175 0.204 maxin maxout 716 7982 34764 403441 130 751 3782 4655 TABLE I EXTRACTED GRAPH: N = 103 TO 106. d 0.85 0.9 0.99 0.999 Jacobi 26 36 330 5076 DI 12 17 101 548 FI (α = 1) FI (α = 2) FI (α = 10) 1.72 1.99 3.60 15.3 TABLE II 3.12 3.94 19.6 92.7 6.97 9.55 53.1 258 COMPUTATION COST: N = 103. IMPACT OF DAMPING FACTOR. COMPUTATION COST: NUMBER OF USE OF COORDINATES OF P DIVIDED BY L. • E: number of 0 in-degree nodes: the 0 in-degree nodes are defined recursively: a node i, having incoming links from nodes that are all 0 in-degree nodes, is also a 0 in-degree node; from the diffusion point of view, those nodes are those who converged exactly in finite steps; • O: number of loop nodes (pii 6= 0); • maxin = maxi #ini (maximum in-degree, the in-degree of i is the number of non-null entries of the i-th line vector of P ); • maxout = maxi #outi (maximum out-degree, the out- degree of i is the number of non-null entries of the i-th column vector of P ). Table II shows the comparative evaluation of the computa- tion cost in number of iterations (one iteration is here defined as a use of L coordinates of P in the computation) with a target precision of 1/N (for L1 norm). We compared the Jacobi iteration, D-iteration (DI, cf. [2]) and the fast ranking algorithm (FI) we propose in this paper. The convergence becomes very slow when the damping factor d is being close to 1 to compute the PageRank vector, whereas our ranking vector can be obtained very efficiently whatever the choice of d. Figure 1 shows the convergence speed (in number of iterations) of Jacobi, D-iteration (DI) and the proposed (FI) methods: our approach reaches the limit in all cases in less than 2.2 iterations. The convergence efficiency is simply not comparable. Figures 2 and 3 compare the ranking results obtained with FR (using H + F ), LOC (local computation: rank equal to the number of incoming links) to PageRank vector on the top x%: on y-axis, it counts the number of common nodes in the top x% between two ranking methods, then it is divided by the number of compared elements (nodes). The fifth curve shows the common elements proportion we observe between two PageRank vectors using a damping factor of 0.9 and 0.8. Our FR ranking vector can be seen as an approximation of PageRank vector, since it converges to PageRank vector for n o i t c a r f : s t n e m e e l n o m m o C 1 0.9 0.8 0.7 0.6 0.5 0.4 0 Top X%: FR (alpha=1) vs PR Top X%: FR (alpha=2) vs PR Top X%: FR (alpha=10) vs PR Top X%: PR vs LOC Top X%: PR(d=0.8) vs PR(d=0.9) 10 20 30 40 50 60 70 80 90 100 Top X% Fig. 3. N = 106: proportion of common elements between FR (proposed) and PR (PageRank) in top x% ranked sites. Applying the diffusion method on this new ranking vector, we showed that a very efficient computation can be obtained while targeting a relevant ranking score as PageRank. REFERENCES [1] http://law.dsi.unimi.it/datasets.php. [2] D. Hong. D-iteration method or how to improve gauss-seidel method. arXiv, http://arxiv.org/abs/1202.1163, February 2012. Statistical [3] D. Hong. reliability and path diversity based pagerank algorithm improvements. arXiv, http://arxiv.org/abs/1202.2393, Feb 2012. [4] D. Hong, F. Mathieu, and G. Burnside. Convergence of the d-iteration algorithm: convergence rate and asynchronous distributed scheme. arXiv, http://arxiv.org/abs/1301.3007, January 2013. [5] L. Page, S. Brin, R. Motwani, and T. Winograd. The pagerank citation ranking: Bringing order to the web. Technical Report Stanford University, 1998. Jacobi: N=1000 Jacobi: N=10000 Jacobi: N=100000 Jacobi: N=1000000 FI: N=1000 FI: N=10000 FI: N=100000 FI: N=1000000 DI: N=1000000 10 1 0.1 0.01 r o r r E 0.001 0.0001 1e-05 1e-06 1e-07 0 10 20 30 40 Nb of iterations 50 60 70 Fig. 1. Convergence speed comparison. large α: however, by its definition, it tends to eliminate self- ranking aspects due to the presence of loops (a part of scores that I give to children nodes is coming back to me). Therefore, the parameter α is meant to tune the influence of loops in the ranking score and PageRank can be seen as a particular case α → ∞. Globally, we see that our ranking vector preserves very well the top ranked web sites (for N = 106, we see that α = 2 is close enough already to PageRank vector, always above 92%), because they are likely to be pointed by many different and relevant other web sites: FR ranking vector includes by its definition features and ideas of the path diversity mechanism proposed in [3], when α is closer to 1, but with a computation cost that is greatly reduced (whereas the ideas in [3] requires more computation cost than PageRank vector computation). Even though it is hard to justify theoretically, the author believe that a choice of α between 1 and 2 are the most appropriate in terms of the optimal compromise between computation cost and ranking relevancy. n o i t c a r f : s t l n e m e e n o m m o C 1 0.9 0.8 0.7 0.6 0.5 0.4 0 Top X%: FR (alpha=1) vs PR Top X%: FR (alpha=2) vs PR Top X%: FR (alpha=10) vs PR Top X%: PR vs LOC Top X%: PR(d=0.8) vs PR(d=0.9) 10 20 30 40 50 60 70 80 90 100 Top X% Fig. 2. N = 103: proportion of common elements between FR (proposed) and PR (PageRank) in top x% ranked sites. IV. CONCLUSION In this paper, we proposed a new data ranking method and compared its efficiency to the computation of PageRank vector.
1011.2843
2
1011
2010-11-22T15:11:33
Improved Minimum Cuts and Maximum Flows in Undirected Planar Graphs
[ "cs.DS" ]
In this paper we study minimum cut and maximum flow problems on planar graphs, both in static and in dynamic settings. First, we present an algorithm that given an undirected planar graph computes the minimum cut between any two given vertices in O(n log log n) time. Second, we show how to achieve the same O(n log log n) bound for the problem of computing maximum flows in undirected planar graphs. To the best of our knowledge, these are the first algorithms for those two problems that break the O(n log n) barrier, which has been standing for more than 25 years. Third, we present a fully dynamic algorithm that is able to maintain information about minimum cuts and maximum flows in a plane graph (i.e., a planar graph with a fixed embedding): our algorithm is able to insert edges, delete edges and answer min-cut and max-flow queries between any pair of vertices in O(n^(2/3) log^3 n) time per operation. This result is based on a new dynamic shortest path algorithm for planar graphs which may be of independent interest. We remark that this is the first known non-trivial algorithm for min-cut and max-flow problems in a dynamic setting.
cs.DS
cs
Improved Minimum Cuts and Maximum Flows in Undirected Planar Graphs Giuseppe F. Italiano∗ Piotr Sankowski† November 3, 2018 Abstract In this paper we study minimum cut and maximum flow problems on planar graphs, both in static and in dynamic settings. First, we present an algorithm that given an undirected planar graph computes the minimum cut between any two given vertices in O(n log log n) time. Second, we show how to achieve the same O(n log log n) bound for the problem of computing maximum flows in undirected planar graphs. To the best of our knowledge, these are the first algorithms for those two problems that break the O(n log n) barrier, which has been standing for more than 25 years. Third, we present a fully dynamic algorithm that is able to maintain information about minimum cuts and maximum flows in a plane graph (i.e., a planar graph with a fixed embedding): our algorithm is able to insert edges, delete edges and answer min-cut and max-flow queries between any pair of vertices in O(n2/3 log3 n) time per operation. This result is based on a new dynamic shortest path algorithm for planar graphs which may be of independent interest. We remark that this is the first known non-trivial algorithm for min-cut and max-flow problems in a dynamic setting. 0 1 0 2 v o N 2 2 ] S D . s c [ 2 v 3 4 8 2 . 1 1 0 1 : v i X r a ∗Dipartimento di "Tor Vergata", [email protected]. Work partially supported by the 7th Framework Programme of the EU (Net- work of Excellence "EuroNF: Anticipating the Network of the Future - From Theory to Design") and by MIUR, the Italian Ministry of Education, University and Research, under Project AlgoDEEP. Informatica, Produzione, University of Rome Sistemi e †Institute of Informatics, University of Warsaw and Department of Computer and System Science, Sapienza University of Rome, [email protected]. 1 Introduction Minimum cut and maximum flow problems have been at the heart of algorithmic research on graphs for over 50 years. Particular attention has been given to solving those problems on planar graphs, not only because they often admit faster algorithms than general graphs but also since planar graphs arise naturally in many applications. The pioneering work of Ford and Fulkerson [3, 4], which introduced the max-flow min-cut theorem, also contained an elegant algorithm for comput- ing maximum flows in (s, t)-planar graphs (i.e., planar graphs where both the source s and the sink t lie on the same face). The algorithm was implemented to work in O(n log n) time by Itai and Shiloach [9]. Later, a simpler algorithm for the same problem was given by Hassin [6], who reduced the problem to single-source shortest path computations in the dual graph. The time required to compute single-source shortest paths in (s, t)-planar graphs was shown to be O(n√log n ) by Frederickson [5] and later improved to O(n) by Henzinger et al. [8]. As a result, minimum cuts and maximum flows can be found in O(n) time in (s, t)-planar graphs. Itai and Shiloach [9] generalized their approach to the case of general planar (i.e., not only (s, t)-planar) graphs, by observing that the minimum cut separating vertices s and t in a planar graph G is related to the minimum cost cycle that separates faces fs and ft (corresponding to vertices s and t) in the dual graph. The resulting algorithm makes O(n) calls to their original algorithm for (s, t)-planar graphs and thus runs in a total of O(n2 log n) time. In the case of undi- rected planar graphs, Reif [13] improved this bound by describing how to find the minimum cost separating cycle with a divide-and-conquer approach using only O(log n) runs of the (s, t)-planar algorithm: this yields an O(n log2 n) time to compute a minimum cut for undirected planar graphs. Later on, Frederickson [5] improved the running time of Reif's algorithm to O(n log n). The same result can be obtained by using more recent planar shortest path algorithms (see e.g., [8]). Hassin and Johnson [7] extended the minimum cut algorithm of Reif to compute a maximum flow in only O(n log n) additional time: this implies an undirected planar maximum flow algorithm that runs in O(n log n) time as well. In summary, the best bound known for computing minimum cuts and maximum flows in planar undirected graphs is O(n log n). The first contribution of this paper is to improve to O(n log log n) the time for computing minimum cuts in planar undirected graphs. To achieve this bound, we improve Reif's classical approach [13] with several novel ideas. To compute a minimum s-t cut in a planar graph G, we first identify a path π between face fs (corresponding to vertex s) and face ft (corresponding to vertex t) in the dual graph GD. Next, we compute a new graph Gπ as follows. We cut GD along path π, so that the vertices and edges of π are duplicated and lie on the boundary of a new face: another copy of the same cut graph is embedded inside this face. We show that minimum separating cycles in GD correspond to some kind of shortest paths in Gπ. Applying a divide-and-conquer approach on the path π yields the same O(n log n) time bound as previously known algorithms [5, 7, 13]. However, our novel approach has the main advantage that it allows the use of any path π in the dual graph GD, while previous algorithms were constrained to choose π as a shortest path. We will exploit the freedom implicit in the choice of this path π to produce a faster O(n log log n) time algorithm, by using a suitably defined cluster decomposition of a planar graph, combined with the Dijkstra-like shortest path algorithm by Fakcharoenphol and Rao [2]. Our second contribu- tion is to show that also maximum flows can be computed in undirected planar graphs within the same O(n log log n) time bound. We remark that this is not an immediate consequence of our new minimum cut algorithm: indeed the approach of Hassin and Johnson [7] to extend minimum cut algorithms to the problem of computing maximum flows has a higher overhead of O(n log n). To get improved maximum flow algorithms, we have to appropriately modify the original technique of Hassin and Johnson [7]. To the best of our knowledge, the algorithms presented in this paper are 1 the first algorithms that break the O(n log n) long-standing barrier for minimum cut and maximum flow problems in undirected planar graphs. As our third contibution, we present a fully dynamic algorithm that is able to maintain infor- mation about minimum cuts and maximum flows in a plane graph (i.e., a planar graph with a fixed embedding): our algorithm is able to insert edges, delete edges and answer min-cut and max-flow queries between any pair of vertices in O(n2/3 log3 n) time per operation. This result is based on the techniques developed in this paper for the static minimum cut algorithm and on a new dynamic shortest path algorithm for planar graphs which may be of independent interest. We remark that this is the first known non-trivial algorithm for min-cut and max-flow problems in a dynamic setting. 2 Minimum Cuts in Planar Graphs Let G = (V, E, c) be a planar undirected graph where V is the vertex set, E is the edge set and c : E → R+ is the edge capacity function. Let the planar graph G be given with a certain embed- ding. Using the topological incidence relationship between edges and faces of G, one can define the dual graph GD = (F, ED, cD) as follows. Each face of G gives rise to a vertex in F . Dual vertices f1 and f2 are connected by a dual undirected edge eD whenever primal edge e is adjacent to the faces of G corresponding to f1 and f2. The weight cD(eD) of the dual edge eD is equal to the weight c(e) of the primal edge: cD(eD) is referred to as the length of edge eD. In other terms, the length of the dual edge eD is equal to the capacity of the primal edge e. In the following, we refer to G as the primal graph and to GD as its dual. Throughout the paper we will refer to vertices of the dual graph GD interchangeably as (dual) vertices or faces. Note that GD can be embedded in the plane by placing each dual vertex inside the corresponding face of G, and placing dual edges so that each one crosses only its corresponding primal edge. Thus, the dual graph is planar as well, although it might contain multiple edges and self loops. In simpler terms, the dual graph GD of a planar embedded graph G is obtained by exchanging the roles of faces and vertices, and G and GD are each other's dual. Figure 1 shows an embedded planar graph G and its dual GD. Let s and t be any two vertices of G (not necessarily on the same face). We consider the problem of finding a minimum cut in G between vertices s and t. Let C be a cycle of graph G: we define the interior of C, denoted by int(C), to be the region inside C and including C in the planar embedding of the graph G. We can define the exterior ext(C) of the cycle C in a similar fashion. A cycle C in GD is said to be a cut-cycle if int(C) contains exactly s but not t. The following lemma was proven by Johnson [10]. Lemma 1. A minimum s-t cut in G has the same cost as a minimum cost cut-cycle of GD. The lemma follows by the observation that for any cut-cycle C the faces of GD inside int(C) give a set of vertices S in G which defines a cut separating s and t. Note that Lemma 1 gives an equivalence between min-cuts in the primal graph G and minimum cost cut-cycles in the dual graph GD. By using a divide-and-conquer approach, this equivalence can be turned into an efficient al- gorithm for finding flows in undirected planar graphs [13]. The resulting algorithm, combined with more recent results on shortest paths in planar graphs [8], is able to work in a total of O(n log n) time. However, this approach seems to inherently require O(n log n) time, and does not seem to leave margin for improvements. In the next section, we will present a completely different and more flexible approach, which will yield faster running times. 2.1 Computing Min-Cuts Let fs and ft be arbitrary inner faces incident to s and to t respectively. Find any simple path π from fs to ft in GD. The path π can be viewed as connecting special vertices in the dual graph 2 corresponding to s and t. Hence, any s-t cut needs to cross this path, because it splits s from t. Let π traverse dual vertices f1, . . . , fk, where f1 = fs and fk = ft. Let us look at the path π as a horizontal line, with fs on the left and ft on the right (see Figure 2(b)). An edge eD 6∈ π in GD such that eD is incident to some face fi, 1 ≤ i ≤ k, can be viewed as connected to fi from below or from above. We now define a new graph G′π, by cutting GD along path π, so that the vertices and edges of π are duplicated and lie on the boundary of a new face. This is done as follows. Let π′ be a copy of π, traversing new vertices f′1, f′2, . . . , f′k. Then G′π is the graph obtained from GD by reconnecting to f′i edges entering fi from above, 1 ≤ i ≤ k (see Figure 2(c)). Let G′′π be a copy of G′π. Turn over the graph G′′π to make the face defined by π and π′ to be the outer face (see Figure 2(d)). Now, identify vertices on the path π′ (respectively π) in G′′π with the vertices on the path π (respectively π′) in G′π. Denote the resulting graph as Gπ (see Figure 2(e)). Note that the obtained graph Gπ is planar. We define an fi-cut-cycle to be a cut-cycle in GD that includes face fi and does not include any face fj for j > i. The proof of the following lemma is immediate. Lemma 2. Let Ci be a minimum fi-cut-cycle in GD for i = 1, . . . , k. Then Ci with minimum cost is a minimum cut-cycle in GD. A path ρ between fi and f′i in Gπ is said to be fi-separating if ρ contains neither fj nor f′j, for j > i. We say that a cycle C in GD touches path π in face fi if two edges on C incident to fi go both up or both down, whereas we say that C crosses π in face fi if one of these edges goes up, whereas the other goes down. Lemma 3. The cost of a minimum fi-cut-cycle in GD is equal to the length of a shortest fi- separating path in Gπ. Proof. Let C be some fi-cut-cycle in GD: we show that there must be some fi-separating path ρ in Gπ having the same cost as C. Note that the fi-cut-cycle C must either cross or touch the path π in face fi. First, assume that C crosses π in fi. Note that in this case C has to cross the path π an even number of times (excluding fi), as otherwise C would not separate s from t (see Figure 3(a)). We can go along C starting from fi in the graph Gπ and each time when C crosses π in GD, we switch between G′π and G′′π in Gπ. Hence, due to parity of the number of crossings with π, this will produce a resulting path ρ in Gπ which must end in f′i (see Figure 3(b)). Second, assume that C touches π in fi. Then C has to cross path π an odd number of times (see Figure 3(c)). Again if we trace C starting from fi in Gπ we will produce a path ρ in Gπ ending up in f′i (see Figure 3(d)). Moreover, since C is a fi-cut-cycle in GD, it cannot contain by definition any face fj, for j > i: consequently, in either case the resulting path ρ in Gπ will contain neither fj nor f′j, for j > i. Conversely, let ρ be some fi-separating path in Gπ: we show that there must be some fi-cut- cycle C in GD having the same cost as ρ. First, assume that ρ enters fi and f′i using edges from the same graph, i.e., either G′π or G′′π. If this is the case, then the two edges must be such that one is from above and the other is from below. By tracing ρ in GD we obtain a cycle C that crosses π in fi. This cycle does not need to be simple, but it has to cross π an odd number of times (including the crossing at fi), as each time when C crosses π the path ρ must switch between G′π and G′′π. Hence, C must be a cut-cycle. Second, assume that ρ enters fi and f′i using edges from different graphs, i.e., one edge from G′π and the other edge from G′′π. If this is the case, then the two edges must be both from above or both from below. Consider first the case where ρ leaves fi from above using an edge from G′′π, and enters f′i from above using an edge from G′π (see Figure 3(d)). This time we get a cut-cycle C touching π in fi and intersecting π an odd number of times. The case where ρ leaves fi from below using an edge from G′π, and enters f′i from below using an edge from G′′π is completely analogous (see Figure 3(f)). Once again, since ρ is an fi-separating path in Gπ, in any case the resulting cut cycle C will not contain fj, for j > i. 3 Note that, having constructed the graph Gπ, we can find the shortest fi-separating path by simply running Dijkstra's algorithm on Gπ where we remove all faces fj and f′j for j > i. By Lem- mas 1, 2 and 3, the linear-time implementation of Dijkstra's algorithm known for planar graphs [8] implies an O(n2) time algorithm for computing minimum cuts in planar graphs. There is a more efficient way of computing minimum cuts that goes along the lines of Reif's recursive algorithm [13]. Before describing this approach, we need to prove some non-crossing properties of fi-cut-cycles. Lemma 4. For i < j, let Ci be a minimum fi-cut-cycle in GD, and let Cj be a minimum fj-cut- cycle in GD. Then there exists a cut cycle C ⊆ int(Ci) ∩ int(Cj) in GD such that c(C) ≤ c(Ci). Proof. If Ci ⊆ int(Cj) then C = Ci and the lemma follows trivially. On the other hand, it is impossible that Cj ⊆ int(Ci) because in this case Ci would include some face fk on π for k ≥ j > i. The only possibility left is that Ci * int(Cj) and Cj * int(Ci). In this case, there must exist a subpath pi of Ci from fa to fb such that pi intersects int(Cj) only at fa and fb. Let pj be the subpath of Cj going from fa to fb (see Figure 4). We claim that c(pj) ≤ c(pi). Indeed, suppose by contradiction that c(pj) > c(pi), and let C′j be the cycle obtained from Cj after replacing path pj with pi. Then the cycle C′j is shorter than Cj. Moreover, since Ci does not include any face fk for k > i, also C′j cannot include any face fk for k > j > i. As a consequence, the cycle C′j is an fj-cut-cycle in GD, with c(C′j ) < c(Cj), contradicting our assumption that Cj is a minimum fj-cut-cycle in GD. Since c(pj) ≤ c(pi), replacing path pi on Ci with the path pj yields a cycle C′i, with c(C′i) ≤ c(Ci). As long as C′i * int(Cj) and Cj * int(C′i) we can repeat this procedure. At the end, we will obtain a cycle C ⊆ int(Ci) ∩ int(Cj), such that c(C) ≤ c(Ci). Moreover, the obtained cycle C will be a cut-cycle, as int(Ci) ∩ int(Cj) contains s. Lemma 5. For i < j, let Ci be a minimum fi-cut-cycle in GD, and let Cj be a minimum fj-cut- cycle in GD. Then, for some i′ ≤ i, there exists a minimum fi′-cut-cycle Ci′ ⊆ int(Cj) such that c(Ci′) ≤ c(Ci). Proof. Consider the cut-cycle C contained inside int(Ci)∩ int(Cj) as given by Lemma 4, for which we know that c(C) ≤ c(Ci). As C ⊆ int(Ci), C cannot contain any fk such that k > i. Hence, it is an fi′-cut-cycle for some i′ ≤ i. The minimum fi′-cut-cycle Ci′ is shorter than C and consequently it is shorter than Ci. If Ci′ ⊆ int(Cj), the lemma follows. Otherwise, we can apply Lemma 4 to produce another minimum fi′′-cut-cycle contained in int(Cj) such that c(Ci′′) ≤ c(Ci), for some i′′ ≤ i′ ≤ i. The above lemma shows that each computed cut splits the graph into two parts, the interior and the exterior part of the cut, which can be handled separately. Hence, we can use a divide and conquer approach on the path π. We first find a minimum cut-cycle that contains the middle vertex on the path π. Then we recurse on both parts of the path, so there will be O(log n) levels of recursion in total. In this recursion we will compute minimum cost s-t cuts for all vertices on π. By Lemma 3, we compute a minimum fi-cut-cycle for some fi by finding a shortest path in the planar graph Gπ. Then we need to divide the graph into the inside and the outside of the cut. The vertices on the minimum cut need to be included into both parts, so we need to take care that the total size of the parts does not increase too much. This can be done in a standard way as described by Reif [13] or by Hassin and Johnson [7]. Their technique guarantees that on each level of the recursion the total size of the parts is bounded by O(n). Hence, using the O(n)-time algorithm [8] for shortest paths we get an O(n log n) time algorithm for finding minimum cuts in planar graphs. Although this approach yields the same time bounds as previously known algorithms [7, 13], it has the main advantage to allow the use of any path π in GD, while previous algorithms were constrained to choose π as a shortest path. As shown in the next section, we can even allow the path π to be 4 non-simple. In Section 3 we will show how to exploit the freedom implicit in the choice of the path π to produce a faster O(n log log n) time algorithm for finding minimum cuts in planar graphs. 2.2 Using Non-simple Paths Let π = (v1, . . . , vℓ) be a non-simple path and let v be a vertex appearing at least twice on the path π, i.e., v = vi = vj for some i < j. We say that the path π is self-crossing in v if the edges incident to v on π appear in the following circular order (vi−1, vi), (vj−1, vj), (vi, vi+1), (vj, vj+1) in the embedding. We say that a path π is self-crossing if π is self-crossing in some vertex v. Otherwise we say that π is non-crossing. If a vertex v appears at least twice on a non-crossing path π than we say that π touches itself in v. In the previous section we assumed that the path π from fs to ft in GD was simple, now we will show that we only need the weaker assumption that π is non-crossing. In order to work with non-crossing paths we will modify the graph GD to make the path π simple. Let v = vi be a face where π touches itself in GD. Note that there is no other edge from π between the edges (vi−1, vi), (vi, vi+1) in the circular order around v given by the embedding. Take all edges Ev incident to v that are embedded between and including the edges (vi−1, vi), (vi, vi+1). Now, add a new face v′ to GD and make the edges Ev to be incident with v′ instead of v. Finally connect v with v′ using an undirected edge of length zero (see Figure 5). Let π be a non-crossing path: perform this vertex-splitting operation until π becomes a simple path. This produced a new graph GD,π. Note that this transformation does not change the lengths of cut-cycles, so we get the following observation. Corollary 6. The lengths of minimum fi-cut-cycles in GD and GD,π are the same. As a result, if π is a non-simple non-crossing path, instead of running our algorithm on GD, we can compute the graph GD,π and run our algorithm on GD,π. 3 Cluster Partitions Our algorithms are based on a particular cluster decomposition. We start by presenting the ideas behind this cluster decomposition and then show how this decomposition can be effectively ex- ploited for computing min-cuts. From now on, we assume that we are given a graph for which the dual graph has vertex degree at most three. This is without loss of generality, since it can be obtained by triangulating the primal graph with zero capacity edges. Let n be the number of vertices of G. We first define a cluster partition of G into edge clusters which will be used by our algorithm. In the cluster partition the graph is decomposed into a set of cluster P such that each edge of G is included into exactly one cluster. Each cluster contains two types of vertices: internal vertices, and border vertices. An internal vertex is adjacent only to vertices in the same cluster, while a border vertex is adjacent to vertices in different clusters. A hole in a cluster is any face (including the external face) containing only boundary vertices. We denote by ∂P the set of border vertices of a cluster P . We define an r-partition of an n-node graph to be a cluster partition that contains at most O( n r ) clusters, each containing at most r vertices, O(√r ) border vertices and a constant number of holes. The proof of the following lemma is in Appendix A. It is based on ideas of Frederickson [5], who constructed a similar partition without the bound on the number of holes. Lemma 7. An r-partition of an n-node planar graph can be computed in O(n log r + n√r log n) time. We use the r-partition to define a representation for shortest paths in a graph that has similar number of edges, but fewer vertices. In order to achieve this, we use the notion of dense distance 5 graphs. A dense distance graph for a cluster C is defined to be a complete graph over the border vertices of C where edge lengths correspond to shortest path distances in C. In order to compute dense distance graphs for all clusters we use Klein's algorithm [11], who have shown that after O(n log n) preprocessing time any distance from the external face can be computed in O(log n) time. The proof of the following lemma is given in Appendix B. Lemma 8. Given an r-partition P we can compute a dense distance graph for all clusters in P in O(n log r) time. The dense distance graphs can be used to speed up shortest path computations using Dijkstra's algorithm. It was shown by Fakcharoenphol and Rao ([2], Section 3.2.2) that a Dijkstra-like algo- rithm can be executed on a dense distance graph for a cluster P in O(∂P log2 P) time. Having constructed the dense distance graphs, we can run Dijkstra in time almost proportional to the number of vertices (rather than to the number of edges, as in standard Dijkstra). We use this algorithm in graphs composed of dense distance graphs and a subset E′ of edges of the original graph G = (V, E): Corollary 9. Dijkstra can implemented in O(E′ log V + Pi ∂Gi log2 ∂Gi) time on a graph composed of a set of dense distance graphs Gi and a set of edges E′ over the vertex set V . Proof. In order to achieve this running time we use Fakcharoenphol and Rao [2] data-structure for each Gi. Moreover, minimum distance vertices from each Gi and all endpoints of edges in E′ are kept in a global heap. In general, clusters may contain holes although in typical cases, e.g., in grid graphs, the obtained clusters are holeless. In this section, in order to introduce the main ideas behind our algorithm, we restrict ourselves to holeless r-partitions, i.e., r-partitions where each cluster contains one hole (external face). We will show in Appendix D how to handle the general case. Assume that we have computed the dense distance graphs for all clusters in a given r-partition P of the dual graph GD. Recall that in our min-cut algorithm we are free to choose any path π from fs to ft in GD, as long as π is non-crossing. We choose π to minimize the number of clusters it crosses and to maximally use the dense representation of clusters. We define a skeleton graph GP = (∂P, EP ) to be a graph over the set of border vertices in P. The edge set EP is composed of infinite length edges connecting consecutive (in the order on the hole) border vertices on each hole. By our holeless assumption, all border vertices in each cluster lie on the external face of the cluster, so the graph GP is connected. We define a patched graph to be G = GD ∪ GP . Note that this graph is still planar and the shortest distances do not change after adding infinite length edges. to be the graph composed of: (1) two clusters Ps and Pt that include fs and ft respectively; (2) the dense distance graphs (represented by square matrices) for all other clusters; r √r ) = O(r + n√r ) (3) the skeleton graph GP (see Figure 6). Note that G r ) dense distance graphs each over O(√r ) vertices; at most 3r edges of GD from Ps vertices; O( n and Pt; additional O( n√r ) edges from the skeleton graph GP . Using Corollary 9 to run Dijkstra's algorithm we get the following. contains: O(2r + n s,t Define G s,t Corollary 10. The shortest paths in G s,t can be computed in O((r + n√r ) log2 n) time. 3.1 Recursive Division Let bs and bt be any border vertices in clusters Ps and Pt respectively. We define π to be com- posed of: a simple path from fs to bs in Ps; a simple path from bs to bt in GP ; and a simple path 6 from bt to ft in Pt. Note that the construction of the graph G O(n log r + n√r log n) time by Lemmas 7 and 8. s,t and consequently of G s,t π takes s,t s,t s,t i> <i and G := GD ∩ int(Ci) := GD ∩ ext(Ci) Let Ci be some fi-cut-cycle in GD. After finding Ci, we need to recurse on the graphs GD ∩ int(Ci) and GD ∩ ext(Ci). These graphs cannot be computed explicitly. However, we will show how to determine G . Let P be a cluster in the partition other then Ps or Pt, and let GP be its dense distance graph. For a set of vertices X we so parts define GP ∩X to be the dense distance graph of P∩X. The fi-cut-cycle was found using G of Ci that pass through P correspond to shortest paths. Hence, the shortest paths in P ∩int(Ci) and P∩ext(Ci) cannot cross the cycle Ci. As a result, distances in GP ∩int(Ci) and GP ∩ext(Ci) between border vertices of P that are not separated by Ci are the same as in GP . On the other hand, for border vertices that are separated by Ci the distances are infinite (see Figure 7). We define G ∩ X to be the graph obtained by taking GP ∩ X for every cluster in G. Note that we have the following. Corollary 11. G using G = G = G <i i> s,t s,t ∩ int(Ci) and G ∩ ext(Ci). s,t s,t Using these equalities the construction of G <i i> and G takes time proportional to the size of G s,t s,t i> i> <i <i and G and a minimum cut Ci> in G 2⌋. Next, construct graphs G only. Given a path π = f1, . . . , fk, the recursive algorithm for computing min-cuts works as follows. First, remove from G vertices with degree 2 by merging the two incident edges, and find an fi-cut- cycle Ci for i = ⌊ k , and recursively find a minimum cut C<i in G . Finally, return the smallest of the three cuts C<i, Ci and Ci>. To achieve our promised bounds, we need to show that the above algorithm works in sublinear time. In order to show that, we only need to prove that the total size of the graphs on each level in the recursion tree is small. Take a graph G and for each cluster P that contains more then one border vertex add a new vertex vP and replace each dense distance graph by a star graph with s,t c . Obviously, vP in a center. We call the resulting graph the contracted graph and denote it by G the contracted graph has more vertices than the original graph: thus, we can bound the number of vertices in the original graph by considering only contracted graphs. The proof of this lemma is included in Appendix C. s,t Lemma 12. The total number of vertices in contracted graphs on each level in the recursion tree is O(r + n√r ). By the above lemma and Corollary 9, running Dijkstra for each level takes O((r + n√r ) log2 n) time in total. On each level the length of the path π is halved, so there are at most log n recursion levels. Hence we obtain the following theorem. Theorem 13. Let G be a flow network with the source s and the sink t. If GD allows holeless r-partition, then the minimum cut between s and t can be computed in O(n log r + (r + n√r ) log3 n) time. By setting r = log8 n we obtain an O(n log log n) time algorithm. Theorem 13 holds also for general r-partitions within the same O(n log log n) time bound. The modifications needed to make the above algorithm work in the general case are presented in Ap- pendix D. 4 Computing Maximum Flows The standard ways of computing maximum flow in near linear time assume that we already have computed its flow value f . It is given by the min-cut capacity and as we already know it can be computed in O(n log log n) time. We will use the approach proposed by Hassin and Johnson [7], 7 but adopted to our case as we use a different family of cuts Ci. As argued in the following, their approach uses only very basic properties of the cut-cycles and can be directly applied to our case. Moreover, for the sake of brevity, we will assume that that we are given a holeless r-partition. The general case can be handled using ideas presented in Appendix D, and it will be included in the full version of this paper. Let us define the graph −→G π to be the graph obtained from G′π by adding directed edges of length −f from fi to f′i for all 1 ≤ i ≤ k. After Lemma 4.1 in Miller and Naor [12] we know the following. Corollary 14. The graph −→G π does not contain negative length cycles. Let r be such that Cr is the shortest of all Ci for 1 ≤ i ≤ k. The above corollary assures that distance δ(v) from f′r to a vertex v is well defined in −→G π. The next lemma follows by Theorem 1 in [7] or Section 5.1 in [12]. Lemma 15. Let e = (u, v) be the edge in G and let eD = (fu, fv) be the corresponding edge in GD. The face fu is defined to lie to the left when going from u to v. The function f (u, v) := δ(fu)−δ(fv) defines the maximum flow in G. By this lemma, in order to construct the flow function we only need to compute distances from f′r in −→G π. The cycles Ci for i = 1, . . . , k divide −→G π into k + 1 subnetworks −→G 0, . . . ,−→G k where for 1 ≤ i ≤ k − 1, −→G i is the subnetwork bounded by and including Ci and Ci+1. The next lemma is a restatement of Lemma 2 from [7]. Lemma 16. Let v be a vertex in Ni. Then if i < r then there exists a shortest (f′r, v)-path which is j=0 −→G j. Similarly, if i ≥ r then there exists a shortest (f′r, v)-path which is contained contained in Sr−1 in Sk j=r −→G j. Lemma 16 implies that the computation of δ(v) for v ∈ Sr−1 j=0 −→G j can be restricted to Sr−1 j=0 −→G j j=r −→G j in a similar fashion. only. We can restrict the computation for v ∈ Sk Similarly to [7] let us define a normal path to be a simple (f′r, v)-path ρ(v) = ρr·. . .·ρq·. . .·ρ2q−i such that, for j = r, . . . , q, subpath ρj is in −→G j, and, for j = q + 1, . . . , 2q − i, subpath ρj is in −→G 2g−j and uses no edges of negative length. We require as well that q is minimal. Hassin and Johnson [7] have shown that distances from f′r in an n-vertex graph can be computed in O(n log n) time when for each vertex v there exists a shortest (f′r, v)-path that is normal (Theorem 2 in [7]). Their computation is based on Dijkstra's algorithm and can be sped up using dense distance graphs and Corollary 9. Lemma 17. Distances from f′r in the graph −→G π can be computed in O(n log r + ( n√r + r) log2 n) time when for each vertex v there exists a shortest (f′r, v)-path that is normal. Proof. The algorithm works in two phases. First, we take −→G π and substitute each cluster P with its dense distance graph. The resulting graph has O( n√r ) vertices. The Dijkstra-like computation from [7] can be executed in O(( n√r + r) log2 n) time on this graph. In this way we obtain distances δ(v) for border nodes v in all clusters in GD. Second, for each cluster separately we run Hassin and Johnson's computation starting from border vertices only. The second phase works in O(r log r) time for each cluster, which yields O(n log r) time in total. In order to use the above lemma we only need the following result, which can be proven in the same way as Lemma 3 from [7]. The proof in [7] uses only the fact that subpaths of cut cycles Ci are shortest paths and this holds in our case as well. 8 Lemma 18. For any i = r, . . . , k, for every vertex v, in −→G i there exists a normal shortest path ρ(v). Proof. Assume that a shortest path ρ(v) intersect some cycle Ci. If the previous intersected cycle was Ci as well, then we can either short cut ρ(v) using the part of Ci or short cut Ci using part of ρ(v) (see Figure 8). This contradicts either the minimality of ρ(v) or the minimality of Ci. Moreover, after ρ(v) leaves Ci to go into −→G i−1 it cannot use a negative edge any more, as otherwise it would cross itself. If it crosses itself then the resulting cycle could be removed as it cannot have a negative weight. Combining Lemma 15, Lemma 17 and Lemma 18 we obtain the main result of this section. Theorem 19. The maximum flow in an undirected planar graph can be computed in O(n log r + ( n√r + r) log2 n) time. By setting r = log8 n we obtain an O(n log log n) time algorithm. 5 Dynamic Shortest Paths and Max Flows in Planar Graphs Most of the ideas presented in this section are not entirely new, but nevertheless combined together they are able to simplify and improve previously known approaches. Our dynamic algorithm builds upon the r-partition introduced in Section 3. We first show how to maintain a planar graph GD with positive edge weights under an intermixed sequence of the following operations 1: insertD(x, y, c) add to GD an edge of length c between vertex x and vertex y, provided that the new edge preserves the planarity of GD; deleteD(x, y) delete from GD the edge between vertex x and vertex y; shortest pathD(x, y) return a shortest path in GD from vertex x to vertex y. In our dynamic algorithm we maintain the r-partition of GD together with dense distance graphs for all clusters in the partition. This information will be recomputed every √r operations. We now show how to handle the different operations. We start with operation insert: let (x, y) be the edge to be inserted, and let Px (respectively Py) be the cluster containing vertex x (respectively vertex y). If x and y are not already border vertices in clusters Px and Py, we make them border vertices in both clusters and add edge (x, y) arbitrarily either to cluster Px or to cluster Py. Next, we recompute the dense distance graphs of clusters Px and Py, as explained in Lemma 8. This requires overall time O(r log r). Note that an insert operation may increase by a constant the number of border vertices in at most two clusters and adds an edge to one cluster: since the partition into clusters is recomputed every √r operations, this will guarantee that throughout the sequence of operations each cluster will always have at most O(r) edges and O(√r) border vertices. To delete edge (x, y), we remove this edge from the only cluster containing it, and recompute the dense dis- tance graph of this cluster. Once again, this can be carried out in time O(r log r). Amortizing the initialization over √r operations yields O( + r log r) time per update. log n n log r+ n√r √r In order to answer a shortest path(x, y) query, we construct the graph G tion 3). Note that the distance from s to t in GD and G shortest path from s to t can be computed in O((r + n√r ) log2 n) time. s,t (as defined in Sec- are equal. Hence, by Corollary 10 the s,t In order to minimize the update time we set r = n2/3 and obtain the following theorem. 1We have chosen to work with the dual graph GD for consistency with the remaining parts of the paper. 9 Lemma 20. Given a planar graph G with positive edge weights, we can insert edges (allowing changes of the embedding), delete edges and report shortest paths between any pair of vertices in O(n2/3 log2 n) amortized time per operation. 2 We recall that we can check whether a new edge insertion violates planarity within the bounds of Lemma 20: indeed the algorithm of Eppstein et al. [1] is able to maintain a planar graph subject to edge insertions and deletions that preserve planarity, and allow to test whether a new edge would violate planarity in time O(n1/2) per operation. Finally, we observe that not only we have improved slightly the running time over the O(n2/3 log7/3 n) time algorithm by Fakcharoenphol and Rao [2], but our algorithm is also more general. Indeed, the algorithm in [2] can only handle edge cost updates and it is not allowed to change the embedding of the graph. On the contrary, our algorithm can handle the full repertoire of updates (i.e., edge insertions and deletions) and it allows the embedding of the graph to change throughout the sequence of updates. We now turn our attention to dynamic max-flow problems. In particular, given a planar graph G = (V, E) we wish to perform an intermixed sequence of the following operations: insert(x, y, c) delete(x, y) max flow(s, t) add to G an edge of capacity c between vertex x and vertex y, provided that the embedding of G does not change; delete from G the edge between vertex x and vertex y; return the value of the maximum flow from vertex s to vertex t in G. Note that insert operations are now more restricted than before, as they are not allowed to change the embedding of the graph. To answer max flow queries in the primal graph G we need to maintain dynamically information about the distances in the dual graph GD, with the bounds re- ported in Lemma 20. Unfortunately, things are more involved as a single edge change in the primal graph G may cause more complicated changes in the dual graph GD. In particular, inserting a new edge into the primal graph G results in splitting into two a vertex in the dual graph GD, whereas deleting an edge in the primal graph G implies joining two vertices of GD into one. However, as edges are inserted into or deleted from the primal graph, vertices in the dual graph are split or joined according to the embedding of their edges. To handle efficiently vertex splits and joins in the dual graph, we do the following. Let f be a vertex of degree d in the dual graph: we maintain vertex f as a cycle Cf of d edges, each of cost 0. The actual edges originally incident to f , are made incident to one of the vertices in Cf in the exact order given by the embedding. It is now easy to see that in order to join two vertices f1 and f2, we need to cut their cycles Cf1 and Cf2, and join them accordingly. This can be implemented in a constant number of edge insertions and deletions. Similarly, we can support vertex splitting with a constant number of edge insertions and deletions. Additionally, for each cluster P , for each pair h, h′ of holes we need to compute the dense distance and the minimum-cuts between bh and bh′. However, following Corollary 24, this graphs of Pπh,h′ does not increase the running time of our dynamic algorithm. Note that this information is enough π in O(r + n√r ) time. Moreover, by Theorem 13 and Theorem 26 to construct the graphs G the min-cut algorithm can be executed on these graphs in O((r + n√r ) log3 n) time. Setting r = n2/3 this yields immediately the main result of this section. and G s,t s,t Lemma 21. Given a planar graph G with positive capacities, each operation insert, delete and max flow can be implemented in O(n2/3 log3 n) amortized time. 3 2The same worst-case time bounds can be obtained using a global rebuilding technique. 3Again, the same worst-case time bounds can be obtained using a global rebuilding technique. 10 References [1] David Eppstein, Zvi Galil, Giuseppe F. Italiano, and Thomas H. Spencer. Separator based sparsification I. Planarity testing and minimum spanning trees. Journal of Computer and System Sciences, 52(1):3 -- 27, February 1996. [2] J. Fakcharoenphol and S. Rao. Planar graphs, negative weight edges, shortest paths, and near linear time. J. Comput. Syst. Sci., 72(5):868 -- 889, 2006. [3] L. R. Ford and D. R. Fulkerson. Maximal flow through a network. Canadian Journal of Mathematics, pages 399 -- 404, 1956. [4] L. R. Ford and D. R. Fulkerson. Flows in Network. Princeton Univ. Press, 1962. [5] Greg N. Frederickson. Fast algorithms for shortest paths in planar graphs, with applications. SIAM Journal on Computing, 16(6):1004 -- 1022, 1987. [6] R. Hassin. Maximum flows in (s, t) planar networks. IPL, page 107, 1981. [7] Refael Hassin and Donald B. Johnson. An O(n log2 n) algorithm for maximum flow in undirected planar networks. SIAM J. Comput., 14(3):612 -- 624, 1985. [8] Monika R. Henzinger, Philip Klein, Satish Rao, and Sairam Subramanian. Faster shortest-path algorithms for planar graphs. J. Comput. Syst. Sci., 55(1):3 -- 23, 1997. [9] Alon Itai and Yossi Shiloach. Maximum flow in planar networks. SIAM Journal on Computing, 8(2):135 -- 150, 1979. [10] Donald B. Johnson. Parallel algorithms for minimum cuts and maximum flows in planar networks. J. ACM, 34(4):950 -- 967, 1987. [11] Philip N. Klein. Multiple-source shortest paths in planar graphs. In SODA '05: Proc. 16th Annual ACM-SIAM Symposium on Discrete algorithms, pages 146 -- 155, 2005. [12] Gary L. Miller and Joseph Naor. Flow in planar graphs with multiple sources and sinks (extended abstract). In FOCS, pages 112 -- 117. IEEE, 1989. [13] J. Reif. Minimum s-t cut of a planar undirected network in O(n log2 n) time. SIAM Journal on Computing, 12:71 -- 81, 1983. 11 fs s t ft Figure 1: An embedded planar graph G and its dual graph GD. Vertices of G are shown as circles, and edges of G are solid. Vertices of GD are shown as gray squares, and edges of GD are dashed. s and t are two vertices in G, and fs and ft are arbitrary inner faces incident respectively to s and t. 12 fs f ' s fs tf tf ' tf (a) (c) fs tf fs ' fs (b) (d) tf ' tf (e) Figure 2: (a) The dual graph GD of Figure 1: the path π from fs to ft is shown in bold. (b) The dual graph GD embedded so that the path π is a horizontal line. (c) The graph G′π. (d) The graph G′′π = G′π, embedded so that the face defined by π and π′ is the outer face. (e) The graph Gπ obtained after identifying the path π′ (respectively π) in G′′π with the path π (respectively π′) in G′π. 13 C fs fi C fs fs C (a) (c) (e) fi fi ft ft ft ' f f  fs fs fs  fs ' fi fi fi' fi fi' fi (b) (d) (f) ' f  f  ft  ft ft ft (b) The corresponding fi-separating path ρ in Gπ. Figure 3: On the proof of Lemma 3. (a) The fi-cut-cycle C crosses the path π in fi in the graph GD. (c) The fi-cut-cycle C touches from above the path π in fi in the graph GD. (d) The corresponding fi-separating path ρ in Gπ. (e) The fi-cut-cycle C touches from below the path π in fi in the graph GD. (f) The corresponding fi-separating path ρ in Gπ. Ci pj fs fa pi fb fi ft fj Cj Figure 4: On the proof of Lemma 4. 14 vi+1 v=vi vi-1 (a) v=vi vi+1 0 v' vi-1 (b) Figure 5: Dealing with non-simple paths. (a) A non-crossing path π of GD that touches itself at face v = vi. (b) The vertex splitting transformation on face v. Pt ft Ps fs Figure 6: The graph G clusters, and the skeleton graph GP . The path π from fs to ft is shown in bold. containing clusters Ps and Pt, the dense distance graphs for all other s,t Ci w u v P Figure 7: Computing GP ∩ int(Ci). It two border vertices u and v are not separated by the fi-cut-cycle Ci, then their distance in GP ∩ int(Ci) is equal to their distance in GP . On the other hand, if border vertices v and w are separated by the fi-cut-cycle Ci, then their distance in GP ∩ int(Ci) is infinite. 15 'fr fr 'fr fr y v ft ft  x (a) (b) Ci Ci Figure 8: On the proof of Lemma 18. (a) The cycle Ci can be short cut using the subpath between x and y in ρ(v). (b) A valid normal path. 16 A Computation of r-Partition: Proof of Lemma 7 In order to prove Lemma 7 we will combine Frederickson's [5] technique with the following impli- cation of Section 3.1 and Section 5.1 from [2]. Corollary 22. An r-partition of an n-node planar graph that already contains O( n√r ) border ver- tices can be computed in O(n log n) time. Proof. Actually, Fakcharoenphol and Rao [2] construct in the above time bound a recursive decom- position and in order to get an r-partition we only need to run their algorithm until the size of the clusters drops below O(r). Moreover, the recursive decomposition of Fakcharoenphol and Rao [2] assumes that border ver- tices are present in the decomposed graphs or clusters. Moreover, each time a cluster is split into smaller clusters, the border vertices are split into asymptotically equal parts. The O( n√r ) border vertices we start with will be distributed equally into O( n r ) clusters. Hence, each cluster in the obtained partition will have additional O( n√r × r n ) = O(√r ) border vertices. Now in order to the find the r-partition quickly we use the following algorithm: • Generate a spanning tree T of the graph; • Find connected subtrees of T containing O(√r ) vertices using a procedure from [5]; • Contract the graph on these subsets, to obtain a simple planar graph Gs with O( n√r ) vertices; • Using Corollary 22, find an r-division in Gs with O( n • Expand Gs back to G. In G there are O(n/r) clusters P1 of size O(√r ) resulting from boundary vertices in Gs, and O( n r3/2 ) clusters P2 of size O(r3/2) resulting from the interior vertices of Gs; • Apply Corollary 22 to find an r-division for clusters in P2 taking into account the border vertices r3/2 ) clusters of size O(r); already present in the clusters. It is easy to see that the above procedure requires O(n log r + n√r log n) time. We only need to show that the result is a valid r-division. The clusters P1 correspond exactly to the connected subtrees of T of size O(√r ). They cannot have more then O(√r ) border vertices and all the border vertices lie on the external face, i.e., they contain one hole. Hence, clusters in P1 satisfy the properties of an r-partition. Consider the clusters in P2 before we have applied Corollary 22. Each cluster is obtained by expanding a cluster in Gs that had √r border vertices. Consider the process of expanding to a subtree T a border vertex bh lying on a hole h in a cluster P . Let h′ be the hole obtained from h by removing bh from P . The edges of T were not present in the cluster so the process of expanding T can be seen as gluing T at the side of h′. Note that by the connectivity of T no new hole is created and only the hole h′ becomes "smaller". Moreover, not all of the vertices of T become border vertices of the expanded piece, as some of them do not lie on the side of the new hole (see Figure 9). Nevertheless as T contains O(√r ) vertices at most O(√r ) vertices can become border vertices. Hence, in total the pieces in P2 will have O(r) border vertices. This number satisfies the assumption of Corollary 22, so pieces obtained by using it satisfy the assumption of r-partition. This completes the proof of Lemma 7. B Computation of Dense Distance Graphs: Proof of Lemma 8 Proof. In order to compute dense distance graphs we use the following result by Klein [11]. Theorem 23 (Klein [11]). Given an n-node planar graph with non-negative edge lengths, it takes O(n log n) time to construct a data structure that supports queries of the following form in O(log n) 17 a) b) bh h T h' Figure 9: a) Before expanding the border vertex bh in hole h; b) after expanding bh to T no new hole is created. time: given a destination vertex t on the boundary of the external face, and given a start vertex s anywhere, find the distance from s to t. A cluster C in the r-partition has r vertices, O(√r ) border vertices and a constant number of holes. Border vertices in C lie on one of the holes. In order to compute distances from all border vertices to a given hole H we will apply Theorem 23. We simply find an embedding of the graph such that H becomes the external face, and query the distances from all border vertices to H. There are a constant number of holes in each cluster, and so Klein's data structure will be used a constant number of times for each cluster. On the other hand, there are O(r) pairs of border vertices in each cluster, so we will ask O(r) queries. The time needed to process each cluster is hence O(r log r), which gives n r × O(r log r) = O(n log r) time in total. C Size of Contracted Graphs: Proof of Lemma 12 <i i> and G s,t is split along Ci into G that has O(r + n√r ) vertices and . s,t Proof. At the top level of the recursion we have one graph G c s,t O(r + n√r ) faces. Now consider the case when the graph G s,t Observe that the cycle Ci can be traced in G c when we replace each edge in dense distance graphs for a cluster P by a two-edge path going through the center vertex vP . In such a case we have <i c ∩ int(Ci) and G c = G c ∩ ext(Ci). In other words each time we recurse we split the G s,t c along some cycle and then remove degree-two vertices. Note that after splitting the graph graph G s,t G c along the cycle Ci, the number of faces in the union of the resulting graphs increases by exactly one (see Figure 10). There are at most O(r + n√r ) recursive calls, so the union all contracted graphs on a given level in the recursive tree has O(r+ n√r ) faces as well. Moreover, the vertices in this union graph have degree at least three, because all degree-two vertices are removed. Let v, e and f be the number of vertices, edges and respectively faces in the union graph. Now, by Euler's formula the claim of the lemma follows: v = 3v−2v = 3v−2(2+e−f ) ≤ 2e−2(2+e−f ) ≤ 2f−4 = O(r+ n√r ). i> c = G s,t D General Clusters When holes are present in the r-partition the skeleton graph GP is not connected. Hence, the path connecting bs and bt cannot use border vertices only. We need to modify the algorithm to allow such paths. We do this as follows. 18 Pt ft Ps fs (a) Pt ft (b) Ps fs (c) s,t (a) The graph G c Figure 10: the cycle Ci is shown with dashed edges. (b) The graph G G and the cycle Ci. Cluster boundaries are shown in bold, and c ∩ ext(Ci). (c) The graph contains one more face than G i> c = G s,t <i c = G s,t c ∩ int(Ci). Note that the union of G i> c and G <i c s,t c . 19 For each hole h in P , we fix a border vertex bh. For each pair of holes h, h′ in P , we fix a path πh,h′ that starts from bh and ends in bh′, goes through bh′′ for all holes h′′ in P , and for all bh′′ on the path walks around the hole h′′ passing through all its border vertices (see Figure 11). These paths are used to do some additional preprocessing for each cluster P in the partition. For each pair of holes h, h′ in P we compute dense distance graph for Pπh,h′ , and find the minimum cut Ch,h′ between bh and bh′ in P . h b h bh' h' bh'' h'' Figure 11: The path πh,h′. Corollary 24. The additional preprocessing takes O(n log r) time. Proof. For each cluster P and each pair of holes the dense distance graph can be computed in the same manner as in Lemma 8. On the other hand, minimum-cuts can be found in O(r log r) time using the algorithm by Henzinger et al. [8]. Hence, over all clusters we need a total of O(n log r) time. Now in order to connect fs and ft we will use paths πh,h′ whenever we need to pass between two different holes h, h′ in a piece P . Let Pπ be the set of all such pieces on π. The resulting path is no longer simple, but it will be non-crossing. As shown in Section 2.2, our min-cut algorithm can be executed on non-crossing paths as well. We can make the following observation (see Figure 12). Corollary 25. A minimum s-t cut C either contains a vertex in ∂π or is fully contained in one of the pieces Pπ. Proof. If the cycle C contains a vertex in ∂π, we are done. Assume that it does not contain any vertex from ∂π. In order to be a cut, it has to cross path π and it can do it so in one of πh,h′. Then it has to be fully contained in the corresponding P as by the construction of πh,h′ or border vertices of P lie on π. Using Corollary 25, we can find the minimum cut in two phases. First, let Ci be the smallest of the cuts Ch,h′ in Pπ for bh, b′h ∈ π. Second, run the algorithm from previous section on a path ∂π in G to find a cut Cb. Finally, return the smallest of the cuts Ci and Cb. The running time of the above algorithm is the same as in Theorem 13. s,t Theorem 26. Let G be a flow network with source s and sink t. The minimum cut between s and t in G can be computed in O(n log r + (r + n√r ) log3 n) time. By setting r = log8 n, we obtain an O(n log log n) time algorithm. 20 Figure 12: On illustrating Corollary 25. A cut can be either fully contained in one of the pieces Pπ (such as cut Ci) or it must contain one of the border vertices in ∂π (such as cut Cj). 21
1804.10673
1
1804
2018-04-27T20:19:39
Buffered Count-Min Sketch on SSD: Theory and Experiments
[ "cs.DS" ]
Frequency estimation data structures such as the count-min sketch (CMS) have found numerous applications in databases, networking, computational biology and other domains. Many applications that use the count-min sketch process massive and rapidly evolving datasets. For data-intensive applications that aim to keep the overestimate error low, the count-min sketch may become too large to store in available RAM and may have to migrate to external storage (e.g., SSD.) Due to the random-read/write nature of hash operations of the count-min sketch, simply placing it on SSD stifles the performance of time-critical applications, requiring about 4-6 random reads/writes to SSD per estimate (lookup) and update (insert) operation. In this paper, we expand on the preliminary idea of the Buffered Count-Min Sketch (BCMS) [15], an SSD variant of the count-min sketch, that used hash localization to scale efficiently out of RAM while keeping the total error bounded. We describe the design and implementation of the buffered count-min sketch, and empirically show that our implementation achieves 3.7x-4.7x the speedup on update (insert) and 4.3x speedup on estimate (lookup) operations. Our design also offers an asymptotic improvement in the external-memory model [1] over the original data structure: r random I/Os are reduced to 1 I/O for the estimate operation. For a data structure that uses k blocks on SSD, was the word/counter size, r as the number of rows, M as the number of bits in the main memory, our data structure uses kwr/M amortized I/Os for updates, or, if kwr/M >1, 1 I/O in the worst case. In typical scenarios, kwr/M is much smaller than 1. This is in contrast to O(r) I/Os incurred for each update in the original data structure.
cs.DS
cs
Buffered Count-Min Sketch on SSD: Theory and Experiments Mayank Goswami Queens College, City University of New York [email protected] Dzejla Medjedovic International University of Sarajevo [email protected] Emina Mekic Sarajevo School of Science and Technology [email protected] Prashant Pandey Stony Brook University, New York [email protected] Abstract Frequency estimation data structures such as the count-min sketch (CMS) have found numerous applications in databases, networking, computational biology and other domains. Many applications that use the count-min sketch process massive and rapidly evolving datasets. For data-intensive ap- plications that aim to keep the overestimate error low, the count-min sketch may become too large to store in available RAM and may have to migrate to external storage (e.g., SSD.) Due to the random-read/write nature of hash operations of the count-min sketch, simply placing it on SSD stifles the performance of time-critical applications, requiring about 4-6 random reads/writes to SSD per estimate (lookup) and update (insert) operation. In this paper, we expand on the preliminary idea of the Buffered Count-Min Sketch (BCMS) [15], an SSD variant of the count-min sketch, that used hash localization to scale efficiently out of RAM while keeping the total error bounded. We describe the design and implementation of the buffered count-min sketch, and empirically show that our implementation achieves 3.7×-4.7× the speedup on update (insert) and 4.3× speedup on estimate (lookup) operations. Our design also offers an asymptotic improvement in the external-memory model [1] over the original data structure: r random I/Os are reduced to 1 I/O for the estimate operation. For a data structure that uses k blocks on SSD, w as the word/counter size, r as the number of rows, M as the number of bits in the main memory, our data structure uses kwr/M amortized I/Os for updates, or, if kwr/M >1, 1 I/O in the worst case. In typical scenarios, kwr/M is much smaller than 1. This is in contrast to O(r) I/Os incurred for each update in the original data structure. Lastly, we mathematically show that for the buffered count-min sketch, the error rate does not substantially degrade over the original count-min sketch due to hash localization. Specifically, we prove that for any query q, our data structure provides the guarantee: Pr[Error(q)≥ n(1+o(1))]≤ δ+o(1), which, up to o(1) terms, is the same guarantee as that of a count-min sketch. 2012 ACM Subject Classification Theory of computation → Data structures and algorithms for data management, Theory of computation → Streaming models, Theory of computation → Database query processing and optimization (theory), Keywords and phrases Streaming model, Count-min sketch, Counting, Frequency, External memory, I/O efficiency, Bloom filter, Counting filter, Quotient filter. Digital Object Identifier 10.4230/LIPIcs.ESA.2018. 8 1 0 2 r p A 7 2 ] S D . s c [ 1 v 3 7 6 0 1 . 4 0 8 1 : v i X r a © Mayank Goswami and Dzejla Medjedovic and Emina Mekic and Prashant Pandey; licensed under Creative Commons License CC-BY European Symposium on Algorithms (ESA 2018). Leibniz International Proceedings in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany XX:2 Buffered Count-Min Sketch on SSD: Theory and Experiments 1 Introduction Applications that generate and process massive data streams are becoming pervasive [3,16,20,22,28] across many domain in computer science. Common examples of streaming datasets include fin- ancial markets, telecommunications, IP traffic, sensor networks, textual data, etc [3,8,11,29]. Processing fast-evolving and massive datasets poses a challenge to traditional database systems, where commonly the application stores all data and subsequently does queries on it. In the streaming model [4], the dataset is too large to be completely stored in the available memory, so every data item is seen and processed once - an algorithm in this model performs only one scan of data, and uses sublinear local space. with the goal of reporting all items whose frequency is at least n/k, n=PT The streaming scenario exhibits some limitations on the types of problems we can solve with such strict time and space constraints. A classic example is the heavy hitter problem HH(k) on the stream of pairs (at,ct), where at is the item identifier, and ct is the count of the item at timeslot t, t=1ct. The general version of the problem, with the exception of when k is a small constant1, can not be exactly solved in the streaming model [25,29], but the approximate version of the problem, -HH(k), where all items of the frequency at least n/k−n are reported, and an item with larger error might be reported with small probability δ, is efficiently solved with the count-min sketch [12,21] data structure. Count-min sketch accomplishes this in O(ln(1/δ)/) space, usually far below linear space in most applications. Count-min sketch [12,21] has been extensively used to answer heavy hitters, top k queries and other popularity measure queries that represent the central problem in the streaming context, where we are interested in extracting the essence from an impractically large amount of data. Common applications include displaying the list of bestselling items, the most clicked-on websites, the hottest queries on the search engine, most frequently occurring words in a large text, and so on [22,27,30]. Count-min sketch (CMS) is a hashing-based, probabilistic and lossy representation of a multiset, that is used to answer the count of a query q (number of times q appears in a stream). It has two error parameters: 1) , which controls the overestimation error, and 2) δ, which controls the failure probability of the algorithm. The CMS provides the guarantee that the estimation error for any query q is more than n with probability at most δ. If we set r=ln(1/δ) and c=e/, the CMS is implemented using r hash functions as a 2D array of dimensions r x c. When  and δ are constants, the total overestimate grows proportionately with n, the size of the count-min sketch remains small, and the data structure easily fits in smaller and faster levels of memory. For some applications, however, the allowed estimation error of n is too high when  is fixed. Consider an example of n=230, where δ=0.01 and =2−26, hence the overestimate is 16, and the total data structure size of 3.36GB, provided each counter uses 4 bytes. However, if we double the dataset size, then the total overestimate also doubles to 32 if  stays the same. On the other hand, if we want to maintain the fixed overestimate of 16, then the data structure size doubles to 6.72GB. In this paper, we expand on the preliminary idea of Buffered Count-Min Sketch (BCMS) [15], an SSD variant of the count-min sketch data structure, that scales efficiently to large datasets while keeping the total error bounded. Our work expands on the previous work by introducing detailed design, implementation and experiments, as well as mathematical analysis of the new data structure (our original paper [15], which, to the best of our knowledge is the only attempt thus far to scale count-min sketch to SSD, contains only the outline of the data structure). To demonstrate the issues arising from a growing count-min sketch and storing it in lower levels of memory, we run a mini in-RAM experiment for count-min sketch sizes 4KB-64MB. In 1 When k≈2 this problem goes by the name of majority element. M. Goswami, D. Medjedovic, E. Mekic, and P. Pandey XX:3 Figure 1 The effect of increasing count-min sketch size on the update operation cost in RAM. Figure 1, we see that to maintain the same error, the cost of update will increase as the data structure is being stored in the lower levels of memory, even though we keep the number of hash functions fixed for all data structure sizes. The appropriate peak in the cost is visible at the border of L2 and L3 cache (at 3MB). Asymptotically, storing the unmodified count-min sketch on SSD or a disk is inefficient, given that each estimate and update operation needs r hashes, which results in O(r) random reads/writes to SSD, far below the desired throughput for most time-critical streaming applications. Another context where we see CMS becoming large even when  is fixed is in some text applications,where the number of elements inserted in the sketch is quadratic in the original text size. For instance, [19] uses CMS to record distributional similarity on the web, where each pair of words is inserted as a single item into the CMS, and 90GB of text requires a CMS of 8GB. 1.1 Results 1. We describe the design and implementation of buffered count-min sketch, and empirically show that our implementation achieves 3.7-4.7x the speedup on update (insert) and 4.3x speedup on estimate (lookup) operations. 2. Our design also offers an asymptotic improvement in the external-memory model [1] over the original data structure: O(r) random I/Os are reduced to 1 I/O for estimate. For a data structure that uses k blocks on SSD, w as the word/counter size, r as the number of rows, M as the number of bits in main memory, our data structure uses kwr/M amortized I/Os for updates, or, if kwr/M >1, 1 I/O in the worst case. In typical scenarios, kwr/M <<1. This is in contrast to O(r) I/Os incurred for each update in the original data structure. 3. We mathematically show that for buffered count-min sketch, the error rate does not substan- tially degrade over the original count-min sketch. Specifically, we prove that for any query q, our data structure provides the following guarantee: Pr[Error(q)≥n(1+o(1))]≤δ+o(1). We focus on scenarios where the allowed estimation error is sublinear in n. For example, what √ if we want the estimation error to be no larger than n/logn, or n? These scenarios correspond √ to  = 1/logn or 1/ n, and now for even moderately large values of n, the count-min sketch becomes too large to fit in main memory. Even given more modest condition, such as =o(1/M), where the memory is of size M, the count-min sketch is unlikely to fit in memory. We will assume ESA 2018 XX:4 Buffered Count-Min Sketch on SSD: Theory and Experiments that 1/n≤  <<1/M. Higher values of  do not require the count-min sketch to be placed on disk, and lower values of  mean exact counts are desired. 2 Related Work The streaming model represents many real-life situations where the data is produced rapidly and on a constant basis. Some of the applications include sensor networks [22], monitoring web traffic [26], analyzing text [19], and monitoring satellites orbiting the Earth [18]. Heavy hitters, top k queries, iceberg queries, and quantiles [3,22,28] are some of the most central problems in the streaming context, where we wish to extract the general trends from a massive dataset. Count-Min sketch has proved useful in such contexts for its space-efficiency and providing accurate counts [12,20]. Count-Min sketch can be well illustrated using its connection to the Bloom filter [6,7,9]. Both data structures are lossy and space-efficient representations of sets, used to reduce disk accesses in time-critical applications. Bloom filter answers membership queries and can have false positives, while Count-Min sketch answers frequency queries, and can overestimate the actual frequency count. Both data structures are hashing-based, and suffer from similar issues when placed directly to SSD or a magnetic disk. There has been earlier attempts to scale Bloom filters to SSD using buffering and hash localization [10,13]. Our paper employs similar methods to those in [10,13]. The improvement, both in our case and in the case of Buffered Bloom filter [10] is achieved at the expense of having an extra hash function that helps determine to which page each element is going to hash. There has also been work in designing cache-efficient equivalents for Bloom filters such as quo- tient filter and write-optimized on-disk quotient filter such as Cascade filter (CQF) [5,14,23]. An im- portant distinction to make between these data structures and count-min sketch is that CQF gives exact counts of most of the elements given that the errors caused by false positives are usually very small. However, since the errors are independent, the CQF doesn't offer any guarantees on the over- estimate. For example, two highly occurring elements in a multi-set can collide with each other and both will have large overcounts. On the other hand, the CMS does not give exact counts of elements due to multiple hashes and its size (width of the CMS is smaller than the number of slots in a CQF). But the CMS can offer a guarantee that overestimate will be smaller than n with a probability of δ. 2.1 Count-Min Sketch: Preliminaries In the streaming model, we are given a stream A of pairs (ai,ci), where ai denotes the item identifier (e.g., IP address, stock ID, product ID), and ci denotes the count of the item (e.g., the number of bytes sent from the IP address, the amount by which a stock has risen/fallen or the number of sold items). Each pair Xi =(ai,ci) is an item within a stream of length T, and the goal is to record total sum of frequencies for each particular item ai. For a given estimation error rate  and failure probabiltity δ, define r=ln(1/δ) and c=e/. The Count-Min Sketch is represented via 2D table with c buckets (columns), r rows, implemented using r hash functions (one hash function per row). CMS has two operations: UPDATE(ai)and ESTIMATE(ai), the respective equivalents of in- sert and lookup, and they are performed as follows: UPDATE(ai)inserts the pair by computing r hash functions on ai, and incrementing appropriate slots determined by the hashes by the quantity ci. That is, for each hash function hj, 1≤j≤r, we set CMS[j][hj(ai)]=CMS[j][hj(ai)]+ci. Note that in this paper, we use ci=1, so every time an item is updated, it is just incremented by 1. M. Goswami, D. Medjedovic, E. Mekic, and P. Pandey XX:5 ESTIMATE(ai)reports the frequency of ai which can be an overestimate of the true frequency. It does so by calculating r hashes and taking the minimum of the values found in appropriate cells. In other words, we return min1≤j≤r(CMS[j][hj(ai)]). Because different elements can hash to the same cells, the count-min sketch can return the overestimated (never underestim- ated) value of the count, but in order for this to happen, a collision needs to occur in each row. The estimation error is bounded; the data structure guarantees that for any particular item, the error is within the range n, with probability at least 1−δ, i.e., P r[Error(q)≥n]≤δ. 3 Buffered Count-Min Sketch In this section, we describe Buffered Count-Min Sketch, an adaptation of CMS to SSD. The traditional CMS, when placed on external storage, exhibits performance issues due to random-write nature of hashing. Each update operation in CMS requires c=ln(1/δ) writes to different rows and columns of CMS. On a large data structure, these writes become destined to different pages on disk, causing the update to perform O(ln(1/δ)) random SSD page writes. For high-precision CMS scenarios where δ=0.001%−0.01%, this can be between 5-7 writes to SSD, which is unacceptable in a high-throughput scenario. To solve this problem, we implement, analyze and empirically test the data structure presented in [15] that outlines three adaptations to the original data structure: 1. Partitioning CMS into pages and column-first layout: We logically divide the CMS on SSD into pages of block size B. CMS with r rows, c columns, cell size w, and a total of S =cr w-bit counters, contains k pages P1,P2,P3,...,Pk, where k = S/B and each page spans contiguous B/r columns: Pi spans columns [B(i−1)/r+1,Bi/r]. To improve cache-efficiency, CMS is laid out on disk in column-first fashion, which allows each logical page to be laid out sequentially in memory. Thus, each read/write of a logical page requires at most 2 I/Os. 2. Hash localization: We direct all hashes of each element to a single logical page of CMS that is determined by an additional hash function h0:[1,k]. The subsequent r hash functions map to the columns inside the corresponding logical page, i.e., the range of h1,h2,...,hr for an element e is [B(h0(e)−1)/r+1,Bh0(e)/r]. This way, we direct all updates and reads related to one element to one logical page. 3. Buffering: When an update operation occurs, the hashes produced for an element are first stored inside an in-memory buffer. The buffer is partitioned into sub-buffers of equal size S1,S2,...,Sk, and they directly correspond to logical pages on disk in that Si stores the hashes for updates destined for page Pi. Each element first hashes using h0, which determines in which sub-buffer the hashes will be temporarily stored for this element. Once the sub-buffer Si becomes full, we read the page Pi from the CMS, apply all updates destined for that page, and write it back to disk. The capacity of a sub-buffer is M/k hashes, which is equivalent to M/kwr elements so the cost of an update becomes kwr/M <<1 I/O. The pseudocode for UPDATE(ai)is shown in Algorithm 1, and for ESTIMATE(ai)in Algorithm 2. We use murmurhash as our hashing algorithm due to its efficiency and simplicity [2]. Unlike UPDATE(ai), ESTIMATE(ai)operation is not buffered. In a related work [10] that implements a buffered Bloom filter on SSD, the data structure buffers lookups. However in the count-min sketch scenario, buffering for ESTIMATE(ai)is unproductive given that even if the item is found in the buffer, we still need to check the CMS page to obtain the correct count. Therefore, our ESTIMATE(ai) is optimized for the worst-case single lookup scenario and works for solely insert/lookup as well as mixed workloads. The ESTIMATE(ai) also first computes the correct sub-buffer using h0, and flushes the corresponding sub-buffer to SSD page in case some updates ESA 2018 XX:6 Buffered Count-Min Sketch on SSD: Theory and Experiments Figure 2 UPDATE operation on Buffered Count-Min Sketch. Updates are stored in RAM, and all updates are destined for the same block on disk. Algorithm 1 Buffered Count-Min Sketch - UPDATE function Require : key , r subbufferIndex i := murmur0( key ); for i :=1 to r do hashes [i] := murmur i( key ); end for AppendToBuffer ( hashes , subbufferIndex ); if isSubbufferFull ( subbufferIndex ) then bcmsBlock := readDiskPage ( subbufferIndex ); for each entry in Subbuffer [ subbufferIndex ] do for each index in entry do pageStart := calculatePageStart ( subbufferIndex ); offset := pageStart + entry [ index ]; bcmsBlock [ offset ][ index ]++; end for end for writeBcmsPageBackToDisk ( bcmsBlock ); clearBuffer ( subbufferIndex ); end if 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 were present. Once it applies the necessary changes to the page, it reads the corresponding CMS cells specified by r hashes and returns the minimum value. 4 Analysis of Buffered Count-Min Sketch In this section, we show that the buffering and hash localization do not substantially degrade the error guarantee of the buffered count-min data structure. Fix a failure probability 0<δ <1 and let 0<(n)<1 be the function of n controlling the estimation error. Let r=ln(1/δ) and c=e/. The traditional count-min sketch uses S =rc=(e/)ln(1/δ) counters/words of space. Recall that for our purposes, 1/n≤(n)<<1/M. Let k=S/B be the number of blocks occupied by the buffered count-min sketch. We assume a block can hold B counters. Our analysis will assume the following mild conditions: Assumption 1: n is sufficiently larger than the number of blocks k, n=ω(k(logk)3) suffices. Since k depends inversely on (n), this assumption essentially means that (n)=ω(1/n). Assumption M. Goswami, D. Medjedovic, E. Mekic, and P. Pandey XX:7 Algorithm 2 Buffered Count-Min Sketch - ESTIMATE function Require : key , k subbufferIndex i := murmur0( key ); pageStart := calculatePageStart ( subbufferIndex ); bcmsBlock := readDiskPage ( subbufferIndex ); if isSubbufferNotEmpty ( subbufferIndex ) then for each entry in Subbuffer [ subbufferIndex ] do for each index in entry do offset := pageStart + entry [ index ]; bcmsBlock [ offset ][ index ]++; end for end for clearBuffer ( subbufferIndex ); end if for i :=1 to k do value := murmur i( key ); offset := pageStart + value ; estimation := bcmsBlock [ offset ][i - 1]; estimates [i] := estimation ; end for writeBcmsPageBackToDisk ( bcmsBlock ); return min ( estimates ) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2: limn→∞(n)=0. Both conditions are satisfied, e.g., when (n)=1/logn or 1/nc for any c<1. For brevity, we will drop the dependence of (n) on n, and write the error rate as just , however it is important to note that  is not a constant. (cid:73) Theorem 1. The Buffered-Count-Min-Sketch is a data structure that uses k blocks of space on disk and for any query q, returns ESTIMATE(q) in 1 I/O and performs updates in kwr/M I/Os amortized, or, if kwr/M >1, in one I/O worst case. Let Error(q) = ESTIMATE(q) - TrueFrequency(q). Then for any C≥1, P r[Error(q)≥n(1+p(2(C+1)klogk)/n)]≤δ+O((B/e)C). Remark: By assumption 1,p(2(C+1)klogk)/n is o(1) (in fact, it is o(1/logk)). By assumption 2, (B/e)C is o(1). Thus we claim that the buffered count-min-sketch gives almost the same guarantees as a traditional count-min sketch, while obtaining a factor r speedup in queries.The guarantee for estimates taking 1 I/O is apparent from construction, as only one block needs to be loaded2. The proof is a combination of the classical analysis of CMS and the maximum load of balls in bins when the number of bins is much smaller than the number of balls. Also, note that unlike the traditional CMS, the errors for a query q in different rows are no longer independent (in fact, they are positively correlated: a high error in one row implies more elements were hashed by h0 to the same bucket as q). 2 In practice, we may need 2 I/Os sometimes due to block-page alignment, but never more than 2 ESA 2018 XX:8 Buffered Count-Min Sketch on SSD: Theory and Experiments The hash function h0 maps into k buckets, each having size B (and so we will also call them blocks). Each bucket can be thought of as a r×B/r matrix. Note that r =ln(1/δ), and B/r = e/(k). We assume that h0 is a perfectly random hash function, and, abusing notation, identify a bucket/block with a bin, where h0 assigns elements (balls) to one of the k buckets (bins). In this scenario we use Lemma 2(b) from [24] and adapt it to our setting. (cid:73) Lemma 2. q=1−p. If t=np+o((pqn)2/3) and x:= t−np√ [24] Let B(n,p) denote a Binomial distribution with parameters n and p, and pqn tends to infinity, then P r[B(n,p)≥t]=e−x2/2−logx− 1 Let M(n,k) denote the maximum number of elements that fall into a bucket, when hashed by h0. 2 logπ+o(1). q (cid:73) Lemma 3. Let C≥1 and t=n/k+ P r[M(n,k)≤t]≥1−1/kC. 2(C+1) nlogk k . Then q Proof. We first check that t satisfies the conditions of Lemma 2. Since h0 is uniform, p=1/k (i.e., each bucket is equally probable), and np= n/k. We need to check that the extra term in is o((n(1−1/k)/k)2/3). This is precisely the condition that n = ω(k(logk)3) t, (assumption 1). 2(C+1) nlogk k s Next we apply Lemma 2. In our case, =p2(C+1)logk(1+1/k−1), x= 2(C+1)nlogk/k n(1−1/k)/k 2 logπ+o(1)≤e−x2/2. Putting in x=q2(C+1)logk(1+ 1 Now by assumption 2, (n) goes to zero as n goes to infinity, and so k ∝ 1/(n) goes to infinity, and therefore x goes to infinity as n goes to infinity. Thus we have that the number of elements in any particular bucket (which follows a B(n,1/k) distribution) is larger than t with probability e−x2/2−logx− 1 k−1), we get x2/2= (C+1)logk(1+1/(k−1)≥(C+1)logk, and thus the probability is at most e−(C+1)logk =1/kC+1. Thus the probability that the maximum number of balls in a bin is more than t is bounded (cid:74) Now that we know that with probability as least 1−1/kC, no bucket has more than t elements, we observe that a bucket serves as a "mini" CMS for the elements that hash to it. In other words, let n(q) be the number of elements that hash to the same bucket as q under h0. The expected error in the ith row of the mini-CMS for q (the entry for which is contained inside the bucket of q), is E[Errori(q)]=n(q)/(B/r)=n(q)k/e. (by the union bound) by k.1/kC+1=1/kC, and the lemma is proved. By Markov's inequality Pr[Errori(q)≥n(q)k]≤1/e. Let α= tk/e=(n/k+p(2(C+1)nlogk)/k)k/e=(n/e)(1+p(2(C+1)klogk)/n). We now compute the bound on the final error (after taking the min) as follows. P r(Error(q)≥eα) = P r(Errori(q)≥eα ∀i∈{1,···,r}) (cid:19)r (cid:18)1 = P r(Errori(q)≥eα ∀i n(q)≤t)P r(n(q)≤t) + P r(Errori(q)≥eα ∀i n(q)≥t)P r(n(q)≥t) ≤ = δ+1/kC, 1+1(1/kC) e M. Goswami, D. Medjedovic, E. Mekic, and P. Pandey XX:9 where the second last equality follows from Markov's inequality on Errori(q) and Lemma 3. Finally, by observing that for a fixed δ, k=O(e/B), the proof of the theorem is complete. 5 Evaluation In this section, we evaluate our implementation of the buffered count-min sketch. We compare the buffered count-min sketch against the (traditional) count-min sketch. We evaluate each data structure on two fundamental operations, insertions and queries. We evaluate queries for set of elements chosen uniformly at random. In our evaluation, we address the following questions about how the performance of buffered count-min sketch compares to the count-min sketch: How does the insertion throughput in buffered count-min sketch compare to count-min sketch on SSD? How does the query throughput in buffered count-min sketch compare to count-min sketch on SSD? How does the hash localization in buffered count-min sketch affect the overestimates compared to the overestimates in count-min sketch? 5.1 Experimental setup To answer the above questions, we evaluate the performance of the buffered count-min sketch and the count-min sketch on SSD by scaling the sketch out-of-RAM. For SSD benchmarks, we use four different RAM-size-to-sketch-size ratios, 2, 4, 8, and 16. The RAM-size-to-sketch-size ratio is the ratio of the size of the available RAM and the size of the sketch on SSD. We fix the size of the available RAM to be ≈64MB and change the size of the sketch to change the RAM-size-to- sketch-size ratio. The page size in all our benchmarks was set to 4096B. In all the benchmarks, we measure the throughput (operations per second) to evaluate the insertion and query performance. To measure the insertion throughput, we first calculate the number of elements we can insert in the sketch using calculations described in Section 5.2. During an insert operation, we first generate a 64-bit integer from a uniform-random distribution and then add that integer to the sketch. This way, we do not use any extra memory to store the set of integers to be added to the sketch. We then measure the total time taken to insert the given set of elements in the sketch. Note that for the buffered count-min sketch, we make sure to flush all the remaining inserts from the buffer to the sketch on SSD at the end and include the time to do that in the total time. To measure the query throughput, we query for elements drawn from a uniform-random distribution and measure the throughput. The reason for the query benchmark is to simulate a real-world query workload where some elements may not be present in the sketch and the query will terminate early thereby requiring fewer I/Os. For all the query benchmarks, we first perform the insertion benchmark and write the sketch to SSD. After the insertion benchmark, we flush all caches (page cache, directory entries, and inodes). We then map the sketch back into RAM and perform queries on the sketch. This way we make sure that the sketch is not already cached in kernel caches from the insertion benchmark. We compare the overestimates in buffered count-min sketch and count-min sketch for all the four sketch sizes for which we perform insertion and query benchmarks. To measure the overestimates, we first perform the insertion benchmark. However, during the insertion benchmark, we also store each inserted element in a multiset. Once insertions are done, we iterate over the multiset and query for each element in the sketch. We then take the difference of the count returned from the sketch and the actual count of the element to calculate the overestimate. ESA 2018 XX:10 Buffered Count-Min Sketch on SSD: Theory and Experiments Size Width Depth #elements 3355444 128MB 256MB 6710887 512MB 13421773 1GB 26843546 9875188 19750377 39500754 79001508 5 5 5 5 Table 1 Size, width, and depth of the sketch and the number of elements inserted in count-min sketch and buffered count-min sketch in our benchmarks (insertion, query, and overestimate calculation). Figure 3 Insert throughput of count-min sketch and buffered count-min sketch with increas- ing sizes. The available RAM is fixed to ≈ 64MB. With increasing sketch sizes (on x-axis) the RAM-size-to-sketch-size is also increasing 2, 4, 8, and 16. (Higher is better) For SSD-based experiments, we allocate space for the sketch by mmap-ing it to a file on SSD. We then control the available RAM to the benchmarking process using cgroups. We fix the RAM size for all the experiments to be ≈67MB. We then increase the size of the sketch based on the RAM-size-to-sketch-size ratio of the particular experiment. For the buffered count-min sketch, we use all the available RAM as the buffer. Paging is handled by the operating system based on the disk accesses. The point of these experiments is to evaluate the I/O efficiency of sketch operations. All benchmarks were performed on a 64-bit Ubuntu 16.04 running Linux kernel 4.4.0-98-generic. The machine has Intel Skylake CPU U (Core(TM) i7-6700HQ CPU @ 2.60GHz with 4 cores and 6MB L3 cache) with 32 GB RAM and 1TB Toshiba SSD. 5.2 Configuring the sketch In our benchmarks, we take as input δ, overestimate O (n), and the size of the sketch to configure the sketch S. The depth of the count-min sketch D is dln 1 δe. The number of cells C is S/CELL_SIZE. And width of the count-min sketch is de/e. Given these parameters, we calculate the number of elements n to be inserted in the sketch as C×O D×e . In all our experiments, we set δ to 0.01 and maximum overestimate to 8 and change the sketch size. Table 1 shows dimensions of the sketch and number of elements inserted based on the size of the sketch. M. Goswami, D. Medjedovic, E. Mekic, and P. Pandey XX:11 Figure 4 Query throughput of count-min sketch and buffered count-min sketch with increas- ing sizes. The available RAM is fixed to ≈ 64MB. With increasing sketch sizes (on x-axis) the RAM-size-to-sketch-size is also increasing 2, 4, 8, and 16. (Higher is better) Figure 5 Maximum overestimate reported by count-min sketch and buffered count-min sketch for any inserted element for different sketch sizes. The blue line represents the average overestimate reported by count-min sketch and buffered count-min sketch for all the inserted elements. The average overestimate is same for both count-min sketch and buffered count-min sketch. 5.3 Insert Performance Figure 3 shows the insert throughput of count-min sketch and buffered count-min sketch with changing RAM-size-to-sketch-size ratios. buffered count-min sketch is 3.7×–4.7× faster compared to the count-min sketch in terms of insert throughput on SSD. The buffered count-min sketch performs less than one I/O per insert operation because all the hashes for a given element are localized to a single page on SSD. However, in the count-min sketch the hashes for a given element are spread across the whole sketch. Therefore, the insert throughput of the buffered count-min sketch is 3.7× when the sketch is twice the size of the RAM. And the difference in the throughput increases as the sketch gets bigger and RAM size stays the same. 5.4 Query Performance Figure 4 shows the query throughput of count-min sketch and buffered count-min sketch with changing RAM-size-to-sketch-size ratios. buffered count-min sketch is ≈4.3× faster compared to the count-min sketch in terms of query throughput on SSD. ESA 2018 XX:12 Buffered Count-Min Sketch on SSD: Theory and Experiments The buffered count-min sketch performs a single I/O per query operation because all the hashes for a given element are localized to a single page on SSD. In comparison, count-min sketch may have to perform as many as h I/Os per query operation, where h is the depth of the count-min sketch. 5.5 Overestimates In Figure 5 we empirically compare overestimates returned by the count-min sketch and buffered count-min sketch for all the four sketch sizes for which we performed insert and query benchmarks. And we found that the average and the maximum overestimate returned from count-min sketch and buffered count-min sketch are exactly the same. This shows that empirically hash localization in buffered count-min sketch does not have any major effect on the overestimates. 6 Conclusion In this paper we described the design and implementation of the Buffered count-min sketch, and empirically showed that our implementation achieves 3.7×–4.7× the speedup on update (insert) and 4.3× speedup on estimate (lookup) operations. Queries take 1 I/O, which is optimal in the worst case if not allowed to buffer. However, we do not know whether the update time is optimal. To the best of our knowledge, no lower bounds on the update time of such a data structure are known (the only known upper bounds are on space, e.g., in [17]). We leave the question of deriving update lower bounds and/or a SSD-based data structure with faster update time for future work. References 1 Alok Aggarwal and S. Vitter, Jeffrey. and related problems. http://doi.acm.org/10.1145/48529.48535, doi:10.1145/48529.48535. The input/output complexity of Commun. ACM, 31(9):1116–1127, September 1988. sorting URL: 2 Austin Appleby. 32-bit variant of murmurhash3, 2011. URL: https://sites.google.com/ site/murmurhash/. Brian Babcock, Shivnath Babu, Mayur Datar, Rajeev Motwani, and Jennifer Widom. Models and issues in data stream systems. In Proceedings of the Twenty-first ACM SIGMOD- SIGACT-SIGART Symposium on Principles of Database Systems, PODS '02, pages 1–16, New York, NY, USA, 2002. ACM. URL: http://doi.acm.org/10.1145/543613.543615, doi:10.1145/543613.543615. Brian Babcock, Shivnath Babu, Mayur Datar, Rajeev Motwani, and Jennifer Widom. Models and issues in data stream systems. In Proceedings of the twenty-first ACM SIGMOD-SIGACT- SIGART symposium on Principles of database systems, pages 1–16. ACM, 2002. 3 4 6 5 Michael A. Bender, Martin Farach-Colton, Rob Johnson, Russell Kraner, Bradley C. Kuszmaul, Dzejla Medjedovic, Pablo Montes, Pradeep Shetty, Richard P. Spillane, and Erez Zadok. Don't thrash: How to cache your hash on flash. Proc. VLDB Endow., 5(11):1627–1637, July 2012. URL: http://dx.doi.org/10.14778/2350229.2350275, doi:10.14778/2350229.2350275. Burton H. Bloom. Space/time trade-offs in hash coding with allowable errors. Commun. ACM, 13(7):422–426, July 1970. URL: http://doi.acm.org/10.1145/362686.362692, doi:10.1145/362686.362692. Flavio Bonomi, Michael Mitzenmacher, Rina Panigrahy, Sushil Singh, and George Var- ghese. An improved construction for counting bloom filters. In Proceedings of the 14th Conference on Annual European Symposium - Volume 14, ESA'06, pages 684–695, Lon- don, UK, UK, 2006. Springer-Verlag. URL: http://dx.doi.org/10.1007/11841036_61, doi:10.1007/11841036_61. 7 M. Goswami, D. Medjedovic, E. Mekic, and P. Pandey XX:13 8 Lee Breslau, Pei Cao, Li Fan, Graham Phillips, and Scott Shenker. Web caching and zipf-like distributions: Evidence and implications. In INFOCOM '99. Eighteenth Annual Joint Conference of the IEEE Computer and Communications Societies, pages 126–134, 1999. 9 Andrei Broder, Michael Mitzenmacher, and Andrei Broder I Michael Mitzenmacher. Network applications of bloom filters: A survey. In Internet Mathematics, pages 636–646, 2002. 13 10 Mustafa Canim, George A. Mihaila, Bishwaranjan Bhattacharjee, Christian A. Lang, and Kenneth A. Ross. In Rajesh Bordawekar and Christian A. Lang, editors, ADMS@VLDB, pages 1–8, 2010. URL: http://dblp.uni-trier.de/db/conf/vldb/adms2010.html#CanimMBLR10. Buffered bloom filters on solid state storage. 11 Aiyou Chen, Yu Jin, Jin Cao, and Li Erran Li. Tracking long duration flows in network traffic. the 29th Conference on Information Communica- tions, INFOCOM'10, pages 206–210, Piscataway, NJ, USA, 2010. IEEE Press. URL: http://dl.acm.org/citation.cfm?id=1833515.1833557. In Proceedings of 12 Graham Cormode and S. Muthukrishnan. An improved data stream summary: The count-min sketch and its applications. J. Algorithms, 55(1):58–75, April 2005. URL: http: //dx.doi.org/10.1016/j.jalgor.2003.12.001, doi:10.1016/j.jalgor.2003.12.001. Biplob Debnath, Sudipta Sengupta, Jin Li, David J. Lilja, and David H. C. Du. Bloom- flash: Bloom filter on flash-based storage. In Proceedings of the 2011 31st International Conference on Distributed Computing Systems, ICDCS '11, pages 635–644, Washington, DC, USA, 2011. IEEE Computer Society. URL: http://dx.doi.org/10.1109/ICDCS.2011.44, doi:10.1109/ICDCS.2011.44. Sourav Dutta, Ankur Narang, and Suman K. Bera. Streaming quotient filter: A near optimal approximate duplicate detection approach for data streams. Proc. VLDB En- dow., 6(8):589–600, June 2013. URL: http://dx.doi.org/10.14778/2536354.2536359, doi:10.14778/2536354.2536359. Ehsan Eydi, Dzejla Medjedovic, Emina Mekic, and Elmedin Selmanovic. Buffered count-min sketch. In Mirsad Hadžikadić and Samir Avdaković, editors, Advanced Technologies, Systems, and Applications II, pages 249–255, Cham, 2018. Springer International Publishing. and Shonali Krishnaswamy. ing data streams: 34(2):18–26, June 2005. http://doi.acm.org/10.1145/1083784.1083789, doi:10.1145/1083784.1083789. Sumit Ganguly. Lower bounds on frequency estimation of data streams. Computer Science Symposium in Russia, pages 204–215. Springer, 2008. 16 Mohamed Medhat Gaber, Arkady Zaslavsky, SIGMOD Rec., In International A review. Min- URL: 15 17 14 18 Michael Gertz, Quinn Hart, Carlos Rueda, Shefali Singhal, and Jie Zhang. A data and query model for streaming geospatial image data. In Torsten Grust, Hagen Höpfner, Arantza Illarramendi, Stefan Jablonski, Marco Mesiti, Sascha Müller, Paula-Lavinia Patranjan, Kai-Uwe Sattler, Myra Spiliopoulou, and Jef Wijsen, editors, Current Trends in Database Technology – EDBT 2006, pages 687–699, Berlin, Heidelberg, 2006. Springer Berlin Heidelberg. 19 Amit Goyal, Jagadeesh Jagarlamudi, Hal Daumé, III, and Suresh Venkatasubramanian. Sketch techniques for scaling distributional similarity to the web. In Proceedings of the 2010 Workshop on GEometrical Models of Natural Language Semantics, GEMS '10, pages 51–56, Stroudsburg, PA, USA, 2010. Association for Computational Linguistics. URL: http://dl.acm.org/citation.cfm?id=1870516.1870524. 20 Gurmeet Singh Manku and Rajeev Motwani. over data streams. Large Data Bases, VLDB '02, pages 346–357. VLDB Endowment, 2002. http://dl.acm.org/citation.cfm?id=1287369.1287400. frequency counts the 28th International Conference on Very URL: In Proceedings of Approximate 21 Muthu Muthukrishnan and Graham Cormode. Approximating data with the count-min sketch. volume 29, pages 64–69, Los Alamitos, CA, USA, 10 2011. IEEE Computer Society Press. URL: doi.ieeecomputersociety.org/10.1109/MS.2011.127, doi:10.1109/MS.2011.127. ESA 2018 XX:14 Buffered Count-Min Sketch on SSD: Theory and Experiments 22 23 Suman Nath, Phillip B. Gibbons, Srinivasan Seshan, and Zachary R. Anderson. Synopsis diffusion for robust aggregation in sensor networks. In Proceedings of the 2Nd Interna- tional Conference on Embedded Networked Sensor Systems, SenSys '04, pages 250–262, New York, NY, USA, 2004. ACM. URL: http://doi.acm.org/10.1145/1031495.1031525, doi:10.1145/1031495.1031525. Prashant Pandey, Michael A. Bender, Rob Johnson, and Robert Patro. A general-purpose counting filter: Making every bit count. In Proceedings of the 2017 ACM International Conference on Management of Data, SIGMOD Conference 2017, Chicago, IL, USA, May 14-19, 2017, pages 775–787, 2017. URL: http://doi.acm.org/10.1145/3035918.3035963, doi:10.1145/3035918.3035963. 24 Martin Raab and Angelika Steger. "balls into bins"-a simple and tight analysis. Randomization and Approximation Techniques in Computer Science, pages 159–170, 1998. 25 Tim Roughgarden and Gregory Valiant. Cs168: The modern algorithmic toolbox lecture #2: Approximate heavy hitters and the count-min sketch, 2018. 26 Tamás Sarlós, Adrás A. Benczúr, Károly Csalogány, Dániel Fogaras, and Balázs Rácz. To randomize or not to randomize: Space optimal summaries for hyperlink analysis. In Proceedings of the 15th International Conference on World Wide Web, WWW '06, pages 297–306, New York, NY, USA, 2006. ACM. URL: http://doi.acm.org/10.1145/1135777.1135823, doi:10.1145/1135777.1135823. Stuart Schechter, Cormac Herley, and Michael Mitzenmacher. Popularity is everything: A new approach to protecting passwords from statistical-guessing attacks. In Proceedings of the 5th USENIX Conference on Hot Topics in Security, HotSec'10, pages 1–8, Berkeley, CA, USA, 2010. USENIX Association. URL: http://dl.acm.org/citation.cfm?id=1924931.1924935. 28 David P. Woodruff. New algorithms for heavy hitters in data streams. CoRR, abs/1603.01733, 27 2016. URL: http://arxiv.org/abs/1603.01733. 29 Yin Zhang, Sumeet Singh, Subhabrata Sen, Nick Duffield, and Carsten Lund. Online identi- fication of hierarchical heavy hitters: Algorithms, evaluation, and applications. In Proceedings of the 4th ACM SIGCOMM Conference on Internet Measurement, IMC '04, pages 101–114, New York, NY, USA, 2004. ACM. URL: http://doi.acm.org/10.1145/1028788.1028802, doi:10.1145/1028788.1028802. 30 Qi (George) Zhao, Mitsunori Ogihara, Haixun Wang, and Jun (Jim) Xu. Finding global icebergs over distributed data sets. In Proceedings of the Twenty-fifth ACM SIGMOD- SIGACT-SIGART Symposium on Principles of Database Systems, PODS '06, pages 298–307, New York, NY, USA, 2006. ACM. URL: http://doi.acm.org/10.1145/1142351.1142394, doi:10.1145/1142351.1142394.
1006.1117
1
1006
2010-06-06T17:03:09
On the hardness of distance oracle for sparse graph
[ "cs.DS" ]
In this paper we show that set-intersection is harder than distance oracle on sparse graphs. Given a collection of total size n which consists of m sets drawn from universe U, the set-intersection problem is to build a data structure which can answer whether two sets have any intersection. A distance oracle is a data structure which can answer distance queries on a given graph. We show that if one can build distance oracle for sparse graph G=(V,E), which requires s(|V|,|E|) space and answers a (2-\epsilon,c)-approximate distance query in time t(|V|,|E|) where (2-\epsilon) is a multiplicative error and c is a constant additive error, then, set-intersection can be solved in t(m+|U|,n) time using s(m+|U|,n) space.
cs.DS
cs
On the hardness of distance oracle for sparse graph Hagai Cohen and Ely Porat⋆ Department of Computer Science, Bar-Ilan University, 52900 Ramat-Gan, Israel {cohenh5,porately}@cs.biu.ac.il Abstract. In this paper we show that set-intersection is harder than distance oracle on sparse graphs. Given a collection of total size n which consists of m sets drawn from universe U , the set-intersection problem is to build a data structure which can answer whether two sets have any intersection. A distance oracle is a data structure which can answer distance queries on a given graph. We show that if one can build distance oracle for sparse graph G = (V, E), which requires s(V , E) space and answers a (2 − ǫ, c)-approximate distance query in time t(V , E) where 2 − ǫ is a multiplicative error and c is a constant additive error, then, set-intersection can be solved in t(m + U , n) time using s(m + U , n) space. 1 Introduction and Related Work Let G = (V, E) be a graph. The all-pairs shortest paths problem (APSP) requires to construct a data structure for a given graph G so that the exact distance be- tween every two vertices on that graph can be retrieved efficiently. This problem is one of the most fundamental graph problems of computer science. Despite the importance of this problem, there is still no efficient solution for it using less than O(V 2) space. When the graph is dense, i.e., when E = O(V 2), this space is not much. But, for sparse graphs where E = O(V ) this is extremely a lot of space. Thorup and Zwick [1] explored an alternative for the APSP problem. They introduced a solution for the approximate distance oracle, which is a data struc- ture that answers approximate distance queries in a graph. They achieved that, for any integer k ≥ 1, an undirected weighted graph with n vertices and m edges can be preprocessed in expected O(kmn1/k) time to construct a data structure of size O(kn1+1/k) that can answer any (2k − 1)-approximate distance query in O(k) time. This means that the distance oracle answers distance queries with multiplicative error of 2k − 1. In this paper we show by a reduction from the set intersection problem that it is hard to build a (2 − ǫ, c)-approximate distance oracle where 2 − ǫ is a multiplicative error and c is a constant additive error. ⋆ This work was supported by BSF and ISF In the set intersection problem, we are given a collection of sets which we can preprocess. Then, given two sets we need to answer quickly whether there is any intersection between the sets. This is a common problem in many fields, especially in retrieval algorithms and search engines. The formal definition of the problem is as follows: Definition 1. Let D be a database consisting of a collection of m sets drawn from universe U , S1, . . . , Sm ⊆ U . Denote n to be the input size, i.e., n = Pm i=1 Si. The set intersection problem is to build a data structure that given a query of two indices i, j ≤ m, can answer if sets Si and Sj have any intersection. Cohen and Porat [2] showed how the set intersection problem can be solved in O(√n) query time using O(n) space. Their solution is based on dividing the sets in the database D to large and non-large sets, where they define a large set to be a set which has more than √n elements. They construct a set intersection matrix for the large sets in D, which is a matrix saving for each pair of sets if there is any intersection between them. They showed that the number of large sets is at most √n, thus, this matrix costs √n×√n = O(n) bits space. Moreover, for each set in D they store a static hash table to retrieve in O(1) time if an element belongs to that set or not. Given a query consisting of two indices i, j, if both Si and Sj are large sets, the answer can be retrieved from the set intersection matrix in O(1) time. Otherwise, one of the sets is a non-large set, i.e., it has less than √n elements. On this case, the answer can be retrieved by going over all the elements of the smaller set, checking for each one of them if it belongs to the other set in O(1) time. Because non-large sets have at most O(√n) elements, this takes at most O(√n) time. This solution can be easily extended to a tunable solution. If we define a large set to be a set with more than t elements, the number of large sets can be at most n t2 ) space. Hence, this problem can be answered in O(t) query time using O( n2 t sets. Thus, the set intersection matrix costs O( n2 t2 ) space. In this paper we show a reduction from the set intersection problem to dis- tance oracle on sparse graphs. In Sect. 2 we show that if one can build a dis- tance oracle using s(V ,E) space with t(V ,E) query time, which answers (2 − ǫ)-approximate distance queries, the set intersection problem can be solved in t(m + U, n) query time using s(m + U, n) space. In Sect. 3 we extend the reduction to a (2 − ǫ)-approximate distance oracle with constant additive error. 2 Set Intersection Reduction In the next theorem we claim that if one can build a distance oracle that answers (2− ǫ)-approximate distance queries, the set intersection problem can be solved. Theorem 1. Let G = (V, E) be a sparse graph. Given a distance oracle that an- swers (2− ǫ)-approximate distance queries using s(V ,E) space with t(V ,E) query time, we can solve the set intersection problem using s(m + U, n) space with t(m + U, n) query time. i=1 Si. Proof. For the set intersection problem we are given a database D consisting of m sets drawn from universe U , S1, . . . , Sn ⊆ U . We denote n to be the input size, i.e., n = Pm We construct a bipartite graph with two disjoint sets of vertices: V1 with vertices for each set in D and V2 with vertices for each element in U . Hence, V1 = m and V2 = U. The edges between V1 and V2 are simple, if an element e ∈ U belongs to a set s then there is an edge between the corresponding vertices in the bipartite graph. Because this graph is a bipartite graph it is simple that the distance between each two vertices must be even. We can see that if two sets have any intersection between them, the distance between the corresponding vertices is 2. The number of edges on this graph is bounded by n. We construct a distance oracle for this graph which answers (2 − ǫ)-approximate distance queries using s(m + U, n) space. Given two sets Si, Sj we would like to calculate if there is any intersection between them. To answer that we retrieve the approximate distance between the corresponding vertices of Si and Sj in the bipartite graph. Because both the vertices are in V1 if the approximate distance is less than 4−ǫ, the exact distance must be 2 because the distance must be even. This means that there is an element e that has an edge to either vi and vj, therefore, there is an intersection between Si and Sj. Otherwise, there is no such an element, hence, there is no intersection between the sets. Therefore, we can answer the set intersection problem in t(m + U, n) query time using s(m + U, n) space. ⊓⊔ 3 Distance Oracle with Constant Additive Error In this section we extend the reduction to (2 − ǫ)-approximate distance oracle with constant additive error. We prove that set intersection is harder than ap- proximate distance oracle even for distance oracle with constant additive error. We denote a distance oracle with multiplicative error d and additive error c as (d, c)-approximation distance oracle. Theorem 2. Let G = (V, E) be a sparse graph. Given a distance oracle that an- swers (2−ǫ, c)-approximate distance queries using s(V ,E) space with t(V ,E) query time, we can solve the set intersection problem using s(m + U, n) space with t(m + U, n) query time. Proof. We build a bipartite graph as in the proof of Theorem 1. But now each edge between V1 and V2 will be a path of 2 ǫ (c− 1) vertices. This adds a constant number of vertices and edges, hence, the space cost of a distance oracle for the bipartite graph is still s(m + U, n) space. Given two sets Si, Sj we would like to calculate if there is any intersection between them. To answer that we retrieve the approximate distance between the corresponding vertices of Si and Sj in the bipartite graph. If the approximated distance is less than 4c ǫ , because the distance oracle is (2 − ǫ, c)-approximate distance oracle, it means that the exact distance has to be less than 4c ǫ − 4c + c. The minimal distance between vertex ǫ × (2 − ǫ) + c = 8c in V1 and vertex in V2 is 2 ǫ (c − 1), hence, the distance is exactly 4 ǫ (c − 1) and therefore there is an intersection. If the approximated distance is greater than 4c ǫ , there would be no intersection because the distance is too high. s(m + U, n) space. By that we solved the set intersection problem in t(m + U, n) time using ⊓⊔ 4 Conclusions In this paper we showed that set intersection is harder than distance oracle on sparse graphs. We showed how the set intersection problem can be solved using (2 − ǫ)-approximate distance oracle with constant additive error. References 1. Thorup, M., Zwick, U.: Approximate distance oracles. In: STOC '01: Proceedings of the thirty-third annual ACM symposium on Theory of computing, New York, NY, USA, ACM (2001) 183 -- 192 2. Cohen, H., Porat, E.: Fast set intersection and two-patterns matching. In L´opez- Ortiz, A., ed.: LATIN. Volume 6034 of Lecture Notes in Computer Science., Springer (2010) 234 -- 242
1809.05791
1
1809
2018-09-16T01:42:13
Constant factor FPT approximation for capacitated k-median
[ "cs.DS" ]
Capacitated k-median is one of the few outstanding optimization problems for which the existence of a polynomial time constant factor approximation algorithm remains an open problem. In a series of recent papers algorithms producing solutions violating either the number of facilities or the capacity by a multiplicative factor were obtained. However, to produce solutions without violations appears to be hard and potentially requires different algorithmic techniques. Notably, if parameterized by the number of facilities $k$, the problem is also $W[2]$ hard, making the existence of an exact FPT algorithm unlikely. In this work we provide an FPT-time constant factor approximation algorithm preserving both cardinality and capacity of the facilities. The algorithm runs in time $2^{\mathcal{O}(k\log k)}n^{\mathcal{O}(1)}$ and achieves an approximation ratio of $7+\varepsilon$.
cs.DS
cs
Constant factor FPT approximation for capacitated k-median Marek Adamczyk ∗ University of Warsaw Jaros law Byrka † University of Wroc law Jan Marcinkowski ‡ University of Wroc law Syed M. Meesum § University of Wroc law Micha l W lodarczyk ¶ University of Warsaw Abstract Capacitated k-median is one of the few outstanding optimization problems for which the existence of a polynomial time constant factor approximation algorithm remains an open prob- lem. In a series of recent papers algorithms producing solutions violating either the number of facilities or the capacity by a multiplicative factor were obtained. However, to produce solutions without violations appears to be hard and potentially requires different algorithmic techniques. Notably, if parameterized by the number of facilities k, the problem is also W [2] hard, making the existence of an exact FPT algorithm unlikely. In this work we provide an FPT-time constant factor approximation algorithm preserving both cardinality and capacity of the facilities. The algorithm runs in time 2O(k log k)nO(1) and achieves an approximation ratio of 7 + ε. 1 Introduction For many years approximation algorithms and FPT algorithms were developed in parallel. Recently the two paradigms are being combined and provide intriguing discoveries in the intersection of the two worlds. It is particularly interesting in the case of problems for which we fail to progress improving the approximation ratios in polynomial time. An excellent example of such a combination is the FPT approximation algorithm for the k-Cut problem by Gupta et al. [15]. In this work we focus on the Capacitated k-Median problem, whose approximability attracted attention of many researchers. Unlike in the case of the k-Cut problem, it is still not clear what approximation is possible for Capacitated k-Median in polynomial time. As shall be discussed in more detail in the following section, the best true approximation known is O(log k) based on tree embedding of the underlying metric. The other algorithms either violate the bound on the number of facilities or the capacity constraints. Our main result is a (7 + ǫ)-approximation algorithm for the Capacitated k-Median problem running in FPT(k) time, that exploits techniques from both -- approximation and FPT -- realms. The algorithm builds on the idea of clustering the clients into ℓ = O(k · (log n)/ε) locations, which ∗[email protected][email protected][email protected] §[email protected][email protected] 1 is similar to the approach from the O(log k)-approximation algorithm, where one creates O (k) clusters. This is followed by guessing the distribution of the k facilities inside these ℓ clusters. Having such a structure revealed, we simplify the instance further by rounding particular distances and reduce the problem to linear programming over a totally unimodular matrix. 1.1 Problems overview and previous work In the Capacitated k-Median problem (CKM), we are given a set F of facilities, each facility f with a capacity uf ∈ Z>0, a set C of clients, a metric d over F ∪ C and an upper bound k on the number of facilities we can open. A solution to the CKM problem is a set S ⊆ F of at most k open facilities and a connection assignment φ : C → S of clients to open facilities such that (cid:12)(cid:12)φ−1(f )(cid:12)(cid:12) 6 uf for every facility f ∈ S. The goal of the problem is to find a solution that minimizes the connection cost Pc∈C d(c, φ(c)). In the case when all the facilities can serve at most u clients, for some integer u, we obtain the Uniform CKM problem. Uncapacitated k-median The standard k-median problem, where there is no restriction on the number of clients served by a facility, can be approximated up to a constant factor [9, 2]. The current best is the (2.675 + ǫ)-approximation algorithm of Byrka et al. [4], which is a result of optimizing a part of the algorithm by Li and Svensson [21]. Approximability of CKM As already stressed, Capacitated k-Median is among few re- maining fundamental optimization problems for which it is not clear if there exist polynomial time constant factor approximation algorithms. All the known algorithms violate either the number of facilities or the capacities. In particular, already the algorithm of Charikar et al. [9] gave 16- approximate solution for the uniform capacitated k-median violating the capacities by a factor of 3. Then Chuzhoy and Rabani [10] considered general capacities and gave a 50-approximation algorithm violating capacities by a factor of 40. The difficulty appears to be related to the unbounded integrality gap of the standard LP re- laxation. To obtain integral solutions that are bounded with respect to the fractional solution to the standard LP, one has to either allow the integral solution to open twice as much facilities or to violate the capacities by a factor of two. LP-rounding algorithms essentially matching these limits have been obtained [1, 3]. Subsequently, Li broke this integrality gap barrier by giving a constant factor algorithm for the capacitated k-median by opening (1 + ε) · k facilities [19, 20]. Afterwards analogous results, but violating the capacities by a factor of (1 + ε) were also obtained [5, 12]. The algorithms with (1 + ε) violations are all based on strong LP relaxations containing ad- ditional constraints for subsets of facilities. Notably, it is not clear if these relaxations can be solved exactly in polynomial time, still they suffice to construct an approximation algorithm via the "round-or-separate" technique that iteratively adds consistency constraints for selected subsets. Although while spectacularly breaking the standard LP integrality bound, these techniques appear insufficient to yield a proper approximation algorithm that does not violate constraints. The only true approximation for CKM known is a folklore O (log k) approximation algorithm that can be obtained via the metric tree embedding with expected logarithmic distortion [13]. To the best of our knowledge, this result has not been explicitly published, but it can be obtained similarly to the O (log k)-approximation for Uncapacitated KM by Charikar [7]. For the sake of 2 completeness and since it follows easily from our framework, we give its proof in Section 4 without claiming credit for it. This O (log k)-approximation is in contrast with other capacitated clustering problems such as facility location and k-center, for which constant factor approximation algorithms are known [17, 11]. 1.2 Parameterized Complexity A parameterized problem instance is created by associating an input instance with an integer parameter k. We say that a problem is fixed parameter tractable (FPT) if any instance (I, k) of the problem can be solved in time f (k) · IO(1), where f is an arbitrary computable function of k. We say that a problem is FPT if it is possible to give an algorithm that solves it in running time of the required form. Such an algorithm we shall call a parameterized algorithm. To show that a problem is unlikely to be FPT, we use parameterized reductions analogous to those employed in the classic complexity theory. Here, the concept of W-hardness replaces the one of NP-hardness, and we need not only to construct an equivalent instance in FPT time, but also ensure that the size of the parameter in the new instance depends only on the size of the parameter in the original instance. In contrast to the NP-hardness theory, there is a hierarchy of classes FPT = W[0] ⊆ W[1] ⊆ W[2] ⊆ . . . and these containments are believed to be strict. If there exists a parameterized reduction transforming a problem known to be W[t]-hard for t > 0 to another problem Π, then the problem Π is W[t]-hard as well. This provides an argument that Π is unlikely to admit an algorithm with running time f (k) · IO(1). We begin with an argument that allowing FPT time for (even uncapacitated) k-Median should not help in finding the optimal solution and we still need to settle for approximation. Fact 1. The Uncapacitated k-Median problem is W[2]-hard when parameterized by k, even on metrics induced by unweighted graphs. Proof. Consider an instance of the Dominating Set problem, which is W[2]-hard when param- eterized by the solution size. A dominating set of size at most k exists in graph G if and only if we can find a vertex set S of size k, such that all other vertices are at distance 1 from S. This is equivalent to the solution to Uncapacitated k-Median on the metric induced by G being of size exactly V (G) − k. Parameterized Approximation In recent years new research directions emerged in the inter- section of the theory of approximation algorithms and the FPT theory. It turned out that for some problems that are intractable in the exact sense, parameterization still comes in useful when we want to reduce the approximation ratio. Some examples are (2−ε)-approximation for k-Cut [15] or f (F )-approximation for Planar-F Deletion [14] for some implicit function f . The dependency on F was later improved, leading to O(log k)-approximations for, e.g., k-Vertex Separator[18] and k-Treewidth Deletion [16]. On the other hand some problems parameterized by the solution size have been proven resistant to such improvements. Chalermsook et al. [6] observed that under the assumption of Gap-ETH there can be no parametrized approximation with ratio o(k) for k-Clique and none with ratio f (k) for k-Dominating Set (for any function f ). Subsequently Gap-ETH has been replaced with a better established hardness assumption FPT 6= W[1] for k-Dominating Set [23]. 3 1.3 Organization of the paper Our main result is stated in Theorem 11 (Section 3.3), where we present a (7 + ǫ)-approximation algorithm for the Non-Uniform CKM problem running in FPT(k) time. To obtain this result we need two ingredients. First is a metric embedding that reduces the problem to a simpler instance, called ℓ-centered, what is described in Section 2. This reduction provides a richer structure, which can be exploited to obtain an O (log k)-approximation via tree embeddings [13]. As already mentioned, similar approach was presented by Charikar et al. [7] in their algorithm for the uncapacitated setting. We present this result for the sake of completeness in Section 4, after the main result. The second ingredient is a parameterized algorithm for the ℓ-centered instances. Since it is simpler in the uniform setting, we solve it in Section 3.2 as a warm up before the main result. This way the new ideas are being revealed gradually to the reader. 2 ℓ-Centered instances Suppose we work with a graph on nodes F ∪ C, on which we are given a metric d. In our con- siderations the set F ∪ C will be fixed throughout, however we will be modifying the metric over it. Consider an algorithm ALG which produces a solution ALG (d) for a metric d. This solution can be seen as a mapping which we explicitly denote by φALG(d). Its cost in the metric d′ equals Pc∈C d′(cid:0)c, φALG(d)(cid:1) which we shall briefly denote by cost(cid:0)φALG(d), d′(cid:1). The second argument is useful, when an algorithm ALG produces a solution (mapping) ALG (d) with respect to metric d, but later on we may be interested in its cost over a different metric. Also, let OP T (d) denote the optimum solution for the CKM problem on metric d. In order to solve CKM, we shall invoke an algorithm for Uncapacitated KM as a subroutine. Let ALGℓ unc (d) be a relaxed solution that opens up to ℓ ≥ k facilities and can break the capacity constraints. It induces a mapping which, for consistency, we shall denote by φALGℓ unc(d). Observe that in this mapping every client can be connected to the closest open facility. Since Uncapac- itated KM admits constant approximation algorithms, we can work with solutions satisfying: cost(cid:16)φALGℓ constant we will be able to achieve in the relation above. unc(d), d(cid:17) = O(cid:0)cost(cid:0)φOP T (d), d(cid:1)(cid:1). The larger ℓ we allow in the relaxation, the smaller Using such an algorithm for Uncapacitated KM as a subroutine, we can find a simpler metric unc (d)) be the set unc (d). For each such a facility f we create a copy vertex sf , which is to work with. First we build a graph which will induce the metric. Let F (ALGℓ of facilities opened by ALGℓ at distance 0 from f . We denote the set of copies by S, i.e., S =(cid:8)sf(cid:12)(cid:12)f ∈ F (ALGℓ that we demand the distance from f to sf to be 0, we can naturally extend the metric d to the set C ∪ F ∪ S. To distinguish facilities from F (ALGℓ unc (d)) from their copies S, we shall call each copy s ∈ S a center. unc (d))(cid:9). Given We build a complete graph on S and preserve the metric d therein. For every node v 6∈ S, be it either a client from C or a facility from F , we place an edge to the closest (according to the extended d) center sv ∈ S and set its length to d (v, sv). We call such a graph ℓ-centered and refer to its induced metric as dℓ. Definition 2. An instance of CKM is called ℓ-centered if the metric, which we shall denote by dℓ, is induced by a weighted graph G(F ∪ C ∪ S, E) such that 1. S 6 ℓ, 4 Figure 1: An ℓ-centered instance. In the upper layer there is a set S of l vertices connected as a clique. The rest of vertices are divided into separate clusters. Vertices in a single cluster are only connected to their center in the set S. 2. (cid:0)S 2(cid:1) ⊆ E, i.e., S forms a clique, 3. for every v ∈ C ∪ F there is only one edge incident to v in E, and it connects v to some sv ∈ S. For a center s ∈ S we shall say that all nodes from F ∪ C that are connected to s form a cluster of s. If we consider only nodes from F , then we talk about an f -cluster of s, denoted F (s). In the following lemma we relate the cost of embedding the optimum solution OP T (d) from a metric d to dl. Lemma 3 (Embedding d into l-centered metric dl). Let ALGℓ unc (d) be a solution for the Unca- pacitated KM problem on metric d from which we construct the ℓ-centered instance. Optimal solution OP T (d) can be embedded into an l-centered metric dl with the cost relation being cost(cid:16)φOP T (d), d(cid:17) 6 cost(cid:16)φOP T (d), dl(cid:17) 6 3 · cost(cid:16)φOP T (d), d(cid:17) + 4 · cost(cid:16)φALGℓ unc(d), d(cid:17) . Proof. Let c be a client connected to facility fc in the optimal solution OP T (d). Let sc be the center closest to c within S (the ℓ-center), and let sfc be the center closest to fc. First let us note that dl (c, fc) = d (c, sc) + d(cid:0)sc, sfc(cid:1) + d(cid:0)sfc , fc(cid:1). Now let us bound the terms d(cid:0)fc, sfc(cid:1) and d(cid:0)sc, sfc(cid:1) separately. Fact 4. For every client c and its facility fc from OP T we have d(cid:0)fc, sfc(cid:1) 6 d (fc, c) + d (c, sc). Proof. Since sfc is the closest ℓ-center to the facility fc, we have that d(cid:0)fc, sfc(cid:1) 6 d (fc, sc). At the Fact 5. For each c we have d(cid:0)sc, sfc(cid:1) 6 2 (d (fc, c) + d (c, sc)). same time, from the triangle inequality it follows that d (fc, sc) 6 d (fc, c) + d (c, sc). 5 c fc sc sfc Figure 2: Situation in Lemma 3. In the optimum solution to the CKM instance, client c is connected to the facility fc. In the ℓ-centered instance c resides in a cell, where sc is a center. The center of fc is sfc. Proof. From the triangle inequality we know that d(cid:0)sc, sfc(cid:1) 6 d (sc, c) + d (c, fc) + d(cid:0)fc, sfc(cid:1) . From Fact 4 we also know that d(cid:0)fc, sfc(cid:1) 6 d (fc, c) + d (c, sc), and combining the two inequalities we get d(cid:0)sc, sfc(cid:1) 6 d (sc, c) + d (c, fc) + d(cid:0)fc, sfc(cid:1) 6 2 (d (fc, c) + d (c, sc)). These facts imply dl (c, fc) = d (c, sc) + d(cid:0)sc, sfc(cid:1) + d(cid:0)sfc , fc(cid:1) 6 d (c, sc) + d(cid:0)sc, sfc(cid:1) + (d (fc, c) + d (c, sc)) 6 d (c, sc) + 2 (d (fc, c) + d (c, sc)) + (d (fc, c) + d (c, sc)) = 3 · d (fc, c) + 4 · d (c, sc) , (from Fact 4) (from Fact 5) which implies the second inequality from the statement of Lemma 3. The first one directly comes from the triangle inequality completing the whole proof. d (c, fc) 6 d (c, sc) + d(cid:0)sc, sfc(cid:1) + d(cid:0)sfc , fc(cid:1) = dl (c, fc) , Another lemma is quite simple. Its proof just comes from the fact that metric dl dominates the metric d, i.e., dl (u, v) > d (u, v) for all pairs of vertices u, v ∈ C ∪ F . Lemma 6 (Going back from l-centered metric dl to d). Any solution for the l-centered metric dl can be embedded back into d without any loss: cost(cid:16)φALG(dl), dl(cid:17) > cost(cid:16)φALG(dl), d(cid:17) . 6 Blending together Lemmas 3 and 6 we can state the following Lemma about reducing the CKM problem to ℓ-centered instances. Lemma 7. Suppose we are given a solution ALGℓ on metric d which opens ℓ centers, but β-approximates the optimum solution OP T k unc (d) for the Uncapacitated KM problem unc (d) for Un- capacitated KM problem with k centers, i.e., cost(cid:0)ALGℓ Suppose we are given an α-approximation algorithm for the CKM problem on ℓ-centered instances. If so, then we can construct an α·(3 + 4β)-approximation algorithm for CKM on general instances. unc (d) , d(cid:1) 6 β · cost(cid:0)OP T k unc (d) , d(cid:1). Proof. Suppose that we have an α-approximation solution for the ℓ-centered instance with metric dl, i.e., ALG(dl) such that Since OP T (d) is some solution for the ℓ-centered instance with metric dl we have cost(cid:16)φALG(dl), dl(cid:17) 6 α · cost(cid:16)φOP T (dl), dl(cid:17) . And from Lemma 2 we have that cost(cid:16)φALG(dl), dl(cid:17) 6 α · cost(cid:16)φOP T (dl), dl(cid:17) 6 α · cost(cid:16)φOP T (d), dl(cid:17) . cost(cid:16)φALG(dl), dl(cid:17) 6 α · cost(cid:16)φOP T (dl), dl(cid:17) 6 α · cost(cid:16)φOP T (d), dl(cid:17) 6 α(cid:16)3 · cost(cid:16)φOP T (d), d(cid:17) + 4 · cost(cid:16)φALGℓ unc (d) β-approximates the optimal solution OP T k unc(d), d(cid:17)(cid:17) . Since solution ALGℓ KM with k centers on metric d, we have that unc (d) for Uncapacitated cost(cid:16)φALGℓ unc(d), d(cid:17) 6 β · cost(cid:16)φOP T k unc(d), d(cid:17) 6 β · cost(cid:16)φOP T (d), d(cid:17) . The second inequality cost(cid:16)φOP T k unc(d), d(cid:17) 6 cost(cid:0)φOP T (d), d(cid:1) follows from an obvious fact that uncapacitated version of the problem is easier than the capacitated. Hence cost(cid:16)φALG(dl), dl(cid:17) 6 α(cid:16)3 · cost(cid:16)φOP T (d), d(cid:17) + 4 · cost(cid:16)φALGℓ unc(d), d(cid:17)(cid:17) 6 α(cid:16)3 · cost(cid:16)φOP T (d), d(cid:17) + 4β · cost(cid:16)φOP T (d), d(cid:17)(cid:17) 6 α (3 + 4β) · cost(cid:16)φOP T (d), d(cid:17) . Since without any loss we can embed the solution ALG(dl) for the ℓ-centered metric dl into the initial metric d (Lemma 3) we obtain an α · (3 + 4β)-approximation algorithm. The claim follows. 3 Constant factor approximation In this section we present the main result of the paper which is a (7 + ε)-approximation algorithm for the Non-Uniform CKM problem. We precede it with a (7 + ε)-approximation algorithm for the Uniform CKM problem to introduce the ideas gradually. Both algorithms enumerate configurations of open facilities' locations, and as a subroutine we need to use an algorithm which, for a fixed configuration of k open facilities, finds the optimal assignment of clients to facilities. This subroutine is presented in the following subsection. 7 3.1 Optimal mapping subroutine We are given an ℓ-centered metric instance (F ∪ C ∪ S, dℓ) of the k-median problem. Suppose that we have already decided to open a fixed subset F open ⊆ F of the facilities and we look for a mapping φ : C → F open. In the uncapacitated case we can just assign each client to the closest facility in F open. It turns out that even in the capacitated setting we can find the mapping φ optimally in polynomial time for a given F open. We state the problem of finding the optimal φ as an integer program: subject to minimize Xc∈C Xf ∈F open Xf ∈F open Xc∈C dℓ(c, f ) · xc,f (MAPPING-IP) xc,f = 1 ∀c ∈ C, xc,f 6 uf ∀f ∈ F open, xc,f ∈ {0, 1}. In the above program xc,f = 1 represents the fact that φ(c) = f . Lemma 8. We can find an optimal solution to the (MAPPING-IP) in polynomial time. Proof. The proof follows from the fact that the relaxation of the above integer program -- a program which differs from (MAPPING-IP) only with the xc,f > 0 constraints instead of xc,f ∈ {0, 1} -- has an optimal solution which is integral. To see this, observe that the linear program is a formulation of the transportation problem. For such a linear program, the constraint matrix is totally unimodular, which implies the integrality of an extremal solution. See [24] for a reference. 3.2 Uniform case As a warm up, we begin with a parameterized algorithm for the uniform case. It is a bit simpler than the general case, because once we know the number of facilities to open in f -cluster F (s), then we can choose them greedily. Lemma 9. Uniform CKM can be solved exactly in time ℓk · nO(1) on ℓ-centered instances. Proof. Let (F ∪ C ∪ S, dℓ) be the ℓ-centered metric. Note that the f -clusters partition the whole set of facilities, i.e., ∪s∈SF (s) = F . Let OP T (dℓ) be an optimal solution for the CKM problem on dℓ. Every facility f ∈ F belongs to exactly one f -cluster F (s). Hence, the f -clusters partition the set of k facilities opened by OP T (dℓ). Let us look at all the facilities from a particular f -cluster F (s) opened by OP T (dℓ), and suppose that OP T (dℓ) opens ks of facilities in F (s). Since we consider a uniform capacity case, we can assume without loss that these ks open facilities from F (s) are exactly the ones that are closest to s. Therefore, if we know what is the number of facilities that OP T (dℓ) opens in each f -cluster, then we would know what the exact set of open facilities in OP T (dℓ) is due to the greediness in each f -cluster. To find out this allocation we can simply enumerate over all possibilities. We just need to scan over all configurations (ks)s∈S where Ps ks = k. Since there are k facilities to open, and each of them can belong to one of ℓ f -clusters F (s), there are at most ℓk possible configurations. 8 Of course some configurations may not be feasible since it may happen that ks > F (s), but these can be simply ignored. For each configuration (ks)s∈S we need to find the optimal mapping of clients to the set of by configuration (ks)s∈S, that is, where we greedily open ks facilities in f -cluster F (s). Given open facilities that preserves their capacities. Let F (cid:0)(ks)s∈S(cid:1) be the set of open facilities induced F (cid:0)(ks)s∈S(cid:1), to find the optimal mapping we use the polynomial time exact algorithm from Lemma 8 with F open = F (cid:0)(ks)s∈S(cid:1). Once we know the optimal assignment for each configuration, we can simply take the cheapest one, knowing that it is the optimal one. This proves the lemma. This lemma suffices to obtain a (7 + ε)-approximation for Uniform CKM with a reasoning that we will present in Theorem 11 in full generality. 3.3 Non-uniform case Lemma 10. Non-Uniform CKM can be solved with approximation ratio (1 + ǫ) in time ε ln n (cid:0)O(cid:0)ℓ · 1 ε(cid:1)(cid:1)k nO(1) on ℓ-centered instances. Proof. We begin with guessing the largest distance in dℓ between a client and a facility that would appear in the optimal solution -- let us denote this quantity as D. There are at most O(n2) choices for D, and from now we assume that it is guessed correctly. Note that D ≤ cost (OP T (dℓ), dℓ) and D ≥ d(f, sf ) for all facilities opened by OP T (dℓ). Consider the set of facilities F (s) in the cluster of a center s. We can remove all facilities f such that d(s, f ) > D, because they cannot be a part of the optimal solution. Let us partition remaining facilities from F (s) into buckets F0 (s) , F1 (s) , ..., F⌈ log1+ε ε ⌉ (s), such that n Fi (s) =  nf ∈ F (s)(cid:12)(cid:12)(cid:12) nf ∈ F (s)(cid:12)(cid:12)(cid:12) d (s, f ) ∈h(1 + ε)−(i+1) D, (1 + ε)−i Dio for i <(cid:6) log1+ε d (s, f ) ∈h0, (1 + ε)−⌈ log1+ε for i =(cid:6) log1+ε n n ε(cid:7) ε(cid:7) n The number of buckets equals log1+ε n ε = 1 ln(1+ε) ln n ℓ(s, f ) = (1 + ε)−i D for f ∈ Fi (s). The distances within S remain untouched. Observe ε ln n ε(cid:1). We modify the metric again ε ⌉ Dio ε = O(cid:0) 1 by setting d′ that the distances can only increase. We shall guess the structure of the solution OP T (d′ ℓ) similarly as in Lemma 9. For each of the k facilities, we can choose its location as follows: first we choose one of the ℓ-centers s (ℓ choices), and then we choose one of the Fi (s) partitions (O(cid:0) 1 facilities in a particular partition Fi (s) as ks,i. We can assume that ks,i ≤ Fi (s) because otherwise we know that the guess was incorrect. Since d′ ℓ(s, f ) is the same for all f ∈ Fi (s), we can assume the optimal solution opens ks,i facilities with the biggest capacities. ε(cid:1) choices). Let us denote the number of ε ln n Once we establish the set of facilities to open, we can find the optimal assignment in metric d′ ℓ using the polynomial time exact subroutine from Lemma 8. The total time complexity of solving the problem exactly over d′ ℓ equals the running time of the subroutine times the number of possible configurations, which is (cid:0)O(cid:0)ℓ · 1 ε ln n ε(cid:1)(cid:1)k nO(1). 9 It remains to prove that the algorithm yields a proper approximation. We will show that for any solution SOL it holds that (1) ℓ of cost at cost(cid:0)φSOL, dℓ(cid:1) 6 cost(cid:0)φSOL, d′ ℓ(cid:1) 6 (1 + ε) · cost(cid:0)φSOL, dℓ(cid:1) + ε · D. By substituting SOL = OP T (dℓ) we learn that there exists a solution over metric d′ most (1 + ε) · cost(cid:0)φOP T (dℓ), dℓ(cid:1) + ε · D ≤ (1 + 2ε) · cost(cid:0)φOP T (dℓ), dℓ(cid:1) for correctly guessed D. Therefore the cost of the solution found by our algorithm cannot be larger. Finally we substitute this solution as SOL to see that its cost cannot increase when returning to metric dℓ. The claim will follow by adjusting ε. The first inequality in (1) is straightforward because d′ ℓ dominates dℓ. Consider now a pair ℓ(c, f ) ≤ (1 + ε) · dℓ(c, f ), so the cost of connecting such pairs increases at most by a multiplicative factor (1 + ε) during the n . Since there are at most n such pairs, the (c, f = φSOL(c)), where f ∈ Fi (s). If i < (cid:6) log1+ε metric switch. If i = (cid:6) log1+ε ε(cid:7) , then dℓ(c, f ) ≤ d′ total additive cost increase is bounded by ε · D. ε(cid:7) , then d′ ℓ(s, f ) = εD n n Theorem 11. Non-Uniform CKM can be solved with approximation ratio (7 + ǫ) in time (k/ǫ)O(k)nO(1). Proof. From Lemma 10 we know that we can get a (1 + ε) −approximation algorithm for the Non- nO(1). We shall use the (1 + ε)-approximation for Uncapacitated KM by Lin and Vitter [22], that opens at most Uniform CKM problem on ℓ-centered instances in time (cid:0)O(cid:0)ℓ · 1 ℓ =(cid:0)1 + 1 together with Lemma 10, we obtain a (7 + ε) −approximation algorithm for the general Non- Uniform CKM problem with running time ε(cid:1) k · (ln n + 1) facilities. By plugging this subroutine to find ℓ-centers into the Lemma 7 O (cid:18)(cid:18)1 + ε(cid:19)k! nO(1) = O (cid:18) 1 εO(1) k ln2 n(cid:19)k! nO(1). ε(cid:19) k · (ln n + 1) · ε(cid:1)(cid:1)k ε ln n 1 ε ln n 1 ln n Finally, we use standard arguments to show that (ln n)2k ≤ max(n, kO(k)). Consider two cases. If 2 ln ln n ≤ k, then by inverting we know that ln n = O (k ln k), and so (ln n)2k = kO(k). Suppose now that 2 ln ln n > k. In this case ln n (ln n)2k < (ln n) ln n ln ln n = 2ln ln n· ln n ln ln n = n. 4 O (log k)-approximation In this section present a polynomial-time O (log k)-approximation algorithm for CKM. A constant- factor approximation algorithms for Uncapacitated KM exist [9], and so it is a clear conse- quence of the Lemma 7 with β being constant that it is sufficient for us to construct an O (log k)- approximation algorithm for the k-centered instances. A standard tool to provide such a guarantee is the Probabilistic Tree Embedding by [13]. This makes our algorithm a randomized one, but if needed, it is possible to derandomize it using the ideas from [8]. 10 Definition 12. A set of metric spaces T together with a probability distribution πT over T probabilistically α-approximates the metric space (X, d) if 1. Every metric τ ∈ T dominates (X, d), that is, d(x, y) 6 τ (x, y) ∀x, y ∈ X. 2. For every pair of points x, y ∈ X its expected distance is not expanded by more then α, i.e., Eτ ∼πT [τ (x, y)] 6 α · d(x, y). It is a well-known fact, that any metric (X, d), can be probabilistically O(log X)-approximated by a distribution of tree metrics, such that the points in X are the leaves in the resulting tree [13]. As described in Definition 2, our k-centered metric dk is induced by a graph composed of two layers -- the set S of k vertices connected in a clique, and the rest of vertices, F ∪C, each connected to only one vertex in S. Let T be a random tree embedding of the set S (with a metric function dT ). A modified instance GT of our problem is created by replacing the clique S with its tree approximation T . Lemma 13. An optimum solution for CKM on the instance GT is in expectation at most O (log k) times larger than the optimum for the metric dk. Proof. OP T (dk) denotes the optimum mapping of clients to k facilities in the k-centered metric dk. Consider client c and facility f = φOP T (dk) (c). Let now sc be the center of c and sf the center of f . The cost of connecting client c to f amounts to in the metric dk. dk (c, f ) = dk (c, sc) + dk(cid:0)sc, sf(cid:1) + dk(cid:0)sf , f(cid:1) The guarantee of tree embeddings gives us an upper bound on a cost of applying the same mapping in the instance GT , E [dT (c, f )] = dk (c, sc) + E(cid:2)dT (cid:0)sc, sf(cid:1)(cid:3) + dk(cid:0)sf , f(cid:1) 6 dk (c, sc) + O (log k) · dk(cid:0)sc, sf(cid:1) + dk(cid:0)sf , f(cid:1) 6 O (log k) · dk (c, f ) . Which means that E(cid:2)cost(cid:0)φOP T (dk), dT(cid:1)(cid:3) 6 O (log k)·cost(cid:0)φOP T (dk), dGk(cid:1). Moreover, OP T (dk) might not be the optimal solution for the metric dT , yet its optimal solution can only have smaller cost: cost(cid:16)φOP T (dT ), dT(cid:17) 6 cost(cid:16)φOP T (dk), dT(cid:17) Theorem 14. The CKM problem admits an O(log k)-approximation algorithm with polynomial running time. Proof. After applying the probabilistic tree embedding to the graph inducing dk -- as presented in Lemma 13 -- we obtain a tree instance GT . It should come as no surprise that the problem is polynomially solvable on trees and we explain how to find the optimum solution on GT in Lemma 16. The assignment φOP T (dT ), which yields the minimum cost on the tree GT , can be now used to match clients to facilities in the original instance. It does not incur any additional cost, as cost(cid:16)φOP T (dT ), dT(cid:17) > cost(cid:16)φOP T (dT ), dk(cid:17) > cost(cid:16)φOP T (dT ), d(cid:17) from the property (1) of Definition 12 and Lemma 6. Combining this with a bound on E(cid:2)cost(cid:0)φOP T (dk), dT(cid:1)(cid:3) from Lemma 13 finishes the proof. 11 et t (a) et et1 hk′ , bi et2 hk′ 1 , b1 i hk′ 2 , b2 i t1 t2 (b) Figure 3: (a) A subtree t with some open facilities (squares) and a number of clients (circles). If the total capacity of facilities opened in t exceeds the needs of the clients, we may decide to connect some clients from outside through edge et. If the capacity of open clients is too small, we may connect some clients with outside facilities through et. It never makes sense to do both. (b) A dynamic programming step. To compute D(t, k′, b) we need to find the cheapest solutions for subtrees, such that k′ 2 = k′ and b1 + b2 = b. The additional cost incurred is d(et) · b. 1 + k′ 4.1 CKM on a tree The second ingredient to the O(log k)-approximation for CKM is solving the problem exactly on trees. We will now describe a simple, exact, polynomial algorithm for that special case. In our algorithm we can assume, that all the clients and facilities reside in leaves, but the principle is easy to extend to the general problem on trees. Imagine we have a subtree t of the tree instance, hanging on an edge et. Once we have decided, which facilities to open inside the subtree t, we know if their total capacity is sufficient to serve all the clients inside t. If not, then we need to route some clients' connections to the facilities outside through the edge et. However, if the facilities we have opened in t have enough total capacity to serve some b clients from the outside, we will connect them through the edge et (see Figure 3). This insight lays out the dynamic algorithm for us. We first turn the tree into a complete binary tree by adding dummy vertices and edges of length 0 (which may double its size). Then, for every subtree t, numbers k′ and b, we compute D(t, k′, b). Definition 15. D(t, k′, b), for subtree t, number k′ ∈ {0, . . . , k} of facilities and balance b ∈ {−n, . . . , n}, is the minimum cost of opening exactly k′ facilities in t and routing exactly b clients down through et (b < 0 would mean that we are routing −b clients up). The cost of routing is counted to the top endpoint of et. Lemma 16. The CKM problem on trees admits a polynomial time exact algorithm. Proof. Computing D(t, k′, b) on t with two children t1 and t2 amounts to finding k′ 1, k′ 2, b1 and b2 12 that minimize D(t1, k′ 1, b1) + D(t2, k′ 2, b2), such that b1 + b2 = b and k′ pair hk′, bi. Once k′ 1, k′ 2, b1 and b2 are found, we set 1 + k′ 2 = k′. They can be trivially found in O (k · n) time for a single D(t, k′, b) = D(t1, k′ 1, b1) + D(t2, k′ 2, b2) + d(et) · b, where d(e) is the length of the edge in our tree. For a leaf l, D(l, k′, b) is defined naturally, depending on whether the leaf holds a client or a facility. Note, that for a leaf with a facility, D(l, 1, b) is finite also for b smaller than the capacity of the facility, as the optimal solution might not use it entirely. Finally, the optimum solution to the CKM problem on the entire tree T is equal to min k′∈{1,...,k} D(T, k′, 0). 5 Conclusions and open problems We have presented a (7 + ε)-approximation algorithm for the CKM problem, which consists of three building blocks: approximation for Uncapacitated KM, metric embedding into a simpler structure, and a parameterized algorithm working on ℓ-centered instances. Whereas the first and the last ingredient are almost lossless from the approximation point of view, the embedding procedure seems to be the main bottleneck for obtaining a better approxi- mation guarantee. One can imagine that a different technique would allow to obtain a (1 + ε)- approximation in FPT time. We believe that finding such an algorithm or ruling out its existence is an interesting research direction. Another avenue for improvement is processing k-centered instances in time 2O(k)nO(1). Such a routine would reduce the running time of the whole algorithm to single exponential. In order to do so, one could replace the subroutine for Uncapacitated KM by Lin and Vitter [22] with a standard approximation algorithm that opens exactly k facilities, what would moderately increase the constant in approximation ratio. Finally, whereas we have used the framework of ℓ-centered instances to devise an FPT ap- proximation, it might be possible to explore the structure of special instances further and find a polynomial time approximation algorithm. This could yield an improvement over the O(log k)- approximation ratio for CKM, which remains a major open problem. 13 References [1] K. Aardal, P. L. van den Berg, D. Gijswijt, and S. Li. Approximation algorithms for hard capac- itated k-facility location problems. European Journal of Operational Research, 242(2):358 -- 368, 2015. 1.1 [2] V. Arya, N. Garg, R. Khandekar, A. Meyerson, K. Munagala, and V. Pandit. Local search heuristics for k-median and facility location problems. SIAM Journal on Computing, 33(3):544 -- 562, 2004. 1.1 [3] J. Byrka, K. Fleszar, B. Rybicki, and J. Spoerhase. Bi-factor approximation algorithms for hard capacitated k-median problems. In Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 722 -- 736. SIAM, 2015. 1.1 [4] J. Byrka, T. Pensyl, B. Rybicki, A. Srinivasan, and K. Trinh. An improved approximation for k-median, and positive correlation in budgeted optimization. In Proceedings of the Twenty- Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 737 -- 756. SIAM, 2015. 1.1 [5] J. Byrka, B. Rybicki, and S. Uniyal. An approximation algorithm for uniform capacitated k-median problem with 1 + ǫ capacity violation. In Integer Programming and Combinatorial Optimization - 18th International Conference, IPCO 2016, Li`ege, Belgium, June 1-3, 2016, Proceedings, pages 262 -- 274, 2016. 1.1 [6] P. Chalermsook, M. Cygan, G. Kortsarz, B. Laekhanukit, P. Manurangsi, D. Nanongkai, and L. Trevisan. From gap-eth to fpt-inapproximability: Clique, dominating set, and more. In Foundations of Computer Science (FOCS), 2017 IEEE 58th Annual Symposium on, pages 743 -- 754. IEEE, 2017. 1.2 [7] M. Charikar, C. Chekuri, A. Goel, and S. Guha. Rounding via trees: Deterministic approxima- tion algorithms for group steiner trees and k -median. In Proceedings of the Thirtieth Annual ACM Symposium on the Theory of Computing, Dallas, Texas, USA, May 23-26, 1998, pages 114 -- 123, 1998. 1.1, 1.3 [8] M. Charikar, C. Chekuri, A. Goel, S. Guha, and S. A. Plotkin. Approximating a finite metric by a small number of tree metrics. In 39th Annual Symposium on Foundations of Computer Science, FOCS '98, November 8-11, 1998, Palo Alto, California, USA, pages 379 -- 388, 1998. 4 [9] M. Charikar, S. Guha, ´E. Tardos, and D. B. Shmoys. A constant-factor approximation algo- rithm for the k-median problem. In Proceedings of the thirty-first annual ACM symposium on Theory of computing, pages 1 -- 10. ACM, 1999. 1.1, 1.1, 4 [10] J. Chuzhoy and Y. Rabani. Approximating k-median with non-uniform capacities. In Proceed- ings of the sixteenth annual ACM-SIAM symposium on Discrete algorithms, pages 952 -- 958. Society for Industrial and Applied Mathematics, 2005. 1.1 [11] M. Cygan, M. Hajiaghayi, and S. Khuller. Lp rounding for k-centers with non-uniform hard capacities. In Foundations of Computer Science (FOCS), 2012 IEEE 53rd Annual Symposium on, pages 273 -- 282. IEEE, 2012. 1.1 14 [12] H. G. Demirci and S. Li. Constant approximation for capacitated k-median with (1 + ǫ)- capacity violation. In 43rd International Colloquium on Automata, Languages, and Program- ming, ICALP 2016, July 11-15, 2016, Rome, Italy, pages 73:1 -- 73:14, 2016. 1.1 [13] J. Fakcharoenphol, S. Rao, and K. Talwar. A tight bound on approximating arbitrary metrics by tree metrics. In Proceedings of the 35th Annual ACM Symposium on Theory of Computing, June 9-11, 2003, San Diego, CA, USA, pages 448 -- 455, 2003. 1.1, 1.3, 4, 4 [14] F. V. Fomin, D. Lokshtanov, N. Misra, and S. Saurabh. Planar f-deletion: Approximation, kernelization and optimal fpt algorithms. In Proceedings of the 2012 IEEE 53rd Annual Sympo- sium on Foundations of Computer Science, FOCS '12, pages 470 -- 479, Washington, DC, USA, 2012. IEEE Computer Society. 1.2 [15] A. Gupta, E. Lee, and J. Li. An fpt algorithm beating 2-approximation for k-cut. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 2821 -- 2837. Society for Industrial and Applied Mathematics, 2018. 1, 1.2 [16] A. Gupta, E. Lee, J. Li, P. Manurangsi, and M. Wlodarczyk. Losing treewidth by separating subsets. CoRR, abs/1804.01366, 2018. 1.2 [17] M. R. Korupolu, C. G. Plaxton, and R. Rajaraman. Analysis of a local search heuristic for facility location problems. Journal of algorithms, 37(1):146 -- 188, 2000. 1.1 [18] E. Lee. Partitioning a graph into small pieces with applications to path transversal. Mathe- matical Programming, 2018. Preliminary version in SODA 2017. 1.2 [19] S. Li. On uniform capacitated k-median beyond the natural LP relaxation. In Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 696 -- 707. SIAM, 2015. 1.1 [20] S. Li. Approximating capacitated k-median with (1 + ǫ)k open facilities. In Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), To Appear, 2016. 1.1 [21] S. Li and O. Svensson. Approximating k-median via pseudo-approximation. In proceedings of the forty-fifth annual ACM symposium on theory of computing, pages 901 -- 910. ACM, 2013. 1.1 [22] J.-H. Lin and J. S. Vitter. ε-approximations with minimum packing constraint violation (ex- tended abstract). In Proceedings of the Twenty-fourth Annual ACM Symposium on Theory of Computing, STOC '92, pages 771 -- 782, New York, NY, USA, 1992. ACM. 3.3, 5 [23] K. C. S., B. Laekhanukit, and P. Manurangsi. On the parameterized complexity of approximat- ing dominating set. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2018, pages 1283 -- 1296, New York, NY, USA, 2018. ACM. 1.2 [24] A. Schrijver. Combinatorial Optimization - Polyhedra and Efficiency. Springer, 2003. 3.1 15
1204.4997
1
1204
2012-04-23T08:25:37
Optimal Orthogonal Graph Drawing with Convex Bend Costs
[ "cs.DS", "cs.DM" ]
Traditionally, the quality of orthogonal planar drawings is quantified by either the total number of bends, or the maximum number of bends per edge. However, this neglects that in typical applications, edges have varying importance. Moreover, as bend minimization over all planar embeddings is NP-hard, most approaches focus on a fixed planar embedding. We consider the problem OptimalFlexDraw that is defined as follows. Given a planar graph G on n vertices with maximum degree 4 and for each edge e a cost function cost_e : N_0 --> R defining costs depending on the number of bends on e, compute an orthogonal drawing of G of minimum cost. Note that this optimizes over all planar embeddings of the input graphs, and the cost functions allow fine-grained control on the bends of edges. In this generality OptimalFlexDraw is NP-hard. We show that it can be solved efficiently if 1) the cost function of each edge is convex and 2) the first bend on each edge does not cause any cost (which is a condition similar to the positive flexibility for the decision problem FlexDraw). Moreover, we show the existence of an optimal solution with at most three bends per edge except for a single edge per block (maximal biconnected component) with up to four bends. For biconnected graphs we obtain a running time of O(n T_flow(n)), where T_flow(n) denotes the time necessary to compute a minimum-cost flow in a planar flow network with multiple sources and sinks. For connected graphs that are not biconnected we need an additional factor of O(n).
cs.DS
cs
Optimal Orthogonal Graph Drawing with Convex Bend Costs∗ Thomas Bläsius, Ignaz Rutter, Dorothea Wagner Karlsruhe Institute of Technology (KIT) [email protected] Abstract Traditionally, the quality of orthogonal planar drawings is quantified by either the total number of bends, or the maximum number of bends per edge. However, this neglects that in typical applications, edges have varying importance. Moreover, as bend minimization over all planar embeddings is NP-hard, most approaches focus on a fixed planar embedding. We consider the problem OptimalFlexDraw that is defined as follows. Given a planar graph G on n vertices with maximum degree 4 and for each edge e a cost function coste : N0 −→ R defining costs depending on the number of bends on e, compute an orthogonal drawing of G of minimum cost. Note that this optimizes over all planar embeddings of the input graphs, and the cost functions allow fine-grained control on the bends of edges. In this generality OptimalFlexDraw is NP-hard. We show that it can be solved efficiently if 1) the cost function of each edge is convex and 2) the first bend on each edge does not cause any cost (which is a condition similar to the positive flexibility for the decision problem FlexDraw). Moreover, we show the existence of an optimal solution with at most three bends per edge except for a single edge per block (maximal biconnected component) with up to four bends. For biconnected graphs we obtain a running time of O(n· Tflow(n)), where Tflow(n) denotes the time necessary to compute a minimum-cost flow in a planar flow network with multiple sources and sinks. For connected graphs that are not biconnected we need an additional factor of O(n). Introduction 1 Orthogonal graph drawing is one of the most important techniques for the human-readable visu- alization of complex data. Its aesthetic appeal derives from its simplicity and straightforwardness. Since edges are required to be straight orthogonal lines -- which automatically yields good angular resolution and short links -- the human eye may easily adapt to the flow of an edge. The readability of orthogonal drawings can be further enhanced in the absence of crossings, that is if the underlying data exhibits planar structure. Unfortunately, not all planar graphs have an orthogonal drawing in which each edge may be represented by a straight horizontal or vertical line. In order to be able to visualize all planar graphs nonetheless, we allow edges to have bends. Since bends obfuscate the readability of orthogonal drawings, however, we are interested in minimizing the number of bends on the edges. In this paper we consider the problem OptimalFlexDraw whose input consists of a planar graph G with maximum degree 4 and for each edge e a cost function coste : N0 −→ R defining costs depending on the number of bends on e. We seek an orthogonal drawing of G with minimum cost. Garg and Tamassia [9] show that it is NP-hard to decide whether a 4-planar graph admits an ∗Part of this work was done within GRADR -- EUROGIGA project no. 10-EuroGIGA-OP-003. 1 orthogonal drawing without any bends. Note that this directly implies that OptimalFlexDraw is NP-hard in general. For a special case, namely planar graphs with maximum degree 3 and series-parallel graphs, Di Battista et al. [4] give an algorithm minimizing the total number of bends optimizing over all planar embeddings. They introduce the concept of spirality that is similar to the rotation we use (see Section 2.3 for a definition). Bläsius et al. [2] show that the existence of a planar 1-bend drawing can be tested efficiently. More generally, they consider the problem FlexDraw, where each edge has a flexibility specifying its allowed number of bends. For the case that all flexibilities are positive, they give a polynomial-time algorithm for testing the existence of a valid drawing. As minimizing the number of bends for 4-planar orthogonal drawings is NP-hard, many results use the topology-shape-metrics approach initially fixing the planar embedding. Tamassia [15] de- scribes a flow network for minimizing the number of bends. This flow network can be easily adapted to also solve OptimalFlexDraw even for the case where the first bend may cause cost, however, the planar embedding has to be fixed in advanced. Biedl and Kant [1] show that every plane graph can be embedded with at most two bends per edge except for the octahedron. Morgana et al. [12] give a characterization of plane graphs that have an orthogonal drawing with at most one bend per edge. Tayu et al. [17] show that every series-parallel graph can be drawn with at most one bend per edge. All these results and the algorithm we present here have the requirement of maximum degree 4 in common. Although this is a strong restriction it is important to consider this case since algorithms dealing with higher-degree vertices (drawing them as boxes instead of single points) rely on algorithms for graphs with maximum degree 4 [16, 8, 11]. Even though fixing an embedding allows to efficiently minimize the total number of bends (with this embedding), this neglects that the choice of a planar embedding may have a huge impact on the number of bends in the resulting drawing. The result by Bläsius et al. [2] concerning the problem FlexDraw takes this into account and additionally allows the user to control the final drawing, for example by allowing few bends on important edges. However, if such a drawing does not exist, the algorithm solving FlexDraw does not create a drawing at all and thus it cannot be used in a practical application. Thus, the problem OptimalFlexDraw, which generalizes the corresponding optimization problem, is of higher practical interest, as it allows the user to take control of the properties of the final drawing within the set of feasible drawings. Moreover, it allows a more fine-grained control of the resulting drawing by assigning high costs to bends on important edges. Contribution and Outline. Our main result is the first polynomial-time bend-optimization algorithm for general 4-planar graphs optimizing over all embeddings. Previous work considers only restricted graph classes and unit costs. We solve OptimalFlexDraw if 1) all cost functions are convex and 2) the first bend is for free. We note that convexity is indeed quite natural, and that without condition 2) OptimalFlexDraw is NP-hard, as it could be used to minimize the total number of bends over all embeddings, which is known to be NP-hard [9]. In particular, our algorithm allows to efficiently minimize the total number of bends over all planar embeddings, where one bend per edge is free. Note that this is an optimization version of FlexDraw where each edges has flexibility 1, as a drawing with cost 0 exists if and only if FlexDraw has a valid solution. Moreover, as it is known that every 4-planar graph has an orthogonal representation with at most two bends per edge [1], our result can also be used to create such a drawing minimizing the number of edges having two bends by setting the costs for three or more bends to ∞. To derive the algorithm for OptimalFlexDraw, we show the existence of an optimal solution 2 Figure 1: (a) Two parallel edges, the thin has one bend for free, every additional bend costs 1, the thick edge has two bends for free, every additional bend costs 2. Whether embedding E1 or E2 is better depends on the number of bends. The minimum (marked by gray boxes) yields a non-convex cost function. (b) The non-convexity in (a) does not rely on multiple edges, the thick edge could be replaced by the shown gadget where each edge of the gadget has one bend for free and every additional bend costs 2. (c) This example has a non-convex cost function even if every edge has one bend for free and each additional bend costs 1. with at most three bends per edge except for a single edge per block with up to four bends, confirming a conjecture of Rutter [14]. Our strategy for solving OptimalFlexDraw for biconnected graphs optimizing over all planar embedding is the following. We use dynamic programming on the SPQR-tree of the graph, which is a data structure representing all planar embeddings of a biconnected graph. Every node in the SPQR-tree corresponds to a split component and we compute cost functions for these split components determining the cost depending on how strongly the split component is bent. We compute such a cost function from the cost functions of the children using a flow network similar to the one described by Tamassia [15]. As computing flows with minimum cost is NP-hard for non-convex costs we need to ensure that not only the cost functions of the edges but also the cost functions of the split components we compute are convex. However, this is not true at all, see Figure 1 for an example. This is not even true if every edge can have a single bend for free and then has to pay cost 1 for every additional bend, see Figure 1(c). To solve this problem, we essentially show that it is sufficient to compute the cost functions on the small interval [0, 3]. We can then show that the cost functions we compute are always convex on this interval. We start with some preliminaries in Section 2. Afterwards, we first consider the decision problem FlexDraw for the case that the planar embedding is fixed in Section 3. In this restricted setting we are able to prove the existence of valid drawings with special properties. Bläsius et al. [2] show that "rigid" graphs do not exist in this setting in the sense that a drawing that is bent strongly can be unwound under the assumption that the flexibility of every edge is at least 1. In other words this shows that graphs with positive flexibility behave similar to single edges with positive flexibility. We present a more elegant proof yielding a stronger result that can then be used to reduce the number of bends of every edge down to three (at least for biconnected graphs and except for a single edge on the outer face). In Section 4 we extend the term "bends", originally defined for edges, to split components and show that in a biconnected graph the split components corresponding to the nodes in its SPQR-tree can be assumed to have only up to three bends. In Section 5 we show that these results for the decision problem FlexDraw can be extended to the optimization problem OptimalFlexDraw. With this result we are able to drop the fixed planar embedding (Section 6). We first consider biconnected graphs in Section 6.1 and compute cost functions on the interval [0, 3], 3 notconvex012345123456E1E2cost00bends1234502581236(a)(b)(c) which can be shown to be convex on that interval, bottom up in the SPQR-tree. In Section 6.2 we extend this result to connected graphs using the BC-tree (see Section 2.2 for a definition). 2 Preliminaries In this section we introduce some notations and preliminaries. 2.1 FlexDraw The original FlexDraw problem asks for a given 4-planar graph G = (V, E) with a function flex: E −→ N0 ∪ {∞} assigning a flexibility to every edge whether an orthogonal drawing of G exists such that every edge e ∈ E has at most flex(e) bends. Such a drawing is called a valid drawing of the FlexDraw instance. The problem OptimalFlexDraw is the optimization problem corresponding to the decision problem FlexDraw and is defined as follows. Let G = (V, E) be a 4-planar graph together with a cost function coste : N0 −→ R ∪ {∞} associated with every edge e ∈ E having the interpretation that ρ bends on the edge e cause coste(ρ) cost. Then the cost of an orthogonal drawing of G is the total cost summing over all edges. A drawing is optimal if it has the minimum cost among all orthogonal drawings of G. The task of the optimization problem OptimalFlexDraw is to find an optimal drawing of G. Since OptimalFlexDraw contains the NP-hard problem FlexDraw, it is NP-hard itself. However, FlexDraw is efficiently solvable for instances with positive flexibility, that is instances in which the flexibility of every edge is at least 1. To obtain a similar result for OptimalFlexDraw we have to restrict the possible cost functions slightly. For a cost function coste(·) we define the difference function ∆ coste(·) to be ∆ coste(ρ) = coste(ρ + 1) − coste(ρ). A cost function is monotone if its difference function is greater or equal to 0. We say that the base cost of the edge e with monotone cost function is be = coste(0). The flexibility of an edge e with monotone cost function is defined to be the largest possible number of bends ρ for which coste(ρ) = be. As before, we say that an instance G of OptimalFlexDraw has positive flexibility if all cost functions are monotone and the flexibility of every edge is positive. Unfortunately, we have to restrict the cost functions further to be able to solve OptimalFlexDraw efficiently. The cost function coste(·) is convex, if its difference function is monotone. We call an instance of OptimalFlexDraw convex, if every edge has positive flexibility and each cost function is convex. Note that this includes that the cost functions are monotone. We provide an efficient algorithm solving OptimalFlexDraw for convex instances. 2.2 Connectivity, BC-Tree and SPQR-Tree A graph is connected if there exists a path between any pair of vertices. A separating k-set is a set of k vertices whose removal disconnects the graph. Separating 1-sets and 2-sets are cutvertices and separation pairs, respectively. A connected graph is biconnected if it does not have a cut vertex and triconnected if it does not have a separation pair. The maximal biconnected components of a graph are called blocks. The cut components with respect to a separation k-set S are the maximal subgraphs that are not disconnected by removing S. The block-cutvertex tree (BC-tree) B of a connected graph is a tree whose nodes are the blocks and cutvertices of the graph, called B-nodes and C-nodes, respectively. In the BC-tree a block B and a cutvertex v are joined by an edge if v belongs to B. If an embedding is chosen for each block, these embeddings can be combined to an embedding of the whole graph if and only if B can be 4 Figure 2: The unrooted SPQR-tree of a biconnected planar graph. The nodes µ1, µ3 and µ5 are P-nodes, µ2 is an R-node and µ4 is an S-node. The Q-nodes are not shown explicitely. rooted at a B-node such that the parent of every other block B in B, which is a cutvertex, lies on the outer face of B. We use the SPQR-tree introduced by Di Battista and Tamassia [5, 6] to represent all planar embeddings of a biconnected planar graph G. The SPQR-tree T of G is a decomposition of G into its triconnected components along its split pairs where a split pair is either a separation pair or an edge. We first define the SPQR-tree to be unrooted, representing embeddings on the sphere, that is planar embeddings without a designated outer face. Let {s, t} be a split pair and let H1 and H2 be two subgraphs of G such that H1 ∪ H2 = G and H1 ∩ H2 = {s, t}. Consider the tree containing the two nodes µ1 and µ2 associated with the graphs H1 +{s, t} and H2 +{s, t}, respectively. These graphs are called skeletons of the nodes µi, denoted by skel(µi) and the special edge {s, t} is said to be a virtual edge. The two nodes µ1 and µ2 are connected by an edge, or more precisely, the occurrence of the virtual edges {s, t} in both skeletons are linked by this edge. Now a combinatorial embedding of G uniquely induces a combinatorial embedding of skel(µ1) and skel(µ2). Furthermore, arbitrary and independently chosen embeddings for the two skeletons determine an embedding of G, thus the resulting tree can be used to represent all embeddings of G by the combination of all embeddings of two smaller planar graphs. This replacement can of course be applied iteratively to the skeletons yielding a tree with more nodes but smaller skeletons associated with the nodes. Applying this kind of decomposition in a systematic way yields the SPQR-tree as introduced by Di Battista and Tamassia [5, 6]. The SPQR-tree T of a biconnected planar graph G contains four types of nodes. First, the P-nodes having a bundle of at least three parallel edges as skeleton and a combinatorial embedding is given by any ordering of these edges. Second, the skeleton of an R-node is triconnected, thus having exactly two embeddings [18], and third, S-nodes have a simple cycle as skeleton without any choice for the embedding. Finally, every edge in a skeleton representing only a single edge in the original graph G is formally also considered to be a virtual edge linked to a Q-node in T representing this single edge. Note that all leaves of the SPQR-tree T are Q-nodes. Besides from being a nice way to represent all embeddings of a biconnected planar graph, the SPQR-tree has only size linear in G and Gutwenger and Mutzel [10] showed how to compute it in linear time. Figure 2 shows a biconnected planar graph together with its SPQR-tree. Often the SPQR-tree T of a biconnected planar graph G is assumed to be rooted in a Q-node representing all planar embeddings with the corresponding edge on the outer face. In contrast to previous results, we assume the SPQR-tree T to be rooted in some node τ, which may be a Q-node or an inner node. In the following we describe the interpretation of the SPQR-tree with root τ. Every node µ, apart form τ itself, has a unique parent and thus its skeleton skel(µ) contains a virtual edge corresponding to this parent. We refer to this virtual edge as the parent edge. A planar embedding E of G is represented by T with root τ if the embedding induced on the skeleton skel(µ) of every node µ 6= τ has the parent edge on the outer face. The embedding of skel(τ) is not restricted, thus the choice of the outer face makes a difference for the root. 5 µ2v1v2v3v4v5abcdefghijv5v2ijv5v2v1dv1v2ev1v4v4v1v2v3bcafghµ5µ4µ3µ1 For every node µ in the SPQR-tree T apart from the root τ we define the pertinent graph of µ, denoted by pert(µ), as follows. The pertinent graph of a Q-node is the edge associated to it. The pertinent graph of an inner node µ is recursively defined to be the graph obtained by replacing all virtual edges apart from the parent edge by the pertinent graphs of the corresponding children in T . The expansion graph of a virtual edge ε in skel(µ) is the pertinent graph of µ0 where µ0 is the child of µ corresponding to the virtual edge ε with respect to the root µ. 2.3 Orthogonal Representation Two orthogonal drawings of a 4-planar graph G are equivalent, if they have the same topology, that is the same planar embedding, and the same shape in the sense that the sequence of right and left turns is the same in both drawings when traversing the faces of G. To make this precis, we define orthogonal representations, originally introduced by Tamassia [15], as equivalence classes of this equivalence relation between orthogonal drawings. To ease the notation we first only consider the biconnected case. Let Γ be an orthogonal drawing of a biconnected 4-planar graph G. In the planar embedding E induced by Γ every edge e is incident to two different faces, let f be one of them. When traversing f in clockwise order (counter-clockwise if f is the outer face) e may have some bends to the right and some bends to the left. We define the rotation of e in the face f to be the number of bends to the right minus the number of bends to the left and denote the resulting value by rot(ef). Similarly, every vertex v is incident to several faces, let f be one of them. Then we define the rotation of v in f, denoted by rot(vf), to be 1, −1 and 0 if there is a turn to the right, a turn to the left and no turn, respectively, when traversing f in clockwise direction (counter-clockwise if f is the outer face). The orthogonal representation R belonging to Γ consists of the planar embedding E of G and all rotation values of edges and vertices, respectively. It is easy to see that every orthogonal representation has the following properties. (I) For every edge e incident to the faces f1 and f2 the equation rot(ef1) = − rot(ef2) holds. (II) The sum over all rotations in a face is 4 for inner faces and −4 for the outer face. (III) The sum of rotations around a vertex v is 2 · (deg(v) − 2). Tamassia showed that the converse is also true [15], that is R is an orthogonal representation representing a class of orthogonal drawings if the rotation values satisfy the above properties. He moreover describes a flow network such that every flow in the flow network corresponds to an orthogonal representation. A modification of this flow network can also be used to solve Op- timalFlexDraw but only for the case that the planar embedding is fixed. In some cases we also write rotR(·) instead of rot(·) to make clear to which orthogonal representation we refer to. Moreover, the face in the index is sometimes omitted if it is clear which face is meant. When extending the term orthogonal representation to not necessarily biconnected graphs there are two differences. First, a vertex v with deg(v) = 1 may exist. Then v is incident to a single face f and we define the rotation rot(vf) to be −2. Note that the rotations around every vertex v still sum up to 2·(deg(v)−2). The second difference is that the notation introduced above is ambiguous since edges and vertices may occur several times in the boundary of the same face. For example a bridge e is incident to the face f twice, thus it is not clear which rotation is meant by rot(ef). However, it will always be clear from the context, which incidence to the face f is meant by the index f. Thus, we use for connected graphs the same notation as for biconnected graphs. Let G be a 4-planar graph with orthogonal representation R and two vertices s and t incident to a common face f. We define πf(s, t) to be the unique shortest path from s to t on the boundary of f, when traversing f in clockwise direction (counter-clockwise if f is the outer face). Let 6 Figure 3: On the left three tight orthogonal drawings are stacked together. This is not possible on the right side, since the black vertices have angles larger than 90◦ in internal faces. s = v1, . . . , vk = t be the vertices on the path πf(s, t). The rotation of π(s, t) is defined as rot(π(s, t)) = rot({vi, vi+1}) + rot(vi) , k−1X i=1 k−1X i=2 where all rotations are with respect to the face f. Note that it does not depend on the particular drawing of a graph G how many bends each edge has but only on the orthogonal representation. Thus we can continue searching for valid and optimal orthogonal representations instead of drawings to solve FlexDraw and OptimalFlexDraw, respectively. Let G be a 4-planar graph with positive flexibility and valid orthogonal representation R and let {s, t} be a split pair. Let further H be a split component with respect to {s, t} such that the orthogonal representation S of H induced by R has {s, t} on the outer face f. The orthogonal representation S of H is called tight with respect to the vertices s and t if the rotations of s and t in internal faces are 1, that is s and t form 90◦-angles in internal faces of H. Bläsius et al. [2, Lemma 2] show that S can be made tight with respect to s and t, that is there exists a valid tight orthogonal representation of H that is tight. Moreover, this tight orthogonal representation can be plugged back into the orthogonal representation of the whole graph G. We call an orthogonal representation R of the whole graph G tight, if every split component having the corresponding split pair on its outer face is tight with respect to its split pair. It follows that we can assume without loss of generality that every valid orthogonal representation is tight. This has two major advantages. First, if we have for example a chain of graphs and orthogonal representations of each graph in the chain, we can combine these orthogonal representations by simply stacking them together; see Figure 3. Note that this may not be possible if the orthogonal representations are not tight. Second, the shape of the outer face f of a split component with split pair {s, t} is completely determined by the rotation of πf(s, t) and the degrees of s and t, since the rotation at the vertices s and t in the outer face only depends on their degrees. In the following we assume every orthogonal representation to be tight. 2.4 Flow Network A cost flow network (or flow network for short) is a tuple N = (V, A, COST, dem) where (V, A) is a directed (multi-)graph, COST is a set containing a cost function costa : N0 −→ R ∪ {∞} for each arc a ∈ A and dem: V −→ Z is the demand of the vertices. A flow in N is a function φ: A −→ N0 assigning a certain amount of flow to each arc. A flow φ is feasible, if the difference of incoming and outgoing flow at each vertex equals its demand, that is The cost of a given flow φ is the total cost of the arcs caused by the flow φ, that is φ(v, u) for all v ∈ V. dem(v) = X (u,v)∈A φ(u, v) − X cost(φ) = X (v,u)∈A costa(φ(a)). a∈A 7 ? A feasible flow φ in N is called optimal if cost(φ) ≤ cost(φ0) holds for every feasible flow φ0. If the cost function of an arc a is 0 on an interval [0, c] and ∞ on (c,∞), we say that a has A flow network N is called convex if the cost functions on its arcs are convex. capacity c. In the flow networks we consider, every arc a ∈ A has a corresponding arc a0 ∈ A between the same vertices pointing in the opposite direction. A flow φ is normalized if φ(a) = 0 or φ(a0) = 0 for each of these pairs. Since we only consider convex flow networks a normalized optimal flow does always exist. Thus we assume without loss of generality that all flows are normalized. We simplify the notation as follows. If we talk about an amount of flow on the arc a that is negative, we instead mean the same positive amount of flow on the opposite arc a0. In many cases minimum-cost flow networks are only considered for linear cost functions, that is each unit of flow on an arc causes a constant cost defined for that arc. Note that the cost functions in a convex flow network N are piecewise linear and convex according to our definition. Thus, it can be easily formulated as a flow network with linear costs by splitting every arc into multiple arcs, each having linear costs. It is well known that flow networks of this kind can be solved in polynomial time. The best known running time depends on additional properties that N may satisfy. We use an algorithm computing a minimum-cost flow in the network N as black box and denote the necessary running time by Tflow(N). In Section 6.3 we have a closer look on which algorithm to use. Let u, v ∈ V be two nodes of the convex flow network N with demands dem(u) and dem(v). The parameterized flow network with respect to the nodes u and v is defined the same as N but with a parameterized demand of dem(u)− ρ for u and dem(v)+ ρ for v where ρ is a parameter. The cost function costN(ρ) of the parameterized flow network N is defined to be cost(φ) of an optimal flow φ in N with respect to the parameterized demands determined by ρ. Note that increasing ρ by 1 can be seen as pushing one unit of flow from u to v. We define the optimal parameter ρ0 to be the parameter for which the cost function is minimal among all possible parameters. The correctness of the minimum weight path augmentation method to compute flows with minimum costs implies the following theorem [7]. Theorem 1. The cost function of a parameterized flow network is convex on the interval [ρ0,∞], where ρ0 is the optimal parameter. Proof. Let N = (V, A, COST, dem) be a parameterized flow network and let φ0 be a minimum-cost flow in N with respect to the optimal parameter ρ0. To simplify notation, we assume ρ0 = 0. The residual network R0 with respect to φ0 is the graph (V, A) with a constant cost cost0(a) assigned to every arc a such that cost0(a) is the amount of cost in N that has to be payed to push an additional unit of flow along a, with respect to the given flow φ0. Note that this cost may be negative. It is well known that an optimal flow φ1 with respect to the parameter 1 can be computed by pushing one unit of flow along a path from u to v with minimum weight in R0 [7]. Moreover, we can continue and compute an optimal flow φk+1 by augmenting φk along a minimum weight path in the residual network Rk with respect to the flow φk. Assume we augment φk along the path πk causing cost costk(πk) to obtain an optimal flow φk+1 with respect to the parameter k + 1 and then we augment along a path πk+1 in Rk+1 with cost costk+1(πk+1) to obtain an optimal flow φk+2 with respect to the parameter k + 2. To obtain the claimed convexity we have to show that costk(πk) ≤ costk+1(πk+1) holds. If πk and πk+1 contain an arc a in the same direction, then costk(a) ≤ costk+1(a) holds by the convexity of the cost function of a. If πk contains the arc a and πk+1 contains the arc a0 in the opposite direction then costk(a) = − costk+1(a0) holds. Assume πk and πk+1 share such an arc in the opposite direction. Then we remove this arc in both directions, splitting each of the paths πk and πk+1 into two subpaths. We define two new paths π and π0 by concatenating the first part of πk 8 Figure 4: Since a strictly directed path from t to s has a lower bound for its rotation this yields upper bounds for paths from s to t (Lemma 1). with the second part of πk+1 and vice versa, respectively. This can be done iteratively, thus we can assume that π and π0 do not share arcs in the opposite direction. We consider the cost of π and π0 in the residual network Rk. Obviously, for an arc a that is exclusively contained either in π or in π0 we have costk(a) = costk+1(a). For an arc that is contained in π and π0 we have costk(a) ≤ costk+1(a). Moreover, for every pair of arcs a and a0 that was removed we have costk(a) = − costk+1(a0). This yields the inequality costk(πk) + costk+1(πk+1) ≥ costk(π) + costk(π0). Since πk was a path with smallest possible weight in Rk we have costk(πk) ≤ costk(π) and costk(πk) ≤ costk(π0). With the above inequality this yields costk+1(πk+1) ≥ costk(πk). 3 Valid Drawings with Fixed Planar Embedding In this section we consider the problem FlexDraw for the case that the planar embedding is fixed. We show that the existence of a valid orthogonal representation implies the existence of a valid orthogonal representation with special properties. We first show the following. Given a biconnected 4-planar graph with positive flexibility and an orthogonal representation R such that two vertices s and t lie on the outer face f, then the rotation along πf(s, t) can be reduced by 1 if it is at least 0. This result is a key observation for the algorithm solving the decision problem FlexDraw [2]. It in a sense shows that "rigid" graphs that have to bent strongly do not exists. This kind of graphs play an important role in the N P-hardness proof of 0-embeddability by Garg and Tamassia [9]. Moreover, we show the existence of a valid orthogonal representation R0 inducing the same planar embedding and having the same angles around vertices as R such that every edge has at most three bends in R0, except for a single edge on the outer face with up to five bends. If we allow to change the embedding slightly, this special edge has only up to four bends. Let G be a 4-planar graph with positive flexibility and valid orthogonal representation R, and let e be an edge. If the number of bends of e equals its flexibility, we orient e such that its bends are right bends. Otherwise, e remains undirected. We define a path π = (v1, . . . , vk) in G to be a directed path, if the edge {vi, vi+1} (for i ∈ {1, . . . , k − 1}) is either undirected or directed from vi to vi+1. A path containing only undirected edges can be seen as directed path for both possible directions. The path π is strictly directed, if it is directed and does not contain undirected edges. These terms directly extend to (strictly) directed cycles. Given a (strictly) directed cycle C the terms left(C) and right(C) denote the set of edges and vertices of G lying to the left and right of C, respectively, with respect to the orientation of C. A cut (U, V \ U) is said to be directed from U to V \ U, if every edge {u, v} with u ∈ U and v ∈ V \ U is either directed from u to v or undirected. According to the above definitions a cut is strictly directed from U to V \ U if it is directed and contains no undirected edges. Before we show how to unwind an orthogonal representation that is bent strongly we need the following technical lemma. Lemma 1. Let G be a graph with positive flexibility and vertices s and t such that G + st is biconnected and 4-planar. Let further R be a valid orthogonal representation with s and t incident 9 stπ(s,t)π(t,s)ststπ(s,t)π(t,s)(a)(b)(c)(d)(e)stststt0t0(f) to the common face f such that πf(t, s) is strictly directed from t to s. Then the following holds. (1) rotR(πf(s, t)) ≤ −3 if f is the outer face and G does not consist of a single path (2) rotR(πf(s, t)) ≤ −1 if f is the outer face (3) rotR(πf(s, t)) ≤ 5 Proof. We first consider the case where f is the outer face (Figure 4(a)), that is cases (1) and (2). Due to the fact that πf(t, s) is strictly directed from t to s and the flexibility of every edge is positive, each edge on πf(t, s) has rotation at least 1. Moreover, the rotations at vertices along the path πf(t, s) are at least −1 since πf(t, s) is simple as G+ st is biconnected. Since the number of internal vertices on a path is one less than the number of edges this yields rot(πf(t, s)) ≥ 1; see Figure 4(b). If G consists of a single path this directly yields rot(πf(s, t)) ≤ −1 and thus concludes case (2). For case (1) first assume that the degrees of s and t are not 1 (Figure 4(b)), that is rot(sf), rot(tf) ∈ {−1, 0, 1} holds. Since f is the outer face the equation rot(πf(s, t))+rot(tf)+rot(πf(t, s))+rot(sf) = −4 holds and directly implies the desired inequality rot(πf(s, t)) ≤ −3. In the case that for example t has degree 1 (and deg(s) > 0), we have rot(tf) = −2 and rot(sf) ∈ {−1, 0, 1}, thus the considerations above only yield rot(πf(s, t)) ≤ −2. However, in this case there necessarily exists a vertex t0 where the paths πf(s, t) and πf(t, s) split, as illustrated in Figure 4(c). More precisely, let t0 be the first vertex on πf(s, t) that also belongs to πf(t, s). Obviously, the degree of t0 is at least 3 and thus rot(t0 f) (with respect to the path πf(t, s)) is at least 0. Hence we obtain the stronger inequality rot(πf(t, s)) ≥ 2 yielding the desired inequality rot(πf(s, t)) ≤ −3. If s and t both have degree 1 we cannot only find the vertex t0 but also the vertex s0 where the paths πf(s, t) and πf(t, s) split. Since G + st is biconnected these two vertices are distinct and the estimation above works, finally yielding rot(πf(s, t)) ≤ −3. If f is an internal face (Figure 4(d)), that is case (3) applies, we start with the equation rot(πf(s, t)) + rot(tf) + rot(πf(t, s)) + rot(sf) = 4. First we consider the case that neither t nor s have degree 1. Thus, rot(tf), rot(sf) ∈ {−1, 0, 1}. With the same argument as above we obtain rot(πf(t, s)) ≥ 1 and hence rot(πf(s, t)) ≤ 5; see Figure 4(e). Now assume that t has degree 1 and s has larger degree. Then rot(tf) = −2 holds and the above estimation does not work anymore. Again, at some vertex t0 the paths πf(t, s) and πf(s, t) split as illustrated in Figure 4(f). Obviously, f) is at least 0. This yields rot(πf(t, s)) ≥ 2 the degree of t0 needs to be greater than 2 and thus rot(t0 in the case that deg(t) = 1, compensating rot(tf) = −2 (instead of rot(tf) ≥ −1 in the other case). To sum up, we obtain the desired inequality rot(πf(s, t)) ≤ 5. The case deg(s) = deg(t) = 1 works analogously. The flex graph G× R of G with respect to a valid orthogonal representation R is defined to be the dual graph of G such that the dual edge e? is undirected if e is undirected, otherwise it is directed from the face right of e to the face left of e. Figure 5(a) shows an example graph with an orthogonal drawing together with the corresponding flex graph. Assume we have a simple directed cycle C in the flex graph. Then bending along this cycle yields a new valid orthogonal representation R0 which is defined as follows. Let e? = (f1, f2) be an edge contained in C dual to e. Then we decrease rot(ef1) and increase rot(ef2) by 1. It can be easily seen that the necessary properties for R0 to be an orthogonal representation are satisfied. Obviously, rotR0(ef1) = − rotR0(ef2) holds and rotations at vertices did not change. Moreover, the rotation around a face f does not change since f is either not contained in C or it is contained in C, but then it has exactly one incoming and exactly one outgoing edge. Note that bending along a cycle in the flex graph preserves the planar embedding of G and for every vertex the rotations in all incident faces. The following lemma shows that a high rotation along a path πf(s, t) for two vertices s and t sharing the face f can be reduced by 1 using a directed cycle in the flex graph. 10 Figure 5: (a) An orthogonal representation and the corresponding flex graph where every edge has flexibility 1. (b, c, d) Illustration of Lemma 2. Lemma 2. Let G be a biconnected 4-planar graph with positive flexibility, a valid orthogonal rep- resentation R and s and t on a common face f. The flex graph G× R contains a directed cycle C such that f ∈ C, s ∈ left(C) and t ∈ right(C), if one of the following conditions holds. (1) rotR(πf(s, t)) ≥ −2, f is the outer face and πf(s, t) is not strictly directed from t to s (2) rotR(πf(s, t)) ≥ 0 and f is the outer face (3) rotR(πf(s, t)) ≥ 6 Proof. Figure 5(b) shows the path πf(s, t) together with the desired cycle C. Due to the duality of a cycle in the dual and a cut in the primal graph a directed cycle C in G× R having s and t to the left and to the right of C, respectively, induces a directed cut in G that is directed from s to t and vice versa. Recall that directed cycles and cuts may also contain undirected edges. Assume for contradiction that such a cycle C does not exist. Claim 1. The graph G contains a strictly directed path π from t to s. Every cut (S, T) with T = V \ S, s ∈ S and t ∈ T separating s from t must contain an edge that is directed from T to S, otherwise this cut would correspond to a cycle C in the flex graph that does not exist by assumption. Let T be the set of vertices in G that can be reached by strictly directed paths from t. If T contains s we found the path π strictly directed from t to s. Otherwise, (S, T) with S = V \ T is a cut separating S from T and there cannot be an edge that is directed from a vertex in T to a vertex in S which is a contradiction, and thus the path π strictly directed from t to s exists, which concludes the proof of the claim. Let G0 be the subgraph of G induced by the paths π and πf(s, t) together with the orthogonal representation R0 induced by R. We first consider case (1). Let f0 be the outer face of the orthogonal representation R0. Obvi- ously, πf0(s, t) = πf(s, t) and π = πf0(t, s) holds, see Figure 5(c). Moreover, the graph G0 + st is biconnected and G0 does not consist of a single path since πf0(s, t) and πf0(t, s) are different due to the assumption that πf(s, t) is not strictly directed from t to s. Since πf0(t, s) is strictly directed from t to s we can use Lemma 1(1) yielding rotR0(πf0(s, t)) ≤ −3 and thus rotR(πf(s, t)) ≤ −3, which is a contradiction. For case (2) exactly the same argument holds except for the case where the strictly directed path π is the path πf(s, t) strictly directed from t to s. In this case we have to use Lemma 1(2) instead of Lemma 1(1) yielding rotR(πf(s, t)) ≤ −1, which is again a contradiction. In case (3) the subgraph G0 of G induced by the two paths π and πf(s, t) again contains s and t on a common face f0, which may be the outer or an inner face, see Figure 5(c) and Figure 5(d), respectively. In both cases we obtain rotR(πf(s, t)) ≤ 5 due to Lemma 1(3), which is a contradiction. Lemma 2 directly yields the following corollary, showing that graphs with positive flexibility behave very similar to single edges with positive flexibility. 11 π(s,t)fCststπ(s,t)π=π(t,s)stπ=π(t,s)π(s,t)(a)(b)(c)(d)f0f0 Corollary 1. Let G be a graph with positive flexibility and vertices s and t such that G + st is biconnected and 4-planar. Let further R be a valid orthogonal representation with s and t on the outer face f such that ρ = rotR(πf(s, t)) ≥ 0. For every rotation ρ0 ∈ [−1, ρ] there exists a valid orthogonal representation R0 with rotR0(πf(s, t)) = ρ0. Proof. For the case that G itself is biconnected, the claim follows directly from Lemma 2(2), since we can reduce the rotation along πf(s, t) stepwise by 1, starting with the orthogonal representation R, until we reach a rotation of −1. For the case that G itself is not biconnected we add the edge {s, t} to the orthogonal representation R such that the path πf(s, t) does not change, that is πf(t, s) consists of the new edge {s, t}. Again Lemma 2(2) can be used to reduce the rotation stepwise down to −1. As edges with many bends imply the existence of paths with high rotation, we can use Lemma 2 to successively reduce the number of bends of every edge down to three, except for a single edge on the outer face. Since we only bend along cycles in the flex graph, neither the embedding nor the angles around vertices are changed. Theorem 2. Let G be a biconnected 4-planar graph with positive flexibility, having a valid orthogo- nal representation. Then G has a valid orthogonal representation with the same planar embedding, the same angles around vertices and at most three bends per edge, except for at most one edge on the outer face with up to five bends. Proof. In the following we essentially pick an edge with more than three bends, reduce the number of bends by one and continue with the next edge. After each of these reduction steps we set the flexibility of every edge down to max{ρ, 1}, where ρ is the number of bends it currently has. This ensures that in the next step the number of bends of each edge either is decreased, remains as it is or is increased from zero to one. We start with an edge e = {s, t} that is incident to two faces f1 and f2 and has more than three bends. Due to the fact that we traverse inner faces in clockwise and the outer face in counter- clockwise direction, the edge e forms in one of the two faces the path from s to t and in the other face the path from t to s. Assume without loss of generality that πf1(t, s) and πf2(s, t) are the paths on the boundary of f1 and f2, respectively, that consist of e. Note that rot(πf1(t, s)) = − rot(πf2(s, t)) holds and we assume that rot(πf1(t, s)) is not positive. As e was assumed to have more than three bends, the inequality rot(πf1(t, s)) ≤ −4 holds. We distinguish between the two cases that f1 is an inner or the outer face. We first consider the case that f1 is an inner face; Figure 6(a) illustrates this situation for the case where e has four bends. Then the rotations around the face f1 sum up to 4. As the rotations at the vertices s and t can be at most 1, we obtain rot(πf1(s, t)) ≥ 6. Thus we can apply Lemma 2(3) to reduce the rotation of πf1(s, t) by bending along a cycle in the flex graph that contains f1 and separates s from t. Obviously, this increases the rotation along πf1(t, s) by 1 and thus reduces the number of bends of e by 1. For the case that f1 is the outer face we first ignore the case where e has four or five bends and show how to reduce the number of bends to five; Figure 6(b) shows the case where e has six bends. Thus the inequality rot(πf1(t, s)) ≤ −6 holds. As the rotations around the outer face f1 sum up to −4 and the rotations at the vertices s and t are at most 1, the rotation along πf1(s, t) must be at least 0. Thus we can apply Lemma 2(2) to reduce the rotation of πf1(s, t) by 1, increasing the rotation along πf1(t, s), and thus reducing the number of bends of e by one. Finally, we obtain an orthogonal representation having at most three bends per edge except for some edges on the outer face with four or five bends having their negative rotation in the outer face. If there is only one of these edges left we are done. Otherwise let e = {s, t} be one of the edges with 12 Figure 6: Reducing the number of bends on edges (Theorem 2) rot(πf(t, s)) ∈ {−5,−4}, where f is the outer face. Then the inequality rot(πf(s, t)) ≥ −2 holds by the same argument as before and we can apply Lemma 2(1) to reduce the rotation, if we can ensure that πf(s, t) is not strictly directed from t to s. To show that, we make use of the fact that πf(s, t) contains an edge e0 = {u, v} with at least four bends due to the assumption that e was not the only edge with more than three bends. Assume without loss of generality that u occurs before v on πf(s, t), thus πf(s, t) splits into the three parts πf(s, u), πf(u, v) and πf(v, t). Recall that rot(πf(s, t)) ≥ −2 holds and thus rot(πf(s, u))+rot(u)+rot(πf(u, v))+rot(v)+rot(πf(v, t)) ≥ −2. As the rotation at the vertices u and v is at most 1 and the rotation of πf(u, v) at most −4 it follows that rot(πf(s, u)) + rot(πf(v, t)) ≥ 0. Figure 6(c) illustrates the situation for the case where e and e0 have four bends and rot(πf(s, u)) = rot(πf(v, t)) = 0. Note that at least one of the two paths is not degenerate in the sense that s 6= u or v 6= t, otherwise the total rotation around the outer face would be at most −6, which is a contradiction. Assume without loss of generality that rot(πf(s, u)) ≥ 0. It follows that πf(s, u) cannot be strictly directed from u to s and since πf(s, u) is a subpath of πf(s, t) the path πf(s, t) cannot be strictly directed from t to s. This finally shows that we can use part (1) of Lemma 2 implying that we can find a valid orthogonal representation such that at most a single edge with four or five bends remains, whereas all other edges have at most three bends. If we allow the embedding to be changed slightly, we obtain an even stronger result. Assume the edge e lying on the outer face has more than three bends. If e has five bends, we can reroute it in the opposite direction around the rest of the graph, that is we can choose the internal face incident to e to be the new outer face. In the resulting drawing e has obviously only three bends. Thus the following result directly follows from Theorem 2. Corollary 2. Let G be a biconnected 4-planar graph with positive flexibility having a valid orthogo- nal representation. Then G has a valid orthogonal representation with at most three bends per edge except for possibly a single edge on the outer face with four bends. Note that Corollary 2 is restricted to biconnected graphs. For general graphs it implies that each block contains at most a single edge with up to four bends. Figure 7 illustrates an instance of FlexDraw with linearly many blocks and linearly many edges that are required to have four bends, showing that Corollary 2 is tight. Theorem 2 implies that it is sufficient to consider the flexibility of every edge to be at most 5, or in terms of costs we want to optimize, it is sufficient to store the cost function of an edge only in the interval [0, 5]. However, there are two reasons why we need a stronger result. First, we want to compute cost functions of split components and thus we have to limit the number of "bends" they can have (see the next section for a precise definition of bends for split components). Second, as mentioned in the introduction (see Figure 1) the cost function of a split component may already be non-convex on the interval [0, 5]. Fortunately, the second reason is not really a problem since 13 f1steπf1(s,t)πf1(t,s)(a)(b)stf1eπf1(t,s)πf1(s,t)stuvπ(t,s)π(u,v)π(s,u)π(v,t)ee0(c) Figure 7: An instance of FlexDraw requireing linearly many edges to have four bends. Flexibilites are 1 except for the thick edges with flexibility 4. there may be at most a single edge with up to five bends, all remaining edges have at most three bends and thus we only need to consider their cost functions on the interval [0, 3]. In the following section we focus on dealing with the first problem and strengthen the results so far presented by extending the limitation on the number of bends to split components. Note that a split pair inside an inner face of G with a split component H having a rotation less than −3 on its outer face implies a rotation of at least 6 in some inner face of G. Thus, we can again apply Lemma 2(3) to reduce the rotation showing that split components and single edges can be handled similarly. However, by reducing the rotation for one split component, we cannot avoid that the rotation of some other split component is increased. For single edges we did that by reducing the flexibility to the current number of bends. In the following section we extend this technique by defining a flexibility not only for edges but also for split components. We essentially show that all results we presented so far still apply, if we allow this kind of extended flexibilities. 4 Flexibility of Split Components and Nice Drawings Let G be a biconnected 4-planar graph with SPQR-tree T and let T be rooted at some node τ. Recall that we do not require τ to be a Q-node. Let µ be a node of T that is not the root τ. Then µ has a unique parent and skel(µ) contains a unique virtual edge ε = {s, t} that is associated with this parent. We call the split-pair {s, t} a principal split pair and the pertinent graph pert(µ) with respect to the chosen root a principal split component. The vertices s and t are the poles of this split component. Note that a single edge is also a principal split component except for the case that its Q-node is chosen to be the root. A planar embedding of G is represented by T with the root τ if the embedding of each skeleton has the edge associated with the parent on the outer face. Let R be a valid orthogonal representation of G such that the planar embedding of R is represented by T rooted at τ. Consider a principal split component H with respect to the split pair {s, t} and let S be the orthogonal representation of H induced by R. Note that the poles s and t are on the outer face f of S. We define max{ rotS(πf(s, t)), rotS(πf(t, s))} to be the number of bends of the split component H. Note that this is a straightforward extension of the term bends as it is used for edges. With this terminology we can assign a flexibility flex(H) to a principal split component H and we define the orthogonal representation R of G to be valid if and only if H has at most flex(H) bends. We say that the graph G has positive flexibility if the flexibility of every principal split component is at least 1, which is straightforward extension of the original notion. We define a valid orthogonal representation of G to be nice if it is tight and if there is a root τ of the SPQR-tree such that every principal split component has at most three bends and the edge corresponding to τ in the case that τ is a Q-node has at most five bends. The main result of this section will be the following theorem, which directly extends Theorem 2. Theorem 3. Every biconnected 4-planar graph with positive flexibility having a valid orthogonal representation has an orthogonal representation with the same planar embedding and the same 14 Figure 8: Augmentation of G by the safety edges eH(s, t) and eH(t, s). angles around vertices that is nice with respect to at least one node chosen as root of its SPQR-tree. Before we prove Theorem 3 we need to make some additional considerations. In particular we need to extend the flex-graph such that it takes the flexibilities of principal split components into account. The extended version of the flex graph can then be used to obtain a result similar to Lemma 2, which was the main tool to proof Theorem 2. Another difficulty is that it depends on the chosen root which split components are principal split components. For the moment we avoid this problem by choosing an arbitrary Q-node to be the root of the SPQR-tree T . Thus we only have to care about the flexibilities of the principal split components with respect to the chosen root. One might hope that the considerations we make for the flex-graph in the case of a fixed root still work, if we consider the principal split components with respect to all possible roots at the same time. However, this fails as we will see later, making it necessary to consider internal vertices as the root. Assume that the SPQR-tree T of G is rooted at the Q-node corresponding to an arbitrary chosen edge. Let H be a principal split component with respect to the chosen root with the poles s and t. In the embedding of G the outer face f of H splits into two faces f1 and f2, where the path πf(s, t) is assumed to lie in f1 and πf(t, s) is assumed to lie in f2, that is πf1(s, t) = πf(s, t) and πf2(t, s) = πf(t, s). We augment G by inserting the edge {s, t} twice, embedding one of them in f1 and the other in f2. We denote the edge {s, t} inserted into the face f1 by eH(s, t) and the edge inserted into f2 by eH(t, s). Figure 8 illustrates this process and shows how the dual graph of G changes. We call the new edges eH(s, t) and eH(t, s) safety edges and define the extended flex graph G× as before, ignoring that some edges have a special meaning. To simplify notation we often use the term flex graph, although we refer to the extended flex graph. Note that every cycle in the flex graph that separates s from t and thus crosses π(s, t) and π(t, s) needs to also cross the safety edges eH(s, t) and eH(t, s). Thus we can use the safety edges to ensure that the flex graph respects the flexibility of H by orienting them if necessary. More precisely, we orient the safety edge eH(s, t) from t to s if rot(π(s, t)) = − flex(H) and similarly eH(t, s) from s to t if rot(π(t, s)) = − flex(H). This ensures that the rotations along π(s, t) and π(t, s) cannot be reduced below − flex(H) by bending along a cycle in the flex graph. Moreover, rot(π(s, t)) cannot be increased above flex(H) as otherwise rot(π(t, s)) has to be below − flex(H) and vice versa. To sum up, we insert the safety edges next to the principal split component H and orient them if necessary to ensure that bending along a cycle in the flex graph respects not only the flexibilities of single edges but also the flexibility of the principal split component H. Since adding the safety edges for the graph H is just a technique to respect the flexibility of H by bending along a cycle in the flex graph, we do not draw them. Note that the augmented graph does not have maximum degree 4 anymore but this is not a problem since we do not draw the safety edges. However, we formally assign an orthogonal representation to the safety edges by essentially giving them the shape of the paths they "supervise". More precisely, the edges eH(s, t) and eH(t, s) have the same rotations as the paths π(s, t) and π(t, s) on the outer face of 15 Hπ(s,t)π(t,s)f1f2HeH(s,t)eH(t,s)stst H, respectively. Moreover, the angles at the vertices s and t are also assumed to be the same as for these two paths. As we do not only want to respect the flexibility of a single split component, we add the safety edges for each of the principal split components at the same time. Note that the augmented graph remains planar as we only add the safety edges for the principal split components with respect to a single root. It follows directly that the considerations above still work, which would fail if the augmented graph was non-planar. This is the reason why we cannot consider the principal split components with respect to all roots at the same time. The following lemma directly extends Lemma 2 to the case where the extended flex graph is considered. Lemma 3. Let G be a biconnected 4-planar graph with positive flexibility, a valid orthogonal rep- resentation R and s and t on a common face f. The extended flex graph G× R contains a directed cycle C such that f ∈ C, s ∈ left(C) and t ∈ right(C), if one of the following conditions holds. (1) rotR(πf(s, t)) ≥ −2, f is the outer face and πf(s, t) is not strictly directed from t to s (2) rotR(πf(s, t)) ≥ 0 and f is the outer face (3) rotR(πf(s, t)) ≥ 6 Proof. As in the proof of Lemma 2 we assume for contradiction that the cycle C does not exists, yielding a strictly directed path from t to s in G. This directly yields the claim, if we can apply Lemma 1 as before. The only difference to the situation before is that the directed path from t to s may contain some of the safety edges. However, by definition a safety edge eH(u, v) is directed from v to u if and only if rot(π(u, v)) = − flex(H). As flex(H) is positive rot(π(u, v)) has to be negative and thus the rotation along eH(u, v) when traversing it from v to u is at least 1. Thus, it does not make a difference whether the directed path from t to s consists of normal edges or may contain safety edges. Hence, Lemma 1 extends to the augmented graph containing the safety edges, which concludes the proof. Now we are ready to prove Theorem 3. To improve readability we state it again. Theorem 3. Every biconnected 4-planar graph with positive flexibility having a valid orthogonal representation has an orthogonal representation with the same planar embedding and the same angles around vertices that is nice with respect to at least one node chosen as root of its SPQR-tree. Proof. Let R be a valid orthogonal representation of G. We assume without loss of generality that R is tight. Since the operations we apply to R in the following do not affect the angles around vertices, the resulting orthogonal representation is also tight. Thus it remains to enforce the more interesting condition for orthogonal representations to be nice, that is reduce the number of bends of principal split components down to three. As mentioned before, the SPQR-tree T of G is initially rooted at an arbitrary Q-node. Let eref be the corresponding edge. As in the proof of Theorem 2 we start with an arbitrary principal split component H with more than three bends. Then one of the two paths in the outer face of H has rotation less than −3 and we have the same situation as for a single edge, that is we can apply Lemma 3 to reduce the rotation of the opposite site and thus reduce the number of bends of H by one. Afterwards, we can set the flexibility of H down to the new number of bends ensuring that it is not increased later on. However, this only works if the negative rotation of the split component H lies in an inner face of G. On the outer face we can only increase to a rotation of −5 yielding an orthogonal representation such that every principal split component has at most three bends, or maybe four or five bends, if it has its negative rotation in the outer face. Note that this is essentially the same situation we also had in the proof of Theorem 2. In the following we show similarly that the number of bends can be reduced further, 16 Figure 9: The path between the new and the old root in the SPQR-tree containing µ (left). The whole graph G containing the principal split component H0 corresponding to µ with respect to the new root and the principal split component H of the new root with respect to the old root (right). until either a unique innermost principal split component (where innermost means minimal with respect to inclusion) or the reference edge eref may have more than three bends. First assume that eref has more than three, that is four or five, bends and that there is a principal split component H with more than three bends having its negative rotation on the outer face. Let {s, t} be the corresponding split pair and let without loss of generality πf(t, s) be the path along H with rotation less than −3 where f is the outer face. Then the path πf(s, t) contains the edge eref = {u, v}, otherwise H would not be a principal split component. Moreover, rot(πf(t, s)) ≤ −4 implies that rot(πf(s, t)) ≥ −2 holds. As in the proof of Theorem 2 (compare with Figure 6(c)) the path πf(s, t) splits into the paths πf(s, u), πf(u, v) and πf(v, t). Since πf(u, v) consists of the single edge eref with more than three bends rot(πf(u, v)) ≤ −4 holds, implying that the rotation along πf(s, u) or πf(v, t) is greater or equal to 0. This shows that πf(s, t) cannot be strictly directed from t to s and thus we can apply Lemma 3(1) to reduce the number of bends H has. Finally, there is no principal split component with more than three bends left and the reference edge eref has at most five bends, which concludes this case. In the second case, eref has at most three bends. We show that if there is more than one principal split component with more than three bends, then they hierarchically contain each other. Assume that the number of bends of no principal split component that has more than three bends can be reduced further. Assume further there are two principal split components H1 and H2 with respect to the split pairs {s1, t1} and {s2, t2} that do not contain each other, that is without loss of generality the vertices t1, s1, t2 and s2 occur in this order around the outer face f when traversing it in counter-clockwise direction and πf(t1, s1) and πf(t2, s2) belong to H1 and H2 respectively. Analogous to the case where eref has more than three bends we can show that Lemma 3(1) can be applied to reduce the number of bends of H1, which is a contradiction. Thus, either H1 is contained in H2 or the other way round. This shows that there is a unique principal split component H that is minimal with respect to inclusion having more than three bends. Due to the inclusion property, all nodes in the SPQR-tree corresponding to the principal split components with more than three bends lie on the path between the current root and the node corresponding to H. We denote the node corresponding to H by τ and choose τ to be the new root of the SPQR-tree T . Since the principal split components depend on the root chosen for T some split components may no longer be principal and some may become principal due to rerooting. Our claim is that all principal split components with more than three bends are no longer principal after rerooting and furthermore that all split components becoming principal can be enforced to have at most three bends. First note that the principal split component corresponding to a node µ in the SPQR-tree changes if and only if µ lies on the path between the old and the new root, that is between τ and the Q-node corresponding to eref. Since all principal split components (with respect to the old root) that have more than three bends also lie on this path, all these split components are no longer principal (with respect to the new root). It remains to deal with the new principal split components corresponding to the nodes on this path. Note that the new root τ itself has no principal split component associated with it. Let µ 6= τ be a node on the path between the new 17 s0t0tsτµerefHH0rot≤−4tss0t0G and the old root and let H0 be the new principal split component corresponding to µ with the poles s0 and t0. Recall that H is the former principal split component corresponding to the new root τ with the poles s and t. Note that H of course is still a split component, although it is not principal anymore. Figure 9 illustrates this situation. Now assume that H0 has more than three bends. Then there are two possibilities, either it has its negative rotation on the outer face or in some inner face. If only the latter case arises we can easily reduce the number of bends down to three as we did before. In the remaining part of the proof we show that the former case cannot arise due to the assumption that the number of bends of H cannot be reduced anymore. Assume H0 has its negative rotation in the outer face f, that is without loss of generality the path πf(t, s) belongs to H0 and has rotation at most −4. Thus we have again the situation that the two split components H0 and H both have a rotation of at most −4 in the outer face. Moreover, these two split components do not contain or overlap each other since s and t are not contained in H0 as τ is the new root and H does not contain s0 or t0 since µ is an ancestor of τ with respect to the old root. Thus we could have reduced the number of bends of H before we changed the root, which is a contradiction to the assumption we made that the number of bends of principal split components with more than three bends cannot be reduced anymore. Hence, all new principal split components either have at most three bends or they have their negative rotation in some inner face. Finally, we obtain a valid orthogonal representation with at most three bends per principal split component with respect to τ. 5 Optimal Drawings with Fixed Planar Embedding All results from the previous sections deal with the case where we are only interested in the decision problem of whether a given graph has a valid drawing or not. More precisely, we always assumed to have a valid orthogonal representation of an instance of FlexDraw and showed that this implies that there exists another valid orthogonal representation with certain properties. In this section, we consider convex instances of the optimization problem OptimalFlexDraw. The following generic theorem shows that the results for FlexDraw that we presented so far can be extended to OptimalFlexDraw. Theorem 4. If the existence of a valid orthogonal representation of an instance of FlexDraw with positive flexibility implies the existence of a valid orthogonal representation with property P, then every convex instance of OptimalFlexDraw has an optimal drawing with property P. Proof. Let G be a convex instance of OptimalFlexDraw. Let further R be an optimal orthogonal representation. We can reinterpret G as an instance of FlexDraw with positive flexibility by setting the flexibility of an edge with ρ bends in R to max{ρ, 1}. Then R is obviously a valid orthogonal representation of G with respect to these flexibilities. Thus there exists another valid orthogonal representation R0 having property P. It remains to show that cost(R0) ≤ cost(R) holds when going back to the optimization problem OptimalFlexDraw. However, this is clear for the following reason. Every edge e has as most as many bends in R0 as in R except for the case where e has one bend in R0 and zero bends in R. In the former case the monotony of coste(·) implies that the cost did not increase. In the latter case e causes the same amount of cost in R as in R0 since coste(0) = coste(1) = be holds for convex instances of OptimalFlexDraw. Note that this proof still works, if the cost functions are only monotone but not convex. It follows that every convex 4-planar graph has an optimal drawing that is nice since Theorem 4 shows that Theorem 3 can be applied. Thus, it is sufficient to consider only nice drawings when searching for an optimal solution, as there exists a nice optimal solution. This is a fact that we 18 Figure 10: Split components with as few bends as possible. crucially exploit in the next section since although the cost function of a principal split component may be non-convex, we can show that it is convex in the interval that is of interest when only considering nice drawings. 6 Optimal Drawings with Variable Planar Embedding All results we presented so far were based on a fixed planar embedding of the input graph G. In this section we present an algorithm that computes an optimal drawing of G in polynomial time, optimizing over all planar embeddings of G. Our algorithm crucially relies on the existence of a nice drawing among all optimal drawings of G. For biconnected graphs (Section 6.1) we present a dynamic program that computes the cost function of all principal split components bottom-up in the SPQR-tree with respect to a chosen root. To compute the optimal drawing among all drawings that are nice with respect to the chosen root, it remains to consider the embeddings of the root itself. If we choose every node to be the root once, this directly yields an optimal drawing of G taking all planar embeddings into account. In Section 6.2 we extend our results to connected graphs that are not necessarily biconnected. To this end we first modify the algorithm for biconnected graphs such that it can compute an optimal drawing with the additional requirement that a specific vertex lies on the outer face. Then we can use the BC-tree to solve OptimalFlexDraw for connected graphs. We use the computation of a minimum-cost flow in a network of size n as a subroutine and denote the consumed running time by Tflow(n). In Section 6.3 we consider which running time we actually need. 6.1 Biconnected Graphs In this section we always assume G to be a biconnected 4-planar graph forming a convex instance of OptimalFlexDraw. Let T be the SPQR-tree of G. As defined before, an orthogonal represen- tation is optimal if it has the smallest possible cost. We call an orthogonal representation τ-optimal if it has the smallest possible cost among all orthogonal representation that are nice with respect to the root τ. We say that it is (τ,E)-optimal if it causes the smallest possible amount of cost among all orthogonal representations that are nice with respect to τ and induce the planar embedding E on skel(τ). In this section we concentrate on finding a (τ,E)-optimal orthogonal representation with respect to a root τ and a given planar embedding E of skel(τ). Then a τ-optimal representation can be computed by choosing every possible embedding of skel(τ). An optimal solution can then be computed by choosing every node in T to be the root once. In Section 4 we extended the terms "bends" and "flexibility", which were originally defined for single edges, to arbitrary principal split components with respect to the chosen root. We start out by making precise what we mean with the cost function costH(·) of a principal split component H with poles s and t. Recall that the number of bends of H with respect to an orthogonal representation S with s and t on the outer face f is defined to be max{ rotS(πf(s, t)), rotS(πf(t, s))}. Assume S is the nice orthogonal representation of H that has the smallest possible cost among all nice orthogonal representations with ρ bends. Then we essentially define costH(ρ) to be the cost of 19 deg2deg3deg4deg4deg5deg60−10−1−1−2−10−1−1−2−2 Figure 11: A single vertex can be replaced by a split component with three bends. S. However, with this definition the cost function of H is not defined for all ρ ∈ N0 since H does not have an orthogonal representation with zero bends at all, if deg(s) > 1 or deg(t) > 1, as at least one of the paths πf(s, t) and πf(t, s) has negative rotation in this case. More precisely, if deg(s) + deg(t) > 2, then H has at least one bend, and if deg(s) + deg(t) > 4, then H has at least two bends. Figure 10 shows for each combination of degrees a small example with the smallest possible number of bends. In these two cases we formally set costH(0) = costH(1) and costH(0), costH(1) = costH(2), respectively. Thus, we only need to compute the cost functions for at least d(deg(s)+deg(t)−2)/2e bends. We denote this lower bound by 'H = d(deg(s)+deg(t)−2)/2e. Hence, it remains to compute the cost function costH(ρ) for ρ ∈ ['H , 3]. For more than three bends we formally set the cost to ∞. Note that the definition of the cost function only considers nice orthogonal representations (including that they are tight). As a result of this restriction the cost for an orthogonal representation with ρ bends might be less than costH(ρ). However, due to Theorem 3 in combination with Theorem 4 we know that optimizing over nice orthogonal representations is sufficient to find an optimal solution. As for single edges, we define the base cost bH of the principal split component H to be costH(0). We will see that the cost function costH(·) is monotone and even convex in the interval [0, 3] (except for a special case) and thus the base cost is the smallest possible amount of cost that has to be payed for every orthogonal drawing of H. The only exception is the case where deg(s) = deg(t) = 3. In this case H has at least two bends and thus the cost function costH(·) needs to be considered only on the interval [2, 3]. However, it may happen that costH(2) > costH(3) holds in this case. Then we set the base cost bH to costH(3) such that the base cost bH is really the smallest possible amount of cost that need to be payed for every orthogonal representation of H. We obtain the following theorem. Theorem 5. If the poles of a principal split component do not both have degree 3, then its cost function is convex on the interval [0, 3]. Before showing Theorem 5 we just assume that it holds and moreover we assume that the cost function of every principal split component is already computed. We first show how these cost functions can then be used to compute an optimal drawing. To this end, we define a flow network on the skeleton of the root τ of the SPQR-tree, similar to Tamassias flow network [15]. The cost functions computed for the children of τ will be used as cost functions on arcs in the flow network. As we can only solve flow networks with convex costs we somehow have to deal with potentially non-convex cost functions for the case that both endvertices of a virtual edge have degree 3 in its expansion graph. Our strategy is to simply ignore these subgraphs by contracting them into single vertices. Note that the resulting vertices have degree 2 since the poles of graphs with non-convex cost functions have degree 3. The process of replacing the single vertex in the resulting drawing by the contracted component is illustrated in Figure 11. The following lemma justifies this strategy. Lemma 4. Let G be a biconnected convex instance of OptimalFlexDraw with τ-optimal orthog- onal representation R and let H be a principal split component with non-convex cost function and base cost bH. Let further G0 be the graph obtained from G by contracting H into a single vertex and let R0 be a τ-optimal orthogonal representation of G0. Then cost(R) = cost(R0) + bH holds. 20 Figure 12: (a) The structure of the flow network NE for the case that τ is an R-node with skel(τ) = K4. The outer face is split into several gray boxes to improve readability. (b) A flow together with the corresponding orthogonal representation. The numbers indicate the amount of flow on the arcs. Undirected edges imply 0 flow, directed arcs without a number have flow 1. Proof. Assume we have a τ-optimal orthogonal representation R of G inducing the orthogonal representation S on H. As H has either two or three bends we can simply contract it yielding an orthogonal representation R0 of G with cost(R0) = cost(R) − cost(S) ≤ cost(R) − bH. The opposite direction is more complicated. Assume we have an orthogonal representation R0 of G0, then we want to construct an orthogonal representation R of G with cost(R) = cost(R0) + bH. Let S be an orthogonal representation of H causing only bH cost. Since costH(·) was assumed to be non-convex, S needs to have three bends. It is easy to see that R0 and S (or S0 obtained from S by mirroring the drawing) can be combined to an orthogonal representation of G if the two edges incident to the vertex v in G0 corresponding to H have an angle of 90◦ between them. However, this can always be ensured without increasing the costs of R0. Let e1 and e2 be the edges incident to v and assume they have an angle of 180◦ between them in both faces incident to v. If neither e1 nor e2 has a bend, the flex graph contains the cycle around v due to the fact that e1 and e2 have positive flexibilities. Bending along this cycles introduces a bend to each of the edges, thus we can assume without loss of generality that e1 has a bend in R0. Moving v along the edge e1 until it reaches this bend decreases the number of bends on e1 by one and ensures that v has an angle of 90◦ in one of its incident faces. Thus we can replace v by the split component H with orthogonal representation S having cost bH yielding an orthogonal representation R of G with cost(R) = cost(R0) + bH. When computing a (τ,E)-optimal orthogonal representation of G we make use of Lemma 4 in the following way. If the expansion graph H corresponding to a virtual edge ε in skel(τ) has a non- convex cost function, we simply contract this virtual edge in skel(τ). Note that this is equivalent to contracting H in G. We can then make use of the fact that all remaining expansion graphs have convex cost functions to compute a (τ,E)-optimal orthogonal representation of the resulting graph yielding a (τ,E)-optimal orthogonal representation of the original graph G since the contracted expansion graphs can be inserted due to Lemma 4. Note that expansion graphs with non convex cost functions can only appear if the root is a Q- or an S-node. In the skeletons of P- and R-nodes every vertex has degree at least three, thus the poles of an expansion graph cannot have degree 3 since G has maximum degree 4. Now we are ready to define the flow network NE on skel(τ) with respect to the fixed embedding E of skel(τ); see Figure 12(a) for an example. For each vertex v, each virtual edge ε and each face f in skel(τ) the flow network NE contains the nodes v, ε and f, called vertex node, edge node and face node, respectively. The network NE contains the arcs (v, f) and (f, v) with capacity 1, called vertex-face arcs, if the vertex v and the face f are incident in skel(τ). For every virtual edge ε we 21 vertexnodefacenodeedgenodeskel(µ)edge-facearcvertex-facearc11232211(a)(b) be bτ =P add edge-face arcs (ε, f) and (f, ε), if f is incident to ε. We use costH(·) − bH as cost function of the arc (f, ε), where H is the expansion graph of the virtual edge ε. The edge-face arcs (ε, f) in the opposite direction have infinite capacity with 0 cost. It remains to define the demand of every node in NE. Every inner face has a demand of 4, the outer face has a demand of −4. An edge node ε stemming from the edge ε = {s, t} with expansion graph H has a demand of degH(s) + degH(t) − 2, where degH(v) denotes the degree of v in H. The demand of a vertex node v is 4 − degG(v) − degskel(τ)(v). In the flow network NE the flow entering a face node f using a vertex-face arc or an edge- face arc is interpreted as the rotation at the corresponding vertex or along the path between the poles of the corresponding child, respectively; see Figure 12(b) for an example. Incoming flow is positive rotation and outgoing flow negative rotation. Let bH1, . . . , bHk be the base costs of the expansion graphs corresponding to virtual edges in skel(τ). We define the total base costs of τ to i bHi. Note that the total base costs of τ are a lower bound for the costs that have to be paid for every orthogonal representation of G. We show that an optimal flow φ in NE corresponds to a (τ,E)-optimal orthogonal representation R of G. Since the base costs do not appear in the flow network, the costs of the flow and its corresponding orthogonal representation differ by the total base costs bτ, that is cost(R) = cost(φ) + bτ. We obtain the following lemma. Lemma 5. Let G be a biconnected convex instance of OptimalFlexDraw, let T be its SPQR- tree with root τ and let E be an embedding of skel(τ). If the cost function of every principal split component is known, a (τ,E)-optimal solution can be computed in O(Tflow( skel(τ))) time. Proof. As mentioned before, we want to use the flow network NE to compute an optimal orthogonal representation. To this end we show two directions. First, given a (τ,E)-optimal orthogonal representation R, we obtain a feasible flow φ in NE such that cost(φ) = cost(R) − bτ, where bτ are the total base costs. Conversely, given an optimal flow φ in NE, we show how to construct an orthogonal representation R such that cost(R) = cost(φ) + bτ. As the flow network NE has size O( skel(τ)), the claimed running time follows immediately. Let R be a (τ,E)-optimal orthogonal representation of G. As we only consider nice and thus only tight drawings we can assume the orthogonal representation R to be tight. Recall that being tight implies that the poles of the expansion graph of every virtual edge have a rotation of 1 in the internal faces. We first show how to assign flow to the arcs in NE. It can then be shown that the resulting flow is feasible and causes cost(R) − bτ cost. For every pair of vertex-face arcs (f, v) and (v, f) in NE there exists a corresponding face f in the orthogonal representation R of G and we set φ((v, f)) = rot(vf). Let ε = {s, t} be a virtual edge in skel(µ) incident to the two faces f1 and f2. Without loss of generality let πf1(s, t) be the path belonging to the expansion graph of ε. Then πf2(t, s) also belongs to H. We set φ((ε, f1)) = rotR(πf1(s, t)) and φ((ε, f2)) = rotR(πf2(t, s)). For the resulting flow φ we need to show that the capacity of every arc is respected, that the demand of every vertex is satisfied, and that cost(φ) = cost(R) − bτ holds. First note that the flow on the vertex-face arcs does not exceed the capacities of 1 since every vertex has degree at least 2. Since no other arc has a capacity, it remains to deal with the demands and the costs. For the demands we consider each vertex type separately. Let f be a face node. The total incoming flow entering f is obviously equal to the rotation in R around the face f. As R is an orthogonal representation this rotation equals to 4 (−4 for the outer face), which is exactly the demand of f. Let ε be an edge node corresponding to the expansion graph H with poles s and t. Recall that dem(ε) = degH(s) + degH(t) − 2 is the demand of ε. Figure 13(a) illustrates the demand of a virtual edge. Let S be the orthogonal representation induced on H by R and let f be the outer face of S. Clearly, the flow leaving ε is equal to rotR(πf1(s, t)) + rotR(πf2(t, s)) = 22 Figure 13: (a) Illustration of the demand of virtual edges. (b) Rotation of poles in the outer face, depending on the degree. rotS(πf(s, t)) + rotS(πf(t, s)). Since f is the outer face of H, the total rotation around this faces sums up to −4. The rotation of the pole s in the outer face f is degH(s)−3, see Figures 13(b), and the same holds for t. Thus we have rotS(πf(s, t))+rotS(πf(t, s))+degH(s)−3+degH(t)−3 = −4. This yields for the outgoing flow rotS(πf(s, t)) + rotS(πf(t, s)) = 2 − degH(s) − degH(t), which is exactly the negative demand of ε. It remains to consider the vertex nodes. Let v be a vertex node, recall that dem(v) = 4 − degG(v) − degskel(τ)(v) holds. The outgoing flow leaving v is equal to the summed rotation of v in faces not belonging to expansion graphs of virtual edges in skel(τ). As R is an orthogonal representation, the total rotation around every vertex v is 2 · (degG(v) − 2). Moreover, v is incident to degskel(τ)(v) faces that are not contained in expansion graphs of virtual edges of skel(τ). Thus there are degG(v) − degskel(τ)(v) faces incident to v belonging to expansion graphs. As we assumed that the orthogonal representation of every expansion graph is tight, the rotation of v in each of these faces is 1. Thus the rotation of v in the remaining faces not belonging to expansion graphs is 2·(degG(v)−2)−(degG(v)−degskel(τ)(v)). Rearrangement yields a rotation, and thus an outgoing flow, of degG(v) + degskel(τ)(v) − 4, which is the negative demand of v. To show that cost(φ) = cost(R)−bτ holds it suffices to consider the flow on the edge-face arcs as no other arcs cause cost. Let ε be a virtual edge and let f1 and f2 the two incident faces. The flow entering f1 or f2 does not cause any cost, as (ε, f1) and (ε, f2) have infinite capacity with 0 cost. Thus only flow entering ε over the arcs (f1, ε) and (f2, ε) may cause cost. Assume without loss of generality that the number of bends ρ the expansion graph H of ε has is determined by the rotation along πf1(s, t), that is ρ = − rotR(πf1(s, t)). Let ρ0 = − rotR(πf2(t, s)) be the negative rotation along the path πf2(t, s) in the face f2. Note that φ((f1, ε)) = ρ and φ((f2, ε)) = ρ0. Obviously, the flow on (f1, ε) causes the cost costH(ρ) − bH. We show that the cost caused by the flow on (f2, ε) is 0. If ρ0 ≤ 0 this is obviously true, as there is no flow on the edge (f2, ε). Otherwise, 0 < ρ0 ≤ ρ holds. It follows that the smallest possible number of bends 'H every orthogonal representation of H has lies between ρ0 and ρ. It follows from the definition of costH(·) and from the fact that all cost functions are convex that costH(ρ0) = bH. To sum up, the total cost on edge-face arcs incident to the virtual edge ε is equal to the cost caused by its expansion graph H with respect to the orthogonal representation R minus the base cost bH. As neither φ nor R have additional cost we obtain cost(φ) = cost(R) − bτ. It remains to show the opposite direction, that is given an optimal flow φ in NE, we can construct an orthogonal representation R of G such that cost(R) = cost(φ) + bτ. This can be done by reversing the construction above. The flow on edge-face arcs determines the number of bends for the expansion graphs of each virtual edge. The cost functions of these expansion graphs guarantee the existence of orthogonal representations with the desired rotations along the paths between the poles, thus we can assume to have orthogonal representations for all children. We combine these orthogonal representations by setting the rotations between them at common poles as specified by the flow on vertex-face arcs. It can be easily verified that this yields an orthogonal representation of the whole graph G by applying the above computation in the opposite direction. The above results rely on the fact that the cost functions of principal split components are 23 (a)012111−2−1021t131st242st2tttssss(b) convex as stated in Theorem 5 and that they can be computed efficiently. In the following we show that Theorem 5 really holds with the help of a structural induction over the SPQR-tree. More precisely, the cost functions of principal split components corresponding to the leaves of T are the cost functions of the edges and thus they are convex. For an inner node µ we assume that the pertinent graphs of the children of µ have convex cost functions and show that H = pert(µ) itself also has a convex cost function. The proof is constructive in the sense that it directly yields an algorithm to compute these cost functions bottom up in the SPQR-tree. Note that we can again apply Lemma 4 in the case that the cost function of the expansion graph of one of the virtual edges in skel(µ) is not convex due to the fact that both of its poles have degree 3. This means that we can simply contract such a virtual edge (corresponding to a contraction of the expansion graph in H), compute the cost function for the remaining graph instead of H and plug the contracted expansion graph into the resulting orthogonal representations. Thus we can assume that the cost function of each of the expansion graphs is convex, without any exceptions. The flow network NE that was introduced to compute an optimal orthogonal representation in the root of the SPQR-tree can be adapted to compute the cost function of the principal split component H corresponding to a non-root node µ. To this end we have to deal with the parent edge, which does not occur in the root of T , and we consider a parameterization of NE to compute several optimal orthogonal representations with a prescribed number of bends, depending on the parameter in the flow network. Before we describe the changes in the flow network we need to make some considerations about the cost function. By the definition of the cost function it explicitely optimizes over all planar embeddings of skel(µ). Moreover, as the cost function costH(ρ) depends on the number of bends ρ a graph H has, it implicitly allows to flip the embedding of H since the number of bends is defined as max{ rot(π(s, t)), rot(π(t, s))}. However, the flow network NE can only be used to compute the cost function for a fixed embedding. Thus we define the partial H(ρ) of H with respect to the planar embedding E of skel(µ) to be the smallest cost function costE possible cost of an orthogonal representation inducing the planar embedding E on skel(µ) with ρ bends such that the number of bends is determined by πf(s, t), that is rot(πf(s, t)) = −ρ, where f H(·), is the outer face. Note that the minimum over the partial cost functions costE where E0 is obtained by flipping the embedding E of skel(µ) yields a function describing the costs of H with respect to the embedding E of skel(µ) depending on the number of bends H has (and not on the rotation along πf(s, t) as the partial cost function does). Obviously, minimizing over all partial cost functions yields the cost function of H. The flow network NE is defined as before with the following modifications. The parent edge of skel(µ) does not have a corresponding edge node. Let f1 and f2 be the faces in skel(µ) incident to the parent edge. These two faces together form the outer face f of H, thus we could merge them into a single face node. However, not merging them has the advantage that the incoming flow in f1 and f2 corresponds to the rotations along πf(s, t) and πf(t, s), respectively (it might be the other way round but we can assume this situation without loss of generality). Thus, we do not merge f1 and f2, which enables us to control the number of bends of H by setting the demands of f1 and f2. This is also the reason why we remove the vertex-face arcs between the poles and the two faces f1 and f2. Before we describe how to set the demands of f1 and f2, we fit the demands of the poles to the new situation. As we only consider tight orthogonal representations we know that the rotation at the poles s and t in all inner faces is 1. Thus, we set dem(s) = 2− degskel(µ)(s) and dem(t) = 2 − degskel(µ)(t) as this is the number of faces incident to s and t, respectively, after removing the vertex-face arcs to f1 and f2. With these modifications the only flow entering f1 and f2 comes from the paths πf(s, t) and πf(t, s), respectively. As the total rotation around the outer face is −4 and the rotation at the vertices s and t is degH(s)−3 and degH(t)−3, respectively, we have to H(·) and costE0 24 ensure that dem(f1) + dem(f2) = 2− degH(s)− degH(t). As mentioned before, we assume without loss of generality that πf(s, t) belongs to the face f1 and πf(t, s) belongs to f2. Then the incoming flow entering f1 corresponds to rot(πf(s, t)) of an orthogonal representation. We parameterize NE with respect to the faces f1 and f2 starting with dem(f1) = 0 and dem(f2) = 2−degH(s)−degH(t). It obviously follows that an optimal flow in NE with respect to the parameter ρ corresponds to an optimal orthogonal representation of H that induces E on skel(µ) and has a rotation of −ρ along πf(s, t). Thus, up to the total base costs bµ, the cost function of the flow network equals to the partial cost function of H on the interval ['H , 3], that is costNE(ρ) + bµ = costE H(ρ) for 'H ≤ ρ ≤ 3. To obtain the following lemma it remains to show two things for the case that deg(s) + deg(t) < 6. First, costNE(ρ) and thus each partial cost function is convex for 'H ≤ ρ ≤ 3. Second, the minimum over these partial cost functions is convex. Lemma 6. If Theorem 5 holds for each principal split component corresponding to a child of the node µ in the SPQR-tree, then it also holds for pert(µ). Proof. As mentioned before, we can use the flow network NE to compute the partial cost function costE H(ρ) = costNE(ρ) + bµ holds on this interval. In the following we only consider the case where degH(s) + degH(t) < 6 holds for the poles s and t. For the case degH(s) = degH(t) = 3 we do not need to show anything. To show that the partial cost function is convex we do the following. First, we show that costE H(ρ) is minimal for ρ = 'H. This implies that the cost function costNE(ρ) of the flow network is minimal for ρ = ρ0 ≤ 'H. Then Theorem 1 can be applied showing that costNE(ρ) is convex for ρ ∈ [ρ0,∞] yielding that the partial cost function H(ρ) is convex for ρ ∈ ['H , 3]. Thus, it remains to show that costE costE H(ρ) is minimal for ρ = 'H to obtain convexity for the partial cost functions. Let S be an orthogonal representation of H with ρ ∈ ['H , 3] bends such that πf(s, t) determines the number of bends, that is rotS(πf(s, t)) = −ρ, where f is the outer face of H. We show the existence of an orthogonal representation S0 with rotS0(πf(s, t)) = −'H and cost(S0) ≤ cost(S). Since we assume S to be tight, the rotations at the poles rotS(sf) and rotS(tf) only depend on the degree of s and t. More precisely, we have rotS(sf) = degH(s) − 3 and the same holds for t. Since the total rotation around the outer face f is −4 the following equation holds. H(ρ) for 'H ≤ ρ ≤ 3 since costE rotS(πf(t, s)) = ρ + 2 − degH(s) − degH(t) (1) In the following we show that rotS(πf(t, s)) ≥ 0 holds if the number of bends ρ exceeds 'H. Then Corollary 1 in combination with Theorem 4 can be used to reduce the rotation along πf(t, s) and thus reduce the number of bends by 1, yielding finally an orthogonal representation with 'H bends determined by πf(s, t). Recall that the lower bound for the number of bends was defined as 'H = d(deg(s) + deg(t) − 2)/2e. First consider the case that degH(s) + degH(t) is even (and of course less than 6). Then Equation (1) yields rotS(πf(t, s)) = ρ − 2'H. If ρ is greater than 'H this yields rotS(πf(t, s)) > −'H. Since 'H is at most 1 in the case that deg(s) + deg(t) is even and less than 6, this yields rotS(πf(t, s)) > −1. The case that degH(s) + degH(t) is odd works similarly. Then Equation (1) yields rotS(πf(t, s)) = ρ−2'H +1. As before ρ is assumed to be greater than 'H yielding rotS(πf(t, s)) > −'H + 1. As 'H is at most 2 we again obtain rotS(πf(t, s)) > −1, which concludes the proof that the partial cost functions are convex. It remains to show that the minimum over the partial cost functions is convex. First assume that µ is an R-node. Then its skeleton has only two embeddings E and E0 where E0 is obtained by flipping E. We have to show that the minimum over the two partial cost functions costE H(·) and H(·) remains convex. For the case that deg(s) + deg(t) = 5 the equation 'H = 2 holds and thus costE0 we only have to show convexity on the interval [2, 3]. Obviously, costH(·) is convex on this interval 25 H('H) = costE0 H(0) = costE H(·) and costE0 H('H) = costE0 H(1) holds by definition, if deg(s) + deg(t) > 2. if and only if costH(2) ≤ costH(3). As this is the case for both partial cost functions, it is also true for the minimum. For deg(s) + deg(t) < 5 we first show that costE H('H) holds. For the case that deg(s) + deg(t) is even this is clear since mirroring an orthogonal representa- tion S with rotS(πf(s, t)) = −'H inducing E on skel(µ) yields an orthogonal representation S0 with rotS0(πf(s, t)) = −'H inducing E0 on skel(µ). For the case that deg(s) + deg(t) = 3, the orthogonal representation S with rotation −1 along πf(s, t) can also be mirrored yielding S0 with rotation 0 along πf(s, t). By Corollary 1 this rotation can be reduced to −1 without causing any additional cost. As this construction also works in the opposite direction we have costE H('H) for all cases. Moreover, costE If deg(s) = deg(t) = 1 this equation is also true as the rotation along πf(s, t) of an orthogonal representation can be reduced by 1 if it is 0, again due to Corollary 1. Thus it remains to show that the cost function costH(·) defined as the minimum of costE H(·) is convex on the interval [1, 3]. Assume for a contradiction that costH(ρ) is not convex for ρ ∈ [1, 3], that is ∆ costH(1) > ∆ costH(2). Assume without loss of generality that costH(3) = costE H(3) holds. As we showed before costH(1) = costE H(2) we additionally have costH(2) ≤ costE H(1) ≥ ∆ costH(1) and ∆ costE H(ρ) is not convex for ρ ∈ [1, 3], which is a contradiction. Thus costH(·) is convex. The case that µ is a P-node works similar to the case that µ is an R-node. If µ has only two children, its skeleton has only two embeddings E and E0 obtained from one another by flipping. Thus the same argument as for R-nodes applies. If µ has three children, then deg(s) = deg(t) = 3 holds and thus we do not have to show convexity. Note that in the case deg(s) = deg(t) = 3 the resulting cost function can be computed by taking the minimum over the partial cost functions with respect to all embeddings of skel(µ), although it may by non-convex. If µ is an S-node, we have a unique embedding and thus the partial cost function with respect to this embedding is already the cost function of H. Note that considering only the rotation along πf(s, t) for the partial cost function is not a restriction, as S-nodes are completely symmetric. H(2). This implies that the inequalities ∆ costE H(2) ≤ ∆ costH(2) hold, yielding that the partial cost function costE H(1) also holds. Since costH(2) is the minimum over costE H(2) and costE Lemma 6 together with the fact that the cost function of every edge is convex shows that Theorem 5 holds, that is the cost functions of all principal split components are convex on the interesting interval [0, 3] except for the special case where both poles have degree 3. However, this special case is easy to handle as principal split components of this type with non-convex cost functions can be simply contracted to a single vertex by Lemma 4. Moreover, the proof is constructive in the sense that it shows how the cost functions can be computed efficiently bottom up in the SPQR-tree. For each node µ we have to solve a constant number of minimum-cost flow problems in a flow network of size O( skel(µ)). As the total size of all skeletons in T is linear in the number n of vertices in G, we obtain an overall O(Tflow(n)) running time to compute the cost functions with respect to the root τ. Finally, Lemma 5 can be applied to compute an optimal orthogonal representation with respect to a fixed root and a fixed embedding of the root's skeleton in O(Tflow( skel(τ))) time. To compute an overall optimal solution, we have to compute a (τ,E)- optimal solution for every root τ and every embedding E of skel(τ). The number of embeddings of skel(τ) is linear in the size of skel(τ) (since P-nodes have at most degree 4) and the total size of all skeletons is linear in n. We obtain the following theorem. Theorem 6. OptimalFlexDraw can be solved in O(n · Tflow(n)) time for convex biconnected instances. 26 6.2 Connected Graphs In this section we extend the result obtained in Section 6.1 to the case that the input graph G contains cutvertices. Let B be the BC-tree of G rooted at some B-node β. Then every Block except for β has a unique cutvertex as parent and we need to find optimal orthogonal representations with the restriction that this cutvertex lies on the outer face. We claim that we can then combine these orthogonal representations of the blocks without additional cost. Unfortunately, with the so far presented results we cannot compute the optimal orthogonal representation of a biconnected graph considering only embeddings where a specific vertex v lies on the outer face. We may restrict the embeddings of the skeletons we consider when traversing the SPQR-tree bottom up to those who have v on the outer face. However, we can then no longer assume that the cost functions we obtain are symmetric. To deal with this problem, we present a modification of the SPQR-tree, that can be used to represent exactly the planar embeddings that have v on the outer face and are represented by the SPQR-tree rooted at a node τ. Let τ be the root of the SPQR-tree T . If v is a vertex of skel(τ), then restricting the embeddings of skel(τ) to those who have v on the outer face of skel(τ) forces v to be on the outer face of the resulting embedding of G. Otherwise, v is contained in the expansion graph of a unique virtual edge ε in skel(τ), we say that v is contained in ε. Obviously, ε has to be on the outer face of the embedding of skel(τ). However, this is not sufficient and it depends on the child µ of τ corresponding to ε whether v lies on the outer face of the resulting embedding of G. Let Eτ be an embedding of skel(τ) having ε on the outer face and let s and t be the endpoints of ε. Then there are two possibilities, either ε = {s, t} has the outer face to the left or to the right, where the terms "left" and "right" are with respect to an orientation from t to s. Assume without loss of generality that the outer face lies to the right of ε and consider the child µ of τ corresponding to ε. As T is rooted, we consider only embeddings of skel(µ) that have the parent edge {s, t} on the outer face. As the choice of the outer face of skel(µ) does not have any effect on the resulting embedding, we can assume that {s, t} lies to the left of skel(µ), that is the inner face incident to {s, t} lies to the right of {s, t} with respect to an orientation from t to s. A vertex contained in skel(µ) then lies obviously on the outer face of the resulting embedding of G if and only if it lies on the outer face of the embedding of skel(µ). Thus, if v is contained in skel(µ), restricting the embedding choices such that v lies on the outer face of skel(µ) forces v to be on the outer face of G. Note that in this case µ is either an R- or an S-node. For S-nodes there is no embedding choice and every vertex in skel(µ) lies on the outer face in this embedding. If µ is an R-node, there are only two embeddings and either v lies on the outer face of exactly one of them or in none of them. In the latter case the SPQR-tree with respect to the root τ does not represent an embedding of G with v on the outer face at all. Assume that v is not contained in skel(µ). Then it is again contained in a single virtual edge ε0 and it is necessary that ε0 lies on the outer face of the embedding of skel(µ). Moreover, it depends on the child of µ corresponding to ε0 whether v really lies on the outer face. Note that fixing ε0 on the outer face completely determines the embedding of skel(µ) if it is not a P-node. If µ is a P-node, the virtual edge ε0 has to be the rightmost, whereas the order of all other virtual edges can be chosen arbitrarily. If this is the case we split the P-node into two parts, one representing the fixed embedding of ε0, the other representing the choices for the remaining edges; see Figure 14(a). More precisely, we split µ into two P-nodes, the first one containing the parent edge {s, t}, the edge ε0 and a new virtual edge corresponding to the second P-node, which is inserted as child. The skeleton of the second P-node contains a parent edge corresponding to the first P-node and the remaining virtual edges that were contained in skel(µ) but are not contained in the first P-node. The children of µ are attached to the two P-nodes depending on where the corresponding virtual 27 Figure 14: (a) Splitting a P-node into two P-nodes, the vertex v fixed to the outer face is contained in the thick edges. (b) Contracting the path from the root to the node containing v in its skeleton. edges are. Note that by splitting the P-node µ, the virtual edge ε0 can no longer be in between two other virtual edges in µ. However, this is a required restriction, thus we do not loose embeddings that we want to represent. Moreover, the new P-node containing the virtual edge ε0 that need to be fixed to the outer face contains only two virtual edges (plus the parent edge) and thus the embedding of its skeleton is completely fixed by requiring ε0 to be on the outer face. To sum up, if skel(τ) contains v, then we simply have to choose an embedding of skel(τ) with v on the outer face. Otherwise, we have to fix the virtual edge containing v to the outer face and additionally have to consider the child of τ corresponding to this virtual edge. For the child we then have essentially the same situation. Either v is contained in its skeleton, then the embedding is fixed to the unique embedding having v on the outer face or v is contained in some virtual edge. However, then the embedding of the skeleton is again completely fixed (P-nodes have to be split up first) and we can continue with the child corresponding to the virtual edge containing v. This yields a path of nodes starting with the root τ having a completely fixed embedding only depending on the embedding Eτ chosen for skel(τ). As the nodes on the path do not represent any embedding choices, we can simply contract the whole path into a single new root node, merging the skeletons on the path, such that the embedding of the new skeleton of the root is still fixed. This contraction is illustrated in Figure 14(b). More precisely, let τ be the root and let ε be the edge containing v, corresponding to the child µ. Then we merge τ and µ by replacing ε in τ by the skeleton of µ without the parent edge. The children of µ are of course attached to the new root τ0 since skel(τ0) contains the corresponding virtual edges. As mentioned before, the embedding of skel(µ) was fixed by the requirement that v is on the outer face, thus the new skeleton skel(τ0) has a unique embedding Eτ0 inducing Eτ on skel(τ) and having v or the new virtual edge containing v on the outer face. The procedure of merging the root with the child corresponding to the virtual edge containing v is repeated until v is contained in the skeleton of the root. We call the resulting tree the restricted SPQR-tree with respect to the vertex v and to the embedding Eτ of the root. To come back to the problem OptimalFlexDraw, we can easily apply the algorithm presented in Section 6.1 to the restricted SPQR-tree. All nodes apart from the root are still S-, P-, Q- or R-nodes and thus the cost functions with respect to the corresponding pertinent graphs can be computed bottom up. The root τ may have a more complicated skeleton, however, its embedding is fixed, thus we can apply the flow algorithm as before, yielding an optimal drawing with respect to the chosen root τ and to the embedding Eτ of skel(τ) with the additional requirement that v lies on the outer face. Since the restricted SPQR-tree can be easily computed in linear time for a chosen root τ and a fixed embedding E of skel(τ), we can compute a (τ,E)-optimal orthogonal representation with the additional requirement that v lies on the outer face in Tflow(n) time, yielding the following theorem. 28 µ1µ2µ3µ4ststµ1µ2µ3stµ4tsts(a)µ1µ6µ7µ2µ3µ4µ5µ2µ1µ6µ7µ3µ4µ5(b)vv Theorem 7. OptimalFlexDraw with the additional requirement that a specific vertex lies on the outer face can be solved in O(n · Tflow(n)) time for convex biconnected instances. As motivated before, we can use the BC-tree to solve OptimalFlexDraw for instances that are not necessarily biconnected. We obtain the following theorem. Theorem 8. OptimalFlexDraw can be solved in O(n2 · Tflow(n)) time for convex instances. Proof. Let G be a convex instance with positive flexibility of OptimalFlexDraw and let B be its BC-tree rooted at some B-node β. We show how to find an optimal drawing of G, optimizing over all embeddings represented by B with respect to the root β. Then we can simply choose every B-node in B to be the root once, solving OptimalFlexDraw. The algorithm consumes O(n·Tflow(n)) time for each root β and thus the overall running time is O(n2 · Tflow(n)). For the block corresponding to the root β we use Theorem 6 to find the optimal orthogonal representation. For all other blocks we use Theorem 7 to find the optimal orthogonal representation with the cutvertex corresponding to the parent in B on the outer face. It remains to stack these orthogonal representations together without causing additional cost. This can be easily done, if a cutvertex that is forced to lie on the outer face has all free incidences in the outer face and every other cutvertex has all free incidences in a single face. The former can be achieved as we can assume orthogonal representations to be tight. If the latter condition is violated by a cutvertex v, then v has two incident edges e1 and e2 and the rotation of v is 0 in both incident faces. If both edges e1 and e2 have zero bends, we bend along a cycle around v in the flex graph and thus we can assume without loss of generality that e1 has a bend. Moving v along e1 to this bend yields an orthogonal representation where v has both free incidences in the same face. Thus given the orthogonal representations for the blocks, we can simply stack them together without causing additional cost. 6.3 Computing the Flow In the previous sections we used Tflow(n) as placeholder for the time necessary to compute a minimum-cost flow in a flow network of size n. Most minimum-cost flow algorithms do not consider the case of multiple sinks and sources. However, this is not a real problem as we can simply add a supersink connected to all sinks and a supersource connected to all sources. Unfortunately, the resulting flow network is no longer planar. Orlin gives a strongly polynomial time minimum- cost flow algorithm with running time O(m log n(m + n log n)), where n is the number of vertices and m the number of arcs [13]. Since our flow network is planar (plus supersink and supersource) the number of arcs is linear in the number of nodes. Thus with this flow algorithm we have Tflow(n) ∈ O(n2 log2 n). Cornelsen and Karrenbauer give a minimum-cost flow algorithm for planar flow networks with multiple sources and sinks consuming O(√ χ n log3 n) time [3], where χ is the cost of the resulting flow. Since the cost functions in an instance of OptimalFlexDraw may define exponentially large costs in the size of the input, we cannot use this flow algorithm in general to obtain a polynomial time algorithm. However, in practice it does not really make sense to have exponentially large costs. Moreover, in several interesting special cases an optimal solution has cost linear in the number of vertices. We obtain the following results. Corollary 3. A convex instance G of OptimalFlexDraw can be solved in O(n4 log2 n) and O(√ χ n3 log3 n) time, where χ is the cost of an optimal solution. The running time can be improved by a factor of O(n) for biconnected graphs. 29 7 Conclusion We presented an efficient algorithm for the problem OptimalFlexDraw that can be seen as the optimization problem corresponding to FlexDraw. As a first step, we considered biconnected 4-planar graphs with a fixed embedding and showed that they always admit a nice drawing, which implies at most three bends per edge except for a single edge on the outer face with up to four bends. Our algorithm for optimizing over all planar embeddings requires that the first bend on every edge does not cause any cost as the problem becomes NP-hard otherwise. Apart from that restric- tion we allow the user to specify an arbitrary convex cost function independently for each edge. This enables the user to control the resulting drawing. For example, our algorithm can be used to minimize the total number of bends, neglecting the first bend of each edge. This special case is the natural optimization problem arising from the decision problem FlexDraw. As another interesting special case, one can require every edge to have at most two bends and minimize the number of edges having more than one bend. This enhances the algorithm by Biedl and Kant [1] generating drawings with at most two bends per edge with the possibility of optimization. Note that in both special cases the cost of an optimal solution is linear in the size of the graph, yielding a running time in O(n 5 2 log3 n) if the graph is biconnected). 7 2 log3 n) (O(n References [1] T. Biedl and G. Kant. A Better Heuristic for Orthogonal Graph Drawings. Comput. Geom., 9(3):159 -- 180, 1998. [2] T. Bläsius, M. Krug, I. Rutter, and D. Wagner. Orthogonal Graph Drawing with Flexibility Constraints. In Graph Drawing (GD'10), volume 6502 of LNCS, pages 92 -- 104. Springer, 2011. [3] S. Cornelsen and A. Karrenbauer. Accelerated Bend Minimization. In Graph Drawing (GD'11), volume 7034 of LNCS, pages 111 -- 122. Springer, 2012. [4] G. Di Battista, G. Liotta, and F. Vargiu. Spirality and Optimal Orthogonal Drawings. SIAM J. Comput., 27(6):1764 -- 1811, 1998. [5] G. Di Battista and R. Tamassia. On-Line Maintenance of Triconnected Components with SPQR-Trees. Algorithmica, 15(4):302 -- 318, 1996. [6] G. Di Battista and R. Tamassia. On-Line Planarity Testing. SIAM J. Comput., 25(5):956 -- 997, 1996. [7] J. Edmonds and R. M. Karp. Theoretical Improvements in Algorithmic Efficiency for Network Flow Problems. J. ACM, 19:248 -- 264, 1972. [8] U. Fössmeier and M. Kaufmann. Drawing High Degree Graphs with Low Bend Numbers. In Graph Drawing (GD'95), LNCS, pages 254 -- 266. Springer, 1995. [9] A. Garg and R. Tamassia. On the Computational Complexity of Upward and Rectilinear Planarity Testing. SIAM J. Comput., 31(2):601 -- 625, 2001. [10] C. Gutwenger and P. Mutzel. A Linear Time Implementation of SPQR-Trees. Drawing (GD'00), volume 1984 of LNCS, pages 77 -- 90. Springer, 2001. In Graph 30 [11] G. W. Klau and P. Mutzel. Quasi-Orthogonal Drawing of Planar Graphs. Technical report, Max-Planck-Institut für Informatik, Saarbrücken, Germany, 1998. [12] A. Morgana, C. P. de Mello, and G. Sontacchi. An Algorithm for 1-bend Embeddings of Plane Graphs in the Two-Dimensional Grid. Discr. Appl. Math., 141(1-3):225 -- 241, 2004. [13] J. B. Orlin. A Faster Strongly Polynomial Minimum Cost Flow Algorithm. Oper. Res., 41:338 -- 350, 1993. [14] I. Rutter. The Many Faces of Planarity -- Matching, Augmentation, and Embedding Algorithms for Planar Graphs -- . PhD thesis, Fakultät für Informatik, Karlsruher Institut für Technologie (KIT), 2011. [15] R. Tamassia. On Embedding a Graph in the Grid with the Minimum Number of Bends. SIAM J. Comput., 16(3):421 -- 444, 1987. [16] R. Tamassia, G. Di Battista, and C. Batini. Automatic Graph Drawing and Readability of Diagrams. IEEE Trans. Syst. Man Cybern., 18(1):61 -- 79, 1988. [17] S. Tayu, K. Nomura, and S. Ueno. On the Two-Dimensional Orthogonal Drawing of Series- Parallel Graphs. Discr. Appl. Math., 157(8):1885 -- 1895, 2009. [18] H. Whitney. Non-Separable and Planar Graphs. Transactions of the American Mathematical Society, 34(2):339 -- 338, April 1932. 31
1902.08742
1
1902
2019-02-23T06:04:30
Optimal Algorithm to Reconstruct a Tree from a Subtree Distance
[ "cs.DS" ]
This paper addresses the problem of finding a representation of a subtree distance, which is an extension of the tree metric. We show that a minimal representation is uniquely determined by a given subtree distance, and give a linear time algorithm that finds such a representation. This algorithm achieves the optimal time complexity.
cs.DS
cs
Optimal Algorithm to Reconstruct a Tree from a Subtree Distance Takanori Maehara RIKEN Center for Advanced Intelligence Project [email protected] Kazutoshi Ando Department of Mathematical and Systems Engineering, Shizuoka University [email protected] Abstract This paper addresses the problem of finding a representation of a subtree distance, which is an extension of the tree metric. We show that a minimal representation is uniquely determined by a given subtree distance, and give a linear time algo- rithm that finds such a representation. This algorithm achieves the optimal time complexity. Keywords: graph algorithm, phylogenetic tree, tree metric, subtree distance 1. Introduction and the results A phylogenetic tree represents an evolutionary relationship among the species that are investigated. Estimating a phylogenetic tree from experimental data is a fundamental problem in phylogenetics [8]. One of the commonly used approaches to achieve this task is the use of a distance-based method. In this approach, we first compute the dissimilarity (i.e., a nonnegative and symmetric function) between the species by, e.g., the edit distance between the genome sequences. Then, we find a weighted tree having the shortest path distance that best fits the given dissimilarity. The most popular method for this approach is the neighbor-joining method [6]. A weighted tree T is specified by the set of vertices V(T ), the set of edges E(T ), and the nonnegative edge weight l : E(T ) → R+. Let us consider the case in which a given dissimilarity d : X × X → R exactly fits some weighted tree; i.e., there exists 1 a weighted tree T and a mapping ψ : X → V(T ) such that d(x, y) = dT (ψ(x), ψ(y)) (x, y ∈ X), (1.1) where dT (u, v) is the distance between u and v in T for u, v ∈ V(T ). In this case, the dissimilarity d : X × X → R is called a tree metric, and the pair (T , ψ) is called a representation of d. It is known that a dissimilarity d is a tree metric if and only if it satisfies an inequality called the four-point condition [9, 2], which is given by d(x, y) + d(z, w) ≤ max{d(x, z) + d(y, w), d(x, w) + d(y, z)} (1.2) for any x, y, z, w ∈ X. For any tree metric d, there exists a unique minimal represen- tation (T , ψ) of d [2]. Here, a representation is minimal if there is no representation (T ′, ψ′) of d, such that T ′ is obtained by removing some vertices and edges and/or by contracting some edges of T (i.e., T ′ is a proper minor of T ). Furthermore, such a representation is constructed in O(n2) time [3], where n = X. In some applications, we are interested in the distance between groups of species (e.g., genus, tribe, or family). In such a case, we aim to identify a group as a con- nected subgraph in a phylogenetic tree. The subtree distance, which was introduced by Hirai [5], is an extension of the tree metric that can be adopted for use in such situations. A function d : X × X → R is called a subtree distance if there exists a weighted tree T and a mapping φ : X → 2V(T ) such that φ(x) induces a subtree of T (i.e., a connected subgraph of T ) for x ∈ X and equations d(x, y) = dT (φ(x), φ(y)) (x, y ∈ X), (1.3) hold, where dT (U, W ) = min{dT (u, w) u ∈ U, w ∈ W } for U, W ⊆ V(T ). We say that a pair (T , φ) is a representation of d. Note that a subtree distance is not necessarily a metric because it may not satisfy the non-degeneracy (d(x, y) > 0 for x 6= y) and the triangle inequality (d(x, z) ≤ d(x, y) + d(y, z)). Hirai proposed a characterization of subtree distances in which a dissimilarity d : X × X → R is a subtree distance if and only if it satisfies an inequality called the extended four-point condition, which is given by d(x, y) + d(z, w) ≤ max   d(x, z) + d(y, w), d(x, w) + d(y, z), d(x, y), d(z, w), d(x,y)+d(y,z)+d(z,x) , d(x,y)+d(y,w)+d(w,x) , , d(y,z)+d(z,w)+d(w,y) 2 2 d(x,z)+d(z,w)+d(w,x) 2 2   (1.4) for any x, y, z, w ∈ X. The extended four-point condition yields an O(n4) time algorithm to recognize a subtree distance. 2 This paper addresses the following problem, which we call the subtree distance reconstruction problem. Problem 1. Given a subtree distance d : X × X → R on a finite set X, find a representation (T , φ) of d. Ando and Sato [1] proposed an O(n3) time algorithm for this problem. Their al- gorithm consists of three steps: (1) identify a subset V0 = {x ∈ X d(y, z) ≤ d(x, y) + d(x, z) (y, z ∈ X)}, (2) find a representation (T , φ) for the restriction of d onto V0, and (3) for x ∈ X \ V0, locate φ(x) in T by examining a connected components of T \ φ(x). In this study, we propose the following theorems. We define a minimal represen- tation for a subtree distance in the same manner as a minimal representation for a tree metric. Theorem 2. For a subtree distance d : X ×X → R, a minimal representation (T , φ) is uniquely determined by d. Theorem 3. There exists an O(n2) time algorithm that finds, for any subtree dis- tance d : X × X → R, its unique minimal representation, where n = X. The proof of Theorem 3 is constructive. Similar to [1], our algorithm consists of three parts: (1) identify the set of objects L that are mapped to the leaves, (2) find the minimal representation (T , φ) for the restriction of d onto L, and (3) for x ∈ X \ L, locate φ(x) in T by measuring the distances from the leaves. Since Steps 1 and 3 can be implemented with a time complexity of O(n2), and there is an O(n2) time algorithm for Step 2 [3], the total time complexity of the algorithm is O(n2). Note that even if we know d : X × X → R is a tree metric, Ω(n2) time is required to reconstruct a tree [4]. Therefore, our algorithm achieves the optimal time complexity. This algorithm can also be used to recognize a subtree distance by checking the failure or inconsistency during the process and by verifying equations (1.3) after the reconstruction. Corollary 4. There exists an O(n2) time algorithm that determines whether a given input d : X × X → R is a subtree distance or not, where n = X. 2. Proofs We assume that there are no objects x, y ∈ X such that d(x, z) = d(y, z) for all z ∈ X. This assumption is satisfied by removing such elements after lexicographic sorting, which requires O(n2) time [7]. Clearly, this preprocessing does not change 3 the minimal representation. We also assume that X ≥ 3. Otherwise, the theorems trivially hold. First, we prove Theorem 2. We identify the properties of a minimal representa- tion. Lemma 5. Let (T , φ) be a minimal representation of a subtree distance d : X ×X → R. Then, the following properties hold. 1. For each edge e ∈ E(T ), the length of e is positive. 2. For each leaf vertex u ∈ V(T ), there exists x ∈ X such that φ(x) = {u}. Proof. 1. If there is an edge e of zero length, we can contract e from the represen- tation. 2. Let u be a leaf vertex of T . If there is no x ∈ X with u ∈ φ(x), we can remove u from the representation to obtain a smaller representation. Suppose that, for all x ∈ X with u ∈ φ(x), φ(x) contains at least two elements. Then, these φ(x)s contain the unique adjacent vertex v of u. Since d(v, w) ≤ d(u, w) for all w ∈ V(T ) \ {u}, u does not contribute any shortest paths in the tree. Therefore, we can remove u from the representation. Motivated by Property 2 in Lemma 5, we introduce the following definition. For a minimal representation (T , φ), an object x ∈ X is a leaf object if φ(x) = {u} for some leaf u ∈ V(T ). We defined a leaf object by specifying a minimal representation. However, as shown below, the set of leaf objects is uniquely determined by d. First, we show that there exists an object that is a leaf object for any minimal representation. Lemma 6. Let (r, r′) ∈ argmaxx,y∈X d(x, y). Then, for any minimal representation, r and r′ are leaf objects. Proof. For any tree, the farthest pair is attained by a pair of leaves. Next, we show that the leaf objects are characterized by d and a leaf object r. Lemma 7. Let (T , φ) be a minimal representation of subtree distance d : X × X → R, and let r ∈ X be a leaf object. An object x ∈ X \ {r} is a leaf object if and only if d(y, r) < d(x, y) + d(x, r) for all y ∈ X \ {x, r}. Proof. (The "if" part). Suppose x is not a leaf object. Then, there is another leaf object y ∈ X \ {x, r} such that the path from φ(r) to φ(y) intersects φ(x). By considering distances among φ(r), φ(y) and φ(x) on this path, we have d(r, y) ≥ d(x, r) + d(x, y). 4 (The "only if" part). Suppose x is a leaf object. Then, for any y ∈ X \ {x, r} the shortest path from φ(y) to φ(r) never intersects φ(x). Thus, we have d(y, r) < d(x, y) + d(x, r). Here, we used the assumption that there is no x, y ∈ X such that d(x, z) = d(y, z) for all z ∈ X. Since we can take a leaf object r universally by Lemma 6, and the condition in Lemma 7 is described without specifying the underlying representation, we can conclude that the set of leaf objects is uniquely determined by d. Thus, we obtain the following corollary. Corollary 8. Any minimal representation of a subtree distance has the same leaf objects. Now, we observe that the dissimilarity dL : L × L → R obtained by restricting d : X × X → R on the set of leaf objects L ⊆ X forms a tree metric because the leaf objects are mapped to singletons. Since the minimal representation of a tree metric is unique [2], any minimal representation of d has the same topology as the minimal representation of dL. The remaining issue is to show that each non-leaf object x ∈ X \ L is uniquely located in the minimal representation (T , φ) of dL. This is clear because any con- nected subgraph in a tree is uniquely identified by the distances from the leaves. More precisely, we obtain the following explicit representation. We first consider T as a continuous object. We fix a leaf object r ∈ L. For each leaf object x ∈ L \ {r}, there exists a unique path path(φ(r), φ(x)) from φ(r) to φ(x) in T . Let I(r, a; x, b) be the interval on the path having a distance of at least a from φ(r) and at least b from φ(x), i.e., I(r, a; x, b) = {u ∈ path(φ(r), φ(x)) : dT (φ(r), u) ≥ a, dT (φ(x), u) ≥ b}. (2.1) For U ⊆ V(T ), we denote by U the subgraph of T induced by U. Note that both I(r, a; x, b) and U are continuous objects. By using these notations, we obtain the following. Lemma 9. Let d : X ×X → R be a subtree distance and L be the set of leaf objects. Let (T , φ) be the minimal representation of dL. Fix a leaf object r ∈ L. Then, we have for each non-leaf object z ∈ X \ L φ(z) = [ x∈L\{r} I(r, d(r, z); x, d(x, z)). (2.2) 5 Proof. Since φ(z) is a connected subgraph, the intersection of φ(z) and the path from φ(r) to φ(x) is the interval I(r, d(r, z); x, d(x, z)). Since any tree is covered by the paths from a fixed leaf φ(r) and the other leaves φ(x) for x ∈ L \ {r}, we have φ(z) =   [ = [ x∈L\{r} x∈L\{r} path(φ(r), φ(x))  ∩ φ(z) (cid:16)path(φ(r), φ(x)) ∩ φ(z)(cid:17) = [ x∈L\{r} I(r, d(r, z); x, d(x, z)). (2.3) By placing the vertices on the boundaries of φ(z) for z ∈ X \ L and then let- ting φ(z) be the vertices intersecting φ(z) for z ∈ X \ L, we obtain the minimal representation of d. This completes the proof of Theorem 2. Note that the number of the vertices of the minimal representation is O(n2) since each φ(z) has at most L = O(n) boundaries. Now, we prove Theorem 3. The above proof of Theorem 2 is constructive, and it provides the following algorithm: 1. Identify the set L of leaf objects by Lemmas 6 and 7. 2. Find the minimal representation of dL by the existing algorithm. 3. Locate the non-leaf objects by Lemma 9. We evaluate the time complexity of this algorithm. Step 1 is conducted in O(n2) time for finding a leaf object r ∈ X and O(n2) time for finding other leaf objects. Step 2 is performed in O(n2) time by using Culberson and Rudnicki's algorithm [3]. Also, Step 3 is performed in O(n2) time by equation (2.2) since, for each z, it processes each edge at most once. Hence, Theorem 3 is proved. Acknowledgments The authors thank Hiroshi Hirai and anonymous referees for helpful comments. This work was supported by the Japan Society for the Promotion of Science, KAK- ENHI Grant Number 15K00033. 6 References [1] Kazutoshi Ando and Koki Sato. An algorithm for finding a representation of a subtree distance. Journal of Combinatorial Optimization, 36(3):742 -- 762, 2018. [2] Peter Buneman. The recovery of trees from measures of dissimilarity. In D.G. Kendall and P. Tautu, editors, Mathematics in the Archeological and Historical Sciences, pages 387 -- 395. Edinburgh University Press, 1971. [3] Joseph C. Culberson and Piotr Rudnicki. A fast algorithm for constructing trees from distance matrices. Information Processing Letters, 30(4):215 -- 220, 1989. [4] Jotun J. Hein. An optimal algorithm to reconstruct trees from additive distance data. Bulletin of Mathematical Biology, 51(5):597 -- 603, 1989. [5] Hiroshi Hirai. Characterization of the distance between subtrees of a tree by the associated tight span. Annals of Combinatorics, 10(1):111 -- 128, 2006. [6] Naruya Saitou and Masatoshi Nei. The neighbor-joining method: a new method for reconstructing phylogenetic trees. Molecular Biology and Evolution, 4(4):406 -- 425, 1987. [7] Juraj Wiedermann. The complexity of lexicographic sorting and searching. In Proceedings of the 8th International Symposium on Mathematical Foundations of Computer Science, pages 517 -- 522, 1979. [8] Edward O. Wiley and Bruce S. Lieberman. Phylogenetics: Theory and Practice of Phylogenetic Systematics. John Wiley & Sons, 2011. [9] K. A. Zaretskii. Constructing a tree on the basis of a set of distances between the hanging vertices. Uspekhi Matematicheskikh Nauk, 20(6):90 -- 92, 1965. 7
1711.02120
1
1711
2017-11-06T19:14:43
Small Resolution Proofs for QBF using Dependency Treewidth
[ "cs.DS", "cs.LO" ]
In spite of the close connection between the evaluation of quantified Boolean formulas (QBF) and propositional satisfiability (SAT), tools and techniques which exploit structural properties of SAT instances are known to fail for QBF. This is especially true for the structural parameter treewidth, which has allowed the design of successful algorithms for SAT but cannot be straightforwardly applied to QBF since it does not take into account the interdependencies between quantified variables. In this work we introduce and develop dependency treewidth, a new structural parameter based on treewidth which allows the efficient solution of QBF instances. Dependency treewidth pushes the frontiers of tractability for QBF by overcoming the limitations of previously introduced variants of treewidth for QBF. We augment our results by developing algorithms for computing the decompositions that are required to use the parameter.
cs.DS
cs
Small Resolution Proofs for QBF using Dependency Treewidth Eduard Eiben, Robert Ganian, and Sebastian Ordyniak Algorithms and Complexity Group, TU Wien, Vienna, Austria [email protected], [email protected], [email protected] Abstract In spite of the close connection between the evaluation of quantified Boolean formulas (QBF) and propositional satisfiability (SAT), tools and techniques which exploit structural properties of SAT instances are known to fail for QBF. This is especially true for the structural parameter treewidth, which has allowed the design of successful algorithms for SAT but cannot be straightforwardly applied to QBF since it does not take into account the interdependencies between quantified variables. In this work we introduce and develop dependency treewidth, a new structural parameter based on treewidth which allows the efficient solution of QBF instances. Dependency treewidth pushes the frontiers of tractability for QBF by overcoming the limitations of previously introduced variants of treewidth for QBF. We augment our results by developing algorithms for computing the decompositions that are required to use the parameter. Digital Object Identifier 10.4230/LIPIcs... 1 Introduction The problem of evaluating quantified Boolean formulas (QBF) is a generalization of the propositional satisfiability problem (SAT) which naturally captures a range of computational tasks in areas such as verification, planning, knowledge representation and automated rea- soning [11, 19, 23, 24]. QBF is the archetypical PSpace-complete problem and is therefore believed to be computationally harder than NP-complete problems such as SAT [17, 20, 30]. In spite of the close connection between QBF and SAT, many of the tools and techniques which work for SAT are known not to help for QBF, and dynamic programming based on the structural parameter treewidth [2, 31] is perhaps the most prominent example of this behavior. Treewidth is a highly-established measure of how "treelike" an instance is, and in the SAT setting it is known that n-variable instances of treewidth at most k can be solved in time at most f(k) · n [31] for a computable function f. Algorithms with running time in this form (i.e., f(k) · nO(1), where k is the parameter and the degree of the polynomial of n is independent of k) are called fixed-parameter algorithms, and problems which admit such an algorithm (w.r.t. a certain parameter) belong to the class FPT. Furthermore, in the SAT setting, treewidth allows us to do more than merely solve the instance: it is also possible to find a so-called resolution proof [7, 5]. If the input was a non-instance, such a resolution proof contains additional information on "what makes it unsatisfiable" and hence can be more useful than outputting a mere Reject in practical settings. In the QBF setting, the situation is considerably more complicated. It is known that QBF instances of bounded treewidth remain PSpace-complete [2], and the intrinsic reason for this fact is that treewidth does not take into account the dependencies that arise between variables in QBF. So far, there have been several attempts at remedying this situation by introducing variants of treewidth which support fixed-parameter algorithms for QBF: prefix pathwidth (along with prefix treewidth) [12] and respectful treewidth [2], along with two other licensed under Creative Commons License CC-BY Leibniz International Proceedings in Informatics Schloss Dagstuhl -- Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany XX:2 Small Resolution Proofs for QBF using Dependency Treewidth parameters [1, 6] which originate from a different setting but can also be adapted to obtain fixed-parameter algorithms for QBF. We refer to Subsection 3.2 for a comparison of these pa- rameters. Aside from algorithms with runtime guarantees, it is worth noting that empirical connections between treewidth and QBF have also been studied in the literature [21, 22]. In this work we introduce and develop dependency treewidth, a new structural param- eter based on treewidth which supports fixed-parameter algorithms for QBF. Dependency treewidth pushes the frontiers of tractability for QBF by overcoming the limitations of both the previously introduced prefix and respectful variants. Compared to the former, this new parameter allows the computation of resolution proofs analogous to the case of classical treewidth for SAT instances. Prefix pathwidth relies on entirely different techniques to solve QBF and does not yield small resolution proofs. Moreover, the running time of the fixed-parameter algorithm which uses prefix pathwidth has a triple-exponential dependency on the parameter k, while dependency treewidth supports a considerably more efficient O(32knk)-time algorithm for QBF. Unlike respectful treewidth and its variants, which only take the basic dependencies between variables into account, dependency treewidth can be used in conjunction with the so-called dependency schemes introduced by Samer and Szeider [25, 27], see also the work of Biere and Lonsing [3]. Dependency schemes allow an in-depth analysis of how the assignment of individual variables in a QBF depends on other variables, and research in this direction has uncovered a large number of distinct dependency schemes with varying complexities. The most basic dependency scheme is called the trivial dependency scheme [25], which stipulates that each variable depends on all variables with distinct quantification which precede it in the prefix. Respectful treewidth in fact coincides with dependency treewidth when the trivial dependency scheme is used, but more advanced dependency schemes allow us to efficiently solve instances which otherwise remain out of the reach of state-of-the-art techniques. Crucially, all of the structural parameters mentioned above require a so-called decom- position in order to solve QBF; computing these decompositions is typically an NP-hard problem. A large part of our technical contribution lies in developing algorithms to com- pute decompositions for dependency treewidth. Without such algorithms, it would not be possible to use the parameter unless a decomposition were supplied as part of the input (an unrealistic assumption in practical settings). It is worth noting that all of these algorithms can also be used to find respectful tree decompositions, where the question of finding suitable decompositions was left open [2]. We provide two algorithms for computing dependency tree decompositions, each suitable for use under different situations. The article is structured as follows. After the preliminaries, we introduce the parameter and show how to use it to solve QBF (assuming a decomposition has already been computed). This section also contains an in-depth overview and comparison of previous work in the area. A separate section then introduces other equivalent characterizations of dependency treewidth. The last technical section contains our algorithms for finding dependency tree decompositions, after which we provide concluding notes and remarks. Preliminaries 2 For i ∈ N, we let [i] denote the set {1, . . . , i}. We refer to the book by Diestel [9] for standard graph terminology. Given a graph G, we denote by V (G) and E(G) its vertex and edge set, respectively. We use ab as a shorthand for the edge {a, b}. For V 0 ⊆ V (G), the guards of V 0 (denoted δ(V 0)) are the vertices in V (G) \ V 0 with at least one neighbor in V 0. We refer to the standard textbooks [10, 14] for an in-depth overview of parameterized Eduard Eiben, Robert Ganian, and Sebastian Ordyniak XX:3 complexity theory. Here, we only recall that a parameterized problem (Q, κ) is a problem Q ⊆ Σ∗ together with a parameterization κ: Σ∗ → N, where Σ is a finite alphabet. A parameterized problem (Q, κ) is fixed-parameter tractable (w.r.t. κ), in short FPT, if there exists a decision algorithm for Q, a computable function f : N → N, and a polynomial function p: N → N, such that for all x ∈ Σ∗, the running time of the algorithm on x is at most f(κ(x)) · p(x). Algorithms with this running time are called fixed-parameter algorithms. 2.1 Quantified Boolean Formulas For a set of propositional variables K, a literal is either a variable x ∈ K or its negation ¯x. A clause is a disjunction over literals. A propositional formula in conjunctive normal form (i.e., a CNF formula) is a conjunction over clauses. Given a CNF formula φ, we denote the set of variables which occur in φ by var(φ). For notational purposes, we will view a clause as a set of literals and a CNF formula as a set of clauses. A quantified Boolean formula is a tuple (φ, τ) where φ is a CNF formula and τ is a sequence of quantified variables, denoted var(τ), which satisfies var(τ) ⊇ var(φ); then φ is called the matrix and τ is called the prefix. A QBF (φ, τ) is true if the formula τ φ is true. A quantifier block is a maximal sequence of consecutive variables with the same quantifier. An assignment is a mapping from (a subset of) the variables to {0, 1}. The primal graph of a QBF I = (φ, τ) is the graph GI defined as follows. The vertex set of GI consists of every variable which occurs in φ, and st is an edge in GI if there exists a clause in φ containing both s and t. 2.2 Dependency Posets for QBF Before proceeding, we define a few standard notions related to posets which will be used throughout the paper. A partially ordered set (poset) V is a pair (V,≤V ) where V is a set and ≤V is a reflexive, antisymmetric, and transitive binary relation over V . A chain W of V is a subset of V such that x ≤V y or y ≤V x for every x, y ∈ W. A chain partition of V is a tuple (W1, . . . , Wk) such that {W1, . . . , Wk} is a partition of V and for every i with 1 ≤ i ≤ k the poset induced by Wi is a chain of V. An anti-chain A of V is a subset of V such that for all x, y ∈ A neither x ≤V y nor y ≤V x. The width (or poset-width) of a poset V, denoted by width(V), is the maximum cardinality of any anti-chain of V. A poset of width 1 is called a linear order. A linear extension of a poset P = (P,≤P ) is a relation (cid:22) over P such that x (cid:22) y whenever x ≤P y and the poset P∗ = (P,(cid:22)) is a linear order. A subset A of V is downward-closed if for every a ∈ A it holds that b ≤V a =⇒ b ∈ A. A reverse of a poset is obtained by reversing each relation in the poset. For brevity we will often write ≤V to refer to the poset V := (V,≤V ). (cid:73) Proposition 1 ([13]). Let V be a poset. Then in time O(width(V)·kVk2), it is possible to compute both width(V) = w and a corresponding chain partition (W1, . . . , Ww) of V. We use dependency posets to provide a general and formal way of speaking about the various dependency schemes introduced for QBF [25]. It is important to note that depen- dency schemes in general are too broad a notion for our purposes; for instance, it is known that some dependency schemes do not even give rise to sound resolution proof systems. Here we focus solely on so-called permutation dependency schemes [28], which is a general class containing all commonly used dependency schemes that give rise to sound resolution proof XX:4 Small Resolution Proofs for QBF using Dependency Treewidth systems. This leads us to our definition of dependency posets, which allow us to capture all permutation dependency schemes. Given a QBF I = (φ, τ), a dependency poset V = (var(φ),≤I) of I is a poset over var(φ) with the following properties: 1. for all x, y ∈ var(φ), if x ≤I y, then x is before y in the prefix, and 2. given any linear extension (cid:22) of V, the QBF I0 = (φ, τ(cid:22)), obtained by permutation of the prefix τ according the (cid:22), is true iff I is true. The trivial dependency scheme is one specific example of a permutation dependency scheme. This gives rise to the trivial dependency poset, which sets x ≤ y whenever x, y are in different quantifier blocks and x is before y in the prefix. However, more refined permutation dependency schemes which give rise to other dependency posets are known to exist and can be computed efficiently [25, 28]. In particular, it is easy to verify that a dependency poset can be computed from any permutation dependency scheme in polynomial time (by computing the transitive closure). To illustrate these definitions, consider the following QBF: ∃a∀b∃c(a ∨ c) ∧ (b ∨ c) Then the trivial dependency poset would set a ≤ b ≤ c. However, for instance the resolu- tion path dependency poset (arising from the resolution path dependency scheme [32, 26]) contains a single relation b ≤ c (in this case, a is incomparable to both b and c). 2.3 Q-resolution Q-resolution is a sound and complete resolution system for QBF [16]. Our goal here is to formalize the required steps for the Davis Putnam variant of Q-resolution. We begin with a bit of required notation. For a QBF I = (φ, τ) and a variable x ∈ var(φ), let φx be the set of all clauses in φ containing the literal x and similarly let φ¯x be the set of all clauses containing literal ¯x. We denote by res(I, x) the QBF I0 = (φ0, τ0) such that τ0 = τ \ {x} and φ0 = φ \ (φx ∪ φ¯x) ∪ {(D \ {x}) ∪ (C \ {¯x})D ∈ φx; C ∈ φ¯x}; informally, the two clause-sets are pairwise merged to create new clauses which do not contain x. For a QBF I = (φ, τ) and a variable x ∈ var(φ) we denote by I \ x the QBF I = (φ0, τ \ {x}), where we get φ0 from φ by removing all occurrences of x and ¯x. (cid:73) Lemma 2. Let I = (φ, τ) and x ∈ var(φ) be the last variable in τ. If x is existentially quantified, then I is true if and only if res(I, x) is true. Proof. Assume I is true and let F be a winning strategy for existential player in I [16]. We will show that F is also a winning existential strategy in res(I, x). Assume that the existential player played according to F in res(I, x), but there is a clause B that is not satisfied at the end of the game. Clearly B ∈ {(D \ {x}) ∪ (C \ {¯x})D ∈ φx; C ∈ φ¯x}, otherwise B is also a clause of I and hence it has to be satisfied due to the existential player using F. In particular, B = (D \ {x}) ∪ (C \ {¯x}) for some D ∈ φx and C ∈ φ¯x. Now if F assigns x to 1, since F is a winning strategy it follows that C must be satisfied by some other literal, and hence B must also be satisfied -- a contradiction. A symmetric argument also leads to a contradiction if F assigns x to 0. Assume now that res(I, x) is true and let F be a winning strategy for the existential player in res(I, x). Now suppose that after all variables of res(I, x) have been assigned according to the strategy F, there is some D ∈ φx such that D \ {x} is false. Since (D \ {x}) ∪ (C \ {¯x}) is true for all C ∈ φ¯x, it means that all C ∈ φ¯x are true before we Eduard Eiben, Robert Ganian, and Sebastian Ordyniak XX:5 assign x, and our strategy can assign x to 1. On the other hand if D \ {x} is true for all D (cid:74) in φx, our strategy assigns x to 0 and again satisfies all clauses of I. (cid:73) Lemma 3. Let I = (φ, τ) and x ∈ var(φ) be the last variable in τ. If x is universally quantified, then I is true if and only if I \ x is true. Proof. We will prove an equivalent statement: I \ x is false if and only if I is false. It is easy to see that if F is a winning strategy for the universal player in I, then if he plays according F, then when the universal should assign the last variable x there is either a clause that is already false and does not contain x, or a clause that contains x and is false after an assignment of x according to F. In both cases I \ x contains a clause that is false. On the other hand, assume F is a winning strategy for the universal player in I \ x and the universal plays according to F in I until all variables but x are assigned. Clearly, this strategy leads to an assignment of variables such that there is a clause B in I \ x, which is false under this assignment. From the definition of I \ x, it is easy to observe that I contains a clause B0, which is equal to one of the following: B, B ∪ {x}, or B ∪ {¯x}. It is straightforward to extend F in a way that whenever F falsifies a clause B, then the new (cid:74) strategy falsifies the clause B0. 2.4 Treewidth Here we will introduce three standard characterizations of treewidth [18]: tree decomposi- tions, elimination orderings, and cops and robber games. These will play an important role later on, when we define their counterparts in the dependency treewidth setting and use these in our algorithms. following properties hold: (T1)S Tree decomposition: A tree decomposition of a graph G is a pair (T, χ), where T is a rooted tree and χ is a function from V (T) to subsets of V (G), called a bag, such that the t∈V (T ) χ(t) = V (G), (T2) for each uv ∈ E(G) there exists t ∈ V (T) such that u, v ∈ χ(t), and (T3) for every u ∈ V (G), the set Tu = {t ∈ V (T) : u ∈ χ(t)} induces a connected subtree of T. To distinguish between the vertices of the tree T and the vertices of the graph G, we will refer to the vertices of T as nodes. The width of the tree decomposition T is maxt∈T χ(t)−1. The treewidth of G, tw(G), is the minimum width over all tree decompositions of G. For a node t ∈ V (T), we denote by Tt the subtree of T rooted at t. The following fact will be useful later on: (cid:73) Proposition 4. Let T = (T, χ) be a tree decomposition of a graph G and t ∈ V (T) a node with parent p in T. Then χ(p) ∩ χ(t) separates χ(Tt) \ χ(p) from the rest of G. Elimination ordering: An elimination ordering of a graph is a linear order of its vertices. Given an elimination ordering φ of the graph G, the fill-in graph H of G w.r.t. φ is the unique minimal graph such that: V (G) = V (H). E(H) ⊇ E(G). If 0 ≤ k < i < j ≤ n and vi, vj ∈ NH(vk), then vivj ∈ E(H). The width of elimination ordering φ is the maximum number of neighbors of any vertex v that are larger than v (w.r.t. φ) in H. (Monotone) cops and robber game: The cops and robber game is played between two players (the cop-player and the robber-player) on a graph G. A position in the game is a pair (C, R) where C ⊆ V (G) is the position of the cop-player and R is a (possibly empty) XX:6 Small Resolution Proofs for QBF using Dependency Treewidth connected component of G \ C representing the position of the robber-player. A move from position (C, R) to position (C0, R0) is legal if it satisfies the following conditions: CM1 R and R0 are contained in the same component of G \ (C ∩ C0), CM2 δ(R) ⊆ C0. A play P is a sequence (∅, R0), . . . , (Cn, Rn) of positions such that for every i with 1 ≤ i < n it holds that the move from (Ci, Ri) to (Ci+1, Ri+1) is legal; the cop-number of a play is maxi≤n Ci. A play P is won by the cop-player if Rn = ∅, otherwise it is won by the robber-player. The cop-number of a strategy for the cop player is maximum cop-number over all plays that can arise from this strategy. Finally, the cop-number of G is the minimum cop-number of a winning strategy for the cop player. (cid:73) Proposition 5 ([18]). Let G be a graph. The following three claims are equivalent: G has treewidth k, G has an elimination ordering of width k, G has cop-number k. 3 Dependency Treewidth for QBF We are now ready to introduce our parameter. We remark that in the case of dependency treewidth, it is advantageous to start with a counterpart to the elimination ordering char- acterization of classical treewidth, as this is used extensively in our algorithm for solving QBF. We provide other equivalent characterizations of dependency treewidth (representing the counterparts to tree decompositions and cops and robber games) in Section 4; these are not only theoretically interesting, but serve an important role in our algorithms for computing the dependency treewidth. Let I = (φ, τ) be a QBF instance with a dependency poset P. An elimination ordering of GI is compatible with P if it is a linear extension of the reverse of P; intuitively, this corresponds to being forced to eliminate variables that have the most dependencies first. For instance, if P is a trivial dependency poset then a compatible elimination ordering must begin eliminating from the rightmost block of the prefix. We call an elimination ordering of GI that is compatible with P a P-elimination ordering (or dependency elimination ordering). The dependency treewidth w.r.t. P is then the minimum width of a P-elimination ordering. 3.1 Using dependency treewidth Our first task is to show how dependency elimination orderings can be used to solve QBF. (cid:73) Theorem 6. There is an algorithm that given 1. a QBF I with n variables and m clauses, 2. a dependency poset P for I, and 3. a P-elimination ordering π of width k, decides whether I is true in time O(32kkn). Moreover, if I is false, then the algorithm outputs a Q-resolution refutation of size O(3kn). Proof. Let I = (φ, τ) and let x1, . . . , xn denote the variables of φ such that xi ≤π xi+1 for all 1 ≤ i < n. From the definition of the dependency poset and the fact that π is a dependency elimination ordering, it follows that the QBF instance I0 = (φ, τ0), where τ0 is the reverse of π, is true if and only if I is true. Eduard Eiben, Robert Ganian, and Sebastian Ordyniak XX:7 From now on let H be the fill-in graph of the primal graph of I with respect to π, and To solve I we use a modification of the Davis Putnam resolution algorithm [7]. We start with instance I0 and recursively eliminate the last variable in the prefix using Lemmas 2 and 3 until we either run out of variables or we introduce as a resolvent a non-tautological clause that is either empty or contains only universally quantified variables. We show that each variable we eliminate has the property that it only shares clauses with at most k other variables, and in this case we introduce at most 3k clauses of size at most k at each step. let us define Ii = (φi, τ i) for 1 ≤ i ≤ n as follows: 1. I1 = I0, 2. Ii+1 = Ii \ xi if xi is universally quantified, and 3. Ii+1 = res(Ii, xi), if xi is existentially quantified. Note that xi is always the last variable of the prefix of Ii and it follows from Lemmas 2 and 3 that Ii+1 is true if and only if Ii is true. Moreover, In only contains a single variable, and hence can be decided in constant time. In the following, we show by induction that Ii+1 contains at most 3k new clauses, i.e., clauses not contained in Ii. To this end, we show and use the fact that both φi x and φi¯x contain at most 3k clauses, and this is sufficient to ensure a small Q-resolution refutation if the instance is false. (cid:73) Claim 1. The instance Ii+1 contains at most 3k clauses not contained in Ii. Furthermore, if the primal graph of Ii is a subgraph of H, then so is the primal graph of Ii+1. Proof of the Claim. We distinguish two cases: either xi is universal, or existential. In the former case, it is easily observed that the primal graph of Ii \ xi is a subgraph of the primal graph of Ii obtained by removing xi from the graph. Hence, in this case the primal graph of Ii+1 is a subgraph of H as well. Moreover, we do not add any new clauses, only remove xi from already existing ones. In the later case, let xi be an existentially quantified variable. Let xpxq be an edge in the primal graph of res(Ii, xi), but not in the primal graph of Ii. Clearly, xp and xq are in a newly added clause B = (D \ {x}) ∪ (C \ {¯x}) such that D ∈ φi . But that means that both xp and xq are in a clause with xi in Ii. Hence, xpxi and xqxi are both edges in the primal graph of Ii and also in H. But, p > i and q > i, since otherwise xp and xq will not appear in Ii+1. Since H is the fill-in graph w.r.t. π, H contains xpxq as well and H is a supergraph of the primal graph of Ii. Moreover, as π is an elimination ordering of the primal graph of I of width k, there are at most k variables in φi that appear with xi in a clause in Ii. Hence there are at most 3k different clauses containing these variables, and so φi contain at most 3k clauses of size at most k + 1. Finally, the set of new clauses xi } contains at most 3k clauses too, and the claim {(D \ {xi}) ∪ (C \ { ¯xi})D ∈ φi (cid:74) follows. and C ∈ φi¯xi xi , φi¯xi ; C ∈ φi¯xi xi Since I is equivalent to In, it is easy to see that if I is false, then In either contains the empty clause, or two clauses {xn} and { ¯xn}, or xn is universally quantified. In these cases it is easy to see that the union of clauses of all Ii (including the empty clause, if it is not already in In) is a Q-resolution refutation. Moreover, it follows from Claim 1 that this Q-resolution refutation has at most m + 3kn clauses. For the runtime analysis, the time necessary to compute a variable-clause adjacency list data structure (which will be useful for the next step) is upper-bounded by O(mk) due to clauses having size at most k (since the width of the elimination ordering is at most k). If x is universal, then I \ x can be computed in time O(3k), since x occurs in at most 3k clauses. If x is existential, then we need to compute the new clauses which takes time at XX:8 Small Resolution Proofs for QBF using Dependency Treewidth most O(32k · k) since there are at most 32k pairs of clauses containing x and each such clause has size at most k. Finally, observe that the total number of clauses cannot exceed n · k (because the treewidth of the matrix is also bounded by k), and so both O(mk) and m are superseded (cid:74) by the other term in the runtime and the resolution refutation size. 3.2 A Comparison of Decompositional Parameters for QBF As was mentioned in the introduction, two dedicated decompositional parameters have pre- viously been introduced specifically for evaluating quantified Boolean formulas: prefix path- width (and, more generally, prefix treewidth) [12] and respectful treewidth [2]. The first task of this section is to outline the advantages of dependency treewidth compared to these two parameters. Prefix pathwidth is based on bounding the number of viable strategies in the classical two-player game characterization of the QBF problem [12]. As such, it decomposes the dependency structure of a QBF instance beginning from variables that have the least de- pendencies (i.e., may appear earlier in the prefix). On the other hand, our dependency treewidth is based on Q-resolution and thus decomposes the dependency structure begin- ning from variables that have the most dependencies (i.e., may appear last in the prefix). Lemma 7 shows that both approaches are, in principle, incomparable. That being said, dependency treewidth has two critical advantages over prefix treewidth/pathwidth: 1. dependency treewidth outputs small resolution proofs, while it is not at all clear whether the latter can be used to obtain such resolution proofs; 2. dependency treewidth supports a single-exponential fixed-parameter algorithm for QBF (Theorem 6), while the latter uses a prohibitive triple-exponential algorithm [12]. (cid:73) Lemma 7. Let us fix the trivial dependency poset. There exist infinite classes A,B of QBF instances such that: a. A has unbounded dependency treewidth but prefix pathwidth at most 1; b. B has unbounded prefix pathwidth (and prefix treewidth) but dependency treewidth at most 1. Proof. a. Let Ai = ∃x1, . . . , xi∀y∃x(y ∨ x) ∧ i^ (xj ∨ x). j=1 The trivial dependency poset Pi for Ai would be {x1, . . . , xi} ≤ y ≤ x. Hence every Pi- elimination ordering must start with x, and then the width of such an ordering would be i+1. On the other hand, one can observe [12] that the path decomposition Q = (Q1, . . . , Qi+1), where Qj = {xj, x} for 1 ≤ j ≤ i and Qi+1 = {y, x}, is a prefix path-decomposition w.r.t. Pi of width 1. b. Consider the following formula with alternating prefix: Bi = ∃x1∀x2 . . .∀x2i∃x2i+1 ((xj ∨ x2j) ∧ (xj ∨ x2j+1). 2i−1^ j=1 Since the quantifiers in the prefix of Bi alternate, the trivial dependency poset Pi for Bi would be the linear order x1 ≤ x2 ≤ ··· ≤ x2i. It is readily observed that the primal graph of Bi is a balanced binary tree of depth i, and it is known that the pathwidth of such trees is Eduard Eiben, Robert Ganian, and Sebastian Ordyniak XX:9 i−1 [8]. From the fact that pathwidth is a trivial lower bound for prefix pathwidth together with previous work on prefix treewidth [12, Theorem 6], it follows that i−1 is a lower bound on the prefix treewidth of Bi. On the other hand, since Pi is linear order, the only elimination ordering compatible with Pi is the reverse of Pi. Moreover, from the definition of Bi, it is easily seen that xj has at most 1 neighbor that is smaller w.r.t. Pi, namely xbj/2c. Therefore, the dependency (cid:74) treewidth of Bi is 1. Respectful treewidth coincides with dependency treewidth when the trivial dependency scheme is used, i.e., represents a special case of our measure. Unsurprisingly, the use of more advanced dependency schemes (such as the resolution path dependency scheme [32, 28]) allows the successful deployment of dependency treewidth on much more general classes of QBF instances. Furthermore, dependency treewidth with such dependency schemes will always be upper-bounded by respectful treewidth, and so algorithms based on dependency treewidth will outperform the previously introduced respectful treewidth based algorithms. (cid:73) Lemma 8. There exists an infinite class C of QBF instances such that C has unbounded dependency treewidth with respect to the trivial dependency poset but dependency treewidth at most 1 with respect to the resolution-path dependency poset. Proof. Recall the previous example: Ai = ∃x1, . . . , xi∀y∃x(y ∨ x) ∧ i^ (xj ∨ x). j=1 We have already established that Ai has dependency treewidth i + 1 when the trivial dependency poset is used. However, e.g., the resolution-path dependency poset [32, 26]) contains a single relation y ≤ x. Since the primal graph of Ai is a star, it is then easy to verify that Ai has dependency treewidth 1 when the resolution-path dependency poset is (cid:74) used. Finally, we note that the idea of exploiting dependencies among variables has also given rise to similarly flavored structural measures in the areas of first-order model checking (first order treewidth) [1] and quantified constraint satisfaction (CD-width1) [6]. Even though the settings differ, Theorem 5.5 [1] and Theorem 5.1 [6] can both be translated to a basic variant of Theorem 6. We note that this readily-obtained variant of Theorem 6 would not account for dependency schemes. We conclude this subsection with two lemmas which show that there are classes of QBF instances that can be handled by our approach but are not covered by the results of Adler, Weyer [1] and Chen, Dalmau [6]. Before we compare the dependency treewidth with the CD-width of Chen and Dalmau, we will first define their parameter (or, more specifically, provide a translation into the QBF setting). CD-width is also based on an elimination ordering, however with a slight modifi- cation: they also use the fact that we can eliminate universal variables without introducing new clauses (see Lemma 3) and therefore we can eliminate the last universal variable even if it appears together with many variables. Formally the elimination ordering by Chen and Dalmau is defined as follows: 1 We remark that in their paper, the authors refer to their parameter simply as "the width". For disambiguation, here we call it CD-width (shorthand for Chen-Dalmau's width). XX:10 Small Resolution Proofs for QBF using Dependency Treewidth (cid:73) Definition 9. Let I = (φ, τ) be a QBF instance. Given a linear ordering (cid:22) of var(φ), the CD-fill-in graph H(cid:22) of I is the unique minimal graph such that: V (GI) = V (H(cid:22)). E(H(cid:22)) ⊇ E(GI). If u (cid:22) v (cid:22) w, u is existentially quantified, and v, w ∈ NH(cid:22)(u), then vw ∈ E(H(cid:22)). A CD-elimination ordering of a QBF instance I = (φ, τ) is a linear order (cid:22) of var(φ) such that for each existentially quantified x and each universally quantified y in var(φ): If y is before x in τ, then x (cid:22) y. If x is before y in τ and there is an edge xy in H(cid:22), then y (cid:22) x. The width of a CD-elimination ordering (cid:22) is the maximum number of neighbors of an existentially quantified vertex v that are larger than v (w.r.t. (cid:22)) in H(cid:22). We remark that one could also use the less restrictive form of elimination orderings con- sidered above with any dependency poset, obtaining a more general variant of Theorem 6. However, such a notion would lose many of the nice structural properties used in our algo- rithms for finding the decompositions; for instance, the result is no longer a restriction of treewidth and does not have any immediate cops-and-robber game characterization. Hence finding such an ordering of small width would become a more challenging problem. (cid:73) Lemma 10. There exist infinite classes D, E of QBF instances such that: a. D has unbounded CD-width but dependency treewidth at most 1 w.r.t. the resolution-path b. E has unbounded dependency treewidth w.r.t. any dependency poset but CD-width at dependency poset. most 1. Proof. a. Recall the previous example: Ai = ∃x1, . . . , xi∀y∃x(y ∨ x) ∧ i^ (xj ∨ x). j=1 We have already established that Ai has dependency treewidth 1 when the resolution-path dependency poset is used. To establish the other directions it suffices to observe that Ex- ample 3.6 of Chen and Dalmau [6] uses the class of prefixed graphs obtained from A by taking primal graph of instances Ai and keeping the same prefix as an example of class with unbounded elimination width. b. Let Ei = ∀x1∀x2 ···∀xi (xp ∨ xq). ^ 1≤p<q≤i As Ei does not contain any existentially quantified variable, it is easy to observe that CD- width of Ei is 0. However, the primal graph of Ei is a clique and hence dependency treewidth is i − 1 w.r.t. every possible dependency poset. (cid:74) Similarly as above, before we compare first order treewidth to dependency treewidth, we give some necessary definitions. Let (cid:67) be a binary relation on the variables of some QBF instance I = (φ, τ). Then two variables x and y are entangled with respect to (cid:67) and I, if x occurs in a clause with some variable z such that y (cid:67) z and y occurs in a clause with some variable z such that x (cid:67) z. (cid:73) Definition 11. Let I = (φ, τ) be a QBF instance. Then (cid:22)FO to ⊆) binary relation on var(φ), such that the following holds: is the minimal (with respect I Eduard Eiben, Robert Ganian, and Sebastian Ordyniak XX:11 I I is reflexive. is transitive. (1) (cid:22)FO (2) (cid:22)FO (3) If x is before y in τ, x and y have different quantifiers in τ, and there is a sequence x = z0, . . . , zn = y of variables such that for all 0 ≤ i < n we have that zi and zi+1 are entangled w.r.t. (cid:22)I and I and that x (cid:22)I zi or y (cid:22)FO zi, then x (cid:22)FO y. I I (cid:73) Definition 12. Let I = (φ, τ) be a QBF instance and x ∈ var(φ). The essential alternation depth of x in I, denoted by eadI(x), is the maximum over all (cid:22)FO -paths P ending in x of the number of quantifier changes in P, adding +1 in case the first variable on P is existentially quantified and +2 if it is universally quantified. For a QBF instance I = (φ, τ), let VFO and only if eadI(x) ≤ eadI(y). Notice that x (cid:22)FO VFO ordering that is compatible with VFO ead) be the poset such that x ≤I ead y if y implies eadI(x) ≤ eadI(y) and hence . The first order treewidth is the minimal width of an elimination is an extension of (cid:22)FO I = (var(φ),≤I . I I I I Now we are ready to prove the following lemma. I (cid:73) Lemma 13. There exists an infinite class F of QBF instances such that F has unbounded first order treewidth but dependency treewidth at most 2 with respect to the resolution-path dependency poset. Proof. Let Fi = ∀x2iy2i∃x2i−1y2i−1 ···∀x2y2∃x1y1∀z (z ∨ x1 ∨ y1) 2i−1^ [(xj ∨ xj+1) ∧ (yj ∨ yj+1)] ∧ i^ j=1 j=1 (x2j−1 ∨ y1). The resolution-path dependency poset would give us following relations: a chain y2i ≤ ··· ≤ y2 ≤ y1 ≤ z and a chain x2i ≤ ··· ≤ x2 ≤ x1 ≤ z. It is readily observed that the elimination ordering zx1x2 . . . x2iy1y2 . . . y2i with width 2 is compatible with this dependency poset. On the other hand, one can observe that x2j (cid:22)FO entangled w.r.t. (cid:22)FO and hence also x2j (cid:22)FO elimination ordering that is compatible with VFO and the width of such elimination ordering is at least i − 1. Finally, we remark that if one were to show that VFO Fi Fi Fi x2j−1 and that y1 and x2j−1 are y1 for all 1 ≤ j ≤ i. It follows that any I must have y1 before all xj for 2 ≤ j ≤ 2i (cid:74) is a dependency poset, then this would imply that first order treewidth is a special case of dependency treewidth (for this dependency poset). However, proving such a claim goes beyond the scope of this paper. I 4 Dependency Treewidth: Characterizations In this section we obtain other equivalent characterizations of dependency treewidth. The purpose of this endeavor is twofold. From a theoretical standpoint, having several natural characterizations (corresponding to the characterizations of treewidth) is not only interesting but also, in some sense, highlights the solid foundations of a structural parameter. From a practical standpoint, the presented characterizations play an important role in Section 5, which is devoted to algorithms for finding optimal dependency elimination orderings. Dependency tree decomposition: Let I be a QBF instance with primal graph G and dependency poset P and let (T, χ) be a tree decomposition of G. Note that the rooted tree XX:12 Small Resolution Proofs for QBF using Dependency Treewidth T naturally induces a partial order ≤T on its nodes, where the smallest element is the root and leaves form maximal elements. For a vertex v ∈ V (G), we denote by Fv(T) the unique ≤T -minimal node t of T with v ∈ χ(t), which is well-defined because of Properties (T1) and (T3) of a tree decomposition. Let <T be the partial ordering of V (G) such that u <T v if and only if Fu(T) <T Fv(T) for every u, v ∈ V (G). We say that (T, χ) is a dependency tree decomposition if it satisfies the following additional property: (T4) <T is compatible with ≤P, i.e., for every two vertices u and v of G it holds that whenever Fu(T) <T Fv(T) then it does not hold that v ≤P u. (cid:73) Lemma 14. A graph G has a P-elimination ordering of width at most ω if and only if G has a dependency tree decomposition of width at most ω. Moreover, a P-elimination ordering of width ω can be obtained from a dependency tree decomposition of width ω in polynomial-time and vice versa. Proof. For the forward direction we will employ the construction given by Kloks in [18], which shows that a normal elimination ordering can be transformed into a tree decomposition of the same width. We will then show that this construction also retains the compatibility with P. Let ≤φ= (v1, . . . , vn) be a dependency elimination ordering for G of width ω and let H be the fill-in graph of G w.r.t. ≤φ. We will iteratively construct a sequence (T0, . . . ,Tn−1) such that for every i with 0 ≤ i < n, Ti = (Ti, χi) is dependency tree decompositions of the graph Hi = H[{vn−i, . . . , vn}] of width at most ω. Because Tn−1 is a dependency tree decomposition of Hn−1 = H of width at most ω, this shows the forward direction of the lemma. In the beginning we set T0 to be the trivial tree decomposition of H0, which contains merely one node whose bag consists of the vertex vn. Moreover, for every i with 0 < i < n, Ti is obtained from Ti−1 as follows. Note that because NHi(vn−i) induces a clique in Hi−1, Ti−1 contains a node that covers all vertices in NHi(vn−i). Let t be any such bag, then is Ti is obtained from Ti−1 by adding a new node t0 to Ti−1 making it adjacent to t and setting χi(t0) = NHi[vn−i]. It is known [18] that Ti satisfies the Properties (T1) -- (T3) of a tree decomposition and it hence only remains to show that Ti satisfies (T4). Since, by induction hypothesis, Ti−1 is a dependency tree decomposition, Property (T4) already holds for every pair u, v ∈ V (Hi−1). Hence it only remains to consider pairs u and vn−i for some u ∈ V (Hi−1). Because the only node containing vn−i in Ti is a leaf, we can assume that Fu(T) <T Fvn−i(T) and because vn−i ≤φ u it cannot hold that vn−i ≤P u, as required. For the reverse direction, let T = (T, χ) be a P-tree decomposition of G of width at most ω. It is known [18] that any linear extension of <T is an elimination ordering for G of width at most ω. Moreover, because of Property (T4), <T is compatible with ≤P and hence there is a linear extension of <T , which is also a linear extension of the reverse of ≤P. (cid:74) Dependency cops and robber game: Recalling the definition of the (monotone) cops and robber game for treewidth, we define the dependency cops and robber game (for a QBF instance I with dependency poset P) analogously but with the additional restriction that legal moves must also satisfy a third condition: CM3 C0 \ C is downward-closed in R, i.e., there is no r ∈ R \ C0 with r ≤P c for any c ∈ C0 \ C. Intuitively, condition CM3 restricts the cop-player by forcing him to search vertices (vari- ables) in an order that is compatible with the dependency poset. To formally prove the equivalence between the cop-number for this restricted game and dependency treewidth, we will need to also formalize the notion of a strategy. Here we will represent strategies for the cop-player as rooted trees whose nodes are labeled with Eduard Eiben, Robert Ganian, and Sebastian Ordyniak XX:13 positions for the cop-player and whose edges are labeled with positions for the robber- player. Namely, we will represent winning strategies for the cop-player on a primal graph G by a triple (T, α, β), where T is a rooted tree, α : V (T) → 2V (G) is a mapping from the nodes of T to subsets of V (G), and β : E(T) → 2V (G), satisfying the following conditions: CS1 α(r) = ∅ and for every component R of G, the root node r of T has a unique child c with β({r, c}) = R, and CS2 for every other node t of T with parent p it holds that: the move from position (α(p), β({p, t})) to position (α(t), β({t, c})) is legal for every child c of t and moreover for every component R of G \ α(t) contained in β({p, t}), t has a unique child c with β({t, c}) = R. Informally, the above properties ensure that every play consistent with the strategy is win- ning for the cop-player and moreover for every counter-move of the robber-player, the strategy gives a move for the cop-player. The width of a winning strategy for the cop- player is the maximum number of cops simultaneously placed on G by the cop-player, i.e., maxt∈V (T ) α(t). The cop-number of a graph G is the minimum width of any winning strat- egy for the cop-player on G. We are now ready to show the equivalence between dependency tree decompositions and winning strategies for the cop-player. (cid:73) Lemma 15. For every graph G the width of an optimal dependency tree decomposition plus one is equal to the cop-number of the graph. Moreover, a dependency tree decomposition of width ω can be obtained from a winning strategy for the cop-player of width ω + 1 in polynomial-time and vice versa. Proof. Let T = (T, χ) be a dependency tree decomposition of G of width ω. We start by showing that T can be transformed into a dependency tree decomposition of width ω satisfying: (*) χ(r) = ∅ for the root node r of T and for every node t ∈ V (T) with child c ∈ V (T) in To ensure that T satisfies χ(r) = ∅ it is sufficient to add a new root vertex r0 to T and set χ(r0) = ∅. We show next that starting from the root of T we can ensure that for every node t ∈ V (T) with child c the set χ(Tc) \ χ(t) is a component of G \ χ(t). Let t be a node with child c in T for which this does not hold. Because of Proposition 4, we have that χ(Tc) \ χ(t) is a set of components, say containing C1, . . . , Cl, of G \ χ(t). For every i with 1 ≤ i ≤ l, let Ti = (Ti, χi) be the dependency tree decomposition with Ti = Tc and χi(t0) = χ(t0) ∩ (Ci ∪ χ(t)) and root ri = c. Then we replace the entire sub dependency tree decomposition of T induced by Tc in T with the tree decompositions T1, . . . ,Tl such that t now becomes adjacent to the roots r1, . . . , rl. It is straightforward to show that the result of this operation is again a dependency tree decomposition of G of width at most ω and moreover the node t has one child less that violates (*). By iteratively applying this operation to every node t of T we eventually obtain a dependency tree decomposition that satisfies (*). Hence w.l.o.g. we can assume that T satisfies (*). We now claim that (T, α, β) where: α(t) = χ(t) for every t ∈ V (T), for a node t ∈ V (T) with parent p ∈ V (T), β({p, t}) = χ(Tt) \ χ(p). T the set χ(Tc) \ χ(t) is a component of G \ χ(t). is a winning strategy for ω + 1 cops. Observe that because T satisfies (*), it holds that α(r) = ∅ and for every t ∈ V (T) with parent p ∈ V (T), the pair (α(p), β({p, t}) is a position in the visible P-cops and robber game on G. We show next that for every t, p as above and every child c of t in T, it holds that the move from (α(p), β({p, t}) to (α(t), β({t, c}) is valid. Because β({t, c}) = χ(Tc) \ χ(t) ⊆ χ(Tt) \ XX:14 Small Resolution Proofs for QBF using Dependency Treewidth χ(p) = β({p, t}) and β({p, t}) is connected in G\α(p) (and hence also in G\(α(p)∩α(t))), it follows that β({p, t}) and β({t, c}) are contained in the same component of G\(α(p)∩ α(t)), which shows CM1. Because of Proposition 4, it holds that α(p)∩α(t) and hence in particular α(t) separates β({p, t}) from the rest of the graph, which shows CM2, i.e, δ(β({p, t})) ⊆ α(t). Towards showing CM3 suppose for a contradiction that there is a r ∈ β({p, t}) \ α(t) with r ≤P c for some c ∈ α(t) \ α(p). Because r ∈ β({p, t}) \ α(t) and c ∈ α(t), we obtain that c <T r and because of (T4) it follows that r ≤P c does not hold. Note that CS1 and the second part of CS2, i.e., for every node t with parent p and every component R of G \ α(t), t has a unique child c with β({t, c}) = R, both hold because T satisfies T1 and T3 (T3 is only needed to show that the child is unique). On the other hand, let S = (T, α, β) be a winning strategy for the cop-player in the visible P-cops and robber game on G using ω cops. Observe that S can be transformed into a winning strategy for the cop-player using ω cops satisfying: (a) for every node t of T with parent p it holds that α(t) ⊆ δ(β({p, t})) ∪ β({p, t}). Indeed; if (a) is violated, then one can simply change α(t) to α(t)∩ (δ(β({p, t}))∪ β({p, t})) without violating any of CS1 or CS2. Hence we can assume that S satisfies (a). We now claim that T = (T, α) is a dependency tree decomposition of G of width ω − 1. Towards showing T1, let v ∈ V (G). Because of CS1, it holds that either v ∈ α(r) for the root r of T or there is a child c of r in T with v ∈ β({r, c}). Moreover, due to CS2 we have that either v ∈ α(c) or v ∈ β({c, c0}) for some child c0 of c in T. By proceeding along T, we will eventually find a node t ∈ V (T) with v ∈ α(t). Towards showing T2, let {u, v} ∈ E(G). Again because of CS1, it holds that either {u, v} ⊆ α(r), or {u, v} ⊆ δ(β({r, c})) ∪ β({r, c}) for some child c of r in T. Because of CM2, we obtain that δ(β({r, c})) ⊆ α(c) and together with CS2, we have that either {u, v} ⊆ α(c) or {u, v} ⊆ δ(β({c, c0})) ∪ β({c, c0}) for some child c0 of c in T. By proceeding along T, we will eventually find a node t ∈ V (T) with {u, v} ∈ α(t). Next, we prove that T3 holds by showing that for any three nodes t1, t2, and t3 in T such that t2 lies on the unique path from t1 to t3 in T, it holds that α(t1) ∩ α(t2) ⊆ α(t3). We will distinguish two cases: (1) t1 is not an ancestor of t3 and vice versa, and (2) t1 and t2 lie on the unique path from the root of T to t3. (b) for every node t with child c in T it holds thatS Before proceeding, we need to establish that S satisfies the following property: t0∈V (Tc) α(t0) ⊆ δ(β({t, c}) ∪ β({t, c}). Because of CM2 we have that β({t, c}) ⊆ β({p, t}) for every three nodes p, t, and c such that p is the parent of t which in turn is the parent of c in T. Moreover, because of (a) we have that α(t) ⊆ δ(β({p, t}))∪ β({p, t}) for every node t with parent p in T. Applying these two facts iteratively along a path from t to any of its descendants t0 in T, we obtain that α(t0) ⊆ δ(β({p, t})) ∪ β({p, t}), as required. Towards showing case (1) assume that this is not the case, i.e., there are t1, t2, and t3 as above and a vertex v ∈ α(t1) ∩ α(t3) but v /∈ α(t2). W.l.o.g. we can assume that t2 is the least common ancestor of t1 and t2 in T, otherwise we end up in case (2). Let c1 and c2 be the two children of t2 such that t1 ∈ V (Tc1) and t2 ∈ V (Tc2). Then because v ∈ α(ti) we obtain from (b) that v ∈ δ(β({t2, ci})) ∪ β({t2, ci})) for any i ∈ {1, 2}. Because the sets β({t2, c1}) and β({t2, c2}) are disjoint, it follows that v ∈ δ(β({t2, ci})) and thus v ∈ α(t2) contradicting our assumption that this is not the case. Towards showing case (2) assume that this is not the case, i.e., there are t1, t2, and t3 as above and a vertex v ∈ α(t1)∩ α(t3) but v /∈ α(t2). W.l.o.g. we can assume that t2 is a child of t1 in T. Because v ∈ α(t3) we obtain from (b) that α(t3) ⊆ δ(β({t1, t2}) ∪ β({t1, t2}). Hence either v ∈ δ(β({t1, t2})) or v ∈ β({t1, t2}). In the former case it follows from CM2 that v ∈ α(t2) a contradiction to our assumption that v /∈ α(t2) and in the later case, we obtain that v /∈ α(t1) a contradiction to our assumption that v ∈ α(t1). Eduard Eiben, Robert Ganian, and Sebastian Ordyniak XX:15 S i.e., there are u, v ∈ V (G) Towards showing T4 assume that this is not the case, with u <T v but v ≤P u. Let p be the parent of Fu(T) in T. Then because u, v ∈ t0∈V (TFu(T ))) α(t0) and (b), we obtain that u, v ∈ δ(β({p, Fu(T)})) ∪ β({p, Fu(T)}). More- over since neither u or v are in α(p), we have that u, v ∈ β({p, Fu(T)}). Finally because u ∈ α(Fu(T)) but not v ∈ α(Fu(T)), we obtain from CM3 that u ≤P v contradicting our assumption that v ≤P u. (cid:74) 5 Computing Dependency Treewidth In this section we will present two exact algorithms to compute dependency treewidth. The first algorithm is based on the characterization of dependency treewidth in terms of the cops and robber game and shows that, for every fixed ω, determining whether a graph has dependency treewidth at most ω, and in the positive case also computing a dependency tree decomposition of width at most ω, can be achieved in polynomial time. The second algorithm is based on a chain partition of the given dependency poset and shows that if the width of the poset is constant, then an optimal dependency tree decomposition can be constructed in polynomial time. Before proceeding to the algorithms, we would like to mention here that the fixed- parameter algorithm for computing first order treewidth [1] can also be used for computing dependency treewidth in the restricted case that the trivial dependency poset is used. Below we provide our first algorithm for the computation of dependency treewidth. (cid:73) Theorem 16. There is an algorithm running in time O(V (G)2ω+2) that, given a graph G and a poset P = (V (G),≤P) and ω ∈ N, determines whether ω cops have a winning strategy in the dependency cops and robber game on G and P, and if so outputs such a winning strategy. Proof. The idea is to transform the cops and robber game on G into a much simpler two player game, the so-called simple two player game, which is played on all possible positions of the cops and robber game on G. A simple two player game is played between two players, which in association to the cops and robber game, we will just call the cops and the robber player [15]. Both players play by moving a token around on a so-called arena, which is a triple A = (VC, VR, A) such that ((VC ∪ VR), A) is a bipartite directed graph with bipartition (VC, VR). The vertices in VC are said to belong to the cop-player and the vertices in VR are said to belong to the robber-player. Initially, one token is placed on a distinguished starting vertex s ∈ VC ∪ VR. From then onward the player who owns the vertex, say v, that currently contains the token, has to move the token to an arbitrary successor (i.e., out-neighbor) of v in A. The cop- player wins if the robber-player gets stuck, i.e., the token ends up in a vertex owned by the robber-player that has no successors in A, otherwise the robber-player wins. It is well-known that strategies in this game are deterministic and memoryless, i.e., strategies for a player are simple functions that assign every node owned by the player one of its successors. Moreover, the winning region for both players as well as their corresponding winning strategy can be computed in time O(VC ∪ VR + A) by the following algorithm. The algorithm first computes the winning region WC, as follows. Initially all vertices owned by the robber-player which do not have any successors in A are placed in WC. The algorithm then iteratively adds the following vertices to WC: all vertices owned by the cop-player that have at least one successor WC, all vertices owned by the robber-player for which all successors are in WC. XX:16 Small Resolution Proofs for QBF using Dependency Treewidth Once the above process stops, the set WC is the winning region of the cop-player in A and (VC ∪ VR)\ WC is the winning region for the robber-player. Moreover, the winning strategy for both players can now be obtained by choosing for every vertex a successors that is in the winning region of the player owning that vertex (if no such vertex exists, then an arbitrary successor must be chosen). Given a graph G, a poset P = (V (G),≤P), and an integer ω, we construct an arena A = (VC, VR, A) and a starting vertex s ∈ VR such that ω cops have a winning strategy in the P-cops and robber game on G iff the cop-player wins from s in the simple two player game on A as follows: We set VC to be the set of all pairs (C, R) such that (C, R) is a position in the P-cops and robber game on G using at most ω cops (C ≤ ω), We set VR to be the set of all triples (C, C0, R) such that: (C, R) is a position in the P-cops and robber game on G using at most ω cops (C ≤ ω), and C0 ⊆ V (G) is a potential new cop-position for at most ω cops from (C0, R0), i.e., δ(R) ⊆ C0 and C, R, and C0 satisfy CM3. From every vertex (C, R) ∈ VC we add an arc to all vertices (C, C0, R) ∈ VR. From every vertex (C, C0, R) ∈ VR we add an arc to all vertices (C0, R0) ∈ VC such that the move from (C, R) to (C0, R0) is legal. Additionally VR contains the starting vertex s that has an outgoing arc to every vertex (∅, R) ∈ VC such that R is a component of G. By construction VC ≤ V (G)ω+1 and VR ≤ V (G)2ω+1. Moreover, because every vertex in VC has at most V (G)ω successors and every vertex in VR has at most V (G) successors, we obtain that A ≤ V (G)2ω+2. Let us now analyze the running time required to construct A. We can construct all vertices (C, R) ∈ VC in time O(V (G)ωE(G)) by computing the set of all components of G \ C for every cop-position C. Note that within the same time we can additionally compute and store the guards δ(R) for every component R. For each vertex in (C, R) ∈ VC we can then compute the associated vertices (C, C0, R) ∈ VR and add the necessary arcs by enumerating all sets C0 ⊆ V (G) with δ(R) ⊆ C0 and checking for each of those whether R and C0 satisfy CM3. Enumerating the sets C0 ⊆ V (G) with δ(R) ⊆ C0 can be achieved in time O(V (G)ω) (using the fact that we stored δ(R) for every component R). Moreover, determining whether R and C0 satisfy CM3 can be achieved in time O(ωR) = O(ωV (G)) by going over all vertices r ∈ R and verifying that r ∈ C0 or that it is not smaller than any vertex in C0. Hence computing all vertices of A and all arcs from vertices in VC to vertices in VR can be achieved in time at most O(V (G)ωE(G) + V (G)2ω+1ω), which for the natural assumption that ω > 0 is at most O(V (G)2ω+2). Finally, we need to add the arcs between vertices in (C, C0, R) ∈ VR and the vertices (C0, R0) ∈ VC. Note that there is an arc from (C, C0, R) ∈ VR to (C0, R0) ∈ VC if and only if R0 ⊆ R and moreover for every component R0 of G\ C0 either it is a subset of R or it is disjoint with R, which can be checked in constant time. Hence the total time required for this last step is equal to the number of vertices in VR times V (G) which is at most O(V (G)2ω+2). It follows that the time required to construct A is at most O(V (G)2ω+2). Once the arena is constructed the winning regions as well as the winning strategies for both players can be computed in time O(VC ∪ VR + A) ∈ O(V (G)2ω+2). (cid:74) The next theorem summarizes our second algorithm for computing dependency treewidth. The core distinction here lies in the fact that the running time does not depend on the de- pendency treewidth, but rather on the poset-width. This means that the algorithm can Eduard Eiben, Robert Ganian, and Sebastian Ordyniak XX:17 precisely compute the dependency treewidth even when this is large, and it will perform better than Theorem 16 for formulas with "tighter" dependency structures (e.g., formulas which utilize the full power of quantifier alternations). (cid:73) Theorem 17. There is an algorithm running in time O((V (G)kk2) that, given a graph G and a poset P = (V (G),≤P) of width k and ω ∈ N, determines whether G and P admit a dependency elimination ordering of width at most ω, and if yes outputs such a dependency elimination ordering. Proof. To decide whether G has a dependency elimination ordering of width at most ω, we first build an auxiliary directed graph H as follows. The vertex set of H consists of all pairs (D, d) such D ⊆ V (G) is a downward closed set and d ∈ D is a maximal element of D such that NG[D\d](d) ≤ ω. Additionally, H contains the vertices (V (G),∅) and (∅,∅). Furthermore, there is an arc from (D, d) to (D0, d0) of H if and only if D0 = D ∪ {d0} or D = D0 = V (G) and d0 = ∅. This completes the construction of H. It is immediate that G has a dependency elimination ordering of width at most ω if and only if there is a directed path in H from (∅,∅) to (V (G),∅). Hence, given H we can decide whether G has a dependency elimination ordering of width at most ω (and output it, if it exists) in time O(V (H) log(V (H)) + E(H)) (e.g., by using Dijkstra's algorithm). It remains to analyze the time required to construct H (as well as its size). Let k be the width of the poset P. Due to Proposition 1, we can compute a chain partition C = (W1, . . . , Wk) of width k in time O(k · V (G)2). Note that every downward closed D set can be characterized by the position of the maximal element in D on each of the chains W1, . . . , Wk, we obtain that there are at most V (G)k downward closed sets. Hence, H has at most O(V (G)k(k + 1)) vertices its vertex set can be constructed in time O(V (G)k(k + 1)). Since every vertex (D, d) of H has at most k + 1 possible out-neighbors, we can construct the arc set of H in time O(V (G)kk2). Hence, the total time required to construct H is O((V (G)kk2) which dominates the (cid:74) time required to find a shortest path in H, and so the runtime follows. Concluding Notes 6 Dependency treewidth is a promising decompositional parameter for QBF which overcomes the key shortcomings of previously introduced structural parameters; its advantages include a single-exponential running time, a refined and flexible approach to variable dependencies, and the ability to compute decompositions. It also admits several natural characterizations that show the robustness of the parameter and allows the computation of resolution proofs. The presented algorithms for computing dependency elimination orderings leave open the question of whether this problem admits a fixed-parameter algorithm (parameterized by dependency treewidth). We note that the two standard approaches for computing treewidth fail here. In particular, the well-quasi-ordering approach with respect to minors does not work since the set of ordered graphs can be observed not to be well-quasi ordered w.r.t. the ordered minor relation [29]. On the other hand, the records used in the second approach [4] do not provide sufficient information in our ordered setting. 6.0.0.1 Acknowledgments The authors wish to thank the anonymous reviewers for their helpful comments. Eduard Eiben acknowledges support by the Austrian Science Fund (FWF, projects P26696 and W1255-N23). Robert Ganian is also affiliated with FI MU, Brno, Czech Republic. 3 Armin Biere and Florian Lonsing. Integrating dependency schemes in search-based QBF solvers. In Theory and Applications of Satisfiability Testing - SAT 2010, volume 6175 of LNCS, pages 158 -- 171. Springer, 2010. 4 Hans L. Bodlaender. A linear time algorithm for finding tree-decompositions of small In Proceedings of the Twenty-Fifth Annual ACM Symposium on Theory of treewidth. Computing, May 16-18, 1993, San Diego, CA, USA, pages 226 -- 234, 1993. Florent Capelli. Structural restrictions of CNF-formulas: applications to model counting and knowledge compilation. PhD thesis, Université Paris Diderot, 2016. 6 Hubie Chen and Víctor Dalmau. Decomposing quantified conjunctive (or disjunctive) for- 5 mulas. SIAM J. Comput., 45(6):2066 -- 2086, 2016. 7 M. Davis and H. Putnam. A computing procedure for quantification theory. J. of the ACM, 8 Reinhard Diestel. Graph minors 1: A short proof of the path-width theorem. Combina- torics, Probability & Computing, 4:27 -- 30, 1995. 9 Reinhard Diestel. Graph Theory, 4th Edition, volume 173 of Graduate texts in mathematics. 7(3):201 -- 215, 1960. Springer, 2012. XX:18 Small Resolution Proofs for QBF using Dependency Treewidth 1 References Isolde Adler and Mark Weyer. Tree-width for first order formulae. Logical Methods in Computer Science, 8(1), 2012. 2 Albert Atserias and Sergi Oliva. Bounded-width QBF is pspace-complete. J. Comput. Syst. Sci., 80(7):1415 -- 1429, 2014. 10 Rodney G. Downey and Michael R. Fellows. Fundamentals of Parameterized Complexity. Texts in Computer Science. Springer Verlag, 2013. 12 13 11 Uwe Egly, Thomas Eiter, Hans Tompits, and Stefan Woltran. Solving advanced reasoning tasks using quantified boolean formulas. In Proceedings of the Seventeenth National Con- ference on Artificial Intelligence and Twelfth Conference on on Innovative Applications of Artificial Intelligence, July 30 - August 3, 2000, Austin, Texas, USA., pages 417 -- 422, 2000. Eduard Eiben, Robert Ganian, and Sebastian Ordyniak. Using decomposition-parameters for QBF: mind the prefix! In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, February 12-17, 2016, Phoenix, Arizona, USA., pages 964 -- 970, 2016. S. Felsner, V. Raghavan, and J. Spinrad. Recognition algorithms for orders of small width and graphs of small dilworth number. Order, 20(4):351 -- 364, 2003. Jörg Flum and Martin Grohe. Parameterized Complexity Theory, volume XIV of Texts in Theoretical Computer Science. An EATCS Series. Springer Verlag, Berlin, 2006. Erich Grädel, Wolfgang Thomas, and Thomas Wilke, editors. Automata, Logics, and In- finite Games: A Guide to Current Research [outcome of a Dagstuhl seminar, February 2001], volume 2500 of Lecture Notes in Computer Science. Springer, 2002. 16 Hans Kleine Büning and Uwe Bubeck. Theory of quantified boolean formulas. In A. Biere, M. J. H. Heule, H. van Maaren, and T. Walsh, editors, Handbook of Satisfiability, volume 185 of Frontiers in Artificial Intelligence and Applications, chapter 23, pages 735 -- 760. IOS Press, 2009. 17 Hans Kleine Büning and Theodor Lettman. Propositional logic: deduction and algorithms. 15 14 Cambridge University Press, Cambridge, 1999. 18 T. Kloks. Treewidth: Computations and Approximations. Springer Verlag, Berlin, 1994. 19 Charles Otwell, Anja Remshagen, and Klaus Truemper. An effective QBF solver for plan- ning problems. In Proceedings of the International Conference on Modeling, Simulation & Visualization Methods, MSV '04 & Proceedings of the International Conference on Al- gorithmic Mathematics & Computer Science, AMCS '04, June 21-24, 2004, Las Vegas, Nevada, USA, pages 311 -- 316. CSREA Press, 2004. 20 Christos H. Papadimitriou. Computational Complexity. Addison-Wesley, 1994. Eduard Eiben, Robert Ganian, and Sebastian Ordyniak XX:19 21 22 23 Luca Pulina and Armando Tacchella. A structural approach to reasoning with quantified boolean formulas. In Craig Boutilier, editor, IJCAI 2009, Proceedings of the 21st Interna- tional Joint Conference on Artificial Intelligence, Pasadena, California, USA, July 11-17, 2009, pages 596 -- 602, 2009. Luca Pulina and Armando Tacchella. An empirical study of QBF encodings: from treewidth estimation to useful preprocessing. Fundam. Inform., 102(3-4):391 -- 427, 2010. J. Rintanen. Constructing conditional plans by a theorem-prover. J. Artif. Intell. Res., 10:323 -- 352, 1999. 24 Ashish Sabharwal, Carlos Ansótegui, Carla P. Gomes, Justin W. Hart, and Bart Selman. QBF modeling: Exploiting player symmetry for simplicity and efficiency. In Theory and Applications of Satisfiability Testing - SAT 2006, 9th International Conference, Seattle, WA, USA, August 12-15, 2006, Proceedings, pages 382 -- 395, 2006. 25 Marko Samer and Stefan Szeider. Backdoor sets of quantified Boolean formulas. Journal of Autom. Reasoning, 42(1):77 -- 97, 2009. Friedrich Slivovsky and Stefan Szeider. Computing resolution-path dependencies in linear time. In Alessandro Cimatti and Roberto Sebastiani, editors, Theory and Applications of Satisfiability Testing - SAT 2012, volume 7317 of Lecture Notes in Computer Science, pages 58 -- 71. Springer Verlag, 2012. Friedrich Slivovsky and Stefan Szeider. Variable dependencies and q-resolution. In Theory and Applications of Satisfiability Testing - SAT 2014 - 17th International Conference, Held as Part of the Vienna Summer of Logic, VSL 2014, Vienna, Austria, July 14-17, 2014. Proceedings, volume 8561 of Lecture Notes in Computer Science, pages 269 -- 284. Springer, 2014. Friedrich Slivovsky and Stefan Szeider. Quantifier reordering for QBF. J. Autom. Reason- ing, 56(4):459 -- 477, 2016. 26 27 28 30 31 29 Daniel A Spielman and Miklós Bóna. An infinite antichain of permutations. Electron. J. Combin, 7:N2, 2000. L. J. Stockmeyer and A. R. Meyer. Word problems requiring exponential time. In Pro- ceedings of the 5th Annual ACM Symposium on Theory of Computing, April 30 - May 2, 1973, Austin, Texas, USA, pages 1 -- 9. ACM, 1973. Stefan Szeider. On fixed-parameter tractable parameterizations of SAT. In Enrico Giunchiglia and Armando Tacchella, editors, Theory and Applications of Satisfiability, 6th International Conference, SAT 2003, Selected and Revised Papers, volume 2919 of Lecture Notes in Computer Science, pages 188 -- 202. Springer Verlag, 2004. 32 Allen Van Gelder. Variable independence and resolution paths for quantified boolean for- mulas. In Jimmy Lee, editor, Principles and Practice of Constraint Programming - CP 2011, volume 6876 of Lecture Notes in Computer Science, pages 789 -- 803. Springer Verlag, 2011.
1811.00710
1
1811
2018-11-02T02:24:40
On subexponential running times for approximating directed Steiner tree and related problems
[ "cs.DS" ]
This paper concerns proving almost tight (super-polynomial) running times, for achieving desired approximation ratios for various problems. To illustrate, the question we study, let us consider the Set-Cover problem with n elements and m sets. Now we specify our goal to approximate Set-Cover to a factor of (1-d)ln n, for a given parameter 0<d<1. What is the best possible running time for achieving such approximation? This question was answered implicitly in the work of Moshkovitz [Theory of Computing, 2015]: Assuming both the Projection Games Conjecture (PGC) and the Exponential-Time Hypothesis (ETH), any ((1-d) ln n)-approximation algorithm for Set-Cover must run in time >= 2^{n^{c d}}, for some constant 0<d<1. We study the questions along this line. First, we show that under ETH and PGC any ((1-d) \ln n)-approximation for Set-Cover requires 2^{n^{d}}-time. This (almost) matches the running time of 2^{O(n^d)} for approximating Set-Cover to a factor (1-d) ln n by Cygan et al. [IPL, 2009]. Our result is tight up to the constant multiplying the n^{d} terms in the exponent. This lower bound applies to all of its generalizations, e.g., Group Steiner Tree (GST), Directed Steiner (DST), Covering Steiner Tree (CST), Connected Polymatroid (CP). We also show that in almost exponential time, these problems reduce to Set-Cover: We show (1-d)ln n approximation algorithms for all these problems that run in time 2^{n^{d \log n } poly(m). We also study log^{2-d}n approximation for GST. Chekuri-Pal [FOCS, 2005] showed that GST admits (log^{2-d}n)-approximation in time exp(2^{log^{d+o(1)}n}), for any 0 < d < 1. We show the lower bound of GST: any (log^{2-d}n)-approximation for GST must run in time >= exp((1+o(1)){log^{d-c}n}), for any c>0, unless the ETH is false. Our result follows by analyzing the work of Halperin and Krauthgamer [STOC, 2003]. The same lower and upper bounds hold for CST.
cs.DS
cs
On subexponential running times for approximating directed Steiner tree and related problems Marek Cygan∗ Guy Kortsarz† Bundit Laekhanukit‡ November 5, 2018 Abstract This paper concerns proving almost tight (super-polynomial) running times, for achieving desired approximation ratios for various problems. To illustrate the question we study, let us consider the Set-Cover problem with n elements and m sets. Now we specify our goal to approximate Set-Cover to a factor of (1 − α) ln n, for a given parameter 0 < α < 1. What is the best possible running time for achieving such approximation ratio? This question was answered implicitly in the work of Moshkovitz [Theory of Computing, 2015]: Assuming both the Projection Games Conjecture (PGC) and the Exponential-Time Hypothesis (ETH), any ((1 − α) ln n)-approximation algorithm for Set-Cover must run in time at least 2nc·α , for some small constant 0 < c < 1. We study the questions along this line. Our first contribution is in strengthening the above result. We show that under ETH and PGC the running time requires for any ((1 − α) ln n)-approximation algorithm for Set-Cover is essentially 2nα . This (almost) settles the question since our lower bound matches the best known running time of 2O(nα) for approximating Set-Cover to within a factor (1 − α) ln n given α terms in the by Cygan et al. exponent. [IPL, 2009]. Our result is tight up to the constant multiplying the n The lower bound of Set-Cover applies to all of its generalization, e.g., Group-Steiner-Tree, Directed-Steiner-Tree, Covering-Steiner-Tree and Connected-Polymatroid. We show that, surprisingly, in almost exponential running time, these problems reduce to Set-Cover. Specifically, we complement our lower bound by presenting an (1−α) ln n approximation algorithm for all aforementioned problems that runs in time 2nα ·log n · poly(m). We further study the approximation ratio in the regime of log2−δ n for Group-Steiner-Tree and Covering-Steiner-Tree. Chekuri and Pal [FOCS, 2005] showed that Group-Steiner-Tree admits n)-approximation in time exp(2logα+o(1) n), for any parameter 0 < α < 1. We show the run- (log2−α ning time lower bound of Group-Steiner-Tree: any (log2−α n)-approximation algorithm for Group- Steiner-Tree must run in time at least exp((1 + o(1))logα−ǫ n), for any constant ǫ > 0, unless the ETH is false. Our result follows by analyzing the hardness construction of Group-Steiner-Tree due to the work of Halperin and Krauthgamer [STOC, 2003]. The same lower and upper bounds hold for Covering-Steiner-Tree. 8 1 0 2 v o N 2 ] S D . s c [ 1 v 0 1 7 0 0 . 1 1 8 1 : v i X r a ∗Department of Math and information, University of Warsaw, Warsaw, Porland. Email: [email protected] †Computer Science Department, Rutgers University -- Camden, Camden NJ, USA. Email: [email protected] ‡Institute for Theoretical Computer Science, Shanghai University of Finance and Economics, Shanghai, China. Email: [email protected] 1 1 Introduction The traditional study of approximation algorithms concerns designing algorithms that run in polynomial time while producing a solution whose cost is within a factor α away from the optimal solution. Once the approximation guarantees meet the barrier, a natural question is to ask whether the approximation ratio can be improved if the algorithms are given running time beyond polynomial. This has been a recent trend in designing approximation algorithms that allows ones to break through the hardness barrier; see, e.g., [1, 5, 22, 6, 6, 7, 7, 15, 14]. While ones ask for improving the approximation ratio, another interesting question is to ask the converse: Suppose the approximation ratio has been specified at the start, what is the smallest running time required to achieve such approximation ratio? This question has recently been an active subject of study; see, e.g., [9, 3, 4]. To answer the above question, ones need complexity assumptions stronger than P 6= NP as this standard assumption does not precisely specify the running times besides polynomial versus super-polynomial. The most popular and widely believed assumption is the Exponential-Time Hypothesis (ETH), which states that 3-SAT admits no 2o(n)-time algorithm. This together with the almost linear size PCP theorems [16, 33] yields many running time lower bounds for approximation algorithms [9, 3, 4]. Let us give an example of the results of this type: Example: Consider the Maximum Clique problem, in which the goal is to find a clique of maximum size in a graph G = (V, E) on n vertices. This problem is known to admit no n1−ǫ-approximation, for any ǫ > 0, unless P = NP [26, 35]. Now, let us ask for an α-approximation algorithm, for α ranging from constant to √n. There is a trivial 2n/αpoly(n)-time approximation algorithm, which is obtained by partitioning vertices of G into to α parts and finding a maximum clique from each part separately. Clearly, the maximum clique amongst these solutions is an α-approximate solution, and the running time is 2n/αpoly(n). The question is whether this is the best possible running-time. Chalermsook et al. [9] showed that such a trivial algorithm is almost tight1. To be precise, under the ETH, there is no α-approximation algorithm that runs in time 2n1−ǫ/α1+ǫ , for any constant ǫ > 0, unless the ETH is false. In this paper, we consider the question along this line. We wish to show the tight lower and upper bounds on the running times of polylogarithmic approximation algorithms for Set-Cover, Group-Steiner-Tree and Directed-Steiner-Tree (which we will define in the next section) and related problems. • For any constant 0 < α < 1, what is the best possible running times for (1 − α) ln n-approximation algorithms for Set-Cover and Directed-Steiner-Tree. • For any constant 0 < α < 1, what is the best possible running time for log2−α-approximation algorithms for Group-Steiner-Tree. In fact, one of our ultimate goals is to find an evidence on which ranges of running-times that the Directed-Steiner-Tree problem admits poly-logarithmic approximations. To be precise, we would like to partially answer the question of whether Directed-Steiner-Tree admits polylogarithmic approximations in polynomial-time, which is a big open problem in the area. While we are far from solving the above question, we aim to prove possibly tight running-time for Directed-Steiner-Tree in the logarithmic range in a very fine-grained manner, albeit assuming two strong assumptions, the Exponential-Time Hypothesis (ETH) [27, 28] and the Projection Game Conjectures (PGC) [32], simultaneously. 1.1 The problems studied in this paper 1.1.1 The Set-Cover problem and its extensions In the weighted Set-Cover problem, the input is a universe U of size n and a collection S of m subsets of U . Each set s ∈ S has a cost c(s). The goal is to select a minimum cost subcollection S′ ⊆ S such that the union of the sets in S′ spans the entire universe U . 1 Recently, Bansal et al. [1] showed that Maximum Clique admits α-approximation in time 2n/ O(α log2 α)poly(n). 2 The more general Submodular-Cover problem admits as input a universe U with cost c(x) on every x ∈ U . A function is submodular if for every S ⊆ T ⊆ V and for every x ∈ U \ T , f (S + x) − f (S) ≥ f (T + x) − f (T ). Let f : 2U 7→ R be a submodular non-decreasing function. The goal in the submodular cover problem is to minimize c(S) subject to f (S) = f (U ). This problem strictly generalizes the weighted Set-Cover problem. The Connected-Polymatroid problem is the case that the elements in U are leaves of a tree, and both the elements and tree edges have costs. The goal is to select a set S so that f (S) = f (U ) and that c(S) + c(T (S)) is minimized, where T (S) is the unique tree rooted at r spanning S. 1.1.2 The Group-Steiner-Tree problem In the Group-Steiner-Tree problem, the input consists an undirected graph with cost c(e) on each edge e ∈ E, a collection of subsets g1, g2, . . . , gk ⊆ V (called group) and a special vertex r ∈ V . The goal is is to find a minimum cost tree rooted at r that contains at least one vertex from every group gi. In the Covering-Steiner-Tree problem, there is a demand di for every gi and di vertices of gi must be spanned in the tree rooted by r This Group-Steiner-Tree problem strictly contains the Set-Cover problem. Every result for Group-Steiner-Tree holds also for the Covering-Steiner-Tree problem given that there is a reduction from Covering-Steiner-Tree to Group-Steiner-Tree [19, 24]. 1.1.3 The Directed-Steiner-Tree problem In the Directed-Steiner-Tree problem, the input consists of a directed graph with costs c(e) on edges, a collection S of terminals, and a designated root r ∈ V . The goal is to find a minimum cost directed graph rooted at r that spans S. This problem has Group-Steiner-Tree as a special case. 1.2 Related work The Set-Cover problem is a well-studied problem. The first logarithmic approximation, to the best of our knowledge, is traced back to the early work of Johnson [29]. Many different approaches have been proposed to approximate Set-Cover, e.g., the dual-fitting algorithm by Chv´atal [13]; however, all algorithms yield roughly the same approximation ratio. The more general problem, namely, the Submodular-Cover problem was also shown to admit O(log n)-approximation in the work of Wolsey [34]. The question of why all these algorithms yield the same approximation ratio was answered by Lund and Yannakakis [31] who showed that the approximation ratio Θ(log n) is essentially the best possible unless NP ⊆ DTIME(nlog log n). Subsequently, Feige [21] showed the more precise lower bound that Set-Cover admits no (1 − ǫ) ln n- approximation, for any ǫ > 0, unless NP ⊆ DTIME(npolylog(n)); this assumption has been weaken to P 6= NP by the recent work of Dinur and Steurer [17]. These lower bounds are, however, restricted to polynomial-time algorithms. In the regime of subexponential-time, Cygan, Kowalik and Wykurz [15] showed that Set-Cover admits an approximation ratio of (1− α) ln n in 2O(nα+polylog(n)) time. On the negative side, Moshkovitz [32] introduced the Projection Games Conjecture (PGC) to prove the approximation hardness of Set-Cover. Originally, the conjecture was introduced in an attempt to show the (1 − ǫ) ln n-hardness of Set-Cover under P 6= NP (which is now proved by Dinur and Steurer [17]). It turns out that this implicitly implies that Set-Cover admits no (1 − α) ln-approximation algorithm in 2nO(α) The generalization of the Set-Cover problem is the Group-Steiner-Tree problem. Garg, Konjevod and Ravi [23] presented a novel LP rounding algorithm to approximate Group-Steiner-Tree on trees to within a factor of O(log2 n). Using the probabilistic metric-tree embedding [2, 20], this implies an O(log3 n)- approximation algorithm for Group-Steiner-Tree in general graphs. On the negative side, Halperin and Krauthgamer showed the lower bound of log2−ǫ n for any ǫ > 0 for approximating Group-Steiner-Tree on trees under the assumption that NP 6⊆ ZPTIME(npolylog(n)). This (almost) matches the upper bound given by the algorithm by Garg et al. For the related problem, the Connected Polymatroid problem was given a polylogarithmic approximation algorithm by C´alinescu and Zelikovsky [8]; their algorithm is based time under PGC and ETH. 3 on the work of Chekuri, Even and Kortsarz [11], which gave a combinatorial polylog(n) approximation for Group-Steiner-Tree on trees. The problem that generalizes all the above problems is the Directed-Steiner-Tree problem. The best known approximation ratio for this problem is nǫ for any constant ǫ > 0 [10, 30] in polynomial-time. In quasi-polynomial-time, Directed-Steiner-Tree admits an O(log3 n)-approximation algorithm. The question of whether Directed-Steiner-Tree admits a polylogarithmic approximation in polynomial-time has been a long standing open problem. 2 Our results We show that under the combination of ETH and PGC, the running time for approximating Set-Cover to within a factor of (1− α) ln n must be at least 2nα , where 0 < α < 1 is a given parameter. This improves the work of Moshkovitz who (implicitly) showed the running time lower bound of 2nO(α) . We complement this by showing that Directed-Steiner-Tree admits a (1− α) ln n approximation algorithm that runs in time 2nα·log n time. Since Directed-Steiner-Tree is the generalization of Set-Cover, Group-Steiner-Tree and Directed-Steiner-Tree, the lower bounds apply to all the aforementioned problems. Hence, up to a small factor of log n in the exponent, we get tight running time lower bounds for approximating all these problems to within (1 − α) ln n. Essentially, the same algorithm and proof give the same result for the Connected-Polymatroid problem. We also investigate the work of Chekuri and Pal [12] who showed that, for any constant 0 < δ < 1, Group-Steiner-Tree admits a log2−δ n approximation algorithm that runs in time exp(2(1+o(1)) logδ n). We show that, for any constant ǫ > 1, there is no log2−δ−ǫ n approximation algorithm for Group-Steiner-Tree (and thus Covering-Steiner-Tree) that runs in time exp(2(1+o(1)) logδ−ǫ n). This lower bound is nearly tight. We note that a reduction from Covering-Steiner-Tree to Group-Steiner-Tree was given in [19]. Thus, any approximation algorithm for Group-Steiner-Tree also applies for Covering-Steiner-Tree. 3 Formal definition of our two complexity assumptions Definition 3.1. In the Label-Cover problem with the projection property (a.k.a., the Projection game), we are given a bipartite graph G(A, B, E), two alphabet sets (also called labels) ΣA and ΣB, and for any edge (also called query) e ∈ E, there is a function φe : ΣA 7→ ΣB. A labeling (σA, σB) is a pair of functions σA : A 7→ ΣA and σB : B 7→ ΣB assigning labels to each vertices of A and B, respectively. An edge e = (a, b) is covered by (σA, σB) if φe(σA(a)) = σB(b). The goal in Label-Cover is to find a labeling (σA, σB) that covers as many edges as possible. In the context of the Two-Provers One-Round game (2P1R), every label is an answer to some "question" a sent to the Player A and some question b sent to the Player B, for a query (a, b) ∈ E. The two answers make the verifier accept if a label x ∈ Σx assigned to a and a label y ∈ ΣB assigned to b satisfy φ(x) = y. Since any label x ∈ ΣA has a unique label in ΣB that causes the verifier to accept, y is called the projection of x into b. We use two conjectures in our paper. The first is the Exponential Time Hypothesis (ETH), which asserts that an instance of the 3-SAT problem on n variables and m clauses cannot be solved in 2o(n)-time. This was later showed by Impagliazzo, Paturi and Zane [27] that any 3-SAT instance can be sparsified in 2o(n)-time to an instance with m = O(n) clauses. Thus, ETH together with the sparsification lemma [28] implies the following: Exponential-Time Hypothesis combined with the Sparsification Lemma: Given a boolean 3-CNF formula φ on n variables and m clauses, there is no 2o(n+m)-time algorithm that decides whether φ is satisfiable. In particular, 3-SAT admits no subexponential-time algorithm. The following was proven by Moshkovitz and Raz [33]. 4 Theorem 3.2 ([33]). There exists c > 0, such that for every ǫ ≥ 1/nc, 3-SAT on inputs of size n can be efficiently reduced to Label-Cover of size N = n1+o(1)poly(1/ǫ) over an alphabet of size exp(1/ǫ) that has soundness error ǫ. The graph is bi-regular (namely, every two questions on the same side participate in the same number of queries). There does not seem to be an inherent reason that the alphabet would be so large. This leads to the following conjecture posed by Moshkovitz [32]. Conjecture 3.3 (The Projection Games Conjecture [32]). There exists c > 0, such that for every ǫ ≥ 1/nc, 3-SAT on inputs of size n can be efficiently reduced to Label-Cover of size N = n1+o(1)poly(1/ǫ) over an alphabet of size poly(1/ǫ) that has soundness error ǫ. Moreover, the graph is bi-regular (namely, every two questions on the same side participate in the same number of queries). The difference between Theorem 3.2 and Conjecture 3.3 is in the size of the alphabet. For our purposes, we only need soundness ǫ = 1/polylog(n), and we know that the degree and alphabet size of the graph in Conjecture 3.3 are always polylog(n) (which are inverse of the soundness). Hence, we may assume the (slightly) weaker assumption (obtained by setting ǫ = 1/polylog(n) in Conjecture 3.3) as below. Conjecture 3.4 (Projection Games Conjecture, a variant). There exists c > 0, such that for every ǫ = 1/polylog(n), 3-SAT on inputs of size n can be efficiently reduced to Label-Cover of size N = n1+o(1)poly(1/ǫ) where the graph is bi-regular and all degrees are bounded by polylog(n). The size of the alphabet is polylog(n) and the soundness is 1/polylog(n). and the completeness is 1. We need to inspect very carefully and slightly change the proof of [32] since we do not want the Label-Cover instance to grow by a lot by the modification in [32]. Hence, in fact we have to go over all steps of [32] and bound the size more carefully in all steps that require that. 4 First part of the proof We start with the same definition as in [32]. Definition 4.1 (Total disagreement). Let (G = (A, B, E), ΣA, ΣB, Φ) be a Label-Cover instance. Let φA : A → ΣA be an assignment to the A-vertices. We say that the A-vertices totally disagree on a vertex b ∈ B, if there are no two neighbors a1, a2 ∈ A of b, for which πe1 (φA(a1)) = πe2 (φA(a2)) , where e1 = (a1, b), e2 = (a2, b) ∈ E. The above simply states that for a given assignment φA and a vertex b ∈ B, no matter which label we assign to the vertex b, we will satisfy only one edge incident to it. Definition 4.2 (Agreement soundness). Let G = (G = (A, B, E), ΣA, ΣB, Φ) be a Label-Cover for de- ciding whether a Boolean formula φ is satisfiable. We say that G has agreement soundness error ǫ, if for unsatisfiable φ, for any assignment φA : A → ΣA, the A-vertices are in total disagreement on at least 1 − ǫ fraction of the b ∈ B. For a Yes-Instance (of 3-SAT), a standard argument implies that you can label the vertices so that every edge is covered. The usual condition of soundness required is that the number of edges covered is a small fraction of the edges, for every label assignment. The total disagreement is stronger than that. It states that for any assignment φA, no matter how we set φB almost all of vertices of B will have at most one incident edge satisfied. In the rest of this subsection the goal is to show (list) agreement soundness error of bounded degree Label-Cover instances. First, we use the following lemma (we do not alter its proof). 5 Lemma 4.3 (Combinatorial construction). For 0 < ǫ < 1, for a prime power D, and ∆ that is a power of D, there is an explicit construction of a regular bipartite graph H = (U, V, E) with U = n, V -degree D, and V ≤ nO(1) that satisfies the following. For every partition U1, . . . , Uℓ of U into sets such that Ui ≤ ǫU, for i = 1, . . . , ℓ, the fraction of vertices v ∈ V with more than one neighbor in any single set Ui, is at most ǫD2. It is rather trivial to show the above lemma by a probabilistic method. Moshkovitz showed in [32] that such graphs can be constructed deterministically via a simple and elegant construction. In the next lemma, we show how to take a Label-Cover instance with standard soundness and convert it to a Label-Cover instance with total disagreement soundness, by combining it with the graph from Lemma 4.3. Here (as opposed to [32]) we have to bound the size of the created instance more carefully ([32] only states that the size is raised to a constant power). Lemma 4.4. Let D ≥ 2 be a prime power and let ∆ be a power of D. Let ǫ > 0. From a Label-Cover instance with soundness error ǫ2D2 and B-degree n, we can construct a Label-Cover instance with agree- ment soundness error 2ǫD2 and B-degree D. The transformation preserves the alphabets, and the size of the created instance is increased by a factor poly(∆), namely by polynomial in the original B-degree. Proof. Let G = (G = (A, B, E), ΣA, ΣB, Φ) be the original Label-Cover from the Projection Game Con- jecture. Let H = (U, V, EH ) be the graph from Lemma 4.3, where ∆, D and ǫ are as given in the current lemma. Let us use U to enumerate the neighbors of a B-vertex, i.e., there is a function E← : B × U → A that, given a vertex b ∈ B and u ∈ U , gives us the A-vertex which is the u neighbor of b. We create a new Label-Cover (G = (A, B × V, E′), ΣA, ΣB, Φ′). The intended assignment to every vertex a ∈ A is the same as its assignment in the original instance. The intended assignment to a vertex hb, vi ∈ B × V is the same as the assignment to b in the original game. We put an edge e′ = (a,hb, vi) if there exist u ∈ U such that E←(b, u) = a and (u, v) ∈ EH . We define πe′ = π(a,b). If there is an assignment to the original instance that satisfies c fraction of its edges, then the corresponding assignment to the new instance satisfies c fraction of its edges (this follows from the regularity of the graph H). Suppose there is an assignment for the new instance φA : A → ΣA in which more than 2ǫD2 fraction of Let us say that b ∈ B is good if for more than an ǫD2 fraction of the vertices in {b} × V the A-vertices Focus on a good b ∈ B. Consider the partition of U into ΣB sets, where the set corresponding to σ ∈ ΣB the vertices in B × V do not have total disagreement. do not totally disagree. Note that the fraction of good b ∈ B is at least ǫD2. is: Uσ = {u ∈ Ua = E←(b, u) ∧ e = (a, b) ∧ πe(φA(a)) = σ} . champion for b. b arbitrary values. The fraction of edges that φA, φB satisfy in the original instance is at least ǫ2D2. By the goodness of b and the property of H, there must be σ ∈ ΣB such that Uσ > ǫU. We call σ the We define an assignment φB : B → ΣB that assigns good vertices b their champions, and other vertices The new instance is bigger by a factor V , which is poly(∆). Next we consider a variant of Label-Cover that is relevant for the reduction to Set-Cover. In this variant, the prover is allowed to assign each vertex ℓ values, and an agreement is interpreted as agreement on one of the assignments in the list. Definition 4.5 (List total disagreement [32]). Let (G = (A, B, E), ΣA, ΣB, Φ) be a Label-Cover. Let ℓ ≥ 1. Let φA : A → (cid:0)ΣA ℓ (cid:1) be an assignment that assigns each A-vertex ℓ alphabet symbols. We say that the A-vertices totally disagree on a vertex b ∈ B if there are no two neighbors a1, a2 ∈ A of b, for which there exist σ1 ∈ φA(a1), σ2 ∈ φA(a2) such that where e1 = (a1, b), e2 = (a2, b) ∈ E. πe1 (σ1) = πe2 (σ2) , 6 Definition 4.6 (List agreement soundness [32]). Let (G = (A, B, E), ΣA, ΣB, Φ) be a Label-Cover for deciding membership whether a Boolean formula φ is satisfiable. We say that G has list-agreement soundness error (ℓ, ǫ), if for unsatisfiable φ, for any assignment φA : A → (cid:0)ΣA on at least 1 − ǫ fraction of the b ∈ B. ℓ (cid:1), the A-vertices are in total disagreement If a PCP has low error ǫ, then even when the prover is allowed to assign each A-vertex ℓ values, the game is still sound. This is argued in the next corollary. Lemma 4.7 (Lemma 4.7 of [32]). Let ℓ ≥ 1, 0 < ǫ′ < 1. Any instance of Label-Cover with agreement soundness error ǫ′ has list-agreement soundness error (ℓ, ǫ′ℓ2). The following corollary summarizes this subsection. Corollary 4.8. For any ℓ = ℓ(n) = polylog(n), for any constant prime power D and constant 0 < α < 1, 3-SAT on input of size n can be reduced to a Label-Cover instance of size N = n1+o(1) with alphabet size polylog(n), where the B-degree is D, and the list-agreement soundness error is (ℓ, α). Proof. Our starting point is the Label-Cover instance from 3.4 with soundness error ǫ, such that 2√ǫ· l2 ≤ α. Note that the B-degree of the instance is ∆ = polylog(n). The corollary then follows by invoking Lemma 4.4 and Lemma 4.7. 4.1 From Label-Cover to Set-Cover Lemma 4.9 (Partition System [32]). For natural numbers m, D, and 0 < α < 1, for all u ≥ (DO(log D) log m)1/α, there is an explicit construction of a universe U of size u and partitions P1, . . . ,Pm of U into D sets that satisfy the following: there is no cover of U with ℓ = D lnU(1 − α) sets Si1, . . . , Siℓ, 1 ≤ i1 < . . . < iℓ ≤ m, such that each set Sij belongs to the partition Pij . We will use the contrapositive of the lemma: if U has a cover of size at most ℓ, then this cover must contain at least two sets from the same partition. Next follows the reduction, which is almost the same as in [32], where the only difference is the parameter setting. We take a Label-Cover instance G from Corollary 4.8 and transform it into an instance of Set-Cover. In order to do so, we invoke Lemma 4.9 with m = ΣB and D which is the B-degree of G. The parameter u will be determined later. Let U be the universe, and Pσ1 , . . . ,Pσm be the partitions of U , where the partitions are indexed by symbols of ΣB. The elements of the Set-Cover instance are B × U , i.e., for each vertex b ∈ B there is a copy of U . Covering {b} × U corresponds to satisfying the edges that touch b. There are m ways to satisfy the edges that touch b -- one for every possible assignment σ ∈ ΣB to b. The different partitions covering U correspond to those different assignments. For every vertex a ∈ A and an assignment σ ∈ ΣA to a, we have a set Sa,σ in the Set-Cover instance. Taking Sa,σ to the cover would correspond to assigning σ to a. Notice that a cover might consist of several sets of the form Sa,· for the same a ∈ A, which is the reason we consider list agreement. The set Sa,σ is a union of subsets, one for every edge e = (a, b) touching a. Suppose e is the i-th edge coming into b (1 ≤ i ≤ D), then the subset associated with e is {b} × S, where S is the i-th subset of the partition PΦe(σ). If we have an assignment to the A-vertices such that all of the neighbors of b agree on one value for b, then the D subsets corresponding to those neighbors and their assignments form a partition that covers bs universe. On the other hand, if one uses only sets that correspond to totally disagreeing assignments to the neighbors, then by the definition of the partitions, covering U requires ≈ lnU times more sets. The formal claim proved by Moshkovitz is as follows. Claim 4.10 (Claim 4.10 of [32]). The following holds • Completeness: If all the edges in G can be satisfied, then the created instance admits a set cover of size A. • Soundness: Let ℓ := D lnU(1 − α) be as in Lemma 4.9. If G has agreement soundness (ℓ, α), then every set cover of the created instance is of size more than A lnU(1 − 2α). 7 The following is our main theorem, where we fine-tune the parameters to get the best possible (and thus almost tight) running time lower bound. Theorem 4.11. Fix a constant γ > 0 and ǫ > 0. Assuming PGC there is an algorithm that given an instance φ of 3-SAT of size n one can create an instance I of Set-Cover with universe of size n1+o(1) · u such that if φ is satisfiable, then I has a set cover of size x, while if φ is not satisfiable, then I does not admit a set cover of size at most x lnu(1 − ǫ). Proof. Given a sparsified 3-CNF formula φ of size n we transform it into a Label-Cover instance G, by Corollary 4.8, obtaining a list-agreement soundness error (ℓ, α), where we set α = ǫ/2 and ℓ = D lnU(1−α). Next, we perform the reduction from this section and by Claim 4.10 we have the following: • If φ is satisfiable, then there exists a solution of size A (where A is one side of G). • If φ is not satisfiable, then any set cover has size more than A lnU(1 − 2α) = A lnU(1 − ǫ). By setting the value of U = u appropriately we get a tradeoff between the approximation ratio and running time in the following lower bound obtained directly from Theorem 4.11. Corollary 4.12. Unless the ETH fails, for any 0 < α < 1 and ǫ > 0 there is no (1 − α) ln n approximation for Set-Cover with universe of size n and m sets in time 2nα−ǫ Proof. Set u = φ1/α−1, then the created instance has at most φ1/α+o(1) elements, which fits the desired running time in the lower bound. It remains to analyze the approximation ratio. Note that A ≤ uα/(1−α), hence poly(m). (1 − α) ln(A · u) ≤ (1 − α)(α/(1 − α) + 1) ln u = ln u . 5 Approximating Directed Steiner Tree In this section, we present a (1− ǫ)· ln n-approximation algorithm for Directed-Steiner-Tree running in time 2O(nα log n). Lemma 5.1. For any rooted tree T with ℓ leaves, there exists a set X ⊆ V (T ) of O(nα) vertices together with a family of edge disjoint trees T1, . . . , Tq, such that: • the trees are edge (but not vertex) disjoint • each Ti is a subtree of T , • the root of each Ti belongs to X, • each leaf of T is a leaf of exactly one Ti, • each Ti has more than nα but less than 2nα leaves. Proof. As long as the tree has more than nα leaves do the following: pick the lowest vertex v in the tree, the subtree rooted at which has more than nα leaves. This implies that all its children contain strictly less than nα leaves. Accumulation subtrees gives at most 2nα leaves since before the last iteration there were less that nα leaves, and the last iteration adds a tree of at most nα leaves. Remove the collected tree, but do not remove their root (namely this root may later participate in other trees). Note that after the accumulated trees are removed, the tree rooted by our chosen root may still have more than nα leaves. This gives Θ(nα) edge disjoint trees with Θ(nα) leaves each. Thus, there is a tree with Θ(nα) leaves, and density (cost over the number of leaves) no larger than the optimum density. 8 For simplicity, we make sure that the number of leaves in each tree is exactly nα by discarding leaves. Since the trees are edge disjoint there must be a tree whose density: cost over the number of leaves is not worse (up to a factor of 2) than the optimum density opt/ℓ. Let (G, K, r) be an instance of Directed-Steiner-Tree. Our algorithm enumerates guesses the (roughly) nα leaves L′ in the tree whose density is no worse than the optimal density, and also guesses the subset XL′ ⊆ V (G) that behaves as Steiner vertices. Assuming the graph went via a transitive closure, the size of XL′ is at most the size of L′ of size O(nα). For a fixed set X, the algorithm first finds an optimum directed Steiner tree T0. We note that assuming that the graph went via transitive closure, we may assume that the number of Steiner vertices is less than the number of leaves, and so we may guess the Steiner vertices at time n√n as well. It is known that given the Steiner vertices and the leaves of the tree, we can, in polynomial time, find the best density tree with these leaves and these X vertices. The first such algorithm is due to Dreyfus and Wagner [18]. The algorithm is quite non trivial and that uses dynamic programming. The running time of the algorithm is O(3n) time which is negligible in our context. We iterate adding more trees in this way. Each time we find the best density tree rooted at some vertex of X which covers nα leaves, and add the edges to S. Each time it requires 2O(nα log n) time. Finally, when there are less than (e2 + 1)nα unconnected terminals left, we find an optimum directed Steiner tree for those vertices. Lemma 5.2. The approximation ratio of the above algorithm is at most (1 − α) ln n. Proof. Let T be an optimum Steiner tree spanning K, let opt be its cost and let X be the set from Lemma 5.1 for the tree T . Let us analyze the algorithm in the iteration when it chooses the set X properly, that is picks the same set as Lemma 5.1. Note that since vertices of X belong to T the cost of the first tree T0 found by the algorithm is at most opt. The last property of Lemma 5.1 guarantees, that our algorithm always finds a tree with at least as good density as opt/r, where r is the number of not yet connected terminals. By the standard set-cover type analysis we can bound the cost of all the best density trees found by the algorithm by e2·21−αX i=n opt i = opt · (Hn − He2·21−α) =(1 − α) ln n · opt. Finally, the last tree is of cost at most opt, and it can be found in time 2O(nα log n). Now we observe that the same theorem applies for the Connected-Polymatroid problem. Since the function is both submodular and increasing for every collection of pairwise disjoint sets {Si}i=1k , Pk i=1 f (Si) ≥ f (Sk i=1 Si). Thus for a given α, at iteration i there exists a collection of leaves Si so that f (Si)/c(Si) ≥ f (U )/c(U ). We can guess Si in time exp(nα · log n) and its set of Steiner vertices Xi in time O(3nα ). Using the algorithm of [18], we can find a tree of density at most 2 · opt/nα. The rest of the proof is identical. 6 Hardness for Group Steiner Tree under the ETH In this section, we show that the approximation hardness of the group Steiner problem under the ETH, which implies that the subexponential-time algorithm for Group-Steiner-Tree of Chekuri and Pal [12] is nearly tight. This hardness result is implicitly in the work Halperin and Krauthgamer [25]. More precisely, the following is a corollary of Theorem 1.1 in [25]. Theorem 6.1 (Corollary of Theorem 1.1 in [25]). Unless the ETH is false, for any parameter 0 < δ < 1, there is no exp(2logδ−ε N )-time log2−δ−ε k-approximation algorithm for Group-Steiner-Tree, for any 0 < ε < δ. Proof Sketch of Theorem 6.1. We provide here the parameter translation of the reduction in [25], which will prove Theorem 6.1. 9 A, Σℓ A = Σℓ The Reduction of Halperin and Krauthgamer. We shall briefly describe the reduction of Halperin and Krauthgamer. The starting point of their reduction is the Label-Cover instance obtained from ℓ rounds of parallel repetition. In the first step, given a d-regular Label-Cover instance G = (G = (A, B, E), ΣA, ΣB, φ) completeness 1 and soundness γ, they apply ℓ rounds of parallel repetition to get a dℓ-regular instance of Label-Cover G′ = (Gℓ = (Aℓ, Bℓ, E′), Σℓ B, φ′). To simplify the notation, we let m = A = B, σ = Σℓ B be the number of vertices and the alphabet size of the Label-Cover instance G, respectively. Then we have that the number of vertices and the alphabet size of G′ is 2mℓ and σℓ, respectively. In the second step, they apply a recursive composition to produce an instance I of Group-Steiner-Tree on a complete (2 · mℓ · σℓ)-ary tree bT of height H on k = dℓmℓ·H groups. Moreover, if G is a Yes-Instance (i.e., there is a labeling that covers all the constraints), then there is a feasible solution to Group-Steiner-Tree with cost H with high probability, and if G is a No-Instance (i.e., every labeing covers at most γ fraction of the edges), then there is no solution with cost less than βH 2 log k, for some sufficiently small constant β > 0. In short, the above reduction gives an instance of Group-Steiner-Tree on a tree with N = O((σm)ℓH ) vertices, k = O(dℓmℓH ) groups, and with approximation hardness gap Ω(H log k). Additionally, the reduc- tion in [25] requires ℓ > c0(log H + log log m + log log d) for some sufficiently large constant c0 > 0. Subexponential-Time Approximation-Hardness. Now we derive the subexponential-time approxi- mation hardness for Group-Steiner-Tree. We start by the nearly linear-size PCP theorem of Dinur [16], which gives a reduction from 3-SAT of size n (the number of variables plus the number of clauses) to a label cover instance G = (G = (A, B, E), ΣA, ΣB, φ) with completeness 1, soundness γ for some 0 < γ < 1, A,B ≤ n · polylog(n), degree d = O(1) and alphabet sets ΣA,ΣB = O(1). For every parameter 0 < δ < 1, we choose H = log1/δ−1 n, which then forces us to choose ℓ = Θ((1/δ − 1) log log n). Note that we may assume that δ ≪ n since it is a fixed parameter. Plugging in these parameter settings, we have an instance of Group-Steiner-Tree on a tree with N vertices and k groups such that N = (cid:16)O(1) · n1+o(1)(cid:17)Θ((1/δ−1) log log n)·log1/δ−1 n = exp(cid:16)log1/δ+o(1) n(cid:17) and k = O(1)Θ((1/δ−1) log log n)(cid:16)n1+o(1)(cid:17)Θ((1/δ−1) log log n)·log1/δ n = exp(cid:16)log1/δ+o(1) n(cid:17) Observe that H ≥ log1−δ−o(1) k. Thus, the hardness gap is Ω(H log k) = Ω(log2−δ−o(1) k). This means that any algorithm for Group-Steiner-Tree on this family of instances with approximation ratio log2−δ−ε k, for any constant ε > 0, would be able to solve 3-SAT. Now suppose there is an exp(2logδ−ε N )-time log2−δ−ε k-approximation algorithm for Group-Steiner- Tree, for some 0 < ε < δ. We apply such algorithm to solve an instance of Group-Steiner-Tree derived from 3-SAT as above. Then we have an algorithm that runs in time exp(2logδ−ε N ) = exp(2(log1/δ+o(1) n)δ−ε ) = exp(2(log (1+o(1))(δ−ε) δ n)) = exp(2o(log n)) = 2o(n) This implies a subexponential-time algorithm for 3-SAT, which contradicts the ETH. Therefore, unless the ETH is false, there is no exp(2logδ−ε N )-time log2−δ−ε k-approximation algorithm for Group-Steiner-Tree, thus proving Theorem 6.1 Since we take log from the expression, the above is also true if we replace k by N . Combined with [12] and [19], we have the following corollary which shows almost tight running-time lower and upper bounds for approximating Group-Steiner-Tree and Covering-Steiner-Tree to a factor log2−δ N . Corollary 6.2. The Group-Steiner-Tree and Covering-Steiner-Tree problems on graphs with n ver- tices admit log2−δ n-approximation algorithms for any constant δ < 1 that runs in time exp(2(1+o(1)) logδ n). In addition, for any constant ǫ > 1 there is no log2−δ−ǫ n approximation algorithm for Group-Steiner-Tree and Covering-Steiner-Tree that runs in time exp(2(1+o(1)) logδ−ǫ n). 10 Remark: We omit the algorithm for the Connected-Polymatroid problem, as its similar to the algorithm for Directed-Steiner-Tree. The lower bound holds because Connected-Polymatroid has Set-Cover as a special case. Acknowledgments. The work of Marek Cygan is part of a project TOTAL that has received funding from the European Research Council (ERC) under the European Unions Horizon 2020 research and innova- tion programme (grant agreement No 677651). Guy Kortsarz was partially supported by NSF grant 1540547. Bundit Laekhanukit was partially supported by ISF grant no. 621/12, and I-CORE grant no. 4/11 and by the 1000-youth award from the Chinese Government. Parts of the work were done while Guy Kortsarz and Bundit Laekhanukit were at the Weizmann Institute of Science, and parts of it were done while Bundit Laekhanukit was at the Max-Plank-Institute for Informatics. References [1] N. Bansal, P. Chalermsook, B. Laekhanukit, D. Nanongkai, and J. Nederlof. New tools and connections for exponential-time approximation. CoRR, abs/1708.03515, 2017. [2] Y. Bartal. Probabilistic approximations of metric spaces and its algorithmic applications. In 37th Annual Symposium on Foundations of Computer Science, FOCS '96, Burlington, Vermont, USA, 14- 16 October, 1996, pages 184 -- 193, 1996. [3] E. Bonnet, B. Escoffier, E. J. Kim, and V. T. Paschos. On subexponential and fpt-time inapproxima- bility. Algorithmica, 71(3):541 -- 565, 2015. Preliminary version in IPEC'13. [4] ´E. Bonnet, M. Lampis, and V. T. Paschos. Time-approximation trade-offs for inapproximable problems. J. Comput. Syst. Sci., 92:171 -- 180, 2018. [5] ´E. Bonnet and V. T. Paschos. Sparsification and subexponential approximation. Acta Inf., 55(1):1 -- 15, 2018. [6] N. Bourgeois, B. Escoffier, and V. T. Paschos. Efficient approximation of min set cover by moderately exponential algorithms. Theor. Comput. Sci., 410(21-23):2184 -- 2195, 2009. [7] N. Bourgeois, B. Escoffier, and V. T. Paschos. Approximation of max independent set, min vertex cover and related problems by moderately exponential algorithms. Discrete Applied Mathematics, 159(17):1954 -- 1970, 2011. [8] G. Calinescu and A. Zelikovsky. The polymatroid steiner problems. J. Comb. Optim., 9(3):281 -- 294, 2005. Preliminary version in ISAAC'04. [9] P. Chalermsook, B. Laekhanukit, and D. Nanongkai. Independent set, induced matching, and pricing: Connections and tight (subexponential time) approximation hardnesses. In 54th Annual IEEE Sym- posium on Foundations of Computer Science, FOCS 2013, 26-29 October, 2013, Berkeley, CA, USA, pages 370 -- 379, 2013. [10] M. Charikar, C. Chekuri, T. Cheung, Z. Dai, A. Goel, S. Guha, and M. Li. Approximation algorithms for directed steiner problems. J. Algorithms, 33(1):73 -- 91, 1999. Preliminary version in SODA'98. [11] C. Chekuri, G. Even, and G. Kortsarz. A greedy approximation algorithm for the group steiner problem. Discrete Applied Mathematics, 154(1):15 -- 34, 2006. [12] C. Chekuri and M. P´al. A recursive greedy algorithm for walks in directed graphs. In 46th Annual IEEE Symposium on Foundations of Computer Science (FOCS 2005), 23-25 October 2005, Pittsburgh, PA, USA, Proceedings, pages 245 -- 253, 2005. 11 [13] V. Chv´atal. A greedy heuristic for the set-covering problem. Math. Oper. Res., 4(3):233 -- 235, 1979. [14] M. Cygan, L. Kowalik, M. Pilipczuk, and M. Wykurz. Exponential-time approximation of hard prob- lems. CoRR, abs/0810.4934, 2008. [15] M. Cygan, L. Kowalik, and M. Wykurz. Exponential-time approximation of weighted set cover. Inf. Process. Lett., 109(16):957 -- 961, 2009. [16] I. Dinur. The PCP theorem by gap amplification. J. ACM, 54(3):12, 2007. Preliminary version in STOC'06. [17] I. Dinur and D. Steurer. Analytical approach to parallel repetition. In Symposium on Theory of Computing, STOC 2014, New York, NY, USA, May 31 - June 03, 2014, pages 624 -- 633, 2014. [18] S. E. Dreyfus and R. A. Wagner. The Steiner problem in graphs. Networks, 1(3):195 -- 207, 1971. [19] G. Even, G. Kortsarz, and W. Slany. On network design problems: Fixed cost flows and the covering steiner problem. In Algorithm Theory - SWAT 2002, 8th Scandinavian Workshop on Algorithm Theory, Turku, Finland, July 3-5, 2002 Proceedings, pages 318 -- 327, 2002. [20] J. Fakcharoenphol, S. Rao, and K. Talwar. A tight bound on approximating arbitrary metrics by tree metrics. J. Comput. Syst. Sci., 69(3):485 -- 497, 2004. Preliminary version in STOC'03. [21] U. Feige. A threshold of ln n for approximating set cover. J. ACM, 45(4):634 -- 652, 1998. Preliminary in STOC'96. [22] D. Fotakis, M. Lampis, and V. T. Paschos. Sub-exponential approximation schemes for csps: From dense to almost sparse. In 33rd Symposium on Theoretical Aspects of Computer Science, STACS 2016, February 17-20, 2016, Orl´eans, France, pages 37:1 -- 37:14, 2016. [23] N. Garg, G. Konjevod, and R. Ravi. A polylogarithmic approximation algorithm for the group steiner In Proceedings of the Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, tree problem. 25-27 January 1998, San Francisco, California., pages 253 -- 259, 1998. [24] A. Gupta and A. Srinivasan. On the covering steiner problem. In FST TCS 2003: Foundations of Software Technology and Theoretical Computer Science, 23rd Conference, Mumbai, India, December 15-17, 2003, Proceedings, pages 244 -- 251, 2003. [25] E. Halperin and R. Krauthgamer. Polylogarithmic inapproximability. In STOC, pages 585 -- 594, 2003. [26] J. Hastad. Clique is hard to approximate within n1-epsilon. In 37th Annual Symposium on Foundations of Computer Science, FOCS '96, Burlington, Vermont, USA, 14-16 October, 1996, pages 627 -- 636, 1996. [27] R. Impagliazzo and R. Paturi. On the complexity of k-sat. J. Comput. Syst. Sci., 62(2):367 -- 375, 2001. Preliminary version in CCC'99. [28] R. Impagliazzo, R. Paturi, and F. Zane. Which problems have strongly exponential complexity? J. Comput. Syst. Sci., 63(4):512 -- 530, 2001. Preliminary version in FOCS'98. [29] D. S. Johnson. Approximation algorithms for combinatorial problems. J. Comput. Syst. Sci., 9(3):256 -- 278, 1974. Preliminary version in STOC'73. [30] G. Kortsarz and D. Peleg. Approximating the weight of shallow steiner trees. Discrete Applied Mathe- matics, 93(2-3):265 -- 285, 1999. Preliminary version in SODA'97. [31] C. Lund and M. Yannakakis. On the hardness of approximating minimization problems. J. ACM, 41(5):960 -- 981, 1994. 12 [32] D. 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'12. [33] D. Moshkovitz and R. Raz. Two-query PCP with subconstant error. J. ACM, 57(5):29:1 -- 29:29, 2010. Preliminary version in FOCS'08. [34] L. A. Wolsey. An analysis of the greedy algorithm for the submodular set covering problem. Combina- torica, 2(4):385 -- 393, 1982. [35] D. Zuckerman. Linear degree extractors and the inapproximability of max clique and chromatic number. Theory of Computing, 3(1):103 -- 128, 2007. Preliminary version in STOC'06. 13
1807.07719
1
1807
2018-07-20T07:16:22
On Euclidean Methods for Cubic and Quartic Jacobi Symbols
[ "cs.DS" ]
We study the bit complexity of two methods, related to the Euclidean algorithm, for computing cubic and quartic analogs of the Jacobi symbol. The main bottleneck in such procedures is computation of a quotient for long division. We give examples to show that with standard arithmetic, if quotients are computed naively (by using exact norms as denominators, then rounding), the algorithms have $\Theta(n^3)$ bit complexity. It is a "folk theorem" that this can be reduced to $O(n^2)$ by modifying the division procedure. We give a self-contained proof of this, and show that quadratic time is best possible for these algorithms (with standard arithmetic or not). We also address the relative efficiency of using reciprocity, as compared to Euler's criterion, for testing if a given number is a cubic or quartic residue modulo an odd prime. Which is preferable depends on the number of residue tests to be done. Finally, we discuss the cubic and quartic analogs of Eisenstein's even-quotient algorithm for computing Jacobi symbols in ${\bf Z}$. Although the quartic algorithm was given by Smith in 1859, the version for cubic symbols seems to be new. As far as we know, neither was analyzed before. We show that both algorithms have exponential worst-case bit complexity. The proof for the cubic algorithm involves a cyclic repetition of four quotients, which may be of independent interest.
cs.DS
cs
On Euclidean Methods for Cubic and Quartic Jacobi Symbols Eric Bach and Bryce Sandlund Computer Sciences Dept. University of Wisconsin Madison, WI 53706 July 18, 2018 8 1 0 2 l u J 0 2 ] S D . s c [ 1 v 9 1 7 7 0 . 7 0 8 1 : v i X r a Abstract. We study the bit complexity of two methods, related to the Euclidean algo- rithm, for computing cubic and quartic analogs of the Jacobi symbol. The main bottleneck in such procedures is computation of a quotient for long division. We give examples to show that with standard arithmetic, if quotients are computed naively (by using exact norms as denominators, then rounding), the algorithms have Θ(n3) bit complexity. It is a "folk theorem" that this can be reduced to O(n2) by modifying the division procedure. We give a self-contained proof of this, and show that quadratic time is best possible for these algorithms (with standard arithmetic or not). We also address the relative efficiency of using reciprocity, as compared to Euler's criterion, for testing if a given number is a cubic or quartic residue modulo an odd prime. Which is preferable depends on the number of residue tests to be done. Finally, we discuss the cubic and quartic analogs of Eisenstein's even-quotient algo- rithm for computing Jacobi symbols in Z. Although the quartic algorithm was given by Smith in 1859, the version for cubic symbols seems to be new. As far as we know, neither was analyzed before. We show that both algorithms have exponential worst-case bit com- plexity. The proof for the cubic algorithm involves a cyclic repetition of four quotients, which may be of independent interest. Presented as a poster at the 13th Algorithmic Number Theory Symposium (ANTS-XIII), Madison, WI, July 16-20, 2018. Bryce Sandlund is now at the University of Waterloo. E-mail addresses for authors: [email protected], [email protected] 1 1. Introduction. Let F be a finite field, of order q. When e divides q − 1, we can test whether x is an e-th power in F using Euler's criterion. This is an "exactness" result, which asserts that, on F∗ q, the image of the e-th power map is the kernel of the (q − 1)/e-th power map. It therefore reduces the "hard" search for a y making ye = x to an "easy" evaluation of x(q−1)/e. It is natural to ask whether exponentiation can be avoided. It definitely can be, when e = 2 and q = p, a prime of Z. This is because we can determine the quadratic character by computing a Jacobi symbol, using a successive division process similar to the Euclidean algorithm. The correctness of this algorithm rests on the quadratic reciprocity law, as extended by Jacobi to include composite moduli. For several such algorithms, see [21]. In this paper we focus on e = 3, 4. Since the results and methods are very similar in both cases, we will first restrict to e = 3, and then take up e = 4 toward the end of the paper. When e = 3, it is natural to move to the ring Z[ρ], with ρ = −1/2+√−3/2 a primitive cube root of unity. When Fq is given to us as Z[ρ]/(π) we can replace quadratic by cubic reciprocity, and produce an analogous test that is free of exponentiation. As far as we know, the first complete description of such a test appeared in 1977, in a paper by Williams and Holte [26]. They said nothing about its complexity, but later Williams [25] pointed out that the number of [arithmetic] operations is logarithmic. (See also Muller [19].). Later (2005), Damgard and Frandsen [5] pointed out that the bit complexity is O(nM (n)), assuming we can multiply n-bit numbers with M (n) bit operations. If standard arithmetic is used, this bound is O(n3). Before describing our contributions we briefly mention some related work. Damgard and Frandsen [5] gave Jacobi symbol algorithms for e = 3, 4, related to the binary algorithm for the gcd in Z, that use O(n2) bit operations. Wikstrom [24] did the same for e = 8. Weilert found an algorithm for the quartic Jacobi symbol with bit complexity n1+o(1), and suggested that a similar result could be proved for the cubic symbol [23, p. 145]. (We do not know if this was ever done.) Jacobi symbol methods for prime e ≤ 19, related to the Euclidean algorithm, were presented by Scheidler and Williams [20]. (Special attention was paid to e = 5.) One goal of our paper is to give a complete self-contained discussion of the bit com- plexity of the Williams-Holte algorithm. As far as we know this has never been done. In particular, we make the following observations. First, the Damgard-Frandsen bound is tight up to constant factors: we exhibit a sequence of input pairs that forces Ω(nM (n)) bit operations. Second, following ideas already used by Collins [3] to compute the gcd in Z[i], approximate quotients can be used in the Williams-Holte algorithm to obtain O(n2) bit complexity. (Earlier, Kaltofen and Rolletschek [16] had computed gcd ideals in rings of quadratic integers in quadratic time using a related but more complicated process.) Finally, even if division could be done for free, the Williams-Holte algorithm would still need Ω(n2) bit operations in the worst case, just to write down the remainders. Our original motivation for this work was to investigate the preference, expressed by Muller and others, for the cubic Jacobi symbol algorithm over Euler's criterion. In conjunction with this, we note that there are really two different computational problems: 2 a) Given p ∈ Z, determine if a is a cube mod p, and b) Given π ∈ Z[ρ], determine if α is a cube mod π. The situation is more complicated than appears at first glance, and we will discuss it further in Section 6. In Section 7, we discuss the cubic and quartic analogs of an elegant but flawed algo- rithm of Eisenstein [7] for computing the Jacobi symbol in Z. The quartic version was given by Smith about 15 years after Eisenstein, but the cubic version may well be new. We show that both of these algorithms have exponential bit complexity. The proof for the cubic algorithm involves some interesting dynamics: for certain input pairs, there is a repeating cycle of quotients, which has the effect of subtracting constants from the pair. Consequently, these intermediate numbers decrease much more slowly than with the Williams-Holte algorithm. 2. Mathematical Background. Let Z denote the integers. The ring of Eisenstein integers is Z[ρ], where ρ = −1/2 + √−3/2 is a primitive cube root of unity. It is the ring of algebraic integers of the imaginary quadratic field Q(ρ). Since ρ2 + ρ + 1 = 0, any Eisenstein integer can be written as a + bρ, where a, b ∈ Z. The norm of α = a + bρ is N (α) = α ¯α = a2 − ab + b2. When thinking of α as a complex number, we will write α = pN (α). We can also think of the numbers a + bρ, where a and b are real, as a 2-dimensional vector space over R. Let α2 = a2 + b2. From examining the quadratic form a2 − ab + b2, we can derive the explicit norm-comparison inequality 2 3 N (α) ≤ α2 ≤ 2N (α). (1) A strong version of long division holds in Z[ρ]: Given α and nonzero β, there are integral q, γ for which α = qβ + γ, N (γ) ≤ 3 4 N (β). (2) We can take q = ⌊α/β⌉, where the brackets indicate each coefficient is rounded to a nearest integer [13, p. 13]. Consequently, Z[ρ] is a principal ideal domain. The units of this ring, the sixth roots of unity, are ±1, ±ρ, ±ρ2 (or, ±(1 + ρ)). When P is a prime ideal of Z[ρ], distinct from (1 − ρ), the cubic symbol (cid:0) α the unique element of {0, 1, ρ, ρ2} for which A prime p of Z is ramified, split, or inert when it is 0, 1, or 2 mod 3, respectively. P(cid:1) is defined as (cid:16) α P(cid:17) ≡ α(NP −1)/3 (mod P ). Here, N P denotes the norm of P , that is, the size of Z[ρ]/P . This extends to an analog of the Jacobi symbol, as follows. Let P = Q1 · · · Qr be a factorization into such prime ideals, with repetitions allowed. Then, P(cid:17) = (cid:16) α r Yi=1 (cid:18) α Qi(cid:19). 3 For convenience, we also allow r = 0 (that is, P = (1)), in which case the symbol is 1. (This follows [2].) This cubic symbol is asymmetric, as its arguments are a number and an ideal. To make it symmetric, we let (cid:16) α β(cid:17) denote (cid:16) α (β)(cid:17). The cubic symbol obeys a reciprocity law for elements, but it must be stated carefully, since multiplying the upper argument by a unit can change the symbol's value. Accord- ingly, we will say that α is primary if α ≡ ±1 mod 3. Note that a primary number cannot be divisible by 1 − ρ, and the only primary units are ±1. Some authors make a more restrictive definition; to encompass this we let 2-primary mean ≡ 2 mod 3. Since Z[ρ]/(3)∗ is cyclic of order 6, each ideal prime to 3 has exactly one 2-primary generator. The cubic reciprocity law consists of a main theorem and two supplementary results. First, suppose that α, β are primary and relatively prime. Then (cid:18) α β(cid:19) = (cid:18) β α(cid:19) Further, suppose β = c + dρ, with c = 3c′ ± 1 and d = 3d′. Then (cid:18) 1 − ρ β (cid:19) = ρ±c′ = ρ−(c2−1)/3. and β(cid:19) = ρ∓(c′+d′) = ρ(c2−cd−1)/3 (cid:18) ρ (3) (4) (5) (6) (The sign in (4) matches the one in the definition of c′, and the sign in (5) is its opposite.) For completeness we note that (cid:18)−1 β (cid:19) = 1, under the same condition. As Collison [4] recounts, the history of cubic reciprocity makes for a complicated tale. (See also [10, 18, 22].) Suffice it to say that (3)–(5) were first proved in print by Eisenstein in 1844 [6, 8]. For a modern exposition of these proofs, see Halter-Koch [12, §7.2]. We end this section with a few remarks on arithmetic in Z[ρ]. M (m, n) stands for the number of bit operations (bops) used to multiply an m-bit integer and an n-bit integer. We can assume that this depends only on input length. Following [1, p. 280], we require M (n) = M (n, n) to satisfy a regularity condition: if a ≥ 1, then M (n) ≤ M (an) ≤ a2M (n). (7) The discrete binary logarithm (bit length function) is given by lg n = (cid:26) 1, ⌊log2 n⌋ + 1, if n = 0; if n 6= 0. By (1), if α = a + bρ, we have a2 + b2 ≤ 2N (α). So lg a, lg b = O(lg N (α)). 4 Therefore, we can compute α ± β using O(lg N (α) + lg N (β)) bops. We can also compute α· β using O(M (lg N (α), lg N (β))) bops. As for long division, we can take q = ⌊α ¯β/N (β)⌉ (The brackets indicate that and then γ = α − qβ; this will use M (lg N (αβ)) bops. coordinates are rounded to nearest elements of Z.) If we only want the remainder, there is a formula of Jacobi [14, pp. 249-250]: γ = [α ¯β mod N (β)]β N (β) (absolutely least remainders for the expression in brackets), with the same complexity. We will say more about long division in Section 5. 3. Cubic Jacobi Symbols via Iterated Division. Just as in Z, one can use continued fractions, or a variation thereof, to compute cubic Jacobi symbols. This was already known to Jacobi. In a paper from the autumn of 1837 [15] that introduced the Jacobi symbol for Z, he noted that Gauss's method for computing the Legendre symbol (cid:16) p q(cid:17) from the continued fraction of p/q (presumably from [11]) would still work with p, q just relatively prime, and then wrote (translation ours): Exactly the same can be applied to biquadratic and cubic residues, for which I have introduced similar symbols. The application of the symbols thus generalized affords, with some practice, agreeable relief. Although it is reassuring to read that even the great masters needed to hone their compu- tational skills, we know of no place where Jacobi explicitly wrote down such an algorithm for the cubic symbol. (In his number theory lectures [14], delivered the preceding winter, he sketched an algorithm for the quartic symbol employing factorization, but said nothing directly about computing cubic symbols.) Eisenstein mentioned a cubic symbol procedure in 1844 [8, p. 32], but gave no details. He did present a full algorithm for the quartic symbol a short time later [9, §10]. In the cubic case, full disclosure apparently had to wait until 1977, when Williams and Holte [26] wrote up the details for an algorithm that we now recognize as the cubic analog of Eisenstein's quartic method. We now give their algorithm, with an extension that allows for inputs that are not relatively prime. 1. [Inputs.] Let α = a + bρ and β = c + dρ, with c 6≡ 0, d ≡ 0 mod 3. (That is, β is primary.) 2. [Base cases.] If β = ±1 or α = ±1, return 1 and stop. 3. [Find remainder.] Let q = ⌊α/β⌉. Compute γ = e + f ρ = α − qβ. If γ = 0, return 0 and stop. 4. [Remove ramified factors.] Find the least m ≥ 0 for which γ′ = e′ + f ′ρ = e + f ρ (1 − ρ)m 5 is not divisible by 1 − ρ. (That is, has e′ + f ′ 6≡ 0 mod 3.) 5. [Make primary.] Find n with 0 ≤ n < 3 so that e′ + f ′ρ γ′′ = ρn is primary. 6. [Recursion.] Return the right side of (cid:18) α β(cid:19) = ρ−m(c2−1)/3+n(c2−cd−1)/3(cid:18) β γ′′(cid:19) The algorithm must terminate because N (β) strictly decreases. We briefly indicate why the output is correct. When β is a unit, the value of the symbol is 1, and if not, but with α = ±1, the same is true. So let there be at least one division step. Using indexing to denote recursion depth, we have α1 = q1β1 + γ1 α2 = q2β2 + γ2 ... = q1β1 + (1 − ρ)m1ρn1 γ′′ 1 , = q2β2 + (1 − ρ)m2ρn2 γ′′ 2 , (8) αt−1 = qt−1βt−1 + γt−1 = qt−1βt−1 + (1 − ρ)mt−1ρnt−1 γ′′ t−1, αt = qtβt, where α2 = β1, β2 = γ′′ 1 , and so on. (We imagine the last division is done, whether needed or not.) Since β is primary, gcd(α, β) is coprime to 1 − ρ, so (using induction), βt is a gcd of α, β. If N (βt) > 1, the last call returns 0, which becomes, correctly, the output. If N (βt) = 1 (that is, γ′′ t−1 is ±1), the t-th call returns 1, and correctness of the output follows from (3)–(5). Note that the algorithm computes a gcd, free of charge, in cases where the symbol is 0. This is similar to the situation in Z [21, p. 608]. Let us now discuss some implementation details. Williams and Holte computed the ratio in Step 3 as α ¯β N (β) In Step 4, we can divide by 1 − ρ using the formula α β = . e + f ρ 1 − ρ = 2e − f 3 + e + f 3 ρ; the result is integral iff 3 divides e + f . Regarding Step 5, division by ρ (that is, multipli- cation by ρ2) permutes e + f ρ, (f − e) − eρ, −f + (e − f )ρ 6 in cyclic order. Examination of cases shows that exactly one of these is primary. Finally, the numerators in the exponent in Step 6 need only be computed mod 9. Williams and Holte gave this exponent in the equivalent form (2m + n)(c2 − 1)/3 − ncd/3. 4. A "Bad" Sequence of Input Pairs. Our goal is to construct a sequence of inputs for which the Williams-Holte algorithm needs nM (n) bit operations. Consider the recurrence relation ξ0 = −1, ξ1 = 2, ξn = 3ρξn−1 + ξn−2, n ≥ 2. This defines a sequence of 2-primary integers in Z[ρ], because all ξn are 2 mod 3, as can be proved by induction. The first few sequence elements are n ξn N (ξn) −1 0 1 2 1 4 −1 + 6ρ 2 43 −16 − 21ρ 3 361 62 + 21ρ 4 2983 −79 + 102ρ 5 24703 −244 − 522ρ 6 204652 1487 + 936ρ 7 1695433 −3052 + 1131ρ 8 14045677 9 −1906 − 11613ρ 116360227 31787 + 30252ρ 963976549 10 We now show that these grow rapidly. The characteristic polynomial for the recurrence relation is with zeroes X 2 − 3ρX − 1, 3ρ ±p9ρ2 + 4 2 λ, µ = (9) . (Incidentally, λ 6∈ Q(ρ) since (9) is irreducible modulo any prime divisor of 19.) Numeri- cally, . = −1.7059 + 2.3182i, . = 0.2059 + 0.2798i, λ µ . = 2.8783, . = 0.3474. λ µ By the theory of linear recurrence relations, there are numbers A and B for which ξn = Aλn + Bµn. 7 (Numerically, A . = −0.5331 + 0.6442i.) For large n the second term is insignificant, and we have . = −0.4669 − 0.6442i, B log(N (ξn)) ∼ n log(N (λ)) . = 2.1144n. So, in norm, the length of ξn grows linearly, and the number of recursive calls for the algorithm on the inputs ξn, ξn−1 is n. We now show that applying the algorithm with α = ξn and β = ξn−1 is tantamount to running the recurrence backwards. Observe first that if a + bρ = x + yi, we have a = x + b = y, 1 √3 2 √3 y. So for large n, ξn/ξn−1 ∼ λ . = −0.3675 + 2.6769ρ, which rounds to 3ρ. (Apparently n ≥ 3 is large enough.) Therefore, the algorithm will produce for the next stage. If ξn = an + bnρ, it can be shown that the vector γ = ξn − 3ρξn−1 = ξn−2 vn = (cid:18) an bn(cid:19) satisfies the recurrence vn = M vn−1 + vn−2, where M is a 2 × 2 matrix. The question of the lengths of an and bn is more delicate, as they don't always increase. This is already apparent from the indicated values. To get around this problem, we note that when N (a + bρ) is large, at least one of a or b is large. Indeed, by (1), a2 + b2 ≥ 2 3 N (a + bρ), so max{a, b} ≥ (N (a + bρ)/3)1/2 . (10) Suppose we implement the Williams-Holte algorithm by first computing an exact fractional quotient α ¯β/N (β), using the usual norm formula. If the inputs are ξn, ξn−1, just computing the denominators alone will use Θ(n) multiplications in Z[ρ], of numbers whose norms decrease geometrically over time. At the halfway point, we must still square a integer whose length is Ω(n), by (10). Since (7) implies M (n/c) ≥ M (n)/c2, we have already used Ω(nM (n)) bops by this point. In particular, with standard arithmetic, the worst-case bit complexity of the algorithm is cubic: on the inputs α, β it is Θ(lg N (αβ))3. 8 Instead of the standard norm formula, we could use others, such as (a − b)2 + ab or ((2a − b)2 + 3b2)/4. However, any reasonable alternative would lead us to the same conclusion. Let us restrict attention to algorithms that compute the norm as 1 s k Xi=1 (tia + uib)(via + wib) where s, t1, . . . , wk are fixed integers. (Algebraic complexity theory supports this choice [27, §IIIc].) If ℓ = max{lg a, lg b}, then lg (tia + uib), lg (tia + uib) ≤ ℓ + O(1). On the other hand, lg (N (a + bρ)) ≥ 2ℓ − O(1), by (1). We must multiply at least one pair of integers whose lengths are ≥ ℓ/2, for if not, the sum on the right hand side would have length ≤ 3ℓ/2 + O(1), and this would still hold after division by s. (Recall that k is fixed.) Since M (ℓ/2) ≥ M (ℓ)/4, this is Ω(M (ℓ)) bops. Incidentally, the minimum value of k is 2. To see this, observe that any one- multiplication algorithm that yields a2 − ab + b2 could be normalized into (a + ub)(a + wb), with u, w ∈ Q. This forces uw = 1, u + w = −1, which is a system with no real solutions. 5. A Quadratic Bit Complexity Bound. This section provides a complete analysis for the the bit complexity of an approximate- division version of the Williams-Holte algorithm. Many of the techniques we use reflect previous analyses of Euclidean gcd algorithms, so the quadratic bit complexity bound is probably a "folk theorem." Nevertheless, we thought it worthwhile to record a proof, because no reference known to us does this. Let us first review the standard Newton iteration for computing β−1, where β is a nonzero complex number. This iteration is Suppose that ξ = (1 − ǫ)/β with ǫ < 1. Then ξ′ = ξ(2 − βξ). ξ′ = 1 − ǫ β (1 + ǫ) = 1 − ǫ2 β . By induction, the i-th iterate will be ξi = 1 − ǫ2i β . (The starting value is denoted ξ0.) To obtain relative error ≤ 2−m, we need ǫ2i which we can solve to obtain ≤ 2−m, i ≥ log m − log log ǫ−1. 9 (Here, the logs are binary.) With the usual expedient of doubling the precision at each step, this will require O(M (m)) bops. Here we are assuming that ǫ belongs to a compact subset of the unit interval (0, 1); the implied constant will depend on this subset. We now consider a particular starting point. Let β = c + dρ be a nonzero Eisenstein integer. Then, there are r, s making 2r−1 ≤ c < 2r and 2s−1 ≤ d < 2s. (If c = 0 we take r = −∞, and similarly for d.) In Q(ρ), the exact inverse is β−1 = c − d N (β) − d N (β) ρ. Then, with e = 2 max{r, s} + 2, the starting point ξ0 = c − d 2e − d 2e ρ satisfies ξ0 = ηβ−1 with 1/32 ≤ η ≤ 3/4. (To prove this, observe that (c2 + d2)/2 ≤ 22 max{r,s} ≤ 4(c2 + d2), and then use (1) to get (4/3)N (β) ≤ 2e ≤ 32N (β).) Since ǫ = 1 − η, this implies 1/4 ≤ ǫ ≤ 31/32. We now consider the bit complexity of long division. Let us argue informally. The coefficients of any number in Q(ρ) can be written in base 2, and if these parts are aligned, each bit pair can be chosen in four possible ways. Thus, 35/2 + 3ρ, equal to 1001.1 + 11ρ in base 2, becomes ( 1 0 ) . . ., or, using a straightforward encoding, 2013.200 · · · . of β, have the representations: Let α, β ∈ Z[ρ] be the inputs for long division. Let these, along with the exact inverse 1 ).( 1 0 )( 0 0 )( 0 1 )( 1 0 )( 0 0 )( 0 . { m digits z ∗ ∗ · · · ∗ ∗∗ ∗ ∗ · · · } k digits α = β = β−1 = ℓ digits { { z ∗ ∗ ∗ ∗ ∗ ∗ · · · ∗ ∗∗ .000 · · · } z ∗ ∗ ∗ · · · ∗ ∗∗ .000 · · · } ℓ digits { z 000 · · · 000 } . Since the quotient is 0 if k < ℓ, we can assume ℓ ≤ k. To obtain the rounded quotient, numerical inversion of β must deliver m = k − ℓ + O(1) digits past the leading ℓ 0's. For Newton's method with precision doubling, as indicated above, this uses O(M (m)) bops. Multiplying this approximate inverse by α and then rounding the result to q uses O(M (m, k)) bops. (One can show that if the error in each computed coefficient of αβ−1 is ≤ δ, the constant in (2) is increased only slightly, to 3/4 + 3δ + O(δ2).) Finally, we obtain qβ with O(M (m, ℓ)) bops. This totals to O(M (k, m) + M (m) + M (ℓ, m)) (11) There is one further subtraction to produce γ, which we will ignore since it will use no more work than any bound we prove. 10 For standard arithmetic, M (m, n) = O(mn) so (11) becomes O(km + (m + ℓ)m) = O(km) = O(lg N (α)lg N (q)). (12) As a worst-case bound, this is not impressive, since the quotient could be almost as long as the dividend. However, for a Jacobi symbol calculation, not all quotients can be large. This makes it useful to have the quotient length as a factor. Our final goal in this section is a quadratic bit complexity bound for the Williams-Holte algorithm, with long division implemented in the above manner. This will be achieved using only standard arithmetic. As we will see this bound cannot be improved. Since the norms can be compared within our time bound, we will assume that N (α) ≥ N (β). By (2) the maximum recursion depth t (from (8)) is O(lg N (β)). Now we consider each part of the algorithm separately. First, we consider the work for long division (Step 3). We first note that log(x + 1) ≤ log(x) + 1 (13) (binary logs), provided that x ≥ 1. This can be proved by comparing derivatives. Using (12), the number of bops in the long divisions is at most a constant times t Xi=1 lg N (αi)lg N (qi) ≤ lg N (α) t (2 log αi/βi + 3) ≤ lg N (α) ≤ lg N (α)(2 logα1/βt + 3t) = O(lg N (α))2, (2 log qi + 1) Xi=1 Xi=1 t using the triangle inequality and (13). Next we consider Step 4. Let us call a division by 1 − ρ successful if the quotient is integral, and unsuccessful if it is not. There are ≤ t unsuccessful divisions, and since N (1 − ρ) > 1, O(lg N (β)) successful ones. The work for each such division is linear, so Step 4 accounts for O(lg N (β))2 bops. The same is true of Step 5, since each invocation of it uses O(lg N (β)) bops. Finally, for Step 6, we assume c and d are reduced mod 9 before computing the exponent. This uses O(lg N (β)) bops. The multiplier n is bounded, and it is simplest conceptually to imagine multiplication by m as repeated addition, since the sum of all such multipliers is O(lg N (β)). Then, Step 6 will account for O(lg N (β))2 bops. Adding the last four bounds and using N (β) ≤ N (α) gives us O(lg N (α))2, as claimed. To end this section, we point out that the quadratic bit complexity estimate is best possible for this algorithm. Indeed, it holds for any varition of it that computes sufficiently accurate quotients. To see this, suppose the inputs are α = ξn and β = ξn−1, as defined in Section 4. The ratio of two successive ξi's is about −0.37 + 2.7ρ. If their quotient is computed accurately enough, there will be no ambiguity about the rounded coefficients, 11 since the rounding can only have more than one possible result if a coefficient is an integer multiple of 1/2. Therefore, the approximate-quotient algorithm will "track" the exact algorithm for all but the last few steps (and produce primary remainders). Just to write down the successive remainders will require Ω(lg N (α))2 bops. Assuming Step 4 searches by incrementing m, we can can also force a linear number of divisions here, by choosing α = 3m + (1 − ρ)m + 1 and β = 3m + 1, which is primary. Then, α/β = 1 + (1 − ρ)m/(3m + 1) which rounds to 1 since (1 − ρ)m/(3m + 1) < 3−m/2. At the top level, the number of divisions by 1 − ρ in Step 4 will be m + 1, with the last (unsuccessful) one leaving γ′′ = 1. With these inputs (at least with binary representation), Step 4 alone would consume Ω(lg N (α))2 bops. 6. Cubic Residue Tests. The reciprocity law suggests a procedure for determining if a ∈ Z is a cubic residue of the prime p ∈ Z [19]. We need only consider p ≡ 1 mod 3, and assume a is prime to p. The first step is to solve the norm equation for integers x, y. It is sufficient to solve the related equation p = x2 − xy + y2 p = s2 + 3t2 (15) (16) and then set x = s + t, y = 2t. To solve (16), we can first solve s2 + 3 ≡ 0 mod p, and then determine t from the ordinary continued fraction expansion for s/p. See [25, p. 366] for details of this. Using standard algorithms for the square root mod p, the bit complexity of this is O(nM (n)); the expensive part is finding s. By (15), one of the prime ideals P lying above p is generated by π = x + ρy, which we can make primary if it is not already. The cubic Jacobi symbol (cid:0) a π(cid:1) is 1 iff a is a cubic residue mod p. Whether this beats Euler's criterion depends on several factors. If we test many a against one p, then the effort of computing π is, in effect, amortized over the sequence of a's. So the procedure is definitely worth using, once we have about log p values of a. For a "one-off" cubic residue test, Euler's criterion should be used, since all the most efficient algorithms to find square roots mod p use exponentiation anyway. Before digital computers, however, quadratic partitions such (16) were systematically tabulated. (Jacobi seems to have been the first to do this; see the 1846 version of [15].) With this representation of p in hand, the advantage then shifts to the cubic Jacobi algorithm, assuming long division is implemented efficiently. As an aside, we note that for p ≡ 1 mod 3, finding √−3 mod p reduces to solving the norm equation for p. For, suppose we know integers x, y making x2 − xy + y2 = p. Then we have 2 (cid:19)2 (cid:18) x + y + 3(cid:18) x − y 2 (cid:19)2 = p, so that z = x + y x − y 12 is a square root of −3 mod p. The denominator cannot vanish mod p; if it did, then from (x − y)x + y2 = p we could conclude p y2 and then py, which contradicts x2 + y2 ≤ 2N (x + ρy) = 2p (a consequence of (1)). We end this section with a few remarks on the tabulation and computation of solutions to (16). By 1925, Cunningham had tabulated the (essentially unique) solutions for all eligible primes up to p = 125683. Lehmer's 1941 survey of number-theoretic tables [17] mentioned nothing better, so this record likely still stood at the dawn of the computer age. It is not clear to us if anyone went further, but it is worth noting that a list for all such p up to N could be made, in amortized polynomial time, by looping through all positive x ≤ √N and y ≤ pN/3, combining their squares, sorting to remove duplicates, and then comparing to a list of primes, obtained from the sieve of Eratosthenes. 7. The Quartic Jacobi Symbol. The results we have proved generalize to testing for fourth powers in finite fields. Since the arguments are so similar, we will be brief. The ring of Gaussian integers is Z[i]; this is a principal ideal domain with units ±1, ±i. Here, the norm coincides with the square of Euclidean length: N (a + bi) = a2 + b2. Again, we have division with remainder: (2) still holds, but with 3/4 replaced by 1/2 [13, p. 12]. Only p = 2 is ramified; primes p ≡ 1 mod 4 are split and primes p ≡ 1 mod 4 are inert. When P 6= (1 + i) is a prime ideal, the quartic character is defined by the condition P(cid:17) ≡ α(NP −1)/4 mod P ; (cid:16) α we define a Jacobi symbol for Z[i] just as before. mod 4 [13, p. 121]. Finally, primary means ≡ 1 mod (1 + i)3. Then, a + bi is primary iff 2 b and a + b ≡ 1 The replacements for (3)–(6) are as follows. Let α = a + bi and β = c + di be primary. Then and (17) (cid:18) α β(cid:19) = (−1)(a−1)(c−1)/4(cid:18) β α(cid:19), β (cid:19) = i(c−d−d2−1)/4, (cid:18) 1 + i (cid:18) i β(cid:19) = i−(c−1)/2, (cid:18)−1 β (cid:19) = (−1)(c−1)/2. See Halter-Koch [12, §7.3-7.4] for proofs. A quartic Jacobi symbol algorithm, entirely analogous to the cubic one in Section 3 (including the possibility that gcd(α, β) 6= 1) was given by Eisenstein in 1844 [9, §10]. For compatibility with Section 3, we express the division step as (20) (19) (18) α = qβ + γ = qβ + (1 + i)minγ′′, 13 where N (γ) ≤ N (β)/2 and γ′′ = e′′ + f ′′i is primary. The algorithm of Section 3 can then be modified as follows. Step 1 should return 1 on the condition that β = 1 or α = 1. Steps 4 and 5 are the same, but with 1 − ρ and ρ replaced by 1 + i and i, where 0 ≤ n < 4. Finally, the recursion becomes β(cid:19) = im(c−d−d2−1)/4−n(c−1)/2(−1)(e′′−1)(c−1)/4(cid:18) β (cid:18) α γ′′(cid:19). As before, suppose that we compute q by computing α ¯β/N (β) exactly, and then rounding coefficients. Consider the sequence defined by the recurrence relation ξn = 2(i + 1)ξn−1+ξn−2, with initial conditions ξ0 = 1, ξ1 = 5. The dominant root of its characteristic . = 2.2720 + 1.7862i. This makes the sequence grow rapidly, and for large n, the coordinatewise nearest Gaussian integer to ξn/ξn−1 is 2 + 2i. Therefore, arguing as we did in Section 4, Eisenstein's algorithm will use Ω(nM (n)) bops in the worst case. polynomial X 2 − 2(i + 1)X − 1 is (i + 1) + √2i + 1 As we did for the cubic algorithm, we can obtain a quadratic bit-complexity bound with standard arithmetic by using Newton iteration to determine quotients for long divi- sion. Our starting point for inverting β = c + di is ξ0 = c 2e − d 2e i, where e is defined from c and d just as in Section 5. As before, 2N (β) ≤ 2e ≤ 16N (β), which gives 1/2 ≤ ǫ ≤ 15/16. Again, a quadratic bound on bops is best possible for Eisenstein's quartic algorithm. Finally, all of the conclusions in Section 6 hold true for testing quartic residues modulo primes p ≡ 1 mod 4. In particular, we can reduce computing √−1 mod p to solving the Diophantine equation p = x2 + y2 by observing that in such a representation, p divides neither x nor y. So (y/x)2 ≡ −1 8. Generalizing the Even-Quotient Algorithm. The method most commonly presented in textbooks for computing the Jacobi symbol in Z could be called an even-to-odd remainder algorithm, because a maximal power of 2 is removed from the remainder before the recursive call. There is another algorithm, published by Eisenstein in [7], in which the quotients are even. This algorithm uses division steps of the form α = qβ + γ, in which q is even, γ < β, and γ is odd. Eisenstein called it a "simpler" algorithm, but it is actually more complex, as far as worst-case behavior is concerned. In particular, when applied to consecutive odd numbers, the number of division steps is exponential in bit length [21, p. 608]. The even-quotient idea generalizes to both cubic and quartic symbols. The cubic version seems not to have been discussed before, so we treat that first. Let N (β) > 1. Then, if α is any other element of Z[ρ], we can find a q, divisible by 1 − ρ, for which α = qβ + γ, N (γ) < N (β). 14 To prove this, consider a nonzero ζ ∈ Q(ρ). We want to write ζ = q + ω with q ≡ 0 mod 1 − ρ and ω < 1. Form q in the usual way, by rounding coefficients of ζ to nearest integers. This makes ω < 1. If q is not divisible by 1− ρ, consider choosing a sixth root of unity ǫ and replacing q by q + ǫ. As we go around the unit circle, the sixth roots of unity, reduced mod 1 − ρ, alternate between 1 and 2. Therefore, three of the choices for ǫ will make q divisible by 1−ρ. Let the new remainder be ω′ = ω−ǫ. We now show that ω′ < 1 is still possible. If the angle θ = arg ω lies between 0 and π/3, we have ω − 1 < 1. (To see this, observe that there are two congruent equilateral triangles, with vertices 0, 1, −ρ2 and −1, 0, ρ.) By symmetry, we also have ω − (−ρ2) < 1. The same argument can be made for each of the other five sectors. The desired result then follows upon taking ζ = α/β. A cubic analog to Eisenstein's even-quotient algorithm can then be defined so as to use (8), but with all qi ≡ 0 mod 1 − ρ, and all mi = 0. (That is, the division in Step 3 has an additional constraint, and Step 4 is deleted from the algorithm.) Just as for the algorithm in Z, the worst-case bit complexity is exponential. As far as we know, this is not easy to discover by manipulating formulas. (Some fruitless effort went into this quest.) Instead, we turned to the "tools of ignorance." After implementing the algorithm in Maple, we ran it on all possible input coefficients in [0, 10]. Keeping track of "record values" for the number of iterations revealed that for α = (3k + 2)ρ, and β = 1 + (3k + 3)ρ, the number of iterations is 4k + 3. For these inputs, the bit length n is ∼ 2 log2 k, making the number of iterations about 2n/2. iterations, the algorithm settled into a repeating cycle of four quotients: To prove that our observation would always hold, we noted that after two "warmup" −2 − ρ, −1 − 2ρ, 2 + ρ, −2 − ρ. We then executed the algorithm symbolically, using Laurent series around k = 0 (that is, expansion in powers of 1/k) to guarantee that rounding would behave correctly for all sufficiently large k. Doing this verified that the observed number of iterations holds holds for all but a finite number of k, from which the exponential bit complexity follows. In 1859, Smith [22, p. 87] presented the analogous algorithm for computing quartic Jacobi symbols. He asserted without proof that the corresponding long division (i.e., with all quotients divisible by 1 − i) is possible. That can be proved with a similar argument; it is only necessary to observe that all powers of i are 1 mod i + 1, and then consider quarter-circular sectors with angles centered on multiples of π/2. It seems to have escaped notice that the worst-case bit complexity of this algorithm is also exponential. If we start with inputs 4m + 1, 4m − 3, there could be about m division steps, since 4m + 1 = 2(4m − 3) − (4m − 7). (Incidentally, this is also a bad example for Eisenstein's algorithm.) To be fair to Smith, he did point out that Eisenstein's version of the quartic algorithm "terminates more rapidly" than his did, but without making this quantitative. Acknowledgments. The authors were supported by the National Science Foundation (CCF-1420750). 15 References. 1. A. V. Aho, J. E. Hopcroft, and J. D. Ullman, The Design and Analysis of Computer Algorithms, Addison-Wesley, 1974. 2. W. Bosma, Cubic reciprocity and explicit primality tests for h · 3k ± 1, in A. van der Poorten, A. Stein, eds., High Primes and Misdemeanours: Lectures in Honour of the 60th Birthday of Hugh Cowie Williams (Fields Institute Communications v. 41), AMS, 2004. 3. G. E. Collins, A fast Euclidean algorithm for Gaussian integers, J. Symbolic Comput. 33, 385-392, 2002. 4. M. J. Collison, The origins of the cubic and biquadratic reciprocity laws, Arch. Hist. Exact Sci., v. 17, pp. 63-69, 1977. 5. I. B. Damgard and G. S. Frandsen, Efficient algorithms for the gcd and cubic residu- osity in the ring of Eisenstein integers, J. Symbol. Comput. 39, 643-652, 2005. 6. G. Eisenstein, Beweis des Reciprocitatssatzes fur die cubischen Reste in der Theorie der aus dritten Wurzeln der Einheit zusammengesetzen complexen Zahlen, J. reine angew. Math. 27, 289-310, 1844. 7. G. Eisenstein, Einfacher Algorithmus zur Bestimmung des Werthes von (cid:0) a angew. Math. 27, 317-318, 1844. b(cid:1), J. reine 8. G. Eisenstein, Nachtrag zum cubischen Reciprocitatssatze fur die aus dritten Wurzeln der Einheit zusammengesetzen complexen Zahlen. Criterien des cubischen Characters der Zahl 3 und ihrer Theiler, J. reine angew. Math. 28, 28-35, 1844. 9. G. Eisenstein, Einfacher Beweis un Verallgemeinerung des Fundamentaltheorems fur die biquadratischen Reste, J. reine angew. Math. 28, 223-245, 1844. 10. G. Frei, The reciprocity law from Euler to Eisenstein, in S. Chikara, S. Mitsuo, and J. W. Dauben, eds., The Intersection of History and Mathematics, Birkhauser, 1994. 11. C.F. Gauss, Theorematis fundamentalis in doctrina de residuis quadraticis demonstra- tiones et ampliationes novae, Comment. Soc. Reg. Sci. Gottingensis 4, 1816-1818. Presented to the society Feb. 10, 1817. [German translation: Neue Beweise und Er- weiterungen des Fundamentalsatzes in der Lehre von den quadratischen Resten, in C.F. Gauss, Untersuchen uber Hohere Arithmetik, ed. H. Maser, New York: Chelsea, 1965, pp. 496-510.] 12. F. Halter-Koch, Quadratic Irrationals: An Introduction to Classical Number Theory, CRC Press, 2013. 13. K. Ireland and M. Rosen, A Classical Introduction to Modern Number Theory, Springer-Verlag, 1982. 14. C. G. J. Jacobi, Vorlesungen uber Zahlentheorie (Wintersemester 1836/37, Konigsberg), ed. F. Lemmermeyer and H. Pieper, Erwin Rauner Verlag, Augsburg, 2007. 15. C. G. J. Jacobi, Uber die Kriestheilung und ihre Anwendung auf die Zahlentheorie, Bericht uber die zur Bekanntmachung geeigneten Verhandlungen der Konigl. Preuss. Akademie der Wissenschaften zu Berlin, pp. 127-136, 1837. Reprinted with comments and numerical tables in J. Reine angew. Math., v. 30, 166-182, 1846. 16. E. Kaltofen and H. Rolletschek, Computing greatest common divisors and factoriza- tions in quadratic number fields, Math. Comp. 53, 697-720, 1989. 16 17. D. H. Lehmer, Guide to Tables in the Theory of Numbers, National Academy of Sciences, Washington, 1941. 18. F. Lemmermeyer, Reciprocity Laws: From Euler to Eisenstein, Springer-Verlag, 2000, 19. S. Muller, On the computation of cube roots mod p, in A. van der Poorten, A. Stein, eds., High Primes and Misdemeanours: Lectures in Honour of the 60th Birthday of Hugh Cowie Williams (Fields Institute Communications v. 41), AMS, 2004. 20. R. Scheidler and H. C. Williams, A public-key cryptosystem utilizing cyclotomic fields, Designs, Codes, and Cryptography 6, 117-131 (1995). 21. J. O. Shallit, On the worst case of three algorithms for computing the Jacobi symbol, J. Symbol. Comput. 10, 593-610 (1990). 22. H. J. S. Smith, Report on the Theory of Numbers, Part I, Report of the British Association for 1859, pp. 228-267. Parts I-VI reprinted as H. J. S. Smith, Report on the Theory of Numbers, Chelsea, New York, 1965. 23. A. Weilert, Fast computation of the biquadratic residue symbol, J. Number Theory 96, 133-151, 1992. 24. D. Wikstrom, On the ℓ-ary GCD algorithm and computing residue symbols, KTH (Stockholm) report TRITA NA 04-39, May 2004. 25. H. C. Williams, An M 3 public-key encryption scheme, Proc. CRYPTO 85, LNCS 218, pp. 358-368 (1986). 26. H. C. Williams and R. C. Holte, Computation of the solution of x3 + Dy3 = 1, Math. Comp. 31, 778-785 (1977). 27. S. Winograd, Arithmetic Complexity of Computations, SIAM, 1980. 17
1409.2116
2
1409
2015-02-04T17:34:20
Smart Sampling for Lightweight Verification of Markov Decision Processes
[ "cs.DS" ]
Markov decision processes (MDP) are useful to model optimisation problems in concurrent systems. To verify MDPs with efficient Monte Carlo techniques requires that their nondeterminism be resolved by a scheduler. Recent work has introduced the elements of lightweight techniques to sample directly from scheduler space, but finding optimal schedulers by simple sampling may be inefficient. Here we describe "smart" sampling algorithms that can make substantial improvements in performance.
cs.DS
cs
Smart Sampling for Lightweight Verification of Markov Decision Processes Pedro D'Argenio∗, Axel Legay†, Sean Sedwards† and Louis-Marie Traonouez† ∗Universidad Nacional de C´ordoba, Argentina, and †Inria Rennes -- Bretagne Atlantique, France 5 1 0 2 b e F 4 ] S D . s c [ 2 v 6 1 1 2 . 9 0 4 1 : v i X r a Abstract -- Markov decision processes (MDP) are useful to model optimisation problems in concurrent systems. To verify MDPs with efficient Monte Carlo techniques requires that their nondeterminism be resolved by a scheduler. Recent work has introduced the elements of lightweight techniques to sample directly from scheduler space, but finding optimal schedulers by simple sampling may be inefficient. Here we describe "smart" sampling algorithms that can make substantial improvements in performance. I. INTRODUCTION Markov decision processes describe systems that interleave nondeterministic actions and probabilistic transitions. This model has proved useful in many real optimisation problems [27], [28], [29] and may be used to represent concurrent probabilistic programs (see, e.g., [3], [1]). Such models com- prise probabilistic subsystems whose transitions depend on the states of the other subsystems, while the order in which concurrently enabled transitions execute is nondeterministic. This order may radically affect the behaviour of a system and it is thus useful to calculate the upper and lower bounds of quantitative aspects of performance. As an example, consider the network of computational nodes depicted in Fig. 1 (relating to the case study in Section VI-D). Given that one of the nodes is infected by a virus, we would like to calculate the probability that a target node becomes infected. If we know the probability that the virus will pass from one node to the next, we could model the system as a discrete time Markov chain and analyse it to find the probability that any particular node will become infected. Such a model ignores the possibility that the virus might actually choose which node to infect, e.g., to maximise its probability of passing through the barrier layer. Under such circumstances some nodes might be infected with near certainty or with only very low probability, but this would not be adequately captured by the Markov chain. By modelling the virus's choice of node as a nondeterministic transition in an MDP, the maximum and minimum probabilities of infection can be considered. Fig. 2 shows a typical fragment of an MDP. Its execution semantics are as follows. In a given state (s0), an action (a1, a2, . . . ) is chosen nondeterministically to select a distri- bution of probabilistic transitions (p1, p2, . . . or p3, p4, etc.). A probabilistic choice is then made to select the next state (s1, s2, s3, s4, . . . ). In this work we use the term scheduler to refer to a particular way the nondeterminism in an MDP is resolved. Classic analysis of MDPs is concerned with finding the target barrier layer infected s0 a1 a2 p1 s1 p2 s2 p3 s3 p4 s4 Figure 1: Model of network virus infection. Figure 2: Fragment of a Markov decision process. expected maximum or minimum reward for an execution of the system, given individual rewards assigned to each of the actions [2], [25]. Rewards may also be assigned to states or transitions between states [16]. In this work we focus on MDPs in the context of model checking concurrent probabilistic systems, to find schedulers that maximise or minimise the probability of a property. Model checking is an automatic technique to verify that a system satisfies a property specified in temporal logic [7]. Probabilistic model checking quantifies the probability that a probabilistic system will satisfy a prop- erty [9]. Numerical model checking algorithms to solve purely probabilistic systems are costly in time and space. Finding extremal probabilities in MDPs is generally more so, but is nevertheless a polynomial function of the explicit description of the MDP [3]. Statistical model checking (SMC) describes a collection of Monte Carlo sampling techniques that make probabilistic model checking more tractable by returning approximative results with statistical confidence [31]. Recent approaches to apply SMC to MDPs [4], [21], [11], [10], [22] are memory- intensive and do not fully address the nondeterministic model checking problem. Classic sampling approaches for MDPs, such as the Kearns algorithm [14], address a related but different problem. In [22] This work extends [22]. the authors provide sampling techniques that can form the basis of memory- efficient ("lightweight") verification of MDPs. The principal contributions of [22] are (i) specifying the infinite behaviour of history-dependent or memoryless schedulers using O(1) memory, (ii) sampling directly and uniformly from scheduler space, and (iii) quantifying the statistical confidence of mul- tiple estimates or multiple hypothesis tests. As in the case of standard SMC, sampling makes the verification problem independent of the size of the space of samples, with a convergence to the correct result almost surely guaranteed with an infinite number of samples. The use of lightweight techniques opens up the possibility to efficiently distribute the problem on high performance massively parallel architectures, such as general purpose computing on graphics processing units (GPGPU). Sampling schedulers makes a significant advance over mere enumeration. For example, suppose half of all schedulers for a given MDP and property are 'near optimal', i.e., have a probability of satisfying the property that is deemed adequately close to the true optimum. If all such near optimal schedulers lie in the second half of the enumeration, it will be necessary to enumerate half of all schedulers before finding one that is near optimal. In contrast, one would expect to see a near optimal scheduler after just two random selections, i.e., the expectation with two samples is one. This phenomenon is not limited to the case when schedulers are pathologically distributed with respect to the enumeration. Since the total number of schedulers increases exponentially with path length (the number of history-dependent schedulers increases doubly exponentially with states and path length), the total number of schedulers is usually very large. Hence, even when near optimal schedulers are more uniformly distributed with re- spect to the enumeration, it is typically not tractable to use enumeration to find one. Note that sampling also works with non-denumerable spaces. The cost of finding a near optimal scheduler with sampling is simply proportional to the relative mass of near optimal schedulers in scheduler space. Our experiments with standard case studies suggest that this cost is typically reasonable. It was demonstrated in [22] that simple undirected sampling may be adequate for some case studies. In this work we present "smart sampling" algorithms that make significantly better use of a simulation budget. For a given number of candidate schedulers, smart sampling can reduce the simulation cost of extremal probability estimation by more than N/⌈2+log2 N⌉, where N is the minimum number of simulations necessary to achieve the required statistical confidence, as given by (1). The basic notions of smart sampling were hinted at in [22]. Simply put, a small part of the budget is used to perform an initial assessment of the problem and to generate an optimal candidate set of schedulers. The remaining budget is used to test and refine the candidate set: sub-optimal schedulers are removed and their budget is re-allocated to good ones. Here we give a full exposition of smart sampling and explain its limitations. We have implemented the algorithms in our stat- istical model checking platform, PLASMA1, and demonstrate their successful application to a number of case studies from the literature. We include some examples that are intractable to numerical techniques and compare the performance of our techniques with an alternative sampling approach [11]. We also give an example where smart sampling is less effective, but show that the results may nevertheless be useful in bounding the range of extremal probabilities. 1project.inria.fr/plasma-lab/ Structure of the Paper In Section II we introduce some basic concepts and notation necessary for the sequel. In Section III we briefly survey closely related work. In Sections IV we recall the basis of our lightweight verification techniques. In Section V we describe the notion of smart sampling and present our smart estimation and smart hypothesis testing algorithms. In Section VI we give the results of experiments with a number of case studies from the literature. In Section VII we discuss the limitations of smart sampling and in Section VIII we summarise the challenges and prospects for our approach. II. PRELIMINARIES Given an MDP with set of actions A, having a set of states S that induces a set of sequences of states Ω = S+, a history- dependent (general) scheduler is a function S : Ω → A. A memoryless scheduler is a function M : S → A. Intuitively, at each state in the course of an execution, a general scheduler (S) chooses an action based on the sequence of previous states and a memoryless scheduler (M) chooses an action based only on the current state. History-dependent schedulers therefore include memoryless schedulers. a1 p1 a2 p2 1 a0 1 − p1 = ¬ψ s0 Fig. 3 illustrates a simple MDP for which memoryless and history-dependent sched- ulers give different optima for the bounded temporal lo- gic property X(ψ ∧ XGt¬ψ) when p1 6= p2 and t > 0. The property makes use of the temporal operators next (X) and globally (G). Intuitively, the property states that on the next step ψ will be true and, on the step after that, ¬ψ will be remain true for t + 1 time steps. The property is satisfied by the sequence of states s0s1s0s0 ··· . If p1 > p2, the maximum probability for s0s1 is achieved with action a2, while the maximum probability for s0s0 is achieved with action a1. Given that both transitions start in the same state, a memoryless scheduler will not achieve the maximum probability achievable with a history-dependent scheduler. Figure 3: MDP with differ- ent optima for general and memoryless schedulers. s1 = ψ 1 − p2 Statistical Model Checking with PLASMA The algorithms we present here are implemented in our SMC platform PLASMA (Platform for Learning and Advanced Statistical Model checking Algorithms [5]). PLASMA is mod- ular, allowing new modelling languages, logics and algorithms to be plugged-in and take advantage of its graphical user interface, its integrated development environment and its abil- ity to correctly divide simulations on parallel computational architectures. We introduce here the basic features of SMC with PLASMA that are relevant to what follows. SMC algorithms work by constructing an automaton to accept only traces that satisfy a specified property. The state space of the system is not constructed explicitly -- states are generated on the fly during simulation -- hence SMC is efficient for large, possibly infinite state, systems. Moreover, since the simulations are required to be statistically independent, SMC may be efficiently divided on parallel computing architectures. The automaton may then be used to estimate the probability of the property or to decide an hypothesis about the probability. Typically, the probability p of property ϕ is estimated by the proportion of traces that individually satisfy it, i.e., p ≈ N PN 1(ωi = ϕ), where ω1, . . . , ωN are N independently generated simulation traces and 1(·) is an indicator function that corresponds to the output of the automaton: it returns 1 if the trace is accepted and 0 if it is not. As a statistical process, the results of SMC are given with probabilistic confidence. i=1 1 In the case of estimation, PLASMA calculates a priori the required number of simulations according to a Chernoff bound [24] that allows the user to specify an error ε and a probability δ that the estimate p will not lie outside the true value ±ε. Given that a system has true probability p of satisfying a property, the Chernoff bound ensures P( p − p ≥ ε) ≤ δ. Parameter δ is related to the number of simulations N by δ = 2e−2N ε2 [24], giving N = (cid:6)(ln 2 − ln δ)/(2ε2)(cid:7) . (1) In the case of hypothesis testing, PLASMA adopts the sequential probability ratio test (SPRT) of Wald [26] to test hypotheses of the form P(ω = ϕ) ⊲⊳ θ, where ⊲⊳∈ {≤,≥} and θ is a user-specified probability threshold. The number of simulations required to decide the test is typically fewer than (1) but is dependent on how close θ is to the true probability. The number is therefore not known in advance. To evaluate P(ω = ϕ) ⊲⊳ θ, the SPRT constructs hypotheses H 0 : P(ω = ϕ) ≥ p0 and H 1 : P(ω = ϕ) ≤ p1, where p0 = θ + ε and p1 = θ − ε for some user-defined interval specified by ε [26]. The SPRT also requires parameters α and β to specify, respectively, the maximum acceptable probabilities of incorrectly rejecting a true H0 and incorrectly accepting a false H0. To choose between H0 and H1, the SPRT defines the probability ratio ratio = n Y i=1 (p1)1(ωi=ϕ)(1 − p1)1(ωi6=ϕ) (p0)1(ωi=ϕ)(1 − p0)1(ωi6=ϕ) , where n is the number of simulation traces ωi, i ∈ {1, . . . , n}, generated so far. The test proceeds by performing a simulation and calculating ratio until one of two conditions is satisfied: H1 is accepted if ratio ≥ (1 − β)/α and H0 is accepted if ratio ≤ β/(1 − α). Parallelisation of SMC is conceptually simple with light- weight algorithms, but balancing the simulation load on unre- liable or heterogeneous computing devices must be achieved without introducing a "selection bias". The problem arises because simulation traces that satisfy a property will, in general, take a different time to generate than those which do not. If the SMC task is divided among a number of clients of different speed or reliability, a naive balancing approach will be biased in favour of results that are generated quickly. To overcome this phenomenon, PLASMA adopts the load balancing algorithm proposed in [30]. PLASMA's GUI facilitates easy parallelisation on ad hoc networked computers or on dedicated grids and clusters. The server application (an instance of PLASMA) starts the job and waits to be contacted by available clients (instances of PLASMA Service). Our estimation experiments in Section VI were distributed on the IGRIDA computing grid2. III. RELATED WORK The classic algorithms to solve MDPs are policy iteration and value iteration [25]. Model checking algorithms for MDPs may use value iteration applied to probabilities [1, Ch. 10] or solve the same problem using linear programming [3]. All consider history-dependent schedulers. The principal challenge of finding optimal schedulers is what has been described as the 'curse of dimensionality' [2] and the 'state explosion problem' [7]. In essence, these two terms refer to fact that the number of states of a system increases exponentially with respect to the number of interacting components and state variables. This phenomenon has motivated the design of lightweight sampling algorithms that find 'near optimal' schedulers to optimise rewards in discounted MDPs, but the standard model checking problem of finding extremal probabilities in non- discounted MDPs is significantly more challenging. Since nondeterministic and probabilistic choices are interleaved in an MDP, schedulers are typically of the same order of complexity as the system as a whole and may be infinite. As a result, previous SMC algorithms for MDPs have considered only memoryless schedulers or have other limitations. The Kearns algorithm [14] is the classic 'sparse sampling algorithm' for large, infinite horizon, discounted MDPs. It constructs a 'near optimal' scheduler by approximating the best action from a current state, using a stochastic depth-first search. Importantly, optimality is with respect to discounted rewards, not probability. The algorithm can work with large, potentially infinite state MDPs because it explores a probabil- istically bounded search space. This, however, is exponential in the discount. To find the action with the greatest expected reward in the current state of a trace, the algorithm recursively estimates the rewards of successor states, up to some max- imum depth defined by the discount and desired error. Actions are enumerated while probabilistic choices are explored by sampling, with the number of samples set as a parameter. The discount guarantees that the algorithm eventually converges. The stopping criterion is when successive estimates differ by less than some error threshold. Since the actions of a state are re-evaluated every time the state is visited (because actions are history-dependent), the performance of the Kearns algorithm is critically dependent on its parameters. There have been several recent attempts to apply SMC to nondeterministic models [4], [21], [11], [10], [22]. In [4], [10] the authors present on-the-fly algorithms to remove 2igrida.gforge.inria.fr 'spurious' nondeterminism, so that standard SMC may be used. This approach is limited to the class of models whose nondeterminism does not affect the resulting probability of a property. The algorithms therefore do not attempt to address the standard MDP model checking problems related to finding optimal schedulers. In [21] the authors first find a memoryless scheduler that is near optimal with respect to a reward scheme and discount, using an adaptation of the Kearns algorithm. This induces a Markov chain whose properties may be verified with standard SMC. By storing and re-using the choices in visited states, the algorithm improves on the performance of the Kearns algorithm, but is thus limited to tractable memoryless sched- ulers. The near optimality of the induced Markov chain is with respect to rewards, not probability, hence [21] does not address the standard model checking problems of MDPs. In [11] the authors present an SMC algorithm to decide whether there exists a memoryless scheduler for a given MDP, such that the probability of a property is above a given threshold. The algorithm has an inner loop that generates candidate schedulers by iteratively improving a probabilistic scheduler, according to sample traces that satisfy the property. The algorithm is limited to memoryless schedulers because the improvement process learns by counting state-action pairs. The outer loop tests the candidate scheduler against the hypothesis using SMC and is iterated until an example is found or sufficient attempts have been made. The approach has several problems. The inner loop does not in general converge to the true optimum (the number of state-actions does not actually indicate scheduler probability), but is sometimes successful because the outer loop randomly explores local maxima. This makes the number of samples used by the inner loop critical: too many may reduce the randomness of the outer loop's exploration and thus significantly reduce the probability of finding examples. A further problem is that the repeated hypothesis tests of the outer loop will eventually produce erroneous results. The present work builds on the elements of lightweight verification for MDPs introduced in [22]. In [22] the authors use an incremental hash function and a pseudo-random number generator to define history-dependent schedulers using only O(1) memory. This allows the schedulers to be selected at random and tested individually, thus facilitating Monte Carlo algorithms that are indifferent to the size of the sample space. The full details of these techniques are described in Section IV. IV. LIGHTWEIGHT VERIFICATION OF MDPS In this section we recall the elemental sampling techniques of [22]. Storing schedulers as explicit mappings does not scale, so we represent schedulers using uniform pseudo-random number generators (PRNG) that are initialised by a seed and iterated to generate the next pseudo-random value. In general, such PRNGs aim to ensure that arbitrary subsets of sequences of iterates are uniformly distributed and that consecutive iterates are statistically independent. PRNGs are commonly used to implement the uniform probabilistic scheduler, which chooses actions uniformly at random and thus explores all possible combinations of nondeterministic choices. Executing such an implementation twice with the same seed will produce identical traces. Executing the implementation with a different seed will produce an unrelated set of choices: individual schedulers cannot be identified, so it is not possible to estimate the probability of a property under a specific scheduler. We use a PRNG to resolve nondeterministic choices, but not to make those choices probabilistically. We use the PRNG to range over the possible choices, such that repeated scheduler samplings will eventually consider all possible sequences of actions. We also rely on the fact that the seed of a PRNG uniquely defines the sequence of pseudo-random values. Hence, in contrast to the uniform probabilistic scheduler, actions are consistent between simulations. An apparently plausible solution is to use independent PRNGs to resolve nondeterministic and probabilistic choices. It is then possible to generate multiple probabilistic simulation traces per scheduler by keeping the seed of the PRNG for nondeterministic choices fixed while choosing random seeds for a separate PRNG for probabilistic choices. Unfortunately, the schedulers generated by this approach do not span the full range of general or even memoryless schedulers. Since the sequence of iterates from the PRNG used for nondeterministic choices will be the same for all instantiations of the PRNG used for probabilistic choices, the ith iterate of the PRNG for nondeterministic choices will always be the same, regardless of the state arrived at by the previous probabilistic choices. The ith chosen action can be neither state nor trace dependent, as required by memoryless (M) and history-dependent (S) schedulers, respectively. A. General Schedulers Using Hash Functions We therefore construct a per-step PRNG seed that is a hash of the integer identifying a specific scheduler concatenated with an integer representing the sequence of states up to the present. is represented by a number of bits bi, We assume that a state of an MDP is an assignment of values to a vector of system variables vi, i ∈ {1, . . . , n}. Each vi typically corresponding to a primitive data type (int, float, double, etc.). The state can thus be represented by the concatenation of the bits of the system variables, such that a sequence of states may be represented by the concatenation of the bits of all the states. Without loss of generality, we interpret such a sequence of states as an integer of Pn i=1 bi bits, denoted s, and refer to this in general as the trace vector. A scheduler is denoted by an integer σ, which is concatenated to s (denoted σ : s) to uniquely identify a trace and a scheduler. Our approach is to generate a hash code h = H(σ : s) and to use h as the seed of a PRNG that resolves the next nondeterministic choice. The hash function H thus maps σ : s to a seed that is deterministically dependent on the trace and the scheduler. The PRNG maps the seed to a value that is uniformly distributed but nevertheless deterministically dependent on the trace and the scheduler. In this way we approximate the schedulers functions S and M described in Section II. Importantly, the technique only relies on the standard properties of hash functions and PRNGs. Algorithm 1 is the basic simulation function used by our algorithms. Algorithm 1: Simulate Input: M: an MDP with initial state s0 ϕ: a property σ: an integer identifying a scheduler Output: ω: a simulation trace 1 Let Uprob,Unondet be uniform PRNGs with respective samples rpr, rnd 2 Let H be a hash function 3 Let s denote a state, initialised s ← s0 4 Let ω denote a trace, initialised ω ← s 5 Let s be the trace vector, initially empty 6 Set seed of Uprob randomly 7 while ω = ϕ is not decided do s ← s : s Set seed of Unondet to H(σ : s) Iterate Unondet to generate rnd and use to resolve nondeterministic choice Iterate Uprob to generate rpr and use to resolve probabilistic choice Set s to the next state ω ← ω : s 8 9 10 11 12 13 B. An Efficient Iterative Hash Function To implement our approach, we use an efficient hash func- tion that constructs seeds incrementally. The function is based on modular division [15, Ch. 6], such that h = (σ : s) mod m, where m is a suitably large prime. Since s is a concatenation of states, is usually very much larger than the maximum size of integers supported as primitive data types. Hence, to generate h we use Horner's method [12][15, Ch. 4]: we set h0 = σ and find h ≡ hn (n as in Section IV-A) by iterating the recurrence relation it hi = (hi−12bi + vi) mod m. (2) The size of m defines the maximum number of different hash codes. The precise value of m controls how the hash codes are distributed. To avoid collisions, a simple heuristic is that m should be a large prime not close to a power of 2 [8, Ch. 11]. The number of schedulers is typically much larger than the number of possible hash codes, hence collisions are theoretically inevitable. This means that not all possible schedulers are realisable with a given hash function and PRNG. Since our chosen hash function and PRNG are drawn from respective families of hash functions and PRNGs that potentially span all schedulers, the problem of collisions can conceivably be addressed by also choosing the hash function and PRNG at random. A scheduler would then be defined by its label, its hash function and its PRNG. We do not implement this idea here to avoid unnecessary complication and because collisions are not the principal limitation. There are typically many orders of magnitude more seeds than we can test, hence the problem of finding the best available scheduler supersedes the problem that the best available scheduler may not be optimal. We anticipate that our proposed solutions to accelerate convergence (property-focused scheduler space and piecewise construction of schedulers) will effectively bypass the collision problem. In practical implementations it is an advantage to perform calculations using primitive data types that are native to the computational platform, so the sum in (2) should always be less than or equal to the maximum permissible value. To achieve this, given x, y, m ∈ N, we note the following congruences: (x + y) mod m ≡ (x mod m + y mod m) mod m (3) (xy) mod m ≡ ((x mod m)(y mod m)) mod m(4) The addition in (2) can thus be re-written in the form of (3), such that each term has a maximum value of m − 1: hi = ((hi−12bi ) mod m + (vi) mod m) mod m (5) To prevent overflow, m must be no greater than half the maximum possible integer. Re-writing the first term of (5) in the form of (4), we see that before taking the modulus it will have a maximum value of (m − 1)2, which will exceed the maximum possible integer. To avoid this, we take advantage of the fact that hi−1 is multiplied by a power of 2 and that m has been chosen to prevent overflow with addition. We thus apply the following recurrence relation: (hi−12j) mod m = (hi−12j−1) mod m + (hi−12j−1) mod m (6) Equation (6) allows our hash function to be implemented using efficient native arithmetic. Moreover, we infer from (2) that to find the hash code corresponding to the current state in a trace, we need only know the current state and the hash code from the previous step. When considering memoryless schedulers we need only know the current state. C. Hypothesis Testing Multiple Schedulers To decide whether there exists a scheduler such that P(ω = ϕ) ⊲⊳ p, we apply the SPRT to multiple (randomly chosen) schedulers. Since the probability of error with the SPRT applied to multiple hypotheses is cumulative, we consider the probability of no errors in any of M tests. Hence, in order to ensure overall error probabilities α and β, we adopt αM = 1 − M√1 − α and βM = 1 − M√1 − β in our stopping conditions. H1 is accepted if ratio ≥ (1−βM )/αM and H0 is accepted if ratio ≤ βM /(1 − αM ). Algorithm 2 demonstrates the sequential hypothesis test for multiple schedulers. If the algorithm finds an example, the hypothesis is true with at least the specified confidence. Algorithm 2: SPRT for multiple schedulers Input: M, ϕ: the MDP and property of interest H ∈ {H0, H1}: the hypothesis with interval θ ± ε α, β: the desired error probabilities of H M : the maximum number of schedulers to test Output: The result of the hypothesis test 1 Let p0 = θ + ε and p1 = θ − ε be the bounds of H 2 Let αM = 1 − M√1 − α and βM = 1 − M√1 − β 3 Let A = (1 − βM )/αM and B = βM /(1 − αM ) 4 Let Useed be a uniform PRNG and σ be its sample 5 for i ∈ {1, . . . , M} while H is not accepted do Iterate Useed to generate σi Let ratio = 1 while ratio > A ∧ ratio < B do ω ← Simulate(M, ϕ, σi) ratio ← (p1)1(ω=ϕ)(1−p1)1(ω6=ϕ) (p0)1(ω=ϕ)(1−p0)1(ω6=ϕ) ratio if ratio ≤ A ∧ H = H0 ∨ ratio ≥ B ∧ H = H1 then accept H 6 7 8 9 10 11 12 Algorithm 3: Estimation with multiple schedulers Input: M, ϕ: the MDP and property of interest ε, δ: the required Chernoff bound M : the number of schedulers to test Output: Extremal estimates pmin and pmax 1 Let N = (cid:6)ln(2/(1 − M√1 − δ ))/(2ε2)(cid:7) be the no. of simulations per scheduler 2 Let Useed be a uniform PRNG and σ its sample 3 Initialise pmin ← 1 and pmax ← 0 4 Set seed of Useed randomly 5 for i ∈ {1, . . . , M} do Iterate Useed to generate σi Let truecount = 0 be the initial number of traces that satisfy ϕ for j ∈ {1, . . . , N} do 6 7 ωj ← Simulate(M, ϕ, σi) truecount ← truecount + 1(ωj = ϕ) 8 9 10 11 12 13 14 15 Let pi = truecount/N if pmax < pi then pmax = pi if pi > 0 ∧ pmin > pi then pmin = pi D. Estimating Multiple Schedulers 16 if pmax = 0 then 17 No schedulers were found to satisfy ϕ We consider the strategy of sampling M schedulers to es- timate the optimum probability. We thus generate M estimates {p1, . . . , pM}, corresponding to true values {p1, . . . , pM}, and take either the maximum (pmax) or minimum (pmin), as required. To overcome the cumulative probability of error with the standard Chernoff bound, we specify that all estimates pi must be within ε of their respective true values pi, ensuring that any pmin, pmax ∈ {p1, . . . , pM} are within ε of their true value. Given that all estimates pi are statistically independent, the probability that all estimates are less than their upper bound is expressed by P(VM )M . Hence, P(WM )M , giving N = (cid:6)− ln(cid:0)1 − M√1 − δ(cid:1) /(2ε2)(cid:7) for user-specified parameters M , ε and δ. This ensures that P(pmin − pmin ≥ ε) ≤ δ and P(pmax − pmax ≥ ε) ≤ δ. To ensure the usual stronger conditions that P( pmax − pmax ≥ ε) ≤ δ and P( pmin − pmin ≥ ε) ≤ δ, we have i=1 pi − pi ≤ ε) ≥ (1 − e−2N ε2 i=1 pi − pi ≥ ε) ≤ 1 − (1 − e−2N ε2 N = l(cid:16)ln 2 − ln(cid:16)1 − M√1 − δ(cid:17)(cid:17) /(2ε2)m . (7) N scales logarithmically with M , making it tractable to consider many schedulers. In the case of M = 1, (7) degen- erates to (1). Note, however, that the confidence expressed by (7) is with respect to the sampled set, not with respect to the true extrema. Algorithm 3 is the resulting extremal probability estimation algorithm for multiple schedulers. Figure 4 shows the empirical cumulative distribution of schedulers generated by Algorithm 3 applied to the MDP of y t i l i b a b o r P e v i t l a u m u C 1 8 . 0 6 . 0 4 . 0 2 . 0 0 0 memoryless 0.1 0.2 0.3 Probability Figure 4: Empirical cumulative distribution of estimates from Algorithm 3 applied to MDP of Fig. 3. Fig. 3, using p1 = 0.9, p2 = 0.5, ϕ = X(ψ ∧ XG4¬ψ), ε = 0.01, δ = 0.01 and M = 300. The vertical red and blue lines mark the true probabilities of ϕ under each of the history- dependent and memoryless schedulers, respectively. The grey rectangles show the ±ε error bounds, relative to the true probabilities. There are multiple estimates per scheduler, but all estimates are within their respective confidence bounds. V. SMART SAMPLING The simple sampling strategies used by Algorithms 2 and 3 have the disadvantage that they allocate equal simulation budget to all schedulers, regardless of their merit. In general, › › the problem we address has two independent components: the rarity of near optimal schedulers and the rarity of the property under a near optimal scheduler. We should allocate our simulation budget accordingly and not waste budget on schedulers that are clearly not optimal. Motivated by the above, our smart estimation algorithm comprises three stages: (i) an initial undirected sampling experiment to discover the nature of the problem, (ii) a targeted sampling experiment to generate a candidate set of schedulers with high probability of containing an optimal scheduler and (iii) iterative refinement of the candidates to estimate the probability of the best scheduler with specified confidence. By excluding the schedulers with the worst estimated probabilities and re-allocating their simulation budget to the schedulers that remain, at each iterative step of stage (iii) the number of schedulers reduces while the confidence of their estimates increases. With a suitable choice of per-iteration budget, the algorithm is guaranteed to terminate. In the following subsection we develop the theoretical basis of stage (ii). A. Maximising the Probability of Seeing a Good Scheduler In what follows we assume the existence of an MDP and a property ϕ whose probability we wish to maxim- ise by choosing a suitable scheduler from the set S. Let P : S → [0, 1] be a function mapping schedulers to their probability of satisfying ϕ and let pmax = maxσ∈S(P(s)). For the sake of exposition, we consider the problem of finding a scheduler that maximises the probability of satisfying ϕ and define a "good" (near optimal) scheduler to be one in the set Sg = {σ ∈ S P(σ) ≥ pmax − ε} for some ε ∈ (0, pmax]. Intuitively, a good scheduler is one whose probability of satisfying ϕ is within ε of pmax, noting that we may similarly define a good scheduler to be one within ε of pmin = minσ∈S(P(σ)), or to be in any other subset of S. In particular, to address reward-based MDP optimisations, a good scheduler could be defined to be the subset of S that is near optimal with respect to a reward scheme. The notion of a "best" scheduler follows intuitively from the definition of a good scheduler. If we sample uniformly from S, the probability of finding a good scheduler is pg = Sg/S. The average probability of a good scheduler is pg = Pσ∈Sg P(σ)/Sg. If we select M schedulers uniformly at random and verify each with N simulations, the expected number of traces that satisfy ϕ using a good scheduler is thus M pgN pg. The probability of seeing a trace that satisfies ϕ using a good scheduler is the cumulative probability (1 − (1 − pg)M )(1 − (1 − pg)N ). (8) Hence, for a given simulation budget Nmax = N M , to implement stage (ii) the idea is to choose N and M to maximise (8) and keep any scheduler that produces at least one trace that satisfies ϕ. Since, a priori, we are generally unaware of even the magnitudes of pg and pg, stage (i) is necessarily uninformed and we set N = M = ⌈√Nmax⌉. The results of stage (i) allow us to estimate pg and pg (see Fig. 9a) and thus maximise (8). This may be done numerically, but we have found the heuristic N = ⌈1/pg⌉ to be near optimal in all but extreme cases. B. Smart Estimation Algorithm 4 is our smart estimation algorithm to find schedulers that maximise the probability of a property. The algorithm to find minimising schedulers is similar. Lines 1 to 5 implement stage (i), lines 6 to 10 implement stage (ii) and lines 11 to 23 implement stage (iii). Note that the algorithm distinguishes pmax (the notional true maximum probability), pmax (the true probability of the best candidate scheduler found) and pmax (the estimated probability of the best candidate scheduler). The per-iteration simulation budget Nmax must be greater than the number needed by the standard Chernoff bound (1), to ensure that there will be sufficient simulations to guarantee the specified confidence if the algorithm refines the candidate set to a single scheduler. Typically, the per-iteration budget will be greater than this, such that the required confidence is reached before refining the set of schedulers to a single element. Under these circumstances the confidence is judged according to the Chernoff bound for multiple estimates (7). In addition, lines 16 to 19 allow the algorithm to quit as soon as the minimum number of simulations is reached. Algorithm 4 may be further optimised by re-using the simulation results from previous iterations of stage (iii). The contribution is small, however, because confidence decreases exponentially with the age (in terms of iterations) of the results. C. Smart Hypothesis Testing We wish to test the hypothesis that there exists a scheduler such that property ϕ has probability ⊲⊳ θ, where ⊲⊳∈ {≥,≤}. Two advantages of sequential hypothesis testing are that it is not necessary to estimate the actual probability to know if an hypothesis is satisfied, and the easier the hypothesis is to satisfy, the quicker it is to get a result. Algorithm 5 maintains these advantages and uses smart sampling to improve on the performance of Algorithm 2. For the purposes of exposition, Algorithm 5 tests H0, as described in Section II. The algorithm to test H1 is similar. A sub-optimal approach would be to use Algorithm 4 to refine a set of schedulers until one is found whose estimate sat- isfies the hypothesis with confidence according to a Chernoff bound. Our approach is to exploit the fact that the average estimate at each iteration of Algorithm 4 is known with high confidence, i.e., confidence given by the total simulation budget. This follows directly from the result of [6], where the bound is specified for a sum of arbitrary random variables, not necessarily with identical expectations. By similar arguments based on [26], it follows that the sequential probability ratio test may also be applied to the sum of results produced during the course of an iteration of Algorithm 4. Moreover, it is possible to test each scheduler with respect to its individual Algorithm 4: Smart Estimating Input: M: an MDP ϕ: a property ǫ, δ: the required Chernoff bound Nmax > ln(2/δ)/(2ǫ2): the per-iteration budget Output: pmax ≈ pmax, where pmax ≈ pmax and P(pmax − pmax ≥ ǫ) ≤ δ 1 N ← ⌈√Nmax⌉; M ← ⌈√Nmax⌉ 2 S ← {M seeds chosen uniformly at random} 3 ∀σ ∈ S,∀i ∈ {1, . . . , N} : ωσ i ← Simulate(M, ϕ, σ) 4 R : S → N maps scheduler seeds to number of traces satisfying ϕ: R ← {(σ, n) σ ∈ S ∧ N ∋ n = PN i = ϕ)} 1(ωσ i=1 5 pmax ← maxσ∈S(R(σ)/N ) 6 N ← ⌈1/pmax⌉, M ← ⌈Nmax pmax⌉ 7 S ← {M seeds chosen uniformly at random} 8 ∀σ ∈ S,∀i ∈ {1, . . . , N} : ωσ 9 R ← {(σ, n) σ ∈ S ∧ N ∋ n = PN 1(ωσ 10 S ← {σ ∈ S R(σ) > 0} 11 ∀σ ∈ S, R(σ) ← 0; i ← 0; conf ← 1 12 while conf > δ ∧ S 6= ∅ do i=1 i ← Simulate(M, ϕ, σ) i = ϕ)} 13 14 15 16 17 18 19 20 21 22 23 i ← i + 1 Mi ← S Ni ← 0 while conf > δ ∧ Ni < ⌈Nmax/Mi⌉ do Ni ← Ni + 1 conf ← 1 − (1 − e−2ǫ2Ni)Mi ∀σ ∈ S : ωσ Ni ← Simulate(M, ϕ, σ) 1(ωσ R ← {(σ, n) σ ∈ S ∧ N ∋ n = PNi pmax ← maxσ∈S(R(σ)/Ni) R′ : {1, . . . ,S} → S is an injective function s.t. ∀(n, σ), (n′, σ′) ∈ R′, n > n′ =⇒ R(σ) ≥ R(σ′) S ← {σ ∈ S σ = R′(n) ∧ n ∈ {⌊S/2⌋, . . . ,S}} j = ϕ)} j=1 results and the current number of schedulers, according to the bound given in Section IV-C. Hence, if the "average scheduler" or an individual scheduler ever satisfies the hypothesis (lines 23 and 24), the algorithm immediately terminates and reports that the hypothesis is satisfied with the specified confidence. If the "best" scheduler ever individually falsifies the hypothesis (lines 25 and 26), the algorithm also terminates and reports the result. Note that this outcome does not imply that there is no scheduler that will satisfy the hypothesis, only that no scheduler was found with the given budget. Finally, if the algorithm refines the initial set of schedulers to a single instance and the hypothesis was neither satisfied nor falsified, an inconclusive result is reported (line 29). We implement one further important optimisation. We use the threshold probability θ to directly define the simulation budget to generate the candidate set of schedulers, i.e. N = ⌈1/θ⌉, M = ⌈θNmax⌉ (line 3). This is justified because we need only find schedulers whose probability of satisfying ϕ is greater than θ. By setting N = ⌈1/θ⌉, (8) ensures that such schedulers, if they exist, have high probability of being observed. The initial coarse exploration used in Algorithm 4 is thus not necessary. Algorithm 5 is our smart hypothesis testing algorithm. Note that we do not set a precise minimum per-iteration simulation budget because we expect the hypothesis to be decided with many fewer simulations than would be required to estimate the probability. In practice it is expedient to initially set a low per-iteration budget (e.g., 1000) and repeat the algorithm with an increased budget (e.g., increased by an order of magnitude) if the previous test was inconclusive. VI. CASE STUDIES To demonstrate the performance of smart sampling, we have implemented Algorithms 4 and 5 in our statistical model checking platform PLASMA [5]. We performed a number of experiments on standard models taken from the numer- ical model checking literature, most of which can be found illustrated on the PRISM website3. We found that all of our estimation experiments achieved their specified Chernoff bounds (ε = δ = 0.01 in all cases) with a relatively modest per-iteration simulation budget of 105 simulations. The actual number of simulation cores used for the estimation results was subject to availability and varied between experiments. To facilitate comparisons, in what follows we normalise all timings to be with with respect to 64 cores. Typically, each data point was produced in a few tens of seconds. Our hypothesis tests were performed on a single machine, without distribution. Despite this, most experiments completed in just a few seconds (some in fractions of a second), demonstrating that our smart hypothesis testing algorithm is able to take advantage of easy hypotheses. A. IEEE 802.11 Wireless LAN Protocol We consider a reachability property of the IEEE 802.11 Wireless LAN (WLAN) protocol model of [20]. The pro- tocol aims to avoid "collisions" between devices sharing a communication channel, by means of an exponential back- off procedure when a collision is detected. We therefore estimate the probability of the second collision at various time steps, using Algorithm 4 with per-iteration budget of 105 simulations. Fig. 5 illustrates the estimated maximum probabilities (pmax) and minimum probabilities (pmin) for time steps k ∈ {0, 10, . . . , 100}. The property is expressed as Fkcol = 2. The shaded areas indicate the true probabilities ±0.01, the specified absolute error bound using Chernoff bound ε = δ = 0.01. Our results are clearly very close to the true values. Table I gives the results of hypothesis tests based on the same model using property F100col = 2. See Section VI-B for a description. The results illustrated in Fig. 5 refer to the same property and confidence as the those shown in Fig. 4 of [22]. The total 3www.prismmodelchecker.org/casestudies/ Algorithm 5: Smart Hypothesis Testing Input: M: an MDP ϕ: a property H0 : P(ω = ϕ) ≥ θ ± ε is the hypothesis α, β: the desired error probabilities of H0 Nmax: the per-iteration simulation budget Output: The result of the hypothesis test 1 Let p0 = θ + ε, p1 = θ − ε 2 Let A = (1 − β)/α, B = β/(1 − α) 3 N ← ⌈1/θ⌉; M ← ⌈θNmax⌉ 4 S ← {M seeds chosen uniformly at random} 5 ∀σ ∈ S,∀i ∈ {1, . . . , N} : ωσ 6 R ← {(σ, n) σ ∈ S ∧ N ∋ n = PN 1(ωσ 7 if (p1)P R(σ)(1−p1)Nmax−P R(σ) 8 (p0)P R(σ)(1−p0)Nmax−P R(σ) ≤ A then Accept H0 and quit i ← Simulate(M, ϕ, σ) i = ϕ)} i=1 9 S ← {σ ∈ S R(σ) > 0}, M ← S + 1 10 while M > 1 do 11 M ← S Let αM = 1 − M√1 − α, βM = 1 − M√1 − β Let AM = (1 − βM )/αM , BM = βM /(1 − αM ) Let ratio = 1 for σi ∈ S, i ∈ {1, . . . , M} do Let ratio i = 1 for j ∈ {1, . . . , N} do ω ← Simulate(M, ϕ, σi) if ω = ϕ then ratio ← p1 p0 ratio; ratio i ← p1 p0 ratio i else ratio i ratio ← 1−p1 1−p0 ratio; ratio i ← 1−p1 1−p0 Accept H0 and quit if ratio ≤ A ∨ ratio i ≤ AM then if ratio i ≥ BM then Reject H0 (given budget) and quit 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 R′ : {1, . . . ,S} → S is an injective function s.t. ∀(n, σ), (n′, σ′) ∈ R′, n > n′ =⇒ R(σ) ≥ R(σ′) S ← {σ ∈ S σ = R′(n) ∧ n ∈ {⌊S/2⌋, . . . ,S}} 28 29 Inconclusive result (given budget) simulation cost to generate a point in Fig. 5 is 1.2 × 106 (12 iterations of 105 simulations using smart sampling), compared to a cost of 2.7 × 108 per point in Fig. 4 of [22] (4000 schedulers tested with 67937 simulations using simple sampling). This demonstrates a more than 200-fold improvement in performance. B. IEEE 802.3 CSMA/CD Protocol The IEEE 802.3 CSMA/CD protocol is a wired network protocol that is similar in operation to that of IEEE 802.11, but using collision detection instead of collision avoidance. In n o s i i l l o c f o y t i l i b a b o r P 2 . 0 5 1 . 0 1 . 0 5 0 . 0 0 p^ p^ max min 0 20 40 60 80 100 Time steps (k) Figure 5: Estimated maximum and minimum probabilities of second collision in WLAN protocol. Shaded regions denote true values ±0.01. CSMA 3 4 CSMA 3 6 CSMA 4 4 WLAN 5 WLAN 6 θ time θ time θ time θ time time 0.5 0.5 0.3 1.3 0.5 0.2 0.1 0.8 1.3 0.8 3.5 0.4 5.2 0.7 0.3 0.15 2.6 2.2 0.85 737 0.45 79 0.8 4.0 0.18 * * 0.86 * 0.48 * 0.9 8.6 0.2 2.9 6.5 0.9 2.9 0.5 39 0.93 * 0.25 2.9 1.3 0.95 2.5 0.8 2.6 0.95 3.8 0.5 1.3 1.3 Table I: Hypothesis test results for CSMA/CD and WLAN protocols. θ is the threshold probability or the true probability (marked by asterisk). time is simulation time in seconds to achieve the correct result on a single machine. Table I we give the results of applying Algorithm 5 to the IEEE 802.3 CSMA/CD protocol model of [18]. The models and parameters are chosen to compare with results given in Table III in [11], hence we also give results for hypothesis tests performed on the WLAN model used in Section VI-A. In contrast to the results of [11], our results are produced on a single machine, with no parallelisation. There are insufficient details given about the experimental conditions in [11] to make a formal comparison (e.g., error probabilities of the hypothesis tests and number of simulation cores), but it seems that the performance of our algorithm is generally much better. We set α = β = δ = 0.01, which constitute a fairly tight bound, and note that, as expected, the simulation times tend to increase as the threshold θ approaches the true probability. C. Choice Coordination To demonstrate the scalability of our approach, we consider the choice coordination model of [23] and estimate the min- imum probability that a group of six tourists will meet within T steps. The model has a parameter (BOUND) that limits the state space. We set BOUND = 100, making the state space of ≈ 5 × 1016 states intractable to numerical model checking. Fortunately, it is possible to infer the correct probabilities from tractable parametrisations. For T = 20 and T = 25 the true minimum probabilities are respectively 0.5 and 0.75. Using smart sampling and a Chernoff bound of ε = δ = 0.01, we correctly estimate the probabilities to be 0.496 and 0.745 in a few tens of seconds on 64 simulation cores. Infection probability 1 0.8 0.6 0.4 0.2 Error -0.008 -0.006 -0.004 -0.002 0 0 0.9 0.92 0.94 0.96 0.98 Detection probability 200 150 100 Time steps 50 1 0 0.002 0.9 0.92 0.94 0.96 0.98 Detection probability (a) Estimates. n o i t c e n n o c f o y t i l i b a b o r P 0 . 1 8 . 0 6 . 0 4 . 0 2 . 0 0 . 0 p^ p^ max min 200 150 100 Time steps 50 1 0 (b) Errors. Figure 6: Minimum probability of network infection. 0 50 100 150 200 Time steps (T) Infection probability Error 1 0.8 0.6 0.4 0.2 0 0.9 0.92 0.94 0.96 0.98 Detection probability 0.01 0.008 0.006 0.004 0.002 0 -0.002 0.9 0.92 0.94 0.96 0.98 Detection probability 200 150 100 Time steps 50 1 0 (a) Estimates. 200 150 100 Time steps 50 1 0 (b) Errors. Figure 7: Maximum probability of network infection. D. Network Virus Infection Network virus infection is a subject of increasing relevance. Hence, using a per-iteration budget of 105 simulations, we demonstrate the performance of Algorithm 4 on the PRISM virus infection case study based on [19]. The network is illustrated in Fig. 1 and comprises three sets of linked nodes: a set of nodes containing one infected by a virus, a set of nodes with no infected nodes and a set of barrier nodes which divides the first two sets. A virus chooses which node to infect nondeterministically. A node detects a virus probabilistically and we vary this probability as a parameter for barrier nodes. We consider time as a second parameter. Figs. 6 and 7 illustrate the estimated probabilities that the target node in the uninfected set will be infected. We observe in Figs. 6b and 7b that the estimated minimums are within [−0.0070, +0.00012] and the estimated maximums are within [−0.00012, +0.0083] of their true values. The respective negative and positive biases to these error ranges reflects the fact that Algorithm 4 converges from respectively below and above (as illustrated in Fig. 9b). The average time to generate a point in Fig. 6 was approximately 100 seconds, using 64 simulation cores. Points in Fig. 7 took on average approximately 70 seconds. E. Gossip Protocol Gossip protocols are an important class of network al- gorithms that rely on local connectivity to propagate informa- tion globally. Using the gossip protocol model of [17], we used Algorithm 4 with per-simulation budget of 105 simulations to estimate the maximum (pmax) and minimum (pmin) probabil- ities that the maximum path length between any two nodes is less than 4 after T time steps. This is expressed by property FT max path len < 4. The results are illustrated in Fig. 8. Figure 8: Estimated probabilities that maximum path length is < 4 in gossip protocol model. Shaded regions denote ±0.01 of true values. Estimates of maximum probabilities are within [−0, +0.0095] of the true values. Estimates of minimum probabilities are within [−0.007, +0] of the true values. Each point in the figure took on average approximately 60 seconds to generate using 64 simulation cores. VII. CONVERGENCE AND COUNTEREXAMPLES The techniques described in the preceding sections open up the possibility of efficient lightweight verification of MDPs, with the consequent possibility to take full advantage of parallel computational architectures, such as multi-core pro- cessors, clusters, grids, clouds and general purpose computing on graphics processors (GPGPU). These architectures may potentially divide the problem by the number of available computational devices (i.e., linearly), however this must be considered in the context of scheduler space increasing expo- nentially with path length. Although Monte Carlo techniques are essentially impervious to the size of the state space (they also work with non-denumerable space), it is easy to construct verification problems for which there is a unique optimal scheduler. Such examples do not necessarily invalidate the approach, however, because it may not be necessary to find the possibly unique optimal scheduler to return a result with a level of statistical confidence. The nature of the distribution of schedulers nevertheless affects efficiency, so in this section we explore the convergence properties of smart sampling and give an example from the literature that does not converge as well as the case studies in Section VI. Essentially, the problem is that of exponentially distributed schedulers, i.e., having a very low mass of schedulers close to the optimum. Fig. 10 illustrates the difference between exponentially decreasing and linearly decreasing distributions with the same overall mass. In both cases pmax ≈ 0.2 (the density at 0.2 is zero), but the figure shows that there is more probability mass near 0.2 in the case of the linear distribution. Figure 9 illustrates the convergence of Algorithm 4, using a per-iteration budget of 106 applied to schedulers whose prob- ability of success (i.e., of satisfying a hypothetical property) is distributed according to the exponential distribution of Fig. 10. Fig. 9a shows how the initial undirected sampling (black dots) crudely approximates pmax. This approximation is then used y t i l i b a b o r p e v i t a u m u C l 1 8 . 0 6 . 0 4 . 0 2 . 0 0 y t i l i b a b o r P 3 . 0 2 . 0 1 . 0 0 p^ max s max p^ mean 0.1 0.2 0 1 2 3 4 5 6 Scheduler probability Iteration (a) Scheduler distributions. Dots de- note the results of initial sampling. The red line is the set of schedulers to refine. Black lines show the result of subsequent refinements. (b) Estimates and schedulers. At each iterative step: pmax is the maximum estimate, pmean is the mean estimate and σmax is the true maximum prob- ability of the available schedulers. Figure 9: Convergence of Algorithm 4 with exponentially distributed scheduler probabilities (Fig. 10) and per-iteration budget of 106 simulations. y t i s n e D 1 8 . 0 6 0 . 4 0 . 2 0 . 0 total mass » 0.0144 y t i l i b a b o r p m u m n M i i 15 processes 20 processes 1 8 0 . 6 . 0 4 . 0 2 . 0 0 0.1 0.2 0 100 200 300 400 500 Scheduler probability Path length (k) Figure 10: Theoretical lin- ear (blue) and exponential (red) scheduler densities with probability mass ≈ 0.0144 and zero density at probab- ility 0.2. to Figure 11: Performance of smart sampling (black dots) applied self-stabilising models of [13]. Red shaded areas values ±0.01. denote true to generate the candidate set of schedulers (red distribution). The black lines illustrate five iterations of refinement, resulting in a shift of the distribution towards pmax. Fig. 9b illustrates the same shift in terms of the convergence of probabilities. Iteration 0 corresponds to the undirected sampling. Iteration 1 corresponds to the generation of the candidate set of sched- ulers. Note that for these first two iterations, pmean includes schedulers that have zero probability of success. The expected value of pmean in these two iterations is equal to the expected probability obtained by the uniform probabilistic scheduler. This fact can be used to verify that the hash function and PRNG described in Section IV sample uniformly. In sub- sequent iterations the candidates all have non-zero probability of success. Importantly, the figure demonstrates that there is a significant increase in the maximum probability of scheduler success (σmax) between iteration 0 and iteration 1, and that this maximum is maintained throughout the subsequent refine- ments. Despite the apparently very low density of schedulers near pmax, Algorithm 4 is able to make a good approximation. The theoretical performance demonstrated in Fig. 9 explains why we are able to achieve good results in Section VI. It is nevertheless possible to find examples for which accurate results are difficult to achieve. Fig. 11 illustrates the results of applying Algorithm 4 to instances of the self-stabilising al- gorithm of [13], using a per-iteration budget of 105. Although the estimates (black dots) do not lie within our statistical confidence bounds of the true values (red shaded areas), we nevertheless claim that the results are useful. The problem of quantifying the confidence of estimates with respect to optimal values remains open, however. To improve the performance of smart sampling, it is possible to make an even better allocation of simulation budget. For example, if good schedulers are very rare it may be beneficial to increase the per-iteration budget (thus increasing the pos- sibility of seeing a good scheduler in the initial candidate set) but increase the proportion of schedulers rejected after each iteration (thus reducing the overall number of iterations and maintaining a fixed total number of simulations). To avoid rejecting good schedulers under such a regime, it may be necessary to reject fewer schedulers in the early iterations when confidence is low. VIII. PROSPECTS AND CHALLENGES The use of sampling facilitates algorithms that scale inde- pendently of the sample space, hence we anticipate that it will be possible to apply our techniques to nondeterministic models with non-denumerable schedulers. We believe it is immediately possible to apply smart sampling to reward-based MDP optimisation problems. The success of sampling depends on the relative abundance of near optimal schedulers in scheduler space and our experi- ments suggest that these are not rare in standard case studies. While it is possible to construct pathological examples, where near optimal schedulers cannot easily be found by sampling, it is perhaps even simpler to confound numerical techniques with state explosion (three independent counters ranging over 0 to 1000 is typically sufficient with current hardware). Hence, as with numerical model checking, our ongoing challenge is essentially to increase performance and increase the number of models and problems that may be efficiently addressed. Smart sampling has made significant improvements over simple sampling, but we recognise that it will be necessary to develop other techniques to accelerate convergence. We anticipate that the most fruitful approaches will be (i) to reduce the sampled scheduler space to only those that satisfy the property and (ii) to construct schedulers piecewise. Such techniques will also reduce the potential of hash function collisions. An important remaining challenge is to quantify the con- fidence of our estimates and hypothesis tests with respect to optimality. In the case of hypothesis tests that satisfy the hypo- thesis, the statistical confidence of the result is sufficient. If an hypothesis is not satisfied, however, the statistical confidence does not relate to whether there exists a scheduler to satisfy it. Likewise, the statistical confidence bounds of probability estimates imply nothing about how close they are to the true optima. We nevertheless know that our estimates of the extrema must lie within the true extrema or exceed them with the specified statistical confidence. This is already useful and [19] Marta Kwiatkowska, Gethin Norman, David Parker, and Maria Grazia Vigliotti. Probabilistic mobile ambients. Theoretical Computer Science, 410(12-13):1272 -- 1303, 2009. [20] Marta Z. Kwiatkowska, Gethin Norman, and Jeremy Sproston. Probab- ilistic model checking of the IEEE 802.11 wireless local area network protocol. In Proc. 2nd Joint International Workshop on Process Algebra and Probabilistic Methods, Performance Modeling and Verification, pages 169 -- 187. Springer, 2002. [21] Richard Lassaigne and Sylvain Peyronnet. Approximate planning and verification for large Markov decision processes. In Proc. 27th Annual ACM Symposium on Applied Computing, pages 1314 -- 1319. ACM, 2012. [22] A. Legay, S. Sedwards, and L.-M. Traonouez. Scalable verification of Markov decision processes. In 4th Workshop on Formal Methods in the Development of Software (FMDS 2014), LNCS. Springer, 2014. [23] U. Ndukwu and A. McIver. An expectation transformer approach to pre- dicate abstraction and data independence for probabilistic programs. In Proc. 8th Workshop on Quantitative Aspects of Programming Languages (QAPL'10), 2010. [24] Masashi Okamoto. Some inequalities relating to the partial sum of binomial probabilities. Annals of the Institute of Statistical Mathematics, 10(1):29 -- 35, 1958. [25] Martin L. Puterman. Markov Decision Processes: Discrete Stochastic Dynamic Programming. Wiley-Interscience, 1994. [26] Abraham Wald. Sequential tests of statistical hypotheses. The Annals of Mathematical Statistics, 16(2):117 -- 186, 1945. [27] Douglas J. White. Real applications of Markov decision processes. Interfaces, 15(6):73 -- 83, 1985. [28] Douglas J. White. Further real applications of Markov decision pro- cesses. Interfaces, 18(5):55 -- 61, 1988. [29] Douglas J. White. A survey of applications of Markov decision processes. Journal of the Operational Research Society, 44(11):1073 -- 1096, Nov. 1993. [30] H. L. S. Younes. Verification and Planning for Stochastic Processes with Asynchronous Events. PhD thesis, Carnegie Mellon University, 2005. [31] Hakan L. S. Younes and Reid G. Simmons. Probabilistic verification of discrete event systems using acceptance sampling. In Computer Aided Verification, pages 223 -- 235. Springer, 2002. a significant improvement over the results produced using the uniform probabilistic scheduler. In addition, given the number of simulations performed, we may at least quantify confidence with respect to the product pgpg (the rarity of near optimal schedulers times the average probability of the property with near optimal schedulers). ACKNOWLEDGEMENTS We are grateful to Benoıt Delahaye for useful prior dis- cussions. This work was partially supported by the European Union Seventh Framework Programme under grant agreement no. 295261 (MEALS). REFERENCES [1] Christel Baier and Joost-Pieter Katoen. Principles of model checking. MIT Press, 2008. [2] Richard Bellman. Dynamic Programming. Princeton University Press, 1957. [3] Andrea Bianco and Luca De Alfaro. Model checking of probabilistic and nondeterministic systems. In Foundations of Software Technology and Theoretical Computer Science, pages 499 -- 513. Springer, 1995. [4] Jonathan Bogdoll, Luis Mar´ıa Ferrer Fioriti, Arnd Hartmanns, and Holger Hermanns. Partial order methods for statistical model checking and simulation. In Formal Techniques for Distributed Systems, pages 59 -- 74. Springer, 2011. [5] Benoıt Boyer, Kevin Corre, Axel Legay, and Sean Sedwards. PLASMA- lab: A flexible, distributable statistical model checking library. In Kaus- tubh Joshi, Markus Siegle, Marielle Stoelinga, and PedroR. D'Argenio, editors, Quantitative Evaluation of Systems, volume 8054 of LNCS, pages 160 -- 164. Springer, 2013. [6] Herman Chernoff. A measure of asymptotic efficiency for tests of a hypothesis based on the sum of observations. Ann. Math. Statist., 23(4):493 -- 507, 1952. [7] E.M. Clarke, E. A. Emerson, and J. Sifakis. Model checking: algorithmic verification and debugging. Commun. ACM, 52(11):74 -- 84, November 2009. [8] Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms. MIT Press, 3rd edition, 2009. [9] Hans Hansson and Bengt Jonsson. A logic for reasoning about time and reliability. Formal aspects of computing, 6(5):512 -- 535, 1994. [10] Arnd Hartmanns and Mark Timmer. On-the-fly confluence detection for statistical model checking. In NASA Formal Methods, pages 337 -- 351. Springer, 2013. [11] David Henriques, Joao G. Martins, Paolo Zuliani, Andr´e Platzer, and Edmund M. Clarke. Statistical model checking for Markov decision processes. In Quantitative Evaluation of Systems, 2012 Ninth Interna- tional Conference on, pages 84 -- 93. IEEE, 2012. [12] William George Horner. A new method of solving numerical equations of all orders, by continuous approximation. Philosophical Transactions of the Royal Society of London, 109:308 -- 335, 1819. [13] A. Israeli and M. Jalfon. Token management schemes and random walks yield self-stabilizating mutual exclusion. In Proc. 9th Annual ACM Symposium on Principles of Distributed Computing (PODC '90), pages 119 -- 131. ACM New York, 1990. [14] Michael Kearns, Yishay Mansour, and Andrew Y. Ng. A sparse sampling algorithm for near-optimal planning in large Markov decision processes. Machine Learning, 49(2-3):193 -- 208, 2002. [15] Donald E. Knuth. The Art of Computer Programming. Addison-Wesley, 3rd edition, 1998. [16] M. Kwiatkowska, G. Norman, and D. Parker. Stochastic model checking. In M. Bernardo and J. Hillston, editors, Formal Methods for the Design of Computer, Communication and Software Systems: Performance Eval- uation (SFM'07), volume 4486 of LNCS (Tutorial Volume), pages 220 -- 270. Springer, 2007. [17] Marta Kwiatkowska, Gethin Norman, and David Parker. Analysis of a gossip protocol in PRISM. SIGMETRICS Perform. Eval. Rev., 36(3):17 -- 22, November 2008. [18] Marta Kwiatkowska, Gethin Norman, David Parker, and Jeremy Spro- ston. Performance analysis of probabilistic timed automata using digital clocks. Formal Methods in System Design, 29:33 -- 78, August 2006.
1209.4971
1
1209
2012-09-22T08:37:17
Streaming Complexity of Checking Priority Queues
[ "cs.DS", "cs.CC" ]
This work is in the line of designing efficient checkers for testing the reliability of some massive data structures. Given a sequential access to the insert/extract operations on such a structure, one would like to decide, a posteriori only, if it corresponds to the evolution of a reliable structure. In a context of massive data, one would like to minimize both the amount of reliable memory of the checker and the number of passes on the sequence of operations. Chu, Kannan and McGregor initiated the study of checking priority queues in this setting. They showed that use of timestamps allows to check a priority queue with a single pass and memory space O(N^(1/2)), up to a polylogarithmic factor. Later, Chakrabarti, Cormode, Kondapally and McGregor removed the use of timestamps, and proved that more passes do not help. We show that, even in the presence of timestamps, more passes do not help, solving a previously open problem. On the other hand, we show that a second pass, but in reverse direction, shrinks the memory space to O((log N)^2), extending a phenomenon the first time observed by Magniez, Mathieu and Nayak for checking well-parenthesized expressions.
cs.DS
cs
Streaming Complexity of Checking Priority Queues∗ Nathanael Fran¸cois1 and Fr´ed´eric Magniez2 1Univ Paris Diderot, Sorbonne Paris-Cit´e, LIAFA, CNRS, 75205 Paris, France, [email protected] 2CNRS, LIAFA, Univ Paris Diderot, Sorbonne Paris-Cit´e, 75205 Paris, France, [email protected] Abstract This work is in the line of designing efficient checkers for testing the reliability of some massive data structures. Given a sequential access to the insert/extract operations on such a structure, one would like to decide, a posteriori only, if it corresponds to the evolution of a reliable structure. In a context of massive data, one would like to minimize both the amount of reliable memory of the checker and the number of passes on the sequence of operations. Chu, Kannan and McGregor [9] initiated the study of checking priority queues in this setting. They showed that the use of timestamps allows to check a priority queue with a single pass and memory space O(√N ). Later, Chakrabarti, Cormode, Kondapally and McGregor [7] removed the use of timestamps, and proved that more passes do not help. We show that, even in the presence of timestamps, more passes do not help, solving an open problem of [9, 7]. On the other hand, we show that a second pass, but in reverse direction, shrinks the memory space to O((log N )2), extending a phenomenon the first time observed by Magniez, Mathieu and Nayak [15] for checking well-parenthesized expressions. 1 Introduction The reliability of memory is central and becomes challenging when it is massive. In the context of program checking [4] this problem has been addressed by Blum, Evans, Gemmell, Kannan and Naor [3]. They designed on-line checkers that use a small amount of reliable memory to test the behavior of some data structures. Checkers are allowed to be randomized and to err with small error probability. In that case the error probability is not over the inputs but over the random coins of the algorithm. Chu, Kannan and McGregor [9] revisited this problem for priority queue data structures, where the checker only has to detect an error after processing an entire sequence of data accesses. This can be rephrased as a one-pass streaming recognition problem. Streaming algorithms sequentially scan the whole input piece by piece in one sequential pass, or in a small number of passes, while using sublinear memory space. In our context, the stream is defined by the sequence of insertions and extractions on the priority queue. Using a streaming algorithm, the objective is then to decide if the stream corresponds to a correct implementation of a priority queue. We also consider collection data structures that implement multisets. ∗Supported by the French ANR Defis program under contract ANR-08-EMER-012 (QRAC project) 1 Definition 1 (Collection,PQ). Let Σ0 be some alphabet. Let Σ = {ins(a), ext(a) : a ∈ Σ0}. For w ∈ ΣN , define inductively multisets Mi by M0 = ∅, Mi = Mi−1 \ {a} if w[i] = ext(a), and Mi = Mi−1 ∪ {a} if w[i] = ins(a). Then w ∈ Collection(Σ0) if and only if Mn = ∅ and a ∈ Mi−1 when w[i] = ext(a), for i = 1, . . . , N . Moreover, w ∈ PQ(U ), for U ∈ N, if and only if w ∈ Collection({0, 1, . . . , U}) and a = max(Mi−1) when w[i] = ext(a), for i = 1, . . . , N . Streaming algorithms were initially designed with a single pass: when a piece of the stream has been read, it is gone for ever. This makes those algorithms of practical interest for online context, such as network monitoring, for which first streaming algorithms were developed [1]. Motivated by the explosion in the size of the data that algorithms are called upon to process in everyday real-time applications, the area of streaming algorithms has experienced tremendous growth over the last decade in many applications. In particular, a streaming algorithm can model an external read-only memory. Examples of such applications occur in bioinformatics for genome decoding, or in Web databases for the search of documents. In that context, considering multi-pass streaming algorithm is relevant. Using standard arguments one can establish that every p-pass randomized streaming algorithm needs memory space Ω(N/p) for recognizing Collection. Nonetheless, Chakrabarti, Cormode, Kondapally and McGregor [7] gave a one-pass randomized for PQ using memory space O(√N ). They also showed that several passes do not help, since any p-pass randomized algorithm would require memory space Ω(√N /p). A similar lower bound was showed independently, but using different tools, by Jain and Nayak [10]. The case of a single pass was established previously by Magniez, Mathieu and Nayak [15] for checking the well-formedness of parenthesis expressions, or equivalently the behavior of a stack. A simpler variant of PQ with timestamps was in fact first studied by Chu, Kannan and Mc- Gregor [9], where now each item is inserted to the queue with its index. Definition 2 (PQ-TS). Let Σ = {ins(a), ext(a) : a ∈ {0, 1, . . . , U}} × N. Let w ∈ ΣN . Then w ∈ PQ-TS(U ) if and only if w ∈ Collection(Σ), w[1, . . . , N ][1] ∈ PQ(U ), and w[i][2] = i when w[i][1] = ins(a). Nonetheless the two works [9, 7] let open two problems. The lower bound of [7] was only proved for PQ, and no significant lower bounds for PQ-TS was established. Moreover, the streaming complexity of PQ for algorithms that can process the stream in any direction has not been studied. Even though recognizing PQ-TS is obviously easier than recognizing PQ, our first contribution (Section 3) consists in showing that they both obey the same limitation, even with multiple passes in the same direction. Theorem 3. Every p-pass randomized streaming algorithm recognizing PQ-TS(3N/2) with bounded error 1/3 requires memory space Ω(√N /p) for inputs of length N . As a consequence, since this lower bound uses very restricted hard instances, it models most of possible variations. For instance, assuming that the input is in Collection and has no duplicates, is not sufficient to guarantee a faster algorithm. The proof of Theorem 3 consists in introducing a related communication problem with Θ(√N ) players. Then we reduce the number of players to 3, and prove a lower bound on the information carried by players, leading to the desired lower bound. We are following the information cost approach taken in [8, 17, 2, 12, 11], among other works. Recently, the information cost appeared as one of the most central notion in communication 2 complexity [6, 5, 13]. The information cost of a protocol is the amount of information that messages carry about players' inputs. We adapt this notion to suit both the nature of streaming algorithms and of our problem. Even if our result suggests that allowing multiple passes does not help, one could also consider the case of bidirectional passes. We believe that it is a natural relaxation of multi-pass streaming algorithms where the stream models some external read-only memory. In that case, we show that a second pass, but in reverse order, makes the problem of checking PQ easy, even with no timestamps (Section 4). A similar phenomenon has been established previously in [15] for checking the well-formedness of parenthesis expressions. Their problem is simpler than ours, and therefore our algorithm is more general. Theorem 4. There is a bidirectional 2-pass randomized streaming algorithm recognizing PQ(U ) with memory space O((log N )(log U + log N )), time per processing item polylog(N, U ), and one- sided bounded error N −c, for inputs of length N and any constant c > 0. Our algorithm uses a hierarchical data structure similar to the one introduced in [15] for checking well-parenthesized expressions. At high level, it also behaves similarly. It performs one pass in each direction and makes an on-line compression of past information in at most log N hashcodes. While this compression can loose information, the compression technique ensures that a mistake is always detected in one of the two directions. Nonetheless our algorithm differs on two main points. First, unlike parenthesized expressions, PQ is not symmetric. Therefore one has to design an algorithm for each pass. Second, the one-pass algorithm for PQ [7] is technically more advanced than the one of [15]. Thus designing a bidirectional 2-pass algorithm for PQ is more challenging. Theorems 3 and 4 point out a strange situation but not isolated at all. Languages studied in [9, 15, 7, 14] and in this paper have space complexity Θ(√N polylog(N )) for a single pass, Ω(√N /p) for p passes in the same direction, and polylog(N ) for 2 passes but one in each direction. We hope this paper makes progress in the study that phenomenon. 2 Preliminaries In streaming algorithms (see [16] for an introduction), a pass on an input w ∈ ΣN , for some alphabet Σ, means that w is given as an input stream w[1], w[2], . . . , w[N ], which arrives sequentially, i.e., letter by letter in this order. For simplicity, we assume throughout this article that the input length N is always given to the algorithm in advance. Nonetheless, all our algorithms can be adapted to the case in which N is unknown until the end of a pass. Definition 5 (Streaming algorithm). A p-pass randomized streaming algorithm with space s(N ) and time t(N ) is a randomized algorithm that, given w ∈ ΣN as an input stream, • performs k sequential passes on w; • maintains a memory space of size at most s(N ) bits while reading w; • has running time at most t(N ) per processed letter w[i]; • has preprocessing and postprocessing time at most t(N ). The algorithm is bidirectional if it is allowed to access to the input in the reverse order, after reaching the end of the input. Then p is the total number of passes in either direction. 3 The proof of our lower bound uses the language of communication complexity with multi-players, and is based on information theory arguments. We consider number-in-hand and message-passing communication protocols. Each player is given some input, and can communicate with another player according to the rules of the protocol. Our players are embedded into a directed circle, so that each player can receive (resp. transmit) a message from its unique predecessor (resp. successor). Each player send a message after receiving one, until the end of the protocol is reached. Players have no space and time restriction. Only the number of rounds and the size of messages are constrained. Consider a randomized multi-player communication protocol P . We consider only two types of random source, that we call coins. Each player has access to its own independent source of private coins. In addition, all players share another common source of public coins. The output of P is announced by the last player. This is therefore the last message of the last player. We say that P is with bounded error ǫ when P errs with probability at most ε over the private and public coins. The transcript Π of P is the concatenation of all messages sent by all players, including all public coins. In particular, it contains the output of P , since it is given by the last player. Given a subset S of players, we let ΠS be the concatenation of all messages sent by players in S, including again all public coins. We now remind the usual notions of entropy H and mutual information I. Let X, Y, Z be random variables. Then H(X) = − Ex←X log Pr(X = x), H(XY = y) = − Ey←Y log Pr(X = xY = y), H(XY ) = Ey←Y H(XY = y), and I(X : Y Z) = H(XZ) − H(XY, Z). The entropy and the mutual information are non negative and satisfy I(X : Y Z) = I(Y : XZ). The mutual information between two random variables is connected to the Hellinger distance h between their respective distribution probabilities. Given a random variable X we also denote by X its underlying distribution. Proposition 6 (Average encoding). Let X, Y be random variables. Then Ey←Y h2(XY =y, X) ≤ κI(X : Y ), where κ = ln 2 2 . The Hellinger distance also generalizes the cut-and-paste property of deterministic protocols to randomized ones. Proposition 7 (Cut and paste). Let P be a 2-player randomized protocol. Let Π(x, y) denote the random variable representing the transcript in P when Players A, B have resp. inputs x, y. Then h(Π(x, y), Π(u, v)) = h(Π(x, v), Π(u, y)), for all pairs (x, y) and (u, v). Last we use that the square of the Hellinger distance is convex, and the following connexion to 2kX − Y k1 ≤ √2h(X, Y ). For a reference on these the more convention ℓ1-distance: h(X, Y )2 ≤ 1 results, see [10]. 3 Lower bound for PQ-TS The proof of our lower bound consists in first translating it into a 3m-player communication prob- lem, for some large m; then reducing the number of players to 3 using the information cost approach; and last studying the base case of 3 players using information theory arguments. 4 i = 3 i = 2 k = 3 i = 1 k = 3 23 23 23 23 i = 3 18 17 18 16 16 17 i = 2 14 14 18 17 18 16 16 14 17 14 A2 B2 C2 9 8 9 8 7 7 5 i = 1 5 2 2 A1 B1 5 2 C1 9 8 9 8 7 7 5 2 Figure 1: Left: Instance of Raindrops(m, 4) with one error: 17 is extracted after 16. Insertions ai are circled. Right: Cutting Raindrops(m, 4) into 3m pieces to make it a communication problem. Players' input are within each corresponding region. 3.1 From streaming algorithms to communication protocols In this section, we write a instead of ins(a) and ¯a instead of ext(a). Consider the following set of hard instances of size N = (2n + 2)m: Raindrops(m, n) (see LHS of Figure 1) • For i = 1, 2, . . . , m, repeat the following motif: -- For j = 1, 2, . . . , n, insert either vi,j = 3(ni − j) or vi,j = 3(ni − j) + 2 -- Insert either ai = 3(ni − (ki − 1)) + 1 or ai = 3(ni − ki) + 1, for some ki ∈ {2, . . . , n} -- Extract vi,1, vi,2, . . . , vi,ki−1, ai in decreasing order • Extract everything left in decreasing order Observe that such an instance is in Collection. One can compute the timestamps for each value by maintaining only O(log N ) additionnal bits. Last, there is only one potential error in each motif that can make it outside of PQ-TS. Indeed, vi,1, vi,2, . . . , vi,ki−1, ai are in decreasing order up to a switch between ai and vi,ki−1. Given such an instance as a stream, an algorithm for PQ-TS must decide if an error occurs between ai and vi,ki, for some i. Intuitively, if the memory space is less than εn, for a small enough constant ε > 0, then the algorithm cannot remember all the values (vi,j)j when ai is extracted, and therefore cannot check a potential error with ai. The next opportunity is during the last sequence of extractions. But then, the algorithm has to remember all values (ai)i, which is again impossible if the memory space is less than εm. In order to formalize this intuition, Lemma 8 (proof in Appendix A) first translates our problem into a communication one between 3m players as shown on the RHS of Figure 1. Then we analyze its complexity using information theory arguments in Section 3.2. 5 Any insertion and extraction of an instance in Raindrops(m, n) can be described by its index and a single bit. Let xi[j] ∈ {0, 1} such that vi,j = 3(ni − j) + 2xi[j]. Similarly, let di ∈ {0, 1} such that ai = 3(ni − ki) + 1 + 3di. For simplicity, we write x instead of (xi)1≤i≤m. Similarly, we use the notations k and d. Then our related communication problem is: WeakIndex(m, n) • Input for players (Ai, Bi, Ci)1≤i≤m: -- Player Ai has a sequence xi ∈ {0, 1}n -- Player Bi has xi[1, ki − 1], with ki ∈ {2, . . . , n} and di ∈ {0, 1} -- Player Ci has xi[ki, n] • Output: fm(x, k, d) = Wm • Communication settings: i=1 f (xi, ki, di), where f (x, k, d) = [(d = 0) ∧ (x[k] = 1)] -- One round: each player sends a message to the next player according to the diagram A1 → B1 → A2 → ··· → Bm → Cm → Cm−1 → ··· → C1. -- Multiple rounds: If there is at least one round left, C1 sends a message to A1, and then players continue with the next round. Lemma 8. Assume there is a p-pass randomized streaming algorithm for deciding if an instance of Raindrops(n, m) is in PQ-TS(3mn) with memory space s(m, n) and bounded error ε. Then there is a p-round randomized protocol for WeakIndex(n, m) with bounded error ε such that each message has size at most s(m, n). We are now ready to give the structure of the proof of Theorem 3, which has techniques based on information theory. Define the following collapsing distribution µ0 of hard inputs (x, k, d), encoding instances of Raindrops(1, n), where f always takes value 0. Distribution µ0 is such that (x, k) is uniform on {0, 1}n × {2, . . . , n} and, given x, k, the bit d ∈ {0, 1} is uniform if x[k] = 0, and d = 1 if x[k] = 1. From now on, (X, K, D) are random variables distributed according to µ0, and (x, k, d) denote any of their values. Then the proof of Theorem 3 consists in studying the information cost of any communica- tion protocol for WeakIndex(n, m), which is a lower bound on its communication complexity. Using that µ0 is collapsing for f , Lemma 9 establishes a direct sum on the information cost of WeakIndex(n, m). Then, even if f is constant on µ0, Lemma 12 lower bounds the information cost of a single instance of WeakIndex(n, 1). Proof of Theorem 3. Let n, N be positive integers such that N = (2n + 2)n. Assume that there exists a p-pass randomized algorithm that recognizes PQ-TS(3N/2), with memory space αn and bounded error ε, for inputs of size N . Then, by Lemma 8, there a p-round randomized protocol P for WeakIndex(n, n) such that each message has size at most αn. By Lemma 9, one can derive from P another (p + 1)-round randomized protocol P ′ for WeakIndex(n, 1) with bounded error ε, and transcript Π′ satisfying Π′ ≤ 3(t + 1)αn and max {I(D : Π′ CX)} ≤ (p + 1)α. Then by Lemma 12, 3(p + 1)α ≥ (1 − 2ε)/10, that is α = O(1/p), concluding the proof. BX, K), I(K, D : Π′ 6 3.2 Communication complexity lower bound We first reduce the general problem WeakIndex(n, m) with 3m players to a single instance of WeakIndex(n, 1) with 3 players. In order to do so we exploit the direct sum property of the information cost. The use of a collapsing distribution where f is always 0 is crucial. Lemma 9. If there is a p-round randomized protocol P for WeakIndex(n, m) with bounded error ε and messages of size at most s(m, n), then there is a (p + 1)-round randomized protocol P ′ for WeakIndex(n, 1) with bounded error ǫ, and transcript P ′ satisfying Π′ ≤ 3(p + 1)s(m, n) and max{I(D : Π′ Sketch of proof. Given a protocol P , we show how to construct another protocol P ′ for any instance (x, k, d) of WeakIndex(n, 1). In order to avoid any confusion, we denote by A, B and C the three players of P ′, and by (Ai, Bi, Ci)i the ones of P . BX, K), I(K, D : Π′ CX)} ≤ p+1 m s(m, n). Protocol P ′ • Using public coins, all players generate uniformly at random j ∈ {1, . . . , m}, and xi ∈ {0, 1}n for i 6= j • Players A, B and C set respectively their inputs to the ones of Aj, Bj, Cj • For all i > j, Player B generates, using its private coins, uniformly at random ki ∈ {2, . . . , n}, and then it generates uniformly at random di such that f (xi, ki, di) = 0 • For all i < j, Player C generates, using its private coins, uniformly at random ki ∈ {2, . . . , n}, and then it generates uniformly at random di such that f (xi, ki, di) = 0 • Players A, B and C run P as follows. A simulates Aj only, B simulates Bj and (Ai, Bi, Ci)i>j, and C simulates Cj and (Ai, Bi, Ci)i<j. Observe that A starts the protocol if j = 1, and C starts otherwise. Moreover C stops the simulation after p rounds if j = 1, and after p+1 rounds otherwise. For all i 6= j, entries are generated such that f (xi, ki, ai) = 0, therefore fm(X, k, d) = f (xj, kj, aj) = f (x, k, a), and P ′ has the same bounded error than P . Then we show in Appendix A that P ′ satisfies the required conditions of the lemma. We now prove a trade-off between the bounded error of a protocol for a single instance of WeakIndex(n, 1) and its information cost. The proof involves some of the tools of [10] but with some additional obstacles to apply them. The inherent difficulty is due to that we have 3 players whereas the cute-and-paste property applies to 2-player protocols. Therefore we have to group 2 players together. Given some parameters (x, k, a) for an input of WeakIndex(n, 1), we denote by Π(x, k, a) the random variable describing the transcript Π of our protocol. We start by two lemmas exploiting the average encoding theorem (proofs in Appendix A). Lemma 10. Let P be a randomized protocol for WeakIndex(n, 1) with transcript Π satisfying Π ≤ αn and I(K, D : ΠCX) ≤ α. Then E x[1,l−1],l h2(Π(x[1, l − 1]0X[l + 1, n], l, 1), Π(x[1, l − 1]1X[l + 1, n], l, 1)) ≤ 28α, where l ∈ [ n 2 + 1, n] and x[1, l − 1] are uniformly distributed. 7 Lemma 11. Let P be a randomized protocol for WeakIndex(n, 1) with transcript Π satisfying I(D : ΠBX, K) ≤ α. Then E x[1,l−1],l h2(Π(x[1, l − 1]0X[l + 1, n], l, 0), Π(x[1, l − 1]0X[l + 1, n], l, 1)) ≤ 12α, where l ∈ [ n 2 + 1, n] and x[1, l − 1] are uniformly distributed. We now end with the main lemma which combines both previous ones and applies the cut-and- paste property, where Players A, C are grouped. Lemma 12. Let P be a randomized protocol for WeakIndex(n, 1) with bounded error ǫ, and transcript Π satisfying Π ≤ αn and max {I(D : ΠBX, K), I(K, D : ΠCX)} ≤ α. Then α ≥ (1 − 2ε)/10. Proof. Let L be a uniform integer random variable in [ n 2 + 1, n]. Remind that we enforce the output of P to be part of Π. Therefore, any player, and in particular B, can compute f with bounded error ε given Π. Since f (x[1, l − 1]0X[l + 1, n], l, 0) = 0 and f (x[1, l − 1]1X[l + 1, n], l, 1) = 1, the error parameter ε must satisfies E x[1,l−1],lkΠ(x[1, l − 1]0X[l + 1, n], l, 0) − Π(x[1, l − 1]1X[l + 1, n], l, 0)k1 ≥ 2(1 − 2ε). The rest of the proof consists in upper bounding the LHS by 19α. Applying the triangle inequality and that (u+ v)2 ≤ 2(u2 + v2) on the inequalities of Lemmas 10 and 11 gives E x[1,l−1],l h2(Π(x[1, l − 1]0X[l + 1, n], l, 0), Π(x[1, l − 1]1X[l + 1, n], l, 1)) ≤ 30α. We then apply the cut-and-paste property by considering (A, C) as a single player with transcript ΠA,C. Therefore E x[1,l−1],l h2(Π(x[1, l − 1]0X[l + 1, n], l, 1), Π(x[1, l − 1]1X[l + 1, n], l, 0)) ≤ 30α. Combining again with the inequality from Lemma 11 gives E x[1,l−1],l h2(Π(x[1, l − 1]0X[l + 1, n], l, 0), Π(x[1, l − 1]1X[l + 1, n], l, 0)) ≤ 42α. Last, we get the requested upper bound by using the connexion between the Hellinger distance and the ℓ1-distance, and the convexity of the square function. 4 Bidirectional streaming algorithm for PQ Remember that in this section our stream is given without any timestamps. Therefore we consider in this section only streams w of ins(a), ext(a), where a ∈ [0, U ]. For the sake of clarity, we assume for now that the stream has no duplicate. Our algorithms can be extended to the general case, but the technical difficulties shadow the main ideas. Up to padding we can assume that N is a power of 2: we append a sequence of ins(a)ext(a)ins(a + 1)ext(a + 1) . . . of suitable length, where a is large enough so that there 8 is no duplicate (assuming that w is of even size, otherwise w 6∈ PQ(U )). We use O(log N ) bits of memory to store, after the first pass, the number of letters padded. We use a hash function based on the one used by the Karp-Rabin algorithm for pattern match- ing. For all this section, let p be a prime number in {max(2U + 1, N c+1), . . . , 2 max(2U + 1, N c+1)}, for some fixed constant c ≥ 1. Since our hash function is linear we only define it for single inser- tion/extraction as hash(ins(a)) = αa mod p, and hash(ext(a)) = −αa mod p, where α is a randomly chosen integer in [0, p − 1]. This is the unique source of randomness of our algorithm. A hashcode h encodes a sequence w if h = hash(w) as a formal polynomial in α. In that case we say that h includes w[i], for all i. Moreover w is balanced if the same integers have been inserted and extracted. In that case it must be that h = 0. We also say that h is balanced it it encodes a balanced sequence w. The converse is also true with high probability by the Schwartz-Zippel lemma. Fact 13. Let w be some unbalanced sequence. Then Pr(hash(w) = 0) ≤ N p ≤ 1 N c . The forward-pass algorithm was introduced in [7], but the reverse-pass one is even simpler. As a warming up, we start by introducing the later algorithm. In order to keep it simple to understand, we do not optimize it fully. Last define the instruction Update(h, v) that returns (h + hash(v) mod p) and updates h to that value. 4.1 One-reverse-pass algorithm for PQ Our algorithm decomposes the stream w into blocks. We call a valley an extraction w[t] = ext(a) with w[t + 1] = ins(b). A new block starts at every valley. To the i-th block we associate a hashcode hi and an integer mi. Hashcode hi encodes all the extractions within the block and the matching insertions. Integer mi is the minimum of extractions in the block. With the values (mi)i, one can encode insertions in the correct hi if w ∈ PQ. Observe that we use index notations for block indices and bracket notations for stream positions. Algorithm 1 uses memory space O(r), where r is the number of valleys in w. We could make it run with memory space O(√N log N ) by reducing the number of valleys as in [7]. We do not need to as we use another compression in the two-pass algorithm. We first state a crucial property of Algorithm 1, and then show that it satisfies Theorem 15, when there is no duplicate. We remind that we process the stream from right to left. Lemma 14. Consider Algorithm 1 right after processing ins(a). Assume that ext(a) has been already processed. Let hk, hk′ be the respective hashcodes including ext(a), ins(a). Then k = k′ if and only if all ext(b) occurring between ext(a) and ins(a) satisfy b > a. Theorem 15. There is a 1-reverse-pass randomized streaming algorithm for PQ(U ) with memory space O(r(log N + log U )) and one-sided bounded error N −c, for inputs of length N with r valleys, and any constant c > 0. Proof. We show that Algorithm 1 suits the conditions, assuming there is no duplicate. Let w ∈ PQ(U ). Then w always passes the test at line 10. Moreover, by Lemma 14, each insertion ins(a) is necessarily in the same hashcode than its matching extraction ext(a). Therefore, all hashcodes 9 Algorithm 1: One-reverse-pass algorithm for PQ 1 m0 ← −∞; h0 ← 0; t ← N ; i ← 0 // i is called the block index 2 While t > 0 If w[t] = ins(a) k ← max{j ≤ i : mj ≤ a}; // C o m p u t e the h a s h c o d e index of a Update(hk, w[t]) Else w[t] = ext(a) If w[t + 1] = ins(b) // This is a valley . We start a new block Else w[t + 1] = ext(b) i ← i + 1; mi ← a; hi ← 0 // Create a new h a s h c o d e Check (a ≥ b) // Check that e x t r a c t i o n s are well - o r d e r e d Update(hi, w[t]) t ← t − 1 3 4 5 6 7 8 9 10 11 12 13 For j = 0 to i: Check (hj = 0) // Check that h a s h c o d e s are b a l a n c e d w . h . p . 14 Accept // w s u c c e e d e d to all checks equal 0 at line 13 since they are balanced. In conclusion, the algorithm accepts w with probability 1. Assume now that w 6∈ PQ. First we show that unbalanced w are rejected with high probability, that is at least 1 − N −c, at line 13, if they are not rejected before. Indeed, since each w[t] is encoded in some hj, at least one hj must be unbalanced. Then by Fact 13, the algorithm rejects w.h.p. We end the proof assuming w balanced. We remind that we process the stream from right to left. The two remaining possible errors are: (1) ins(a) is processed before ext(a), for some a; and (2) ext(a), ext(b), ins(a) are processed in this order with b < a and possibly intermediate insertions/extractions. In both cases, we show that some hashcodes are unbalanced at line 13, and therefore fail the test w.h.p by Fact 13, except if the algorithm rejects before. Consider case (1). Since ins(a) is processed before ext(a), there is at least one valley between ins(a) and ext(a). Therefore ins(a) and ext(a) are encoded into two different hashcodes, that are unbalanced at line 13. Consider now case (2). Lemma 14 gives that ext(a) and ins(a) are encoded in two different hashcodes, that are again unbalanced at line 13. 4.2 Bidirectional two-pass algorithm Algorithm 2 performs one pass in each direction using Algorithm 3. We use the hierarchical data structure of [15] in order to reduce the number of blocks. A block of size 2i is of the form [(q − 1)2i + 1, q2i], for 1 ≤ q ≤ N/2i. Observe that, given two such blocks, either they are disjoint or one is included in the other. We decompose dynamically the letters of w, that have been already processed, into nested blocks of 2i letters as follows. Each new processed letter of w defines a new block. When two blocks have same size, they merge. All processed blocks are pushed on a stack. Therefore, only the two topmost blocks of the stack may potentially merge. Because the size of each block is a power of 2 and at most two blocks have the same size (before merging), there are at most log N + 1 blocks at any time. Moreover, since our stream size is a power of 2, all blocks eventually appear in the hierarchical decomposition, whether we read the stream from left to right or from right to left. In fact, if two same-sized blocks appear simultaneously in one decomposition before merging, the same is true in 10 Algorithm 2: Bidirectional 2-pass algorithm for PQ 1 O n e P a s s A l g o r i t h m (w) 2 O n e P a s s A l g o r i t h m (w) 3 Accept // w s u c c e e d e d to all checks r e a d i n g stream from left to right r e a d i n g stream from right to left Algorithm 3: OnePassAlgorithm 1 S ← []; 2 If left - to - right - pass Then Push (S ,(0,−∞, 0)) // I n i t i a l i z a t i o n of S 3 While stream is not empty 4 5 6 7 Read ( next letter v on stream ) // See below While the 2 t o p m o s t e l e m e n t s of S have same block size ℓ (h1, m1, ℓ) ←Pop (S ); (h2, m2, ℓ) ←Pop (S ) Push (S ,(h1 + h2 mod p, min(m1, m2), 2ℓ)) // Merge of 2 blocks 8 If left - to - right - pass Then Check (S = [(0,−∞, 0), (0, 0, N )]) 9 Else Check (S = [(0, 0, N )])} 10 Return 11 12 F u n c t i o n Read ( v ): 13 Case v = ins(a) // When r e a d i n g an i n s e r t i o n 17 Case v = ext(a) and left - to - right - pass // When r e a d i n g an e x t r a c t i o n Let (h, m, ℓ) be the first item of S from top such that a ≥ m R e p l a c e (h, m, ℓ) by (Update(h, v), m, ℓ) Push (S, (0, +∞, 1)) For all items (h, m, ℓ) on S such that m > a: Check (h = 0) Let (h, m, ℓ) be the first item of S from top such that a > m R e p l a c e (h, m, ℓ) by (Update(h, v), m, ℓ) Push (S ,(0, a, 1)) 14 15 16 18 19 20 21 22 Case v = ext(a) and right - to - left - pass // When r e a d i n g an e x t r a c t i o n 23 24 For all items (h, m, ℓ) on S such that m > a: Check (h = 0) Push (S ,(hash(v), a, 1)) the other decomposition. This point is crucial for our analysis. Algorithm 3 uses the following description of a block B: its hashcode hB , the minimum mB of its extractions, and its size ℓB. For the analysis, we also note tB the index such that w[tB] = mB. Among those parameters, only hB can change without B being merged with another block. On the pass from right to left, all extractions from the block and the matching insertions are included in hB. On the pass from left to right, insertions are included in the hashcode of the earliest possible block where they could have been, and the extractions are included with their matching insertions. The minimums (mB)B are used to decide where to include values (except extractions on the pass from right to left). Observe that it is important to check that hB = 0 whenever possible and not at the end of the execution of the algorithm, since only one block is left at the end. When there is some ambiguity, we denote by h→ B and h← B the hashcodes for the left-to-right and right-to-left passes. Observe that mB, tB, ℓB are identical in both directions. Proof of Theorem 4. We show that Algorithm 2 suits the conditions, assuming there is no duplicate. The space constraints are satisfied because each element of S takes space O(log N + log U ) and S has size at most log N + 1. The processing time is from inspection. 11 ins(a): case 1 ext(mB) ins(a): case 2 ext(b) ext(a) ins(a): case 3 ext(mc) ins(a): case 1 ρ′ tB ρ′ B τ ρ ρ′ tC ρ′ C Figure 2: Relative positions of insertions and extractions used in the proof of Theorem 4 As with Theorem 15, inputs in PQ(U ) are accepted with probability 1, and unbalanced inputs are rejected with high probability (at least 1−N −c). Let w 6∈ PQ be balanced. For ease of notations, let w[−1] = ins(−∞) and w[0] = ext(−∞). Then, there are τ < ρ such that w[τ ] = ext(b), w[ρ] = ext(a), a > b, and w[t] 6= ins(a) for all τ < t < ρ. Among those pairs (τ, ρ), consider the ones with the smallest ρ. From those, select the one with the smallest b, with w[τ ] = ext(b). Let B, C be the largest possible disjoint blocks such that τ is in B and ρ in C. Then B and C have same size, are contiguous, and appear simultaneously in each direction before they merge. Let ρ′ and τ ′ be such that w[ρ′] = ins(a) and w[τ ′] = ins(b). The minimality of ρ and the minimality of b guarantee that w[t] is an insertion for all τ < t < ρ. Indeed if w[t] = ext(c) either b > c, which contradicts the minimality of b, or c > b and (τ, t) contradicts the minimality of ρ. In particular, tC ≥ ρ and tB ≤ τ . Similarly τ < τ ′, otherwise τ would be a better candidate than ρ. 6∈ [tB, tC], tB < ρ′ < τ , and ρ < ρ′ < tC. These cases determine in which hashcode ins(a) is included. We analyze Algorithm 3 when some letter is processed before blocks potentially merge. We distinguish three cases based on the position ρ′ of ins(a) (see Figure 2): ρ′ Case 1: ρ′ 6∈ [tB, tC]. One can prove that h→ h← C is unbalanced when w[tB] is processed; therefore Algorithm 3 detects w.h.p. h→ depending on whether mB > mC (see Lemma 19 in Appendix B). B is unbalanced when w[tC ] is processed and that C 6= 0 Case 2: tB < ρ′ < τ . We show that when Algorithm 3 processes w[tB] = ext(mB), it checks B 6= 0 or h← h← D = 0 at line 23 for some h← D including ins(a) but not ext(a). Thus it rejects w.h.p. When w[ρ′] = ins(a) is processed on the right-to-left pass, τ ∈ B1 with B1 a block in the stack. τ ∈ B, therefore B1 intersects B. Because B1 6⊆ B, we have B1 ⊆ B. Because w[τ ] = ext(b), we have a > b ≥ mB1, and block B1 is eligible at line 14 of Algorithm 3, meaning that w[ρ′] = ins(a) is included in either h← B2. Since ρ′ ∈ B, again B2 ⊆ B. Last, when Algorithm 3 processes w[tB] = ext(mB), since we are still within B, some hashcode hB3, with B3 ⊆ B, includes w[ρ′]. Moreover, h← B3 does not include w[ρ] = ext(a) since ρ ∈ C and C comes before B. Last, mB3 > mB, by definition of mB. Hence, Algorithm 3 checks h← B3 = 0 at line 23 when processing w[tB]. B3 satisfies the conditions for D when w[tB] is processed, and Algorithm 3 rejects w.h.p. B1 or a more recent hashcode h← Case 3: ρ < ρ′ < tC. The proof is the same as case 2, replacing τ , B, B1, B2, B3, h← B1, h← B2 , C3, tC, B and line 23 with line 18. Note that we only h← B3, tB, C with ρ, C, C1, C2, C3, h→ have a ≥ mC1 this time, so it is important that the inequality at line 14 is large and not strict. C2, h→ C1 , h→ 4.3 Generalization when duplicates occur We maintain two additional parameters δB and CB for each block B. The difference between the number of insertions and extractions included in hB is stored in δB. Whenever δB = 0, we 12 check hB = 0. The number of unmatched occurrences of ins(mB) for the left-to-right pass (resp. ext(mB) for the right-to-left pass) is stored in CB. We can then appropriately determine whether each ext(mB) (resp. ins(mB)) should be included in hB. The change on the criterion of line 14 of Algorithm 3 makes the proof of case 3 of the theorem longer and breaks the symmetry. Acknowledgements Authors would like to thank Rahul Jain and Ashwin Nayak for sharing their intuition and possible extensions of [10]. In particular, N.F. thanks Ashwin Nayak for having hosted him at IQC, Univer- sity of Waterloo. They also thanks Christian Konrad, Wei Yu, Qin Zhang for related discussions, and Andrew McGregor for motivating us to study restricted instances of PQ. References [1] N. Alon, Y. Matias, and M. Szegedy. The space complexity of approximating the frequency moments. Journal of Computer and System Sciences, 58(1):137 -- 147, 1999. [2] Z. Bar-Yossef, T. S. Jayram, R. Kumar, and D. Sivakumar. An information statistics approach to data stream and communication complexity. Journal of Computer and System Sciences, 68(4):702 -- 732, 2004. [3] M. Blum, W. S. Evans, P. Gemmell, S. Kannan, and M. Naor. Checking the correctness of memories. Algorithmica, 12(2):225 -- 244, 1994. [4] M. Blum and S. Kannan. Designing programs that check their work. Journal of the ACM, 42(1):269 -- 291, 1995. [5] M. Braverman. Interactive information complexity. In Proc. of ACM Symp. on Theory of Computing, pages 505 -- 524, 2012. [6] M. Braverman and A. Rao. Information equals amortized communication. In 748-757, editor, Proc. of IEEE Symp. on Foundations of Computer Science, 2011. [7] A. Chakrabarti, G. Cormode, R. Kondapally, and A. McGregor. Information cost tradeoffs for augmented index and streaming language recognition. In Proc. of IEEE Symp. on Foundations of Computer Science, pages 387 -- 396, 2010. [8] A. Chakrabarti, Y. Shi, A. Wirth, and A. C.-C. Yao. Informational complexity and the direct sum problem for simultaneous message complexity. In Proc. of IEEE Symp. on Foundations of Computer Science, pages 270 -- 278, 2001. [9] M. Chu, S. Kannan, and A. McGregor. Checking and spot-checking the correctness of priority queues. In Proc. of Int. Colloquium on Automata, Languages and Programming, pages 728 -- 739, 2007. [10] R. Jain and A. Nayak. The space complexity of recognizing well-parenthesized expressions in the streaming model: the index function revisited, 2010. ECCC Tech. Rep. TR10-071. 13 [11] R. Jain, J. Radhakrishnan, and P. Sen. A lower bound for the bounded round quantum communication complexity of Set Disjointness. In Proc. of IEEE Symp. on Foundations of Computer Science, pages 220 -- 229, 2003. [12] T. S. Jayram, Ravi Kumar, and D.Sivakumar. Two applications of information complexity. In Proc. of ACM Symp. on Theory of Computing, pages 673 -- 682, 2003. [13] I. Kerenidis, S. Laplante, V. Lerays, J. Roland, and D. Xiao. Lower bounds on information complexity via zero-communication protocols and applications. In Proc. of IEEE Symp. on Foundations of Computer Science, 2012. To appear. [14] C. Konrad and F. Magniez. Validating XML documents in the streaming model with external memory. In Proc. of Int. Conf. on Database Theory, pages 34 -- 45, 2012. [15] F. Magniez, C. Mathieu, and A. Nayak. Recognizing well-parenthesized expressions in the streaming model. In Proc. of ACM Symp. on Theory of Computing, pages 261 -- 270, 2010. [16] S. Muthukrishnan. Data Streams: Algorithms and Applications. Now Publishers Inc., 2005. [17] M. Saks and X. Sun. Space lower bounds for distance approximation in the data stream model. In Proc. of ACM Symp. on Theory of Computing, pages 360 -- 369, 2002. A Missing proofs for the lower bound We start by proving the lemma relating the streaming complexity of deciding if an in- stance of Raindrops(m, n) belongs to PQ-TS(3mn) to the communication complexity of WeakIndex(n, m). Proof of Lemma 8. Assume that there exists a p-pass randomized streaming algorithm with mem- ory space s(m, n), that decides if an instance of Raindrops(m, n) belongs or not to PQ-TS(3nm). Each instance of Raindrops(m, n) can be encoded by an input of WeakIndex(n, m), where each of the 3m players has one part of it. Then, the rest of the proof consists in showing how the players can use the algorithm in order to construct a protocol that satisfies the required properties of the lemma. Each player simulates alternatively the algorithm. A player performs the simulation until the algorithm reaches the part of the input of the next player. Then the player sends the current state of the algorithm, so that the next player can continue the simulation. Since the algorithm uses at most memory space s(m, n), the current state can be encoded using s(m, n) bits. Each pass corresponds to one round of communication, implying the result. Before giving the next missing proofs of Section 3, we state some useful properties of entropy and mutual information that we need. See [10] for more information. Fact 16. Let X, Y, Z, R be random variables such X and Z are independent when conditioning on R, namely when conditioning on R = r, for each possible values of r. Then I(X : Y Z, R) ≥ I(X : Y R). 14 Proof. From the definition of mutual information and the independence of X, Z when conditioning on R, we get that I(X : Y Z, R) = H(XZ, R) − H(XY, Z, R) = H(XR) − H(XY, Z, R). Using that entropy can only decrease under conditioning, and using again the definition of mutual information, we conclude by bounding the last term as H(XR) − H(XY, Z, R) ≥ H(XR) − H(XY, R) = I(X : Y R). Proposition 17 (Chain rule). Let X, Y, Z, R be random variables. Then I(X, Y : ZR) = I(X : ZR) + I(Y : ZX, R). Proposition 18 (Data processing inequality). Let X, Y, Z, R be random variables such that R is independent from X, Y, Z. Then I(X : Y Z) ≥ I(f (X, R) : Y Z), for every function f . Note that the previous property is usually stated with no variable T . Nonetheless, since T is independent from the other variables, we have I(X : Y Z) = I(X, R : Y Z), and then we can apply the usual data processing inequality. We can now prove our three lemmas. End of proof of Lemma 9. Let Π, Π′ be the respective transcripts of P, P ′. For convenience, note ΠCm+1 = ΠBm, ΠB0 = ΠCm and ΠCm+1 = ΠA1. Remind that the public coins of a protocol are included in its transcript. First, each player of P ′ sends 3 messages by round, and there are (p + 1) rounds. Since each message has size at most s(m, n), we derive that the length of Π′ is at most 3(p + 1)s(m, n). Then, in order to prove that there is only a small amount of information in the transcripts of Bob and Charlie, we show a direct sum of some appropriated notion of information cost. Consider first the transcript of Player C1. Because of the restriction on the size of his messages, we know that ΠC1 ≤ (p + 1)s(m, n). From this we derive a first inequality on the amount of information this transcript can carry, using that the entropy of a variable is at most its bit-size: I(K, D : ΠC1X) ≤ ΠC1 ≤ (p + 1)s(m, n). We now use the chain rule in order to get a bound about the information carried by P ′ on a single instance. I(K, D : ΠC1X) = ≥ m X j=1 m X j=1 m I((Ki, Di)j≥i : ΠC1X, (Ki, Di)i<j) (by chain rule) I(Kj, Dj : ΠBj−1X, (Ki, Di)i<j) (by data processing inequality) X j=1 I(Kj, Dj : ΠBj−1X) (by Fact 16) ≥ = m × I(KJ , DJ : ΠBJ −1X, J) = m × I(KJ , DJ : ΠBJ −1, J, (Xi)i6=JXJ ) (independence of J, (Xi)i6=J ) = m × I(K, D : Π′ (since J, (Xi)i6=J are public coins of P ′). (by conditioning on J) CX) 15 We then do similarly for Player Bm and therefore conclude the proof. First the size bound on messages of Bm gives I(ΠBm : DX, K) ≤ (p + 1)s(m, n). Then as before we get: I(D : ΠBmX, K) = m X j=1 I(Dj : ΠBmX, K, (Di)i>j) ≥ m X j=1 I(Dj : ΠCj+1X, K, (Di)i>j) ≥ m × I(DJ : ΠCJ +1, J, (Xi)i6=JXJ , KJ ) = m × I(D : Π′ BX, K). Proof of Lemma 10. From the second hypothesis and the data processing inequality we get that I(K, D : ΠA,CX) ≤ α, which after applying the average encoding leads to Ex,k,d h2(ΠA,C(x, k, d), ΠA,C (x, K, D)) ≤ κα. We now restrict µ0 by conditioning on D = 1. Then (X, K) is uniformly distributed. Moreover, since D = 1 with probability 3/4 on µ0, we get Ex,k h2(ΠA,C(x, k, 1), ΠA,C (x, K, 1)) ≤ 4 3 κα. Let J, L be uniform integer random variables re- spectively in [2, n 2 + 1, n]. Then the above implies Ex,j h2(ΠA,C(x, j, 1), ΠA,C (x, K, 1)) ≤ 8 3 κα and Ex,l h2(ΠA,C(x, l, 1), ΠA,C (x, K, 1)) ≤ 8 3 κα. Applying the triangle inequality and that (u + v)2 ≤ 2(u2 + v2), we get 2 ] and [ n E x,j,l h2(ΠA,C(x, j, 1), ΠA,C (x, l, 1)) ≤ 32 3 κα. Using the convexity of h2, we finally obtain for b = 0, 1: E x[1,l−1],j,l h2(ΠA,C(x[1, l − 1]bX[l + 1, n], j, 1), ΠA,C (x[1, l − 1]bX[l + 1, n], l, 1)) ≤ 64 3 κα. Now the chain rule allow us to measure the information about a single bit in ΠA,C as I(X[L] : ΠA,C(X, J, 1)X[1, L − 1]) = E l←L 2 n × I(X[ n = I(X[l] : ΠA,C(X, J, 1)X[1, l − 1]) 2 + 1, n] : ΠA,C(X, J, 1)X[1, n 2 ]). Since the entropy of a variable is at most its bit-size, we get that the last term is upper bounded by ΠA,C, which is at most αn by the first hypothesis. Then as before, the average encoding and the triangle inequality lead to E x[1,l−1],j,l h2(ΠA,C(x[1, l − 1]0X[l + 1, n], j, 1), ΠA,C (x[1, l − 1]1X[l + 1, n], j, 1)) ≤ 16κα. Combining gives E x[1,l−1],l h2(ΠA,C (x[1, l − 1]0X[l + 1, n], l, 1), ΠA,C (x[1, l − 1]1X[l + 1, n], l, 1)) ≤ 28α. Let RB be the random coins of B. Since they are independent from all variables, including the messages, the previous inequality is still true when we concatenate RB to ΠA,C. Then ΠB is uniquely determined from RB once K, D, X[1, K − 1] are fixed, which is the case in that inequality. Therefore replacing RB by ΠB can only decrease the distance, concluding the proof. 16 Proof of Lemma 11. Using the data processing inequality and the hypothesis we get that I(D : ΠX, K)) ≤ α. Therefore by average encoding, Ex,k,d h2(Π(x, k, d), Π(x, k, D)) ≤ κα. 2κα. Using the convexity of h2 and the fact that X[l] is a uniform random bit, we derive 2 + 1, n]. Then Ex,l,d h2(Π(x, l, d), Π(x, l, D)) ≤ Let L be a uniform integer random variable in [ n E x[1,l−1],l,d h2(Π(x[1, l − 1]0X[l + 1, n], l, d), Π(x[1, l − 1]0X[l + 1, n], l, D)) ≤ 4κα. Since D = 0 with probability 1/2 when X[l] = 0 and K = l, we finally get the two inequalities E x[1,l−1],l h2(Π(x[1, l − 1]0X[l + 1, n], l, 0), Π(x[1, l − 1]0X[l + 1, n], l, D)) ≤ 8κα, E h2(Π(x[1, l − 1]0X[l + 1, n], l, 1), Π(x[1, l − 1]0X[l + 1, n], l, D)) ≤ 8κα, leading to the conclusion using the triangle inequality and that (u + v)2 ≤ 2(u2 + v2). x[1,l−1],l B Missing proofs for the algorithm We start by proving the property of Algorithm 1 we use in the proof of Theorem 15. Proof of Lemma 14. Remind again, that we process the stream from right to left in this proof, and that hk, hk′ are the respective hashcodes including ext(a), ins(a). First assume that all ext(b) between ext(a) and ins(a) satisfy b > a. Let i be the current block index while processing ins(a). Observe that k is the current block index right after processing ext(a). Since ext(a) is processed before ins(a) and since there is a valley between ext(a) and ins(a), we have k < i. We prove that k′ = max{j ≤ imj ≤ a} = k. The first equality is from line 4 of Algorithm 1. We now prove the second equality. For each j ∈ {k +1, . . . , i}, value mj is extracted between ext(a) and ins(a). Then, our assumption leads to mj > a. Moreover, because the algorithm checks at line 10 that extraction sequences included in the same hashcode are decreasing, we have mk ≤ a, leading to the second equality. We now prove the converse by contrapositive. Assume that some ext(b) between ext(a) and ins(a) satisfies b ≤ a. Since we forbid duplicates, in fact b < a. Let j be the current block index right after processing ext(b). Then line 10 ensures that mj ≤ b. Again, k is the current block index right after processing ext(a), and therefore k ≤ j. If k = j, then the extraction sequence is not decreasing and line 10 rejects, contradicting the hypotheses that the algorithm has not rejected yet after processing ins(a). Therefore k < j. But, line 4 and the fact that mj ≤ b imply that k′ ≥ j, and therefore k < k′. We now give the missing part of the proof of Theorem 4. Lemma 19. If ρ′ 6∈ [tB, tC ], then Algorithm 2 rejects w with probability at least 1 − N −c. Proof. We prove that h→ C is unbalanced when w[tB] is processed. From that, we deduce that the algorithm rejects with high probability unless mB ≤ mC and mC ≤ mB, i.e. mB = mC, which is impossible because w has no duplicates and B and C are disjoint. B is unbalanced when w[tC ] is processed and that h← 17 Indeed if mC < mB then Algorithm 3 checks that h→ and rejects with high probability because h→ high probability at line 23 when processing w[tB] on the right-to-left pass. B = 0 at line 18 when processing w[tC], B is unbalanced. Similarly, if mC < mB, it rejects with B (resp. h← Now we only have to prove that h→ C ) is unbalanced when w[tC] (resp. w[tB]) is processed. Let us assume there exists B1 ( B such that ins(a) is included in h→ B1 when w[tB] is processed. Then, by definition of mB, mB1 > mB. Moreover, ρ ∈ C, so w[ρ] = ext(a) is not processed yet and not included in B1. Therefore, Algorithm 3 checks h→ B1 = 0 at line 18, and rejects w.h.p. We can now assume that there is no such B1 ( B, and therefore that hB, does not include ins(a) when w[tC ] is processed. Since h→ B is unbalanced when tC is processed. B1 , B, B1, tB and tC with h← C1 , C, B includes ext(a), h→ B , h→ The proof for h← C is the same as above, replacing h→ C , h← C1, tC and tB, and line 18 with line 23. 18
1906.07887
1
1906
2019-06-19T02:56:11
Tutorial on algebraic deletion correction codes
[ "cs.DS", "cs.IT", "eess.SP", "cs.IT" ]
The deletion channel is known to be a notoriously diffcult channel to design error-correction codes for. In spite of this difficulty, there are some beautiful code constructions which give some intuition about the channel and about what good deletion codes look like. In this tutorial we will take a look at some of them. This document is a transcript of my talk at the coding theory reading group on some interesting works on deletion channel. It is not intended to be an exhaustive survey of works on deletion channel, but more as a tutorial to some of the important and cute ideas in this area. For a comprehensive survey, we refer the reader to the cited sources and surveys. We also provide an implementation of VT codes that correct single insertion/deletion errors for general alphabets at https://github.com/shubhamchandak94/VT_codes/.
cs.DS
cs
Tutorial on algebraic deletion correction codes Kedar Tatwawadi∗, Shubham Chandak Stanford University April 2019 Abstract The deletion channel is known to be a notoriously difficult channel to design error-correction codes for. In spite of this difficulty, there are some beautiful code constructions which give some intuition about the channel and about what good deletion codes look like. In this tutorial we will take a look at some of them. This document is a transcript of my talk at the coding theory reading group on some interesting works on deletion channel. It is not intended to be an exhaustive survey of works on deletion channel, but more as a tutorial to some of the important and cute ideas in this area. For a comprehensive survey, we refer the reader to the cited sources and the following papers and surveys [8, 10, 12]. We also provide implementation of VT codes that correct single insertion/deletion errors for general alphabets at https://github.com/shubhamchandak94/VT_codes/. 1 Introduction Deletion channel is one of the most fundamental of the channels, and is still not well understood. Most of you would know what a deletion channel/error looks like. But, to give an example, this is what a single deletion looks like: Here the decoder receives the message 1010 and needs to recover the original message. This corresponds 10110 → 1010 to a single deletion, either in position 3 or 4. We cannot say what position the deletion occurred. In relation to our favourite erasure channel, where such a single error might look like: Here, we know what positions the erasure happened. The deletion channel is in fact a strictly worse channel, as we can convert the erasure channel output into a deletion channel output, by simply removing all the 'e' symbols from the output. 10110 → 10e10 We will also see that it has connections to our second favourite channel the Binary Symmetric Channel (BSC) channel. 1.1 Capacity of Deletion Channel We define a binary deletion channel, BDC with deletion rate α, where each symbol in input xn can get deleted with probability α. This definition has similarities with the BEC and BSC, but that's where the similarity ends. Surprisingly unlike BEC and BSC, we know quite less about BDC. 1. We still do not know the capacity of the BDC channel. One reason is that BDC is not really a discrete memoryless channel (DMC). For a DMC, you should be able to write: ∗Corresponding author: [email protected] p(ynxn) = n Yi=1 p(yixi) 1 We cannot write the same for deletion channels, one reason: as the output does not have "length" n, and is in fact a random variable. Shannon theory gives us a nice characterization for the capacity of DMCs: C = max p(x) I(X; Y ) (1) But, without this nice expression, finding the capacity is a much more difficult task. 2. We can of course get some bounds on the deletion channel capacity. For example: we know that binary erasure channel is strictly better than the BDC. Thus: CBDC (α) ≤ 1 − α (2) This has been an open problem since quite some time now, but there has been some recent progress on this, which I will briefly talk about. Most of the results are a part of the survey by Mitzmacher [10]. Kalai, Mitzenmacher, and Sudan [7] showed that when α → 0 the capacity is almost equal to the BSC. Best known capacity lower bounds I am aware of are [5]: 0.11(1 − α) . Recently, improved capacity upper bounds were obtained by Cheraghchi [4] which state that: CBDC ≤ (1 − α) log Φ (3) for α ≥ 0.5, where Φ is the golden ratio. For those of you who are interested, they essentially find capacity bounds for a channel known as Poisson repeat channel (the number of times each symbol is repeated is a Poisson random variable), which are then ported over for deletion channel as a special case. This is mainly to give a sense of how difficult the deletion channel analysis is, and how little we really know about it. Typically, not knowing the capacity directly translates to not knowing good codes. But, surprisingly we know some nice code constructions in specific cases, which we will discuss next. Deletion channel is also related to the insertion channel, or the indel channel, where both insertions and deletions happen, or general edit distance channels: indels + substitutions/reversals. A better understanding of the deletion channel is useful not just for communication, but for the problem of denoising, which is quite common (say when we type things and miss a character). 2 Adversarial deletion error We spoke about "Shannon-type" random deletion error capacity. But, for majority of the talk, we will mainly talk about the adversarial error, where when we say e errors, we mean at max e symbols are deleted. In this context let us define an e-deletion error correction code. Definition 1 For any vector u ∈ Fn obtained after e deletions. 2 we define De(u) as the descendants; i.e. all the vectors in Fn−e 2 For example: For u = 01101, D1(u) = {0110, 0111, 0101, 1101} For u = 00000, D1(u) = {0000} Thus the descendant balls need not be of the same sizes unlike the Hamming balls we are familiar with. And this will lead to some interesting scenarios as we will see. In fact we can analyze the size of 1-deletion balls: Lemma 1 The size of 1-deletion Descendant ball D1(un) of a vector un is equal to the number of "runs" in un. 2 For example: u7 = 0010111 has 4 runs in total 00, 1, 0, 111. Thus, D1(u7) = 4. It is easy to see why this is true: Any deletion in a run essentially leads to the same n − 1 length sequence in the descendant ball. Definition 2 We call a subset C ⊂ Fn De(v) = φ 2 to be a e-error correction code, if for any u, v ∈ C, u 6= v, De(u) ∩ We will mainly deal with e = 1 during the talk. 2.1 Repetition coding Lets start with the simplest of the 1-deletion correction codes you can think of: "repetition codes". We repeat every symbol 2 times. Is that sufficient? Let us say, we observe some symbol an odd number of times, then we know that a symbol was deleted in that runs of 0's or 1's. Note that, we still cannot figure out the location of the deletion, but can figure out what was deleted. This idea can in fact be extended to correct e deletions by repeating every symbol e + 1 times. But, this is quite bad: For correcting 1 error, our communication rate is 0.5. Still better that the BSC case, where we had to repeat things 3 times. Cool! Can we do better? We will next look at a cool class of codes known as the VT-codes; or the Varshamov-Tenengolts code. But before doing let's look at a puzzle. 2.2 A puzzle I believe the puzzle has some connection with VT-codes, might help with the understanding; but if not, it is a cool simple puzzle! So lets say, Mary is the Queen of the seven kingdoms, and she had ordered 100 big barrels filled with gold coins, where each coin has a weight of 10gm. But, she knows from her secret agency that one of the barrels contains counterfeit coins weighing only 9gm. She has an electric weighing scale which she can use; so the question is: How can she determine which barrel contains the counterfeit coins with a single measurement The solution is simple: she takes j coins from the jth barrel and places them on the electronic weighing scale. Now if the weight is less that expected by r grams, then it is the rth barrel which is counterfeit! We will come back to this puzzle :) 3 VT-codes Allright! We are all set to define VT-codes. Definition 3 Varshamov-Tenengolts code V Ta(n) ⊂ Fn 2 is defined as: V Ta(n) =(xn n Xi=1 ixi ≡ a mod (n + 1)) (4) Some historical context on these codes: These codes were first proposed as error correction codes for 1-bit Z-channel error! Which means essentially 1 → 0, but not the other way round. Z-channel errors are known as asymmetric bit-flips. Varshamov and Tenengolts proposed these codes in 1965 [14], and then Levenshtein discovered that these codes in fact work well also for the deletion channel as well! Z-channel correction So before we look into 1 deletion correction, let us see how they can correct one Z-channel error, i.e. one of the 1's can flip to a 0. Let xn be the received symbol: then we can still compute: S = a − ixi n Xi=1 3 In case, there is a 1 → 0 flip at position j, then S = j. Thus, we can correct the Z-channel error! Here is where the similarity with the puzzle can be seen. 3.1 VT-codes decoding We are all set to discuss the decoding for deletion channel: 1. First of all, note that if it is only a deletion channel, then "error detection" comes for free from the length of the code, unlike the bit-flipping error 2. Let yn−1 be the received erroneous codeword after 1 deletion. Define: n−1 w = Xi=1 S = a − yi n−1 Xi=1 iyi (5) (6) 3. Let p be the position at which deletion occurred, as in xp was deleted. Let L0, L1 be the counts of 1,0 to the left of position p. and R0, R1 be the counts to the right. In that case: S = R1 if xp = 0 and S = p + R1 if xp = 1. S = p + R1 = L0 + L1 + 1 + R1 = w + L0 + 1 Thus, as R1 < w + 1, if S ≤ w, 0 is deleted at a position with R1 1's to its right, otherwise, 1 is deleted such that there are L0 = S − w − 1 zeros to its left. 4. Note that we can thus uniquely determine the xn sequence, but we cannot determine the exact location of the deletion here, as it can be any 0 or 1 in the run we identified. This beautiful decoding algorithm was given by Levenshtein in his 1965 work [8]. Also most of the things which I will talk are from the survey by Sloane [12]. 3.2 VT-codes rate As the VT-codes are combinatorial, we can get exact formulae for their sizes. Exact combinatorial formulate can be found in [12]. Here are few interesting things: 1. Lemma 2 For some a ∈ [0, n]: As every xn ∈ Fn V Ta(n) ≥ 1 lies in exactly one of V Ta(n) sets: 2n n + 1 This leads to the lemma. n Xa=0 V Ta(n) = 2n 2. It can be in fact shown that a = 0 leads to the largest code size, and a = 1 the smallest size. 3. For n = 2q − 1, all the VT-code sizes are in fact equal to 2n n+1 . V T0(n) ≤ V Ta(n) ≤ V T1(a) 4 3.3 Optimality of VT-codes We say a e-error correction code is "optimal" if it has the smallest size amongst all e-error correction codes. Let us analyze the "optimality" of VT-codes. 1. Levenshtein [8] showed that, optimal 1-deletion correction codes have asymptotic sizes ≈ 2n n . This makes VT-codes asymptotically optimal. 2. People have not been able to prove that VT-codes are optimal non-asymptotically. Finding the "op- timal" 1-deletion code is a NP-hard problem, as it involves finding the independent set on the graph where vertices are connected if they lead to the same deletion descendants [12]. But for n ≤ 8 it is known that they are optimal, using computer programs. Sizes of these codes are: 1, 2, 2, 4, 6, 10, 16, 30 For higher n due to the exponential nature of the algorithms, we cannot say anything yet. 3. VT-codes also have the property that they are "perfect codes" [9] which implies that their descendent sets which are disjoint cover the entire 2n−1 sized. For example: V T0(3) = {000, 101} Descendants = {00, 10, 01, 11} Levenshtein showed that surprisingly, this is true for all a, which is quite cool in itself! The perfect codes analogy comes from Hamming codes being Perfect. But, unlike the Hamming distortion case, here perfect codes does not imply optimal codes? Why? For example, code {000, 111} is not perfect but is perhaps a better code that V T0(3), potentially there might be a larger code for larger n. Why does this happen? Because, the number of descendants are not fixed, some have 1 and some have more. 4. Linearity: VT codes are linear until n = 4 but never after! [12]. Variants of VT-code (restrictions on VT-codes) can be made linear by considering redundancy to be √n as against log n. Althought I am not sure how is linearity of codes useful, if the decoding is still non-linear (linear time complexity, but non-linear in nature). 3.4 Systematic Encoding Now that we have taken a look at the linear-time decoding of VT-codes, it is a natural question to ask if there exist a nice way to encode data. This problem surprisingly remained open for more than 30 years until 1998 when Abdel-Gaffar et al. [1] provided a very convenient way of in fact "systematic encoding" of data. 1. For n = 2q − 1, let m = 2q − q − 1 be the number of data bits, and q are the "parity" bits. Let the data bits be b1, b2, . . . , bm, and the code-word to be formed xn in V Ta(n). 2. Fill in the data except in positions 1, 2, 22, 23, . . . , 2q−1. Thus xn codeword looks like: x1, x2, b1, x4, b2, b3, b4, x8, . . . , bm We can compute: S = a−P2q are decided, to obtain S = 0, we need: −1 i=1 ixi mod (2q). As most of the positions of xn (except x2j , j ∈ [0, q−1]) 2jx2j mod (2q) = a q−1 Xj=0 We can now conveniently choose x2j , j ∈ [0, q − 1] as the q-bit binary expansion of a. 3. Note that m = 2q − q − 1, n = 2q − 1 for 1-deletion correction is exactly same as the rate of Hamming code. Not sure if this is a coincidence or something more! 5 4 Insertion + Deletion + Substitution codes We looked at 1-deletion correction channels in depth. In the next part of the tutorial, we will extend this understanding to more general scenarios. The first scenario is 1 insertion instead of 1 deletion error. 4.1 General indel error codes Levenshtein [8] showed this general lemma: Lemma 3 Any s-deletion correction code can also correct s1 deletions and s2 insertion errors where s1+s2 ≤ s. Note that here we do not need to know s1, s2 beforehand. The general proof is quite simple. Here, we will prove the simpler version of 1-insertion error, as that is sufficient to get an intuitive understanding. 1. Let us assume that C is a 1-deletion correction code. We want to show that C can correct 1-insertion errors as well. 2. Let us assume that on the contrary, there exist codewords xn, yn ∈ C such that after one insertion error in them the resulting noisy codewords xn+1, yn+1 are equal. Let the insertion occured at position i in xn+1 and at position j in yn+1. 3. As xn+1 = yn+1, even after deleting symbols in position i, j in both x, y, results in n− 1 vectors which are equal. However, the n − 1 length codewords are in fact 1-deletion descendants of the codewords xn, yn ∈ C. This is contradictory to the definition of deletion correction codes, as no descendants can be equal. Thus, C has to be 1-insertion correction as well. Note that, this is more of an existential result, and efficient deletion error decoding algorithms might not translate into efficient insertion detection algorithms. 4.2 VT-codes for 1-insertion, deletion, substitution correction Levenshtein showed the surprising fact that with a simple modification standard VT-codes can be converted into 1-insertion, deletion and substitution correction codes. The modification is as follows: V T a(n) ⊂ Fn 2 is defined as: V T a(n) =(xn n Xi=1 ixi ≡ a mod (2n + 1)) (7) Let us try to understand why V T a(n) work: 1. First of all, from the length of the code, we know whether there is an insertion, deletion or a substitution. 2. Recollect that deletion error correction in V Ta(n) codes only depends on distinct remainders modulus (n + 1). This should still hold true if the modulus is taken m ≥ n + 1. Thus, with m = 2n + 1, 1-deletion correction still holds. 3. 1-insertion code ability was already shown from the general lemma earlier. However, using a similar remainder trick mod 2n + 1, insertions can in fact be corrected efficiently using the V T a(n) codes. 4. The only case remaining to analyze is the 1-substitution or 1-bitflip case. Let 0 → 1 at position p ∈ [1, n] in the codeword xn resulting in the noisy codework xn. Clearly: ixi mod (2n + 1) n S = a − Xi=1 = 2n − p 6 If 1 → 0, then: n Xi=1 S = a − = p ixi mod (2n + 1) As all these S values are distinct, we can correct for 1-bitflip. Note that, this construction is not optimal just for 1-bitflip, as it essentially encodes 1 bit less than Hamming codes. 5 VT-codes for larger alphabet Creating deletion codes for larger alphabets becomes a bit tricky. Of course, repetition coding still works on non-binary alphabets. Code which does not work When I started thinking about this problem, I came up with this code, which has a bug! Let us still take a look at it, as it gives some understanding as to the intricacies of code-design: Define βi for i ∈ [2, n] as: Then we consider code as: βi = 1, xi 6= 0 = 0, otherwise C =(cid:26)xn n n Xi=1 Xj=1 iβi = a mod (n + 1), xi = b mod (q)(cid:27) Let us look at the argument as to why the code works, and try to find the bug! Argument: The first equation, similar to the binary VT code will tell us the position of the deletion, and the second equation tells us the value. Why does the above argument not work. The reason is that binary VT-codes not not actually tell us the position of the deletion correctly. They can tell us in which "run" the deletion happened, and hence obtain the codeword correctly, but not the exact position. How do we solve for that? Code which works This code appears in the work of Tenengolts in 1984. [13] Define αi for i ∈ [2, n] as: αi = 1, xi ≥ xi−1 = 0, xi < xi−1 Then we consider the code: C =(cid:26)xn n n Xi=2 (i − 1)αi = a mod (n), xi = b mod (q)(cid:27) Xj=1 7 Let us try to analyze the decoding for this code: 1. First of all, as in the previous code, from the second constraint Pn what is the value of the deleted symbol. What remains to determine is its position. j=1 xi = b mod (q), we figure out 2. The α sequence is essentially capturing the monotonous regions of the xn sequence. αi = 1, when the sequence is increasing (non-decreasing), and 0 when it is decreasing. Thus, a deletion in xn sequence will in fact lead to exactly 1 deletion in the α sequence (the position of deletion might be shifted by 1, but it does not matter as VT-codes do not correct for position). 3. As the first equation is a VT-code, it can determine the run in which the deletion occurred. As every run in α sequence corresponds to monotonic increasing/decreasing subsequence in xn, from the value of the deleted symbol, we can correctly place it and complete the decoding! Efficient systematic encoding for this code was discovered recently in a work by Abroshan et al. [2] and is included in the implementation at https://github.com/shubhamchandak94/VT_codes/. 6 Bursty deletion codes In this section we will look at Bursty deletions. By a single bursty deletion of size s, we mean that some consecutive s symbols were deleted. Note that, s-bursty deletion correction codes can correct for exactly 1 burst of size s, but surprisingly they need not correct for a burst of size s− 1. For example: C = {0101, 1010} can correct 2-bursty errors, but not single deletion errors! 6.1 VT-code based construction We consider a construction based on single-deletion correction VT-codes to correct a single burst of s deletions. How should one do that? One simple trick is to distribute these s deletions across the n length sequence, so that each n/s length subsequence has exactly 1 deletion. For simplicity, let n/s = k. Then the codeword xn has the property that each of the s rows below, belong to a V Ta(n) code. x1, xs+1, x2s+1, . . . , xn−s+1 x2, xs+2, x2s+2, . . . , xn−s+2 ... xs, x2s, x2s+2, . . . , xn 1. Let us analyze the scenario of 1 bursty error of size s from position xj, . . . , xj+s−1 are deleted. This corresponds to exactly 1 deletion in each of the rows. 2. We still need to figure out which symbols of the deleted codeword belong to which rows, as the alignment might no longer be true. The cool thing is that, if there are exactly s consecutive deletions, then every sth symbol will still be correctly aligned to the rows. 3. Thus, our code can in fact correct a bursty error of s deletions, but need not correct lower number of bursts, which is quite unusual! One important caveat to observe here is that the position of deletion in each of the rows is the same, or shifted by 1. Thus, if one of the rows is a VT-code, and the other rows just tell whether the error position is odd or even, that is enough to resolve the bursty error. This observation is the basis of further improvements to bursty error correction. For more details take a look at this paper: [11]. 8 7 Multiple Deletions One would imagine that it should be possible to extend the elegant construction of VT-codes from single deletion correction to multiple deletions. However, this problem has proved to be much more difficult. There have been some recent works which extend the single deletion errors to multiple errors. Gabrys et al [6] provide an extension of the VT-codes idea to correct two deletions. There have been other recent works which provide multiple deletion correcting codes using different (non VT-code based) ideas [3]. Acknowledgement I would like to thank Jay Mardia and Mary Wootters for interesting discussions on deletion codes. References [1] Khaled AS Abdel-Ghaffar and Hendrik C Ferreira. Systematic encoding of the Varshamov-Tenengol'ts codes and the Constantin-Rao codes. IEEE Transactions on Information Theory, 44(1):340 -- 345, 1998. [2] Mahed Abroshan, Ramji Venkataramanan, and Albert Guillen I Fabregas. Efficient systematic encoding of non-binary vt codes. In 2018 IEEE International Symposium on Information Theory (ISIT), pages 91 -- 95. IEEE, 2018. [3] Joshua Brakensiek, Venkatesan Guruswami, and Samuel Zbarsky. Efficient low-redundancy codes for correcting multiple deletions. IEEE Transactions on Information Theory, 64(5):3403 -- 3410, 2017. [4] Mahdi Cheraghchi. Capacity upper bounds for deletion-type channels. Journal of the ACM (JACM), 66(2):9, 2019. [5] Eleni Drinea and Michael Mitzenmacher. Improved lower bounds for the capacity of iid deletion and duplication channels. IEEE Transactions on Information Theory, 53(8):2693 -- 2714, 2007. [6] Ryan Gabrys and Frederic Sala. Codes correcting two deletions. IEEE Transactions on Information Theory, 65(2):965 -- 974, 2018. [7] Adam Kalai, Michael Mitzenmacher, and Madhu Sudan. Tight asymptotic bounds for the deletion In 2010 IEEE International Symposium on Information channel with small deletion probabilities. Theory, pages 997 -- 1001. IEEE, 2010. [8] Vladimir I Levenshtein. Binary codes capable of correcting deletions, insertions, and reversals. In Soviet physics doklady, pages 707 -- 710, 1966. [9] Vladimir I Levenshtein. On perfect codes in deletion and insertion metric. Discrete Mathematics and Applications, 2(3):241 -- 258, 1992. [10] Michael Mitzenmacher et al. A survey of results for deletion channels and related synchronization channels. Probability Surveys, 6:1 -- 33, 2009. [11] Clayton Schoeny, Antonia Wachter-Zeh, Ryan Gabrys, and Eitan Yaakobi. Codes correcting a burst of deletions or insertions. IEEE Transactions on Information Theory, 63(4):1971 -- 1985, 2017. [12] Neil JA Sloane. On single-deletion-correcting codes. Codes and designs, 10:273 -- 291, 2000. [13] Grigory Tenengolts. Nonbinary codes, correcting single deletion or insertion (Corresp.). IEEE Trans- actions on Information Theory, 30(5):766 -- 769, 1984. [14] RR Varshamov and GM Tenengolts. Codes which correct single asymmetric errors (in Russian). Au- tomatika i Telemkhanika, 161(3):288 -- 292, 1965. 9
1506.08518
2
1506
2015-12-22T08:31:43
Fast Computation of Abelian Runs
[ "cs.DS" ]
Given a word $w$ and a Parikh vector $\mathcal{P}$, an abelian run of period $\mathcal{P}$ in $w$ is a maximal occurrence of a substring of $w$ having abelian period $\mathcal{P}$. Our main result is an online algorithm that, given a word $w$ of length $n$ over an alphabet of cardinality $\sigma$ and a Parikh vector $\mathcal{P}$, returns all the abelian runs of period $\mathcal{P}$ in $w$ in time $O(n)$ and space $O(\sigma+p)$, where $p$ is the norm of $\mathcal{P}$, i.e., the sum of its components. We also present an online algorithm that computes all the abelian runs with periods of norm $p$ in $w$ in time $O(np)$, for any given norm $p$. Finally, we give an $O(n^2)$-time offline randomized algorithm for computing all the abelian runs of $w$. Its deterministic counterpart runs in $O(n^2\log\sigma)$ time.
cs.DS
cs
Fast Computation of Abelian Runs Gabriele Ficia,1, Tomasz Kociumakab,2, Thierry Lecroqc, Arnaud Lefebvrec, ´Elise Prieur-Gastonc aDipartimento di Matematica e Informatica, Universit`a di Palermo, Italy bFaculty of Mathematics, Informatics and Mechanics, University of Warsaw, Poland cNormandie Universit´e, LITIS EA4108, NormaStic CNRS FR 3638, IRIB, Universit´e de Rouen, 76821 Mont-Saint-Aignan Cedex, France 5 1 0 2 c e D 2 2 ] S D . s c [ 2 v 8 1 5 8 0 . 6 0 5 1 : v i X r a Abstract Given a word w and a Parikh vector P, an abelian run of period P in w is a maximal occurrence of a substring of w having abelian period P. Our main result is an online algorithm that, given a word w of length n over an alphabet of cardinality σ and a Parikh vector P, returns all the abelian runs of period P in w in time O(n) and space O(σ + p), where p is the norm of P, i.e., the sum of its components. We also present an online algorithm that computes all the abelian runs with periods of norm p in w in time O(np), for any given norm p. Finally, we give an O(n2)-time offline randomized algorithm for computing all the abelian runs of w. Its deterministic counterpart runs in O(n2 log σ) time. Keywords: Combinatorics on Words, Text Algorithms, Abelian Period, Abelian Run 1. Introduction Computing maximal (non-extendable) repetitions in a word is a classical topic in the area of string algorithms (see for example [1] and references therein). Maximal repetitions of substrings, also called runs, give information on the repetitive regions of a word, and are used in many applications, for example in the analysis of genomic sequences. Kolpakov and Kucherov [2] gave the first linear-time algorithm for computing all the runs in a word and conjectured that any word of length n contains less than n runs. Recently, Bannai et al. [3, 4], using the notion of Lyndon roots of a run, proved this conjecture and designed a much simpler algorithm computing the runs. Here we deal with a generalization of this problem to the commutative setting. Recall that an abelian power is a concatenation of two or more words that have the same Parikh vector, i.e., that have the same number of occurrences of each letter of the alphabet. For example, aababa is an abelian square, since aab and aba both have two a's and one b, i.e., the same Parikh vector P = (2, 1). When an abelian power occurs within a word, one can search for its "maximal" occurrence by extending it to the left and to the right character by character without violating the condition on the number of occurrences of each letter. Following the approach of Constantinescu and Ilie [5], we say that a Parikh vector P is an abelian period of a word w if w can be written as w = u0u1 · · · uk−1uk for some k ≥ 1 where for 0 < i < k all the ui's have the same Parikh vector P and the Parikh vectors of u0 and uk are contained in P. If k > 2, we say that the Email addresses: [email protected] (Gabriele Fici), [email protected] (Tomasz Kociumaka), [email protected] (Thierry Lecroq), [email protected] (Arnaud Lefebvre), [email protected] (´Elise Prieur-Gaston) 1Supported by the Italian Ministry of Education (MIUR) project PRIN 2010/2011 "Automi e Linguaggi Formali: Aspetti Matematici e Applicativi". 2Supported by the Polish Ministry of Science and Higher Education under the 'Iuventus Plus' program in 2015-2016 grant no 0392/IP3/2015/73. The author is also supported by Polish budget funds for science in 2013-2017 as a research project under the 'Diamond Grant' program. To appear in Theoretical Computer Sicence August 16, 2018 word w is periodic with period P. Note that the factorization above is not necessarily unique. For example, a · bba · bba · ε and ε · abb · abb · a (ε denotes the empty word) are two factorizations of the word abbabba both corresponding to the abelian period (1, 2). Moreover, the same word can have different abelian periods. In this paper we define an abelian run of period P in a word w as an occurrence of a substring v of w such that v is periodic with abelian period P and this occurrence cannot be extended to the left nor to the right by one letter into a substring periodic with period P. For example, let w = ababaaa. Then the prefix ab · ab · a = w[0. . 4] has abelian period (1, 1) but it is not an abelian run since the prefix a · ba · ba · a = w[0. . 5] also has abelian period (1, 1). The latter, on the other hand, is an abelian run of period (1, 1) in w. Looking for abelian runs in a word can be useful to detect regions in the word where there is some kind of non-exact repetitiveness, for example regions with several consecutive occurrences of a substring or its reversal. Matsuda et al. [6] recently presented an offline algorithm for computing all abelian runs of a word of length n in O(n2) time. Notice that, however, the definition of abelian run in [6] is slightly different from the one we consider here. We compare both versions in Section 2. Basically, our notion of abelian run is more restrictive than the one of [6], for which we use the term "anchored run". We first present an online algorithm that, given a word w of length n over an alphabet of cardinality σ and a Parikh vector P, returns all the abelian runs of period P in w in time O(n) and space O(σ + p), where p is the norm of P, that is, the sum of its components. This algorithm improves upon the one given in [7] which runs in time O(np). Next, we give an O(np)-time online algorithm for computing all the abelian runs with periods of norm p of a word of length n, for any given p. Finally, we present an O(n2) (resp. O(n2 log n)) -time offline randomized (resp. deterministic) algorithm for computing all the abelian runs of a word of length n. The rest of this article is organized as follows. Sect. 2 introduces central concepts and fixes the notation. In Sect. 3 we review the results on abelian runs given in [6]. Sect. 4 is devoted to the presentation of our main result: a new solution for computing the abelian runs for a given Parikh vector. In Sect. 5 we apply this algorithm in a procedure for computing the abelian runs with periods of a given norm. Next, in Sect. 6, we design a solution for computing all the abelian runs, which builds upon the result recalled in Sect. 3. Finally, we conclude in Sect. 7. 2. Definitions and Notation Let Σ = {a1, a2, . . . , aσ} be a finite ordered alphabet of cardinality σ, and let Σ∗ be the set of finite words over Σ. We assume that the mapping between ai and i can be evaluated in constant time for 1 ≤ i ≤ σ. We let w denote the length of the word w. Given a word w = w[0. . n − 1] of length n > 0, we write w[i] for the (i + 1)-th symbol of w and, for 0 ≤ i ≤ j < n, we write w[i. . j] to denote a fragment of w from the (i + 1)-th symbol to the (j + 1)-th symbol, both included. This fragment is an occurrence of a substring w[i] · · · w[j]. For 0 ≤ i ≤ n, w[i. . i − 1] denotes the empty fragment. We let wa denote the number of occurrences of the symbol a ∈ Σ in the word w. The Parikh vector of w, denoted by Pw, counts the occurrences of each letter of Σ in w, that is, Pw = (wa1 , . . . , waσ ). Notice that two words have the same Parikh vector if and only if one word is a permutation (i.e., an anagram) of the other. Given the Parikh vector Pw of a word w, we let Pw[i] denote its i-th component and Pw its norm, defined as the sum of its components. Thus, for w ∈ Σ∗ and 1 ≤ i ≤ σ, we have Pw[i] = wai and Pw = Pσ i=1 Pw[i] = w. Finally, given two Parikh vectors P, Q, we write P ⊆ Q if P[i] ≤ Q[i] for every 1 ≤ i ≤ σ. If additionally P 6= Q, we write P ⊂ Q and say that P is contained in Q. Definition 1 (Abelian period [5]). A factorization w = u0u1 · · · uk−1uk satisfying k ≥ 1, Pu1 = · · · = Puk−1 = P, and Pu0 ⊂ P ⊃ Puk is called a periodic factorization of w with respect to P. If a word w admits such a factorization, we say that P is an (abelian) period of w. We call fragments u0 and uk respectively the head and the tail of the factorization, while the remaining factors are called cores. Note that the head and the tail are of length strictly smaller than P; in particular they can be empty. 2 i j j − i − h − t + 1 h P P P t Figure 1: The tuple (i, h, t, j) denotes an occurrence of a substring starting at position i, ending at position j, and having abelian period P with head length h and tail length t. Observe that a periodic factorization with respect to a fixed period is not unique. However, it suffices to specify u0 to indicate a particular factorization; see [5]. Dealing with factorizations of fragments of a fixed text, it is more convenient to use a different quantity for this aim. Suppose w[i. . j] = u0 · · · uk is a factorization with respect to abelian period P with p = P. Observe that consecutive starting positions i1, . . . , ik of factors u1, . . . , uk differ by exactly p. Hence, they share a common remainder modulo p, which we call the anchor of the factorization. Note that the anchor does not change if we trim a factorization of w[i. . j] to a factorization of a shorter fragment, or if we extend it to a factorization of a longer fragment. Definition 2 (Anchored period). A fragment w[i. . j] has an abelian period P anchored at k if it has a periodic factorization with respect to P whose anchor is k mod p. If w has a factorization with at least two cores, we say that w is periodic with period P (anchored at k if k mod p is the anchor of the factorization). Definition 3 (Abelian run). A fragment w[i. . j] is called an abelian run with period P if it is periodic with period P and maximal with respect to this property (i.e., each of w[i − 1. . j] and w[i. . j + 1] either does not exist or it is not periodic with period P). We shall often represent an abelian run w[i. . j] as a tuple (i, h, t, j) where h and t are respectively the lengths of the head and the of the tail of a periodic factorization of w[i. . j] with period P and at least two cores (see Figure 1). Note that (i + h) mod p is the anchor of the factorization, and that 1 p (j − i − h − t − 1) is the number of cores, in particular it is an integer. Observe that an abelian run with period P may have several valid factorizations. For example, a·ba·ba·ε and ε · ab · ab · a are factorization of a run w[0..4] with period P = (1, 1) in w = ababa. Therefore the run can be represented as (0, 1, 0, 4) and as (0, 0, 1, 4). However, in v = abab only (0, 0, 0, 3) is a representation of v[0..3] as an abelian run with period P = (1, 1). This is because (0, 1, 1, 3) corresponds to a factorization v[0..3] = a · ba · b with one core only, and such a factorization does not indicate that v[0..3] is an abelian run. Matsuda et al. [6] gave a different definition of abelian runs, where maximality is with respect to extending a fixed factorization. In this paper, we call such fragments anchored (abelian) runs. Definition 4 (Anchored run [6]). A fragment w[i. . j] is a k-anchored abelian run with period P if w[i. . j] is periodic with period P anchored at k and maximal with respect to this property (i.e., each of w[i − 1. . j] and w[i. . j + 1] either does not exist or it is not periodic with period P anchored at k). Note that every abelian run is an anchored run with the same period (for some anchor). The converse is not true, since it might be possible to extend an anchored run preserving the period but not the anchor. For example, in the word w = ababaaa considered in the introduction, the fragment w[0. . 4] = ε · ab · ab · a is a 0-anchored run but not an abelian run, since w[0. . 5] = a · ba · ba · a is periodic with abelian period (1, 1). Since a factorization is uniquely determined by the anchor, standard inclusion-maximality is equivalent to the condition in Definition 4. Observation 5. Let w[i. . j] and w[i′. . j ′] be fragments of w with abelian period P anchored at k. If w[i. . j] is properly contained in w[i′. . j ′] (i.e, i′ < i and j ≤ j ′, or i′ ≤ i and j < j ′), then w[i. . j] is not a k-anchored abelian run with period P. 3 Abelian runs enjoy the same property, but its proof is no longer trivial. Lemma 6. Let w[i. . j] and w[i′. . j ′] be fragments of w with abelian period P. If w[i. . j] is properly contained in w[i′. . j ′], then w[i. . j] is not an abelian run with period P. Proof. We assume that i′ < i. The case of j < j ′ is symmetric. For a proof by contradiction suppose that w[i. . j] is an abelian run and let w[i. . j] = u0 · · · uk be a periodic factorization with period P and at least two cores (i.e., satisfying k ≥ 3). A periodic factorization of w[i′. . j ′] can be trimmed to a factorization w[i − 1. . j] = v0 · · · vℓ. However, since w[i. . j] is an abelian run, this factorization must have at most one core (i.e., ℓ ≤ 2). Moreover, u0 · · · uk cannot be extended to a factorization of w[i − 1. . j] = u′ 0u1 · · · uk. In other words u′ 0, the extension of u0 by one letter to the left, must satisfy Pu′ 0 6⊆ P. Let p = P. The conditions on the number of cores imply u0+2p ≤ w[i. . j] and w[i−1]. . j] < v0+2p. 0 ⊂ Pv0 ⊂ P, which is in (cid:3) 0 is a proper prefix of v0. This yields Pu′ 0 = u0 + 1 < v0, i.e., u′ Consequently, u′ contradiction with Pu′ 0 6⊆ P. Corollary 7. Let w be a word. For a fixed Parikh vector P, there is at most one abelian run with abelian period P starting at each position of w. 3. Previous Work Matsuda et al. [6] presented an algorithm that computes all the anchored runs of a word w of length n in O(n2) time and space complexity. The initial step of the algorithm is to compute maximal abelian powers in w. Recall that an abelian power is a concatenation of several abelian-equivalent words. In other words, an abelian power of period P is a word admitting a periodic factorization with respect to P with an empty head, an empty tail and at least two cores. A fragment w[i. . j] is a maximal abelian power if it cannot be extended to a longer power of period P (preserving the anchor). Formally, the maximality conditions are 1. Pw[i−p..i−1] 6= Pw[i..i+p−1] or i − p < 0, and 2. Pw[j−p+1..j] 6= Pw[j+1..j+p] or j + p ≥ n, where p = P. The approach of [6] is to first compute all the abelian squares using the algorithm by Cummings & Smyth [8]. The next step is to group squares into maximal abelian powers. For this, it suffices to merge pairs of overlapping abelian squares of the form w[i. . i + 2p − 1] and w[i + p. . i + 3p − 1]. This way maximal abelian powers are computed in O(n2) time. Observe that there is a natural one-to-one correspondence between maximal abelian powers and anchored runs: it suffices to trim the head and the tail of the factorization of an anchored run to obtain a maximal abelian power. Hence, the last step of the algorithm is to compute the maximal head and tail by which each abelian power can be extended. This could be done naively in O(n3) time overall, but a clever computation enables to find all the abelian runs in time and space O(n2) (see [6] for further details). In Section 6, we extend this result to compute the abelian runs only rather than all the anchored runs. Both these algorithms work offline: they need to know the whole word before reporting any abelian run. In the following two sections we give several online algorithms, which are able to report a run ending at position i − 1 of a word w before reading w[i + 1] and the following letters. Clearly, not knowing w[i] one cannot decide whether the run could be extended to the right, so this is the optimal delay. However, these methods are restricted to finding runs of a given period or a given norm of the periods, respectively. 4. Computing Abelian Runs with Fixed Parikh Vector In this section we present our online solution for computing all the abelian runs of a given Parikh vector P of norm p in a given word w. The algorithm works in O(n) time and O(σ + p) space where n = w. First, in Sect. 4.1, we show how to compute all anchored runs of period P. Later, in Sect. 4.2, we modify the algorithm to return abelian runs only. We conclude in Sect. 4.3 with an example course of actions in our solution. 4 w i − p bi i impossible tail 6⊆ P Figure 2: Bi[k] = ∞ for i − p + 1 < k < bi. 4.1. Algorithm for Anchored Runs We begin with a description of data maintained while scanning the string w. For an integer k, let Bi[k] be the starting position of the longest suffix of w[0. . i] which has period P anchored at k. If there is no such a suffix, we set Bi[k] = ∞. Since this notion depends on k mod p only, we store Bi[k] for 0 ≤ k < p only. Let bi be the starting position of the longest suffix of w[0. . i] whose Parikh vector is contained in or equal to P. In other words, we have Pw[bi..i] ⊆ P and Pw[bi−1..i] 6⊆ P (or bi = 0). Note that bi = i + 1 if w[i] does not occur in P. Observe that the tail of any periodic factorization of a suffix of w[0. . i] must be contained in w[bi. . i]. This leads to the following characterization: Lemma 8. Let 0 ≤ i < w. We have Bi[k] ≤ k for bi ≤ k ≤ i + 1 and Bi[k] = ∞ for i − p + 1 < k < bi. Proof. For bi ≤ k ≤ i + 1, the fragment w[k. . i] has abelian period P anchored at k. (The underlying factorization has empty head, no cores and tail w[k. . i], unless k = bi = i − p + 1, when the factorization has one core, empty head and empty tail). Hence, we have Bi[k] ≤ k directly from the definition. For i − p + 1 < k < bi, the tail of the factorization with anchor k mod p would need to start at position (cid:3) k, which is impossible (see Figure 2). The values bi−1 and bi are actually sufficient to describe Bi based on Bi−1. Lemma 9. For 0 ≤ i < w the following equalities hold: 1. Bi[k] = ∞ 6= Bi−1[k] for max(i − p + 1, bi−1) ≤ k < bi, 2. Bi[k] = Bi−1[k] for bi ≤ k ≤ i and for i − p + 1 < k < bi−1, 3. Bi[i + 1] = bi if bi > i − p + 1 and Bi[i + 1] = Bi−1[i − p + 1] otherwise. Proof. Lemma 8 implies that Bi[k] = ∞ for i − p + 1 < k < bi and Bi−1[k] = ∞ for i − p + 1 < k < bi−1 (hence Bi−1[k] = Bi[k] in this latter case). For bi ≤ k < i, we have Pw[k..i] ⊆ P, so we can extend the factorization of a suffix of w[0. . i − 1] whose tail starts at position k (see Figure 3). Finally, note that Bi[i + 1] is the starting position of the maximal suffix of w[0. . i] with an empty-tail periodic factorization. If Pw[i−p+1..i] 6= P (i.e., if bi > i − p + 1), this is just w[bi. . i]. Otherwise, we can extend the factorization of a suffix of w[0. . i − 1] whose tail starts at position i − p + 1. (cid:3) Having read letter w[i], we need to report anchored runs which end at position i − 1. For this, we use the following characterization. Lemma 10. Let i − p < k ≤ i. A fragment w[b. . i − 1] is a k-anchored run with period P if and only if Bi−1[k] = b ≤ k − 2p and Bi[k] > b. Proof. Clearly an anchored run ending at position i − 1 must be a left-maximal suffix of w[0. . i − 1] with a given anchor. Moreover, we must have b ≤ k − 2p so that the factorization has at least two cores and Bi[k] > b due to right-maximality. It is easy to see that these conditions are sufficient. (cid:3) 5 By Lemma 9, most entries of Bi are inherited from Bi−1, so we use a single array B and having read w[i], we update its entries. As evident from Lemma 10, each anchored run to be reported corresponds to a modified entry. The algorithm AnchoredRun(P, p, w, n) in Figure 4 implements our approach. The while loop incre- ments k from bi−1 to bi. For k > i − p, we set B[k] to ∞ and possibly report a run. Note that k = i − p + 1 is within the scope of Case 3 rather than Case 1 in Lemma 9. However, later we set B[i + 1] to bi if bi > i − p + 1 (as described in Case 3). Nevertheless, if an (i + 1)-anchored run needs to be reported, we have Bi−1[i − p + 1] < ∞ = Bi[i − p + 1], so bi−1 ≤ i − p + 1 and thus k = i − p + 1 is considered in the loop. Theorem 11. The algorithm AnchoredRun(P, p, w, n) computes all the anchored runs with period P of norm p in a word w of length n in time O(n) and additional space O(σ + p). Proof. The correctness of the algorithm comes from Lemmas 9-10 and the discussion above. The external for loop in lines 3 -- 14 runs n + 1 times. The internal while loop in lines 4 -- 12 cannot iterate more than n + 1 times since it starts with k equal to 0 and ends when k is equal to n and k can only be incremented by 1 (in line 12). The test Pw[k..i] 6⊆ P in line 4 can be realized in constant time once we store Pw[k..i] and a counter of its components for which the value is greater than in P. This data needs to be updated once we increment i in the for loop and k in line 12. We then need to increment the component w[i] or decrement the component w[k] of Pw[k..i], respectively. The global counter needs to be updated accordingly. All the w Bi−1[k] bi−1 kbi i ⊆ P fragment ending at i − 1 fragment ending at i · · · · · · Figure 3: Bi[k] = Bi−1[k] for bi ≤ k ≤ i. AnchoredRun(P, p, w, n) 1 k ← 0 2 B[0] ← k 3 for i ← 0 to n do 4 while k ≤ n and (i = n or Pw[k..i] 6⊆ P) do 5 6 7 8 9 10 11 12 13 14 if k > i − p then b ← B[k mod p] B[k mod p] ← ∞ if b ≤ k − 2p then h ← (k − b) mod p t ← i − k Output(b, h, t, i − 1) ¯ ¯k ← k + 1 ¯if k > i − p + 1 then B[(i + 1) mod p] ← k ¯ ¯ Figure 4: Algorithm computing all the anchored runs of period P of norm p in a word w of length n. 6 other operations run in constant time. Thus the total time complexity of the algorithm is O(n). The space complexity comes from the number of counters (σ) and the size of the array B (p). (cid:3) Note that the space consumption can be reduced to O(p) at the price of introducing (Monte Carlo) randomization. Instead of storing the Parikh vectors in a plain form, we can use dynamic hash tables [9] so that the size is proportional to the number of non-zero entries. 4.2. Algorithm for Abelian Runs In this section we extend our algorithm so that it reports abelian runs only. For an offline solution, we could simply determine the anchored runs (using the procedure developed above) and filter out those which are not maximal. However, in order to obtain an online algorithm, we need a more subtle approach, which is based on the following characterization. Lemma 12. A fragment w[b. . i − 1] is an abelian run with period P if and only if it is an anchored run (with period P) and for each k′ the inequalities Bi−1[k′] ≥ b and Bi[k′] > b hold. Proof. By Lemma 6, an abelian run of period P cannot be properly contained in a fragment with pe- riod P (anchored at some k′). Conditions involving Bi−1[k′] and Bi[k′] enforce left-maximality and right- maximality, respectively. Since each abelian run is an anchored run (with the same period) and since all anchored runs are periodic, the claim follows. (cid:3) To apply Lemma 12, it suffices to find an anchor k such that b = Bi−1[k] = mink′ Bi−1[k′] < mink′ Bi[k′]. There can be several such anchors and in case of ties we are going to detect the one for which the factorization of w[b. . i − 1] has shortest tail. This factorization maximizes the number of cores, so if w[b. . i − 1] is an anchored run with any anchor, it is with that one in particular. Note that the while loop in lines 4 -- 12 of Algorithm AnchoredRun processes anchors bi−1 ≤ k < bi in the order of decreasing tail lengths and Run(P, p, w, n) 1 k ← 0 2 L ← ∅ 3 B[0] ← k 4 P tr[0] ← insertAtTheEnd(L, 0) 5 for i ← 0 to n do 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 bmin ← B[getFirst(L)] while k ≤ n and (i = n or Pw[k..i] 6⊆ P) do if k > i − p then b ← B[k mod p] B[k mod p] ← ∞ Delete(L, P tr[k mod p]) P tr[k mod p] ← Nil if b = bmin and B[getFirst(L)] > b and b ≤ k − 2p then h ← (k − b) mod p t ← i − k Output(b, h, t, i) ¯ ¯k ← k + 1 if k > i − p + 1 then B[(i + 1) mod p] ← k P tr[(i + 1) mod p] ← insertAtTheEnd(L, (i + 1) mod p) ¯ ¯ ¯ Figure 5: Algorithm computing all the abelian runs of period P of norm p in a word w of length n. 7 updates the underlying values B[k] from Bi−1[k] to Bi[k]. For the sought anchor k this update strictly increases the value mink′ B[k′], and moreover this is the first increase of the minimum within a given iteration of the outer for loop. Hence, we record the original minimum and check for an abelian run only if mink′ B[k′] increases from that value. To implement the procedure described above, we need to efficiently compute the smallest element in the array B. For this, recall that B[j] can only be modified from ∞ to k (and the value k does not decrease throughout the algorithm) or from some value back to ∞. We maintain a doubly-linked list L of all indices j with finite B[j] such that the order of indices j in the list is consistent with the order of values B[j]. To update the list, it suffices to insert the index j to the end of list while setting B[j] to k, and remove it from the list setting B[j] to ∞. Then the smallest value in B is attained at an argument stored as the first element of the list L (or ∞, if the list is empty). The algorithm Run(P, p, w, n), depicted in Figure 5, implements the approach described above. It uses the following constant-time functions to operate on lists: • insertAtTheEnd(L, e) that inserts e at the end of the doubly-linked list L and returns a pointer to the location of e in the list; • Delete(L, ptr) that deletes the element pointed by ptr from the doubly-linked list L; • getFirst(L) that returns the first element of the list L (0 if the list is empty). The algorithm also uses an array P tr which maps any anchor j to a pointer of the corresponding location in the list L (or Nil if B[j] = ∞). The discussion above proves that Run(P, p, w, n) correctly computes abelian runs with period P in w. Its running time is the same as that of AnchoredRun(P, p, w, n) since the structure of the computations remains the same while additional instructions run in constant time. Memory consumption is still O(p + σ) because both L and P tr take O(p) space. Theorem 13. The algorithm Run(P, p, w, n) computes all the abelian runs with period P of norm p in a word w of length n in time O(n) and additional space O(σ + p), which can be reduced to O(p) using randomization. 4.3. Example Let us see the behaviour of the algorithm on Σ = {a, b}, w = abaababaabbb and P = (2, 2): k = 0 B = [0, ∞, ∞, ∞] L = (0) i = 0 Pw[0] ⊆ P B = [0, 0, ∞, ∞] L = (0, 1) i = 1 Pw[0..1] ⊆ P B = [0, 0, 0, ∞] L = (0, 1, 2) i = 2 Pw[0..2] ⊆ P B = [0, 0, 0, 0] L = (0, 1, 2, 3) i = 3 Pw[0..3] 6⊆ P b = 0 B = [∞, 0, 0, 0] L = (1, 2, 3) k = 1 Pw[1..3] ⊆ P B = [1, 0, 0, 0] L = (1, 2, 3, 0) i = 4 Pw[1..4] ⊆ P i = 5 Pw[1..5] 6⊆ P k = 2 Pw[2..5] 6⊆ P b = 0 B = [1, 0, ∞, 0] L = (1, 3, 0) k = 3 Pw[3..5] ⊆ P B = [1, 0, 3, 0] L = (1, 3, 0, 2) i = 6 Pw[3..6] ⊆ P i = 7 Pw[3..7] 6⊆ P k = 4 Pw[4..7] ⊆ P i = 8 Pw[4..8] 6⊆ P k = 5 Pw[5..8] 6⊆ P b = 0 B = [1, ∞, 3, 0] L = (3, 0, 2) k = 6 Pw[6..8] ⊆ P B = [1, 6, 3, 0] L = (3, 0, 2, 1) i = 9 Pw[6..9] ⊆ P i = 10 Pw[6..10] 6⊆ P k = 7 8 Pw[7..10] ⊆ P i = 11 Pw[7..11] 6⊆ P k = 8 Pw[8..11] 6⊆ P b = 1 B = [∞, 6, 3, 0] L = (3, 2, 1) k = 9 Pw[9..11] 6⊆ P b = 6 B = [∞, ∞, 3, 0] L = (3, 2) k = 10 Pw[10..11] ⊆ P B = [10, ∞, 3, 0] L = (3, 2, 0) i = 12 b = 3 B = [10, ∞, ∞, 0] L = (3, 0) k = 11 b = 0 B = [10, ∞, ∞, ∞] L = (0) h = 3 t = 1 Output(0, 3, 1, 11) k = 12 b = 10 B = [∞, ∞, ∞, ∞] L = () k = 13 5. Computing Abelian Runs with Fixed Parikh Vector Norm In this section we develop an O(np)-time algorithm to compute all abelian runs with periods of norm p. First, we describe the algorithm for anchored runs and later generalize it to abelian runs. 5.1. Anchored Runs Let us start with a simple offline algorithm which works in O(n) time to compute k-anchored runs with period of norm p for fixed values p and k. This method is similar to the algorithm of Matsuda et al. [6] briefly described in Section 3. Namely, it suffices to compute maximal abelian powers with periods of norm p anchored at k, and then extend them by a head and a tail. Define a block as any fragment of the form w[i. . i + p − 1] such that i ≡ k (mod p). Note that the cores in decompositions with anchor k mod p are blocks. Finding k-anchored powers with periods of a given norm p is very easy if the anchor is fixed. We consider consecutive blocks, naively check if they are abelian- equivalent and merge any maximal chains of abelian-equivalent blocks. Determining the head and the tail of the k-anchored runs is also simple. For each i ≡ k (mod p) we compute the longest suffix of w[0. . i − 1] and the longest prefix of w[i + p. . n − 1] whose Parikh vectors are contained in Pw[i..i+p−1]. This approach can be implemented online in O(σ + p) space as follows: we scan consecutive blocks and (naively) check their abelian equivalence. Whenever we read a full block (say, starting at position i), we compute the longest suffix w[bi−1. . i − 1] of w[0. . i − 1] whose Parikh vector is contained in Pw[i..i+p−1]. This gives a periodic factorization of w[bi−1. . i + p − 1] anchored at k mod p. We then try to extend it to the right while reading further characters. Once it is impossible to extend the factorization, say by letter w[j + 1], we declare w[bi−1. . j] as a maximal fragment with period Pw[i..i+p−1] anchored at k. If the decomposition has at least two cores, we report an anchored run. If we succeed to extend by a full block (i.e., if Pw[i..i+p−1] = Pw[i+p..i+2p−1]), we do not restart the algorithm but instead we continue to extend the factorization. This way, we guarantee that bi−1 > i − p whenever we start building a new factorization. Clearly, the procedure described above computes all k-anchored runs with period of norm p. To compute all anchored runs, we simply run it in parallel for all p possible anchors. Theorem 14. There is an algorithm which computes online all the anchored runs with periods of norm p in a word w of length n over an alphabet of size σ in time O(np) and additional space O(p(σ + p)), which can be reduced to O(p2) using randomization. 5.2. Abelian Runs Let us first slightly modify the algorithm presented in the previous section. Observe that whenever we start a new phase having just read a block w[i. . i + p − 1], instead of performing the computations using a simple procedure described above, we could launch the algorithm of Section 4.1 for w[max(i − p, 0). . ] and P = Pw[i..i+p−1], simulate it until it needs to read w[i + p] and then feed it with newly read letters until the maximal extension of w[i. . i + p − 1] anchored at k is found (i.e., until the respective entry of the B array is set to ∞). Other anchored runs output by the algorithm should be ignored, of course. As before, if such a process is running while we have completed reading a subsequent block, we do not start a new phase. 9 It is easy to see that such an algorithm is equivalent to the previous one. However, if we use the algorithm of Section 4.2 instead, we automatically get a possibility to check whether the maximal extension of w[i. . i + p − 1] anchored at k is a maximal fragment with period Pw[i..i+p−1]. Note that we start the simulation at a position max(i − p, 0) which is smaller than bi−1, unless the latter is 0. This guarantees that left-maximality is correctly verified despite the fact the fragment prior to position i − p is ignored in the simulation. As before, we disregard any other abelian run that the algorithm of Section 4.2 may return. We run this process in parallel for all possible anchors to guarantee that each abelian run with period of norm p is reported exactly once. More precisely, in ambiguous cases a run is reported for the anchor corresponding to the factorization with shortest tail, just as in Section 4.2. Theorem 15. There is an algorithm which computes online all the abelian runs with periods of norm p in a word w of length n over an alphabet of size σ in time O(np) and additional space O(p(σ + p)), which can be reduced to O(p2) using randomization. 6. Offline Algorithm for Computing All Abelian Runs In this section we present an O(n2)-time offline algorithm which computes all the abelian runs. As a starting point, we use the set of all anchored runs computed by the algorithm by Matsuda et al. (see Section 3). Recall that all abelian runs are anchored runs with the same period. Hence, it suffices to filter out those anchored runs which are properly contained in another anchored run with the same period. We also need to make sure that every abelian run is reported once only (despite possibly being k-anchored for different anchors k). Note that this filtering can be performed independently for distinct periods. If we have a list of anchored runs with a fixed period, sorted by the starting position, it is easy to retrieve the abelian runs of that period with a single scan of the list. Ordering by the starting position can be performed together for all periods so that it takes O(r + n) time where r is the number of all anchored runs. Hence, the main difficulty is grouping according to the period. For this, we shall assign to each fragment of w an identifier, so that two fragments are abelian-equivalent if and only if their identifiers are equal. The identifiers of periods can be easily retrieved since given a k-anchored run, we can easily locate one of the cores of the underlying factorization. Thus, in the remaining part of this section we design a naming algorithm which assigns the identifiers. A naive solution would be to generate the Parikh vectors of all substrings of w, sort these vectors removing duplicates, and give each fragment a rank of its Parikh vector in that order. However, already storing the Parikh vectors can take prohibitive Θ(n2σ) space. To overcome this issue, we use the concept of diff-representation, originally introduced in the context of abelian periods [10]. Observe that in a sense the Parikh vectors of fragments can be generated efficiently: for a fixed p, we can first generate Pw[0..p−1], then update it to Pw[1..p], and so on until we reach Pw[n−p..n−1]. In other words, the Parikh vectors of all fragments of length p can be represented in a sequence so that the total Hamming distance of the adjacent vectors is O(n). The diff-representation, designed to manipulate sequences satisfying such a property, is formally defined as a sequence of single-entry changes such that the original sequence of vectors is a subsequence of intermediate results when applying this operations starting from the null vector (of the fixed dimension r). Note that the diff-representation of a sequence of Parikh vectors of all fragments of w can be computed in time O(n2) proportional to its size. The following result lets us efficiently assign identifiers to its elements. Lemma 16 ([10]). Given a sequence of vectors of dimension r represented using a diff-representation of size m, consider the problem of assigning integer identifiers of size nO(1) so that equality of vectors is equivalent to equality of their identifiers. It can be solved in O(r + m log r) time using a deterministic algorithm and in O(r + m) time using a Monte Carlo algorithm which is correct with high probability (1 − 1 (r+m)c where c can be chosen arbitrarily large). In our setting this yields the following result. 10 Theorem 17. There exists an O(n2)-time randomized algorithm (Monte Carlo, correct with high-probability) which computes all abelian runs in a given word of length n. Additionally, there exists an O(n2 log σ)-time deterministic algorithm solving the same problem. 7. Conclusions We gave algorithms that, given a word w of length n over an alphabet of cardinality σ, return all the abelian runs of a given period P in w in time O(n) and space O(σ + p), or all the abelian runs with periods of a given norm p in time O(np) and space O(p(σ + p)). These algorithms work in an online manner. We also presented an O(n2) (resp. O(n2 log n))-time offline randomized (resp. deterministic) algorithm for computing all the abelian runs in a word of length n. One may wonder if it is possible to reduce further the complexities of these latter algorithms. We believe that further combinatorial results on the structure of the abelian runs in a word could lead to novel solutions. References [1] W. F. Smyth, Computing regularities in strings: a survey, European Journal of Combinatorics 34 (1) (2013) 3 -- 14. doi:10.1016/j.ejc.2012.07.010. [2] R. Kolpakov, G. Kucherov, Finding maximal repetitions in a word in linear time, 40th Annual Sympo- sium on Foundations of Computer Science, FOCS 1999, IEEE Computer Society, New-York, 1999, pp. 596 -- 604. doi:10.1109/SFFCS.1999.814634. in: [3] H. Bannai, T. I, S. Inenaga, Y. Nakashima, M. Takeda, K. Tsuruta, A new characterization of maximal repetitions by Lyndon trees, in: P. Indyk (Ed.), Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, San Diego, CA, USA, January 4-6, 2015, SIAM, 2015, pp. 562 -- 571. doi:10.1137/1.9781611973730.38 . [4] H. Bannai, T. I, S. Inenaga, Y. Nakashima, M. Takeda, K. Tsuruta, The "runs" theorem, CoRR abs/1406.0263v7. URL http://arxiv.org/abs/1406.0263v7 [5] S. Constantinescu, L. Ilie, Fine and Wilf's theorem for abelian periods, Bulletin of the European Association for Theoretical Computer Science 89 (2006) 167 -- 170. [6] S. Matsuda, S. Inenaga, H. Bannai, M. Takeda, Computing abelian covers and abelian runs, in: J. Holub, J. Zd´arek (Eds.), Prague Stringology Conference, PSC 2014, Czech Technical University in Prague, 2014, pp. 43 -- 51. [7] G. Fici, T. Lecroq, A. Lefebvre, ´E. Prieur-Gaston, Online computation of abelian runs, in: A. H. Dediu, E. Formenti, C. Mart´ın-Vide, B. Truthe (Eds.), Language and Automata Theory and Applications, LATA 2015, Vol. 8977 of LNCS, Springer International Publishing, 2015, pp. 391 -- 401. doi:10.1007/978-3-319-15579-1_30. [8] L. J. Cummings, W. F. Smyth, Weak repetitions in strings, Journal of Combinatorial Mathematics and Combinatorial Computing 24 (1997) 33 -- 48. [9] M. Dietzfelbinger, A. R. Karlin, K. Mehlhorn, F. Meyer auf der Heide, H. Rohnert, R. E. Tarjan, Dynamic perfect hashing: Upper and lower bounds, SIAM Journal on Computing 23 (4) (1994) 738 -- 761. doi:10.1137/S0097539791194094 . [10] T. Kociumaka, J. Radoszewski, W. Rytter, Fast algorithms for abelian periods in words and greatest common di- visor queries, in: N. Portier, T. Wilke (Eds.), 30th International Symposium on Theoretical Aspects of Computer Science, STACS 2013, Vol. 20 of LIPIcs, Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2013, pp. 245 -- 256. doi:10.4230/LIPIcs.STACS.2013.245. 11
1108.3683
1
1108
2011-08-18T08:31:11
Substring Range Reporting
[ "cs.DS" ]
We revisit various string indexing problems with range reporting features, namely, position-restricted substring searching, indexing substrings with gaps, and indexing substrings with intervals. We obtain the following main results. {itemize} We give efficient reductions for each of the above problems to a new problem, which we call \emph{substring range reporting}. Hence, we unify the previous work by showing that we may restrict our attention to a single problem rather than studying each of the above problems individually. We show how to solve substring range reporting with optimal query time and little space. Combined with our reductions this leads to significantly improved time-space trade-offs for the above problems. In particular, for each problem we obtain the first solutions with optimal time query and $O(n\log^{O(1)} n)$ space, where $n$ is the length of the indexed string. We show that our techniques for substring range reporting generalize to \emph{substring range counting} and \emph{substring range emptiness} variants. We also obtain non-trivial time-space trade-offs for these problems. {itemize} Our bounds for substring range reporting are based on a novel combination of suffix trees and range reporting data structures. The reductions are simple and general and may apply to other combinations of string indexing with range reporting.
cs.DS
cs
Substring Range Reporting∗ Philip Bille [email protected] Inge Li Gørtz [email protected] September 4, 2018 Abstract We revisit various string indexing problems with range reporting features, namely, position- restricted substring searching, indexing substrings with gaps, and indexing substrings with in- tervals. We obtain the following main results. • We give efficient reductions for each of the above problems to a new problem, which we call substring range reporting. Hence, we unify the previous work by showing that we may restrict our attention to a single problem rather than studying each of the above problems individually. • We show how to solve substring range reporting with optimal query time and little space. Combined with our reductions this leads to significantly improved time-space trade-offs for the above problems. In particular, for each problem we obtain the first solutions with optimal time query and O(n logO(1) n) space, where n is the length of the indexed string. • We show that our techniques for substring range reporting generalize to substring range counting and substring range emptiness variants. We also obtain non-trivial time-space trade-offs for these problems. Our bounds for substring range reporting are based on a novel combination of suffix trees and range reporting data structures. The reductions are simple and general and may apply to other combinations of string indexing with range reporting. 1 Introduction Given a string S of length n the string indexing problem is to preprocess S into a compact rep- resentation that efficiently supports substring queries, that is, given another string P of length m report all occurrences of substrings in S that match P . Combining the classic suffix tree data struc- ture [14] with perfect hashing [13] leads to an optimal time-space trade-off for string indexing, i.e., an O(n) space representation that supports queries in O(m + occ) time, where occ is the number of occurrences of P in S. In recent years, several extensions of string indexing problems that add range reporting features have been proposed. For instance, Makinen and Navarro proposed the position-restricted substring searching problem [21, 22]. Here, queries take an additional range [a, b] of positions in S and the goal is to report the occurrences of P within S[a, b]. For such extensions of string indexing no optimal time-space trade-off is known. For instance, for position-restricted substring searching one ∗An extended abstract of this paper appeared at the 22nd Conference on Combinatorial Pattern Matching. 1 can either get O(n logε n) space (for any constant ε > 0) and O(m + log log n + occ) query time or O(n1+ε) space with O(m + occ) query time [8, 21, 22]. Hence, removing the log log n term in the query comes at the cost of significantly increasing the space. In this paper, we revisit a number string indexing problems with range reporting features, namely position-restricted substring searching, indexing substrings with gaps, and indexing sub- strings with intervals. We achieve the following results. • We give efficient reductions for each of the above problems to a new problem, which we call substring range reporting. Hence, we unify the previous work by showing that we may restrict our attention to a single problem rather than studying each of the above problems individually. • We show how to solve substring range reporting with optimal query time and little space. Combined with our reductions this leads to significantly improved time-space trade-offs for all of the above problems. For instance, we show how to solve position-restricted substring searching in O(n logε n) space and O(m + occ) query time. • We show that our techniques for substring range reporting generalize to substring range counting and substring range emptiness variants. We also obtain non-trivial time-space trade- offs for these problems. Our bounds for substring range reporting are based on a novel combination of suffix trees and range reporting data structures. The reductions are simple and general and may apply to other combinations of string indexing with range reporting. 1.1 Substring Range Reporting Let S be a string where each position is associated with a integer value in the range [0, u]. The integer associated with position i in S is the label of position i, denoted label(i), and we call S a labeled string. Given a labeled string S, the substring range reporting problem is to compactly represent S while supporting substring range reporting queries, that is, given a string P and a pair of integers a and b, 0 ≤ a ≤ b ≤ u, report all starting positions in S that match P and whose labels are in the range [a, b]. We assume a standard unit-cost RAM model with word size w and a standard instruction set including arithmetic operations, bitwise boolean operations, and shifts. We assume that a label can be stored in a constant number of words and therefore w = Θ(log u). The space complexity is the number of words used by the algorithm. All bounds mentioned in this paper are valid in this model of computation. To solve substring range reporting a basic approach is to combine a suffix tree with a 2D range reporting data structure. A query for a pattern P and range [a, b] consists of a search in the suffix tree and then a 2D range reporting query with [a, b] and the lexicographic range of suffixes defined P . This is essentially the overall approach used in the known solutions for position-restricted substring searching [4, 8, 9, 21, 22, 31], which is a special case of substring range reporting (see the next section). Depending on the choice of the 2D range reporting data structure this approach leads to different trade-offs. In particular, if we plug in the 2D range reporting data structure of Alstrup et al. [2], we get a solution with O(n logε n) space and O(m + log log u + occ) query time (see Makinen 2 and Navarro [21, 22]). The log log u term in the query time is from the range reporting query. Alternatively, if we use a fast data structure for the range successor problem [8, 31] to do the range reporting, we get optimal O(m+occ) query time but increase the space to at least Ω(n1+ε). Indeed, since any 2D range reporting data structure with O(n logO(1) n) space must use Ω(log log u) query time [26], we cannot hope to avoid this blowup in space with this approach. Our first main contribution is a new and simple technique that overcomes the inherent problem of the previous approach. We show the following result. Theorem 1 Let S be a labeled string of length n with labels in the range [0, u]. For any constants ε, δ > 0, we can solve substring range reporting using O(n(logε n + log log u)) space, O(n(log n + logδ u)) expected preprocessing time, and O(m + occ) query time, for a pattern string of length m. Compared to the previous results we achieve optimal query time with an additional O(n log log u) term in the space. For the applications considered here, we have that u = O(n) and therefore the space bound simplifies to O(n(logε n + log log u)) = O(n logε n). Hence, in this case there is no asymptotic space overhead. The key idea to obtain Theorem 1 is a new and simple combination of suffix trees with multiple range reporting data structures for both 1 and 2 dimensions. Our solution handles queries differently depending on the length of the input pattern such that the overall query is optimized accordingly. Interestingly, the idea of using different query algorithms depending on the length of the pattern is closely related to the concept of filtering search introduced for the standard range reporting problem by Chazelle as early as 1986 [6]. Our new results show that this idea is also useful in combinatorial pattern matching. Finally, we also consider substring range counting and substring range emptiness variants. Here, the goal is to count the number of occurrences in the range and to determine whether or not the range is empty, respectively. Similar to substring range reporting, these problems can also be solved in a straightforward way by combining a suffix with a 2D range counting or emptiness data structure. We show how to extend our techniques to obtain improved time-space trade-offs for both of these problems. 1.2 Applications Our second main contribution is to show that substring range reporting actually captures several other string indexing problems. In particular, we show how to reduce the following problems to substring range reporting. • Position-restricted substring searching: Given a string S of length n, construct a data struc- ture supporting the following query: Given a string P and query interval [a, b], with 1 ≤ a ≤ b ≤ n, return the positions of substrings in S matching P whose positions are in the interval [a, b]. • Indexing substrings with intervals: Given a string S of length n, and a set of intervals π = {[s1, f1], [s2, f2], . . . , [sπ, fπ]} such that si, fi ∈ [1, n] and si ≤ fi, for all 1 ≤ i ≤ π, construct a data structure supporting the following query: Given a string P and query interval [a, b], with 1 ≤ a ≤ b ≤ n, return the positions of substrings in S matching P whose positions are in [a, b] and in one of the intervals in π. 3 • Indexing substrings with gaps: Given a string S of length n and an integer d, the problem is to construct a data structure supporting the following query: Given two strings P1 and P2 return all positions of substrings in S matching P1 ◦ (cid:63)d ◦ P2. Here ◦ denotes concatenation and (cid:63) is a wildcard matching all characters in the alphabet. Previous results Let m be the length of P . Makinen and Navarro [21, 22] introduced the position-restricted substring searching problem. Their fastest solution uses O(n logε n) space, O(n log n) expected preprocessing time, and O(m+log log n+occ) query time. Crochemore et al. [8] proposed another solution using O(n1+ε) space, O(n1+ε) preprocessing time, and O(m + occ) query time (see also Section 1.1). Using techniques from range non-overlapping indexing [7] it is possible to improve these bounds for small alphabet sizes [27]. Several succinct versions of the problem have also been proposed [4, 21, 22, 31]. All of these have significantly worse query time since they require superconstant time per reported occurrence. Finally, Crochemore et al. [10] studied a restricted version of the problem with a = 1 or b = n. For the indexing substrings with intervals problem, Crochemore et al. [8, 9] gave a solution with O(n log2 n) space, O(π + n log3 n) expected preprocessing time, and O(m + log log n + occ) query time. They also showed how to achieve O(n1+ε) space, O(n1+ε + π) preprocessing time, and O(m + occ) query time. Several papers [3,17,20] have studied the property matching problem, which is similar to the indexing substrings with intervals problem, but where both start and end point of the match must be in the same interval. Iliopoulos and Rahman [18] studied the problem of indexing substrings with gaps. They gave a solution using O(n logε n) space, O(n log n) expected preprocessing time, and O(m + loglog n + occ) query time, where m is the length of the two input strings. Crochemore and Tischler recently proposed a variant of the problem [11]. Our results We reduce position-restricted substring searching, indexing substrings with intervals, and indexing substrings with gaps to substring range reporting. Applying Theorem 1 with our new reductions, we get the following result. Theorem 2 Let S be a string of length n and let m be the length of the query. For any constant ε > 0, we can solve (i) Position-restricted substring searching using O(n logε n) space, O(n log n) expected preprocess- ing time, and O(m + occ) query time. (ii) Indexing substrings with intervals using O(n logε n) space, O(π + n log n) expected prepro- cessing time, and O(m + occ) query time. (iii) Indexing substrings with gaps using O(n logε n) space, O(n log n) expected preprocessing time, and O(m + occ) query time (m is the size of the two input strings). This improves the best known time-space trade-offs for all three problems, that all suffer from the trade-off inherent in 2D range reporting. The reductions are simple and general and may apply to other combinations of string indexing with range reporting. 4 2 Basic Concepts 2.1 Strings and Suffix Trees Throughout the section we will let S be a labeled string of length S = n with labels in [0, u]. We denote the character at position i by S[i] and the substrings from position i to j by S[i, j]. The substrings S[1, j] and S[i, n] are the prefixes and suffixes of S, respectively. The reverse of S is SR. We denote the label of position i by labelS(i). The order of suffix S[i, n], denoted orderS(i), is the lexicographic order of S[i, n] among the suffixes of S. The suffix tree for S, denoted TS, is the compacted trie storing all suffixes of S [14]. The depth of a node v in TS is the number of edges on the path from v to the root. Each of the edges in TS is associated with some substring of S. The children of each node are sorted from left to right in increasing alphabetic order of the first character of the substring associated with the edge leading to them. The concatenation of substrings from the root to v is denoted strS(v). The string depth of v, denoted strdepthS(v), is the length of strS(v). The locus of a string P , denoted locusS(P ), is the minimum depth node v such that P is a prefix of strS(v). If P is not a prefix of a substring in S we define locusS(P ) to be ⊥. Each leaf (cid:96) in TS uniquely corresponds to a suffix in S, namely, the suffix strS((cid:96)). Hence, we will use labelS((cid:96)) and orderS((cid:96)) to refer to the label and order of the corresponding suffix. For an internal node v we extend the notation such that labelS(v) = {labelS((cid:96)) (cid:96) is a descendant leaf of v} orderS(v) = {orderS((cid:96)) (cid:96) is a descendant leaf of v}. Since children of a node are sorted, the left to right order of the leaves in TS corresponds to the lexicographic order of the suffixes of S. Hence, for any node v, orderS(v) is an interval. We denote the left and right endpoints of this interval by lv and rv. When the underlying string S is clear from the context we will often drop the subscript S for brevity. The suffix tree for S uses O(n) space and can be constructed in O(sort(n)) time, where sort(n) is the time for sorting n values in the model of computation [12]. We only need a standard comparison-based O(n log n) suffix tree construction in our results. Let P be a string of length m. If locusS(P ) = ⊥ then P does not occur as a substring in S. Otherwise, the substrings in S that match P are the suffixes in orderS(locusS(P )). Hence, we can compute all occurrences of P in S by traversing the suffix tree from the root to locusS(P ) and then report all suffixes stored in the subtree. Using perfect hashing [13] to represent the outgoing edges of each node in TS we achieve an O(n) solution to string indexing that supports queries in O(m + occ) time (here occ is the total number of occurrences of P in S). 2.2 Range Reporting Let X ⊆ {0, . . . , u}d be a set of points in a d-dimensional grid. The range reporting problem in d-dimensions is to compactly represent X while supporting range reporting queries, that is, given a rectangle R = [a1, b1]×···× [ad, bd] report all points in the set R∩ X. We use the following results for range reporting in 1 and 2 dimensions. Lemma 1 (Alstrup et al. [1], Mortensen et al. [24]) For a set of n points in [0, u] and any constant γ > 0, we can solve 1D range reporting using O(n) space, O(n logγ u) expected preprocess- ing time and O(1 + occ) query time. 5 Lemma 2 (Alstrup et al. [2]) For a set of n points in [0, u] × [0, u] and any constant ε > 0, we can solve 2D range reporting using O(n logε n) space, O(n log n) expected preprocessing time, and O(log log u + occ) query time. 3 Substring Range Reporting We now show Theorem 1. Recall that S is a labeled string of length n with labels from [0, u]. 3.1 The Data Structure Our substring range reporting data structure consists of the following components. • The suffix tree TS for S. For each node v in TS we also store lv and rv. We partition TS into a top tree and a number of bottom trees. The top tree consists of all nodes in TS whose string depth is at most log log u and all their children. The trees induced by the remaining nodes are the forest of bottom trees. • A 2D range reporting data structure on the set of points {(orderS(i), labelS(i)) i ∈ {1, . . . , n}}. • For each node v in the top tree, a 1D range reporting data structure on the set {labelS(i) i ∈ orderS(v)}. We analyze the space and preprocessing time for the data structure. We use the range reporting data structures from Lemmas 1 and 2. The space for the suffix tree is O(n) and the space for the 2D range reporting data structure is O(n logε n), for any constant ε > 0. We bound the space for the (potentially Ω(n)) 1D range reporting data structures stored for the top tree. Let Vd be the set of nodes in the top tree with depth d. Since the sets orderS(v), v ∈ Vd, partition the set of descendant leaves of nodes in Vd, the total size of these sets is as most n. Hence, the total size of the 1D range reporting data structures for the nodes in Vd is therefore O(n). Since there are at most log log u + 1 levels in the top tree, the space for all 1D range reporting data structures is O(n log log u). Hence, the total space for the data structure is O(n(logε n + log log u)). We can construct the suffix tree in O(sort(n)) time and the 2D range reporting data structure in O(n log n) expected time. For any constant γ > 0, the expected preprocessing time for all 1D range reporting data structures is  (cid:88) O  = O(n log log u logγ u) = O(n log2γ u). orderS(v) logγ u v in top tree Setting δ = 2γ we use O(n(log n + logδ u)) expected preprocessing time in total. 3.2 Substring Range Queries Let P be a string of length m, and let a and b be a pair of integers, 0 ≤ a ≤ b ≤ u. To answer a substring range query we want to compute the set of starting positions for P whose labels are in [a, b]. First, we compute the node v = locusS(P ). If v = ⊥ then P is not a substring of S, and we return the empty set. Otherwise, we compute the set of descendant leaves of v with labels in [a, b]. There are two cases to consider. 6 (i) If v is in the top tree we query the 1D range reporting data structure for v with the interval [a, b]. (ii) If v is in a bottom tree, we query the 2D range reporting data with the rectangle [lv, rv]×[a, b]. Given the points returned by the range reporting data structures, we output the corresponding starting positions of the corresponding suffixes. From the definition of the data structure it follows that these are precisely the occurrences of P within the range [a, b]. Next consider the time complexity. We find locusS(P ) in O(m) time (see Section 2). In case (i) we use O(1 + occ) time to compute the result by Lemma 1. Hence, the total time for a substring range query for case (i) is O(m + occ). In case (ii) we use O(log log u + occ) time to compute the result by Lemma 2. We have that v = locusS(P ) is in a bottom tree and therefore m ≥ strdepth(parent(locusS(v))) > log log u. Hence, the total time to answer a substring range query in case (ii) is O(m + log log u + occ) = O(m + occ). Thus, in both cases we use O(m + occ) time. Summing up, our solution uses O(n(logε n + log log u) space, O(n(log n + logδ u)) expected preprocessing time, and O(m + occ) query time. This completes the proof of Theorem 1. 4 Applications In this section we show how to improve the results for the three problems position-restricted sub- string searching, indexing substrings with intervals, and indexing gapped substrings, using our data structure for substring range reporting. Let reportS(P, a, b) denote a substring range reporting query on string S with parameters P , a, and b. 4.1 Position-Restricted Substring Searching We can reduce position-restricted substring searching to substring range reporting by setting label(i) = i for all i = 1, . . . , n. To answer a query we return the result of the substring range query reportS(P, a, b). Since each label is equal to the position, it follows that the solution to the substring range reporting instance immediately gives a solution to position-restricted substring searching. Applying Theorem 1 with u = n, this proves Theorem 2(i). 4.2 Indexing Substrings with Intervals We can reduce indexing substrings with intervals to substring range reporting by setting (cid:40) i 0 label(i) = if i ∈ ϕ for some ϕ ∈ π, otherwise. To answer a query we return the result of the substring range reporting query reportS(P, a, b). Let I be the solution to the indexing substrings with intervals instance and let I(cid:48) be the solution to the substring range reporting instance derived by the above reduction. Then i ∈ I ⇔ i ∈ I(cid:48). To prove this assume i ∈ I. Then i ∈ ϕ for some ϕ ∈ π and i ∈ [a, b]. From i ∈ ϕ and the definition of label(i) it follows that label(i) = i. Thus, label(i) = i ∈ [a, b] and thus i ∈ I(cid:48). Assume i ∈ I(cid:48). Then label(i) ∈ [a, b]. Since a > 0 also label(i) > 0, and it follows that label(i) = i. By the reduction this means that i ∈ ϕ for some ϕ ∈ π. Since i = label(i), we have i ∈ [a, b] and therefore i ∈ I. 7 Figure 1: A string S, the labeling for d = 2 (below the string), and the suffix tree of TSR. Given a query P1 = ab and P2 = bac we find v = locusSR(ba) (marked in the suffix tree). We have lv = 6 and rv = 7 from the left-to-right-order in the TSR. The substring range reporting query reports(P2, 6, 7) returns 7. Hence, we report the occurrence at position 7 − 2 − 2 = 3. We can construct the labeling in O(n +π) if the intervals are sorted by startpoint or endpoint. Otherwise additional time for sorting is needed. A similar approach is used in the solution by Crochemore et al. [8]. Applying Theorem 1 with u = n, this proves Theorem 2(ii). 4.3 Indexing Substrings with Gaps We can reduce the indexing substrings with gaps problem to substring range reporting as follows. Construct the suffix tree of the reverse of S, i.e., the suffix tree TSR for SR. For each node v in TSR also store lv and rv. Set (cid:40) orderSR(n − i + d + 2) 0 for i ≥ d + 2, otherwise. labelS(i) = To answer a query find the locus node v of P R in TSR. Then use the substring range reporting 1 data structure to return all positions of substrings in S matching P2 whose labels are in the range [lv, rv]. For each position i returned by reportS(P2, lv, rv), return i − P1 − d. See Fig. 1 for an example. Correctness of the reduction We will now show that the reduction is correct. Let I be the solution to the indexing substrings with gaps instance and let I(cid:48) be the solution to the substring range reporting instance derived by the above reduction. We will show i ∈ I ⇔ i ∈ I(cid:48). Let mi = Pi for i = 1, 2. If i ∈ I then there is an occurrence of P1 at position i in S and an occurrence of P2 at position i(cid:48) = i + m1 + d in S. It follows directly, that there is an occurrence of P R 1 at position i(cid:48)(cid:48) = n − (i + m1) + 2 in SR. By definition, (cid:48) labelS(i ) = labelS(i + m1 + d) = orderSR(n − (i + m1 + d) + d + 2) = orderSR(i (cid:48)(cid:48) ), where the second equality follows from the fact that i + m1 + d ≥ d + 2. Since there is an occurrence of P R 1 )). 1 at position i(cid:48)(cid:48) in SR, we have labelS(i(cid:48)) = orderSR(i(cid:48)(cid:48)) ∈ orderSR(locusSR(P R 8 cababa$cababa$cabcababa$aba$acabbaab$cababa$ba$$ba$$68311079425vlvrv7aaabbcabca123456891079861000S=25 Thus, labelS(i(cid:48)) ∈ [lv, rv], and since there is an occurrence of P2 at position i(cid:48) in S, we have i(cid:48) − m1 − d = i ∈ I(cid:48). If i ∈ I(cid:48) then there is an occurrence of P2 at position i(cid:48) = i + m1 + d with label(i(cid:48)) in the range 1 ). We need to show that this implies that there is an occurrence of [lv, rv], where v = locusSR(P R P1 at position i in S. By definition, (cid:48) labelS(i ) = orderSR(n − i (cid:48) + d + 2) = orderSR(n − i − m1 + 2). Let i(cid:48)(cid:48) = n − i − m1 + 2. Since orderSR(i(cid:48)(cid:48)) = labelS(i(cid:48)) ∈ [lv, rv], there is an occurrence of P R 1 at position i(cid:48)(cid:48) in SR. It follows directly, that there is an occurrence of P1 at position n− i(cid:48)(cid:48) − m1 + 2 = n − (n − i − m1 + 2) − m1 + 2 = i in S. Therefore, i ∈ I. Complexity Construction of the suffix tree TSR takes time O(n log n) and the labeling can be constructed in time O(n). Both use space O(n). It takes O(m1) time to find the locus nodes of P R in TSR. The substring range reporting query takes time O(m2 + occ). Thus the total query 1 time is O(m + occ). Applying Theorem 1 with u = n, this completes the proof of Theorem 2(iii). 5 Substring Range Counting and Emptiness We now show how to apply our techniques to substring range counting and substring range empti- ness. Analogous to substring range reporting, the goal is here to count the number of occurrences in the range and to determine whether or not the range is empty, respectively. A straightforward way to solve these problems is to combine a suffix tree with a 2D range counting data structure and a 2D range emptiness data structure, respectively. Using the techniques from Section 3 we show how to significantly improve the bounds of this approach in both cases. We note that by the reductions in Section 4 the bounds for substring range counting and substring range emptiness also immediately imply results for counting and emptiness versions of position-restricted substring searching, indexing substrings with intervals, and indexing substrings with gaps. 5.1 Preliminaries Let X ⊆ {0, . . . , u} be a set of points in a d-dimensional grid. Given a query rectangle R = [a1, b1] × ··· × [ad, bd], a range counting query computes R ∩ X, and a range emptiness query computes if R ∩ X = ∅. Given X the range counting problem and the range emptiness problem is to compactly represent X, while supporting range counting queries and range emptiness queries, respectively. Note that any solution for range reporting or range counting implies a solution for range emptiness with the same complexity (ignoring the occ term for range reporting queries). We will need the following additional geometric data structures. Lemma 3 (J´aJ´a et al. [19]) For a set of n points in [0, u]×[0, u] we can solve 2D range counting in O(n) space, O(n log n) preprocessing time, and O(log n/ log log n + log log u) query time. Lemma 4 (van Emde Boas et al. [29, 30], Mehlhorn and Naher [23]) For a set of n points in [0, u] we can solve 1D range counting in O(n) space, O(n log log n) preprocessing time, and O(log log u) query time. 9 To achieve the result of Lemma 4 we use a van Emde Boas data structure [29, 30] implemented in linear space [23] using perfect hashing. This data structure supports predecessor queries in O(log log u) time. By also storing for each point it's rank in the sorted order of the points, we can compute a range counting query by two predecessor queries. To build the data structure efficiently we need to sort the points and build suitable perfect hash tables. We can sort deterministically in O(n log log n) time [16], and we can build the needed hash tables in O(n) time using deterministic hashing [15] combined with a standard two-level approach (see e.g., Thorup [28]). Lemma 5 (Chan et al. [5]) For a set of n points in [0, u]×[0, u] we can solve 2D range emptiness in O(n log log n) space, O(n log n) preprocessing time, and O(log log u) query time. 5.2 The Data Structures We now show how to efficiently solve substring range counting and substring range emptiness. Recall that S is a labeled string of length n with labels from [0, u]. We can directly solve substring range counting by combining a suffix tree with the 2D range counting result from Lemma 3. This leads to a solution using O(n) space and O(m+log n/ log log n+ log log u) query time. We show how to improve the query time to O(m + log log u) at the cost of increasing the space to O(n log n/ log log n). Hence, we remove the log n/ log log n term from the query time at the cost of increasing the space by a log n/ log log n factor. We cannot hope to achieve such a bound using a suffix tree combined with a 2D range counting data structure since any 2D range counting data structure using O(n logO(1) n) space requires Ω(log n/ log log n) query time [25]. We can also directly solve substring range emptiness by combining a suffix tree with the 2D range emptiness result from Lemma 5. This solution uses O(n log log n) space and O(m + log log u) query time. We show how to achieve optimal O(m) query time with space O(n log log u). Our data structure for substring range counting and existence follows the construction in Sec- tion 3. We partition the suffix tree into a top and a number of bottom trees and store a 1D data structure for each node in the top tree and a single 2D data structure. To answer a query for a pattern string P of length m, we search the suffix tree with P and use the 1D data structure if the search ends in the top tree and otherwise use the 2D data structure. We describe the specific details for each problem. First we consider substring range counting. In this case the top tree consists of all nodes of string depth at most log n/ log log n. The 1D and 2D data structures used are the ones from Lemma 4 and 3. By the same arguments as in Section 3 the total space used for the 1D data structures for all nodes in the top tree at depth d is at most O(n) and hence the total space for all 1D data structures is O(n(log n/ log log n)). Since the 2D data structure uses O(n) space, the total space is O(n log n/ log log n). The time to build all 1D data structures is O(n(log n/ log log n) · log log n)) = O(n log n). Since the suffix tree and the 2D data structure can be built within the same bound, the total preprocessing time is O(n log n). Given a pattern of length m, a query uses O(m + log log u) time if the search ends in the top tree, and O(m + log n/ log log n + log log u) time if the search ends in a bottom tree. Since bottom trees consists of nodes of string depth more than log n/ log log n the time to answer a query in both cases is O(m + log log u). In summary, we have the following result. Theorem 3 Let S be a labeled string of length n with labels in the range [0, u]. We can solve substring range counting using O(n log n/ log log n) space, O(n log n) preprocessing time, and O(m+ log log u) query time, for a pattern string of length m. 10 Next we consider substring range emptiness. In this case the top tree consists of all nodes of string depth at most log log u. We use the 1D and 2D data structures from Lemma 1 and Lemma 5. The total space for all 1D data structures is O(n log log u). Since the 2D data structure uses O(n log log n) space the total space is O(n log log u). For any constant γ > 0, the expected time to build all 1D data structures is O(n log log u logγ u) = O(n logδ u) for suitable constant δ > 0. The suffix tree and the 2D data structure can be built in O(n log n) time and hence the total expected preprocessing time is O(n(log n + logδ u)). If the search for a pattern string ends in the top tree the query time is O(m) and if the search ends in a bottom tree the query time is O(m + log log u). As above, the partition in top and bottom trees ensures that the query time in both cases is O(m). In summary, we have the following result. Theorem 4 Let S be a labeled string of length n with labels in the range [0, u]. For any constant δ > 0 we can solve substring range existence using O(n log log u) space, O(n(log n+logδ u)) expected preprocessing time, and O(m) query time, for a pattern string of length m. 6 Acknowledgments We thank Christian Worm Mortensen and Kasper Green Larsen for clarifications on the prepro- cessing times for the results in Lemma 3 and Lemma 5. References [1] S. Alstrup, G. Brodal, and T. Rauhe. Optimal static range reporting in one dimension. In Proc. 33rd STOC, pages 476 -- 482, 2001. [2] S. Alstrup, G. Stølting Brodal, and T. Rauhe. New data structures for orthogonal range searching. In Proc. 41st FOCS, pages 198 -- 207, 2000. [3] A. Amir, E. Chencinski, C. S. Iliopoulos, T. Kopelowitz, and H. Zhang. Property matching and weighted matching. Theoret. Comput. Sci., 395(2-3):298 -- 310, 2008. [4] P. Bose, M. He, A. Maheshwari, and P. Morin. Succinct orthogonal range search structures on a grid with applications to text indexing. In Proc. 11th WADS, pages 98 -- 109, 2009. [5] T. M. Chan, K. Larsen, and M. Patra¸scu. Orthogonal range searching on the ram, revisited. In Proc. 27th SoCG, pages 354 -- 363, 2011. [6] B. Chazelle. Filtering search: A new approach to query-answering. SIAM J. Comput., 15(3):703 -- 724, 1986. [7] H. Cohen and E. Porat. Range non-overlapping indexing. In Proc. 20th ISAAC, pages 1044 -- 1053, 2009. [8] M. Crochemore, C. S. Iliopoulos, M. Kubica, M. S. Rahman, and T. Walen. gorithms for the range next value problem and applications. 205 -- 216, 2008. Improved al- In Proc. 25th STACS, pages [9] M. Crochemore, C. S. Iliopoulos, M. Kubica, M. S. Rahman, and T. Walen. Finding patterns in given intervals. Fundam. Inform., 101(3):173 -- 186, 2010. 11 [10] M. Crochemore, C. S. Iliopoulos, and M. S. Rahman. Optimal prefix and suffix queries on texts. Inf. Process. Lett., 108(5):320 -- 325, 2008. [11] M. Crochemore and G. Tischler. The gapped suffix array: A new index structure. In Proc. 17th SPIRE, pages 359 -- 364, 2010. [12] M. Farach-Colton, P. Ferragina, and S. Muthukrishnan. On the sorting-complexity of suffix tree construction. J. ACM, 47(6):987 -- 1011, 2000. [13] M. L. Fredman, J. Koml´os, and E. Szemer´edi. Storing a sparse table with O(1) worst case access time. J. ACM, 31:538 -- 544, 1984. [14] D. Gusfield. Algorithms on strings, trees, and sequences: computer science and computational biology. Cambridge, 1997. [15] T. Hagerup, P. B. Miltersen, and R. Pagh. Deterministic dictionaries. J. Algorithms, 41(1):69 -- 85, 2001. [16] Y. Han. Deterministic sorting in O(n log log n) time and linear space. J. Algorithms, 50(1):96 -- 105, 2004. [17] C. S. Iliopoulos and M. S. Rahman. Faster index for property matching. Inf. Process. Lett., 105(6):218 -- 223, 2008. [18] C. S. Iliopoulos and M. S. Rahman. Indexing factors with gaps. Algorithmica, 55(1):60 -- 70, 2009. [19] J. J´aJ´a, C. W. Mortensen, and Q. Shi. Space-efficient and fast algorithms for multidimensional dominance reporting and counting. In Proc. 15th ISAAC, pages 558 -- 568, 2004. [20] M. Juan, J. Liu, and Y. Wang. Errata for "Faster index for property matching". Inf. Process. Lett., 109(18):1027 -- 1029, 2009. [21] V. Makinen and G. Navarro. Position-restricted substring searching. In Proc. 7th LATIN 2006, pages 703 -- 714, 2006. [22] V. Makinen and G. Navarro. Rank and select revisited and extended. Theoret. Comput. Sci., 387(3):332 -- 347, 2007. [23] K. Mehlhorn and S. Nahler. Bounded ordered dictionaries in O(log log N ) time and O(n) space. Inform. Process. Lett., 35(4):183 -- 189, 1990. [24] C. W. Mortensen, R. Pagh, and M. Patra¸ccu. On dynamic range reporting in one dimension. In Proc. 37th STOC, pages 104 -- 111, 2005. [25] M. Patra¸scu. Lower bounds for 2-dimensional range counting. In Proc. 39th STOC, pages 40 -- 46, 2007. [26] M. Patra¸scu and M. Thorup. Time-space trade-offs for predecessor search. In Proc. 38th STOC, pages 232 -- 240, 2006. [27] E. Porat, 2011. Personal communication. 12 [28] M. Thorup. Space efficient dynamic stabbing with fast queries. In Proceedings of the 33rd Annual ACM Symposium on Theory of Computing, pages 649 -- 658, 2003. [29] P. van Emde Boas. Preserving order in a forest in less than logarithmic time and linear space. Inform. Process. Lett., 6(3):80 -- 82, 1977. [30] P. van Emde Boas, R. Kaas, and E. Zijlstra. Design and implementation of an efficient priority queue. Mathematical Systems Theory, 10:99 -- 127, 1977. Announced at FOCS 1975. [31] C.-C. Yu, W.-K. Hon, and B.-F. Wang. Improved data structures for the orthogonal range successor problem. Comput. Geometry, 44(3):148 -- 159, 2011. 13
1811.11856
1
1811
2018-11-27T16:42:21
Efficient Measuring of Congruence on High Dimensional Time Series
[ "cs.DS", "cs.DM" ]
A time series is a sequence of data items; typical examples are streams of temperature measurements, stock ticker data, or gestures recorded with modern virtual reality motion controllers. Quite some research has been devoted to comparing and indexing time series. Especially, when the comparison should not be affected by time warping, the ubiquitous Dynamic Time Warping distance function ($\texttt{DTW}$) is one of the most analyzed time series distance functions. The Dog-Keeper distance ($\texttt{DK}$) is another example for a distance function on time series which is truely invariant under time warping. For many application scenarios (e.$\,$g. motion gesture recognition in virtual reality), the invariance under isometric spatial transformations (i.$\,$e. rotation, translation, and mirroring) is as important as the invariance under time warping. Distance functions on time series which are invariant under isometric transformations can be seen as measurements for the congruency of two time series. The congruence distance ($\texttt{CD}$) is an example for such a distance function. However, it is very hard to compute and it is not invariant under time warpings. In this work, we are taking one step towards developing a feasable distance function which is invariant under isometric spatial transformations and time warping: We develop four approximations for $\texttt{CD}$. Two of these even satisfy the triangle inequality and can thus be used with metric indexing structures. We show that all approximations serve as a lower bound to $\texttt{CD}$. Our evaluation shows that they achieve remarkable tightness while providing a speedup of more than two orders of magnitude to the congruence distance.
cs.DS
cs
Efficient Measuring of Congruence on High Dimensional Time Series Jorg P. Bachmann1 and Johann-Christoph Freytag2 1 [email protected] 2 [email protected] 1,2Humboldt-Universitat zu Berlin, Germany November 30, 2018 Abstract A time series is a sequence of data items; typical examples are streams of temperature measure- ments, stock ticker data, or gestures recorded with modern virtual reality motion controllers. Quite some research has been devoted to com- paring and indexing time series. Especially, when the comparison should not be affected by time warping, the ubiquitous Dynamic Time Warping distance function (DTW) is one of the most analyzed time series distance functions. The Dog-Keeper distance (DK) is another exam- ple for a distance function on time series which is truely invariant under time warping. For many application scenarios (e. g. motion gesture recognition in virtual reality), the in- variance under isometric spatial transformations (i. e. rotation, translation, and mirroring) is as important as the invariance under time warping. Distance functions on time series which are in- variant under isometric transformations can be seen as measurements for the congruency of two time series. The congruence distance (CD) is an example for such a distance function. However, it is very hard to compute and it is not invariant under time warpings. In this work, we are taking one step towards developing a feasable distance function which is invariant under isometric spatial transforma- tions and time warping: We develop four ap- proximations for CD. Two of these even satisfy the triangle inequality and can thus be used with metric indexing structures. We show that all ap- proximations serve as a lower bound to CD. Our evaluation shows that they achieve remarkable tightness while providing a speedup of more than two orders of magnitude to the congruence dis- tance. 1 Introduction Multimedia retrieval is a common application which requires finding similar objects to a query object. We consider examples such as gesture recognition with modern virtual reality motion controllers and classification of handwritten let- 1 ters where the objects are multi-dimensional time series. In many cases, similarity search is performed using a distance function on the time series, where small distances imply similar time series. A nearest neigbor query to the query time series can be a k-nearest neighbor (k-NN) query or an ε-nearest neighbor (ε-NN) query: A k-NN query retrieves the k most similar time series; an ε-NN query retrieves all time series with a distance of at most ε. In our examples, the time series of the same classes (e. g., same written characters or same gestures) differ by temporal as well as spatial displacements. Time warping distance functions such as dynamic time warping (DTW) [14] and the Dog-Keeper distance (DK) [6, 10] are robust against temporal displacements. They map pairs of time series representing the same trajectory to small distances. Still, they fail when the time se- ries are rotated or translated in space. The distance functions defined and analyzed in this paper measure the (approximate) congru- ence of two time series. Thereby, the distance be- tween two time series S and T shall be 0 iff S can be transformed into T by rotation, translation, and mirroring; in this case, S and T are said to be congruent. A value greater than 0 shall corre- late to the amount of transformation needed to turn the time series into congruent ones. The classical Congruence problem basically determines whether two point sets A, B ⊆ Rk are congruent considering isometric transforma- tions (i. e., rotation, translation, and mirroring) [3, 11]. For 2- and 3-dimensional spaces, there are results providing algorithms with runtime O(n · log n) when n is the size of the sets [3]. For larger dimensionalities, they provide an al- gorithm with runtime O(nk−2·log n). For various reasons (e. g. bounded floating point precision, physical measurement errors), the approximated Congruence problem is of much more interest in practical applications. Different variations of the approximated Congruence problem have been studied (e. g. what types of transforma- tions are used, is the assignment of points from A to B known, what metric is used) [2, 3, 11, 12]. The Congruence problem is related to our work, since the problem is concerned with the ex- istence of isometric functions such that a point set maps to another point set. The main differ- ence is, that we consider ordered lists of points (i. e. time series) rather than pure sets. It turned out, that solving the approximated Congru- ence problem is NP-hard regarding length and dimensionality [5]. With this work, we contribute by evaluating the congruence distance with an implementation based on a nonlinear optimizer. We propose two approximations to the congruence distance which have linear runtime regarding the dimen- sionality and (quasi-) quadratic runtime regard- ing the length of the time series. We improve the complexity of both approximations at cost of approximation quality, such that their com- plexity is (quasi-) linear regarding the length of the time series. We evaluate the approximations experimentally. 1.1 Basic Notation We denote the natural numbers including zero with N and the real numbers with R. For a, b ∈ N we denote the modulo operator by a%b. The := set of all powers of two is denoted via 2 {1, 2, 4, 8,···}. Elements of a k-dimensional vector v ∈ Rk are accessed using subindices, i. e. v3 is the third el- ement of the vector. Sequences (here also called time series) are usually written using capital let- N 2 ters, e. g. S = (s0,··· , sn−1) is a sequence of length n. Suppose si ∈ Rk, then si,j denotes the j-th element of the i-th vector in the sequence S. The projection to the j-th dimension is de- noted via Sj, i. e. Sj = (s0,j,··· , sn−1,j). The Euclidean norm of a vector v is denoted via (cid:107)v(cid:107)2, thus d(v, w) := (cid:107)v − w(cid:107)2 denotes the Euclidean distance between v and w ∈ Rk. We denote the set of k-dimensional orthog- onal matrices with MO(k), the identity ma- trix with I and the transposed of a matrix M with M T . For a matrix M in Rk, we denote the matrix holding the absoloute values with M := (Mi,j)0(cid:54)i,j<k. 1.2 Congruence Distance While DTW compares two time series S and T , it is (nearly) invariant under time warpings. In detail, consider σ(S) and τ (T ) as warp- ings by duplicating elements (e. g. σ(S) = (s0, s1, s1, s1, s2, s3, s3, s4,··· )), then DTW mini- mizes the L1 distance under all time warps: σ(S)−1(cid:88) i=0 d (σ(S)i, τ (T )i) DTW(S, T ) := min σ,τ with σ(S) = τ (T ). On the other hand, the congruence distance is invariant under all isometric transformations. The difference to DTW is, that it minimizes the L1 distance by multiplying an orthogonal matrix and adding a vector: f (M, v) dC(S, T ) := min M,v := min M,v n−1(cid:88) i=0 d (si, M · ti + v) (1) to the objective function. For time series in Rk, the orthogonality of M yields a set of k2 equality based constraints. 2 Approximating the Congru- ency Consider two time series S, T , an arbitrary or- thogonal matrix M ∈ MO(k), and a vector v ∈ Rk. Using the triangle inequality, we ob- tain d(si, M · sj + v) (cid:54) d(si, M · ti + v) + d(ti, tj) + d(M · tj + v, sj) ⇒d(si, sj) − d(ti, tj) (cid:54) d(si, M · ti + v) + d(sj, M · tj + v) (cid:80)n−1 i. e. we can estimate the congruence distance i=0 d(si, M · ti + v) without actually solving the optimization problem. We unroll this idea to propose two approximating algorithms in Sec- tion 2.1 and 2.2. (2) Considering the well-known self-similarity matrix of a time series, the left hand side of Equation (2) matches the entry of the differ- ence between two self-similarity matrices. Usu- ally, the self-similarity matrix is used to analyze a time series for patterns (e. g. using Recurrence Plots [9]). The important property that makes the self-similarity matrix useful for approximat- ing the congruence distance, is its invariance un- der transformations considered for the congru- ence distance, rotation, translation, and mirroring. i. e. The self-similarity matrix of an arbitrary time series T = (t0, . . . , tn−1) is defined as follows: ∆T := (cid:0) d (ti, tj) (cid:1) 0(cid:54)i,j<n The computation of dC(S, T ) is an optimization problem where f (cf. Equation (1)) corresponds Note, that ∆Ti,j = ∆Tj,i and ∆Ti,i = 0. In fact, the self-similarity matrix ∆T completely 3 describes the sequence T up to congruence, i.e., up to rotation, translation, and mirroring of the whole sequence in Rk [5]: Two time series S and T are congruent iff they have the same self- similarity matrix, i. e. ∃M ∈ MO(k), v ∈ Rk : S = M · T + v ⇐⇒ ∆S = ∆T. (3) 2.1 Metric Approximation Equation (2) and (3) yield the approach for ap- proximating the congruency: We measure the congruency of two time series S and T via a met- ric on their self-similarity matrices. Definition 2.1 (Delta Distance). Let S, T be two time series of length n. The delta distance d∆(S, T ) is defined as follows: Since d is symmetric, d∆ inherits its symme- try. Hence, d∆ is a pseudo metric on the set of time series of length n where all time series of an equivalence class are congruent to each other. We omit providing pseudo code since the com- putation matches the formula in Definition 2.1. The complexity of computing the delta distance d∆ grows quadratically with the length of the time series. Our next aim is to show that the the delta dis- tance d∆ provides a lower bound on the congru- ence distance dC, as formulated in the following theorem. Theorem 2.3. For all time series S and T , the following holds: d∆(S, T ) (cid:54) dC(S, T ). (cid:12)(cid:12)d(cid:0)si, s(i+δ)%n (cid:1) − d(cid:0)ti, t(i+δ)%n (cid:1)(cid:12)(cid:12) Proof. Fixiate a δ∗ which maximizes d∆(S, T ) in Definition 2.1. Using the triangle inequality as in Equation (2) yields d∆(S, T ) := 1 2 max 0<δ<n n−1(cid:88) i=0 (cid:1)(cid:12)(cid:12) d∆(S, T ) = 1 2 i=0 i=0 1 2 n−1(cid:88) (cid:12)(cid:12)d(cid:0)si, s(i+δ∗)%n (cid:1) − d(cid:0)ti, t(i+δ∗)%n n−1(cid:88) (cid:12)(cid:12)d(cid:0)si, s(i+δ∗)%n (cid:1)− d(cid:0)M · ti + v, M · t(i+δ∗)%n + v(cid:1)(cid:12)(cid:12) n−1(cid:88) d(cid:0)s(i+δ∗)%n, M · t(i+δ∗)%n + v(cid:1)(cid:1) n−1(cid:88) (d (si, M · ti + v) + d (si, M · ti + v) (cid:54) 1 2 i=0 = i=0 for arbitrary M ∈ MO(k) and v ∈ Rk. Hence, d∆(S, T ) (cid:54) dC(S, T ). 4 Proposition 2.2. The delta distance satisfies the triangle inequality. Proof. Consider three time series R, S, and T and fixiate a δ∗ which maximizes d∆(R, T ) in Definition 2.1. Then = dδ(R, T ) = i=0 n−1(cid:88) (cid:12)(cid:12)d(cid:0)ri, r(i+δ∗)%n n−1(cid:88) (cid:12)(cid:12)d(cid:0)ri, r(i+δ∗)%n (cid:12)(cid:12)d(cid:0)si, s(i+δ∗)%n (cid:1)(cid:12)(cid:12) (cid:1) − d(cid:0)ti, t(i+δ∗)%n (cid:1)(cid:12)(cid:12) + (cid:1) + d(cid:0)si, s(i+δ∗)%n (cid:1)(cid:12)(cid:12) (cid:1) − d(cid:0)ti, t(i+δ∗)%n i=0 (cid:54) (cid:54) d∆(R, S) + d∆(S, T ) prooves the triangle inequality. In this section, we provided the delta distance, which is a metric lower bound to the congruence distance. 2.2 Greedy Approximation The approach of the delta distance is simple: For time series S and T , it only sums up values along a (wrapped) diagonal in ∆S − ∆T and chooses the largest value. However, another combination of elements within ∆S − ∆T as addends might provide a better approximation of the congru- ence distance. Since it is a computational expen- sive task, to try all combinations, we try to find a good combination using a greedy algorithm for selecting the entries of ∆S − ∆T. The greedy algorithm first sorts the ele- ments di,j = d(si, sj) − d(ti, tj) in descend- ing order and stores them in a sequence Q = (di1,j1, di2,j2,··· ). While iterating over the se- quence Q, it adds dir,jr to a global sum and masks the indices ir and jr as already seen. El- ements in the queue which access already seen indices are skipped, thus each index is used at most once. Basically, this is the reason, why the greedy delta distance (denoted as dG(S, T )) is a lower bound to the congruence distance. The- orem 2.4 proves the last statement and Algo- rithm 1 provides the pseudo code for the com- putation. ements, which takes n2 · log(n2) steps. The complexity is dominated by sorting n2 el- Theorem 2.4. For all time series S and T , the following holds: dG(S, T ) (cid:54) dC(S, T ). Algorithm 1 Greedy Delta Distance Input: time series S, T of length n 1 Algorithm: greedydelta 2 3 Output: distance d 4 5 6 7 8 9 10 11 12 13 14 15 16 let Q = () // empty sequence for i = 0, . . . , n − 2 for j = i + 1, . . . , n − 1 append di,j := d (si, sj) − d (ti, tj) to Q sort Q // (descending) let S = ∅ let d = 0 for each dia,ja in Q if ia ∈ S or ja ∈ S continue let d = d + dia,ja let S = S ∪ {ia, ja} return d have not been skipped. Since each index is ap- pears at most once in this list, the following in- equality holds for arbitrary orthogonal matrices M and vectors vRk: r(cid:88) dG(S, T ) = dia,ja a=1 r(cid:88) r(cid:88) n−1(cid:88) a=1 (cid:54) (cid:54) (cid:54) i=0 a=1 d (sia, sja) − d (M · tia + v, M · tja + v) d (sia, tia) + d (M · tia + v, M · tja + v) d (si, M · ti + v) Proof. Let Q∗ = (di1,j1,··· , dir,jr ) be the list of elements from the queue in Algorithm 1 which Hence, dG(S, T ) (cid:54) dC(S, T ). 5 2.3 Runtime improvement The complexity of the delta distance and greedy delta distance is linear regarding the dimension- ality but quadratic in length. In this section, we motivate an optimization for both algorithms. Time series usually do not contain random points, but they come from continuous processes in the real world, i. e. the distance between two successive elements is rather small. Hence, the distances d (ti, tj) and d (ti, tj+1) are probably close to each other if i (cid:28) j, i. e. if j is much larger than i. This insight leads to the idea, to only consider elements d (ti, tj) where i − j is a power of two, i. e. we consider less elements for larger temporal distances. The Fast Delta Distance: Adapting the idea to the delta distance d∆ yields the following def- inition. Definition 2.5 (Fast Delta Distance). Let S, T be two time series of length n. The fast delta distance d∆(S, T ) is defined as follows: d∆(S, T ) := 1 2 max 0<δ<n,δ∈2N n−1(cid:88) i=0 (cid:12)(cid:12)d(cid:0)si, s(i+δ)%n (cid:1) − d(cid:0)ti, t(i+δ)%n (cid:1)(cid:12)(cid:12) Since we omit some values δ in Definition 2.1, the fast version d∆ is a lower bound to d∆, i. e. the following theorem holds: Theorem 2.6. For all time series S and T , the following holds: d∆(S, T ) (cid:54) d∆(S, T ) Especially, the fast delta distance is also a lower bound to the congruence distance. For time series of length n the complexity of the fast delta distance d∆ improves to n log n. On the other hand, equivalence classes regarding the fast delta distance might include time series which are not congruent. The Fast Greedy Delta Distance: Incor- porating the idea for improving the runtime into the greedy delta distance simply changes Line 7 of Algorithm 1: We only consider values for the variable j, which add a power of 2 to the vari- able i. Algorithm 2 provides the line to change in Algorithm 1 in order to achieve the fast greedy delta distance. Algorithm 2 Distinction between Greedy Delta Distance (cf. Algorithm 1) and Fast Greedy Delta Distance for j ∈ 2 N with j (cid:54) n − 1 7 The fast greedy delta distance is again dom- inated by the sorting of elements. This time, n log n elements have to be sorted, thus its complexity is n log(n) log(n log n) = n log(n)2. Hence, the fast versions both have quasi linear runtime regarding length and linear runtime re- garding dimensionality. An inequality such as in Theorem 2.6 does not exist for the fast greedy delta distance. Also, there is no correlation between the (fast) delta distance and the (fast) greedy distance. Though, the evaluation shows that the greedy delta dis- tance provides a much better approximation in most cases. Call for Section 3 for an evaluation of their tightness to the congruence distance. 3 Evaluation Since the exact computation of the congruence distance is a computational hard problem (an 6 thus not feasable in practical applications), we are mainly interested in the evaluation of the ap- proximations. Unfortunately, there is no direct algorithm for the computation of the congruence distance and we have to consider the computa- tion of the congruence distance as a nonlinear optimization problem. For two time series S and T , we will denote the distance value computed by an optimizer with dO(S, T ). Since an optimizer might not find the global optimum, all values for the congruence distance (computed by an opti- mizer) in this section, are in fact upper bounds to the correct but unknown value of the congruence distance, i. e. dC(S, T ) (cid:54) dO(S, T ). This given circumstance complicates the evaluation of our approximations to the congruence distance. To estimate the tightness of the approxima- tions, we first evaluate our optimizer on prob- lems for which we know the correct results (cf. Section 3.1). In those cases, where the er- ror of the optimizer is small, the estimation of the tightness of our approximations is accurate. On the other hand, when the error of the opti- mizer increases, our estimation of the tightness of our approximations are loose and the approx- imation might be tighter than the experiments claim. For a detailed explanation, consider a lower bound (cid:96)(S, T ) for the congruence distance (e. g. (cid:96) might be one of dG, dG, d∆, or d∆) and suppose dC(S, T ) = dO(S, T ) − ε, i. e. ε (cid:62) 0 is the error of the optimizer. Then, we have the following correlation between the estimated tightness and the real tightness: (cid:96)(S, T ) dC(S, T ) = (cid:96)(S, T ) dO(S, T ) − ε (cid:62) (cid:96)(S, T ) dO(S, T ) Hence, for small errors ε, the estimated tightness is accurate and for large errors ε we underesti- mate the tightness. In Section 3.2 and 3.3, we Figure 1: Boxplot: distance values (left) and runtimes (right) from our Optimizer on congru- ent time series. evaluate the tightness and the speedup of ap- proximations to the (optimizer based) congru- ence distance, respectively. 3.1 Congruence Distance: An Opti- mization Problem Consider fixed time series S and T in Rk with length n. The congruence distance is a nonlinear optimization problem with equality based con- straints. The function to minimize is n−1(cid:88) f (M, v) = d (si, M · ti + v) i=0 while the k2 equality based constraints corre- spond the the constraints for orthogonal matri- ces: M · M T = I. As a initial "solution" for the optimizer, we sim- ply choose M = I and v = 0. We manually transformed time series T with a random orthogonal matrix M∗ and a small ran- dom vector v∗ and solved the optimization prob- lem dC(T, M∗ · T + v∗) to examine whether our optimizer is working properly. Clearly, we ex- pect the optimizer to find a solution with value 7 0 1 2 3 4 5 6 7 81234Congruence DistanceDimensionality 0 5 10 15 20 251234Computation TimeDimensionality 0. Whenever the optimizer claimed large dis- tance values, we concluded that the optimizer is not working. We tried different optimizer strate- gies and chose an augmented lagrangian algo- rithm [7] with the BOBYQA algorithm [13] as local optimizer for further experiments because it promised the best performance with these ex- periments. We used the implementations pro- vided by the NLopt library [1]. We used the RAM dataset generator [4] to eval- uate the optimizer on time series with vary- ing dimensionality. We solved 400 optimiza- tion problems for varying dimensionality and removed all of those runs where the optimizer did not find a reasonable solution (i. e. runs where the optimizer yielded solutions larger than 100). Figure 1 shows the distance values pro- posed by the optimizer (and therefore the error it makes) per dimensionality up to dimensional- ity 4. For higher dimensionalities, the optimizer completely failed to find any reasonable value near 0 although we gave it enough resources of any kind (e. g. number of iterations, computa- tion time, etc.). Figure 1 also shows that the computation times rapidly increase with increas- ing dimensionality. Because of the raising error and runtime with increasing dimensionality, an evaluation of the congruence distance on higher dimensionality is not feasable. Hence, we can only consider up to 4-dimensional time series in all further experiments. 3.2 Tightness of Approximations In order to evaluate the tightness of the (fast) delta distance and (fast) greedy delta distance as lower bounds to the congruence distance, we used the RAM dataset generator [4] as well as a real world dataset with 2-dimensional time se- ries (character trajectories [8], contains over 2800 Figure 2: Average tightness of the delta distance (top left), the fast delta distance (top right), the greedy delta distance (bottom left), and the fast greedy delta distance (bottom right) to the con- gruence distance, respectively. time series). Other real world datasets with higher dimensionality have not been suitable be- cause the optimizer failed to compute the con- gruence distance. Since making the (greedy) delta distance time warping aware is future work, we have to deal with time warping another way. We simply pre- process our datasets, such that each time series, seen as a trajectory, moves with constant speed, i. e. for each dewarped time series, the following holds: d (ti, ti+1) ≈ d (ti+1, ti+2) . We achieve this property by simply reinterpolat- ing the time series regarding the arc length. Figure 2 shows the tightness of the approxi- mations on RAM datasets. As we expected, the greedy delta distance provides the tightest ap- 8 0 0.2 0.4 0.6 0.8 11234TightnessDimensionalityDelta Distance 0 0.2 0.4 0.6 0.8 11234TightnessDimensionalityFast Delta Distance 0 0.2 0.4 0.6 0.8 11234TightnessDimensionalityGreedy Delta Distance 0 0.2 0.4 0.6 0.8 11234TightnessDimensionalityFast Greedy Delta Distance Figure 3: Average speedup of the approxima- tions to our optimizer proximation to the congruence distance (pro- vided by our optimizer). As we observed in Section 3.1, the error of our optimizer increases with increasing dimen- sionality. Hence, the tightness of the optimizer to the real congruence distance is decreasing. Since we can observe a similar behaviour here (the tightness of the approximation is decreas- ing with increasing dimensionality), the reason might be the inaccuracy of the optimizer. Ei- ther way, we can see that the tightness is above 50% in most cases. Especially when using the greedy delta distance, the tightness is above 75% in most cases. On the character trajectories dataset, the delta distance and the greedy delta distance achieved a tightness of 63% and 83%, respec- tively. 3.3 Speedup of Approximations Figure 3 shows the speedup of the approxima- tions to the optimizer. As expected, the speedup increases exponentially with increasing dimen- sionality. While the fast delta distance is the fastest algorithm, it also provides the worst ap- proximation (compare with Figure 2). On the other hand, the greedy delta distance provides the best approximation while being the slowest algorithm. Still, the greedy delta distance is mul- tiple orders of magnitudes faster than our opti- mizer. The following speedups have been achieved on the character trajectory dataset: 1642 with the delta distance; 8040 with the fast delta distance; 321 with the greedy delta distance; 2287 with the fast greedy delta distance. The results are similar to those on the RAM generated datasets. 4 Conclusion and Future Work In this paper, we analyzed the problem of mea- suring the congruence between two time series. We provided four measures for approximating the congruence distance which are at least 2 or- ders of magnitude faster than the congruence distance. The first (namely, the delta distance) provides the additional ability to be used in metrix indexing structures. The second (greedy delta distance) loses this benefit, but seems to achieve a better approximation. Both approx- imations have linear complexity regarding the dimensionality but at least quadratic complex- ity regarding the length of the time series. The other two approximations address this problem at a cost of approximation quality. They have quasi-linear runtime regarding the length. In practical applications, time series distance functions need to be robust against time warp- ing. The approximations provided in this work are based on comparing self-similarity matrices of time series. Based on this idea, our next step is to develop a time warping distance function measuring the congruency. 9 10 100 1000 10000 100000 1x106 1 1.5 2 2.5 3 3.5 4Average Computation TimeDimensionalityDelta DistanceFast Delta DistanceGreedy Delta DistanceFast Greedy Delta Distance [10] T. Eiter and H. Mannila. Computing dis- crete fr´echet distance. Technical report, Technische Universitat Wien, 1994. [11] P. J. Heffernan and S. Schirra. Approximate decision algorithms for point set congru- ence. In Proc. of the Symposium on Com- put. Geometry, SCG, pages 93 -- 101. ACM, 1992. [12] P. Indyk and S. Venkatasubramanian. Ap- proximate congruence in nearly linear time. Comput. Geom. Theory Appl., 24(2):115 -- 128, Feb. 2003. [13] M. J. D. Powell. The bobyqa algorithm for bound constrained optimization without derivatives. 01 2009. [14] H. Sakoe and S. Chiba. Readings in speech recognition. In A. Waibel and K.-F. Lee, ed- itors, Readings in Speech Recognition, chap- ter Dynamic Programming Algorithm Op- timization for Spoken Word Recognition, pages 159 -- 165. Morgan Kaufmann Publish- ers Inc., San Francisco, CA, USA, 1990. References [1] Nlopt. https://nlopt.readthedocs.io. Accessed: 2018-05-15. [2] H. Alt and L. J. Guibas. Discrete geomet- ric shapes: Matching, interpolation, and ap- proximation: A survey. Technical report, Handbook of Comput. Geometry, 1996. [3] H. Alt, K. Mehlhorn, H. Wagener, and E. Welzl. Congruence, similarity and sym- metries of geometric objects. Discrete Com- put. Geom., 3(3):237 -- 256, Jan. 1988. [4] J. P. Bachmann and J. Freytag. High di- mensional time series generators. CoRR, abs/1804.06352, 2018. [5] J. P. Bachmann, J. Freytag, B. Hauskeller, and N. Schweikardt. Measuring congruence on high dimensional time series. CoRR, abs/1805.10697, 2018. [6] J. P. Bachmann and J.-C. Freytag. Dynamic Time Warping and the (Windowed) Dog- Keeper Distance, pages 127 -- 140. Springer International Publishing, Cham, 2017. [7] E. G. Birgin and J. M. Mart´ınez. Improv- ing ultimate convergence of an augmented lagrangian method. Optimization Methods Software, 23(2):177 -- 195, Apr. 2008. [8] D. Dheeru and E. Karra Taniskidou. UCI machine learning repository, 2017. [9] J.-P. Eckmann, S. O. Kamphorst, and D. Ruelle. Recurrence plots of dynami- cal systems. EPL (Europhysics Letters), 4(9):973, 1987. 10
1304.7067
1
1304
2013-04-26T04:55:07
Detecting regularities on grammar-compressed strings
[ "cs.DS" ]
We solve the problems of detecting and counting various forms of regularities in a string represented as a Straight Line Program (SLP). Given an SLP of size $n$ that represents a string $s$ of length $N$, our algorithm compute all runs and squares in $s$ in $O(n^3h)$ time and $O(n^2)$ space, where $h$ is the height of the derivation tree of the SLP. We also show an algorithm to compute all gapped-palindromes in $O(n^3h + gnh\log N)$ time and $O(n^2)$ space, where $g$ is the length of the gap. The key technique of the above solution also allows us to compute the periods and covers of the string in $O(n^2 h)$ time and $O(nh(n+\log^2 N))$ time, respectively.
cs.DS
cs
Detecting regularities on grammar-compressed strings Tomohiro I1,2, Wataru Matsubara3, Kouji Shimohira1, Shunsuke Inenaga1, Hideo Bannai1, Masayuki Takeda1, Kazuyuki Narisawa3, and Ayumi Shinohara3 1 Department of Informatics, Kyushu University, Japan {tomohiro.i, inenaga, bannai, takeda}@inf.kyushu-u.ac.jp 2 Japan Society for the Promotion of Science (JSPS) 3 Graduate School of Information Sciences, Tohoku University, Japan {narisawa,ayumi}@ecei.tohoku.ac.jp Abstract. We solve the problems of detecting and counting various forms of regularities in a string represented as a Straight Line Program (SLP). Given an SLP of size n that represents a string s of length N , our algorithm compute all runs and squares in s in O(n3h) time and O(n2) space, where h is the height of the derivation tree of the SLP. We also show an algorithm to compute all gapped-palindromes in O(n3h + gnh log N ) time and O(n2) space, where g is the length of the gap. The key technique of the above solution also allows us to compute the periods and covers of the string in O(n2h) time and O(nh(n + log2 N )) time, respectively. 1 Introduction Finding regularities such as squares, runs, and palindromes in strings, is a fun- damental and important problem in stringology with various applications, and many efficient algorithms have been proposed (e.g., [12,6,1,7,13,2,9]). See also [5] for a survey. In this paper, we consider the problem of detecting regularities in a string s of length N that is given in a compressed form, namely, as a straight line program (SLP), which is essentially a context free grammar in the Chomsky normal form that derives only s. Our model of computation is the word RAM: We shall assume that the computer word size is at least ⌈log2 N ⌉, and hence, standard operations on values representing lengths and positions of string s can be manipulated in constant time. Space complexities will be determined by the number of computer words (not bits). Given an SLP whose size is n and the height of its derivation tree is h, Bannai et al. [3] showed how to test whether the string s is square-free or not, in O(n3h log N ) time and O(n2) space. Independently, Khvorost [8] pre- sented an algorithm for computing a compact representation of all squares in s in O(n3h log2 N ) time and O(n2) space. Matsubara et al. [14] showed that a compact representation of all maximal palindromes occurring in the string s can be computed in O(n3h) time and O(n2) space. Note that the length N of the decompressed string s can be as large as O(2n) in the worst case. Therefore, in such cases these algorithms are more efficient than any algorithm that work on uncompressed strings. In this paper we present the following extension and improvements to the above work, namely, 1. an O(n3h)-time O(n2)-space algorithm for computing a compact represen- tation of squares and runs; 2. an O(n3h+gnh log N )-time O(n2)-space algorithm for computing a compact representation of palindromes with a gap (spacer) of length g. We remark that our algorithms can easily be extended to count the number of squares, runs, and gapped palindromes in the same time and space complexities. Note that Result 1 improves on the work by Khvorost [8] which requires O(n3h log2 N ) time and O(n2) space. The key to the improvement is our new technique of Section 3.3 called approximate doubling, which we believe is of independent interest. In fact, using the approximate doubling technique, one can improve the time complexity of the algorithms of Lifshits [10] to compute the periods and covers of a string given as an SLP, in O(n2h) time and O(nh(n+ log2 N )) time, respectively. If we allow no gaps in palindromes (i.e., if we set g = 0), then Result 2 implies that we can compute a compact representation of all maximal palindromes in O(n3h) time and O(n2) space. Hence, Result 2 can be seen as a generalization of the work by Matsubara et al. [14] with the same efficiency. 2 Preliminaries 2.1 Strings Let Σ be the alphabet, so an element of Σ∗ is called a string. For string s = xyz, x is called a prefix, y is called a substring, and z is called a suffix of s, respectively. The length of string s is denoted by s. The empty string ε is a string of length 0, that is, ε = 0. For 1 ≤ i ≤ s, s[i] denotes the i-th character of s. For 1 ≤ i ≤ j ≤ s, s[i..j] denotes the substring of s that begins at position i and ends at position j. For any string s, let sR denote the reversed string of s, that is, sR = s[s] · · · s[2]s[1]. For any strings s and u, let lcp(s, u) (resp. lcs(s, u)) denote the length of the longest common prefix (resp. suffix) of s and u. We say that string s has a period c (0 < c ≤ s) if s[i] = s[i + c] for any 1 ≤ i ≤ s − c. For a period c of s, we denote s = uq, where u is the prefix of s of length c and q = s c . For convenience, let u0 = ε. If q ≥ 2, s = uq is called a repetition with root u and period u. Also, we say that s is primitive if there is no string u and integer k > 1 such that s = uk. If s is primitive, then s2 is called a square. We denote a repetition in a string s by a triple hb, e, ci such that s[b..e] is a repetition with period c. A repetition hb, e, ci in s is called a run (or maximal 2 periodicity in [11]) if c is the smallest period of s[b..e] and the substring cannot be extended to the left nor to the right with the same period, namely neither s[b − 1..e] nor s[b..e + 1] has period c. Note that for any run hb, e, ci in s, every substring of length 2c in s[b..e] is a square. Let Run(s) denote the set of all runs in s. A string s is said to be a palindrome if s = sR. A string s said to be a gapped palindrome if s = xuxR for some string u ∈ Σ∗. Note that u may or may not be a palindrome. The prefix x (resp. suffix xR) of xuxR is called the left arm (resp. right arm) of gapped palindrome xuuR. If u = g, then xuxR is said to be a g-gapped palindrome. We denote a maximal g-gapped palindrome in a string s by a pair hb, eig such that s[b..e] is a g-gapped palindrome and s[b − 1..e + 1] is not. Let gPals(s) denote the set of all maximal g-gapped palindromes in s. Given a text string s ∈ Σ+ and a pattern string p ∈ Σ+, we say that p occurs at position i (1 ≤ i ≤ s − p + 1) iff s[i..i + p − 1] = p. Let Occ(s, p) denote the set of positions where p occurs in s. For a pair of integers 1 ≤ b ≤ e, [b, e] = {b, b + 1, . . . , e} is called an interval. Lemma 1 ([15]). For any strings s, p ∈ Σ+ and any interval [b, e] with 1 ≤ b ≤ e ≤ b + p, Occ(s, p) ∩ [b, e] forms a single arithmetic progression if Occ(s, p) ∩ [b, e] 6= ∅. 2.2 Straight-line programs A straight-line program (SLP ) S of size n is a set of productions S = {Xi → expr i}n i=1, where each Xi is a distinct variable and each expr i is either expri = XℓXr (1 ≤ ℓ, r < i), or expri = a for some a ∈ Σ. Note that Xn derives only a single string and, therefore, we view the SLP as a compressed representation of the string s that is derived from the variable Xn. Recall that the length N of the string s can be as large as O(2n). However, it is always the case that n ≥ log N . For any variable Xi, let val (Xi) denote the string that is derived from variable Xi. Therefore, val (Xn) = s. When it is not confusing, we identify Xi with the string represented by Xi. Let Ti denote the derivation tree of a variable Xi of an SLP S. The derivation tree of S is Tn (see also Fig. 5 in Appendix C). Let height (Xi) denote the height of the derivation tree Ti of Xi and height (S) = height (Xn). We associate each leaf of Ti with the corresponding position of the string val (Xi). For any node z of the derivation tree Ti, let ℓz be the number of leaves to the left of z in Ti. The position of z in Ti is ℓz + 1. Let [u, v] be any integer interval with 1 ≤ u ≤ v ≤ val (Xi). We say that the interval [u, v] crosses the boundary of node z in Ti, if the lowest common ancestor of the leaves u and v in Ti is z. We also say that the interval [u, v] touches the boundary of node z in Ti, if either [u − 1, v] or [u, v + 1] crosses the boundary of z in Ti. Assume p = w[u..u + p − 1] and interval [u, u + p − 1] crosses or touches the boundary of node z in Ti. When z is labeled by Xj, then we also say that the occurrence of p starting at position u in val (Xi) crosses or touches the boundary of Xj. 3 Lemma 2 ([4]). Given an SLP S of size n describing string w of length N , we can pre-process S in O(n) time and space to answer the following queries in O(log N ) time: -- Given a position u with 1 ≤ u ≤ N , answer the character w[u]. -- Given an interval [u, v] with 1 ≤ u ≤ v ≤ N , answer the node z the interval [u, v] crosses, the label Xi of z, and the position of z in TS = Tn. For any production Xi → XℓXr and a string p, let Occξ(Xi, p) be the set of occurrences of p which begin in Xℓ and end in Xr. Let S and T be SLPs of sizes n and m, respectively. Let the AP-table for S and T be an n × m table such that for any pair of variables X ∈ S and Y ∈ T the table stores Occξ(X, Y ). It follows from Lemma 1 that Occξ(X, Y ) forms a single arithmetic progression which requires O(1) space, and hence the AP-table can be represented in O(nm) space. Lemma 3 ([10]). Given two SLPs S and T of sizes n and m, respectively, the AP-table for S and T can be computed in O(nmh) time and O(nm) space, where h = height (S). Lemma 4 ([10], local search (LS)). Using AP-table for S and T that de- scribe strings p in s, we can compute, given any position b and constant α > 0, Occ(s, p) ∩ [b, b + αp] as a form of at most ⌈α⌉ arithmetic progressions in O(h) time, where h = height (S). Note that, given any 1 ≤ i ≤ j ≤ s, we are able to build an SLP of size O(n) that generates substring s[i..j] in O(n) time. Hence, by computing the AP-table for S and the new SLP, we can conduct the local search LS operation on substring s[i..j] in O(n2h) time. For any variable Xi of S and positions 1 ≤ k1, k2 ≤ Xi, we define the "right-right" longest common extension query by LCE(Xi, k1, k2) = lcp(Xi[k1..Xi], Xi[k2..Xi]). Using a technique of [15] in conjunction with Lemma 3, it is possible to answer the query in O(n2h) time for each pair of positions, with no pre-processing. We will later show our new algorithm which, after O(n2h)-time pre-processing, answers to the LCE query for any pair of positions in O(h log N ) time. 3 Finding runs In this section we propose an O(n3h)-time and O(n2)-space algorithm to com- pute O(n log N )-size representation of all runs in a text s of length N represented by SLP S = {Xi → expri }n i=1 of height h. For each production Xi → Xℓ(i)Xr(i) with i ≤ n, we consider the set Run ξ(Xi) of runs which touch or cross the boundary of Xi and are completed in Xi, i.e., those that are not prefixes nor suffixes of Xi. Formally, Run ξ(Xi) = {hb, e, ci ∈ Run(Xi) 1 ≤ b − 1 ≤ Xℓ(i) < e + 1 ≤ Xi}. 4 It is known that for any interval [b, e] with 1 ≤ b ≤ e ≤ s, there exists a unique occurrence of a variable Xi in the derivation tree of SLP, such that the interval [b, e] crosses the boundary of Xi. Also, wherever Xi appears in the derivation tree, the runs in Run ξ(Xi) occur in s with some appropriate offset, and these occurrences of the runs are never contained in Run ξ(Xj) with any other variable Xj with j 6= i. Hence, by computing Run ξ(Xi) for all variables Xi with i ≤ n, we can essentially compute all runs of s that are not prefixes nor suffixes of s. In order to detect prefix/suffix runs of s, it is sufficient to consider two auxiliary variables Xn+1 → X$Xn and Xn+2 → Xn+1X$′, where X$ and X$′ respectively derive special characters $ and $′ that are not in s and $ 6= $′. Hence, the problem of computing the runs from an SLP S reduces to computing Run ξ(Xi) for all variables Xi with i ≤ n + 2. Our algorithm is based on the divide-and-conquer method used in [3] and also [8], which detect squares crossing the boundary of each variable Xi. Roughly speaking, in order to detect such squares we take some substrings of val (Xi) as seeds each of which is in charge of distinct squares, and for each seed we detect squares by using LS and LCE constant times. There is a difference between [3] and [8] in how the seeds are taken, and ours is rather based on that in [3]. In the next subsection, we briefly describe our basic algorithm which runs in O(n3h log N ) time. 3.1 Basic algorithm Consider runs in Run ξ(Xi) with Xi → XℓXr. Since a run in Run ξ(Xi) contains a square which touches or crosses the boundary of Xi, our algorithm finds a run by first finding such a square, and then computing the maximal extension of its period to the left and right of its occurrence. We divide each square ww by its length and how it relates to the boundary of Xi. When w > 1, there exists 1 ≤ t < log val (Xi) such that 2t ≤ w < 2t+1 and there are four cases (see also Fig. 1); (1) wℓ ≥ 3 2 w > wℓ ≥ w, (3) w > wℓ ≥ 1 2 w > wℓ, where wℓ is a prefix of ww which is also a suffix of val (Xℓ). 2 w, (4) 1 2 w, (2) 3 The point is that in any case we can take a substring p of length 2t−1 of s which touches the boundary of Xi, and is completely contained in w. By using p as a seed we can detect runs by the following steps: Step 1: Conduct local search of p in an "appropriate range" of Xi, and find a copy p′ (= p) of p. Step 2: Compute the length plen of the longest common prefix to the right of p and p′, and the length slen of the longest common suffix to the left of p and p′, then check that plen + slen ≥ d − p, where d is the distance between the beginning positions of p and p′. Notice that Step 2 actually computes maximal extension of the repetition. Since d = w, it is sufficient to conduct local search in the range satisfying 2t ≤ d < 2t+1, namely, the width of the interval for local search is smaller than 5 Xi Xℓ Xr case (1) case (2) case (3) case (4) w p' w p' t-1 2 t-1 2 w p w p w p w p' w p w p' Fig. 1. The left arrows represent the longest common suffix between the left substrings immediately to the left of p and p′. The right arrows represent the longest common prefix between the substrings immediately to the right of p and p′. 2p, and all occurrences of p′ are represented by at most two arithmetic progres- sions. Although exponentially many runs can be represented by an arithmetic progression, its periodicity enables us to efficiently detect all of them, by using LCE only constant times, and they are encoded in O(1) space. We put the details in Appendix A since the employed techniques are essentially the same as in [8]. By varying t from 1 to log N , we can obtain an O(log N )-size compact rep- resentation of Run ξ(Xi) in O(n2h log N ) time. More precisely, we get a list of j=0 hδ1−cj, δ2+ cj, δ3 + cji for all elements of the list equals to Run ξ(Xi) without duplicates. By applying the above procedure to all the n variables, we can obtain an O(n log N )- size compact representation of all runs in s in O(n3h log N ) time. The total space requirement is O(n2), since we need O(n2) space at each step of the algorithm. In order to improve the running time of the algorithm to O(n3h), we will use O(log N ) quintuplets hδ1, δ2, δ3, c, ki such that the union of setsSk−1 new techniques of the two following subsections. 3.2 Longest common extension In this subsection we propose a more efficient algorithm for LCE queries. Lemma 5. We can pre-process an SLP S of size n and height h in O(n2h) time and O(n2) space, so that given any variable Xi and positions 1 ≤ k1, k2 ≤ Xi, LCE(Xi, k1, k2) is answered in O(h log N ) time. 6 To compute LCE(Xi, k1, k2) we will use the following function: For an SLP S = {Xi → expri}n i=1, let Match be a function such that Match(Xi, Xj, k) =(true false if k ∈ Occ(Xi, Xj), if k /∈ Occ(Xi, Xj). Lemma 6. We can pre-process a given SLP S of size n and height h in O(n2h) time and O(n2) space so that the query Match(Xi, Xj, k) is answered in O(log N ) time. Proof. We apply Lemma 2 to every variable Xi of S, so that the queries of Lemma 2 is answered in O(log N ) time on the derivation tree Ti of each variable Xi of S. Since there are n variables in S, this takes a total of O(n2) time and space. We also apply Lemma 3 to S, which takes O(n2h) time and O(n2) space. Hence the pre-processing takes a total of O(n2h) time and O(n2) space. To answer the query Match(Xi, Xj, k), we first find the node of Ti the interval [k, k + Xj − 1] crosses, its label Xq, and its position r in Ti. This takes O(log N ) time using Lemma 2. Then we check in O(1) time if (k − r) ∈ Occξ(Xq, Xj) or not, using the arithmetic progression stored in the AP-table. Thus the query is ⊓⊔ answered in O(log N ) time. The following function will also be used in our algorithm: Let FirstMismatch be a function such that FirstMismatch(Xi, Xj, k) =(lcp(Xi[k..Xi], Xj) undefined if Xi − k + 1 ≤ Xj, otherwise. Using Lemma 6 we can establish the following lemma. See Appendix B for a full proof. Lemma 7. We can pre-process a given SLP S of size n and height h in O(n2h) time and O(n2) space so that the query FirstMismatch(Xi, Xj, k) is answered in O(h log N ) time. We are ready to prove Lemma 5: Proof. Consider to compute LCE(Xi, k1, k2). Without loss of generality, assume k1 ≤ k2. Let z be the lca of the k1-th and (k2−k1+Xi)-th leaves of the derivation tree Ti. Let Pℓ be the path from z to the k1-th leaf of the derivation tree Ti, and let L be the list of the right child of the nodes in Pℓ sorted in increasing order of their position in Ti. The number of nodes in L is at most height (Xi) ≤ h, and L can be computed in O(height (Xi)) = O(h) time. Let Pr be the path from z to the (k2 −k1+Xi)-th leaf of the derivation tree Ti, and let R be the list of the left child of the nodes in Pr sorted in increasing order of their position in Ti. R can be computed in O(h) time as well. Let U = L∪R = {Xu(1), Xu(2), . . . , Xu(m)} be the list obtained by concatenating L and R. For each Xu(p) in increasing order q=1 Xu(q)) until of p = 1, 2, . . . , m, we perform query Match(Xi, Xu(p), k1 +Pp−1 7 either finding the first variable Xu(p′) for which the query returns false (see also Fig. 6 in Appendix C), or all the queries for p = 1, . . . , m have returned true. In the latter case, clearly LCE(Xi, k1, k2) = Xi − k1 + 1. In the former case, the first mismatch occurs between Xi and Xu(p′), and hence LCE(Xi, k1, k2) = Pp′−1 q′=1 Xu(q′) + FirstMismatch(Xi, Xu(p′), k1 +Pp′−1 Since U contains at most 2 · height (Xi) variables, we perform O(h) Match queries. We perform at most one FirstMismatch query. Thus, using Lemmas 6 and 7, we can compute LCE(Xi, k1, k2) in O(h log N ) time after O(n2h)-time O(n2)-space pre-processing. ⊓⊔ q′=1 Xu(q′)). We can use Lemma 5 to also compute "left-left", "left-right", and "right- left" longest common extensions on the uncompressed string s = val (S): We can compute in O(n) time an SLP S R of size n which represents the reversed string sR [14]. We then construct a new SLP S′ of size 2n and height h + 1 by concatenating the last variables of S and S R, and apply Lemma 5 to S′. 3.3 Approximate doubling Here we show how to reduce the number of AP-table computation required in Step 1 of the basic algorithm, from O(log N ) to O(1) times per variable. Consider any production Xi → XℓXr. If we build a new SLP which contains variables that derive the prefixes of length 2t of Xr for each 0 ≤ t < log Xr, we can obtain the AP-tables for Xi and all prefix seeds of Xr by computing the AP-table for Xi and the new SLP. Unfortunately, however, the size of such a new SLP can be as large as O(n log N ). Here we notice that the lengths of the seeds do not have to be exactly doublings, i.e., the basic algorithm of Section 3.1 works fine as long as the following properties are fulfilled: (a) the ratio of the lengths for each pair of consecutive seeds is constant; (b) the whole string is covered by the O(log N ) seeds 4. We show in the next lemma that we can build an approximate doubling SLP of size O(n). Lemma 8. Let S = {Xi → expr i}n i=1 be an SLP that derives a string s. We can build in O(n) time a new SLP S′ = {Yi → expr ′ i=1 with n′ = O(n) and height (S′) = O(height (S)), which derives s and contains O(log N ) variables Ya1 , Ya2, . . . , Yak satisfying the following conditions: i}n′ -- For any 1 ≤ j ≤ k, Yaj derives a prefix of s, Ya1 = 1 and Yak = s. -- For any 1 ≤ j < k, Yaj < Yaj+1 ≤ 2Yaj . Proof. First, we copy the productions of S into S′. Next we add productions needed for creating prefix variables Ya1 , Ya2, . . . , Yak in increasing order. We con- sider separating the derivation tree Tn of Xn into segments by a sequence of nodes v1, v2, . . . , vk such that the i-th segment enclosed by the path from vi to vi+1 represents the suffix of Yai+1 of length Yai+1 − Yai , namely, Yai+1 → Yai Ybi 4 A minor modification is that we conduct local search for a seed p at Step 1 with the range satisfying 2p ≤ d < 2q, where q is the next longer seed of p. 8 where Ybi is a variable for the i-th segment. Each node vi is called an l-node (resp. r-node) if the node belongs to the left (resp. right) segment of the node. We start from v1 which is the leftmost node that derives s[1]. Suppose we have built prefix variables up to Yai and now creating Yai+1. At this moment we are at vi. We move up to the node ui such that ui is the deepest node on the path from the root to vi which contains position 2Yai , and move down from ui towards position 2Yai. The traversal ends when we meet a node vi+1 which satisfies one of the following conditions; (1) the rightmost position of vi+1 is 2Yai, (2) vi+1 is labeled with Xj, and we have traversed another node labeled with Xj before. -- If Condition (1) holds, vi+1 is set to be an l-node. It is clear that the length of the i-th segment is exactly Yai and Yai+1 = 2Yai. -- If Condition (1) does not hold but Condition (2) holds, vi+1 is set to be an r-node. Since vi+1 contains position 2Yai, the length of the i-th segment is less than Yai and Yai+1 < 2Yai. We remark that since Xj appears in Yai+1 , then Yai+1+ Xj ≤ 2Yai+1 , and therefore, we never move down vi+1 for the segments to follow. We iterate the above procedures until we obtain a prefix variable Yak−1 that satisfies Xn ≤ 2Yak−1. We let uk be the deepest node on the path from the root to vk−1 which contains position s, and let vk be the right child of uk. Since Yai < 2Yai+2 for any 1 ≤ i < k, k = O(log N ) holds. We note that the i-th segment can be represented by the concatenation of "inner" nodes attached to the path from vi to vi+1, and hence, the number of new variables needed for representing the segment is bounded by the number of such nodes. Consider all the edges we have traversed in the derivation tree Tn of Xn. Each edge contributes to at most one new variable for some segment (see also Fig. 7 in Appendix C). Since each variable Xj is used constant times for moving down due to Condition (2), the number of the traversed edges as well as n′ is O(n). Also, it is easy to make the height of Ybi be O(height (S)) for any 1 ≤ i < k. Thus O(height (S′)) = O(log N + height (S)) = O(height (S)). ⊓⊔ 3.4 Improved algorithm Using Lemmas 5 and 8, we get the following theorem. Theorem 1. Given an SLP S of size n and height h that describes string s of length N , an O(n log N )-size compact representation of all runs in s can be computed in O(n3h) time and O(n2) working space. Proof. Using Lemma 5, we first pre-process S in O(n2h) time so that any "right- right" or "left-left" LCE query can be answered in O(h log N ) time. For each variable Xi → XℓXr, using Lemma 8, we build temporal SLPs T and T ′ which have respectively approximately doubling suffix variables of Xℓ and prefix vari- ables of Xr, and compute two AP-tables for S and each of them in O(n2h) time. For each of the O(log N ) prefix/suffix variables, we use it as a seed and find 9 Xi wR p w p g Xℓ w p' g w Xr wR p' g wR case (1) case (2) case (3) Fig. 2. Three groups of g-gapped palindromes to be found in Xi. all corresponding runs by using LS and LCE queries constant times. Hence the time complexity is O(n2h + n(n2h + (h + h log N ) log N )) = O(n3h). The space requirement is O(n2), the same as the basic algorithm. ⊓⊔ 4 Finding g-gapped palindromes A similar strategy to finding runs on SLPs can be used for computing a compact representation of the set gPals(s) of g-gapped palindromes from an SLP S that describes string s. As in the case of runs, we add two auxiliary variables Xn+1 → X$Xn and Xn+2 → Xn+1X$′ . For each production Xi → XℓXr with i ≤ n + 2, we consider the set gPals ξ(Xi) of g-gapped palindromes which touch or cross the boundary of Xi and are completed in Xi, i.e., those that are not prefixes nor suffixes of Xi. Formally, gPals ξ(Xi) = {hb, eig ∈ gPals(Xi) 1 ≤ b − 1 ≤ Xℓ < e + 1 ≤ Xi}. Each g-gapped palindrome in Xi can be divided into three groups (see also Fig. 2); (1) its right arm crosses or touches with its right end the boundary of Xi, (2) its left arm crosses or touches with its left end the boundary of Xi, (3) the others. For Case (3), for every Xℓ−g +1 ≤ j < Xℓ we check if lcp(Xi[1..j]R, Xi[j + g + 1..Xi]) > 0 or not. From Lemma 5, it can be done in O(gh log N ) time for any variable by using "left-right" LCE (excluding pre-processing time for LCE). Hence we can compute all such g-gapped palindromes for all productions in O(n2h + gnh log N ) time, and clearly they can be stored in O(ng) space. For Case (1), let wℓ be the prefix of the right arm which is also a suffix of val (Xℓ). We take approximately doubling suffixes of Xℓ as seeds. Let p be the longest seed that is contained in wℓ. We can find g-gapped palindromes by the following steps: 10 Step 1: Conduct local search of p′ = pR in an "appropriate range" of Xi and find it in the left arm of palindrome. Step 2: Compute "right-left" LCE of p′ and p, then check that the gap can be g. The outward maximal extension can be obtained by computing "left-right" LCE queries on the occurrences of p′ and p. As in the case of runs, for each seed, the length of the range where the local search is performed in Step 1 is only O(p). Hence, the occurrences of p′ can be represented by a constant number of arithmetic progressions. Also, we can obtain O(1)-space representation of g-gapped palindromes for each arithmetic progression representing overlapping occurrences of p′, by using a constant num- ber of LCE queries. Therefore, by processing O(log N ) seeds for every variable Xi, we can compute in O(n2h + n(n2h + (h + h log N ) log N )) = O(n3h) time an O(n log N )-size representation of all g-gapped palindromes for Case (1) in s. In a symmetric way of Case (1), we can find all g-gapped palindromes for Case (2). Putting all together, we get the following theorem. Theorem 2. Given an SLP of size n and height h that describes string s of length N , and non-negative integer g, an O(n log N + ng)-size compact represen- tation of all g-gapped palindromes in s can be computed in O(n3h + gnh log N ) time and O(n2) working space. 5 Discussions Let R and G denote the output compact representations of the runs and g-gapped palindromes of a given SLP S, respectively, and let R and G denote their size. Here we show an application of R and G; given any interval [b, e] in s, we can count the number of runs and gapped palindromes in s[b..e] in O(n + R) and O(n+G) time, respectively. We will describe only the case of runs, but a similar technique can be applied to gapped palindromes. As is described in Section 3.2, s[b..e] can be represented by a sequence U = (Xu(1), Xu(2), . . . , Xu(m)) of O(h) variables of S. Let T be the SLP obtained by concatenating the variables of U . There are three different types of runs in R: (1) runs that are completely within the subtree rooted at one of the nodes of U ; (2) runs that begin and end inside [b, e] and cross or touch any border between consecutive nodes of U ; (3) runs that begin and/or end outside [b, e]. Observe that the runs of types (2) and (3) cross or touch the boundary of one of the nodes in the path from the root to the b-th leaf of the derivation tree TS, or in the path from the root to the e-th leaf of TS. A run that begins outside [b, e] is counted only if the suffix of the run that intersects [b, e] has an exponent of at least 2. The symmetric variant applies to a run that ends outside [b, e]. Thus, the number of runs of types (2) and (3) can be counted in O(n + 2R) time. Since we can compute in a total of O(n) time the number of nodes in the derivation tree of T that are labeled by Xi for all variables Xi, the number of runs of type (1) for all variables Xu(j) can be counted in O(n + R) time. Noticing that runs are compact representation 11 of squares, we can also count the number of occurrences of all squares in s[b..e] in O(n + R) time by simple arithmetic operations. The approximate doubling and LCE algorithms of Section 3 can be used as basis of other efficient algorithms on SLPs. For example, using approximate doubling, we can reduce the number of pairs of variables for which the AP-table has to be computed in the algorithms of Lifshits [10], which compute compact representations of all periods and covers of a string given as an SLP. As a result, we improve the time complexities from O(n2h log N ) to O(n2h) for periods, and from O(n2h log2 N ) to O(nh(n + log2 N )) for covers. References 1. Apostolico, A., Breslauer, D.: An optimal O(log log N )-time parallel algorithm for detecting all squares in a string. SIAM Journal on Computing 25(6), 1318 -- 1331 (1996) 2. Apostolico, A., Breslauer, D., Galil, Z.: Parallel detection of all palindromes in a string. Theor. Comput. Sci. 141(1&2), 163 -- 173 (1995) 3. Bannai, H., Gagie, T., I, T., Inenaga, S., Landau, G.M., Lewenstein, M.: An efficient algorithm to test square-freeness of strings compressed by straight-line programs. Inf. Process. Lett. 112(19), 711 -- 714 (2012) 4. Bille, P., Landau, G.M., Raman, R., Sadakane, K., Satti, S.R., Weimann, O.: Ran- dom access to grammar-compressed strings. In: Proc. SODA 2011. pp. 373 -- 389 (2011) 5. Crochemore, M., Ilie, L., Rytter, W.: Repetitions in strings: Algorithms and com- binatorics. Theor. Comput. Sci. 410(50), 5227 -- 5235 (2009) 6. Crochemore, M., Rytter, W.: Efficient parallel algorithms to test square-freeness and factorize strings. Information Processing Letters 38(2), 57 -- 60 (1991) 7. Jansson, J., Peng, Z.: Online and dynamic recognition of squarefree strings. Inter- national Journal of Foundations of Computer Science 18(2), 401 -- 414 (2007) 8. Khvorost, L.: Computing all squares in compressed texts. In: Proceedings of the 2nd Russian Finnish Symposium on Discrete Mathemtics. vol. 17, pp. 116 -- 122 (2012) 9. Kolpakov, R.M., Kucherov, G.: Finding maximal repetitions in a word in linear time. In: FOCS. pp. 596 -- 604 (1999) 10. Lifshits, Y.: Processing compressed texts: A tractability border. In: Proc. CPM 2007. LNCS, vol. 4580, pp. 228 -- 240 (2007) 11. Main, M.G.: Detecting leftmost maximal periodicities. Discrete Applied Mathe- matics 25(1-2), 145 -- 153 (1989) 12. Main, M.G., Lorentz, R.J.: An O(n log n) algorithm for finding all repetitions in a string. Journal of Algorithms 5(3), 422 -- 432 (1984) 13. Manacher, G.K.: A new linear-time "on-line" algorithm for finding the smallest initial palindrome of a string. J. ACM 22(3), 346 -- 351 (1975) 14. Matsubara, W., Inenaga, S., Ishino, A., Shinohara, A., Nakamura, T., Hashimoto, K.: Efficient algorithms to compute compressed longest common substrings and compressed palindromes. Theoretical Computer Science 410(8 -- 10), 900 -- 913 (2009) 15. Miyazaki, M., Shinohara, A., Takeda, M.: An improved pattern matching algorithm for strings in terms of straight-line programs. In: Proceedings of the 8th Annual Symposium on Combinatorial Pattern Matching. pp. 1 -- 11 (1997) 12 Appendix A: Details of the algorithm to find runs In this section, we describe how we process occurrences of p′ at Step 2 of the basic algorithm. To handle occurrences of p′ that are represented by an arithmetic progression, we make use of its periodicity. For any string s and positive integer c ≤ s, let −→rep c(s) (resp. ←−rep c(s)) denote the length of the longest prefix (resp. suffix) of s having period c. Lemma 9. Let s, p ∈ Σ+ and {a0, a1, . . . , ak} be consecutive occurrences of p in s that form a single arithmetic progression with common difference c ≤ p. Let zj = s[aj + p..s] and z′ j = s[1..aj − 1] for any 0 ≤ j ≤ k. For any non-empty strings x, x′ ∈ Σ+, it holds that −→ β } −→ β + lcp(z0[ lcp(zj, x) =(min{−→α − cj, j, x′) =(min{←−α + cj, lcs(z′ −→ if −→α − cj 6= β , otherwise, and if ←−α + cj 6= otherwise, ←− β , −→ β + 1..x]) −→ β + 1..z0], x[ ←− β } 0[1..z′ −→ β = −→repc(px) − p, ←−α = ←−repc(z′ ←− β ], x′[1..x′ − ←− β ]) 0 − ←− β + lcs(z′ where −→α = −→rep c(pz0) − p, ←−rep c(x′p). Proof. Since −→rep c(pzj) = −→α − cj + p, both pzj and px have a prefix of length −→ min{−→α − cj, β , either pzj or −→ px has a prefix of length min{−→α − cj, β } + p + 1 with period c while the other −→ does not, and hence lcp(zj, x) = lcp(pzj, px) − p = min{−→α − cj, β }. Only when −→ the period breaks the periodicity, i.e., −→α −cj = β , lcp(zj, x) could expand. Note that such expansion occurs at most once. Similarly, since ←−rep c(z′ jp) = ←−α + cj we get the statement for lcs(z′ ⊓⊔ −→ β } + p with period c (see also Fig. 3). If −→α − cj 6= 0p) − p and ←− β = j, x′). a0 a1 a2 a3 a4 s a b b c a b c a b c a b c a b c a b c a b c a b c a c b a a b x c a b c a b c a c b a a c p0 c p1 α β β α c p2 p3 p4 x' a c c a b c a b c a b c s a b b c a b c a b c a b c a b c a b c a b c a b c a c b a a b Fig. 3. Illustration for Lemma 9. In the next lemma, we show how to handle one of the arithmetic progressions computed in Step 2 of Case (3). 13 Lemma 10. Let Xi → XℓXr be a production of an SLP of size n and p be the suffix of val (Xℓ) of length 2t−1. Let {a0, a1, . . . , ak} be consecutive occurrences of p′ in val (Xi) which form a single arithmetic progression, which are computed in Step 2 of Case (3). We can detect all runs corresponding to the occurrences of p′ by using LCE constant times. Also, such runs are represented in constant space. Proof. We apply Lemma 9 by letting s = val (Xi), x = val (Xr) and x′ = val (Xℓ)[1..val (Xℓ) − p]. First we compute −→α = lcp(pz0, p[c + 1..p]z0) + c − p, −→ β = lcp(px, p[c + 1..p]x) + c − p, ←−α = lcs(z′ 0p[1..p − c]) + c − p and ←− β = lcs(x′p, x′p[1..p − c]) + c − p by using lcp and lcs four times. 0p, z′ −→ β + ←−α ≥ a0 − 1 + c, the root of any repetition detected from aj is not Claim. If primitive. −→ β + ←−α ≥ a0 − 1 + c, pyp must have period c, where y is the Proof of Claim. If prefix of length a1 − 1 of x. Since pyp[c + 1..c + p] = p, yp − c is a period of yp. It follows from the periodicity lemma that py, as well as every aj + p − 1, is divisible by greatest common divisor of c and yp − c, and hence the root of ⊓⊔ any repetition detected from aj is not primitive. −→ β + ←−α < a0 − 1 + c. Let dj = aj − 1 + p = a0 − 1 + p + cj, and then we want to check if lcp(zj, x) + j, x′) − cj ≥ lcs(z′ a0 − 1. j, x′) ≥ dj − p = a0 − 1 + cj, or equivalently, lcp(zj, x) + lcs(z′ From the above claim, in what follows we assume that Let j′ = min{j ≥ 0 −→α − cj ≤ −→ β } and j′′ = min{j ≥ 0 ←−α + cj ≥ any 0 ≤ j < min{j′, j′′}, it follows from lcp(zj, x) = j, x′) − cj = that lcp(zj, x) + lcs(z′ −→ β +←−α ≥ a0−1, where δ1 = x′+1−←−α , δ2 = a0+p+ cj, δ3+cji appears iff and δ3 = a0 + p − 1 are constants. ←− β }. For j, x′) = ←−α + cj −→ β + ←−α , and hence a repetition hδ1 − cj, δ2 + −→ β −1 −→ β and lcs(z′ We show that the root of such repetition hδ1 − cj, δ2 + cj, δ3 + cji is primitive. Assume on the contrary that it is not primitive, namely, s′ = s[δ1 − cj..δ2 + cj] = uq with u ≤ (δ3 + cj)/2 and q ≥ 4. Evidently, −→rep c(s′) = j, x′) + p = −→ −→ β + ←−α + p + cj. It follows from a0 − 1 ≤ β + ←−α < a0 − 1 + c that δ3 + cj ≤ −→rep c(s′) < δ3 +cj +c < s′. Since 2u ≤ −→repc(s′) and c ≤ p ≤ (δ3 +cj)/2 ≤ δ3 + cj − u ≤ −→rep c(s′)− u, −→repc(s′[1..s′ − u) = −→repc(s′[u + 1..s′])+ u, however both s′[1..s′−u] and s′[u+1..s′] are uq−1, a contradiction. Therefore, for all 0 ≤ j < min{j′, j′′}, hδ1 − cj, δ2 + cj, δ3 + cji are runs, and they can be encoded by a quintuplet hδ1, δ2, δ3, c, min{j′, j′′}i. −→ β + lcs(z′ For any min{j′, j′′} ≤ j ≤ k except for j = j′ or j′′, lcp(zj, x)+lcs(z′ j, x′)−cj is monotonically decreasing by at least c and satisfies lcp(zj, x)+lcs(z′ j, x′)−cj < −→ β + ←−α − c < a0 − 1, and hence, no repetition appears. For j′ and j′′, we can check whether these two occurrences become runs or not by using LCE constant ⊓⊔ times. 14 Xi Xℓ Xr t-1 2 p p p p p β p0 c p1 α p4 p2 p3 β α c Illustration for Lemma 10. Four runs are found. Here j ′ = 3 and j ′′ = 2. Fig. 4. The runs from p0 and p1 are encoded by a quintuplet. For each j ′ and j ′′, the run is separately encoded by a quintuplet that shows a single run. The other cases can be processed in a similar way. A minor technicality is that we may redundantly find the same run in different cases. However, we can avoid duplicates by simply looking into the currently computed runs when we add new runs, spending O(log N ) time. Also, we can remove repetitions whose root are not primitive by just choosing the smallest period among the repetitions with the same interval. 15 Appendix B: Proof of Lemma 7 Proof. The outline of our algorithm to compute FirstMismatch follows [15] which used a slower algorithm for Match. Assume Xi − k + 1 ≤ Xj holds. If Xj → a with a ∈ Σ, then FirstMismatch(Xi, Xj, k) =(1 0 if Match(Xi, Xj, k) = true, if Match(Xi, Xj, k) = false. If Xj → Xℓ(j)Xr(j), then we can recursively compute FirstMismatch(Xi, Xj, k) as follows: FirstMismatch(Xi, Xj, k) =(FirstMismatch(Xi, Xr(j), k + Xℓ) FirstMismatch(Xi, Xℓ(j), k) if Match(Xi, Xℓ(j), k) = true, if Match(Xi, Xℓ(j), k) = false. (1) We apply Lemma 6 to S, pre-processing SLP S in O(n2h) time and O(n2) space, so that query Match(Xi, Xj ′ , k′) is answered in O(log N ) time for any vari- able Xj ′ and integer k′. Note that in either case of Equation 1, the height of the second variable decreases by 1. Hence we can compute FirstMismatch(Xi, Xj, k) in O(h log N ) time, after the O(n2h)-time O(n2)-space pre-processing. ⊓⊔ 16 Appendix C: Figures X8 X7 X7 X5 X6 X5 X6 X1 X3 X4 X3 X1 X3 X4 X3 X2 X2 X1 X2 X2 X2 X2 X2 X1 X2 X2 X2 a 1 b b 2 3 a 4 bb 65 b a b b a b b b 7 8 9 10 11 12 13 14 Fig. 5. The derivation tree of SLP S = {X1 → a, X2 → b, X3 → X2X2, X4 → X1X2, X5 → X1X3, X6 → X4X3, X7 → X5X6, X8 → X7X7 }, representing string s = abbabbbabbabbb. k1 k2 Xi Pl Z Xi a b Pr Fig. 6. Lemma 5: Illustration for computing LCE(Xi, k1, k2). The roots of the gray subtrees are labeled by the variables in U . We find the first variable Xu(p′) in the list U with which the Match query returns false. We then perform the FirstMismatch query for Xi and Xu(p′) using the appropriate offset. 17 v2 v1 v3 v4 v5 2Ya1 2Ya2 2Ya3 2Ya4 2Ya5 Ya1 Ya2 Ya3 Ya4 Ya5 Fig. 7. Lemma 8: Illustration for approximate doubling. The prefix variables up to Ya5 have been created. The traversals for v2, v3, v4 end due to Condition 1 and that for v5 ends due to Condition 2. Each traversed edge (depicted in bold) contributes to at most one new variable for some segment. Next, we will resume the traversal from v5 targeting position 2Ya5 , and iterate the procedure until we get the last variable Yak . The total number of bold edges can be bounded by O(n) thanks to Condition 2. 18
1908.06320
2
1908
2019-10-28T16:23:28
Revisiting the Graph Isomorphism Problem with Semidefinite Programming
[ "cs.DS", "cs.CC" ]
It is well-known that the graph isomorphism problem can be posed as an equivalent problem of determining whether an auxiliary graph structure contains a clique of specific order. However, the algorithms that have been developed so far for this problem are either not efficient or not exact. In this paper, we present a new algorithm which solves this equivalent formulation via semidefinite programming. Specifically, we show that the problem of determining whether the auxiliary graph contains a clique of specific order can be formulated as a semidefinite programming problem, and can thus be (almost exactly) solved in polynomial time. Furthermore, we show that we can determine if the graph contains such a clique by rounding the optimal solution to the nearest integer. Our algorithm provides a significant complexity result in graph isomorphism testing, and also represents the first use of semidefinite programming for solving this problem.
cs.DS
cs
Revisiting the Graph Isomorphism Problem with Semidefinite Programming Giannis Nikolentzos1 and Michalis Vazirgiannis1,2 2Athens University of Economics and Business, Greece 1 ´Ecole Polytechnique, France {nikolentzos,mvazirg}@aueb.gr preliminary version∗ October 28, 2019 Abstract It is well-known that the graph isomorphism problem can be posed as an equivalent problem of determining whether an auxiliary graph structure contains a clique of specific order. However, the algorithms that have been developed so far for this problem are either not efficient or not exact. In this paper, we present a new algorithm which solves this equiv- alent formulation via semidefinite programming. Specifically, we show that the problem of determining whether the auxiliary graph contains a clique of specific order can be formu- lated as a semidefinite programming problem, and can thus be (almost exactly) solved in polynomial time. Furthermore, we show that we can determine if the graph contains such a clique by rounding the optimal solution to the nearest integer. Our algorithm provides a significant complexity result in graph isomorphism testing, and also represents the first use of semidefinite programming for solving this problem. 1 Introduction Graph isomorphism is one of those few fundamental problems in NP whose computational status still remains unknown [1]. Roughly speaking, the graph isomorphism problem asks whether two graphs are structurally identical or not. The problem is clearly in NP. However, it has been neither proven NP-complete nor found to be solved by a polynomial time algorithm. In fact, there is strong evidence that graph isomorphism is not NP-complete since it has been shown that the problem is located in the low hierarchy of NP [2]. This implies that if the problem was NP-complete, then the polynomial time hierarchy would collapse to its second level. Over the years, algorithms of different nature have been developed to attack the problem. Traditionally, those that draw ideas from group theory turn out to be the most promising. One of these group-theoretic algorithms was proposed by Babai and Luks in 1983 [3]. The algorithm combines a preprocessing procedure proposed by Zemlyachenko et al. [4] with an efficient algorithm for solving graph isomorphism on graphs of bounded degree [5]. Its com- √ putational complexity is 2O( nlogn) where n denotes the number of vertices. Despite decades of active research, no progress had been achieved, and this was the best known algorithm un- til recently when Babai presented an algorithm that solves the graph isomorphism problem in ∗Note: this article has not been peer reviewed yet. 1 quasi-polynomial time [6]. It should be mentioned that while the complexity status of the graph isomorphism for general graphs remains a mystery, for many restricted graph classes, polyno- mial time algorithms are known. This is, for example, the case for planar graphs [7], graphs of bounded degree [5], or graphs with bounded eigenvalue multiplicity [8]. It should also be noted that there exist several algorithms which have proven very efficient for graphs of practical interest [9, 10, 11]. Interestingly, these algorithms are very different from the ones that offer the lowest worst case complexities. This indicates that there is a wide gap between theory and practice. Besides the above algorithms, there are also several scalable heuristics for graph isomorphism which are based on continuous optimization. In these heuristics, the discrete search problem in the space of permutation matrices is replaced by an optimization problem with continuous variables, enabling the use of efficient continuous optimization algorithms. Formally, for any two graphs on n vertices with respective n× n adjacency matrices A1 and A2, the optimization problem consists in minimizing the function A1 − P A2P (cid:62)F over all P ∈ Π, where Π denotes the set of n× n permutation matrices, and ·F is the Froebenius matrix norm [12]. Therefore, the problem of graph isomorphism can be reformulated as the problem of minimizing the above function over the set of permutation matrices. The two graphs are isomorphic to each other if there exists a permutation matrix P for which the above function is equal to 0. Note also that other objectives have also been proposed in the literature, this being perhaps the most common. This problem has a combinatorial nature and there is no known polynomial algorithm to solve it. Numerous approximate methods have been developed. Most of these methods replace the space of permutations by the space of doubly-stochastic matrices. Let D denote the set of n× n doubly stochastic matrices, i. e., nonnegative matrices with row and column sums each equal to F over all D ∈ D. There 1. The convex relaxed problem minimizes the function A − DAD(cid:62)2 is a polynomial-time algorithm for exactly solving the convex relaxed graph matching problem [13]. However, due to relaxation, even if there exists a doubly stochastic matrix D for which the objective function is equal to 0, there is no guarantee that the two graphs are isomorphic to each other. The main contribution of this work is a novel algorithm which attacks efficiently the problem of graph isomorphism. The main tools employed are a compatibility graph, i. e., an auxiliary graph structure that is useful for solving general graph and subgraph isomorphism problems, and a semidefinite programming formulation. Given two graphs of order n, we build their com- patibility graph of order n2. We show that testing the two graphs for isomorphism is equivalent to determining whether the compatibility graph contains a clique of order n. We show that this problem can be formulated as a semidefinite programming optimization problem, and can thus be (almost exactly) solved in polynomial time with readily available solvers. We show that the two graphs are isomorphic to each other if the optimal value of the semidefinite program is arbitrarily close to n(n − 1). Our algorithm demonstrates the usefulness of semidefinite pro- gramming in combinatorial optimization, and provides a significant complexity result in graph isomorphism testing. It should be mentioned that our work is not the first to apply continuous optimization approaches to the problem of determining whether the compatibility graph con- tains a clique of order n. In a previous study, Pelillo developed a heuristic for computing the clique number of the compatibility graph [14]. However, in contrast to the proposed algorithm, this method provides no guarantees, and may get stuck on some local optimum of the objective function. 2 2 Preliminaries In this Section, we first define our notation, and we then introduce the concept of a compatibility graph. We show that the graph isomorphism problem is equivalent to finding if the compatibility graph contains a clique of specific size. We also present the basic concepts of semidefinite programming and an algorithm which is based on Lov´asz ϑ number and for almost all classes of graphs can decide if two instances are isomorphic to each other. 2.1 Graph Theory Notation and Terminology Let G = (V, E) be an undirected and unweighted graph consisting of a set V of vertices and a set E of edges between them. We will denote by n the number of vertices. The adjacency matrix of G is a symmetric matrix A ∈ Rn×n defined as follows: Ai,j = 1 if (i, j) ∈ E, and 0 otherwise. Note that since the graph is undirected, (i, j) ∈ E if and only if (j, i) ∈ E, for all ∼= G2), if i, j ∈ V . Two graphs G1 = (V1, E1) and G2 = (V2, E2) are isomorphic (denoted by G1 there is a bijective mapping φ : V1 → V2 such that (vi, vj) ∈ E1 if and only if (φ(vi), φ(vj)) ∈ E2. We next present the notion of a compatibility graph, i. e., a structure that is very useful for solving graph/subgraph isomorphism and maximum common subgraph problems. These auxiliary graph structures have been proposed independently by several authors [15, 16, 17], while they also lie at the core of several algorithms [14, 18, 19]. Furthermore, different authors have used different names to describe them. For instance, compatibility graphs, association graphs, derived graphs, M-graphs, and product graphs are all names that have been coined to describe these structures. In what follows, we will use the name compatibility graph to refer to them. Formally, given two graphs G1 = (V1, E1) and G2 = (V2, E2), their compatibility graph Gc = (Vc, Ec) is a graph with vertex set Vc = V1 × V2. An edge is drawn between two vertices (v1, u1), (v2, u2) ∈ Vc if and only if v1 (cid:54)= v2, u1 (cid:54)= u2 and either e1 = (v1, v2) ∈ E1 and e2 = (u1, u2) ∈ E2 or e1 (cid:54)∈ E1 and e2 (cid:54)∈ E2. Clearly, there are two types of edges in a compatibility graph: (1) edges that represent common adjacency, and (2) edges that represent common non-adjacency. An example of the compatibility graph that emerges from two P3 graphs is illustrated in Figure 1. Levi established a relation between isomorphic subgraphs of two graphs and cliques in their compatibility graph [15]. Specifically, if some vertices (v1, u1), (v2, u2), . . . , (vk, uk) ∈ Vc form a clique, and are thus pairwise adjacent, then the subgraph in G1 induced by the vertices v1, v2, . . . , vk is isomorphic to the subgraph in G2 induced by the vertices u1, u2, . . . , uk. The isomorphism is given by the vertices (v1, u1), (v2, u2), . . . , (vk, uk) ∈ Vc of the compatibility graph that form the clique, i. e., φ(u1) = v1, φ(u2) = v2, . . . , φ(uk) = vk. The next Theorem establishes an equivalence between the graph isomorphism problem and the maximum clique problem on the compatibility graph, and corresponds to a sub-instance of Levi's result. For completeness, we also provide the proof. Note that if G1 and G2 are two graphs of order n, the maximum clique of their compatibility graph will consist of at most n vertices. Theorem 1. Let G1 and G2 be two graphs of order n, and let Gc be their compatibility graph. Then, G1 and G2 are isomorphic if and only if Gc contains a clique of order n, i. e., ω(Gc) = n. Proof. If G1 = (V1, E1) and G2 = (V2, E2) are isomorphic, then there exists a bijective mapping φ : V1 → V2 such that (vi, vj) ∈ E1 if and only if (φ(vi), φ(vj)) ∈ E2. Then, by construction, there are n vertices (v1, φ(v1)), . . . , (vn, φ(vn)) ∈ Vc which are connected to each other by an edge, i. e.,(cid:0)(v1, φ(v1)), (v2, φ(v2))(cid:1), . . .,(cid:0)(vn−1, φ(vn−1)), (vn, φ(vn))(cid:1) ∈ Ec. These vertices form a clique of order n, and therefore, ω(Gc) = n. For the second part, given a compatibility graph Gc that contains a clique of order n, let (v1, u1), . . . , (vn, un) ∈ Vc denote the n vertices that 3 Figure 1: Two graphs (top left and right) and their compatibility graph (bottom). a bijective mapping φ : V1 → V2 as follows: φ(vi) = ui. Since(cid:0)(vi, φ(vi)), (vj, φ(vj))(cid:1) ∈ Ec for form the clique. By definition, V1 = {v1, . . . , vn} and V2 = {u1, . . . , un}. Then, we can construct i ∈ {0, . . . , n}, we have that (vi, vj) ∈ E1 if and only if (φ(vi), φ(vj)) ∈ E2. Therefore, G1 and G2 are isomorphic to each other. Note that the number of isomorphisms between two graphs can be exponential to the number of vertices of the graphs n. Specifically, if G1 and G2 are isomorphic, then the number of automorphisms of G1 (or of G2) is equal to the number of isomorphisms from G1 to G2. Hence, if, for instance, G1 and G2 are complete graphs on n vertices, i. e., both correspond to the complete graph Kn, then the number of isomorphisms between the two graphs is equal to n! since Aut(G1) = Aut(G2) = Aut(Kn) = n!. Each isomorphism φ : V → V (cid:48) corresponds to an n-clique in the compatibility graph. Therefore, the compatibility graph can contain up to n! cliques. As an example, consider the graphs shown in Figure 1. There are two isomorphisms between G1 and G2. Hence, their compatibility graph contains exactly two cliques of order 3. We now introduce the following Lemma which we will use in the next Section. Lemma 1. Let G1 and G2 be two graphs of order n, and let Gc be their compatibility graph. Then, the vertices of Gc can be grouped into n partitions such that there are no edges between vertices that belong to the same partition. compatibility graph Gc, and (a, b), (c, d) ∈ Vc. Then, by definition, if a = c,(cid:0)(a, b), (c, d)(cid:1) (cid:54)∈ Ec. Proof. Let V1 and V2 denote the sets of vertices of G1 and G2, respectively. Then, V1 = {v1, . . . , vn} and V2 = {u1, . . . , un}. Let also Vc and Ec denote the set of vertices and edges of the The set of nodes Vc can be decomposed into the following n disjoint sets: P1 = {(v1, u1), (v1, u2), . . . , (v1, un)}, P2 = {(v2, u1), (v2, u2), . . . , (v2, un)}, . . ., Pn = {(vn, u1), (vn, u2), . . . , (vn, un)}. 4 123(1,a)(1,b)(1,c)GcG1G2abc(2,a)(2,b)(2,c)(3,a)(3,b)(3,c) Then, Vc = P1 ∪ P2 ∪ . . . ∪ Pn. Clearly, there is no edge between each pair of vertices of each partition. This concludes the proof. 2.2 Semidefinite Programming A semidefinite program (SDP) is the problem of optimizing a linear function over the intersection of the cone of positive semidefinite matrices with an affine space. Semidefinite programming has attracted a lot of attention in recent years since many practical problems in operations research and combinatorial optimization can be modeled or approximated as semidefinite pro- gramming problems. For instance, in control theory, SDPs are used in the context of linear matrix inequalities. In graph theory, the problem of computing the Lov´asz number of a graph can be formulated as a semidefinite program. Given any  > 0, semidefinite programs can be solved within an additive error of  in polynomial time. There are several different algorithms for solving SDPs. For instance, this can be done through the ellipsoid algorithm [20] or through interior-point methods [21]. 2.3 An Algorithm for Almost all Classes of Graphs It follows from Lemma 1 that the set of vertices Vc of a compatibility graph can be decomposed into n disjoint sets P1, P2, . . . , Pn such that there is no edge that connects vertices of the same set. Since a compatibility graph can be decomposed into n disjoint sets such that every edge e ∈ Ec connects a vertex in Pi to one in Pj with i (cid:54)= j, the minimum number of colors required for a proper coloring of Gc is no more than n. Therefore, χ(Gc) ≤ n. For an arbitrary graph G, it is well-known that ω(G) ≤ χ(G). Therefore, a compatibility graph can contain a clique of order n only if χ(Gc) = n. Computing the chromatic number of a graph is in general an NP-complete problem. However, we can compute in polynomial time a real number ϑ( ¯G) that is "sandwiched" between the clique number and the chromatic number of a graph G, that is ω(G) ≤ ϑ( ¯G) ≤ χ(G) [22]. This number is known as the Lov´asz number of G. Again, a compatibility graph can contain a clique of order n only if ϑ( ¯Gc) = χ(Gc) = n. However, the fact that ϑ( ¯Gc) = χ(Gc) = n does not imply that ω(G) = n. Instead, it may hold that ω(Gc) < ϑ( ¯Gc) = χ(Gc) = n. One class of graphs for which the above holds is the family of latin square graphs. Although for the class of compatibility graphs, it may hold that ω(G) = n whenever ϑ( ¯G) = χ(G) = n, we do not study this any further, but we leave it as future work. 3 The Main Result Next, we give a SDP based solution for the graph isomorphism problem. We show that the problem of identifying whether a compatibility graph contains a clique of order n can be ex- pressed as a SDP. For the ease of presentation, we start with a simple formulation where we assume that the rank of the matrix involved in the objective function of the SDP is 1. Unfor- tunately, this constraint is not convex, and renders the problem NP-hard. We then drop the rank constraint, and show that the emerging SDP can successfully deal with the general case. 3.1 Rank-1 Case Define a variable xi for every vertex i ∈ Vc, and let X = xx(cid:62). Let also m = n2. Then, we have that: X = xx(cid:62) ⇔ X ∈ Sm, X (cid:23) 0, rank(X) = 1 5 where Sm is the set of all m × m real symmetric matrices and X (cid:23) 0 means that the matrix variable X is positive semidefinite. Let also J denote the m × m matrix of ones. Consider now the following optimization problem: maximize X subject to trace(JX) trace(X) = n, Xi,j = 0, (i, j) (cid:54)∈ Ec, Xi,j ≤ 1, (i, j) ∈ Ec, X (cid:23) 0, rank(X) = 1. (1a) (1b) (1c) (1d) (1e) (1f) We can determine if there is a clique of order n in Gc by solving the above optimization problem. Specifically, if there exists such a clique in Gc, the value of the optimal solution to the problem is equal to n2. Lemma 2. The value of problem (1) is no greater than n2. Proof. The value of the objective function of the optimization problem is: trace(JX) = Ji,jXi,j = J1,1 X1,1 + . . . + Jm,m Xm,m i=1 j=1 = x1x1 + . . . + xmxm From constraint (1b), it follows that the sum of the diagonal terms of matrix X is equal to n, i. e., x1x1 + x2x2 + . . . + xmxm = n. We next replace these terms with their sum. Therefore, the objective function of the optimization problem becomes: m(cid:88) m(cid:88) m(cid:88) m(cid:88) i=1 j=1 trace(JX) = Ji,jXi,j = n + x1x2 + . . . + xmxm−1 We will next show that in our setting, we can have at most n vertices for which xi (cid:54)= 0. It follows from the constraint (1c) that ∀(i, j) (cid:54)∈ Ec, Xi,j = xixj = 0. Therefore, ∀(i, j) (cid:54)∈ Ec, one of the following three conditions holds: (1) xi = 0, xj (cid:54)= 0, (2) xi (cid:54)= 0, xj = 0, (3) xi = 0, xj = 0. It follows also from Lemma 1 that the vertices of Gc can be grouped into n partitions such that the n vertices that belong to each partition are not connected by an edge. Therefore, there can be at most one vertex i from each partition for which xi (cid:54)= 0. It thus turns out that we can have at most n vertices for which xi (cid:54)= 0. From these n vertices, we can obtain n(n − 1) (ordered) pairs of vertices. For each pair, Xi,j = xixj ≤ 1 holds. Therefore, it follows that: m(cid:88) m(cid:88) trace(JX) = Ji,jXi,j ≤ n + n(n − 1) = n2 This proves the Lemma. i=1 j=1 Theorem 2. If Gc contains a clique of order n, problem (1) can attain its largest possible value. Proof. Let us assume that Gc contains a clique of order n, and let S be the set of vertices that form the n-clique. We set xi = 1 for i ∈ S, and xj = 0 for j ∈ Vc \ S. Clearly, since Ji,j = 1 for 6 each i, j ∈ S, there are n(n − 1) (ordered) pairs of vertices, and for each of those pairs, we have that xixj = 1. Therefore, the objective value of problem (1) is equal to: trace(JX) = n + n(n − 1) = n2 By Lemma 2, the objective value is equal to the largest possible value of problem (1). Further- more, all the constraints hold. Specifically, trace(X) = S = n, and Xi,j (cid:54)= 0 only if i, j ∈ S (with i (cid:54)= j). Moreover, since matrix X corresponds to the outer product of a vector and itself, it is symmetric, positive semidefinite and of rank 1. Theorem 3. If Gc contains no clique of order n, the optimal solution of problem (1) takes some value no greater than n + (n − 1)(n − 2). Proof. As described above, Lemma 1 implies that we can have at most n vertices for which x (cid:54)= 0. Furthermore, since Gc does not contain any n-clique, for each subset of vertices S ⊂ Vc with S = n, there is at least one pair of vertices i, j for which (i, j) (cid:54)∈ Ec. Then, to satisfy the condition that Xi,j = 0 if (i, j) (cid:54)∈ Ec, either xi = 0 or xj = 0. Hence, there can be at most n− 1 vertices for which x (cid:54)= 0. Then, the objective value of the problem is equal to: trace(JX) = x1x1 + . . . + xmxm = n + x1x2 + . . . + xmxm−1 ≤ n + (n − 1)(n − 2) < n2 The first inequality follows from the fact that xixj ≤ 1 for any i, j with i (cid:54)= j (from con- straint (1d)), and as mentioned above there are at most n − 1 vertices for which x (cid:54)= 0. 3.2 General Case Rank constraints in semidefinite programs are usually hard. Specifically, it turns out that problem (1) is a nonconvex problem in X ∈ Sm. If we simply drop the rank constraint, we obtain the following relaxation: trace(JX) maximize X subject to trace(X) = n, Xi,j = 0, (i, j) (cid:54)∈ Ec, Xi,j ≤ 1, (i, j) ∈ Ec, X (cid:23) 0. (2a) (2b) (2c) (2d) (2e) which is a semidefinite program in X ∈ Sm. Clearly, the optimal value of problem (2) is an upper bound of the optimal value of problem (1). We will next show that in case Gc contains one or more cliques of order n, then the optimal value of problem (2) is equal to the optimal value of problem (1) (i. e., equal to n2). Furthermore, we will show that if Gc contains no cliques, then the optimal value of the problem is not greater than n(n − 1). Let vi ∈ Rd be the vector representation of vertex i ∈ Vc, and U = [v1, . . . , vm](cid:62) ∈ Rm×d a matrix whose ith row contains the vector representation of vertex i ∈ Vc. Then, X = U U(cid:62). Lemma 3. The value of problem (2) is no greater than n2. 7 m(cid:88) m(cid:88) m(cid:88) m(cid:88) trace(JX) = Ji,jXi,j = J1,1 X1,1 + . . . + Jm,m Xm,m i=1 j=1 = (cid:104)v1, v1(cid:105) + . . . + (cid:104)vm, vm(cid:105) From constraint (2b), it follows that the sum of the diagonal terms of matrix X is equal to n, i. e., (cid:104)v1, v1(cid:105) + (cid:104)v2, v2(cid:105) + . . . + (cid:104)vm, vm(cid:105) = n. We next replace these terms with their sum. Therefore, the objective function of the optimization problem becomes: trace(JX) = Ji,jXi,j = n + (cid:104)v1, v2(cid:105) + . . . + (cid:104)vm, vm−1(cid:105) (3) i=1 j=1 From Lemma 1, it follows that the set of vertices Vc can be decomposed into n disjoint sets P1, P2, . . . , Pn such that there is no edge that connects vertices of the same set. Then, from constraint (2c), it follows that the vector representations of vertices that belong to the same partition are pairwise orthogonal. Let v1, v2, . . . , vn denote the vector representations of the vertices that belong to partition P1, vn+1, vn+2, . . . , v2n denote the representations of the vertices that belong to partition P2, and so on. Let w1, w2, . . . , wn be the sum of the representations of the vertices that belong to partitions P1, P2, . . . , Pn, respectively. Then, w1 = v1 + v2 + . . . + vn, w2 = vn+1 + vn+2 + . . . + v2n, and so on. Given two partitions (e. g., partitions P1 and P2), the sum of the inner products of all pairs of vectors is equal to: (cid:104)w1, w2(cid:105) = (cid:104)v1 + v2 + . . . + vn, vn+1 + vn+2 + . . . + v2n(cid:105) From the Cauchy-Schwarz inequality, it is known that (cid:104)v, u(cid:105) ≤(cid:112)(cid:104)v, v(cid:105)(cid:104)u, u(cid:105). Hence, fow two = (cid:104)v1, vn+1(cid:105) + (cid:104)v1, vn+2(cid:105) + . . . + (cid:104)vn, v2n(cid:105) (4) Proof. The objective value of problem (2) is equal to: partitions (e. g., partitions P1 and P2), we have that: (cid:104)w1, w2(cid:105) ≤(cid:112)(cid:104)w1, w1(cid:105)(cid:104)w2, w2(cid:105) (cid:112)w12w22 = (5) Now, since the inner product of each pair of vectors of a partition is equal to 0, for each partition (e. g., partition P1), we have that: w12 = (cid:104)w1, w1(cid:105) = (cid:104)v1 + . . . + vn, v1 + . . . + vn(cid:105) = (cid:104)v1, v1(cid:105) + . . . + (cid:104)vn, vn(cid:105) Therefore, from constraint (2b), it follows that: w12 + . . . + wn2 = n (6) 8 Now, from Equation (3), we have: trace(JX) = n + (cid:104)v1, v2(cid:105) + . . . + (cid:104)vm, vm−1(cid:105) = n + (cid:104)w1, w2(cid:105) + . . . + (cid:104)wn, wn−1(cid:105) ≤ n + ≤ n + (cid:112)w12w22 + . . . + + . . . + (cid:112)wn2wn−12 2 2 2 wn2wn−12 w12 + w22 (n − 1)w12 + (w22 + . . . + wn2) (n − 1)w12 + (n − w12) (n − 2)w12 + n 2 (n − 2)(w12 + . . . + wn2) + n2 (n − 2)n + n2 2 2n2 − 2n + . . . + + . . . + 2 2 2 2 = n + = n + = n + = n + = n + = n + = n2 (n − 1)wn2 + (w12 + . . . + wn−12) + . . . + (n − 1)wn2 + (n − wn2) 2 (n − 2)wn2 + n 2 The second equality follows from Equation (4), and the first inequality from Equation (5). The last inequality follows from the well-know inequality of arithmetic and geometric means, while the fourth equality follows from Equation (6). Clearly, a solution to problem (1) is also a solution to problem (2). Hence, if the compatibility graph Gc contains a clique of order n, the rank-1 solution that was presented above is also an optimal solution in this case. However, if Gc contains multiple cliques of order n, there is an optimal solution of higher rank as shown below. Theorem 4. If Gc contains d cliques of order n, we can construct an optimal solution to problem (2) as follows: We assign a vector vi ∈ Rd to each vertex i ∈ Vc. We consider a feaure space with a feature corresponding to each one of the d cliques. If vertex i participates in the jth clique, then the jth component of vi is set equal to 1√ Proof. If vertices i, j ∈ Vc participate in all d cliques of Gc, then (cid:104)vi, vj(cid:105) = 1. Otherwise, (cid:104)vi, vj(cid:105) < 1. From the above, it is clear that Xi,j ≤ 1, ∀(i, j) ∈ Ec. If a vertex i participates in no clique, then vi is a zero vector, and (cid:104)vi, vj(cid:105) = 0, ∀j ∈ Vc. Furthermore, if two vertices i and j participate in one or more cliques, but (i, j) (cid:54)∈ Ec, then the two vertices participate in different cliques and they have no common components taking nonzero values, and thus (cid:104)vi, vj(cid:105) = 0. Therefore, Xi,j = 0, ∀(i, j) (cid:54)∈ Ec. Furthermore, we have that: . d trace(X) = (cid:104)v1, v1(cid:105) + . . . + (cid:104)vm, vm(cid:105) = 1vi 1 + . . . + vi mvi m (cid:0)vi d(cid:88) i=1 (cid:1) where vi denotes the ith component of vector v. Since each clique contains n vertices, there are n vectors whose ith component is nonzero and equal to 1√ d . Hence, it follows that: trace(X) = n 1 d = n d(cid:88) i=1 9  1 1 1 1 1 1 1 1 1 JX = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1  1 1 1 1 1 1 1 1 1  0 0 0 0 0 0 0 0 0 0 1/2 0 1/2 0 0 0 0 1/2 0 0 1/2 1/2 0 0 0 1/2 0 0 1/2 1/2 1 0 0 0 1/2 1/2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1/2 1/2 0 0 0 1/2 0 trace(JX) = 9  0 1/2 0 1/2 0 0 0 0 1/2 =  0 0 0 0 0 0 0 0 0 3/2 3/2 3/2 3/2 3/2 3/2 3/2 3/2 3/2 3/2 3/2 3/2 3/2 3/2 3/2 3/2 3/2 3/2 3 3 3 3 3 3 3 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3/2 3/2 3/2 3/2 3/2 3/2 3/2 3/2 3/2  3/2 3/2 3/2 3/2 3/2 3/2 3/2 3/2 3/2 Figure 2: An optimal solution for the compatibility graph of Figure 1 (top). There are two cliques of order 3 in this graph. Therefore, we assign a 2-dimensional vector to each vertex. Objective value of the constructed solution (bottom). The i, jth component of matrix X corre- sponds to the inner product of the representations of vertices i and j. Hence, all the constraints are satisfied. The objective value of the solution is equal to: trace(JX) = Ji,jXi,j = J1,1 (cid:104)v1, v1(cid:105) + . . . + Jm,m (cid:104)vm, vm(cid:105) m(cid:88) m(cid:88) i=1 j=1 = n + (cid:0)vi d(cid:88) i=1 (cid:1) 1vi 2 + . . . + vi mvi m−1 Since each clique contains n vertices, there are n(n − 1) pairs of vertices i, j ∈ Vc such that (i, j) ∈ Ec. Furthermore, since these vertices participate in a clique, their component that corresponds to that clique is equal to 1√ , and therefore, the product of these components is d equal to 1 d . Since there are n(n − 1) such pairs for each clique, it follows that: d(cid:88) trace(JX) = n + n(n − 1) 1 d = n + n(n − 1) = n2 This concludes the proof. i=1 Fugure 2 illustrates how an optimal solution is constructed for the compatibility graph of Figure 1. There are two cliques of order 3 in this graph. Therefore, we assign a 2-dimensional vector to each of its vertices. 10 (1,a)(1,b)(1,c)Gc(2,a)(2,b)(2,c)(3,a)(3,b)(3,c)[1√2,1√2][0,0][0,0][1√2,0][0,1√2][0,0][0,0][0,1√2][1√2,0] Theorem 5. If Gc contains no clique of order n, the optimal solution of problem (2) takes some value no greater than n(n − 1). Proof. From the Cauchy-Schwarz inequality, it is known that (cid:104)v, u(cid:105) ≤(cid:112)(cid:104)v, v(cid:105)(cid:104)u, u(cid:105). Further- more, for nonzero vectors, equality holds if and only if v and u are linearly dependent (i. e., either v is a multiple of u or the opposite). As shown above, by applying the Cauchy-Schwarz inequality, we obtain: trace(JX) = n + (cid:104)v1, v2(cid:105) + . . . + (cid:104)vm, vm−1(cid:105) = n + (cid:104)w1, w2(cid:105) + . . . + (cid:104)wn, wn−1(cid:105) ≤ n + (cid:112)w12w22 + . . . + (cid:112)wn2wn−12 Equality (between the last two quantities) holds if and only if the n vectors w1, w2, . . . , wn are pairwise linearly dependent. Let us assume that these vectors are pairwise linearly dependent. Then, without loss of generality, let us also assume that the ith component of the first vector w1 is nonzero. Since the vectors are linearly dependent, then the ith component of all the other vectors w2, . . . , wn is also nonzero. Since each vector is equal to the sum of orthogonal vectors (sum of representations of vertices of each partition), for all n partitions there exists some vector (corresponding to some vertex of that partition) whose ith component is nonzero. Then, there exist n vectors whose ith component is nonzero, and hence the inner product of every pair of these vectors is nonzero. That means that every pair of these vertices is connected by an edge (from constraints (2c) and (2d)). Hence, these vertices form a clique of order n. We have reached a contradiction since Gc does not contain a clique of order n. Therefore, the objective function is: (cid:112)w12w22 + . . . + trace(JX) = n + (cid:104)v1, v2(cid:105) + . . . + (cid:104)vm, vm−1(cid:105) = n + (cid:104)w1, w2(cid:105) + . . . + (cid:104)wn, wn−1(cid:105) < n + ≤ n + = n2 w12 + w22 + . . . + 2 (cid:112)wn2wn−12 wn2wn−12 2 We will now establish an upper bound on the value of the objective function. We have that: trace(JX) = n + (cid:104)v1, v2(cid:105) + . . . + (cid:104)vm, vm−1(cid:105) = n + (cid:104)w1, w2(cid:105) + . . . + (cid:104)wn, wn−1(cid:105) = n + 1wi 2 + . . . + wi nwi n−1 (cid:0)wi d(cid:88) i=1 where wi denotes the ith component of vector w. We also have that: trace(X) = (cid:104)v1, v1(cid:105) + (cid:104)v2, v2(cid:105) + . . . + (cid:104)vm, vm(cid:105) = (cid:104)w1, w1(cid:105) + (cid:104)w2, w2(cid:105) + . . . + (cid:104)wn, wn(cid:105) d(cid:88) (cid:0)wi = 1wi 1 + wi 2wi 2 + . . . + wi nwi n (cid:1) (cid:1) = n Since Gc contains no cliques of order n, for each component i of w1, w2, . . . , wn, at most n − 1 out of these n vectors can have a nonzero value. Hence, for each i ∈ {1, 2, . . . , d}, at least one i=1 11 (7) of the following n components wi (n − 1)(n − 2) of the terms of the following summation are nonzero: 2, . . . , wi 1, wi n is equal to zero. Therefore, for each i, at most (cid:1) 1wi 2 + . . . + wi nwi n−1 (cid:0)wi d(cid:88) d(cid:88) i=1 zi (8) trace(JX) = n + = n + where zi denotes the contribution of the ith component to the above summation, i. e., zi = wi j is equal to zero. Then, we have that: n−1. Let us assume that for a given i, wi 2 + . . . + wi nwi 1wi i=1 1wi 1wi 1wi zi = wi = wi ≤ wi wi jwi 1wi 2 + . . . + wi 2 + . . . + wi 1 + wi 2wi 2 2 jwi n + . . . + wi 1 + . . . + wi 1wi j−1 + wi j+1 + . . . + wi 1 + wi wi 1wi 2 nwi wi j−1wi j−1 + nwi j−1wi wi j+1wi j+1wi n−1 n + wi 1 + wi 1wi 2 nwi wi j−1wi j−1 + . . . + j+1 + wi 1wi 1 + . . . + n + wi 2 + j+1wi j+1 n + wi 2 + . . . + 1 + . . . + wi j+1 + . . . + j−1 + wi nwi wi j−1wi nwi j−1 + wi nwi n j+1 + . . . + wi nwi n−1 + j+1wi = (n − 2)(wi = (n − 2)(wi 2 1wi 1wi 1 + . . . + wi 1 + . . . + wi j−1wi jwi j−1 + wi j + . . . + wi j+1wi j+1 + . . . + wi nwi n) nwi n) 2 nwi wi n−1wi n−1 n + wi 2 (9) The inequality follows from the fact that for two scalars a and b, a2+b2 Furthermore, the last equality holds since we have assumed that wi we have: 2 ≥ ab always holds. j = 0. From Equation (8), (cid:1) 1wi 2 + . . . + wi nwi n−1 trace(JX) = n + = n + ≤ n + (cid:0)wi i=1 d(cid:88) d(cid:88) d(cid:88) i=1 i=1 zi (n − 2)(cid:0)wi d(cid:88) (cid:0)wi i=1 = n + (n − 2) = n(n − 1) (cid:1) (cid:1) 1wi 1 + . . . + wi nwi n 1wi 1 + . . . + wi nwi n The inequality follows from Equation (9), while the last equality follows from Equation (7). This concludes the proof. Note that problem (2) has a strictly feasible solution, i. e., a solution that satisfies the n for i ∈ 1, . . . , m positive semidefiniteness requirement strictly. For instance, by setting Xi,i = 1 and Xi,j = 0 for i, j ∈ 1, . . . , m with i (cid:54)= j, we obtain a positive definite feasible solution, i. e., X (cid:31) 0 and all constraints are satisfied. Therefore, strong duality holds [23]. There is an algorithm that for any  > 0, returns a rational closer than  to the solution of problem (2) in time bounded by a polynomial in n and log(1/) [21]. We can thus find a number closer than 1 2 to the optimal value of problem (2) in time polynomial in n. By comparing this number with n2, we can answer if the compatibility graph contains a clique of order n or not. 12 4 Conclusion In this paper, we have presented an algorithm for the graph isomorphism problem. The algo- rithm capitalizes on previous results that transform the problem into an equivalent problem of determining whether there exists a clique of specific order in an auxiliary graph structure. We have shown that the answer to the above question can be given by solving a semidefi- nite program. Given the frequent use of semidefinite programming in the design of algorithms [24, 25, 26], it seemed worthwhile to investigate its effectiveness in addressing the graph isomor- phism problem. The results of this paper constitute a first step in this direction. This paper still leaves some open questions. Studying the dual of the proposed semidefinite program is perhaps the most interesting of them. Acknowledgments The authors would like to thank Prof. Leo Liberti for discussions and comments on early versions of this paper. Giannis Nikolentzos is supported by the project "ESIGMA" (ANR-17- CE40-0028). References [1] M. R. Garey and D. S. Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman & Co., 1979. [2] U. Schoning, "Graph Isomorphism Is in the Low Hierarchy," Journal of Computer and System Sciences, vol. 37, no. 3, pp. 312 -- 323, 1988. [3] L. Babai and E. M. Luks, "Canonical Labeling of Graphs," in Proceedings of the 15th Annual Symposium on Theory of Computing, pp. 171 -- 183, 1983. [4] V. N. Zemlyachenko, N. M. Korneenko, and R. I. Tyshkevich, "Graph Isomorphism Prob- lem," Journal of Soviet Mathematics, vol. 29, no. 4, pp. 1426 -- 1481, 1985. [5] E. M. Luks, "Isomorphism of Graphs of Bounded Valence Can Be Tested in Polynomial Time," Journal of Computer and System Sciences, vol. 25, no. 1, pp. 42 -- 65, 1982. [6] L. Babai, "Graph Isomorphism in Quasipolynomial Time," in Proceedings of the 48th An- nual ACM Symposium on Theory of Computing, pp. 684 -- 697, 2016. [7] J. E. Hopcroft and J.-K. Wong, "Linear Time Algorithm for Isomorphism of Planar Graphs," in Proceedings of the 6th Annual Symposium on Theory of Computing, pp. 172 -- 184, 1974. [8] L. Babai, D. Y. Grigoryev, and D. M. Mount, "Isomorphism of Graphs with Bounded Eigen- value Multiplicity," in Proceedings of the 14th Annual Symposium on Theory of Computing, pp. 310 -- 324, 1982. [9] B. D. McKay and A. Piperno, "Practical graph isomorphism, ii," Journal of Symbolic Computation, vol. 60, pp. 94 -- 112, 2014. [10] T. Junttila and P. Kaski, "Engineering an Efficient Canonical Labeling Tool for Large and Sparse Graphs," in Proceedings of the 9th Workshop on Algorithm Engineering and Experiments, pp. 135 -- 149, 2007. 13 [11] P. T. Darga, K. A. Sakallah, and I. L. Markov, "Faster Symmetry Discovery using Sparsity of Symmetries," in Proceedings of the 45th Design Automation Conference, pp. 149 -- 154, 2008. [12] Y. Aflalo, A. Bronstein, and R. Kimmel, "On convex relaxation of graph isomorphism," Proceedings of the National Academy of Sciences, vol. 112, no. 10, pp. 2942 -- 2947, 2015. [13] D. Goldfarb and S. Liu, "An O(n3l) primal interior point algorithm for convex quadratic programming," Mathematical Programming, vol. 49, no. 1-3, pp. 325 -- 340, 1990. [14] M. Pelillo, "Replicator Equations, Maximal Cliques, and Graph Isomorphism," in Advances in Neural Information Processing Systems, pp. 550 -- 556, 1999. [15] G. Levi, "A note on the derivation of maximal common subgraphs of two directed or undirected graphs," Calcolo, vol. 9, no. 4, p. 341, 1973. [16] H. G. Barrow and R. M. Burstall, "Subgraph isomorphism, matching relational structures and maximal cliques," Information Processing Letters, vol. 4, no. 4, pp. 83 -- 84, 1976. [17] D. Kozen, "A clique problem equivalent to graph isomorphism," ACM SIGACT News, vol. 10, no. 2, pp. 50 -- 52, 1978. [18] I. Koch, "Enumerating all connected maximal common subgraphs in two graphs," Theo- retical Computer Science, vol. 250, no. 1-2, pp. 1 -- 30, 2001. [19] N. Kriege and P. Mutzel, "Subgraph Matching Kernels for Attributed Graphs," in Proceed- ings of the 29th International Coference on International Conference on Machine Learning, pp. 291 -- 298, 2012. [20] M. Grotschel, L. Lov´asz, and A. Schrijver, Geometric algorithms and combinatorial opti- mization, vol. 2. Springer Science & Business Media, 2012. [21] Y. Nesterov and A. Nemirovskii, Interior-point polynomial algorithms in convex program- ming, vol. 13. SIAM, 1994. [22] M. Grotschel, L. Lov´asz, and A. Schrijver, "The ellipsoid method and its consequences in combinatorial optimization," Combinatorica, vol. 1, no. 2, pp. 169 -- 197, 1981. [23] L. Vandenberghe and S. Boyd, "Semidefinite programming," SIAM review, vol. 38, no. 1, pp. 49 -- 95, 1996. [24] M. X. Goemans and D. P. Williamson, "Improved Approximation Algorithms for Maximum Cut and Satisfiability Problems Using Semidefinite Programming," Journal of the ACM, vol. 42, no. 6, pp. 1115 -- 1145, 1995. [25] A. Srivastav and K. Wolf, "Finding dense subgraphs with semidefinite programming," in Proceedings of the International Workshop on Approximation Algorithms for Combinatorial Optimization, pp. 181 -- 191, 1998. [26] U. Feige and R. Krauthgamer, "Finding and certifying a large hidden clique in a semiran- dom graph," Random Structures & Algorithms, vol. 16, no. 2, pp. 195 -- 208, 2000. 14
1712.09473
1
1712
2017-12-27T01:26:52
Sketching for Kronecker Product Regression and P-splines
[ "cs.DS", "cs.LG", "stat.ML" ]
TensorSketch is an oblivious linear sketch introduced in Pagh'13 and later used in Pham, Pagh'13 in the context of SVMs for polynomial kernels. It was shown in Avron, Nguyen, Woodruff'14 that TensorSketch provides a subspace embedding, and therefore can be used for canonical correlation analysis, low rank approximation, and principal component regression for the polynomial kernel. We take TensorSketch outside of the context of polynomials kernels, and show its utility in applications in which the underlying design matrix is a Kronecker product of smaller matrices. This allows us to solve Kronecker product regression and non-negative Kronecker product regression, as well as regularized spline regression. Our main technical result is then in extending TensorSketch to other norms. That is, TensorSketch only provides input sparsity time for Kronecker product regression with respect to the $2$-norm. We show how to solve Kronecker product regression with respect to the $1$-norm in time sublinear in the time required for computing the Kronecker product, as well as for more general $p$-norms.
cs.DS
cs
Sketching for Kronecker Product Regression and P-splines 7 1 0 2 c e D 7 2 ] S D . s c [ 1 v 3 7 4 9 0 . 2 1 7 1 : v i X r a Huaian Diao Zhao Song Wen Sun [email protected] [email protected] [email protected] David P. Woodruff [email protected] Northeast Normal University Harvard U & UT-Austin Carnegie Mellon University Carnegie Mellon University Abstract TensorSketch is an oblivious linear sketch introduced in (Pagh, 2013) and later used in (Pham and Pagh, 2013) in the context of SVMs for polynomial kernels. It was shown in (Avron et al., 2014) that TensorSketch provides a subspace embedding, and there- fore can be used for canonical correlation analysis, low rank approximation, and princi- pal component regression for the polynomial kernel. We take TensorSketch outside of the context of polynomials kernels, and show its utility in applications in which the under- lying design matrix is a Kronecker product of smaller matrices. This allows us to solve Kro- necker product regression and non-negative Kronecker product regression, as well as reg- ularized spline regression. Our main tech- nical result is then in extending TensorS- ketch to other norms. That is, TensorS- ketch only provides input sparsity time for Kronecker product regression with respect to the 2-norm. We show how to solve Kronecker product regression with respect to the 1-norm in time sublinear in the time required for com- puting the Kronecker product, as well as for more general p-norms. 1 INTRODUCTION In the overconstrained least squares regression prob- lem, we are given an n× d matrix A called the "design matrix", n ≫ d, and an n × 1 vector b, and the goal is to find an x which minimizes kAx − bk2. There are many variants to this problem, such as regularized ver- sions of the problem in which one seeks an x so as to Proceedings of the 21st International Conference on Artifi- cial Intelligence and Statistics (AISTATS) 2018, Lanzarote, Spain. JMLR: W&CP volume 7X. Copyright 2018 by the author(s). 2 + kLxk2 minimize kAx − bk2 2 for a matrix L, or regres- sion problems which seek to minimize more robust loss functions, such as ℓ1-regression kAx − bk1. In the era of big data, large scale matrix computa- tions have attracted considerable interest. To obtain reasonable computational and time complexities for large scale matrix computations, a number of random- ized approximation algorithms have been developed. For example, in (Woodruff, 2014), it was shown how to output a vector x′ ∈ Rd for which kAx′ − bk2 ≤ (1 + ǫ) minx∈Rd kAx − bk2 in nnz(A) + poly(d/ǫ) time, where nnz(A) denotes the number of non-zero en- tries of matrix A. We refer the reader to the recent surveys (Kannan and Vempala, 2009; Mahoney, 2011; Woodruff, 2014) for a detailed treatment of this topic. In this work we focus on regression problems for which the design matrix is a Kronecker product matrix, that is, it has the form A ⊗ B for A ∈ Rn1×d1 and B ∈ Rn2×d2. Also, b ∈ Rn1n2 , and one seeks to solve the problem minx∈Rd1d2 k(A ⊗ B)x − bk2 in the standard setting, which can also be generalized to regularized and robust variants. One can also ask the question when the design matrix is a Kronecker product of more than two matrices. Kronecker product matrices have many applications in statistics, linear system theory, signal processing, photogrammetry, multivariate data fitting, etc.; see (Golub and Van Loan, 2013; Van Loan and Pitsianis, 1993; Van Loan, 1992). The linear least squares prob- lem involving the Kronecker product arises in many applications, such as structured linear total least norm on blind deconvolution problems (Oh and Yun, 2005), constrained linear least squares problems with a Kro- necker product structure, the bivariate problem of sur- face fitting and multidimensional density smoothing (Eilers and Marx, 2006). One way to solve Kronecker product regression is to form the matrix C = A ⊗ B explicitly, where A ∈ Rn1×d1, B ∈ Rn2×d2, and then apply a ran- domized algorithm to C. However, this takes at least nnz(A) · nnz(B) time and space. It is natural Sketching for Kronecker Product Regression and P-splines to ask if it is possible to solve the Kronecker prod- uct regression problem in time faster than computing A ⊗ B. This is in fact the case, as Fausett and Fulton (Fausett and Fulton, 1994) show that one can solve Kronecker product regression in O(n1d2 2) time; indeed, the solution vector x = vec((B⊥)⊤D−1A⊥), where D = vec(b) and vec(E) for a matrix E denotes the operation of stacking the columns of E into a sin- gle long vector. While such a computation does not involve computing A ⊗ B, it is more expensive than what one would like. 1 + n2d2 A natural question is if one can approximately solve Kronecker product regression in nnz(A) + nnz(B) + poly(d/ǫ) time, which, up to the poly(d/ǫ) term, would match the description size of the input. Another natu- ral question is Kronecker product regression with reg- ularization. Such regression problems arise frequently in the context of splines (Eilers and Marx, 2006). Fi- nally, what about Kronecker product regression with other, more robust, norms such as the ℓ1-norm? 1.1 Our Contributions is exactly suited for this task. We first observe that the random linear map TensorS- ketch, introduced in the context of problems for the polynomial kernel by Pagh (2013), Pham and Pagh (2013), Namely, in (Avron et al., 2014) it was shown that for a d- dimensional subspace C of Rn, represented as an n× d matrix, there is a distribution on linear maps S with O(d2/ǫ2) rows such that with constant probability, si- multaneously for all x ∈ Rd, kSCxk2 = (1 ± ǫ)kCxk2. That is, S provides an Oblivious Subspace Embed- ding (OSE) for the column span of C. Further, it is known that if b is an n-dimensional vector, then one has that kS[C, b]xk2 = (1 ± ǫ)k[C, b]xk2 for all x ∈ Rd+1. Consequently, to solve the regression prob- lem minx∈Rd kCx−bk2, one can instead solve the much smaller problem minx∈Rd kSCx − Sbk2, and the solu- tion x′ to the latter problem will satisfy kCx′ − bk2 ≤ (1 + ǫ) minx∈Rd kCx − bk2. Importantly, if n = n1 · n1 and there is a basis for the column span of C of the form A1 ⊗ A1, A2 ⊗ A2, . . . , Ad ⊗ Ad, then given A1, . . . , Ad, it holds that SC can be computed in nnz(A) time, where A is the n1 × d matrix whose i-th column is Ai. Fur- ther, given a vector b with nnz(b) non-zero entries, one can compute Sb in nnz(b) time. Thus, one ob- tains a (1 + ǫ)-approximate solution to the regression minx∈Rd kCx−bk2 in nnz(A)+nnz(b)+poly(d/ǫ) time. While not immediately useful for our problem, we show that via simple modifications, the claim about TensorSketch above can be generalized to the case when there is a basis for the column span of C of the form Ai ⊗ Bj for arbitrary vectors A1, . . . , Ad1 ∈ Rn1 and vectors B1, . . . , Bd2 ∈ Rn2 . That is, we observe that in this case SC can be computed in nnz(A) + nnz(B) time, where A is the n1 × d1 matrix whose i-th column is Ai, and B is the n2 × d2 matrix whose i-th column is Bi. In this case C = A ⊗ B, which is exactly the case of Kronecker product regres- sion. Using the above connection to regression, we obtain an algorithm for Kronecker product regression in nnz(A) + nnz(B) + nnz(b) + poly(d1d2/ǫ) time. Us- ing the fact that kSCx − Sbk2 = (1 ± ǫ)kCx − bk2 for all x, we have in particular that this holds for all non- negative x, and so also obtain the same reduction in problem size for non-negative Kronecker product re- gression, which occurs often in image and text data; see e.g., (Chen and Plemmons, 2010). 2 + λkxk2 The above observation allows us to extend many ex- isting variants of least squares regression to the case when C is a Kronecker product of two matrices. For ex- ample, the results in (Avron et al., 2016) for the ridge regression problem minx∈Rd kAx − bk2 2 imme- diately hold when C is a Kronecker product matrix, since the conditions needed for the oblivious embed- ding in (Avron et al., 2016) come down to a subspace embedding and an approximate matrix product condi- tion, both of which are known to hold for TensorS- ketch (Avron et al., 2014). More interestingly we are able to extend the results in (Avron et al., 2016) for Kronecker ridge regression to the case when the reg- ularizer is a general matrix, namely, to the problem minx∈Rd kAx − bk2 2, where L is an arbitrary matrix. Such problems occur in the context of spline regression (Eilers and Marx, 1996, 2006; Eilers et al., 2015). The number of rows of TensorSketch de- pends on a generalized notion of statistical dimen- sion depending on the generalized singular values γi of [A; L], and may be much smaller than d1 or d2. In (Avron et al., 2016), only results for L equal to the identity were obtained. 2 + λkLxk2 Finally, our main technical result is to extend our re- sults to least absolute deviation Kronecker product re- gression minx∈Rd kCx − bk1, which, since it involves the 1-norm, is often considered more robust than least squares regression (Rousseeuw and Leroy, 2005) and has been widely used in applications such as com- puter vision (Zheng et al., 2012). We in fact extend this to general p-norms but focus the discussion on p = 1. We give the first algorithms for this problem that are faster than computing C = A ⊗ B explicitly, which would take at least nnz(A)·nnz(B) ≥ n1n2 time. Namely, and for simplicitly focusing on the case when n1 = n2, for which the goal is to do better than n2 1 time, we show how to output an x ∈ Rd1×d2 for which kCx′ − bk1 ≤ (1 + ǫ) minx∈Rd1d2 kCx − bk1 in time n3/2 poly(d1d2/ǫ). While this is more expensive than Diao, Song, Sun, Woodruff solving Kronecker product least squares, the 1-norm may lead to significantly more robust solutions. From a technical perspective, TensorSketch when applied to a vector actually destroys the 1-norm of a vector, preserving only its 2-norm, so new ideas are needed. We show how to use multiple TensorSketch matri- ces to implicitly obtain very crude estimates to the so- called ℓ1-leverage scores of C, which can be interpreted as probabilities of sampling rows of C in order to ob- tain an ℓ1-subspace embedding of the column span of C (see, e.g., (Woodruff, 2014)). However, since C has n1n2 rows, we cannot even afford to write down the ℓ1-leverage scores of C. We show how to implicitly rep- resent such leverage scores and to sample from them without ever explicitly writing them down. Balancing the phases of our algorithm leads to our overall time. A1 ⊗ A2 ⊗ ...⊗ Aq, n =Qq i=1 ni, and d =Qq a vector x ∈ Rd is defined as kxkp = (Pd 1.2 Notation We consider Kronecker Product of q 2-d matrices A1⊗ A2⊗ ...⊗ Aq, where each Ai ∈ Rni×di. We denote A = i=1 di. We denote [n] as the set {1, 2, 3,··· , n}. The ℓp norm for i=1 xip)1/p, where xi stands for the i'th entry of the vector x. For any matrix M , we use Mi,∗ to represent the i'th row of M and M∗,j as the j'th column of M . We define a Well-Conditioned Basis and Statistical Dimension as follow (similar definitions can be found in Clarkson (2005); Dasgupta et al. (2009); Sohler and Woodruff (2011); Meng and Mahoney (2013); Song et al. (2017a,b) and Avron et al. (2016)): Definition 1.1 (Well-Conditioned Basis). Let A be an n × m matrix with rank d, let p ∈ [1,∞), and let k · kq be the dual norm of k · kp, i.e., 1/p + 1/q = 1. Then an n×d matrix U is an (α, β, p)-well-conditioned basis for the column space of A, if the columns of U span the column space of A and (1) kUkp ≤ α, and (2) for all z ∈ Rd, kzkq ≤ βkU zkp. Consider the classic Ridge Regression: minx kAx − bk2 2. The Statistical Dimension is defined as: Definition 1.2 (Statistical Dimension). Let A be an n×m matrix with rank d and singular values σi, i ∈ [d]. For λ ≥ 0, the statistical dimension sdλ(A) is defined as the quantity sdλ(A) =Pi∈[d] 1/(1 + λ/σ2 2 BACKGROUND:TensorSketch 2 + λkxk2 i ). We briefly introduce TensorSketch (Pagh, 2013; Avron et al., 2014) and how to apply TensorSketch to the Kronecker product of multiple matrices effi- ciently without explicitly computing the tensor prod- uct.1 1We refer readers to (Avron et al., 2014) for more de- tails about TensorSketch. , ..., Aq∗,iq ··· × [nq] → [m] as H(i1, i2, ..., iq) = ((Pq {−1, 1} as S(i1, i2, ..., iq) = Qq We want to find a oblivious subspace embedding S such that for any x ∈ Rn, we have kSAxk2 = (1 ± ǫ)kAxk2, where the notation a = (1 ± ǫb) stands for (1 − ǫ)b ≤ a ≤ (1 + ǫ)b, for any a, b ∈ R. Con- sider the (i1, i2, ..., iq)'th column of A (ij ∈ [dj]): A1∗,i1 ⊗ A2∗,i2 ⊗···⊗ Aq∗,iq . Assume the sketching tar- get dimension is m. TensorSketch is defined using q 3-wise indepedent hash functions hi : [ni] → [m], and q 4-wise independent sign functions si : [ni] → {−1, 1}, ∀i ∈ [q]. Define hash function H : [n1] × [n2] × k=1 hk(ik)) mod m), and sign function S : [n1]× [n2]×···× [nq] → k=1 sk(ik). Applying Tensorsketch to the Kronecker product of vectors is equivalent to applying CountS- A1∗,i1 ketch (Charikar et al., 2004) defined with H and S to the vector (A1∗,i1 ⊗ ...⊗ Aq∗,iq ). To apply Tensors- ketch to A, we just need to apply CountSketch defined with H and S to the columns of A one by one. Applying tensorsketch to the Kronecker product of , ..., Aq∗,iq ) naively would require at least O(n) (A1∗,i1 time. Pagh (2013) shows that one can apply tensors- , ..., Aq∗,iq ) ketch to the Kronecker product of (A1∗,i1 without explicitly computing the Kronecker product of these vectors using the Fast Fourier Transforma- tion. Particularly, Pham and Pagh (2013) show that ) + qm log(m)) time to compute S(A1∗,i1 ⊗...⊗Aq∗,iq ) where Ai∗,j stands for the j'th column of Ai. As A has d columns, comput- i=1 nnz(Ai)) + dqm log(m)) time, i=1 ni), which is the least amount of time one needs for explicitly comput- In the rest of the paper, we assume that we ing A. compute SA using the above efficient procedure with- out explicitly computing A1 ⊗ . . . ⊗ Aq. one only needs O(Pq ing SA takes O(d(Pq which is much smaller than O(Qq j=1 nnz(Aj∗,ij 3 TENSOR PRODUCT LEAST SQUARES REGRESSION Consider the tensor product least squares regression problem minx kAx − bk2 where A ∈ Rn×d and b ∈ Rn. Let S ∈ Rm×n be the matrix form of TensorSketch of Section 2. We propose a TensorSketch -type Algorithm 1 for the tensor product regression prob- lem. The following theorem shows that the solution obtained from Alg. 1 is a good approximation of the optimal solution of the original tensor product regres- sion. Let us define OPT to be the optimal cost of the opti- mization problem, e.g., OPT = minx kAx − bk2. The following theorem shows that Alg. 1 computes a good approximate solution. Theorem 3.1. (Tensor regression) Suppose ex is the output of Algorithm 1 with tensorsketch S ∈ Sketching for Kronecker Product Regression and P-splines Algorithm 1 Tensor product regression 1: procedure TRegression(A, b, ǫ, δ) 2: 3: m ← (d1d2 ··· dq + 1)2(2 + 3q)/(ǫ2δ) Choose S to be an m× (n1n2 ··· nq) TensorS- Compute S(A1 ⊗ A2 ⊗ ··· ⊗ Aq) and Sb ketch matrix 4: 5: 6: 7: end procedure ex ← minx kS(A1 ⊗ A2 ⊗ ··· ⊗ Aq)x − Sbk2 return ex Aq)ex − bk2 ≤ (1 + ǫ) OPT, holds with probability at Rm×n, where m = 8(d1d2 ··· dq + 1)2(2 + 3q)/(ǫ2δ). Then the following approximation k(A1 ⊗ A2 ⊗ ··· ⊗ least 1 − δ. The proof of Theorem 3.1 can be found in Appendix C.1. Theorem 3.1 shows that we can achieve an ǫ-close solution by solving a much smaller regression problem with a number of samples of order O(poly(d/ǫ)), which is independent of the large dimension n. Using the technique we introduced in Sec. 2, we can also compute SA without explicitly computing the tensor product. We can extend Theorem 3.1 to the nonnegative ten- sor product regression problem minx≥0 k(A1 ⊗ A2 ⊗ ··· ⊗ Aq)x − bk2, where Ai ∈ Rni×di, i = 1, . . . , q and b ∈ Rn1n2···nq . Suppose x is the optimal solution. Sim- ilarly, let S ∈ Rm×(n1n2···nq) be the matrix form of lution to minx≥0 kS(A1 ⊗ A2 ⊗ ··· ⊗ Aq)x − Sbk2., we have the following: TensorSketch of Section 2. If ex is the optimal so- Corollary 3.2. (Sketch for tensor nonnegative regres- sion) Suppose x = minx≥0 kSAx − Sbk2 with ten- sorsketch S ∈ Rm×n, where m = 8(d1d2 ··· dq + 1)2(2 + 3q)/(ǫ2δ). Then the following approxima- tion k(A1 ⊗ A2 ⊗ ··· ⊗ Aq)ex − bk2 ≤ (1 + ǫ) OPT holds with probability at least 1 − δ, where OPT = minx≥0 k(A1 ⊗ A2 ⊗ ··· ⊗ Aq)x − bk2. The proof of Corollary 3.2 can be found in Ap- pendix C.1. 4 P-SPLINES B-splines are local basis functions, consisting of low de- gree (e.g., quadratic, cubic) polynomial segments. The positions where the segments join are called the knots. B-splines have local support and are thus suitable for smoothing and interpolating data with complex pat- terns. Unfortunately, control over smoothness is lim- ited: one can only change the number and positions of the knots. If there are no reasons to assume that smoothness is non-uniform, the knots will be equally spaced and the only tuning parameter is their (dis- crete) number. In contrast P-spline (Eilers and Marx, 1996) equally spaces B-splines, discards the deriva- tive completely, and controls smoothness by regular- izing the sum of squares of differences of coefficients. Specifically Eilers and Marx Eilers and Marx (1996) proposed the P-spline recipe: (1) use a (quadratic or cubic) B-spline basis with a large number of knots, say 10-50; (2) introduce a penalty on (second or third order) differences of the B-spline coefficients; (3) min- imize the resulting penalized likelihood function; (4) tune smoothness with the weight of the penalty, us- ing cross-validation or AIC to determine the optimal weight. We give a brief overview of B-Splines and P-Splines below. Let b and u, each vectors of length n, represent the observed and explanatory variables, respectively. Once a set of knots is chosen, the B-spline basis A fol- lows from u. If there are d basis functions then A is n× d. In the case of normally distributed observations the model is b = Ax + e, with independent errors e. In the case of B-spline regression the sum of squares of residuals kb − Axk2 is minimized and the normal equa- tions A⊤Ax = A⊤b are obtained; the explicit solution x = (A⊤A)−1A⊤b results. The P-spline approach min- imizes the penalized least-squares function kb − Axk2 2 + λkLxk2 2, (1) where L ∈ Rp×n is a matrix that forms differences of order ℓ, i.e., Lℓx = ∆ℓx. Examples of this matrix, for ℓ = 1 and ℓ = 2 are : L1 = −1 1 0 −1 0 0 0 0 1 0 −1 1 , L2 = 1 −2 1 0 1 −2 0 0 0 0 0 1 1 −2 1 . The parameter λ determines the influence of the penalty. If λ is zero, we are back to B-spline regression; increasing λ makes x, and hence b = Ax, smoother. Let x∗ denote argminx∈RdkAx − bk2 2 + λkLxk2 2, and 2. In general x∗ = OPT denote kAx∗ − bk2 2 + λkLx∗k2 (A⊤A + λL⊤L)−1A⊤b = A⊤(AA⊤ + λLL⊤)−1b, so x∗ can be found in O(nnz(A) min(n, d)) time using an it- erative method (e.g., LSQR). Our first goal in this section is to design faster algorithms that find an ap- proximateex in the following sense: kAex − bk2 2 + λkLexk2 4.1 Sketching for P-Spline 2 ≤ (1 + ǫ) OPT . (2) We first introduce a new definition of Statistical Di- mension that extends the statistical dimension defined for Ridge Regression (i.e., L is an identity matrix in Eq. 1) (Avron et al., 2016) to P-Spline regression. The problem (1) can also be analyzed by gen- eralized (GSVD) decomposition singular value Diao, Song, Sun, Woodruff Σ 0p×(n−p) 0(n−p)×p d, the GSVD of (A, L) is given by the pair of factoriza- Golub and Van Loan (2013). For matrices A ∈ Rn×d and L ∈ Rp×d with rank(L) = p and rank(cid:18)(cid:20) A L (cid:21)(cid:19) = Id−p (cid:21) RQ⊤ and L = tions A = U(cid:20) V (cid:2)Ω 0p×(n−p)(cid:3) RQ⊤, where U ∈ Rm×n has or- thonormal columns, V ∈ Rp×p, Q ∈ Rd×d are orthogonal, R ∈ Rd×d is upper triangular and non- singular, and Σ and Ω are p × p diagonal matrices: Σ = diag(σ1, σ2, . . . , σp) and Ω = diag(µ1, µ2, . . . , µp) with 0 ≤ σ1 ≤ σ2 ≤ . . . ≤ σp < 1 and 1 ≥ µ1 ≥ µ2 ≥ . . . ≥ µp > 0, satisfying Σ⊤Σ + Ω⊤Ω = Ip. The generalized singular values γi of (A, L) are defined by the ratios γi = σi/µi (i = [p]). In this section we design an algorithm that is aimed at the case when n ≫ d. The general strategy is to design a distribution on matrices of size m-by-n (m is a parameter), sample an S from that distribution, and 2 + λkLxk2 2 . solveex ≡ argminx∈RdkS(Ax − b)k2 The following lemma defines conditions on the distribu- tion of S that guarantees Eq. (2) holds with constant probability (which can be boosted to high probability by repetition and taking the minimum objective). Lemma 4.1. Let x∗ ∈ Rd, A ∈ Rn×d and b ∈ Rn as above. Let U1 ∈ Rn×d denote the first n rows of an orthogonal basis for h A√λLi ∈ R(n+p)×d. Let sketching matrix S ∈ Rm×n have a distribution such that with constant probability (I) kU⊤1 S⊤SU1 − U⊤1 U1k2 ≤ 1/4, and (II) kU⊤1 (S⊤S − I)(b − Ax∗)k2 ≤pǫ OPT /2. Letex denote argminx∈RdkS(Ax− b)k2 with probability at least 9/10, 2 + λkLxk2 2. Then kAex − bk2 2 + λkLexk2 2 ≤ (1 + ǫ) OPT . Define the statistical dimension for P-Splines as fol- lows: i ) + d − p. Definition 4.2 (Statistical Dimension for P-Splines). For S-Spline in Eq. (1), the statistical dimension is defined as sdλ(A, L) =Pi 1/(1 + λ/γ2 The following theorem shows that there is a sparse subspace embedding matrix S ∈ Rm×n (e.g., CountS- ketch), with m ≥ K(sdλ(A, L)/ǫ + sdλ(A, L)2), that satisfies Property (I) and (II) of Lemma 4.1, and hence achieves an ǫ−approximation solution to problem 1: Theorem 4.3. (P-Spline regression) There is a con- stant K > 0 such that for m ≥ K(ǫ−1 sdλ(A, L) + Algorithm 2 P-Spline Tensor product regression 1: procedure PTRegression(A, b, K, L, ǫ, δ) 2: 3: 4: 5: 6: 7: end procedure m ← K(ǫ−1 sdλ(A, L) + sdλ(A, L)2) Choose S to be a m×n TensorSketch matrix Compute S(A1 ⊗ A2 ⊗ ··· ⊗ Aq) and Sb 2 + λkLxk2 2. ex = argminx∈RdkS(Ax − b)k2 return ex ing ex = argminx∈RdkS(Ax − b)k2 + λkLxk2 sdλ(A, L)2) and S ∈ Rm×n a sparse embedding ma- trix (e.g., Countsketch) with SA computable in O(nnz(A)) time, Property (I) and (II) of Lemma 4.1 apply, and with constant probability the correspond- 2 is an ǫ- 2 + λkLxk2 approximate solution to minx∈Rdkb − Axk2 2. Note sdλ(A, L) is upper bounded by d. The above theorem shows that the statistical dimension al- lows us to design smaller sketch matrices whose size only depends on O(poly(sdλ(A, L)/ǫ)) instead of O(poly(d/ǫ)), without sacrificing the approximation accuracy. 4.2 Tensor Sketching for Multi-Dimensional P-Spline Tensor products allow a natural extension of one- dimensional P-spline smoothing to multi-dimensional P-Spline. We focus on 2-dimensional P-Spline but our results can be generalized to the multi-dimensional set- ting. Assume that in addition to u we have a sec- ond explanatory variable v. We have data triples (ui, vj, b(i−1)·n2+j) for i = 1, . . . , n1 and j = 1, . . . , n2. We seek a smooth surface f (u, v) which gives a good approximation to the response b. Let A1, n × d1, be a B-spline basis along u, and A2, n × d2, be a B-spline basis along v. We form the tensor product basis as A1 ⊗ A2. When n1 and n2 are large, we do not com- pute A1⊗ A2. We apply tensorsketch here to avoid explicitly forming A1 ⊗ A2 to speed up computation. Let X = [xkl] be a d1 × d2 matrix of co- the value fit efficients. at (u, v) and so X may be chosen using least is f (u, v) = PkPl A2,k(v)A1,l(u)xkl by minimizing Pi,j[b(i−1)·n2+j − f (ui, vi)]2 = Pi(cid:2)b(i−1)·n2+j −PkPl A2,k(vi)A1,l(ui)xkl(cid:3)2 . Using Kronecker product, the above minimization can be written in the form min kb − Axk2 , where A = A1 ⊗ A2 ∈ Rn1n2×d1d2 and x = vec(X). Again the P- spline approach minimizes the penalized least-squares function kb − (A1 ⊗ A2)xk2 2 + λkLxk2 2. Consider the tensor p-spline regression problem minx k(A1 ⊗ A2 ⊗ ··· ⊗ Aq)x − bk2 2 + λkLxk2 2, where L ∈ Rp×n, Ai ∈ Rni×di, i = 1, . . . , q and b ∈ Rn. Let S ∈ Rm×n be the matrix form of TensorSketch of Section 2. for given X, squares Then, Sketching for Kronecker Product Regression and P-splines Algorithm 2 summarizes the procedure for efficiently solving multi-dimensional P-Spline. Let A = A1⊗ A2⊗···⊗ Aq. Replacing the matrix A in Theorem 4.3 with A, we have the following corollary for multi-dimensional P-Spline: Corollary 4.4 (P-Spline tensor regression). Suppose λ ≤ σ2 1/ǫ. There is a constant K > 0 such that for m ≥ K(ǫ−1 sdλ(A, L) + sdλ(A, L)2) and S ∈ Rm×n a TensorSketch matrix with SA computable in O(nnz(A)) time, Property (I) and Property (II) of Lemma 4.1 apply, and with constant probability the corresponding ex = argminx∈RdkS(Ax − b)k2 + λkLxk2 is an ǫ-approximate solution to minx∈Rdkb − Axk2 λkLxk2 2. 5 TENSOR PRODUCT ABSOLUTE 2 2 + DEVIATION REGRESSION i=1 d2 running a cross validation procedure similar to that in Algorithm 4 of Liang et al. (2014), to find one which succeeds with probability at least 1 − δ: Lemma 5.1 ((Liang et al., 2014)). For δ, ǫ ∈ (0, 1), i (2 + 3q)/ǫ2. Running algorithm Algorithm 4 in (Liang et al., 2014) with parameters t, m, we can obtain a tensorsketch i=1 wi such that with probability at least 1−δ, i2 ⊗ ··· ⊗ A(q) i2 ⊗ let t = O(log 1/δ) and m ≥ 100Qq S ∈ Rm×Qq i1 ⊗ A(2) kSA(1) ··· ⊗ A(q) iq xk2 for all x ∈ Rd. computing a tensorsketch Si1i2...iq i=1 wi ∈ After Rm×Qq each row-block A(1) compose = a S diag(S1,··· ,1,··· , Si1,··· ,iq ,··· , S(n1/w1),··· ,(nq/wq)) ∈ RmQq i1 ⊗ ... ⊗ A(q) iq , we for A as i=1 ni , which is defined as: iq xk2 = (1 ± ǫ)kA(1) i=1 ni/wi×Qq i1 ⊗ A(2) tensorsketch lemma single using 5.1 for We extend our previous results for the ℓ2 norm (i.e., least squares regression) to general ℓp norms, with a focus on p = 1 (i.e., absolute deviation regression). Specifically we consider minx kAx − bkp, where A = A1 ⊗ A2 ⊗ ··· ⊗ Aq. We will show in this section that with probability at least 2/3, we can quickly find an x for which kAx − bk1 ≤ (1 + ǫ) minx kAx − bk1. As in Clarkson and Woodruff (2013), for each i, in O(nnz(Ai) log(di)) + O(r3 i ) time we can replace the input matrix Ai ∈ Rni×di with a new matrix with the same column space of Ai and full column rank. We therefore assume A has full rank in what follows. Suppose S is the TensorSketch matrix defined in Section 2. Let wi ∈ N and assume wi ni. Split Ai into ni/wi matrices A(i) , each wi × di, so that A(i) is the submatrix of Ai indexed by the j-th j block of wi rows. Note A can be written as: ⊗ A(q) ⊗ A(q) 1 ⊗ ··· ⊗ A(q−1) 1 ⊗ ··· ⊗ A(q−1) A(1) 1 ⊗ A(2) 1 ⊗ A(2) A(1) 1 , . . . , A(i) ni/wi 1 1 1 2 ... n1/w1 ⊗ A(2) A(1) n2/w2 ⊗ ··· ⊗ A(q−1) nq−1/wq−1 ⊗ A(q) nq/wq . iq i1 ⊗ A(2) i=1 d2 i2 ⊗ ··· ⊗ A(q) For each A(1) , we can use the Ten- sorSketch matrix Si1i2...iq ∈ Rm×Qq i=1 wi , where we set m ≥ 100Qq i (2 + 3q)/ǫ2, such that with proba- i1 ⊗A(2) bility at least .99, kSi1i2...iq A(1) iq xk2 = i2 ⊗ ··· ⊗ A(q) i1 ⊗ A(2) (1 ± ǫ)kA(1) xk2 simultaneously for all x ∈ Rd as Si1i2...iq is an oblivious subspace embed- ding (Lemma. B.3) . Now we use Algorithm 4 from (Liang et al., 2014) to boost the success probability by computing t = O(log(1/δ)) independent TensorS- ketch products S(j) , j = [t], each with only constant success probability, and then i2 ⊗···⊗A(q) i2 ⊗···⊗A(q) i1 ⊗A(2) A(1) i1i2...iq iq iq .    S1,··· ,1 . . . Si1,··· ,iq . . . S(n1/w1),··· ,(nq/wq) ,  i=1 ni/wi×Qq let S ∈ RmQq Note that A has in total Qq where each block on the diagonal is from Lemma 5.1. i=1(ni/wi) many blocks. Using Lemma 5.1 with a union bound over all blocks of A, we have the following theorem which shows S is an oblivious subspace embedding for A in ℓ2 norm: Theorem 5.2 (ℓ2 OSE for tensor matrices). Given i=1 ni denote δ, ǫ ∈ (0, 1), the matrix that has Qq i=1 ni/wi diagonal block matri- ces where each diagonal block Si1i2...iq ∈ Rm×Qq i=1 wi is from Lemma 5.1. With probability at least 1 − Qq i=1(ni/wi)δ, kSAxk2 = (1 ± ǫ)kAxk2,∀x ∈ Rd. It is known that for any matrix A ∈ Rn×r, we can compute a change of basis U ∈ Rr×r such that AU is an (α, β, p) well-conditioned basis of A (see Defi- nition 1.1), in time polynomial with respect to n, r (Dasgupta et al., 2009). Specifically, Theorem 5 in (Dasgupta et al., 2009) shows that we can compute a change of basis U for which AU is a well-conditioned basis of A in time O(nr5 log(n)) time. However we cannot afford to directly use the results from (Dasgupta et al., 2009) to compute a well-conditioned basis for A, which requires time at least Ω(n). Instead we compute a well-conditioned basis for A through a sketch SA where S is the tensorsketch from Theo- rem 5.2. the Specifically we define following procedure Condition(A) for computing a well-conditioned basis for A. Given A = A1 ⊗ ··· ⊗ Aq ∈ Rn×r, 1) Compute SA; 2) Compute a d × d change of basis matrix U Diao, Song, Sun, Woodruff i=1(ni/wi)δ. i=1 mi and w = Qq so that SAU is an (α, β, p)-well-conditioned basis of the column space of SA; 3) Output AU/(dγp), where γp ≡ √2t1/p−1/2 for p ≤ 2, and γp ≡ √2w1/2−1/p for p ≥ 2, where t = Qq i=1 wi. The following Lemma 5.3 (the proof can be found in the Appendix) is the analogue of that in Clarkson et al. (2013) proved for the Fast Johnson Lindenstauss Transform. Lemma 5.3. For any p ≥ 1. Condition(A) computes AU/(dγp) which is an (α, β√3d(tw)1/p−1/2, p)-well- conditioned basis of A, with probability at least 1 − Qq Lemma 5.3 indicates that Condition(A) computes a (α, β · poly(max(d, log n)), p)-well-conditioned basis. A well-conditioned basis can be used to solve ℓp regres- sion problems, via sampling a subset of rows of the well-conditioned basis AU with probabilities propor- tional to the p-th power of the ℓp norm of the rows (Woodruff, 2014). However the first issue for sampling is that we cannot afford to compute AU as this re- quires O(nnz(A)d) time. To fix this, we apply a Gaus- sian sketch matrix G ∈ Rd×log(n) with i.i.d normal ran- dom variables (Drineas et al., 2011) on the right hand side of AU . Note that AU G can be computed effi- ciently by first compuing U G and then A(U G) in time O(d2 log(n) + nnz(A) log(n)). The second issue is that even with AU G, computing the ℓp norm of each row of AU G takes O(n) time, but we want sublinear time. This leads us to the following sampling technique. M = A1 ⊗ ... ⊗ Aq1 E(Aq1+1 ⊗ ... ⊗ Aq)⊤, The high level idea is that since AU G only has O(log(n)) columns, we can afford to sample columns of AU G with probability proportional to the p-th power of the ℓp norms of the columns, if we can efficiently es- timate the ℓp norms of the columns (note that naıvely computing the ℓp norm of a column also takes O(n) time). Let us denote the first of column of U G as e ∈ Rlog(n). We focus on how to efficiently estimate the ℓp norm of the first column of AU G, which is Ae, and all the left columns can be estimated in the same way. We first reshape the vector Ae into a 2-d matrix (3) where M ∈ R(n1n2...nq1 )×(nq1+1...nq ), E is obtained from reshaping e into a (d1d2...dq1 ) × (dq1+1..dq) ma- trix and q1 ∈ [1, q] is chosen such that (n1n2...nq1 ) ≈ (nq1+1...nq). Namely we reshape the column Ae into a (nearly) square matrix. Focusing now on p = 1, note that kAek1 =Pnq1+1...nq kM∗,ik1. Hence to estimate kAek1, we only need to estimate the ℓ1 norm of the columns of M . Let us apply a sketch matrix R ∈ RO(log(n))×Qq1 i=1 ni, whose entries are sampled i.i.d. from the Cauchy dis- tribution, to the left hand side of M . For the i'th col- umn of M , let us define random variables zi Mi, i=1 l = R⊤l,∗ Algorithm 3 ℓ1 tensor product regression 1: procedure L1TRregression(A, b, ǫ, δ) 2: a R i=1 ni wi )×n. tensorsketch Construct ∈ (mQq Run Condition(A) using S to compute U/(dγp). Generate a Gaussian matrix G ∈ Rd×O(log(n)) for for each column e in U G do and a Cauchy sketch matrix R ∈ Rlog(n)×n. S end for Reshape Ae to M (Eq. 3). Compute λi and λe =Pi λi (Eq 4 and 5). for i ∈ [pQq Sample a column (AU G)∗,e with probabil- ⊲ e ∈ [O(log(n))] Reshape (AU G)∗,e to M , sample a column i=1 wi poly(d)] do ity proportional to λe. . Sample an entry Mk,j with probability pro- M∗,j with probability proportional to λj. portional to Mk,j. row index in A, denoted as ri. end for Convert (k, j) back to the corresponding 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: where D is a diagonal matrix to select the r1, r2, ..., rN -th rows of A and b with N = ex ← minx kD(A1 ⊗ A2 ⊗ ··· ⊗ Aq)x − Dbk1, pQq ⊲ex ∈ Rd1d2···dq return ex i=1 wi poly(d). 16: 17: end procedure l=1 l}O(log n) for l ∈ [O(log(n))], where Rl,∗ is the l'th row of R. Due to the 1-stability property of the Cauchy distri- bution, we have that {zi are O(log n) inde- pendent Cauchys scaled by kMik1. Applying a Cher- noff bound to independent half-Cauchys (see Claims 1, 2 and Lemmas 1, 2 in Indyk (2006)), we have 0.5kMik1 ≤ medianl∈[O(log n)]{zi j} ≤ 1.5kMik1 with probability at least 1 − 2e−cO(log(n)), with constant l}O(log(n)) c ≥ 0.07. Denote the median of {zi as λi. By a union bound over all columns of M , we have that with probability at least 1 − n[q]\[q1]2e−cO(log(n)): l=1 (4) (5) λi = (1 ± 0.5)kMik1,∀i ∈ [n[q]\[q1]], λi = (1 ± 0.5)kAek1 λe = n[q]\[q1]Xi=1 where n[q]\[q1] =Qq i=q1+1 ni. Note that since AU G only has O(log n) columns, we can afford to compute the ℓ1 norm of all the columns using the above procedure. Let us denote the ℓ1 norms of the columns of AU G by λ1, λ2, ..., λO(log n). We can sample a column (AU G)∗,i with probability propor- tional to λi (Line 10 in Alg. 3). Once we sample a column AU G∗,i, we need to sample an entry j ∈ [n] Sketching for Kronecker Product Regression and P-splines with probability proportional to the absolute value of the entry (AU G)j,i. As we cannot afford to compute (AU G)j,i for all j ∈ [n], we use the reshaped 2-d ma- trix M of (AU G)∗,i. Note that sampling an entry in M with probability proportional to the absolute values of entries of M is equivalent to sampling an entry j ∈ [n] from (AU G)∗,i with probability proportional to the ab- solute value of the entries of (AU G)∗,i. We first sample a column M∗,j from all the columns of M with proba- i=q1+1 ni]. We then sample an entry Mk,j with probability proportional to i=1 ni] i=q1+1 ni], the pair (k, j) uniquely deter- mines a corresponding row index r in A, for some i=1 ni]. Hence we successfully sample a row from AU G without ever computing the ℓp norm of the rows. The above sampling procedure is summarized in Line 10 to Line 13 in Alg. 3. We use the above i=1 wi poly(d) rows of A. Let D be a diagonal matrix that selects the corresponding sampled rows from A. We can now solve a smaller ADL problem as minx kDA − Dbk1. Note that our analysis focuses on the ℓ1 norm. We can extend the analysis to general ℓp norms by using a sketching ma- i=1 ni with entries sampled i.i.d. bility proportional to λj for j ∈ [Qq Mk,j for k ∈ [Qq1 and j ∈ [Qq r ∈ [Qq procedure to samplepQq i=1 ni]. Noting that k ∈ [Qq1 trix R ∈ RO(log n)×Qq1 from a p-stable distribution for p ∈ [1, 2]. We now present our main theorem and defer the proofs to the appendix: Theorem 5.4. (Main result) Given ǫ ∈ (0, 1), A ∈ with probability at least 1/2, kAx − bk1 ≤ (1 + ǫ) minx∈Rd kAx − bk1. For the special case when q = 2, n1 = n2, the algorithm's running time is O(n1 Rn×d and b ∈ Rn, Alg. 3 computes bx such that i=1 di/ǫ)). 3/2 poly(Q2 For the special case where q = 2 and n1 = n2, we 3/2 poly( d)), which is faster than O(n1 can see from theorem 5.4 our algorithm computesbx in 2)- time O(n1 the time needed for forming A1 ⊗ A2. Note that we can run Alg. 3 O(log(1/δ)) times independently and pick the best solution among these independent runs to boost the success probability to be 1 − δ, for δ ∈ [0, 1). 6 NUMERICAL EXPERIMENTS We generate matrices A1, A2 and b with all entries sampled i.i.d from a normal distribution. The base- line we compared to is directly solving regression with- out sketching. We let T1 be the time for directly solving the regression problem, and T2 be the time of our algorithm. The time ratio is rt = T2/T1. The relative residual percentage is defined by re = 100 k(A1⊗A2)ex−bk2−k(A1⊗A2)x∗−bkp put of our algorithms and x∗ is the optimal solution. k(A1⊗A2)x∗−bkp , whereex is the out- Table 1: Examples 6.1 and 6.2: the values of re and rt with respect to different sampling parameters m. m 8000 12000 16000 re rt 1.79% 0.11 1.24% 0.18 1.01% 0.25 m 8000 12000 16000 re rt 1.89% 0.06 1.33% 0.11 0.992% 0.18 ℓ1 ℓ2 Throughout the simulations, we use a moderate input matrix size in order to accommodate the brute force algorithm and to compare to the exact solution. Example 6.1 (ℓ2 Regression). We create a design ma- trix with moderate size by fixing n1 = n2 = 300 and d1 = d2 = 15. Thus A ∈ R90000×225. We do 10 rounds to compute the mean values of re and rt, which is re- ported in Table 1 (Left). From Table 1 (left), we can see that when the number m of sampled rows in Algorithm 1 increases from 8000 to 12000, the mean values of re decrease while the mean values of rt increase. In general we can see that we can achieve around 1% relative error while being 5 times faster than the direct method. Example 6.2 (ℓ1 Regression). We set n1 = n2 = 300, d1 = d2 = 15. For minx kAx − bk1, we solve it by a Linear Programming solver in Gurobi (Gurobi Optimization, 2016). We tested different num- bers of sampled rows m (the number of rows in D in Alg. 3). The results are summarized in Table 1 (Right). As we can see from Table 1 (right), our method is around 10 times faster than directly solving the prob- lem, with relative error only around 1%. Example 6.3 (P-Spline Regression). For P-spline re- gression, L3 is fixed. We use 30 knots and cubic B- splines. The data u = (ui) ∈ Rn1, v = (vj ) ∈ Rn2 and b ∈ Rn1n2 are generated i.i.d from the normal distribution. We compute the B-spline basis matrices A1 ∈ Rn1×d1 and A2 ∈ Rn2×d2 separately, if there are d1 and d2 basis functions for the B-spline. We set n1 = n2, d1 = d2, with n1n2 = 104 and d1d2 = 529. The original and sketched P-spline regression problem are both solved by Regularization Tools (Hansen, 1994) via computing their GSVDs. We test different choices of λ. The results are shown in Table 2. From Table 2, sampling only 20% of the rows can give around 0.05% relative error, while the computation time is half of the time of directly solving the p-spline. 7 CONCLUSION We propose algorithms for efficiently solving tensor product least squares regression, regularized P-splines, as well as tensor product least absolute deviation re- gression, using sketching techniques. Our main con- tributions are: (1) we apply tensorsketch to least Diao, Song, Sun, Woodruff Table 2: Example 6.3: the mean values of re and rt with respect to different sampling parameters m and regularization parameters λ. λ 1 0.1 0.01 m 2000 4000 6000 2000 4000 6000 2000 4000 6000 re rt 4.43e-2% 0.52 2.99e-2% 0.70 7.92e-2% 0.91 6.98e-2% 0.47 4.07e-2% 0.72 5.41e-2% 0.94 3.78e-2% 0.46 1.07e-1% 0.71 2.97e-2% 0.95 square regression problems, (2) we propose new statis- tical dimension measures for P-splines, extending the previous statistical dimension defined only for classic Ridge regression, and (3) we extend tensorsketch to ℓp norms and propose an algorithm that can solve tensor product ℓ1 regression in time sublinear in the time for explicitly computing the tensor product. Sim- ulation results support our theorems and demonstrate that our algorithms are much faster than brute-force algorithms and can achieve approximate solutions that are close to optimal. ACKNOWLEDGEMENT Huaian Diao is supported in part by the Fundamental Research Funds for the Central Universities under the grant 2412017FZ007. Wen Sun is supported in part by Office of Naval Research contract N000141512365. References H. Avron, H. Nguyen, and D. Woodruff. Subspace em- In Advances beddings for the polynomial kernel. in Neural Information Processing Systems(NIPS), pages 2258–2266, 2014. H. Avron, K. L. Clarkson, and D. P. Woodruff. Sharper bounds for regression and low-rank approxi- mation with regularization. CoRR, abs/1611.03225, 2016. L. Carter and M. N. Wegman. Universal classes of hash functions. J. Comput. Syst. Sci., 18(2):143– 154, 1979. M. Charikar, K. Chen, and M. Farach-Colton. Finding frequent items in data streams. Theor. Comput. Sci., 312(1):3–15, 2004. D. Chen and R. J. Plemmons. Nonnegativity con- straints in numerical analysis. In The birth of nu- merical analysis, pages 109–139. World Sci. Publ., Hackensack, NJ, 2010. K. Clarkson, P. Drineas, M. Magdon-Ismail, M. Ma- honey, X. Meng, and D. P. Woodruff. The fast Cauchy transform and faster robust linear regres- sion. In SODA, 2013. K. L. Clarkson. Subgradient and sampling algorithms for ℓ1 regression. In Proceedings of the sixteenth an- nual ACM-SIAM symposium on Discrete algorithms (SODA), pages 257–266, 2005. K. L. Clarkson and D. P. Woodruff. Low rank ap- proximation and regression in input sparsity time. In Symposium on Theory of Computing Conference, STOC'13, Palo Alto, CA, USA, June 1-4, 2013, pages 81–90. https://arxiv.org/pdf/1207.6365, 2013. A. Dasgupta, P. Drineas, B. Harb, R. Kumar, and M. W. Mahoney. Sampling algorithms and coresets for ℓp regression. SIAM J. Comput., 38(5):2060– 2078, 2009. P. Drineas, M. Magdon-Ismail, M. W. Mahoney, and D. P. Woodruff. Fast approximation of matrix coher- ence and statistical leverage. CoRR, abs/1109.3843, 2011. P. H. Eilers and B. D. Marx. Multidimensional den- sity smoothing with p-splines. In Proceedings of the 21st international workshop on statistical modelling, 2006. P. H. C. Eilers and B. D. Marx. Flexible smoothing with B-splines and penalties. Statist. Sci., 11(2): 89–121, 1996. P. H. C. Eilers, B. D. Marx, and M. Durb´an. Twenty years of P-splines. SORT, 39(2):149–186, 2015. ISSN 1696-2281. D. W. Fausett and C. T. Fulton. Large least squares problems involving Kronecker products. SIAM J. Matrix Anal. Appl., 15(1):219–227, 1994. G. H. Golub and C. F. Van Loan. Matrix compu- tations. Johns Hopkins Studies in the Mathemati- cal Sciences. Johns Hopkins University Press, Balti- more, MD, 2013. I. Gurobi Optimization. Gurobi optimizer reference manual, 2016. URL http://www.gurobi.com. P. C. Hansen. Regularization tools: A matlab package for analysis and solution of discrete ill-posed prob- lems. Numerical Algorithms, 6(1):1–35, 1994. P. Indyk. Stable distributions, pseudorandom genera- tors, embeddings, and data stream computation. J. ACM, 53(3):307–323, 2006. R. Kannan and S. Vempala. Spectral algorithms. Foundations and Trends in Theoretical Computer Science, 4(3-4):157–288, 2009. Sketching for Kronecker Product Regression and P-splines C. F. Van Loan and N. Pitsianis. Approximation with Kronecker products. In Linear algebra for large scale and real-time applications (Leuven, 1992), volume 232 of NATO Adv. Sci. Inst. Ser. E Appl. Sci., pages 293–314. Kluwer Acad. Publ., Dordrecht, 1993. D. P. Woodruff. Sketching as a tool for numerical lin- ear algebra. Foundations and Trends in Theoretical Computer Science, 10(1-2):1–157, 2014. Y. Zheng, G. Liu, S. Sugimoto, S. Yan, and M. Oku- tomi. Practical low-rank matrix approximation un- der robust l 1-norm. In Computer Vision and Pat- tern Recognition (CVPR), 2012 IEEE Conference on, pages 1410–1417. IEEE, 2012. Y. Liang, M.-F. F. Balcan, V. Kanchanapally, and D. Woodruff. Improved distributed principal com- ponent analysis. In Advances in Neural Information Processing Systems, pages 3113–3121, 2014. M. W. Mahoney. Randomized algorithms for matri- ces and data. Foundations and Trends in Machine Learning, 3(2):123–224, 2011. X. Meng and M. W. Mahoney. Low-distortion sub- space embeddings in input-sparsity time and ap- plications to robust linear regression. In Pro- ceedings of the forty-fifth annual ACM symposium on Theory of computing, pages 91–100. ACM, https://arxiv.org/pdf/1210.3135, 2013. J. Nelson and H. L. Nguyen. Osnap: Faster linear algebra algorithms via sparser numerical subspace embeddings. In 2013 IEEE 54th Annual Symposium on Foundations of Com- puter Science (FOCS), pages 117–126. IEEE, https://arxiv.org/pdf/1211.1002, 2013. S. Oh, S. Kwon and J. Yun. A method for structured linear total least norm on blind deconvolution prob- lem. Applied Mathematics and Computing, 19:151– 164, 2005. R. Pagh. Compressed matrix multiplication. ACM Trans. Comput. Theory, 5(3):9:1–9:17, 2013. M. Patrascu and M. Thorup. The power of simple tabulation hashing. J. ACM, 59(3):14, 2012. N. Pham and R. Pagh. Fast and scalable polynomial kernels via explicit feature maps. In Proceedings of the 19th ACM SIGKDD international conference on Knowledge discovery and data mining(KDD), pages 239–247. ACM, 2013. P. J. Rousseeuw and A. M. Leroy. Robust regression and outlier detection, volume 589. John wiley & sons, 2005. C. Sohler and D. P. Woodruff. Subspace embeddings for the ℓ1-norm with applications. In Proceedings of the forty-third annual ACM symposium on Theory of computing (STOC), pages 755–764. ACM, 2011. Z. Song, D. P. Woodruff, and P. Zhong. Low rank approximation with entrywise ℓ1-norm er- ror. In Proceedings of the 49th Annual Sympo- sium on the Theory of Computing (STOC). ACM, https://arxiv.org/pdf/1611.00898, 2017a. Z. Song, D. P. Woodruff, and P. Zhong. Relative er- ror tensor low rank approximation. arXiv preprint arXiv:1704.08246, 2017b. C. Van Loan. Computational frameworks for the fast Fourier transform, volume 10 of Frontiers in Ap- plied Mathematics. Society for Industrial and Ap- plied Mathematics (SIAM), Philadelphia, PA, 1992. A Background: CountSketch and TensorSketch Diao, Song, Sun, Woodruff i of the output, i = 1, 2, . . . , m is Pjh(j)=i s(j)vj. Note that CountSketch can be represented as an m × n We start by describing the CountSketch transform Charikar et al. (2004). Let m be the target dimension. When applied to n-dimensional vectors, the transform is specified by a 2-wise independent hash function h : [n] → [m] and a 2-wise independent sign function s : [n] → {−1, +1}. When applied to v, the value at coordinate matrix in which the j-th column contains a single non-zero entry s(j) in the h(j)-th row. We now describe the TensorSketch transform Pagh (2013). Suppose we are given points vi ∈ Rni , where i = 1, . . . , q and so φ(v1, . . . , vq) = v1 ⊗ v2 ⊗ ··· ⊗ vq ∈ Rn1n2···nq , and the target dimension is again m. The transform is specified using q 3-wise independent hash functions hi : [ni] → [m], and q 4-wise independent sign functions si : [ni] → {+1,−1}, where i = 1, . . . , q. TensorSketch applied to v1, . . .⊗ vq is then CountSketch applied to φ(v1, . . . , vq) with hash function H : [n1n2 ··· nq] → [m] and sign function S : [n1n2 ··· nq] → {+1,−1} defined as follows: and H(i1, . . . , iq) = h1(i1) + h2(i2) + ··· + hq(iq) mod m, S(i1, . . . , iq) = s1(i1) · s2(i2)··· sq(iq), is 3-wise in- where ij ∈ [nj]. dependent Carter and Wegman (1979); Patrascu and Thorup (2012). Unlike the work of Pham and Pagh Pham and Pagh (2013), which only used that H was 2-wise independent, our analysis needs this stronger property of H. if H is constructed this way, is well-known that then it It The TensorSketch transform can be applied to v1, . . . , vq without computing φ(v1, . . . , vq) as follows. Let vj = (vjℓ ) ∈ Rnj . First, compute the polynomials pℓ(x) = B−1Xi=0 xi Xjℓhℓ(jℓ)=i vjℓ · sℓ(jℓ), for ℓ = 1, 2, . . . , q. A calculation Pagh (2013) shows qYℓ=1 pℓ(x) mod (xB − 1) = xi B−1Xi=0 X vj1 ··· vjq S(j1, . . . , jq), (j1,...,jq)H(j1,...,jq)=i the q polynomials mod (xm − 1) is, the coefficients of that form the value of TensorSketch(v1, . . . , vq). Pagh observed that this product of polynomials can be computed in O(qm log m) time using the Fast Fourier Transform. As it takes O(q max(nnz(vi))) time to form the q polynomials, the overall time to compute TensorSketch(v) is O(q(max(nnz(vi)) + m log m)). the product of B TensorSketch is an Oblivious Subspace Embedding (OSE) Let S be the m × (n1n2 ··· nq) matrix such that TensorSketch (v1, . . . , vq) is S · φ(v1, . . . , vq) for a randomly selected TensorSketch. Notice that S is a random matrix. In the rest of the paper, we refer to such a matrix as a TensorSketch matrix with an appropriate number of rows, i.e., the number of hash buckets. We will show that S is an oblivious subspace embedding for subspaces in Rn1n2···nq for appropriate values of m. Notice that S has exactly one non-zero entry per column. The index of the non-zero in the column (i1, . . . , iq) is j=1 hj(ij) mod m. Let δa,b be the indicator random variable of whether Sa,b is non-zero. The j=1 sj(ij). We show that the embedding matrix S of TensorSketch can be used to approximate matrix product and is an oblivious subspace embedding (OSE). Theorem B.1. Let S be the m × (n1n2 ··· nq) matrix such that H(i1, . . . , iq) =Pq sign of the non-zero entry in column (i1, . . . , iq) is S(i1, . . . , iq) = Qq TensorSketch(v1, . . . , vq) is S · φ(v1, . . . , vq) for a randomly selected TensorSketch. The matrix S satisfies the following two properties. Sketching for Kronecker Product Regression and P-splines 1. (Approximate Matrix Product :) Let A and B be matrices with n1n2 ··· nq rows. For m ≥ (2 + 3q)/(ǫ2δ), we have Pr S (cid:2)kA⊤S⊤SB − A⊤Bk2 F ≤ ǫ2kAk2 FkBk2 F(cid:3) ≥ 1 − δ. 2. (Subspace Embedding :) Consider a fixed k-dimensional subspace V . If m ≥ k2(2 + 3q)/(ǫ2δ), then with probability at least 1 − δ, kSxk = (1 ± ǫ)kxk simultaneously for all x ∈ V . We establish the theorem via two lemmas as in Avron et al. (2016). The first lemma proves the approximate matrix product property via a careful second moment analysis. Lemma B.2 (Approximate matrix product). Let A and B be matrices with n1n2 ··· nq rows. For m ≥ (2 + 3q)/(ǫ2δ), we have Pr S (cid:2)kA⊤S⊤SB − A⊤Bk2 F ≤ ǫ2kAk2 FkBk2 F(cid:3) ≥ 1 − δ. Proof. The proof follows that in Avron et al. (2016). Let C = A⊤S⊤SB. We have Cu,u′ = mXt=1 Xi,j∈[n1n2···nq] S(i)S(j)δt,iδt,jAi,uBj,u′ = mXt=1 Xi6=j∈[n1n2···nq] S(i)S(j)δt,iδt,iAi,uBj,u′ + (A⊤B)u,u′ Thus, E[Cu,u′ ] = (A⊤B)u,u′ . Next, we analyze E[((C − A⊤B)u,u′ )2]. We have ((C − A⊤B)u,u′ )2 = mXt1,t2=1 X i16=j1,i26=j2∈[n1n2···nq] S(i1)S(i2)S(j1)S(j2) · δt1,i1 δt1,j1 δt2,i2δt2,j2 · Ai1,uAi2,uBj1,u′Bj2,u′ For a term in the summation on the right hand side to have a non-zero expectation, it must be the case that E[S(i1)S(i2)S(j1)S(j2)] 6= 0. Note that S(i1)S(i2)S(j1)S(j2) is a product of random signs (possibly with multiplicities) where the random signs in different coordinates in {1, . . . , q} are independent and they are 4-wise independent within each coordinate. Thus, E[S(i1)S(i2)S(j1)S(j2)] is either 1 or 0. For the expectation to be 1, all random signs must appear with even multiplicities. In other words, in each of the q coordinates, the 4 coordinates of i1, i2, j1, j2 must be the same number appearing 4 times or 2 distinct numbers, each appearing twice. All the subsequent claims in the proof regarding i1, i2, j1, j2 agreeing on some coordinates follow from this property. Let S1 be the set of coordinates where i1 and i2 agree. Note that j1 and j2 must also agree in all coordinates in S1 by the above argument. Let S2 ⊂ [q] \ S1 be the coordinates among the remaining where i1 and j1 agree. Finally, let S3 = [q] \ (S1 ∪ S2). All coordinates in S3 of i1 and j2 must agree. Similarly as before, note that i2 and j2 agree on all coordinates in S2 and i2 and j1 agree on all coordinates in S3. We can rewrite i1 = (a, b, c), i2 = (a, e, f ), j1 = (g, b, f ), j2 = (g, e, c) where a = (aℓ), g = (gℓ) with ℓ ∈ S1, b = (bℓ), e = (eℓ) with ℓ ∈ S2 and c = (cℓ), f = (fℓ) with ℓ ∈ S3. First we show that the contribution of the terms where i1 = i2 or i1 = j2 is bounded by 2kAuk2 , where Au is the uth column of A and Bu′ is the u′th column of B. Indeed, consider the case i1 = i2. As observed before, we must have j1 = j2 to get a non-zero contribution. Note that if t1 6= t2, we always have δt1,i1δt2,i2 = 0 as H(i1) cannot be equal to both t1 and t2. Thus, for fixed i1 = i2, j1 = j2, 2kBu′k2 m 2 S(i1)S(i2)S(j1)S(j2) · δt1,i1 δt1,j1 δt2,i2 δt2,j2 · Ai1,uAi2,uBj1,u′ Bj2,u′# E" mXt1,t2=1 = E" mXt1=1 = A2 i1,uB2 m j1,u′ i1,t1δ2 δ2 j1,t1A2 i1,uB2 j1,u′# Diao, Song, Sun, Woodruff Summing over all possible values of i1, j1, we get the desired bound of kAuk2 . The case i1 = j2 is analogous. Next we compute the contribution of the terms where i1 6= i2, j1, j2 i.e., there are at least 3 distinct numbers among i1, i2, j1, j2. Notice that E[δt1,i1δt1,j1δt2,i2 δt2,j2 ] ≤ 1 m3 because the δt,i's are 3-wise independent. For fixed i1, j1, i2, j2, there are m2 choices of t1, t2 so the total contribution to the expectation from terms with the same i1, j1, i2, j2 is bounded by m2 · 1 Therefore, m3 · Ai1,uAi2,uBj1,u′ Bj2,u′ = 1 mAi1,uAi2,uBj1,u′Bj2,u′. 2kBu′k2 m 2 A(a,b,c),uB(g,b,f ),u′A(a,e,f ),uB(g,e,c),u′ 2 E[((C − A⊤B)u,u′ )2] 2kBu′k2 2kAuk2 1 m 2kBu′k2 2kAuk2 m 3q + + 2 2kBu′k2 2kAuk2 m 2 2kBu′k2 2kAuk2 m 2 2kBu′k2 2kAuk2 m 2 2kBu′k2 2kAuk2 m 2 2kBu′k2 2kAuk2 m 2 + + + + + (2 + 3q)kAuk2 2kBu′k2 2 m , ≤ ≤ ≤ = ≤ = ≤ = 3q m Xpartition S1,S2,S3 Xa,g,b,e,c,f m Xa,b,c,g,e,f m Xg,e,f(cid:18)Xa,b,c m Xg,e,f(cid:18)Xb m Xe (cid:18)Xb,g,f 3qkAuk 3qkAuk B2 A2 (a,b,c),u(cid:19)1/2(cid:18)Xa,b,c 3qkAuk · kBu′k m 3qkAuk · kBu′k m A(a,b,c),uB(g,b,f ),u′A(a,e,f ),uB(g,e,c),u′ B2 (g,b,f ),u′ A2 (a,e,f ),uB2 (g,e,c),u′(cid:19)1/2 (g,e,c),u′(cid:19)1/2 (g,e,c),u′(cid:19)1/2 (a,e,f ),uB2 (a,e,f ),uB2 A2 A2 B2 (g,b,f ),u′(cid:19)1/2(cid:18)Xa,c (g,b,f ),u′(cid:19)1/2(cid:18) Xa,c,g,f Xe (cid:18)Xa,f (a,e,f ),u(cid:19)1/2(cid:18)Xg,c (cid:18)Xa,e,f (a,e,f ),u(cid:19)1/2(cid:18)Xg,e,c A2 A2 B2 B2 (g,e,c),u′(cid:19)1/2 (g,e,c),u′(cid:19)1/2 where the second inequality follows from the fact that there are at most 3q partitions of [q] into 3 sets. The other inequalities are from Cauchy-Schwarz. Combining the above bounds, we have E[((C − A⊤B)u,u′ )2] ≤ (2+3q)kAuk2 Markov inequality, kA⊤S⊤SB − A⊤Bk2 2kBu′k2 F with probability 1 − δ. F ≤ ǫ2kAk2 FkBk2 m 2 . For m ≥ (2 + 3q)/(ǫ2δ), by the The second lemma proves that the subspace embedding property follows from the approximate matrix product property. Lemma B.3 (Oblivious subspace embeddings). Consider a fixed k-dimensional subspace V ⊂ Rn1n2···nq . If m ≥ k2(2 + 3q)/(ǫ2δ), then with probability at least 1 − δ, kSxk2 = (1 ± ǫ)kxk2 simultaneously for all x ∈ V . Proof. Let B be a (n1n2 ··· nq) × k matrix whose columns form an orthonormal basis of V . Thus, we have B⊤B = Ik and kBk2 F = k. The condition that kSxk2 = (1 ± ǫ)kxk2 simultaneously for all x ∈ V is equivalent to the condition that the singular values of SB are bounded by 1 ± ǫ. By Lemma B.2, for m ≥ (2 + 3q)/((ǫ/k)2δ), with probability at least 1 − δ, we have kB⊤S⊤SB − B⊤Bk2 F ≤ (ǫ/k)2kBk4 F = ǫ2 Thus, we have kB⊤S⊤SB − Ikk2 ≤ kB⊤S⊤SB − IkkF ≤ ǫ. In other words, the squared singular values of SB are bounded by 1 ± ǫ, implying that the singular values of SB are also bounded by 1 ± ǫ. Note that kAk2 for a matrix A denotes its operator norm. Sketching for Kronecker Product Regression and P-splines C Missing Proofs C.1 Proofs for Tensor Product Least Square Regression Theorem 3.1. (Tensor regression) Suppose ex is the output of Algorithm 1 with tensorsketch S ∈ Rm×n, where m = 8(d1d2 ··· dq + 1)2(2 + 3q)/(ǫ2δ). Then the following approximation k(A1 ⊗ A2 ⊗ ··· ⊗ Aq)ex − bk2 ≤ (1 + ǫ) OPT, holds with probability at least 1 − δ. Proof. It is easy to see that k(A1 ⊗ A2 ⊗ ··· ⊗ Aq)x − bk2 =(cid:13)(cid:13)(cid:13)(cid:13)(cid:2)(A1 ⊗ A2 ⊗ ··· ⊗ Aq) b(cid:3)(cid:20) x −1(cid:21) ∈ Rn1n2···nq y =(cid:2)(A1 ⊗ A2 ⊗ ··· ⊗ Aq) , −1(cid:21)(cid:13)(cid:13)(cid:13)(cid:13)2 b(cid:3)(cid:20) x and identifying and y is a vector of a subspace V ⊂ Rn1n2···nq with dimension at most d1d2 ··· dq + 1, we can use Lemma B.3 to conclude that when m = (d1d2 ··· dq + 1)2(2 + 3q)/(ǫ2δ). Thus we have Pr [kSyk2 − kyk2 ≤ ǫkyk2] ≥ 1 − δ k(A1 ⊗ A2 ⊗ ··· ⊗ Aq)ex − bk2 ≤ 1 1 − ǫkS(A1 ⊗ A2 ⊗ ··· ⊗ Aq)ex − Sbk2 and kS(A1 ⊗ A2 ⊗ ··· ⊗ Aq)x − Sbk2 ≤ (1 + ǫ)k(A1 ⊗ A2 ⊗ ··· ⊗ Aq)x − bk2 hold with probability at least 1 − δ. Then using a union bound, we have 1 1 k(A1 ⊗ A2 ⊗ ··· ⊗ Aq)ex − bk2 1 − ǫkS(A1 ⊗ A2 ⊗ ··· ⊗ Aq)ex − Sbk2 1 − ǫkS(A1 ⊗ A2 ⊗ ··· ⊗ Aq)x − Sbk2 1 − ǫk(A1 ⊗ A2 ⊗ ··· ⊗ Aq)x − bk2 1 + ǫ ≤ ≤ ≤ holds with probability at least 1 − 2δ. Corollary 3.2. (Sketch for tensor nonnegative regression) Suppose x = minx≥0 kSAx − Sbk2 with tensors- ketch S ∈ Rm×n, where m = 8(d1d2 ··· dq +1)2(2+3q)/(ǫ2δ). Then the following approximation k(A1⊗A2⊗···⊗ Aq)ex−bk2 ≤ (1+ǫ) OPT holds with probability at least 1−δ, where OPT = minx≥0 k(A1 ⊗ A2 ⊗ ··· ⊗ Aq)x − bk2. Proof. The proof of Theorem. 3.2 is similar to the proof of theorem 3.1. Denote x = minx≥0 kSAx − Sbk2 and x∗ = minx≥0 kAx − bk2. Using Lemma. B.3, we have: with probability at least 1 − δ, and kAx − bk2 ≤ 1 1 − ǫkSAx − Sbk2, kSAx∗ − Sbk2 ≤ (1 + ǫ)kAx∗ − bk2, (6) (7) Diao, Song, Sun, Woodruff with probability at least 1 − δ. Hence applying a union bound we have: ≤ ≤ ≤ with probability at least 1 − 2δ. C.2 Proofs for P-Splines 1 1 kAx − bk2 1 − ǫkSAx − Sbk2 1 − ǫkSAx∗ − Sbk2 1 − ǫkAx∗ − bk2, 1 + ǫ (8) (9) Lemma 4.1. Let x∗ ∈ Rd, A ∈ Rn×d and b ∈ Rn as above. Let U1 ∈ Rn×d denote the first n rows of an orthogonal basis for h A√λLi ∈ R(n+p)×d. Let sketching matrix S ∈ Rm×n have a distribution such that with constant probability and (I) kU⊤1 S⊤SU1 − U⊤1 U1k2 ≤ 1/4, (II) kU⊤1 (S⊤S − I)(b − Ax∗)k2 ≤pǫ OPT /2. 2 + λkLxk2 2. Then with probability at least 9/10, Let ex denote argminx∈RdkS(Ax − b)k2 Proof. Let A ∈ R(n+d)×d have orthonormal columns with range( A) = range(h A√λLi). (An explicit expression for one such A is given below.) Let b ≡(cid:2) b kAex − bk2 0d(cid:3). We have 2 + λkLexk2 2 ≤ (1 + ǫ) OPT . (10) min y∈Rdk Ay − bk2 2, , in the sense that for any Ay ∈ range( A), there is x ∈ Rd with Ay =h A√λLi x, √λLx∗i. 2. Let y∗ = argminy∈Rdk Ay−bk2, so that Ay∗ =h Ax∗ 2 = kb−Axk2 2+λkLxk2 2 + λkLxk2 2 = kh A√λLi x−bk2 equivalent to kb − Axk2 so that k Ay−bk2 Let A =(cid:2) U1 We define S to beh S 0m×d U2(cid:3), where U1 ∈ Rn×d and U2 ∈ Rd×d, so that U1 is as in the lemma statement. Id i and S satisfies Property (I) and (II) of Lemma 4.1. 0d×n Using kU⊤1 S⊤SU1 − U⊤1 U1k2 ≤ 1/4, with constant probability k A⊤ S⊤ S A − Idk2 = kU⊤1 S⊤SU1 + U⊤2 U2 − Idk2 = kU⊤1 S⊤SU1 − U⊤1 U1k2 ≤ 1/4. (11) Using the normal equations for Eq. (10), we have 0 = A⊤(b − Ay∗) = U⊤1 (b − Ax∗) − √λU⊤2 x∗, and so A⊤ S⊤ S(b − Ay∗) = U⊤1 S⊤S(b − Ax∗) − √λU⊤2 x∗ = U⊤1 S⊤S(b − Ax∗) − U⊤1 (b − Ax∗). Using Property (II) of Lemma 4.1, with constant probability k A⊤ S⊤ S(b − Ay∗)k2 = kU⊤1 S⊤S(b − Ax∗) − U⊤1 (b − Ax∗)k2 ≤pǫ OPT /2 =pǫ/2kb − Ay∗k2. (12) Sketching for Kronecker Product Regression and P-splines It follows by a standard result from (11) and (12) that the solution y ≡ argminy∈Rdk S( Ay−b)k2 has k Ay−bk2 ≤ (1 + ǫ) miny∈Rdk Ay − bk2, and therefore that x satisfies the claim of the theorem. For convenience we give the proof of the standard result: (11) implies that A⊤ S⊤ S A has smallest singular value at least 3/4. The normal equations for the unsketched and sketched problems are A⊤(b − Ay∗) = 0 = A⊤ S⊤ S(b − Ay). The normal equations for the unsketched case imply k Ay − bk2 show that k A(y − y∗)k2 2 ≤ ǫ OPT. We have 2 = ky − y∗k2 2 = k A(y − y∗)k2 2 + kb − Ay∗k2 2, so it is enough to (3/4)ky − y∗k2 ≤ k A⊤ S⊤ S A(y − y∗)k2 = k A⊤ S⊤ S A(y − y∗) − A⊤ S⊤ S(b − Ay)k2 = k A⊤ S⊤ S(b − Ay∗)k2 ≤pǫ OPT /2 so that ky − y∗k2 2 ≤ (4/3)2ǫ OPT /2 ≤ ǫ OPT. The lemma follows. by Eq. (11) by Normal Equation by Eq. (12), The following lemma computes the statistical dimension sdλ(A, L) that will be used for computing the number of rows of sketching matrix S. Lemma C.1. For U1 as in Lemma 4.1, kU1k2 values σi. Also kU1k2 = max{1/p1 + λ/γ2 1 , 1}. F = sdλ(A, L) =Pi 1/(1 + λ/γ2 i ) + d − p, where A has singular Proof. Suppose we have the GSVD of (A, L). Let Then . 0(n−p)×p D ≡(cid:20)Σ⊤Σ + λΩ⊤Ω 0p×(n−p) A =  U 0p×(n−p) D  0(n−p)×p Id−p √λVhΩ 0p×(n−p)iD Id−p (cid:21)−1/2  Σ 2 F Σ Σ 0p×(n−p) 0p×(n−p) 0(n−p)×p 0(n−p)×p =(cid:13)(cid:13)(cid:13)(cid:13)(cid:20) Id−p (cid:21) D(cid:13)(cid:13)(cid:13)(cid:13) has A⊤ A = Id, and for given x, there is y = D−1RQ⊤x with Ay = h A√λLi x. We have kU1k2 (cid:13)(cid:13)(cid:13)(cid:13)U(cid:20) Theorem 4.3. (P-Spline regression) There is a constant K > 0 such that for m ≥ K(ǫ−1 sdλ(A, L)+sdλ(A, L)2) and S ∈ Rm×n a sparse embedding matrix (e.g., Countsketch) with SA computable in O(nnz(A)) time, Prop- erty (I) and (II) of Lemma 4.1 apply, and with constant probability the correspondingex = argminx∈RdkS(Ax − b)k2 + λkLxk2 Proof. Recall that sdλ(A, L) = kU1k2 multiplication 2 is an ǫ-approximate solution to minx∈Rdkb − Axk2 F . Sparse embedding distributions satisfy the bound for approximate matrix Id−p (cid:21) D(cid:13)(cid:13)(cid:13)(cid:13) i ) + d − p as claimed. 2 + λkLxk2 2. =Pp i=1 1/(1 + λ/γ2 F = 2 F kW ⊤S⊤SH − W ⊤HkF ≤ CkWkFkHkF /√m, for a constant C (Clarkson and Woodruff, 2013; Meng and Mahoney, 2013; Nelson and Nguyen, 2013); this is also true of OSE matrices. We set W = H = U1 and use kXk2 ≤ kXkF for all X and m ≥ KkU1k4 F to obtain Property (I) of Lemma 4.1, and set W = U1, H = b − Ax∗ and use m ≥ KkU1k2 F /ǫ to obtain Property (II) of Lemma 4.1. (Here the bound is slightly stronger than Property (II), holding for λ = 0.) With Property (I) and Property (II), the claim for x from a sparse embedding follows using Lemma 4.1. C.3 Proofs for Tensor Product ℓ1 Regression Diao, Song, Sun, Woodruff Lemma 5.3. For any p ≥ 1. Condition(A) computes AU/(dγp) which is an (α, β√3d(tw)1/p−1/2, p)-well- conditioned basis of A, with probability at least 1 −Qq for completeness. Applying Theorem 5.2, we have that with probability at least 1−Qq i=1 ni/wi ]⊤, then for all i ∈ [Qq Proof. This lemma is similar to arguments in Clarkson et al. (2013), we simply adjust notation and parameters i=1(ni/wi)δ, for all x ∈ Rr, i=1 ni/wi], if we consider y = Ax and write y⊤ = [z⊤1 , z⊤2 , . . . , zQq i=1(ni/wi)δ. where Si ∈ Rmi×Qq we have i=1 wi . In the following, suppose mi = t. By relating the 2-norm and the p-norm, for 1 ≤ p ≤ 2, 2kzik2, 2kzik2 ≤ kSizik2 ≤q 3 q 1 kSizikp ≤ t1/p−1/2kSzik2 ≤ t1/p−1/2q 3 2kzik2 ≥q 1 kSizikp ≥ kSizik2 ≥q 1 and similarly, If p > 2, then and similarly, kSizikp ≤ kSizik2 ≤q 3 2kzik2 ≤q 3 kSizikp ≥ t1/p−1/2kSizik2 ≥ t1/p−1/2q 1 p = Pi kSizikp p = Pi kzikp 2 w1/2−1/pkAxkp ≤ kSAxkp ≤q 3 q 1 q 1 2 t1/p−1/2kAxkp ≤ kSAxkp ≤q 3 p and kSAxkp i=1(ni/wi)δ Since kAxkp p = kykp i=1(ni/wi)δ 1 −Qq and for p ∈ [2,∞) with probability 1 −Qq In either case, 2kzik2 ≤ t1/p−1/2q 3 qYj=1 2 w1/2−1/pkzikp, w = 2kzikp, wj. 2 w1/2−1/pkzikp, 2kzik2 ≥ t1/p−1/2q 1 2kzikp. 2 t1/p−1/2kAxkp, 2 w1/2−1/pkAxkp. p, for p ∈ [1, 2] we have with probability kAxkp ≤ γpkSAxkp ≤ √3(tw)1/p−1/2kAxkp. We have, from the definition of an (α, β, p)-well-conditioned basis, that and for all x ∈ Rd, kSAUkp ≤ α kxkq ≤ βkSAU xkp. kAU/(rγp)kp ≤Xi Combining (13) and (14), we have that with probability at least 1 −Qq Combining (13) and (15), we have that with probability at least 1 −Qq kxkq ≤ βkSAU xkp ≤ β√3r(tw)1/p−1/2kAU Hence AU/(rγp) is an (α, β√3r(tw)1/p−1/2, p)-well-conditioned basis. kAUi/rγpkp ≤Xi i=1(ni/wi)δ, kSAUi/rkp ≤ α. i=1(ni/wi)δ, for all x ∈ Rr, 1 rγp xkp. (13) (14) (15) Sketching for Kronecker Product Regression and P-splines i=1 di/ǫ)). k=1 nnz(A(k) ik 3/2 poly(Q2 i=q1+1 di. For any row-block A1 probability at least 1/2, kAx − bk1 ≤ (1 + ǫ) minx∈Rd kAx − bk1. For the special case when q = 2, n1 = n2, the algorithm's running time is O(n1 Theorem 5.4. (Main result) Given ǫ ∈ (0, 1), A ∈ Rn×d and b ∈ Rn, Alg. 3 computes bx such that with Proof. For notational simplicity, let us denote n[q1] = Qq1 d[q]\[q1] = Qq i1 ⊗ . . . ⊗ A(q) O(d(Pq i=q1+1 n1, d[q1] = Qq1 i1 ⊗ . . . ⊗ A(q−1) )) + dqm log(m)) (see Sec 2). Hence for SA, it takes: i=1 ni, n[q]\[q1] = Qq qYi=1 where S ∈ R(mQq i (2 + 3q)/ǫ2 = O(poly(d/ǫ)). We need to compute an orthogonal factorization SA = QRA in O(qmd2) and then compute U = R−1 in O(d3) time. Hence the total A running time of Algorithm Condition(A) is O(qmd2 + d3). Thus the total running time of computing SA and Condition(A) is qYi∈[q]\{k} qXk=1 i=1 wi and m ≥ 100Qq ni/wi + dqm log(m) iq , computing Si1i2...iq (A1 ni/wi! i=1(ni/wi))×Qq i=1 di, and ) takes iq d nnz(Ak) i=1 d2 nnz(Ak) qYi∈[q]\{k} O qXk=1 ni/wi + qYi=1 ni/wi! poly(d/ǫ) + qmd2 + d3 , We will compute U G in O(d2 log n) time. We compute eE = E(Aq1+1 ⊗ . . . ⊗ Aq)T in O(dn[q]\[q1]) time. Then we can compute R(A1 ⊗ ··· ⊗ Aq1 )eEj in O(n[q1]d[q1] log n + d[q1]n[q]\[q1] log n) time. Since computation of the median λi takes O(log n) time, computing all λi and then λe takes O(n[q]\[q1] log n) time. As AU G has O(log n) columns, we need to compute λe for each AU G using the above procedure and hence it takes in total O(d(n[q1] + n[q]\[q1]) log2 n) time. Sampling a column of AU G using λe takes O(log n) time, sampling an entry in M takes in total O(n[q1] + n[q]\[q1]) time. k=1 wk poly(r) samples to select rows, the running time is d(n[q1] + n[q]\[q1]) log2 n · Now for simplicity, we set q = 2, ni = n0 for i ∈ [2]. Note that it is optimal to choose wi = w for i ∈ [2]. Substituting q = 2, ni = n0 and wi = w, we that the total running time of Alg. 3: O(cid:0)dw−1n0(nnz(A1) + nnz(A2)) + w−2n2 0 poly(d/ǫ) + wn0 poly(d) log(n)(cid:1) . For dense A1 and A2, nnz(A1) + nnz(A2) = O(n0) time, and so ignoring poly and log terms that do not depend on n0, the total running time can be simplified to: Setting w = √n0, we can minimize the above running time to O(n3/2 solving the problem by forming A1 ⊗ A2. 0 ), which is faster than the n2 0 time for O(w−1n2 0 + wn0). Since we need pQq pQq k=1 wk poly(r).
1804.02269
2
1804
2019-05-06T14:15:28
A Subquadratic Approximation Scheme for Partition
[ "cs.DS" ]
The subject of this paper is the time complexity of approximating Knapsack, Subset Sum, Partition, and some other related problems. The main result is an $\widetilde{O}(n+1/\varepsilon^{5/3})$ time randomized FPTAS for Partition, which is derived from a certain relaxed form of a randomized FPTAS for Subset Sum. To the best of our knowledge, this is the first NP-hard problem that has been shown to admit a subquadratic time approximation scheme, i.e., one with time complexity of $O((n+1/\varepsilon)^{2-\delta})$ for some $\delta>0$. To put these developments in context, note that a quadratic FPTAS for \partition has been known for 40 years. Our main contribution lies in designing a mechanism that reduces an instance of Subset Sum to several simpler instances, each with some special structure, and keeps track of interactions between them. This allows us to combine techniques from approximation algorithms, pseudo-polynomial algorithms, and additive combinatorics. We also prove several related results. Notably, we improve approximation schemes for 3SUM, (min,+)-convolution, and Tree Sparsity. Finally, we argue why breaking the quadratic barrier for approximate Knapsack is unlikely by giving an $\Omega((n+1/\varepsilon)^{2-o(1)})$ conditional lower bound.
cs.DS
cs
A Subquadratic Approximation Scheme for Partition Marcin Mucha∗ Karol Węgrzycki∗ Michał Włodarczyk∗ The subject of this paper is the time complexity of approximating Knapsack, Subset Abstract time randomized FPTAS for Partition, which is derived from a certain relaxed form of a randomized FPTAS for Subset Sum. To the best of our knowledge, this is the first NP-hard problem that has been shown to admit a subquadratic time approximation scheme, i.e., one Sum, Partition, and some other related problems. The main result is an eO(n + 1/ε5/3) with time complexity of O((n + 1/ε)2−δ) for some δ > 0. To put these developments in context, note that a quadratic FPTAS for Partition has been known for 40 years. Our main contribution lies in designing a mechanism that reduces an instance of Subset Sum to several simpler instances, each with some special structure, and keeps track of interactions between them. This allows us to combine techniques from approximation algorithms, pseudo- polynomial algorithms, and additive combinatorics. We also prove several related results. Notably, we improve approximation schemes for 3SUM, (min, +)-convolution, and TreeSparsity. Finally, we argue why breaking the quadratic barrier for approximate Knapsack is unlikely by giving an Ω((n + 1/ε)2−o(1)) conditional lower bound. ∗Institute of Informatics, University of Warsaw, Poland, {mucha, k.wegrzycki, m.wlodarczyk}@mimuw.edu.pl 1 Introduction The Knapsack-type problems are among the most fundamental optimization challenges. These problems have been studied for more than a century already, as their origins can be traced back to the 1897's paper by Mathews [52]. The Knapsack problem is defined as follows: Definition 1.1 (Knapsack). Given a set of n items En = {1, . . . , n}, with item j having a positive integer weight wj and value vj, together with knapsack capacity t. Select a subset of items E ⊆ En, such that the corresponding total weight w(E) = Pi∈E wi does not exceed the capacity t and the total value v(E) =Pi∈E vi is maximized. Knapsack is one of the 21 problems featured in Karp's list of NP-complete problems [43]. We also study the case where we are allowed to take each element multiple times, called Unbounded Knapsack. Let Σ(S) denote the sum of elements S. Subset Sum is defined as follows: Definition 1.2 (Subset Sum). Given a set S ⊂ N of n numbers (sometimes referred to as items) and an integer t, find a subset S′ ⊆ S with maximal Σ(S′) that does not exceed t. Subset Sum is a special case of Knapsack, where item weights are equal to item values. This problem is NP-hard as well. In fact, it remains NP-hard even if we fix t to be Σ(S)/2. This problem is called the Number Partitioning Problem (or Partition, as we will refer to it): Definition 1.3 (Partition). Given a set S ⊂ N of n numbers, find a subset S′ ⊆ S with maximal Σ(S′) not exceeding Σ(S)/2. The practical applications of Partition problem range from scheduling [42] to minimization of circuits sizes, cryptography [53], or even game theory [35, 54]. The decision version of this problem is sometimes humorously referred to as "the easiest NP-complete problem" [35]. In this paper we will demonstrate that there is a grain of truth in this claim. All the aforementioned problems are weakly NP-hard and admit pseudo-polynomial time algo- rithms. The first such an algorithm for the Knapsack was proposed by Bellman [15] and runs in time O(nt). This bound was improved for the Subset Sum [48] and the current best (randomized) results see Section 2). The strong dependence on t in all of these algorithms makes them impractical for a large t (note that t can be exponentially larger than the size of the input). This dependence time complexity for this problem is eO(n + t), due to Bringmann [17] (for more on these and related has been shown necessary as an O(cid:0)poly(n)t0.99(cid:1) algorithm for the Subset Sum would contradict both the SETH [4] and the SetCover conjecture [23]. One possible approach to avoid the dependence on t is to settle for approximate solutions. The notion of approximate solution we focus on in this paper is that of a Polynomial Time Approximation Scheme (PTAS). A PTAS for a maximization problem is an algorithm that, given an instance of size n and a parameter ε > 0, returns a solution with value S, such that OPT(1 − ε) ≤ S ≤ OPT. It also needs to run in time polynomial in n, but not necessarily in 1/ε (so, e.g., we allow time complexities like O(n1/ε)). A PTAS is a Fully Polynomial Time Approximation Scheme (FPTAS) if it runs in time polynomial in both n and 1/ε. Equivalently, one can require the running time to be polynomial in (n + 1/ε). For example, O(n2/ε4) = O((n + 1/ε)6). For definitions of problems in both exact and approximate sense see Appendix C. The first approximation scheme for Knapsack (as well as Subset Sum and Partition as spe- cial cases) dates back to 1975 and is due to Ibarra and Kim [39]. Its running time is O(n/ε2). After 1 a long line of improvements [29, 30, 45, 44, 50, 47], the current best algorithms for each problem are: the O(min{n/ε, n+1/ε2}) algorithm for Partition due to [31], the O(min{n/ε, n+1/ε2 log (1/ε)}) algorithm for Subset Sum due to [46] and, a very recent eO(n + 1/ε12/5) for Knapsack, due to [19]. Observe that all of these algorithms work in Ω((n + 1/ε)2) time. In fact, we are not aware of the existence of any FPTAS for an NP-hard problem working in time O((n + 1/ε)2−δ). Open Question 1. Can we get an O((n + 1/ε)2−δ) FPTAS for any Knapsack-type problem (or any other NP-hard problem) for some constant δ > 0 or justify that it is unlikely? In this paper we resolve this question positively, by presenting the first such algorithm for the Partition problem. This improves upon almost 40 years old algorithm by Gens and Levner [31]. On the other hand, we also provide a conditional lower bound suggesting that similar improvement for the more general Knapsack problem is unlikely. After this paper was announced, Bringmann [18] showed that for any δ > 0, an O((n + 1/ε)2−δ) algorithm for Subset Sum would contradict the (min, +)-convolution-conjecture. This not only shows a somewhat surprising separation between the approximate versions of Partition and Sub- set Sum, but also explains why our techniques do not seem to transfer to approximating Subset Sum. 1.1 Related Work In this paper we avoid the dependence on t by settling on approximate instead of exact solutions. Another approach is to allow running times exponential in n. This line of research has been very active with many interesting results. The naive algorithm for Knapsack works in O∗(2n) time by simply enumerating all possible subsets. Horowitz and Sahni [36] introduced the meet-in-the- middle approach and gave an exact O∗(2n/2) time and space algorithm. Schroeppel and Shamir [56] improved the space complexity of that algorithm to O∗(2n/4). Very recently Bansal et al. [11] showed an O∗(20.86n)-algorithm working in polynomial space. An interesting question (and very relevant for applications in cryptography) is how hard Knap- sack type problems are for random instances. For results in this line of research see [6, 7, 8, 37]. 1.2 History of Approximation Schemes for Knapsack-type problems To the best of our knowledge, the fastest approximation for Partition dates back to 1980 [31] with eO(min{n/ε, n + 1/ε2}) running time1. The majority of later research focused on matching this running time for the Knapsack and Subset Sum. In this section we will present an overview of the history of the FPTAS for these problems. The first published FPTAS for the Knapsack is due to Ibarra and Kim [39]. This naturally In their approach, gives approximations for the Subset Sum and Partition as special cases. the items were partitioned into large and small classes. The profits are scaled down and then the problem is solved optimally with dynamic programming. Finally, the remaining empty space is filled up greedily with the small items. This algorithm has a complexity O(n/ε2) and requires O(n+1/ε3) space.2 Lawler [50] proposed a different method of scaling and obtained O(n + 1/ε4) running time. 1 As is common for Knapsack-type problems, the eO notation hides terms poly-logarithmic in n and 1/ε, but not in t. 2In [47, Section 4.6] there are claims, that 1975 Karp [44] also gives O(n/ε2) approximation for Subset Sum. 2 Knapsack Knapsack Subset Sum Knapsack Partition Subset Sum Subset Sum Knapsack Partition Reference [15] [47] [39, 44] * [32, 29] [50] * [31] [30] * [46] * [19] This Paper O(n2/ε) O(n/ε2) O(n/ε) O(n + 1/ε4) O(n + 1/ε2) O(n + 1/ε3) eO(n + 1/ε2) eO(n + 1/ε12/5) eO(n + 1/ε5/3) Table 1: Brief history of FPTAS for Knapsack-type problems. Since Partition is a special case of Subset Sum, and Subset Sum is a special case of Knapsack, an algorithm for Knapsack also works for Subset Sum and Partition. We omit redundant running time factors for clarity, For a more robust history see [47, Section 4.6]. A star (*) marks the papers that match the previous e.g., [46] actually runs in eO(min{n/ε, n + 1/ε2}) time but [32, 29] gave O(n/ε) algorithm earlier. best eO(cid:0)(n + 1/ε)2(cid:1) complexity for Partition problem. Running Time Problem Later, Gens and Levner [32, 29] obtained an O(n/ε) algorithm for the Subset Sum based on a different technique. Then, in 1980 they proposed an even faster O(min{n/ε, n+1/ε2}) algorithm [31] for the Partition. To the best of our knowledge this algorithm remained the best (until this paper). Subsequently, Gens and Levner [30] managed to generalize their result to Subset Sum with an increase of running time and obtained O(min{n/ε, n + 1/ε3}) time and O(min{n/ε, n + 1/ε2}) space algorithm [30]. Finally, Kellerer et al. [46] improved this algorithm for Subset Sum by giving O(min{n/ε, n + 1/ε2 log (1/ε)}) time and O(n + 1/ε) space algorithm. This result matched (up to the polylogarithmic factors) the running time for Partition. For the Knapsack problem Kellerer and Pferschy [45] gave an O(n min{log n, log (1/ε)} +1/ε2 log (1/ε) min{n, 1/ε log (1/ε)}) time algorithm (note that the exponent in the parameter (n + 1/ε) is 3 here) and for Unbounded Knapsack Jansen and Kraft [40] gave an O(n + 1/ε2 log3 (1/ε)) time algo- rithm (the exponent in (n+1/ε) is 2, see Appendix C for the definition of Unbounded Knapsack). Very recently Chan [19] presented the currently best eO(n + 1/ε12/5) algorithm for the Knapsack. 1.3 Our Contribution Our main result is the design of the mechanism that allows us to merge the pseudo-polynomial time algorithms for Knapsack-type problems with algorithms on dense Subset Sum instances. The most noteworthy application of these reductions is the following. 5 3 ) randomized time FPTAS for Partition. and Levner [31]. Our algorithm also generalizes to a weak (1− ε)-approximation for Subset Sum.3 Theorem 1.5. There is a randomized weak (1 − ε)-approximation algorithm for Subset Sum Theorem 1.4. There is an eO(n + 1/ε This improves upon the previous, 40 year old bound of eO(n+1/ε2) for this problem, due to Gens running in eO(cid:0)n + 1/ε 3Weak approximation can break the capacity constraint by a small factor. Definition 2.1 specifies formally what 3(cid:1) time. 5 weak (1 − ε)-approximation for Subset Sum is. 3 For a complete proof of these theorems see Section 5. We also present a conditional lower bound for Knapsack and Unbounded Knapsack. Theorem 1.6. For any constant δ > 0, an FPTAS for Knapsack or Unbounded Knapsack with O((n + 1/ε)2−δ) running time would refute the (min, +)-convolution conjecture. This means that a similar improvement is unlikely for Knapsack. Also, this shows that the algorithm of [40] for Unbounded Knapsack is optimal (up to polylogarithmic factors). This lower bound is relatively straightforward and follows from previous works [24, 49] and was also observed in [19]. The lower bound also applies to the relaxed, weak (1 − ε)-approximation for Knapsack and Unbounded Knapsack, which separates these problems from weak (1 − ε)-approximation approximation for Subset Sum. This result was recently extended by Bringmann [18] who showed a conditional hardness for obtaining a strong subquadratic approximation for Subset Sum, which explains why we need to settle for a weak approximation. Lately it has been shown that the exact pseudo-polynomial algorithms for Knapsack and Un- bounded Knapsack are subquadratically equivalent to the (min, +)-convolution [24, 49]. There- fore, as a possible first step towards obtaining an improved FPTAS for Knapsack, we focus our attention on (min, +)-convolution. This also entails an improvement for the related TreeSparsity problem (see Section 7). The Theorem 1.7. (1 + ε)-approximate (min, +)-convolution can be computed in eO((n/ε) log W ) time. best previously known algorithms for both problems worked in time eO((n/ε2)polylog(W )) (see Back- The techniques used to improve the approximation algorithm for (min, +)-convolution also apply to approximation algorithms for 3SUM. For this problem we are able to show an algorithm that matches its asymptotic lower bounds. urs et al. [10]). Theorem 1.8. There is a deterministic algorithm for (1 + ε)-approximate 3SUM running in time eO((n + 1/ε)polylog(W )). Theorem 1.9. Assuming the Strong-3SUM conjecture, there is no eO((n + 1/ε1−δ)polylog(W )) algorithm for (1 + ε)-approximate 3SUM, for any constant δ > 0. For proofs of these theorems and detailed running times see Sections 8 1.4 Organization of the Paper In the Section 2 we present the building blocks of our framework and a sketch of the approximation scheme for Partition. Section 3 contains the notation and preliminaries, and the main proof is divided into Sections 4 and 5. In Sections 6 and 7 we present the algorithms for (min, +)-convolution and TreeSparsity. In the Section 8 we present the algorithms for 3SUM. The proofs of technical lemmas can be found in Appendix A and Appendix B. In Appendix C we give formal definitions of all problems. 2 Connecting Dense, Pseudo-polynomial and Approximation Algo- rithms for Knapsack-type problems: An Overview In this section we describe main building blocks of our framework. We also briefly discuss the recent advances in the pseudo-polynomial algorithms for Subset Sum and discuss how to use them. Then, 4 we explain the intuition behind the trade-off we exploit and give a sketch of the main algorithm. The formal arguments are located in Section 5. Difficulties with Rounding for Subset Sum There is a strong connection between approxi- mation schemes and pseudo-polynomial algorithms [59]. For example, a common theme in approx- imating knapsack is to reduce the range of the values (while keeping the weights intact) and then apply a pseudo-polynomial algorithm. Rounding the weights would be tricky because of the hard knapsack constraint. In particular, if one rounds the weights down, some feasible solutions to the rounded instance might correspond to infeasible solutions in the original instance. On the other hand, when rounding up, some feasible solutions might become infeasible in the rounded instance. Recently, new pseudo-polynomial algorithms have been proposed for Subset Sum (see Koiliaris and Xu [48] and Bringmann [17]). A natural idea is to use these to design an improved approximation scheme for Subset Sum. However, this seems to be difficult due to rounding issues discussed above. After this paper was announced, Bringmann [18] explained this difficulty by giving a conditional lower bound on a quadratic approximation of Subset Sum. 2.1 Weak Approximation for Subset Sum and Application to Partition Because of these rounding issues, it seems hard to design a general rounding scheme that, given a pseudo-polynomial algorithm for Subset Sum, produces an FPTAS for Subset Sum. What we can do, however, is to settle for a weaker notion of approximation. Definition 2.1 (Weak apx for Subset Sum). Let Z ∗ be the optimal value for an instance (Z, t) of Subset Sum. Given (Z, t), a weak (1 − ε)-approximation algorithm for Subset Sum returns Z H such that (1 − ε)Z ∗ ≤ Z H < (1 + ε)t. Compared to the traditional notion of approximation, here we allow a small violation of the packing constraint. This notion of approximation is interesting in itself. Indeed, it has been already considered in the stochastic regime for Knapsack [16]. Before going into details of constructing the weak (1 − ε)-approximation algorithms for the Subset Sum, let us establish a relationship with the approximation for the Partition. Corollary 2.2. If we can weakly (1 − ε)-approximate Subset Sum in time eO(T (n, ε)), then we can (1 − ε)-approximate Partition in the same eO(T (n, ε)) time. This is because of the symmetric structure of Partition problem: If a subset Z ′ violates the hard constraint (t ≤ Σ(Z ′) ≤ (1 + ε)t), then the set Z − Z ′ is a good approximation and does not violate it (recall that in Partition problem we always have t = Σ(Z)/2). For a formal proof see Section A. 2.2 Constructing Weak Approximation Algorithms for Subset Sum: A Sketch Fact 2.3. Given an eO(T (n, t)) exact algorithm for Subset Sum, we can construct a weak (1 − ε)- approximation algorithm for Subset Sum working in time eO(T (n, n Proof. We assume that the exact algorithm for the Subset Sum works also for multisets. We will address this issue in more detail in Section 4.1. 2ε )). 5 Let Z = {v1, . . . , vn} and t constitute a Subset Sum instance. Let I be the set of indices of elements of some optimal solution, and let OPT be their sum. Let us also introduce a scaled approximation parameter ε′ = ε 4 . Let k = 2ε′t n . Define a rounded instance as follows: the (multi)-set of Z contains a copy of k(cid:5) for each i ∈ {1, . . . , n}, and t =(cid:4) t k(cid:5). vi =(cid:4) vi Apply the exact algorithm A to the rounded instance ( Z, t). Let I ′ be the set of indices of We claim that {vi : i ∈ I ′} is a weak (1 − ε) approximation for Z and t. First let us show that elements of the solution found. this solution is not much worse than OPT: Xi∈I ′ vi ≥ kXi∈I ′ vi ≥ kXi∈I vi = kXi∈Ij vi kk ≥Xi∈I (vi − k) ≥ OPT − nk = OPT − 2ε′t ≥ OPT(1 − ε). The last inequality holds because we can assume OPT ≥ t/2 (see Section 4.3 for details). Similarly, we can show that this solution does not violate the hard constraint by too much: Xi∈I ′ vi ≤Xi∈I ′ (kvi + k) ≤ nk + kXi∈I ′ vi ≤ nk + tk ≤ nk + k + t ≤ 3ε′t + t ≤ t(1 + ε). Finally, since the exact algorithm is applied to a (multi)-set of n items with t =(cid:4) t the resulting algorithm runs in the claimed time. k(cid:5) =(cid:4) n 2ε′(cid:5), We state the above proof only to give the flavour of the basic form of reductions in this paper. Usually reductions that we will consider are more complex for technical reasons. One thing to note in particular is that the relation between k and ε is dictated by the fact, that there may be as many as n items in the optimal solution. Given some control over the solution size, one can improve this reasoning (see Lemma 4.7). 2.3 Approximation via Pseudo-polynomial time Subset Sum algorithm Currently, the fastest pseudo-polynomial algorithm for Subset Sum runs in time eO(n + t), ran- domized. S(Z, t) denotes the set of all possible subsums of set Z up to integer t (see Section 3). Theorem 2.4 (Bringmann [17]). There is a randomized, one-sided error algorithm with running time O(n + t log t log3 n δ log n), that returns a set Z ′ ⊆ S(Z, t), containing each element from S(Z, t) with probability at least 1 − δ. This suffices to solve Subset Sum exactly with high probability. Here S(Z, t) is represented by a binary array which for a given index i tells whether there is a subset that sums up to i (see Section 3 for a formal definition). For our trade-off, we actually need a probabilistic guarantee on all elements of S(Z, t) simultaneously. Fortunately, this kind of bound holds for this algorithm as well (see [24, Appendix B.3.2] for detailed analysis). Corollary 2.5. There is a randomized eO(n + t) algorithm that computes S(Z, t) with a constant probability of success. 6 The first case where this routine comes in useful occurs when all items are in the range [γt, t] (think of γ as a trade-off parameter set to ε−2/3). Note, that any solution summing to at most t can consist of at most 1/γ such elements. This observation allows us to round the elements with lower precision and still maintain a good approximation ratio, as follows: v′ γεt(cid:23) , i =(cid:22) 2vi t′ =(cid:22) 2t γεt(cid:23) =(cid:22) 2 γε(cid:23) . γε ) and returns an array of solutions with an additive error ±εt with high probability (see Lemma 5.1). Similar reasoning about sparseness also applies if the number of items is bounded (i.e., when n = ε2 ) and provides the same guarantees Bringmann's [17] algorithm on the rounded instance runs in time eO(n + t′) = eO(n + 1 eO( γ ε )). In that case Bringmann's [17] algorithm runs in time eO( γ (see Lemma 5.2 and also the next section). 2.4 Approximation via Dense Subset Sum Now we need a tool to efficiently solve the instances where all items are in range [0, γt), so-called dense instances. More formally, an instance consisting of m items is dense if all items are in the range [1, mO(1)]. Intuitively, rounding does not work well for these instances since it introduces large rounding errors. On the other hand, if an instance contains many distinct numbers on a small interval, one can exploit its additive structure. Theorem 2.6 (Galil and Margalit [27]). Let Z be a set of m distinct numbers in the interval (0, ℓ] such that and let L := 100·Σ(Z)ℓ log ℓ m2 m > 1000 · √ℓ log ℓ, . Then in O(m + ((ℓ/m) log ℓ)2) preprocessing time we can build a structure that can answer the following queries in constant time. In a query the structure receives a target number t ∈ (L, Σ(Z)−L) and decides whether there is a Z ′ ⊆ Z such that Σ(Z ′) = t. The structure is deterministic. In fact we will use a more involved theorem that can also construct a solution in O(log(l)) time but we omit it here to keep this section relatively free of technicalities (see Section 5.2 for a discussion regarding these issues). Observe that L = eO(ℓ1.5) (because Σ(Z) < mℓ) and the running time is bounded by eO(m + ℓ) (because ℓ/m = O(√ℓ)). We will apply this result for the case ℓ = γt (see Lemma 5.5). Recall, that Bringmann's [17] algorithm runs in time eO(m + t), which would be slower by the factor γ (the trade-off parameter). For simplicity, within this overview we will assume, that Theorem 2.6 provides a data structure that can answer queries with the target numbers in [0, Σ(Z)]. In the actual proof, we need to overcome this obstacle, by merging this data structure with other structures, responsible for targets near the boundary, which we call marginal targets (see Lemma 5.3). Suppose our instance consists of m elements in the range [0, γt]. We use the straightforward rounding scheme, as in the proof of Fact 2.3. v′ εt (cid:23) , i =(cid:22) 2mvi t′ =(cid:22) 2mt εt (cid:23) =(cid:22) 2m ε (cid:23) . 7 We chose γt as the upper bound on item size, so that ℓ′ = mγ/ε is an upper bound on v′ i. Now, if the number of items satisfies the inequality ℓ′ < m2, then we can use the Theorem 2.6 with cannot use the approach from [27]. from the range that is of our interest (for a careful proof see Section 5). running time eO(m + ℓ′) = eO(m + mγ/ε). This provides a data structure that can answer queries Still, it can happen that most of the items are in the sparse instance (i.e., ℓ′ ≥ m2) and we In that case we use Theorem 2.4 again, with running time eO(m + γ eO(m + γ In the end, we are able to compute an array of solutions, for items in range [0, γt] in time ε2 ) with additive error ±εt and high probability (see Lemma 5.6). The last term in time complexity comes from handling the marginal queries. ε2 ) (see Lemma 5.2). ε2 + mγ2 2.5 A Framework for Efficient Approximation In this section we will sketch the components of our mechanism (see Algorithm 1). The mechanism combines pseudo-polynomial Bringmann's [17] algorithm with Galil and Margalit [27] algorithm for dense instances of Subset Sum. Algorithm 1 Roadmap for the weak (1−ε)-approximation for Subset Sum. Input: item set Z, t, ε 1: ensure OP T ≥ t/2 3: repeat 4: 2: reduce Z to eO(1/ε) partition items into Zlarge and Zsmall divide [0, γt] into ℓ = O(γ log(n)/ε) · Zsmall segments round down small items remove item repetitions in Zsmall 5: 6: 7: 8: until ℓ = O(γ log(n)/ε) · Zsmall 9: build a data structure for large items 10: if Zsmall = eO(√ℓ) then build a data structure for small items 11: 12: else 13: 14: 15: end if 16: merge the data structures for large and small items build data structures for marginals exploit the density of the instance to cover the remaining case We begin by reducing the number of items in the instance Z to roughly eO(1/ε) items to get a near linear running time (see Lemma 4.2). After that our goal is to divide items into small and large and process each part separately, as described earlier. However, Theorem 2.6 requires a lower bound on the number of distinct items. To control this parameter, we merge identical items into larger ones, until each item appears at most twice. However, this changes the number of items, and so the procedure might have to be restarted. Lemma 4.4 guarantees that we require at most log n such refinement steps. In the next phase we decide which method to use to solve the instance depending on its density (line 10). We encapsulate these methods into data structures (lines 11-14). Finally we will need to merge the solutions. For this task we introduce the concept of membership oracles (see Defi- 8 nition 4.5) that are based on FFT and backtracking to retrieve solutions (see Lemma 4.6). The simplified trade-off schema is presented on the Figure 1. γt t Dense Instance ǫt m ǫγt Sparse Instance m2 ≤ ℓ eO(m + γ ε2 ) γǫ ) eO(n + 1 If m2 > ℓ ε2 + mγ2 ε2 ) eO( γ Figure 1: Overall schema of trade-off and usage of building blocks. The parameter m denotes number of items in the dense instance, n is the number of all elements, γ is the trade-off parameter, ℓ is the upper bound on the item size after rounding, t is the target sum. The buckets in the sparse/dense instance depict the rounding scheme for small and large items. The final running time of our framework is eO(n + 1 γ(n, ε) > 0 (see Lemma 5.9). For γ = ε−2/3, this gives us an eO(n + ε−5/3) time weak (1 − ε)- approximation approximation for Subset Sum. ε3 ) with high probability for any γε + γ ε2 + γ2 3 Preliminaries For a finite multiset Z ⊂ N we denote its size as Z, the number of distinct elements as Z, and the sum of its elements as Σ(Z). For a number x we define pow(x) as the largest power of 2 not exceeding x. If x < 2 we set pow(x) = 1. For sets A, B ⊂ N their bounded algebraic sum A ⊕t B is a set {a + b : a ∈ {0} ∪ A, b ∈ {0} ∪ B} ∩ [0, t]. Definition 3.1 (Subsums). For a finite multiset Z ⊂ N we define S(Z)k as a set of all possible subset sums of Z of size at most k, i.e., x ∈ S(Z)k iff there exists S′ ⊆ Z, such that Σ(S′) = x and S′ ≤ k. S(Z) is the set without the constraint on the size of the subsets, i.e., S(Z) := S(Z)∞. The capped version is defined as S(Z, t)k := S(Z)k ∩ [0, t] and S(Z, t) := S(Z) ∩ [0, t]. We call two multisets Z1, Z2 ⊂ N equivalent if S(Z1) = S(Z2). Note that 0 ∈ S(Z, t)k for all sets Z and t, k > 0. Definition 3.2 ((ε, t)-closeness). We say that set B is (ε, t)-close to A if there is a surjection φ : A → B such that x − εt ≤ φ(x) ≤ x + εt. A Subset Sum instance (Z2, t) is ε-close to (Z1, t) if S(Z2, t) is (ε, t)-close to S(Z1, t). Sometimes, when there is no other notation on t, we will use the notion of ε-closeness as a (ε, t)-close. Usually the surjection from the definitions will come by rounding down the item sizes and each item set will get a moderately smaller total size. We will also apply the notion of (ε, t)-closeness to binary arrays having in mind the sets they represent. 9 Fact 3.3. If A is (ε, t)-close to S(Z1, t) and B is (ε, t)-close to S(Z2, t) then A ⊕t B is (2ε, t)-close to S(Z1 ∪ Z2, t) We will also need to say, that there are no close elements in a set. It will come in useful to show, that after rounding down all the elements are distinct. Definition 3.4 ((x)-distinctness). The set S is said to be (x)-distinct if every interval of length x contains at most one item from S. The set S is said to be (x, 2)-distinct if every interval of length x contains at most two items from S. 4 Preprocessing This section is devoted to simplify the instance of Subset Sum in order to produce a more readable proof of the main algorithm. In here we will deal with: • multiplicities of the items, • division of the instance into large and small items, • proving that rounding preserves ε-closeness, • reducing a number of items from n to eO(1/ε) items. The solutions to these problems are rather technical and well known in the community [46, 47, 48, 17]. We include it in here because these properties are used in approximation algorithms [47, 46] and exact pseudo-polynomial algorithms [48, 17] communities separately. We expect that reader may not be familiar with both of these technical toolboxes simultaneously and accompany this section with short historical references and pointers to the original versions of proofs. 4.1 From Multisets to Sets The general instance of Subset Sum may consists of plenty of items with equal size. Intuitively, these instances seem to be much simpler than instances where almost all items are different. The next lemma will allow us to formally capture this intuition with the appropriate reduction. This lemma was proposed in [48, Lemma 2.2] but was also used in [17]. Lemma 4.1 (cf. Lemma 2.2 from [48]). Given a multiset S of integers from {1, . . . , t}, such that S = n and the number of distinct items S is n′, one can compute, in O(n log n) time, a multiset T , such that: • S(S, t) = S(T, t) • T ≤ S • T = O(n′ log n) • no element in T has multiplicity exceeding two. 10 Proof. We follow the proof from [48, Lemma 2.2], however the claimed bound on T is only O(n′ log t) therein. Consider an element x with the multiplicity 2k + 1. We can replace it with a single copy of x and k copies of 2x while keeping the multiset equivalent. If the multiplicity is 2k + 2 we need 2 copies of x and k copies of 2x. We iterate over items from the smallest one and for each with at least 3 copies we perform the replacement as described above. Observe that this procedure generates only elements of form 2ix where i ≤ log n and x is an element from S. This yields the bound on T. The routine can be implemented to take O(log n) time for creating each new item using tree data structures. later found applications in Knapsack-type problems [47]. 4.2 From n Items to eO(1/ε) Items To reduce number of items n to eO(1/ε) Kellerer et al. [46] gave a very intuitive construction that we want to get rid of factor O(n). We divide an instance to k = (cid:6) 1 ε(cid:7) intervals of length εt, i.e., jm) items, Ij := (jt, (j + 1)t]. Next notice that for interval Ij we do not need to store more than O(l k Intuitively, rounding scheme described in Section 2 could divide the items into O(n/ε) intervals and this would result with an ε-close instance to the original one. In here we start similarly but because their sum would exceed t (this is the step where ε factor will come in). Finally, the number of items is upper bounded (up to the constant factors): kXj=1(cid:24) k j(cid:25) ≤ k kXj=1 1 j < k log k = O(1/ε log (1/ε)) εt ki · εt 2 + log( 2n ε )Xi=1 ε ) log(n)(cid:1). 11 t ε log( n The last inequality is just an upper bound on harmonic numbers. This was a very informal sketch of the proof of [46] construction to give some intuition. The next technical lemma is based on their trick. Lemma 4.2. Given a Subset Sum instance (Z, t), Z = n, one can find an ε-close instance (Z2, t) 2i−1 ) to the closest multiplicity of(cid:4) εt such that Z2 = O(cid:0) 1 Proof. We begin with constructing Z1 as follows. For i = 1, . . . , log( 2n in Z ∩ [ t 2i , that Z1 = O(cid:0) 1 most t and its counterpart Y1 ⊆ Z1. We lose at most n· εt Let ki = I ∩ [ t 2i , [ t 2i , ε ) log(n)(cid:1). The running time of this procedure is O(Z + Z2). 2i+1(cid:5). We neglect elements smaller than εt ε )(cid:1). 2i−1 ) and ti denote the sum of elements in I ∩ [ t 2i , 2i+1 and ki · t 2i ≤ ti, we have log( 2n εt 2i+1 ≤ We argue that (Z1, t) is ε-close to (Z, t). To see this, consider any subset I ⊆ Z summing to at 2 by omitting items smaller than εt 2n . t 2i−1 ). Since each element in ε ) we round down each element 2n . Observe t 2i−1 ) has been decreased by at most Σ(I) − Σ(Y1) ≤ εti 2 ≤ εt. 2n = εt εt 2 + ε log( n t ε )Xi=1 In the end we take advantage of Lemma 4.1 to transform Z1 into an equivalent multiset Z2 such that Z2 ≤ Z1 log(Z1) = O(cid:0) 1 ε log( n Note, that we discarded items smaller than εt 2n . We do this because sum of these elements is just too small to influence the worst case approximation factor. We do not consider them just for the simplicity of analysis. To make this algorithm competitive in practice, one should probably just greedily add these small items to get a little better solution. 4.3 From One Instance to Small and Large Instances First we need a standard technical assumption, that says that we can cheaply transform an instance to one with a lower bounded solution. We will need it just to simplify the proofs (e.g., it will allow us to use Lemma B.2 multiple times). Lemma 4.3. One may assume w.l.o.g. that for any Subset Sum instance OPT ≥ t 2 . Proof. Let us remove from the item set Z all elements exceeding t since they cannot belong to any solution. If Σ(Z) ≤ t then the optimal solution consists of all items. Otherwise consider a process in which Y1 = Z and in each turn we obtain Yk+1 by dividing Yk into two arbitrary non-empty parts and taking the one with a larger sum. We terminate the process when Ylast contains only one item. Since Σ(Y1) > t, Σ(Ylast) ≤ t, and in each step the sum decreases by at most factor two, for some k it must be Σ(Yk) ∈ [ t 2 , OPT cannot be lower. 2 , t]. Because there is a feasible solution of value at least t One of the standard ways of solving Subset Sum is to separate the large and small items [47]. Usually these approximations consider items greater and smaller than some trade-off parameter. Our techniques require a bound on the multiplicities of small items, which is provided by the next lemma. Lemma 4.4 (Partition into Small / Large Items). Given an instance (Z, t) of Subset Sum, an approximation factor ε, and a trade-off parameter γ, one can deterministically transform the instance (Z, t), in time O(n log2 n), to an ε-close instance (Zsmall ∪ Zlarge, t) such that: • ∀zs ∈ Zsmall, • ∀zl ∈ Zlarge, • The set Zsmall is ( it holds that zs < γt, it holds that zl ≥ γt, at most 2 occurrences of each item. εt m·log n , 2)-distinct where m = O(Zsmall), i.e., after rounding there can be εt Proof. We call an item x large if x ≥ γt and small otherwise. Let Y0 be the initial set of small m0 log n ). We round down the size of each small item to the closest items and m0 = Y0, q0 = pow( multiplicity of q0. Then we apply Lemma 4.1 to the set of small items to get rid of items with 3 or more copies. Note that this operation might introduce new items that are large. We obtain a mi log n ). It new set of small items Y1 and repeat this procedure with notation mi = Yi, qi = pow( holds that mi+1 ≤ mi and qi qi+1. We stop the process when mi+1 ≥ mi 2 , which means there can be at most log n iterations. Let m denote the final number of small items and q ≥ εt 4m log n -- the last power of 2 used for rounding. All small items now occur with multiplicities at most 2. εt Let us fix Zsmall as the set of small items after the modification above and likewise Zlarge. In the mi log n , so each new instance ε log n -close to the previous one. There are at most log n steps and the removal of copies keeps the i-th rounding step values of mi items are being decreased by at most is instance equivalent, therefore (Zsmall ∪ Zlarge, t) is ε-close to (Z, t). εt Our algorithm works independently on these two instances and produces two arrays ε-close to them. The construction below allows us to join these solutions efficiently. We want to use them even if we have only access to them by queries. We formalize this as an (ε, t)-membership-oracle. The asymmetry of the definition below will become clear in Lemma 4.7. 12 Definition 4.5 ((ε, t)-membership-oracle). The (ε, t)-membership-oracle of a set X is a data struc- ture, that given an integer q answers yes/no obeying following conditions: 1. if X contains an element in [q − εt, q + εt], then the answer is yes, 2. if the answer was yes, then X contains an element in [q − 2εt, q + 2εt]. A query to the oracle takes eO(1) time. Moreover, if the oracle answers yes, then it can return a witness x in eO(1) time. Below we present an algorithm that can efficiently join the solutions. We assume, that we have only query-access to them and want to produce an (ε, t)-membership-oracle of the merged solution. Lemma 4.6 (Merging solutions). Given S(Z1, t) and S(Z2, t) as (ε, t)-membership-oracles • S1 that is (ε, t)-close instance to S(Z1, t), • S2 that is (ε, t)-close instance to S(Z2, t), ε ) time, construct a (2ε, t)-membership-oracle for S(Z1 ∪ Z2, t). Proof. For an ease of presentation, only in this proof we will use interval notation of inclusion, i.e., we will say that (a, b] ⊓ A iff ∃xx ∈ (a, b] ∧ x ∈ A. Let p = O(εt). For each interval (ip, (i + 1)p] we can, deterministically in eO( 1 where i ∈n0, . . .j t interval, having in mind that the answer is approximate. The number of intervals is O( 1 ε ). for interval (ip, (i + 1)p]. pko we query oracles whether S(Z1, t) and S(Z2, t) contain some element in the We store the answers in arrays S1 and S2, namely Sj[i] = 1 if the oracle for S(Zj, t) answers yes 1[i] =(1 if the oracle for 0 otherwise S′ (ip, (i + 1)p] ⊓ S1 or i = 0 Then we perform a fast convolution on S1, S2 with FFT. x = x1 + x2. We have (S1 ⊕FFT S2)[k] =Pk If x ∈ S(Z1 ∪ Z2, t)∩ (kp, (k + 1)p], then there is some x1 ∈ S(Z1, t) and x2 ∈ S(Z2, t) such that i=0 S1[i] · S2[k − i] and thus (S1 ⊕FFT S2)[k′] is nonzero for k′ = k or k′ = k + 1. This defines the rule for the new oracle. The additive error of the oracle gets doubled with the summation. On the other hand, if one of these fields is nonzero, then there are corresponding indices i1, i2 summing to k or k + 1. The second condition from Definition 4.5 allows the corresponding value x1 to lie within one of the intervals with indices i1 − 1, i1, or i1 + 1 and likewise for x2. Therefore, the additive error is O(p) = O(εt). iff there is i such that (ip, (i + 1)p] ⊓ S1 ∪ {0} and ((k − i)p, (k − i + 1)p] ⊓ S2 ∪ {0}. Now, we promised only oracle output to our array. When a query comes, we scale down the query interval, then we check whether any of adjacent interval in our structure is nonzero (we lose a constant factor of O(ε) accuracy here) and output yes if we found it and no otherwise. Moreover, with additional polylogarithmic factors we can also retrieve the solution. The idea is similar to backtracking from [46]. Namely, the fast convolution algorithm can compute the table of witnessing indexes (of only one). We store a witnessing index if there is solution and −1 otherwise. Then we ask the oracles of S(Z1, t) and S(Z2, t) for a solution with a proper indexes and return the combination of those. 13 4.4 From Exact Solution to ε-close Instance In Section 2 we presented an overall approach of rounding elements and explained why it gives us the weak approximation of Subset Sum. Here we will focus on formally proving these claims. In our subroutines, we round down the items, execute the exact algorithm on the rounded instance, and retrieve the solution. We want to argue, that in the end we lose only an additive factor of ±εt. We presented a sketch of this reasoning in Fact 2.3. For our purposes we will describe the procedure in the case, when the number of items in any solution is bounded by k (i.e., we are interested only in S(Z, t)k). We can always assume k ≤ n. Lemma 4.7. Given an exact algorithm that outputs the set S(Z, t)k and works in time T (n, t), where n = Z, we can construct an (ε, t)-membership-oracle of set S(Z, t)k in time eO(n + T (n, k/ε)). If the exact algorithm retrieves solution in eO(1) time, then so does the oracle. Proof. For sake of legibility, we assume that we are interested in S(Z, t)k−1 - this only allows us to write simpler formulas. Let (zi) denote the items. We perform rounding in the following way: z′ εt(cid:23) , i =(cid:22) kzi t′ =(cid:22) kt εt(cid:23) =(cid:22) k ε(cid:23) . We run the exact algorithm on the rounded instance (Z ′, t′). It takes time T (n, t′) = O(T (n, k/ε)). This algorithm returns S(Z ′, t′)k−1, which we store in array Q[1, t′]. We construct (ε, t)-membership- oracle in array Q′[1, t′] as follows: we set Q′[i] = 1 iff Q contains 1 in range (i− 2k, i + k]. If we want to be to able retrieve a solution, we need to also remember a particular index j(i) ∈ (i − 2k, i + k] such that Q[j(i)] = 1. Such a data structure can be constructed in a linear time with a help of a queue. Given a query q, the oracle returns Q′[q′], where q′ = j kq Definition 4.5 is satisfied. εtk. It remains to prove that Let I ⊆ Z be a set of at most k − 1 items and I ′ be the set of their counterparts after rounding. Since for all zi ∈ Z it holds we obtain kzi εt − 1 ≤ z′ i ≤ kzi εt , k · Σ(I) εt − k + 1 ≤ Σ(I ′) ≤ k · Σ(I ′) εt . (1) Therefore, if Σ(I) ∈ [q − εt, q + εt], then kq εt − 2k + 1 = Σ(I ′) ≤ εt k · (q + εt) εt k · (q − εt) kq εt = − k + 1 ≤ Σ(I ′), + k, and Σ(I ′) ∈ (q′ − 2k, q′ + k], because Σ(I ′) is integer. On the other hand, we can invert relation (1) to obtain εt k · Σ(I ′) ≤ Σ(I) ≤ εt k ·(cid:0)Σ(I ′) + k − 1(cid:1) . 14 To satisfy the second condition we assume Σ(I ′) ∈ (q′ − 2k, q′ + k] and check that q − 2εt = εt k ·(cid:18) kq εt − 2k(cid:19) ≤ εt k · (q′ + 2k − 1) ≤ q + 2εt, εt k · (q′ − 2k + 1) ≤ Σ(I), what finishes the proof. Σ(I) ≤ We apply Lemma B.2 with {z1, . . . , zk} = Y , q = t/2 and k and ε as in the statement. guarantees that: It (1 − ε)Σ(Y ) ≤ εt 2k Σ(Y ′). And finally, (1 − ε)Σ(Y ) ≥ Σ(Y ) − εt (because we are only interested in solutions smaller than t). So if Y is a optimal solution, then an exact algorithm after rounding would return something greater or equal Σ(Y ) − εt. Conversely, it can turn out that an exact algorithm would find something with a sum greater than q (this is where we can violate the hard constraint). We need to bound it as well (because the definition of (ε, t)-membership-oracle requires that). Note, that analogous argument proves it. Namely, the solution can consist of at most k items and each of them lose only O(εt/k). Moreover, exact oracle gave us only the solution that its rounded version sums up to exactly t′. Formally, we prove it again with Lemma B.2 with the same parameters as before. By dividing both sides by (1 − ε) we know that: kXi=1(cid:22) 2kzi tε (cid:23) = ⌊k⌋ · ε. Once again, we can use Lemma B.2 with the same parameters (we divided both sides by (1−ε) > 0): 1 − ε(cid:19) εt 2k xi ≤(cid:18) 1 kXi=1 tε (cid:23) =(cid:18) 1 kXi=1(cid:22) 2kzi 1 − ε(cid:19) εt tε (cid:23) . kXi=1(cid:22) 2kzi 2k(cid:22) 2k ε (cid:23) ≤ 1 1 − ε t < (1 + 2ε)t. The right side satisfies: 1 − ε(cid:19) εt (cid:18) 1 2k (we can always rescale the approximation factor by setting ε′ = ε/2 at the beginning). The constant before ε does not change much since we only need (O(ε), t)-membership-oracle The main obstacle with returning a solution that obeys the capacity constraint comes from the above lemma. If we could provide a reduction from an exact algorithm without widening the interval [q − εt, q + εt], this would automatically entail a strong approximation for Subset Sum. This seems unlikely due to conditional hardness result for a strong subquadratic approximation for Subset Sum [18]. At the end, we need to prove, that an (ε, t)-membership-oracle gives us the correct solution for weak (1 − ε)-approximation Subset Sum. 15 Lemma 4.8. Given an ( ε 6 , t)-membership-oracle of S(Z, t), we can read the answer to the weak (1 − ε)-approximation Subset Sum in time eO( 1 Proof. We query the oracle for q = i · εt the interval [q − εt [x − εt Otherwise the witness might belong to (t, (1 + ε 2 ]. If OPT < (1 − ε 6 , q + εt 2 , x + εt ε ). 2 )t]. 6 for i = 0, . . . , 6 6 ] contains an x ∈ S(Z, t), then the oracle returns an element within 2 , OPT]. 2 )t, then the oracle will return a witness within (OPT − εt ε . Each query takes time eO(1) and if By taking advantage of Lemma 4.3, we can assume that OPT ≥ t/2, therefore the relative error gets bounded with respect to OPT. 5 The weak (1 − ε)-approximation algorithm for Subset Sum 5.1 Large Items We will use Theorem 2.4 to compute S(Zlarge, t) on a large instance. On that instance, this algorithm is more efficient than Kellerer et al. [46] algorithm because one can round items less aggressively. Lemma 5.1 (Algorithm for Large Items). Given a large instance (Zlarge, t) of Subset Sum (i.e., all items are greater than γt), we can construct an (ε, t)-membership-oracle of S(Zlarge, t) in randomized γε ) time with a constant probability of success. eO(n + 1 Proof. We use Bringmann's [17] algorithm, namely Corollary 2.5, that solves the Subset Sum problem exactly. Since all elements are greater than γt, any subset that sums up to at most t must contain at most 1 γ items. The parameter k in Lemma 4.7 is an upper bound on number of elements in the solution, hence we set k = 1 γ . The Bringmann's [17] algorithm runs in time eO(n + t) and Lemma 4.7 guarantees that we can build an (ε, t)-membership-oracle in time eO(n + k/ε) = eO(n + 1/(γε)), which is what we needed. 5.2 Small Items Now we need an algorithm that solves the problem for small items. As mentioned in Section 2 we will consider two cases depending on the density of instance. The initial Subset Sum instance consists of n elements. The m is the number of elements in the small instance and let m′ = O(m log n) be as in Lemma 4.4. For now we will assume, that the set of elements is (εt/m′)-distinct (we will deal with multiplicities 2 in Lemma 5.7). ε Let q = εt/m′ be the rounding parameter (the value by which we divide) and ℓ = γm′/ε = ) be the upper bound on items' sizes in the small instance after rounding. Parameter m2 ) describes the boundaries of Theorem 2.6. We deliberately use O notation to hide O( γm log n L = O(Σ(S)· constant factors (note that Galil and Margalit [27] algorithm requires that m > 1000 · √l log l). l Lemma 5.2 (Small items and m2 < ℓ log2 ℓ). Suppose we are given an instance (Zsmall, t) of Subset Sum (i.e., all items are smaller than γt) with size satisfying m2 < ℓ log2 ℓ. Then we can compute (ε, t)-membership-oracle of S(Zsmall, t) in randomized eO(m + γ Proof. In here we need to deal with the case, where small instance is sparse. So just as in the proof of Lemma 5.1, we can use Bringmann's [17] algorithm. ε2 ) time. 16 S(Zsmall, L) in time eO(m + mγ2 ε2 ). Proof. We round down items with rounding parameter q = εt/m′ = Ω( small) · cℓ rounded items as Z ′ Σ(Zsmall) with Σ(Z ′ small. After scaling down we have L′ = Σ(Z ′ small) and ℓ remains the same). Recall that ℓ = O( mγ log n ε εt The total sum of items in Z ′ m log n ) and denote the set of m2 (note that we only replace ). ε ). Combining Corollary 2.5 and Lemma 4.7 allows us to construct an (ε, t)-membership-oracle in We will use the reduction from exact to weak (1− ε)-approximation algorithm for Subset Sum from Lemma 4.7. We set m as the maximal number of items in the solution, as there are at most ε ). After dividing both m small items. Recall that ℓ is eO(mγ/ε). This gives us m2 = eO(ℓ) = eO( mγ sides by m we obtain m = eO( γ eO(m + T (m, m/ε)) = eO(m + γ Now we have to handle the harder m2 ≥ ℓ log2 ℓ case. In this situation we again consider two cases. The Galil and Margalit [27] algorithm allows only to ask queries in the range (L, Σ(S) − L) where L = O(Σ(S)· m2 ). In the next lemma we take care of ranges [0, L] and [Σ(S)− L, Σ(S)]. We focus on the range [0, L], because the sums within [Σ(S) − L, Σ(S)] are symmetric to [0, L]. Lemma 5.3 (Small items, range (0, L)). Given an instance (Zsmall, t) of Subset Sum, such that Zsmall = m and the items' sizes are at most γt, we can compute an (ε, t)-membership-oracle for ε2 ) randomized time. l size at most ℓ). Hence ,L′ = O(ℓ2/m) = O( γ2m log2 n in time eO(m + L′) = eO(m + mγ2 (ε, t)-membership-oracle for S(Zsmall, L). small is smaller or equal to ℓm (because there are m elements of ). Therefore Bringmann's [17] algorithm runs ε2 ). Combining it with the analysis of the Lemma 4.7 gives us an ε2 5.3 Applying Additive Combinatorics Before we proceed forward, we need to present the full theorem of Galil and Margalit [26, Theorem 6.1] (in Section 2.4 we presented only a short version to keep it free from technicalities). We need a full running time complexity (with dependence on ℓ, m, Σ(S)). We copied it in here with a slight change of notation (e.g., [26] use SA but we use notation from [48] paper of Σ(A)). Theorem 5.4 (Theorem 6.1 from [26]). Let A be a set of m different numbers in interval (0, ℓ] such that m > 1000 · ℓ0.5 log2 ℓ; then we can build in O(cid:16)m + ((ℓ/m) log l)2 + Σ(A) m2 ℓ0.5 log2 ℓ(cid:17) preprocessing time a structure which allows us to solve the Subset Sum problem for any given integer N in the interval (L, Σ(A) − L). Solving means finding a subset B ⊆ A, such that Σ(B) ≤ N and there is no subset C ⊆ A such that Σ(B) < Σ(C) ≤ N . An optimal subset B is build in O(log ℓ) time per target number and is listed in time O(B). For finding the optimal sum Σ(B) only, the preprocessing time is O(cid:16)m + ((ℓ/m) log ℓ)2(cid:17) and only constant time is needed per target number. , however in the next [27] the authors improved it to L := O(Σ(A) ℓ m2 ) without any damage on running time [28]. For both of these possible choices of L we obtain a subquadratic algorithm. We will use the improved version [27] because it provides a better running time. In [26] authors defined L := 100·Σ(A)ℓ0.5 log2 ℓ m 17 Lemma 5.5 (Small items, range (L, Σ(S)− L)). Given a small instance (Zsmall, t) of Subset Sum (i.e., all items are smaller than γt) such that Zsmall is (εt/m′)-distinct (where m′ = O(m log n)), we ε(cid:1)2 + can compute an (ε, t)-membership-oracle of S(Zsmall, t) ∩ (L, Σ(Zsmall) − L) in time eO(n +(cid:0) γ ε ·(cid:0) γn Proof. We round items to multiplicities of q = εt/m′. Precisely: ε (cid:1)0.5). γ z′ i =(cid:22) zi q(cid:23) , t′ =(cid:22) t q(cid:23) =(cid:22) m′ ε (cid:23) . We know that zi < γt. Therefore z′ i ≤ zi q < γt q = γm′ ε = ℓ. By the same inequalities as in the proof of Lemma 4.7 we know that if we compute S(Z ′ and multiply all results by q, we obtain an (ε, t)-membership-oracle for S(Zsmall, t). small, t′) Checking conditions of the algorithm Now we will check that we satisfy all assumptions of small. First note that m2 < ℓ log2 ℓ, ℓ Galil and Margalit [27] algorithm on the rounded instance Z ′ is the upper bound on the items' sizes in Z ′ small are distinct because we assumed that Zsmall is (εt/m′)-distinct. small, and we know that all items in Z ′ Preprocessing Next Galil and Margalit [27] algorithm constructs a data structure on the set of rounded items Z ′ small. The preprocessing of Galil and Margalit [27] algorithm requires O(cid:18)m + (ℓ/m log ℓ)2 + Σ(Z ′ small) m2 ℓ0.5 log2 ℓ(cid:19) time. If we put it in terms of m, ε, t and hide polylogarithmic factors we see that preprocessing runs in: + γ ε (cid:17)0.5(cid:19) ε(cid:16) γm because Σ(Z ′ small) ≤ ℓm. eO(cid:18)m +(cid:16) γ ε(cid:17)2 L). After scaling down we have L′ = eO(cid:0)Σ(Z ′ Naively, one could run queries for all elements in range (L′, Σ(Z ′ Queries With this data structure we need to compute a set ε-close to S(Zsmall, t)∩(L, Σ(Z ′ small)− small) − L′) and check if there is a subset of Z ′ small that sums up to the query value. However this is too expensive. In order to deal with this issue, we take advantage of the fact that each query returns the closest set whose sum is smaller or equal to the query value. mε2 ) = eO( mγ2 m ) = eO( γ2m2 m2(cid:1) = eO( ℓ2 small) · ε2 ). ℓ Since we have rounded down items with q = εt m′ , we only need to ask εt to learn sufficient information. The queries will reveal if Zsmall contains at least one element in each range [iεt, (i + 1)εt), what matches the definition of the (ε, t)-membership-oracle. q = eO(m) queries in order 18 Retrieving the solution Galil and Margalit [27] algorithm can retrieve the solution in time O(log ℓ). by the preprocessing time. This finalizes the construction of the (ε, t)-membership-oracle. The running time is dominated 5.4 Combining the Algorithms Now we will combine the algorithms for small items. Lemma 5.6 (Small Items). Given a (Zsmall, t) instance of Subset Sum (i.e., all elements in Zsmall are smaller than γt), such that the set Zsmall is (εt/m)-distinct, we can compute an (ε, t)- membership-oracle of S(Zsmall, t) in time eO(m + γ Proof. We will combine two cases: ε2 + mγ2 ε2 ) with high probability. Case When m2 < ℓ log2 ℓ: In such case we use Lemma 5.2 that works in eO(m + γ ε2 ) time. ε ·(cid:0) γm ε(cid:1)2 + γ ε (cid:1)0.5) time. Case When m2 ≥ ℓ log2 ℓ: First we take advantage of Lemma 5.5. This gives us an (ε, t)- It requires membership-oracle that answers queries within set S(Zsmall, t) ∩ (L, Σ(Zsmall) − L). oracle for interval set [Σ(Zsmall) − L, Σ(Zsmall)] is obtained by symmetry. We combine it (using Lemma 4.6) with the (ε, t)-membership-oracle that gives us answers to a ε2 ). The eO(nm +(cid:0) γ set S(Zsmall, t) ∩ [0, L] from Lemma 5.3. This oracle can be constructed in time eO(m + mγ2 Running Time: The running time of merging the solutions from Lemma 4.6 is eO(1/ε) which is ε(cid:1)2) is suppressed by suppressed by the running time of Lemma 5.3 and Lemma 5.5. Factor eO((cid:0) γ eO(cid:16)(cid:16) mγ2 ε2 (cid:17)(cid:17). ε ·(cid:0) γm ε (cid:1)0.5 is also suppressed by eO( mγ2 ε2 ). The algorithm is randomized because Lemma 5.3 is randomized. Term γ The Lemma 4.4 allowed us to partition our instance into small and large items. We additionally know that each interval of length εt/m′ contains at most 2 items. However in the previous proofs we assumed there can be only one such item, i.e., the set should be (εt/m′)-distinct. Lemma 5.7 (From multiple to distinct items). Given an instance (Zsmall, t) of Subset Sum, where Zsmall = m and zzsmall is (εt/m′, 2)-distinct for m′ = O(m log n), we can compute an Proof. We divide the set Zsmall into two sets Z 1 sets Z 1 (ε, t)-membership-oracle for instance (Zsmall, t) in eO(n + γ Zsmall and dividing items into odd-indexed and even-indexed . It takes eO(m) time. ε2 + nγ2 small such that Zsmall = Z 1 Next we use Lemma 5.6 to compute an (ε, t)-membership-oracle for (Z 1 small, the small are disjoint, (εt/m′)-distinct, and have size Ω(m). This can be done by sorting ε2 ) time with high probability. and merge them using Lemma 4.6. small, t) and (Z 2 small ∪ Z 2 small and Z 2 small,Z 2 small, t), 19 Now we will combine the solutions for small and large items. γ εt ε2 ) time with high probability. Theorem 5.8. Let 0 < γ be a trade-off parameter (that depends on n, ε). Given an (Z, t) instance γε + of Subset Sum, we can construct the (ε, t)-membership-oracle of instance S(Z, t) in eO(n + 1 ε2 + nγ2 Proof. We start with Lemma 4.4, that in O(n log2 n) time partitions the set into Zlarge and Zsmall, m log n , 2)-distinct, where m = Zsmall. To deal with small items, we use such that Zsmall is ( Lemma 5.7. The algorithm for small items returns an (ε, t)-membership-oracle of S(Zsmall, t). For large items we can use Lemma 5.1. It also returns an (ε, t)-membership-oracle of S(Zlarge, t). Finally, we use Lemma 4.6 to merge these oracles in time eO(1/ε). All the subroutines run with a constant probability of success. Finally, we have combined all the pieces and we can get a faster algorithm for weak (1 − ε)- approximation for Subset Sum. Corollary 5.9 (Subset Sum with tradeoff). There is a randomized weak (1 − ε)-approximation ε2 ) time with high probability for any ε2 + nγ2 γε + γ γ(n, ε) > 0. algorithm for Subset Sum running in eO(n + 1 Proof. It follows from Lemma 4.8 and Theorem 5.8. γε + γ ε2 + nγ2 The weak (1 − ε)-approximation Subset Sum gives us the approximation for Partition via Corollary 2.2. Corollary 5.10 (Partition with trade-off). There is a randomized (1−ε)-approximation algorithm ε2 ) time with high probability for any γ(n, ε) > 0. for Partition running in eO(n + 1 To get running time of form eO(n+1/εc) and prove our main result we need to reduce the number of items from n to eO(1/ε) and choose the optimal γ. algorithm for Subset Sum running in eO(cid:0)n + ε− 5 Proof. We apply Lemma 4.2 to ensure that the number of items is eO(cid:0) 1 Theorem 5.11 (Weak apx for Subset Sum). There is a randomized weak (1 − ε)-approximation ε(cid:1) and work with an O(ε)-close instance. Then we take advantage of Corollary 5.9 with γ = ε 3(cid:1) time. 3 . 2 Analogously for Partition we get that: Theorem 5.12 (Apx for Partition). There is a randomized (1 − ε)-approximation algorithm for Partition running in eO(cid:0)n + ε− 5 3(cid:1) time. 6 Approximate (min, +)-convolution Approximate (min, +)-convolution Input: Sequences A[0, . . . , n − 1], B[0, . . . , n − 1] of positive integers and approximation pa- rameter 0 < ε < 1 Task: Let OPT[k] = min0≤i≤k(A[i] + B[k − i]) be the (min, +)-convolution of A and B. Find a sequence C[0, . . . , n − 1] such that ∀i OPT[i] ≤ C[i] ≤ (1 + ε)OPT[i] 20 Backurs et al. [10] described a (1 + ε)-approximation algorithm for (min, +)-convolution, that ǫ2 log n log2 W ). In their paper [10] it is used as a building block runs deterministically in time O( n to show a near-linear time approximation algorithm for TreeSparsity. With the approximation algorithm for (min, +)-convolution, they managed to solve TreeSparsity approximately in eO( n ε2 ) time, which in practical applications may be faster than solving this problem exactly in time eO(n2). We begin with explaining its connection with the Subset Sum problem. A natural generaliza- tion of Subset Sum is Knapsack. In this scheme each item has value and weight and our task is to pack items into the knapsack of capacity C, so that their cumulative weight does not exceed capacity and in the same time we want to maximize their total value. In the special case when all weights and values are equal we obtain the Subset Sum problem. To certify the existence of a subset with a given sum, we have used the fast convolution using FFT as subroutine. If we want to generalize it and capture maximal value subset of items of a given weight, we require (max, +)-convolution, which is computationally equivalent to (min, +)- convolution. Cygan et al. [24] exploited this idea to show subquadratic equivalence between exact (min, +)- convolution, Knapsack, and other problems. Here we focus on the approximate setting. From [24] ε1.99 ) approximation algorithm for Unbounded Knapsack is unlikely. ε2 ) FPTAS for Unbounded it follows that the eO(n + 1 This lower bounds proves the optimality of Jansen and Kraft [40] eO(n+ 1 Knapsack. The current best FPTAS for Knapsack is burdened with time complexity of eO(n + In this section we improve upon the eO(n/ε2) approximation algorithm. for (min, +)-convolution. Similar techniques have been exploited to obtain the eO(nω/ε)-time approximation for APSP [60] 1/ε12/5) Chan [19]. We hope, that our approximation schemes are a step towards a faster FPTAS for Knapsack. and they have found use in the approximate pattern matching over l∞ [51]. The basic idea is to propose a fast exact algorithm depending on W (upper bound on the weights) and apply it after rounding weights into smaller space. Our result also applies to (max, +)-convolution. 6.1 Exact eO(nW ) algorithm The (min, +)-convolution admits a brute force O(n2)-algorithm. From the other hand, when all values in sequences are binary, then applying FFT and performing convolution yields an O(n log n)- algorithm. Our exact eO(nW ) algorithm is an attempt to capture this trade-off. Note, that this algorithm is worse than a brute force whenever W > n which is often the case. However, this algorithm turns out useful for approximation. Lemma 6.1. The (min, +)-convolution [(max, +)-convolution] problem can be solved deterministi- cally in O(nW log (nW )) time and O(nW ) space. Proof. Given sequences A[0, . . . , n − 1] and B[0, . . . , n − 1] with values at most W , we transform them into binary sequences of length 2nW . We encode every number in the natural unary manner. For 0 ≤ i < n, 1 ≤ k ≤ W we define: a[2W i + k] =(0 if A[i] 6= k 1 if A[i] = k and similarly we define sequence B. For example, sequence (2, 3, 1) with W = 3 gets encoded as 010'000'001'000'100'000 (the separators ' are used to visually separate sections of length W ). 21 We compute convolution C = A⊕ B using FFT in time O(nW log n log W ). Since C[2W i + k] = P i1+i2=i A[2W i1 + k1] · B[2W i2 + k2], the first nonzero occurrence in the i-th block of length 2W encodes the value of the i-th element of the requested (min, +)-convolution. If we are interested in computing (max, +)-convolution, we should similarly seek for last nonzero value in each block. k1+k2=k The time complexity is dominated by performing convolution with FFT. As the additional space we need O(nW ) bits for the transformed sequences. 6.2 Approximating Algorithm We start with a lemma inspired by [60, Lemma 5.1] and [51, Lemma 1]. Lemma 6.2. For natural numbers x, y and positive q, ε satisfying q ≤ x + y and 0 < ε < 1 it holds: x + y ≤(cid:16)l 2x (x + y)(1 − ǫ) <(cid:16)j 2x qǫm +l 2y qǫk +j 2y qǫm(cid:17) qǫ qǫk(cid:17) qǫ 2 ≤ x + y. Proof. The proof is a special case of Lemmas B.1 and B.2 for k = 2. 2 < (x + y)(1 + ǫ), Lemma 6.3. Assume the (min, +)-convolution [(max, +)-convolution] can be solved exactly in time T (n, W ). Then we can approximate (min, +)-convolution [(max, +)-convolution] in time O((T (n, 4 ε )+ n) log W ). Algorithm 2 ApproximateMinConv(A, B). We use a simplified notation to transform all ele- ments in the sequences A[i] and B[i]. 1: Output[i] = ∞ 2: for l = 2⌈log W⌉, . . . , 0 do 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: q := 2l A′[i] = ⌈ 2A[i] qε ⌉ if A′[i] > ⌈4/ε⌉ then A′[i] = ∞ B′[i] = ⌈ 2B[i] qε ⌉ if B′[i] > ⌈4/ε⌉ then B′[i] = ∞ end if end if V = runExact(A′, B′) if V [i] < ∞ then end if Output[i] = V [i] · qε 2 15: 16: end for 17: return Output[0, . . . , n − 1] Proof. The idea is based on [51, Section 6.2]. We focus on the variant with (min, +)-convolution, however the proofs works alike for (max, +)-convolution. 22 array by qǫ We iterate the precision parameter q through 2W, W, . . . , 4, 2, 1. In each iteration we apply the 2 and store them in the output array C, possibly overwriting some elements. qǫ(cid:7)) to all elements in A, B, we set ∞ for each value exceeding transform from Lemma 6.2 (x →(cid:6) 2x (cid:6) 4 ε(cid:7), and launch the exact algorithm on such input. We multiply all finite elements in the returned m are at most (cid:6) 4 parameter q such that q ≤ C[k] < 2q. The rounded numbers l 2A[i] ε(cid:7), Assume the correct value of C[k] equals A[i] + B[k − i]. For some iteration we get the precision so we will update the k-th index in the output array. On the other hand, the assumption of Lemma 6.2 is satisfied, therefore the generated value lies between C[k] and C[k](1 + ε). In the following iterations, we will still have q ≤ C[k], therefore any further updates to the k-th index will remain valid. The algorithm performs O(log W ) iterations and in each step we run the exact algorithm in ǫ ), thanks to the pruning procedure. Transforming the sequences takes O(n) time in qǫ m,l 2B[k−i] qǫ time T (n, 4 each step. Theorem 6.4 (Apx for (min / max, +)-conv). There is a deterministic algorithm for (1 + ε)- approximate (min, +)-convolution [(max, +)-convolution] running in O(cid:0) n Proof. From Lemma 6.1 the running time of exact algorithm is T (n, W ) = O(nW log n log W ). This quantity dominates the additive term O(n log W ). Hence by replacing each W with 1/ε we get the claimed running time. ε log ( n ε ) log W(cid:1) time. 7 Tree Sparsity running time for (1 + ε)-tail approximation. The TreeSparsity problem has been stated as follows: given a node-weighted binary tree and an integer k, find a rooted subtree of size k with the maximal weight. Its approximation version comes with two flavors: as a head approximation where we are supposed to maximize the weight of the solution, and as a tail approximation where we minimize the total weight of nodes that do not belong to the solution. Note that a constant approximation for one of the variants does not necessarily yield a constant approximation for the other one. Backurs et al. [10] proposed an for approximating (min, +) and (max, +) convolutions. Our construction is based on the approach by Cygan et al. [24] which also results in a simpler analysis than for the previously known approxi- mation schema [10]. In particular, a single proof suffices to cover both head and tail variants. ε2 · log12 n · log2 W(cid:1) running time for (1 − ε)-head approximation, and an O(cid:0) n O(cid:0) n In this section we improve the running times for both variants relying on the eO(cid:0) n ε · log(n/ε)· log3 n· log W(cid:1)-time algorithm that computes the maximal weights of rooted subtrees O(cid:0) n (1 + ε)-approximate TreeSparsity can be solved in time O(cid:0)(cid:0)n + T (n, W, ε/ log2 n)(cid:1) log n(cid:1). ε3 · log9 n · log3 W(cid:1) ε(cid:1) algorithm Theorem 7.1. If (1 + ε)-approximate (min, +)-convolution can be solved in time T (n, W, ε), then The following theorem, combined with our approximation for (min, +)-convolution yields an for each size k = 1, . . . , n with a relative error at most ε in both head and tail variant. Proof. We exploit the heavy-light decomposition introduced by Sleator and Tarjan [57]. This tech- nique has been utilized by Backurs et al. [10] in their work on TreeSparsity approximation and later by Cygan et al. [24] in order to show a subquadratic equivalence between TreeSparsity and (min, +)-convolution. 23 We construct a spine with a head s1 at the root of the tree. We define si+1 to be the child of si with the larger subtree (in case of draw we choose any child) and the last node in the spine is a leaf. The remaining children of nodes si become heads for analogous spines so the whole tree gets covered. Observe that every path from a leaf to the root intersects at most log n spines because each spine transition doubles the subtree size. At first we express the head variant in the convolutional paradigm. For a node v with a subtree of size m we define the sparsity vector (xv[0], xv[1], . . . , xv[m]) of weights of the heaviest subtrees rooted at v with fixed sizes. This vector equals the (max, +)-convolution of the sparsity vectors for the children of v. We are going to compute sparsity vectors for all heads of spines in the tree recursively. Having this performed we can read the solution from a sparsity vector of the root. Let (si)ℓ i=1 be a spine with a head v and let ui indicate the sparsity vector for the child of si being a head (i.e., the child with the smaller subtree). If si has less than two children we treat ui as a vector (0). For an interval [a, b] ⊆ [1, ℓ] let ua,b = ua⊕max ua+1⊕max···⊕max ub and ya,b[k] be the maximum 2 (cid:5). The ⊕max weight of a subtree of size k rooted at sa and not containing sb+1. Let c = (cid:4) a+b operator is associative so ua,b = ua,c ⊕max uc+1,b. To compute the second vector we consider two cases: whether the optimal subtree contains sc+1 or not. ya,b[k] = max(cid:20)ya,c[k], = max(cid:20)ya,c[k], cXi=a cXi=a max x(si) + k1+k2=k−(c−a+1)(cid:16)ua,c[k1] + yc+1,b[k2](cid:17)(cid:21) x(si) +(cid:16)ua,c ⊕max yc+1,b(cid:17)(cid:2)k − (c − a + 1)(cid:3)(cid:21) (2) 2 ] and [ ℓ Using the presented formulas we reduce the problem of computing xv = y1,ℓ to subproblems for intervals [1, ℓ 2 + 1, ℓ] and results are merged with two (max, +)-convolutions. Proceeding further we obtain log ℓ levels of recursion. Since there are O(log n) spines on a path from a leaf to the root, the whole computation tree has O(log2 n) layers, each node being expressed as a pair of convolutions on vectors from its children. Each vertex of the graph occurs in at most log n convolutions so the sum of convolution sizes is O(n log n). In order to deal with the tail variant we consider a dual sparsity vector (xv[0], xv[1], . . . , xv[m]), where xv[i] stands for the total weight of the subtree rooted at v minus xv[i]. The dual sparsity vector of v equals the (min, +)-convolution of the vectors for the children of v. We can use an analog of equation (2) and also express the problem as a computation tree based on convolutions. We take advantage of Theorem 6.4 to perform each convolution with a relative error δ. The formula (2) contains an additive termPc i=a x(si) but this can only decrease the relative error. The cumulative relative error is bounded by (1− δ)log2 n for head approximation and (1 + δ)log2 n for tail approximation, therefore setting δ = Θ(ε/ log2 n) guarantees that the sparsity vector for the root is burdened with relative error at most ε. The sum of running times for all convolutions is O(cid:0)T (n, W, δ) log n(cid:1), what gives the postulated running time for the whole algorithm. In order to retrieve the solution for a given k, we need to find the pair of indices that produced the value of the k-th index of the last convolution. Then we proceed recursively and traverse back the computation tree. Since finding arg max and arg min can be performed in linear time, the total time of analyzing all convolutions is O(n log n). 24 8 In the abstract we have claimed that our result for Partition constitutes the first approximation algorithm for NP-hard problem that breaks the quadratic barrier. However this is not necessary the eO(n + 1/ε) approximation algorithm for 3SUM case for the problems in P. In this section we will show an eO(n + 1/ε) approximation algorithm for 3SUM and prove accompanying lower bound under a reasonable assumption. To the best of our knowledge, this is also the first nontrivial linear approximation algorithm for a natural problem. k-SUM Input: Sets A1, A2, . . . , Ak−1, S, each with cardinality at most n. Task: Decide if there is a tuple (a1, . . . , ak−1, s) ∈ A1×. . .×Ak−1×S such that a1+. . .+ak−1 = s. The 3SUM problem is a special case of k-SUM for k = 3. The 3SUM is one of the most notori- ous problems with a quadratic running time and has been widely accepted as a hardness assumption (see [58] for overview). The fastest known algorithm for 3SUM is slightly subquadratic: Jørgensen and Pettie [41] gave an O(n2(log log n/ log n)2/3)-time deterministic algorithm and then indepen- dently Freund [25] and Gold and Sharir [34] improved this result by presenting an O(n2 log log n/ log n)- time algorithm. eO( n algorithm for 3SUM. In this section we show how to solve 3SUM approximately in time eO(n + 1/ε) The approximation variant for 3SUM was considered by Gfeller [33] who showed a deterministic If we are not ε ) algorithm as a byproduct of finding longest approximate periodic patterns. interested in exact solution, the Gfeller [33] algorithm is polynomially faster than the best exact time and prove this tight up to the polylogarithmic factors. Approximate 3SUM ([33]) Input: Three sets A, B, C of positive integers, each with cardinality at most n. Task: The algorithm: • concludes that no triple (a, b, c) ∈ A × B × C with a + b = c exists, or • it outputs a triple (a, b, c) ∈ A × B × C with a + b ∈ [c/(1 + ε), c(1 + ε)]. This definition generalizes to k-SUM, however we are unaware about any previous works on approximate k-SUM. 8.1 Faster approximation algorithm for 3SUM approximation algorithm. In the Section 9 we will show a conditional optimality of this result. technique from Section 6, where we gave the fast approximation algorithm for (min, +)-convolution. In this section we present an eO(n + 1/ε)-time approximation scheme for 3SUM problem. We use a As previously, we start with a fast eO(n + W ) exact algorithm and then utilize rounding to get an 8.1.1 Exact eO(n + W ) algorithm for 3SUM Let W denote the upper bound on the integers in the sets A,B and C. The exact eO(n + W )-time algorithm for 3SUM is already well known [22, 20]. In here we will place the proof for completeness. For formal reasons we need to take care of the special symbol ∞. What is more, we will generalize this result to k-SUM. 25 Theorem 8.1 (Based on [22, 20]). The k-SUM can be solved deterministically in eO(kn+kW log W ) time and eO(kn + W ) space. Proof. We will encode the numbers in the sets as binary arrays of size O(W ) and iteratively perform fast convolution using FFT. Because we will use only O(1) tables at once, the space complexity will not depend on k. At the end we will need to check if any entry in the final array is in S. Encoding: We iterate for every set A1, . . . , Ak−1 and for l-th iteration encode it as a binary vector V of length W + 1, such that: Vl[i] =(1 iff t ∈ Al 0 otherwise to save space we will use only one Vl vector at the time. The encoding can be done in O(n + W ) time. If the special symbol ∞ ∈ Al appears then we simply discard it. FFT: We want to perform a convolution with FFT on all vectors Vl. We do it one at a time and discard all elements larger than W . Let Ul be the result of up to l-th iteration. We know that the proper polynomial is Ul(x) =P(a1,...,al)∈(A1×...×Al) xa1+...al. And if we multiply it by the polynomial Vl+1 =Pal+1∈Al+1 xal+1, we get Ul+1(x) =P(a1,...,al+1)∈(A1×...×Al+1) xa1+...al+1. Hence at the end we obtain the vector Vk−1 that encodes all the sums of elements in subsets truncated up to W place. Comparing At the end we need to get the binary vector for S and compare it with the resulting vector Vk−1. Time and Space We did k iterations. In each of them we transformed a set into a vector in time O(n). The fast convolution works in O(T log T ) by using FFT. Hence, the running time is O(kn + kW log W ). Algorithm needs O(nk) space to encode input and O(W ) space to store binary vectors. 8.1.2 Approximation algorithm Next we will use an exact algorithm to propose the fast approximation. We will use the same reasoning as in Section 6.4. Lemma 8.2. Assume the k-SUM can be solved exactly in T (n, k, W ) time. Then approximate k-SUM can be solved in O((T (n, k, k/ε) + nk) log W ) time. Because the proof is just a small modification of the Lemma 6.3 we have included it in Sec- tion 8.1.3. At the end we need to connect the exact algorithm from Lemma 8.1 and the reduction from Lemma 8.2. ε log k ε log W ) time. Theorem 8.3. There is a deterministic algorithm for (1 + ε)-approximate k-SUM running in O(nk log W + k2 Proof. From Lemma 8.1 the running time of k-SUM is T (n, k, W ) = O(nk + kW log W ). Applying this running time to the reduction in Lemma 8.2 results in the claimed running time, because the O(nk) term is dominated by O(nk log W ) term in the reduction. 26 To get an approximate algorithm for 3SUM we set k = 3. Corollary 8.4. The approximate 3SUM can be solved deterministically in O((n + 1 time. ε log 1 ε ) log W )) 8.1.3 Proof of Lemma 8.2 Algorithm 3 ApproximateKSum(a1, a2, . . . , ak−1, s, ε). We use a shorten notation to transform all elements in the sequences al[i] and s[i]. 1: Output[i] = ∞ 2: for l = 2⌈log W⌉, . . . , 0 do q := 2l for l = 1 . . . k − 1 do qε m l[i] =l kal[i] a′ if a′ l[i] > ⌈4k/ε⌉ then a′ l[i] = ∞ end if end for qε m s′[i] =l ks[i] if s′[i] > ⌈4k/ε⌉ then 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: s′[i] = ∞ end if if runExactKsum(a′ 1, . . . , a′ k−1, s′) then return True end if 15: 16: 17: end for 18: return False Proof. The proof basically follows the approach approximating (min, +)-convolution in Lemma 6.3. Assume, that there is some number s, for each there exists a tuple (a1, a2, . . . , ak−1) ∈ A1×. . . Ak−1, i=1 ai < s(1 + ε). Then look at Algorithm 3 in which we iterate precision parameter q. Hence there is some q, such that q ≤ s < 2q. From Lemma B.1 we know, that then, we can round the numbers a′ that s <Pk qεm and then their sum should be approximately: i =l kai kXi=1 ai ≤X(cid:24) kai qε(cid:25) < (1 + ε) ai kXi=1 So if there is some number s ∈ S, then ApproximateKSum algorithm would find a tuple, that sum up to s′ ∈ [s, (1 + ε)s]. From the other hand, if for all s ∈ S no tuple sums up to [s, (1 + ε)s] then our Approxi- mateKSum can also return YES. It is because before rounding items could sum up to something in [(1−ε)s, s] (see Section 2). However, if there for such a parameter there always exists a precision pa- rameter q, that q ≤ s < 2q. Then rounding the numbers according to Lemma B.1 gives only (1± ε) 27 error and they cannot sum tol ks qεm. Hence if for all s ∈ S no tuple sums up to [(1 − ε)s, (1 + ε)s] then our ApproximateKSum will return NO. A technicality is hidden in the Definition 8 we need to return approximation of the form 1+ε ≈ 1 − ε so we can take care of if by OPT/(1 + ε) ≤ OUR ≤ OPT(1 + ε) but note that adjusting ε. 1 9 Conditional Lower Bounds Proving conditional lower bounds in P under a plausible assumption is a very active line of re- search [58, 23, 2, 3, 4, 1]. One of the first problems with a truly subquadratic running time ruled out was EditDistance [9]. It admits a linear time approximation algorithm for ε = 1/√n, that follows from the exact O(n + d2) algorithm. Subsequently, this (linear-time) approximation factor was improved by Bar-Yossef et al. [12] to n3/7+o(1), then by Batu et al. [14] to n1/3+o(1), and most recently Andoni et al. [5] proposed an O(n1+ε)-time algorithm with factor (log n)O(1/ε) for every fixed ε > 0. From the other hand Abboud and Backurs [1] ruled out a truly subquadratic PTAS for Longest Common Subsequence using circuit lower bounds. Our results are somehow of similar flavor to this line of research. 9.1 Conditional Lower Bound for Approximate 3SUM we rule out such a possibility and prove the optimality of Theorem 8.4. To show the conditional lower bound we will assume the hardness of the exact 3SUM. The We have shown an approximate algorithm for 3SUM running in eO(n + 1/ε) time. Is this the best we can hope for? Perhaps one could imagine an eO(n + 1/√ε) time algorithm. In this subsection 3SUM conjecture says, that the eO(n2) algorithm is essentially the best we can hope for up to Conjecture 9.1 (3SUM conjecture [58]). In the Word RAM model with O(log n) bit words, any al- gorithm requires Ω(n2−o(1)) time in expectation to determine whether given set S ⊂ {−n3+o(1), . . . , n3+o(1)} of size n contains three distinct elements a, b, c such that a + b = c. subpolynomial factors. This definition of 3SUM in [58] is equivalent to the one in Section C (see discussion in [13]). What is more, solving 3SUM with only polynomially bounded numbers can be reduced to solving it with the upper bound W = O(n3) [13]. 3SUM can be solved in subquadratic time when W = O(n2−δ) via FFT, but doing so assuming only W = O(n2) constitutes a major open problem. Hsu and Umans [38] have considered it as a yet another hardness assumption. Conjecture 9.2 (Strong-3SUM conjecture [38]). 3SUM on a set of n integers in the domain of {−n2, . . . , n2} requires time Ω(n2−o(1)). Theorem 9.3. Assuming the Strong-3SUM conjecture, there is no eO(n + 1/ε1−δ) algorithm for (1 + ε)-approximate 3SUM, for any constant δ > 0. Proof. Consider the exact variant of 3SUM within the domain {−n2, . . . , n2}. We can assume that the numbers are divided into sets A, B, C and we can restrict ourselves to triples a ∈ A, b ∈ B, c ∈ C [13]. We add n2 + 1 to all numbers in A ∪ B and likewise 2n2 + 2 to numbers in C to obtain an equivalent instance with all input numbers greater than 0 and W = O(n2). 28 We can use it to solve the problem above exactly by setting ε = 1 Suppose, that for some small δ > 0 the approximate 3SUM admits an eO(n + 1/ε1−δ)-algorithm. the exact algorithm is strongly subquadratic, namely eO(n + 1/ε1−δ) = eO(n2−2δ). This contradicts the Strong-3SUM conjecture. 2 ). The running time of 2W = Ω(n 1 9.2 Conditional Lower Bounds for Knapsack-type Problems The conditional lower bounds for Knapsack and Unbounded Knapsack are corollaries from [24]. We commence by introducing the main theorem from that work, truncated to problems that are of interest to us. Theorem 9.4 (Theorem 2 from [24]). The following statements are equivalent: 1. There exists an O(n2−ε) algorithm for (min, +)-convolution for some ε > 0. 2. There exists an O(cid:0)(n + t)2−ε(cid:1) algorithm for Unbounded Knapsack for some ε > 0. 3. There exists an O(cid:0)(n + t)2−ε(cid:1) algorithm for Knapsack for some ε > 0. We allow randomized algorithms. Conjecture 9.5 ((min, +)-convolution conjecture [24]). Any algorithm computing (min, +)-convolution requires Ω(n2−o(1)) running time. Basically [24, Theorem 2] says that assuming the (min, +)-convolution conjecture both Un- bounded Knapsack and Knapsack require Ω((n + t)2−o(1)) time. The pseudo-polynomial algo- rithm for Knapsack running in time O(nt) can be modified to work in time O(nv), where v is an upper bound on value of the solution. In similar spirit, the reductions from [24] can use a hypothet- algorithm for (min, +)-convolution (modify Theorem 4 from [24]). ical O(cid:16)(n + v)2−δ(cid:17) algorithm for Knapsack or Unbounded Knapsack to get a subquadratic Knapsack with O(cid:16)(n + v)2−δ(cid:17) running time would refute the (min, +)-convolution conjecture. Corollary 9.6 ([24]). For any constant δ > 0, an exact algorithm for Knapsack or Unbounded We need this modification because in the definition of FPTAS for Knapsack we consider relative error with respect to the optimal value (not weight). We can use a hypothetical faster approximation algorithm to get a faster pseudo-polynomial exact algorithm, what would contradict the (min, +)- convolution conjecture. More formally: Theorem 9.7 (restated Theorem 1.6). For any constant δ > 0, obtaining a weak (1−ε)-approximation for Knapsack or Unbounded Knapsack with O((n + 1/ε)2−δ) running time would refute the (min, +)-convolution conjecture. Unbounded Knapsack) with running time O(cid:0)(n + 1/ε)2−δ(cid:1). If we set ε = 2/v, then the ap- Proof. Suppose, that for some δ > 0 we have a weak (1 − ε)-approximation for Knapsack (or proximation algorithm would solve the exact problem because the absolute error gets bounded by 1/2. By [24, Theorem 2] we know that such an algorithm contradicts the (min, +)-convolution conjecture. The claim follows. 29 A similar argument works for the Subset Sum problem. Abboud et al. [4] showed that assuming SETH there can be no O(t1−δpoly(n)) algorithm for Subset Sum (Cygan et al. [23] obtained the same lower bound before but assuming the SetCover conjecture). Theorem 9.8 (Conditional Lower Bound for approximate Subset Sum). For any constant δ > 0, a weak (1− ε)-approximation for Subset Sum with running time O(cid:16)poly(n)(cid:0) 1 SETH and SetCover conjecture. ε(cid:1)1−δ(cid:17) would refute Proof. We set ε = 2/t and obtain an algorithm solving the exact Subset Sum, because all numbers are integers and the absolute error is at most 1/2. The running time is O(t1−δpoly(n)), what refutes SETH due to [4] and the SetCover conjecture due to [23]. 10 Conclusion and Open Problems In this paper we study the complexity of the Knapsack, Subset Sum and Partition. In the exact setting, if we are only concerned about the dependence on n, Knapsack and Subset Sum were already known to be equivalent up to the polynomial factors. Nederlof et al. [55, Theorem 2] showed, that if there exists an exact algorithm for Subset Sum working in O∗(T (n)) time and O∗(S(n)) space, then we can construct an algorithm for Knapsack working in the same O∗(T (n)) time and O∗(S(n)) space. In contrast, in the realm of pseudo-polynomial time complexity, Subset Sum seems to be simpler than Knapsack (see Bringmann [17], Cygan et al. [24]). In this paper, we show similar separation for Knapsack and Partition in the approximation setting. rithm for Subset Sum is optimal assuming (min, +)-convolution conjecture. Can we improve the After this paper was announced, Bringmann [18] showed that the current eO(n + 1/ε2) algo- approximation algorithm for Knapsack to an eO(n + 1/ε2) and match the quadratic lower bound? It also remains open whether 3SUM and (min, +)-convolution admit FPTAS algorithms with no dependence on W . To add weight to this open problem, note that it is this issue that makes the FPTAS algorithms for TreeSparsity inefficient in practice. Closing the time complexity gap for Partition is another open problem, either by improving the eO((n + 1/ε)5/3)) FPTAS or the Ω((n + 1/ε)1−o(1)) conditional lower bound. It is worth noting, that if the Freiman's Conjecture [26] is true, then our techniques would automatically lead to even faster FPTAS for Partition. Finally, one can also ask whether randomization is necessary to obtain subquadratic FPTAS for Partition. We believe that the randomized building blocks can be replaced with deterministic algorithms by Kellerer et al. [46] and Koiliaris and Xu [48]. 11 Acknowledgements This work is part of the project TOTAL that has received funding from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (grant agreement No 677651). Karol Węgrzycki is supported by the grants 2016/21/N/ST6/01468 and 2018/28/T/ST6/00084 of the Polish National Science Center. We would like to thank Marek Cygan, Artur Czumaj, Zvi Galil, Oded Margalit and Piotr Sankowski for helpful discussions. Also we are grateful to the organizers and participants of the Bridging Continuous and Discrete Optimization program at the Simons Institute for the Theory of Computing, especially Aleksander Mądry. 30 References [1] Amir Abboud and Arturs Backurs. Towards hardness of approximation for polynomial time problems. In Christos H. Papadimitriou, editor, 8th Innovations in Theoretical Computer Science Conference, ITCS 2017, January 9-11, 2017, Berkeley, CA, USA, volume 67 of LIPIcs, pages 11:1 -- 11:26. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2017. ISBN 978-3-95977- 029-3. URL http://www.dagstuhl.de/dagpub/978-3-95977-029-3. [2] Amir Abboud, Ryan Williams, and Huacheng Yu. More applications of the polynomial method to algorithm design. In Proceedings of the Twenty-sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '15, pages 218 -- 230, Philadelphia, PA, USA, 2015. Society for Industrial and Applied Mathematics. [3] Amir Abboud, Virginia Vassilevska Williams, and Joshua R. Wang. Approximation and fixed parameter subquadratic algorithms for radius and diameter in sparse graphs. In Robert Krauthgamer, editor, Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2016, Arlington, VA, USA, January 10-12, 2016, pages 377 -- 391. SIAM, 2016. [4] Amir Abboud, Karl Bringmann, Danny Hermelin, and Dvir Shabtay. Seth-based lower bounds for subset sum and bicriteria path. arXiv preprint arXiv:1704.04546, to appear at SODA 2019, 2019. [5] 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. IEEE Computer Society, 2010. [6] Per Austrin, Petteri Kaski, Mikko Koivisto, and Jussi Määttä. Space-time tradeoffs for sub- set sum: An improved worst case algorithm. In Fedor V. Fomin, Rusins Freivalds, Marta Z. Kwiatkowska, and David Peleg, editors, Automata, Languages, and Programming - 40th Inter- national Colloquium, ICALP 2013, Riga, Latvia, July 8-12, 2013, Proceedings, Part I, volume 7965 of Lecture Notes in Computer Science, pages 45 -- 56. Springer, 2013. [7] Per Austrin, Petteri Kaski, Mikko Koivisto, and Jesper Nederlof. Subset sum in the absence of concentration. In Ernst W. Mayr and Nicolas Ollinger, editors, 32nd International Symposium on Theoretical Aspects of Computer Science, STACS 2015, March 4-7, 2015, Garching, Ger- many, volume 30 of LIPIcs, pages 48 -- 61. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2015. [8] Per Austrin, Petteri Kaski, Mikko Koivisto, and Jesper Nederlof. Dense subset sum may be the hardest. In Nicolas Ollinger and Heribert Vollmer, editors, 33rd Symposium on Theoretical Aspects of Computer Science, STACS 2016, February 17-20, 2016, Orléans, France, volume 47 of LIPIcs, pages 13:1 -- 13:14. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2016. [9] Arturs Backurs and Piotr Indyk. Edit distance cannot be computed in strongly subquadratic time (unless SETH is false). In 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, pages 51 -- 58. ACM, 2015. 31 [10] Arturs Backurs, Piotr Indyk, and Ludwig Schmidt. Better approximations for tree sparsity in nearly-linear time. 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 2215 -- 2229. SIAM, 2017. [11] Nikhil Bansal, Shashwat Garg, Jesper Nederlof, and Nikhil Vyas. Faster space-efficient algo- rithms for subset sum and k-sum. 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 198 -- 209. ACM, 2017. [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. IEEE Computer Society, 2004. [13] Ilya Baran, Erik D. Demaine, and Mihai Patrascu. Subquadratic algorithms for 3sum. Algo- rithmica, 50(4):584 -- 596, 2008. [14] Tugkan Batu, Funda Ergün, and Süleyman Cenk Sahinalp. Oblivious string embeddings and edit distance approximations. In Proceedings of the Seventeenth Annual ACM-SIAM Sympo- sium on Discrete Algorithms, SODA 2006, Miami, Florida, USA, January 22-26, 2006, pages 792 -- 801. ACM Press, 2006. [15] Richard Bellman. Dynamic Programming. Princeton University Press, Princeton, NJ, USA, 1957. [16] Anand Bhalgat, Ashish Goel, and Sanjeev Khanna. Improved approximation results for stochas- tic knapsack problems. In Dana Randall, editor, Proceedings of the Twenty-Second Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2011, San Francisco, California, USA, January 23-25, 2011, pages 1647 -- 1665. SIAM, 2011. [17] Karl Bringmann. A near-linear pseudopolynomial time algorithm for subset sum. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '17, pages 1073 -- 1084, Philadelphia, PA, USA, 2017. Society for Industrial and Applied Mathematics. [18] Karl Bringmann. personal communication, April 2018. [19] Timothy M. Chan. Approximation schemes for 0-1 knapsack. In Raimund Seidel, editor, 1st Symposium on Simplicity in Algorithms, SOSA 2018, January 7-10, 2018, New Orleans, LA, USA, volume 61 of OASICS, pages 5:1 -- 5:12. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2018. [20] Timothy M. Chan and Moshe Lewenstein. Clustered integer 3sum via additive combinatorics. In Proceedings of the Forty-seventh Annual ACM Symposium on Theory of Computing, STOC '15, pages 31 -- 40, New York, NY, USA, 2015. ACM. [21] Ioannis Chatzigiannakis, Piotr Indyk, Fabian Kuhn, and Anca Muscholl, editors. 44th Inter- national Colloquium on Automata, Languages, and Programming, ICALP 2017, July 10-14, 2017, Warsaw, Poland, volume 80 of LIPIcs, 2017. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik. 32 [22] Thomas H Cormen. Introduction to algorithms. MIT press, 2009. [23] Marek Cygan, Holger Dell, Daniel Lokshtanov, Dańiel Marx, Jesper Nederlof, Yoshio Okamoto, Ramamohan Paturi, Saket Saurabh, and Magnus Wahlstrom. On problems as hard as cnf-sat. In Proceedings of the 2012 IEEE Conference on Computational Complexity (CCC), CCC '12, pages 74 -- 84, Washington, DC, USA, 2012. IEEE Computer Society. [24] Marek Cygan, Marcin Mucha, Karol Wegrzycki, and Michal Wlodarczyk. On problems equiv- alent to (min, +)-convolution. In Chatzigiannakis et al. [21], pages 22:1 -- 22:15. [25] Ari Freund. Improved subquadratic 3sum. Algorithmica, 77(2):440 -- 458, 2017. [26] Zvi Galil and Oded Margalit. An almost linear-time algorithm for the dense subset-sum prob- lem. SIAM J. Comput., 20(6):1157 -- 1189, 1991. [27] Zvi Galil and Oded Margalit. An almost linear-time algorithm for the dense subset-sum problem. In Javier Leach Albert, Burkhard Monien, and Mario Rodríguez-Artalejo, editors, Automata, Languages and Programming, 18th International Colloquium, ICALP91, Madrid, Spain, July 8-12, 1991, Proceedings, volume 510 of Lecture Notes in Computer Science, pages 719 -- 727. Springer, 1991. ISBN 3-540-54233-7. [28] Zvi Galil and Oded Margalit. personal communication, 2017. [29] George Gens and Eugene Levner. Computational complexity of approximation algorithms for combinatorial problems. In Jirí Becvár, editor, Mathematical Foundations of Computer Science 1979, Proceedings, 8th Symposium, Olomouc, Czechoslovakia, September 3-7, 1979, volume 74 of Lecture Notes in Computer Science, pages 292 -- 300. Springer, 1979. [30] George Gens and Eugene Levner. A fast approximation algorithm for the subset-sum problem. INFOR: Information Systems and Operational Research, 32(3):143 -- 148, 1994. [31] Georgii V Gens and Eugenii V Levner. Fast approximation algorithms for knapsack type problems. In Optimization Techniques, pages 185 -- 194. Springer, 1980. [32] GV Gens and EV Levner. Approximation algorithm for some scheduling problems. Engrg. Cybernetics, 6:38 -- 46, 1978. [33] Beat Gfeller. Finding longest approximate periodic patterns. In Frank Dehne, John Iacono, and Jörg-Rüdiger Sack, editors, Algorithms and Data Structures - 12th International Symposium, WADS 2011, New York, NY, USA, August 15-17, 2011. Proceedings, volume 6844 of Lecture Notes in Computer Science, pages 463 -- 474. Springer, 2011. [34] Omer Gold and Micha Sharir. Improved bounds for 3sum, k-sum, and linear degeneracy. In Kirk Pruhs and Christian Sohler, editors, 25th Annual European Symposium on Algorithms, ESA 2017, September 4-6, 2017, Vienna, Austria, volume 87 of LIPIcs, pages 42:1 -- 42:13. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2017. [35] Brian Hayes. Computing science: The easiest hard problem. American Scientist, 90(2):113 -- 117, 2002. 33 [36] Ellis Horowitz and Sartaj Sahni. Computing partitions with applications to the knapsack problem. J. ACM, 21(2):277 -- 292, 1974. [37] Nick Howgrave-Graham and Antoine Joux. New generic algorithms for hard knapsacks. In Henri Gilbert, editor, Advances in Cryptology - EUROCRYPT 2010, 29th Annual International Conference on the Theory and Applications of Cryptographic Techniques, French Riviera, May 30 - June 3, 2010. Proceedings, volume 6110 of Lecture Notes in Computer Science, pages 235 -- 256. Springer, 2010. [38] Chloe Ching-Yun Hsu and Chris Umans. On multidimensional and monotone k-sum. To appear at MFCS 2017, 2017. [39] 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. [40] Klaus Jansen and Stefan Erich Julius Kraft. A faster FPTAS for the unbounded knapsack In Zsuzsanna Lipták and William F. Smyth, editors, Combinatorial Algorithms - problem. 26th International Workshop, IWOCA 2015, Verona, Italy, October 5-7, 2015, Revised Selected Papers, volume 9538 of Lecture Notes in Computer Science, pages 274 -- 286. Springer, 2015. [41] Allan Grønlund Jørgensen and Seth Pettie. Threesomes, degenerates, and love triangles. In 55th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2014, Philadelphia, PA, USA, October 18-21, 2014, pages 621 -- 630. IEEE Computer Society, 2014. [42] Edward G. Coffman Jr. and George S. Lueker. Probabilistic analysis of packing and partitioning algorithms. Wiley-Interscience series in discrete mathematics and optimization. Wiley, 1991. [43] Richard M. Karp. Reducibility among combinatorial problems. In Raymond E. Miller and James W. Thatcher, editors, Proceedings of a symposium on the Complexity of Computer Com- putations, held March 20-22, 1972, at the IBM Thomas J. Watson Research Center, Yorktown Heights, New York., The IBM Research Symposia Series, pages 85 -- 103. Plenum Press, New York, 1972. [44] R.M. Karp. The fast approximate solution to hard combinatorial problems. Proceedings of the 6th Southeastern Conference on Combinatorics, Graph Theory and Computing, pages 15 -- 31, 1975. [45] 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. [46] Hans Kellerer, Ulrich Pferschy, and Maria Grazia Speranza. An efficient approximation scheme for the subset-sum problem. In Hon Wai Leong, Hiroshi Imai, and Sanjay Jain, editors, Al- gorithms and Computation, 8th International Symposium, ISAAC '97, Singapore, December 17-19, 1997, Proceedings, volume 1350 of Lecture Notes in Computer Science, pages 394 -- 403. Springer, 1997. [47] Hans Kellerer, Ulrich Pferschy, and David Pisinger. Knapsack problems. Springer, 2004. 34 [48] Konstantinos Koiliaris and Chao Xu. A faster pseudopolynomial time algorithm for subset sum. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '17, pages 1062 -- 1072, Philadelphia, PA, USA, 2017. Society for Industrial and Applied Mathematics. [49] Marvin Künnemann, Ramamohan Paturi, and Stefan Schneider. On the fine-grained complexity of one-dimensional dynamic programming. In Chatzigiannakis et al. [21], pages 21:1 -- 21:15. [50] Eugene L Lawler. Fast approximation algorithms for knapsack problems. Mathematics of Operations Research, 4(4):339 -- 356, 1979. [51] Ohad Lipsky and Ely Porat. Approximate pattern matching with the L1, L2 and L∞ metrics. Algorithmica, 60(2):335 -- 348, 2011. [52] George B Mathews. On the partition of numbers. Proceedings of the London Mathematical Society, 1(1):486 -- 490, 1896. [53] Ralph C. Merkle and Martin E. Hellman. Hiding information and signatures in trapdoor knapsacks. IEEE Trans. Information Theory, 24(5):525 -- 530, 1978. [54] Stephan Mertens. The easiest hard problem: Number partitioning. Computational Complexity and Statistical Physics, 125(2):125 -- 139, 2006. [55] Jesper Nederlof, Erik Jan van Leeuwen, and Ruben van der Zwaan. Reducing a target interval to a few exact queries. In Branislav Rovan, Vladimiro Sassone, and Peter Widmayer, editors, Mathematical Foundations of Computer Science 2012 - 37th International Symposium, MFCS 2012, Bratislava, Slovakia, August 27-31, 2012. Proceedings, volume 7464 of Lecture Notes in Computer Science, pages 718 -- 727. Springer, 2012. [56] Richard Schroeppel and Adi Shamir. A t=o(2n/2), s=o(2n/4) algorithm for certain np- complete problems. SIAM J. Comput., 10(3):456 -- 464, 1981. [57] Daniel D. Sleator and Robert Endre Tarjan. A data structure for dynamic trees. J. Comput. Syst. Sci., 26(3):362 -- 391, June 1983. ISSN 0022-0000. [58] Virginia Vassilevska Williams. Hardness of easy problems: Basing hardness on popular con- jectures such as the strong exponential time hypothesis (invited talk). In Thore Husfeldt and Iyad A. Kanj, editors, 10th International Symposium on Parameterized and Exact Computa- tion, IPEC 2015, September 16-18, 2015, Patras, Greece, volume 43 of LIPIcs, pages 17 -- 29. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2015. [59] Gerhard J. Woeginger. When does a dynamic programming formulation guarantee the existence of a fully polynomial time approximation scheme (fptas)? INFORMS Journal on Computing, 12(1):57 -- 74, 2000. [60] Uri Zwick. All pairs shortest paths in weighted directed graphs -- exact and almost exact algorithms. In 39th Annual Symposium on Foundations of Computer Science, FOCS '98, November 8-11, 1998, Palo Alto, California, USA, pages 310 -- 319. IEEE Computer Society, 1998. 35 A Proof of Theorem 2.2 Corollary A.1 (restated Observation 2.2). If we can weakly (1 − ε)-approximate Subset Sum in time eO(T (n, ε)), then we can (1 − ε)-approximate Partition in the same eO(T (n, ε)) time. Proof. Let Z = n be the initial set of items. We run a weak (1 − ε)-approximation algorithm for Subset Sum with target b = Σ(Z)/2. Let Z ∗ denote the optimal partition of set Z: Z ∗ = arg max Σ(Z ′). Z ′⊆Z, Σ(Z ′)≤b By the definition of weak (1 − ε)-approximation for Subset Sum we get a solution ZW such that: (1 − ε)Σ(Z ∗) ≤ Σ(ZW ) and Σ(ZW ) < (1 + ε)b If Σ(ZW ) ≤ b then it is a correct solution for Partition. Otherwise we take a set Z ′ W = Z\ZW . W ) < b. Additionally we know, that Σ(ZW ) < (1 + ε)b, so Because Σ(Z)/2 = b we know that Σ(Z ′ (1 − ε)b < Σ(Z ′ W ). Similarly, because Z ∗ ≤ b, we have: (1 − ε)Σ(Z ∗) ≤ (1 − ε)b < Σ(Z ′ W ) ≤ Σ(Z ∗) ≤ b. So Σ(Z ′ W ) follows the definition of approximation for Partition. The running time follows because T (n, 1/ε) must be superlinear (algorithm needs to read input at least) and we executed the weak (1 − ε)-approximation Subset Sum algorithm only constant number of times. B Proofs of the Rounding Lemmas Lemma B.1. For k natural numbers x1, x2, . . . , xk and positive q, ε such that q ≤ Pk 0 < ε < 1, it holds: i=1 xi and xi ≤ qε k kXi=1 kXi=1(cid:24) kxi qε(cid:25) < (1 + ε) kXi=1 xi Proof. Let xi = qε k ci + di where 0 < di ≤ qε know there is at least one positive di (we will use this fact later). We have l kxi note that: qεm = ci + 1. First, k . If some xi = 0 then we set ci = di = 0, however we xi = qε k kXi=1 kXi=1 ci + kXi=1 di ≤ qε k ci + qε = qε k (ci + 1), kXi=1 what proves the left inequality. To handle the right inequality we take advantage of the assumption i=1 xi ≥ q and get: Pk (1 + ǫ) kXi=1 xi = ε xi + kXi=1 kXi=1 xi ≥ qǫ + xi = qǫ + ci + qε k kXi=1 di > qε k kXi=1 di = kXi=1 (ci + 1). kXi=1 kXi=1 kXi=1 (ci + 1) + qε k kXi=1 36 Lemma B.2. For k natural numbers x1, x2, . . . , xk and positive q, ε such that q ≤ Pk 0 < ε < 1, it holds: i=1 xi and (1 − ε) xi < qε k kXi=1 qε(cid:23) ≤ kXi=1(cid:22) kxi kXi=1 xi. Proof. The proof is very similar to the proof of Lemma B.1, however now we represent xi as qε where 0 ≤ di < qε qεk = ci. The right inequality holds because: k . We havej kxi kXi=1 di ≥ qε k qε k xi = k ci +di and the left one can be proven as follows: ci + kXi=1 kXi=1 xi − qε = kXi=1 ci kXi=1 ci + di! − qε < qε k qε k kXi=1 ci. (1 − ε) xi = kXi=1 kXi=1 xi − ε kXi=1 xi ≤ kXi=1 C Problems Definitions C.1 Exact problems Knapsack Input: A set of n items {(v1, w1), . . . , (vn, wn)} Task: Find x1, . . . , xn such that: maximize subject to nXj=1 nXj=1 vjxj wjxj ≤ t, xj ∈ {0, 1}n, j = 1, . . . n. Sometimes, instead of exact solution x1, . . . , xn in Knapsack-type problems one needs to return the value of such solution. In decision version of such problems we are given capacity t and value v and ask if there is a subset of items with the total capacity not exceeding t and total value exactly v (e.g., see discussion in [24, 47]). 37 Unbounded Knapsack Input: A set of n items {(v1, w1), . . . , (vn, wn)} Task: Find x1, . . . , xn such that: maximize subject to nXj=1 nXj=1 vjxj wjxj ≤ t, xj ∈ N ∪ {0}, j = 1, . . . n. Subset Sum Input: A set of n integers {w1, . . . , wn} Task: Find x1, . . . , xn such that: maximize subject to nXj=1 nXj=1 wjxj wjxj ≤ t, xj ∈ {0, 1}n, j = 1, . . . n. Partition 2Pn Input: A set of n integers {w1, . . . , wn} and b = 1 Task: Find x1, . . . , xn such that: i=1 wi maximize subject to nXj=1 nXj=1 wjxj wjxj ≤ b, xj ∈ {0, 1}n, j = 1, . . . n. (min, +)-convolution Input: Sequences (a[i])n−1 Task: Output sequence (c[i])n−1 i=0 , (b[i])n−1 i=0 i=0 , such that c[k] = mini+j=k(a[i] + b[j]) k-SUM Input: k − 1 sets A1, A2, . . . , Ak−1 and the set S of integers, each with cardinality at most n. Task: Is there a (a1, . . . , ak−1, s) ∈ A1 × . . . × Ak−1 × S such that a1 + . . . + ak−1 = s 3SUM Input: 3 sets A, B, C of integers, each with cardinality at most n. Task: Is there a triple (a, b, c) ∈ A × B × C such that a + b = c 38 TreeSparsity Input: A rooted tree T with a weight function x : V (T ) → N, parameter k Task: Find the maximal total weight of a rooted subtree of size k C.2 Approximate problems definition Let Σ(S) denote the sum of elements in S. The V (I) denotes the total value of items I and W (I) denotes the total weight of items. (1 − ε)-approximation of Knapsack Input: A set S = {(v1, w1), . . . , (vn, wn)} items and a target number t Task: Let Z ∗ be the optimal solution of exact Knapsack with target t. The (1 − ε)- approximate algorithm for Knapsack returns ZH such that (1 − ε)V (Z ∗) ≤ V (ZH ) ≤ V (Z ∗) and W (ZH) ≤ t. Analogous definition is for Unbounded Knapsack. (1 − ε)-approximation of Subset Sum Input: A set S = {a1, . . . , an} of positive integers and a target number t Task: Let Z ∗ be the optimal solution of exact Subset Sum with target t. The (1 − ε)- approximate algorithm returns ZH such that (1 − ε)Σ(Z ∗) ≤ Σ(ZH) ≤ Σ(Z ∗) (1 − ε)-approximation of Partition Input: A set S = {a1, . . . , an} of positive integers Task: Let Z ∗ be the optimal solution of exact Partition. The (1− ε)-approximate algorithm returns ZH such that (1 − ε)Σ(Z ∗) ≤ Σ(ZH) ≤ Σ(Z ∗) Weak (1 − ε)-approximation of Subset Sum Input: A set S = {a1, . . . , an} of positive integers and a target number t Task: Let Z ∗ be the optimal solution of exact Subset Sum with target t. The (1 − ε)- approximate algorithm returns ZH such that (1 − ε)Σ(Z ∗) ≤ Σ(ZH) ≤ Σ(Z ∗) or t ≤ Σ(ZH) ≤ (1 + ε)t Approximate 3SUM ([33]) Input: Three sets A, B, C of positive integers, each with cardinality at most n. Task: The algorithm: • concludes that no triple (a, b, c) ∈ A × B × C with a + b = c exists, or • it outputs a triple (a, b, c) ∈ A × B × C with a + b ∈ [c/(1 + ε), c(1 + ε)] 39 Approximate (min, +)-convolution Input: Sequences A[0, . . . , n − 1], B[0, . . . , n − 1] of positive integers and approximation pa- rameter 0 < ε ≤ 1 Task: Assume that OPT[k] = min0≤i≤k(A[i] + B[k − i]) is the exact (min, +)-convolution of A and B. The task is to output a sequence C[0, . . . , n − 1] such that ∀i OPT[i] ≤ C[i] ≤ (1 + ε)OPT[i] 40
1611.03385
1
1611
2016-11-10T16:27:09
Approximately Sampling Elements with Fixed Rank in Graded Posets
[ "cs.DS", "math.CO" ]
Graded posets frequently arise throughout combinatorics, where it is natural to try to count the number of elements of a fixed rank. These counting problems are often $\#\textbf{P}$-complete, so we consider approximation algorithms for counting and uniform sampling. We show that for certain classes of posets, biased Markov chains that walk along edges of their Hasse diagrams allow us to approximately generate samples with any fixed rank in expected polynomial time. Our arguments do not rely on the typical proofs of log-concavity, which are used to construct a stationary distribution with a specific mode in order to give a lower bound on the probability of outputting an element of the desired rank. Instead, we infer this directly from bounds on the mixing time of the chains through a method we call $\textit{balanced bias}$. A noteworthy application of our method is sampling restricted classes of integer partitions of $n$. We give the first provably efficient Markov chain algorithm to uniformly sample integer partitions of $n$ from general restricted classes. Several observations allow us to improve the efficiency of this chain to require $O(n^{1/2}\log(n))$ space, and for unrestricted integer partitions, expected $O(n^{9/4})$ time. Related applications include sampling permutations with a fixed number of inversions and lozenge tilings on the triangular lattice with a fixed average height.
cs.DS
cs
Approximately Sampling Elements with Fixed Rank in Prateek Bhakta ∗ Graded Posets Ben Cousins † Dana Randall § August 13, 2018 Abstract Matthew Fahrbach ‡ Graded posets frequently arise throughout combinatorics, where it is natural to try to count the number of elements of a fixed rank. These counting problems are often #P- complete, so we consider approximation algorithms for counting and uniform sampling. We show that for certain classes of posets, biased Markov chains that walk along edges of their Hasse diagrams allow us to approximately generate samples with any fixed rank in expected polynomial time. Our arguments do not rely on the typical proofs of log-concavity, which are used to construct a stationary distribution with a specific mode in order to give a lower bound on the probability of outputting an element of the desired rank. Instead, we infer this directly from bounds on the mixing time of the chains through a method we call balanced bias. A noteworthy application of our method is sampling restricted classes of integer partitions of n. We give the first provably efficient Markov chain algorithm to uniformly sample integer partitions of n from general restricted classes. Several observations allow us to improve the efficiency of this chain to require O(n1/2 log(n)) space, and for unrestricted integer partitions, expected O(n9/4) time. Related applications include sampling permutations with a fixed number of inversions and lozenge tilings on the triangular lattice with a fixed average height. 6 1 0 2 v o N 0 1 ] S D . s c [ 1 v 5 8 3 3 0 . 1 1 6 1 : v i X r a [email protected]. Supported in part by NSF grant CCF-1526900. ∗Department of Math and Computer Science, University of Richmond, Richmond, VA 23173. Email: †School of Computer Science, Georgia Institute of Technology, Atlanta, GA 30332. [email protected]. Supported in part by NSF grants CCF-1217793 and EAGER-1415498. ‡School of Computer Science, Georgia Institute of Technology, Atlanta, GA 30332. Email: [email protected]. Supported in part by NSF grant DGE-1650044 and a Tau Beta Pi Fellow- ship. Email: §School of Computer Science, Georgia Institute of Technology, Atlanta, GA 30332. Email: [email protected]. Supported in part by NSF grants CCF-1526900 and CNS-1544090. 1 1 Introduction Graded posets are partially ordered sets equipped with a unique rank function that both respects the partial order and such that neighboring elements in the Hasse diagram of the poset have ranks that differ by ±1. Graded posets arise throughout combinatorics, including permutations ordered by numbers of inversions, geometric lattices ordered by volume, and independent sets and matchings ordered by cardinality. Sometimes we find rich underlying structures that allow us to directly count, and therefore sample, fixed rank elements of a graded poset. In other cases, efficient methods are unlikely to exist, so Markov chains offer the best approach to sampling and approximate counting. Jerrum and Sinclair [18] observed that we could sample matchings of any fixed size with the addition of a bias parameter λ that gives weight proportional to λm to each matching m. For any graph G, they showed that the sequence ai, the number of matchings of G of size i, is log-concave, from which it follows that f (i) = aiλi is also. In particular, f (i) must be unimodal for all λ. Setting λ = ak/ak+1 makes k the mode of distribution f (i), and therefore samples with this weighting will be of the appropriate size with probability at least 1/(n+1). Jerrum and Sinclair showed that the matching Markov chain is rapidly mixing for all λ, so it can find matchings of fixed size k efficiently whenever 1/poly(n) < λ < poly(n). (This condition is not always satisfied, but the more involved algorithm of Jerrum, Sinclair, and Vigoda circumvents this issue [19].) Log-concavity is critical to this argument in order to conclude that there is a value of λ for which samples of the desired size occur with high enough probability. This follows a common approach used in physics for which we would like to sample from a microcanonical ensemble, i.e., the states with a fixed energy, from a much larger canonical (or grand canonical) ensemble, where the energies are allowed to vary due to interactions with the external environment. In particular, given input parameter λ, often related to temperature, a configuration σ has Gibbs (or Boltzmann) weight π(σ) = λr(σ)/Z, where r(σ) is the rank of σ and Z is the normalizing constant. Elements σ sampled from this distribution are uniformly distributed, conditioned on their rank. The choice of λ controls the expected rank of the distribution, so simulations of the Markov chain at various λ can be useful for understanding properties of configurations with a fixed energy. Typically, however, there is no a priori guarantee that this approach will enable us to sample configurations of a given size efficiently. Our main example throughout will be sampling and counting (possibly restricted) integer partitions. An integer partition of nonnegative integer n is a decomposition of n into a nonincreasing sequence of positive integers that sum to n. The seven partitions of 5 are: (5), (4, 1), (3, 2), (3, 1, 1), (2, 2, 1), (2, 1, 1, 1), and (1, 1, 1, 1, 1). Integer partitions are commonly represented by staircase walks in Z2 known as Young (or Ferrers) diagrams, where the heights of the columns represent distinct pieces of the partition. Partitions of n have exactly n squares, i.e., the area of the diagram, and their column heights are nonincreasing. Partitions arise in many contexts, include exclusion processes [8], random matrices [29], representation theory [15], juggling patterns [4], and growth processes [13] (see, e.g., [2]). 2 1.1 Sampling Elements from Graded Posets Several general approaches have been developed to sample elements of fixed rank from a graded poset, with varying success. The three main approaches for sampling are dynamic programming algorithms using self-reducibility, Boltzmann samplers using geometric random variables, and Markov chains. The first two approaches require methods to estimate the number of configurations of each size, so Markov chains offer the most promising approach for sampling when these are unavailable. Each of these approaches has been studied extensively in the context of sampling integer partitions. The first class of approaches uses dynamic programming and generating functions to iteratively count the number of partitions of a given type. Nijinhuis and Wilf [28] give a recursive algorithm using dynamic programming that computes tables of exact values. This algorithm takes O(n5/2) time and space for preprocessing and O(n3/2) time per sample. Squire [34] improved this to O(n2) time and space for preprocessing and O(n3/2 log(n)) time per sample using Euler's pentagonal recurrence and a more efficient search method. The time and space complexity bounds of these algorithms account for the fact that each value of p(n), as well as the intermediate summands, requires O(n1/2) space by the Hardy- Ramanujan formula. Therefore, even when available, dynamic programming approaches for exact sampling break down in practice on single machines when n ≥ 106 due to space constraints. Boltzmann samplers offer a more direct method for sampling that avoids the compu- tationally expensive task of counting partitions. A Boltzmann sampler generates samples from a larger combinatorial class with probability proportional to the Boltzmann weight λσ, where σ is the size of the partition. Samples of the same size are drawn uniformly at ran- dom, and the algorithm rejects those that fall outside of the target size [10, 11]. The value λ is chosen to maximize the yield of samples of our target size n. Fristedt [12] suggested an ap- proach that quickly generates a random partition using appropriate independent geometric random variables. His approach exploits the factorization of the generating function for p(n) and can be interpreted as sampling Young diagrams σ in the n × ∞ grid with probability proportional to the Boltzmann weight λσ. Recently Arratia and DeSalvo [3] gave a proba- bilistic approach that is substantially more efficient than previous algorithms, thus allowing for fast generation of random partitions for significantly larger numbers, e.g., n ≥ 106. Build- ing on the work of Fristedt [12], they introduce the probabilistic divide-and-conquer (PDC) method to generate random partitions of n in optimal (cid:101)O(n1/2) expected time and space (where (cid:101)O suppresses log factors). Their PDC algorithm also uses independent geometric random variables to generate a partition, but does so recursively in phases. PDC achieves superior performance relative to conventional Boltzmann Sampling by rejecting impossible configurations in early phases. Stochastic approaches using Markov chains have produced a similarly rich corpus of work, but until now have not provided rigorous polynomial bounds. One popular direction uses Markov chains based on coagulation and fragmentation processes that allow pieces of the partition to be merged and split [1, 6]. Ayyer et al. [4] recently proposed several natural Markov chains on integer partitions in order to study juggling patterns. In all of these works, 3 most of the effort has been to show that the Markov chains converge to the uniform distribu- tion over partitions and often use stopping rules in order to generate samples. Experimental evidence suggests that these chains may converge quickly to the correct equilibrium, but they lack explicit bounds. 1.2 Results For any graded poset, let Ωk be the elements of rank k and let Ω =(cid:83)n i=0 Ωi be the entire poset. We show that provably efficient Boltzmann samplers on Ωk can be easily constructed from certain rapidly mixing Markov chains on the Hasse diagram of the entire poset Ω, under very mild conditions. We apply this technique to design the first provably efficient Markov chain based algorithms for sampling integer partitions of an integer n, permutations with a fixed number of inversions, and lozenge tilings with fixed average height. Unlike all other methods for sampling that depend on efficient counting techniques, our results extend to interesting subspaces of these posets, such as partitions with at least k pieces with size greater than (cid:96), or partitions into pieces with distinct sizes, or many other such restricted classes. For these subspaces, our results provide the first sampling algorithms that do not require the space-expensive task of counting. We focus on the example of integer partitions of n and prove that there is a Markov chain Monte Carlo algorithm for uniformly sampling partitions of n from a large family of region- restricted partitions, i.e., Young diagrams restricted to any simply-connected bounding re- gion. The Markov chain on the Hasse diagram for partitions is the natural "mountain-valley" chain studied for staircase walks, tilings, and permutations. The transition probabilities are designed to generate a diagram σ with weight proportional to λσ. Previous work on biased card shuffling [5] and growth processes [5, 13, 24] shows that this chain is rapidly mixing for any constant λ on well-behaved regions. In the general setting of sampling from a graded poset, our algorithm is similar to current Boltzmann samplers that heuristically sample elements of a given size, but often without rigorous analysis. However, we establish conditions under which these algorithms can be shown to be efficient, including restricted settings for which no other methods provide guar- antees on both efficiency and accuracy. For example, we show that our method can produce random partitions of n in O(n9/4) expected time with only O(n1/2 log(n)) space. Using cou- pling from the past, we can in fact generate samples of the desired size exactly uniformly, if this is desirable. Although our algorithm is slower than recent results for sampling unrestricted partitions using independent geometric random variables [3, 12] (in the settings where those methods apply), our method is significantly more versatile. The Markov chain algorithm readily adapts to various restricted state spaces, such as sampling partitions with bounded size and numbers of parts, partitions with bounded Durfee square, and partitions with prescribed gaps between successive pieces including partitions into pieces with distinct sizes. For general bounding regions, our algorithm still uses O(n1/2 log(n)) space, and hence is usually much more suitable than other approaches with substantially larger space requirements. 4 Finally, we achieve similar results for sampling from fixed a rank in other graded posets. These include permutations with a fixed number of inversions and lozenge tilings with a given average height, referring to the height function representation of the tilings (see, e.g., [25]). Kenyon and Okounkov [20] explored limit shapes of tilings with fixed volume, and showed such constraints simplified some arguments, but there has not been work addressing sampling. 1.3 Techniques i≤k Pr[Ωi] ≥ 1/c and(cid:80) distribution satisfying(cid:80) First, we present a new argument that shows how to build Boltzmann samplers with per- formance guarantees, even in cases where the underlying distributions are not known (or necessarily even believed) to be unimodal, provided the Markov chain is rapidly mixing on the whole Hasse diagram. We prove that there must be a balanced bias parameter λ that we can find efficiently allowing us to generate configurations of the target size with prob- ability at least 1/poly(n). The desired set is no longer guaranteed to be the mode of the distribution, as generally required, but we still show that rejection probabilities will not be too high. We carefully define a polynomial sized set from which the bias parameter λ will be chosen. Then we show that at least one bias parameter in this set will define a i>k Pr[Ωi] ≥ 1/c, for some constant c. Be- cause the Markov chain M changes the rank by at most 1 in each step, we must generate samples of size exactly k with probability at least 1/τ (M), where τ (M) is the mixing time of M, which we prove using conductance. Thus, when the chain is rapidly mixing, samples of size k must occur with non-negligible probability. This new method based on balanced biases is quite general and circumvents the need to make any assumptions about the underlying distributions. We use biased Markov chains and Boltzmann sampling to generate samples of the de- sired size k. We assign probability λr(σ)/Z to every element σ ∈ Ω, where r(σ) is its rank and Z is the normalizing constant. When the underlying distributions on f (i) = Ωiλi are known to be log-concave in i, such as unrestricted integer partitions or permutations with a fixed number of inversions, we can provide better guarantees than the general balanced bias algorithm. Several observations allow us to improve the running time of our algorithm, especially in the case of unrestricted integer partitions. First, instead of sampling Young diagrams in an n × n lattice region, we restrict to diagrams lying in the first quadrant of Z2 below the curve y = 2n/x, since this region contains all the Young diagrams of interest and has area Θ(n log(n)), allowing the Markov chain to converge faster. Next, we improve the bounds on the mixing time for our particular choice of λ given in [13] using a careful analysis of a recent result in [24]. Last, we show how to salvage many of the samples rejected by Boltzmann sampling to increase the success probability to at least Ω(1/n1/4). With all of these improvements we conclude that the chain will converge in O(n2) time and O(n1/4) trials are needed in expectation before generating a sample corresponding to a partition of n. We also optimize the space required to implement the Markov chain. All Young diagrams in the region R have at most O(n1/2) corners, so each diagram in stored in O(n1/2 log(n)) space. 5 2 Bounding Rejection with Balanced Bias Let Ω be the elements of any graded poset with rank function r : Ω → Z≥0. The rank of the poset Ω is R = max({r(σ) : σ ∈ Ω}) and the rank generating function of Ω is FΩ(x) = xr(σ). (cid:88) σ∈Ω R(cid:88) Let Ωk be the set of elements of Ω with rank k and let aΩ,k = Ωk. For any λ > 0, the Gibbs measure of each σ ∈ Ω is π(σ) = λr(σ)/Z, where Z = FΩ(λ) = aΩ,iλi is the normalizing constant. We define the natural Markov chain M that traverses the Hasse diagram of Ω as follows. Let ∆ be the maximum number of neighbors of any element σ ∈ Ω in the Hasse diagram. For any pair of neighboring elements σ, ρ ∈ Ω, we define the transition probabilities i=0 P (σ, ρ) = min(1, π(ρ)/π(σ)) 2∆ , and with all remaining probability we stay at σ. This Markov chain is known as the lazy, Metropolis-Hastings algorithm [26] with respect to the Boltzmann distribution π(σ) = λr(σ)/Z. If M connects the state space of the poset, the process σt is guaranteed to converge to the stationary distribution π starting from any initial σ0 [24]. The number of steps needed for the Markov chain M with state space Ω to get arbitrarily close to this stationary distribution is known as its mixing time τ (ε), defined as τ (ε) = min({t : (cid:107)P t(cid:48) , π(cid:107)tv ≤ ε for all t(cid:48) ≥ t}), for all ε > 0, where (cid:107)·,·(cid:107)tv is the total variation distance (see, e.g., [32]). We say that a Markov chain is rapidly mixing if the mixing time is bounded above by a polynomial in n and log(ε−1). We wish to uniformly sample a random element σ ∈ Ωk, for a fixed k ∈ [R]. To achieve this, we repeatedly sample from a favorable Boltzmann distribution over all of Ω until we have an element of rank k. We show that under very mild conditions on the coefficients of the rank generating function, it is sufficient that the Markov chain M over Ω be rapidly mixing in order for the Boltzmann sampling procedure to be efficient. Specifically, we require only that R = O(poly(n)) and 1 ≤ aΩ,i ≤ c(n)i for some polynomial c(n). We formalize our claim by assuming the polynomial c = c(n) ≥ 2. For t ≥ 0, let βt = ln(1/c) + t ln(c)/R and Then let Prt[σ] = λr(σ) a way that at most R2 values need to be considered. /Zt, where Zt = FΩ(λt). The sequence {λt}∞ t t=0 is constructed in such λt = eβt = ct/R−1. 6 Lemma 2.1. For all σ ∈ Ω and t ≥ 0, we have Prt+1[σ] Prt[σ] ≥ 1 c . Proof. By the definition of βt+1, we have 1 ≥ eβtr(σ) eβt+1r(σ) = e− ln(c)r(σ)/R ≥ 1 c . It follows that Prt+1[σ] Prt[σ] = eβt+1r(σ) eβtr(σ) · Zt Zt+1 ≥ Zt Zt+1 = (cid:80) (cid:80) σ∈Ω eβt+1r(σ) ≥ σ∈Ω eβtr(σ) (cid:80) (cid:80) σ∈Ω eβt(σ) σ∈Ω ceβtr(σ) = 1 c . The following lemma is critical to our argument and states that there exists a balanced bias parameter λ relative to our target set Ωk that assigns nontrivial probability mass to elements with rank at most k and elements with rank greater than k. Lemma 2.2. Let Ω be the elements of a graded poset with rank R ≥ 1 such that 1 ≤ aΩ,i ≤ ci for all i ∈ {0, 1, . . . , R} and some c ≥ 2. If k ∈ [R − 1], there exists a t ∈ [R2] for which [r(σ) ≤ k] ≥ 1 c + 1 Pr t and To prove the existence of t∗, recall that Prt[r(σ) > k] > 1/(c + 1) if and only if To prove the second inequality, it suffices to show (c + 1)λR λt = cR−1 ≥ 1 because R ≥ 1. Therefore (c + 1)λR minimum t ∈ [R2] satisfying t > 1. Letting t = R2, we have t > 1 as desired. Finally, let t∗ be the 1 . c + 1 [r(σ) > k] > Pr t 7 Proof. Suppose there exists a minimum t∗ ∈ Z≥1 such that Then so by Lemma 2.1 we have [r(σ) > k] ≥ 1 c + 1 . Pr t Pr t∗ [r(σ) > k] > 1 c + 1 . [r(σ) ≤ k] ≥ c c + 1 Pr t∗−1 , t∗ [r(σ) ≤ k] ≥ 1 Pr c + 1 . R(cid:88) i=k+1 (c + 1) aΩ,iλi t > 1. We now prove our main theorem, which depends on the mixing time τ (ε) of the Markov chain M for the balanced bias λt, given by Lemma 2.2. The proof uses a characterization of the mixing time of a Markov chain in terms of its conductance [17, 33]. For an ergodic Markov chain M with stationary distribution π, the conductance of a subset S ⊆ Ω is defined as (cid:88) σ∈S,ρ∈S Φ(S) = π(σ)P (σ, ρ) . π(S) The conductance of the chain M is the minimum conductance over all subsets ΦM = min S⊆Ω ({Φ(S) : π(S) ≤ 1/2}) , and is related to the mixing time τ (ε) of M as follows. Theorem 2.1 ([17]). The mixing time of a Markov chain M with conductance Φ satisfies (cid:18)1 − 2Φ (cid:19) 2Φ ln(cid:0)ε−1(cid:1) . τ (ε) ≥ Theorem 2.2 (Balanced Bias). Let M be a rapidly mixing Markov chain with state space Ω and mixing time τ = τ (e−1) such that the transitions of M induce a graded partial order on Ω with rank function r : Ω → Z≥0 and rank R. If there exists a polynomial c ≥ 2 such that 1 ≤ aΩ,i ≤ ci for all i ∈ {0, 1, . . . , R}, then π(Ωk) ≥ 1 2(c + 1)(τ + 1) for any fixed k ∈ [R] with the balanced bias. If M can be used to generate exact samples from π in expected O(τ ) time, then we can uniformly sample from Ωk in expected O(cτ 2) time. Proof. Let M have conductance Φ and assume k < R. Considering the cut S = Ω≤k and using Lemma 2.2, we have min(π(S), π(S)) ≥ 1/(c + 1) for the balanced bias λt. It follows that Φ(S) ≤ σ∈S,ρ∈S π(σ)P (σ, ρ) min(π(S), π(S)) ≤ (c + 1) π(σ)P (σ, ρ) ≤ (c + 1) π(Ωk). (cid:88) σ∈Ωk,ρ∈Ωk+1 (cid:80) By Theorem 2.1, we have Φ ≥ 1 2(τ + 1) , so π(Ωk) ≥ 1 2(c + 1)(τ + 1) . It follows that O(cτ ) samples from π are needed in expectation to generate a uniform σ ∈ Ωk for any fixed k ∈ [R − 1] with the given balanced bias. Moreover, if each sample is exactly generated in O(τ ) expected time, then the total running time of this sampling algorithm is O(cτ 2). The argument when k = R − 1 extends to k = R by the detailed balance equation. 8 For simplicity, this theorem assumes we have a method for generating samples exactly from π. In many graded posets, including all considered here, we can use the coupling from the past algorithm to generate perfect samples in expected O(τ ) steps per sample [30]. In cases when we cannot sample exactly, we have the following corollary of Theorem 2.2 that only requires samples be chosen close to π. Corollary 2.1. We can use M to approximately generate samples from Ωk to within ε of the total variation distance of π in expected O(cτ 2 max(log(ε−1), log(cτ ))) time. (cid:18) ε, (cid:19) 1 8(c + 1)(τ + 1) Proof. Let ε∗ = min be the desired bound on the total variation distance between the t-step distribution P t(σ,·) starting from any initial σ ∈ Ω and the stationary distribution π. Then P t(σ, Ωk) − π(Ωk). (cid:88) P t(σ, ρ) − π(ρ) ≥ 1 2 ε∗ ≥ 1 2 ρ∈Ω Theorem 2.2 and our choice of ε∗ imply that P t(σ, Ωk) ≥ π(Ωk) − 2ε∗ ≥ 1 4(c + 1)(τ + 1) . Each sample can be generated in O(τ (ε)) = O(τ log(ε−1)) steps, so the expected runtime is O(cτ 2 max(log(ε−1), log(cτ ))). 3 Sampling Integer Partitions We demonstrate how to use the balanced bias technique to sample from general classes of restricted integer partitions. Integer partitions have a natural representation as Young diagrams, which formally are finite subsets σ ⊆ Z2≥0 with the property that if (a, b) ∈ σ, then {(x, y) ∈ Z2≥0 : 0 ≤ x ≤ a and 0 ≤ y ≤ b} ⊆ σ. Young diagrams can be visualized as a connected set of unit squares on the integer lattice with a corner at (0, 0) and a nonincreasing upper boundary from left to right. Each square in the Young diagram must be supported below by the x-axis or another square and supported to the left by the y-axis or another square. We are interested in region-restricted Young diagrams, a variant of Young diagrams whose squares are restricted to lie in a connected region R ⊆ Z2≥0 such that each square is supported below and to the left by the boundary of R or another square. Note that we use R in this section to denote a region instead of the rank of a poset. We will see that the rank of the poset induced by the natural partial order on R-restricted Young diagrams is R. 9 We call Young diagrams σ ⊆ Z2≥0 such that σ = n unrestricted integer partitions of n and use this term interchangeably with integer partitions. Many well-studied classes of restricted integer partitions have natural interpretations as region-restricted Young diagrams. For example, the set of integer partitions of n with at most k parts and with each part at most size (cid:96) give rise to the Gaussian binomial coefficients and can be thought of as the set of Young diagrams of size n contained in a k × (cid:96) box. Figure 1: Unrestricted and restricted integer partitions. 3.1 The Biased Markov Chain Let the state space Ω be the set of all Young diagrams restricted to lie in a region R. Young diagrams have a natural graded partial order via inclusion, where σ ≤ ρ if and only if σ ⊆ ρ, so the rank of a diagram σ is r(σ) = σ. The following Markov chain M on the Hasse diagram of this partial order makes transitions that add or remove a square on the boundary of the diagram in each step according to the Metropolis-Hastings algorithm. Therefore the stationary distribution is a Boltzmann distribution parameterized by a bias value λ. Let R be a region such that every partition restricted to this region has at most ∆ neighboring configurations. Biased Markov Chain on Integer Partitions M Starting at any Young diagram σ0 ⊆ R, repeat: • Choose a neighbor ρ of σt uniformly at random with probability 1/2∆. • Set σt+1 = ρ with probability min(1, λρ−σt). • With all remaining probability, set σt+1 = σt. 10 The state space Ω is connected, because any configuration can eventually reach the minimum configuration σ = ∅ with positive probability. By construction, M is lazy (i.e., it is always possible that σt = σt+1), so it follows that M is an ergodic Markov chain, and hence has a unique stationary distribution π. Using the detailed balance equation for Markov chains [31], we see that π(σ) = λσ, for all σ ∈ Ω. This Markov chain can be used to efficiently approximate the number of partitions of n restricted to R within arbitrarily small specified relative error, because this problem is self- reducible [16]. Observe that we can run M restricted to R polynomially many times and compute the mean height m in the first column of the sampled Young diagrams. Then we use M to recursively approximate the number of partitions of n− m restricted to the region R(cid:48) = {(x, y) ∈ R : 1 ≤ x and y ≤ m}, and return the product of m and this approximation. 3.2 Sampling Using Balanced Bias In the following general sampling theorem for restricted integer partitions, the mixing time of M must hold for all bias parameters λt. Theorem 3.1. Let τ = τ (e−1) be the mixing time of M on the region R. We can uniformly sample partitions of k restricted to a region R in expected O(∆τ 2) time. Proof. There is only one such partition when k = 0 or k = R, so assume k ∈ [R − 1]. By construction Ωk+1/Ωk ≤ ∆ for all fixed k, so 1 ≤ Ωi ≤ ∆i for all i ∈ {0, 1, . . . ,R}. By Lemma 2.2 there exists a balanced bias λ, which we can identify adaptively in O(log(R)) time with a binary search as we are sampling, since Boltzmann distributions increase mono- tonically with increasing λt. Therefore, we can generate Young diagrams restricted to R with any fixed rank in expected O(∆τ 2) steps of M by Theorem 2.2. If more is known about the number of elements at each rank or the geometry of R, then we can give better bounds on the runtime of this algorithm. For example, if R is the region of a skew Young diagram (see Figure 1), a region contained between two Young diagrams, then we can adapt Levin and Peres' mixing results about biased exclusion processes to this setting. Theorem 3.2 ([23]). Consider the biased exclusion process with bias β = βn = 2pn − 1 > 0 on the segment of length 2n and with n particles. Set α =(cid:112)pn/(1 − pn). For ε > 0, if n is large enough, then τ (ε) ≤ 4n β2 (cid:34) log(cid:0)ε−1(cid:1) + log (cid:34) α (cid:18) αn − 1 α − 1 (cid:19)2(cid:35)(cid:35) . Corollary 3.1. If the region R is a skew Young diagram contained in an n × n box, we can uniformly sample partitions of k restricted to R in expected O(n16) time. 11 Proof. The biased exclusion process on a segment of length 2n with n particles is in bijection with M when the restricting region is an n × n box. The proof of Theorem 3.2 in [23] uses a path coupling argument that directly extends to and gives an upper bound for the mixing time of M when the region R is a skew Young diagram, since the expected change in distance of two adjacent states in the more restricted setting can only decrease. Let λn,t denote λt in an instance of size n. We analyze the three cases λn,t < 1, λn,t = 1, and λn,t > 1, and then bound the mixing time of M for all λn,t. To prove the existence of a balanced bias using Lemma 2.2, observe that aΩ,i ≤ p(i) ≤ 2i for all i ∈ {0, 1, . . . , n2}. In the first case, assume λt,n < 1. Then we have t ∈ [n2 − 1] since R = n2. Translating M to the biased exclusion process, pn,t = βn,t = and , , 1 1 + λn,t 1 − λn,t 1 + λn,t (cid:115) 1 λn,t To use Theorem 3.2, we first prove 1/β2 minimizes βn,t, hence maximizes the desired quantity. Then . αn = n,t ≤ 10n4. To see this, observe that t = n2 − 1 (cid:19)2 lim n→∞ βn,n2−1 (cid:18) 1 (cid:19)2 ≤ αn,t = (cid:0)nαn n,t 4n2 log(2)2 ≤ 10n4. (cid:1)2 ≤ n2 λn+1/2 n,t ≤ n22n+1/2, Next, since an,t > 1, we have n,t − 1 αn,t − 1 αn,t (cid:18) αn because λn,t ≥ 1/2. Thus, τ (ε) = O(n5(log(ε−1) + n)) for all λn,t by Theorem 3.2. is Θ(n3 log(n/ε)). In the third case, λt,n > 1 so t ∈ {n2 + 1, n2 + 2, . . . , n4}, In the unbiased case when λn,t = 1, Wilson [35] proved that the mixing time of M and pn,t = λn,t , , 1 + λn,t λn,t − 1 1 + λn,t βn,t = αn,t =(cid:112)λn,t. 12 By similar analysis, 1/β2 n,t ≤ 10n4 and (cid:18) αn n,t − 1 αn,t − 1 (cid:19)2 ≤ n2λn+1/2 n,t ≤ n2(cid:16) 2n2−1(cid:17)n+1/2 , αn,t since λn,t ≤ 2n2−1. Thus τ (ε) = O(n5(log(ε−1) + n3)), so by Theorem 2.2 we can uniformly sample partitions of k restricted to R in expected O(n16) time. 3.3 Sampling Using Log-concavity When more is known about the stationary distribution π, specifically the sequence {Ωi}∞ i=0, we can typically improve the bounds on the running time of our algorithm. In particu- lar, we show that we can sample unrestricted integer partitions in expected O(n9/4) time. Our primary techniques involve using a compressed representation of partitions and using log-concavity to show strong probability concentration around partitions of the desired size. These techniques extend to a variety of settings where log-concavity or probability concen- tration can be shown. To sample integer partitions of n, we set the bias parameter λn = p(n−1)/p(n) to force the stationary distribution to concentrate at n. The sequence {p(k)}∞ k=26 is log-concave [9, 27], so it follows that the sequence {p(k)λk k=26 is, too. Log-concave sequences of positive terms are unimodal, which implies that the mode of our stationary distribution is at k = n. Moreover, we show how log-concavity gives exponential decay on both sides of the mode, and hence strong concentration. n}∞ We now argue that we need only consider Young diagrams that lie under the curve y = 2n/x to sample partitions of n, as all Young diagrams with squares above that curve must have more than 2n squares total. Proposition 3.1. A Young diagram that lies under the curve y = 2n/x can be stored in O(n1/2 log(n)) space. √ 2n, Proof. For any square in the Young diagram, both of its coordinates are not greater than for then it would lie above y = 2n/x. We may record the height of each column and the 2n(cid:99) − 1} to capture the position of every square 2n(cid:99) heights width of each row in the range {0, 1, . . . ,(cid:98)√ in the diagram. Therefore, we can represent the diagram using exactly these 2(cid:98)√ and widths. Using the compressed representation in the previous proposition, we see that there will not be more than O(n1/2) possible transitions at any possible state, since our algorithms adds or removes at most one square on the upper boundary in each step. Note that we can adapt this technique in the general case for any region R that lies under the curve y = 2n/x. √ Proposition 3.2. There are at most 4 2n potential transitions for any Young diagram that lies under the curve y = 2n/x. 13 Proof. Observe that since the squares in any row or column must be connected, there are at most two valid moves in any particular row or column. Therefore, by Proposition 3.1, there 2n(cid:99) possible transitions from any such Young diagram. are at most 4(cid:98)√ We now shift our attention to bounding λn and the consequences it has on both the mixing time of M and the concentration of π. Hardy and Ramanujan [14] gave the classical asymptotic formula for the partition numbers √ p(n) ∼ 1 4 2n/3, √ 3n eπ and we use related bounds given in [9] for the following lemma. The proof is deferred to the next subsection. Lemma 3.1. For all n ≥ 30, we have 1 − 2√ n < λn < 1 − 1√ n . Theorem 3.3. The Markov chain M with bias λn restricted to the region R bounded by the curve y = 2n/x mixes in O(n3/2(log(ε−1) + n1/2)). β = (1− λ)/(1 + λ), and α =(cid:112)1/λ. By Proposition 3.2, there are at most 4 Proof. We modify Theorem 3.2 and its proof in [23]. In this biased exclusion process, λ = λn, 2n transitions √ from any state, so for n large enough √ τ (ε) ≤ 8 2n β2 (cid:2)log(cid:0)ε−1(cid:1) + log (diam (Ω))(cid:3) , where diam(Ω) is the maximum length path between any two states, as defined in [24]. Therefore, we have diam(Ω) ≤ Rα2n and R ≤ 2nH2n ≤ 2n(log(2n) + 1), so diam(Ω) ≤ 2n(log(2n) + 1)α2n = 2n(log(2n) + 1)λ−n. By Lemma 3.1 and the bound 1 + x ≤ ex, for all x ∈ R, log(cid:0)λ−n(cid:1) ≤ log (cid:18)(cid:18) (cid:19)n(cid:19) √ ≤ 3 n, 1 + 2√ n − 2 for n sufficiently large. We have √ ≤ 2 n − 1 1 β by Lemma 3.1. Therefore, τ (ε) = O(n3/2(log(ε−1) + n1/2)). 14 Another key observation we make to generate partitions of n more efficiently is to sal- vage samples larger than n instead of rejecting them, while preserving uniformity on the distribution Ωn. For any k ≥ 0, consider the function fk : Ωn → Ωn+k that maps a parti- tion σ = (σ1, σ2, . . . , σm) to fk(σ) = (σ1 + k, σ2, . . . , σm). Note that σ1 ≥ σ2 ≥ ··· ≥ σm since σ is a Young diagram. Clearly fk is injective, so we can consider the inverse map k ((ρ1, ρ2, . . . , ρ(cid:96))) that subtracts k from ρ1 if ρ1 − k ≥ ρ2, and is invalid otherwise. Then, f−1 define g : Ω≥n → Ωn ∪ {0} as g((ρ1, ρ2, . . . , ρ(cid:96))) = (ρ1 − k, ρ2, . . . , ρ(cid:96)) 0 if ρ1 + ρ2 + ··· + ρ(cid:96) = n + k and ρ1 − k ≥ ρ2 otherwise. (cid:40) The following lemma, whose proof is deferred to the next subsection, uses the log-concavity of the partition numbers to give a strong lower bound on the success of the map g. Lemma 3.2. Let σ be a random Young diagram from the stationary distribution of M, and let g be the function defined above. Then for all n sufficiently large, Pr[g(σ) generates a partition of n] ≥ 1 160n1/4 . Assembling the ideas in this section, we now formally present our Markov chain Monte Carlo algorithm for generating partitions of n uniformly at random. Algorithm for Sampling Integer Partitions Repeat until success: • Sample σ ∈ Ω using M. • If n ≤ σ ≤ 2n and g(σ) (cid:54)= 0, return g(σ). Note that we restrict σ ≤ 2n instead of σ ≤ 2n log(n) so that g maps to Ωn uniformly. All partitions of 2n are elements of Ω2n, but the same is not true for larger partitions since the bounding region R is the curve y = 2n/x. Lastly, recall that coupling from the past can be used efficiently in this setting to generate perfectly uniform samples, because the natural coupling is monotone and there is a single minimum and maximum configuration [13]. Theorem 3.4. Our Markov chain Monte Carlo algorithm for generating a uniformly random partition of n runs in expected O(n9/4) time and O(n1/2 log(n)) space. Proof. The proof directly follows from Proposition 3.1, Lemma 3.2, and Theorem 3.3. 3.4 Proofs of Lemma 3.1 and Lemma 3.2 We prove Lemma 3.1 using bounds for p(n) given in [9]. Let √ 24n − 1 6 , µ(n) = µn = π 15 and T (n) = νn (cid:19) √ 12 24n − 1 , eµn + (−1)n√ 2 eµn/2 (cid:21) . ν(n) = νn = (cid:20)(cid:18) 1 − 1 µn The function T (n) is the sum of the three largest terms in the Hardy-Ramanujan formula, and the explicit error bounds in [9] that we use were first proved by Lehmer [22]. We only prove upper bounds in the following two proofs, as the lower bounds are proved similarly. Lemma 3.3. For all n ≥ 2, we have (cid:18) (cid:12)(cid:12)(cid:12)(cid:12)p(n) − νn 1 − 1 µn (cid:19) Proof. By Lemma 2.3 and Proposition 2.4 in [9], p(n) < T (n) + 1 + eµn/2 < νn 16 µ3 n Proof of Lemma 3.1. By Lemma 3.3, (cid:16) (cid:17) (cid:17) (cid:16) 1 − 1 1 − 1 µn−1 λn < 1 + eµn−1/2 + νn−1 − (1 + eµn/2) + νn − (e−µn + e−µn/2) + νn for all n ≥ 14, because the lower bound for p(n) is initially negative. We have eµn µn eµn−1 = eµn−1 eµn (cid:16) (cid:16) (cid:17) µn−1 1 − 1 1 − 1 µn (cid:17)  , eµn 1 − 1 µn eµ n + 1 + eµn/2. (cid:12)(cid:12)(cid:12)(cid:12) < 1 + eµn/2. (cid:19) (cid:18) e−µn−1 + e−µn−1/2 + νn−1 (cid:18)  = (cid:19) (cid:18) n (cid:19)2(cid:18) µ3 1 − 1 µn νn n , eµn−1 eµn n − 1 for all n ≥ 65, so it follows that e−µn + e−µn/2 < (cid:0)1 + 1 (cid:0)1 − 1 n−1 (cid:16) (cid:1) νn−1 (cid:16) (cid:1) νn n (cid:17) 1 − 1 1 − 1 µn µn−1 (cid:17) λn < eµn−1 eµn √ for all n ≥ 2. Observe that µn−1 − µn < −π/ 6n and n (µn−1 − 1) µ3 n−1 (µn − 1) µ3 < for all n ≥ 2. Using ex ≤ 1 + x + x2/2, for all x ≤ 0, n n − 1 , (cid:18) n (cid:19)3 (cid:18) n (cid:18) (cid:19)3 ≤ − π√ (cid:19) , n (µn−1 − 1) n−1 (µn − 1) µ3 (cid:19)(cid:18) n (cid:19)3 eµn−1 eµn < e n − 1 λn < , where the final inequality is true for all n ≥ 160. When 30 ≤ n < 160, we verify the claim numerically. n − 1 n − 1 + 6n 1 − π√ 6n π2 12n < 1 − 1√ n 16 Now we prove Lemma 3.2 by showing that the truncation scheme g(σ) succeeds with sufficient probability. By Hardy-Ramanujan formula, we have that for any constant c > 0 and n sufficiently large, 1 − c √ 3n 4 eπ √ √ 2n/3 ≤ p(n) ≤ 1 + c 3n 4 √ 2n/3. eπ Letting λ = λn, the Hardy-Ramanujan formula implies that for all n ≥ 20, √ e−πk/ √ 6n ≤ λk ≤ ek/n−πk/ 6n. Lemma 3.4. Let Zn be the normalizing constant of the desired distribution. Then we have for all n sufficiently large. Proof. Clearly Zn < 40n3/4λnp(n), ∞(cid:88) k=0 Zn ≤ p(k)λk. We further know that f (k) = p(k)λk is unimodal with a maximum at k = n. By the log-concavity of {f (k)}∞ k=26, we have f (n + k) f (n) ≥ f (n + 2k) f (n + k) and f (n − k) for all k ≥ 1. Therefore, we can bound Zn as ≥ f (n − 2k) f (n − k) , f (n) (cid:32) Zn ≤ kf (n) 1 1 − f (n+k) f (n) + 1 1 − f (n−k) f (n) (cid:33) , for any k ≥ 1. Specifically, if both f (n + k)/f (n) and f (n − k)/f (n) are at most some fixed constant less than 1, then Zn = O(kf (n)). Using the bounds above, √ ek/n−π( √ ek/n−π(k−2 6n = k−√ n/6. √ / kn)/ √ n)2 6n+π √ f (k) = p(k)λk ≤ 1 + c 3k √ 4 √ 1 + c 4 3k √ Letting n + k = ( n + n1/4)2, for n large enough, (cid:16)(cid:0)√ n + n1/4(cid:1)2(cid:17) ≤ 1 + c f √ 4 3n √ e1.1−π/ 6+π √ n/6. 17 We can then bound the density value at ( f (n) Taking c ≤ 0.01, we have (cid:16)(cid:0)√ f √ √ ≤ 1+c 4 3n 1−c √ 3n 4 n + n1/4(cid:1)2(cid:17) (cid:16)(cid:0)√ n + n1/4(cid:1)2(cid:17) (cid:16)(cid:0)√ f (n) f f ≤ 1.01 0.99 n − n1/4(cid:1)2(cid:17) Similarly, for n sufficiently large, n + n1/4)2 relative to the maximum by √ e1.1−π/ √ eπ √ e1.1−π/ 1 + c 1 − c √ √ 2n/3−π 6+π 6. = n/6 n/6 e1.1− π√ 6 < 0.85. f (n) < 0.85. Therefore, we have Zn < 40n3/4λnp(n) using the fact that k ≤ 3n3/4. Proof of Lemma 3.2. We use Lemma 3.4 and Lemma 3.1 to bound the probability that g(σ) generates a partition of n successfully. Therefore, we have Pr[g(σ) generates a partition of n] = n(cid:88) λn+kp(n) Zn n(cid:88) n(cid:88) k=0 k=0 √ n 2 k=0 ≥ 1 40n3/4 ≥ 1 40n3/4 = ≥ 1 40n3/4 · 1 160n1/4 . (cid:19)k λk (cid:18) (cid:32) 1 − 2√ n (cid:18) 1 − 1 − 2√ n (cid:19)n+1(cid:33) 4 Sampling in Other Graded Posets We demonstrate the versatility of using a Markov chain on the Hasse diagram of a graded poset to sample elements of fixed rank. When this chain is rapidly mixing for all λt with t ∈ [R2], we can apply Boltzmann sampling and Theorem 2.2 to generate approxi- mately uniform samples in polynomial time. Similar to region-restricted integer partitions, analogous notions of self-reducibility apply to restricted families of permutations and lozenge tilings, so there exist fully polynomial-time approximation schemes for these enumerations problems because we can efficiently sample elements of a given rank from their respective posets [16]. 18 4.1 Permutations with Fixed Rank In the first case, we consider permutations of n elements with a fixed number of inversions. The Hasse diagram in this setting connects permutations that differ by one adjacent trans- position. This partial order is in bijection with the weak Bruhat order on the symmetric group. In the unbiased case (λ = 1), the nearest neighbor Markov chain mixes in time Θ(n3 log(n)) [35]. With constant bias the chain is known to converge in time Θ(n2) [5, 13]. The number of permutations of n with k inversions is known to be log-concave in k, so standard Boltzmann sampling techniques can be used. However, using our balanced bias method, we avoid the need for bounds on the growth of inversion numbers in restricted settings, such as permutations where at least i of the first j elements are in the first half of the permutation. Figure 2 illustrates the distribution of inversions of random permutations in S100 sampled from various ranks of the inversion poset as Rothe diagrams [21]. (a) (b) (c) (d) (e) (f) (cid:0)100 (cid:1) inversions. 2 Figure 2: Random permutations with (a) 5, (b) 20, (c) 40, (d) 60, (e) 80, (f) 95 percent of 4.2 Lozenge Tilings with Fixed Average Height Lozenge tilings are tilings of a triangular lattice region with pairs of equilateral triangles that share an edge. There is a well-studied height function that maps hexagonal lozenge tilings bijectively to plane partitions lying in an n× n× n box (see, e.g., [25]), and it follows that lozenge tilings with a fixed average height of k are precisely the plane partitions with 19 volume k. The Markov chain that adds or removes single cubes on the surface of the plane partition (corresponding to rotating three nested lozenges 180 degrees) is known to mix rapidly in the unbiased case. Caputo et al. [7] studied the biased version of this chain with a preference toward removing cubes, and showed that this chain converges in O(n3) time. Applying the balanced bias method, we can use Boltzmann sampling to generate random lozenge tilings with any target average height in polynomial time, as shown in Figure 3. (a) (b) (c) (d) Figure 3: Random lozenge tilings with average height (a) 5, (b) 15, (c) 35, (d) 50 percent of 753. 20 References [1] D. Aldous. Deterministic and stochastic models for coalescence (aggregation and co- agulation): a review of the mean-field theory for probabilists. Bernoulli, 5(1):3 -- 48, 1999. [2] G. E. Andrews. The Theory of Partitions. Cambridge mathematical library. Cambridge University Press, 1998. [3] R. Arratia and S. DeSalvo. Probabilistic divide-and-conquer: a new exact simulation method, with integer partitions as an example. Combinatorics, Probability and Com- puting, 25(3):324 -- 351, 2016. [4] A. Ayyer, J. Bouttier, S. Corteel, and F. Nunzi. Multivariate juggling probabilities. Electronic Journal of Probability, 20(5):1 -- 29, 2014. [5] I. Benjamini, N. Berger, C. Hoffman, and E. Mossel. Mixing times of the biased card shuffling and the asymmetric exclusion process. Transactions of the American Mathe- matical Society, 357(8):3013 -- 3029, 2005. [6] N. Berestycki and J. Pitman. Gibbs distributions for random partitions generated by a fragmentation process. Journal of Statistical Physics, 127:381 -- 418, 2007. [7] P. Caputo, F. Martinelli, and F. L. Toninelli. Convergence to equilibrium of biased plane partitions. Random Structures & Algorithms, 39(1):83 -- 114, 2011. [8] A. Comtet, S. N. Majumdar, and S. Ouvry. Integer partitions and exclusion statistics. Journal of Physics A: Mathematical and Theoretical, 40(37):11255 -- 11269, 2007. [9] S. DeSalvo and I. Pak. Log-concavity of the partition function. The Ramanujan Journal, 38(1):61 -- 73, 2014. [10] P. Duchon, P. Flajolet, G. Louchard, and G. Shaeffer. Boltzmann samplers for the ran- dom generation of combinatorial structures. Combinatorics, Probability and Computing, 13(4 -- 5):577 -- 625, 2004. [11] P. Flajolet, ´E. Fusy, and C. Pivoteau. Boltzmann sampling of unlabelled structures. In Proceedings of the Fourth Workshop on Analytic Algorithmics and Combinatorics (ANALCO), pages 201 -- 211, 2007. [12] B. Fristedt. The structure of random partitions of large integers. Transactions of the American Mathematical Society, 337(2):703 -- 735, 1993. [13] S. Greenberg, A. Pascoe, and D. Randall. Sampling biased lattice configurations using exponential metrics. In Proceedings of the Twentieth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 76 -- 85, 2009. 21 [14] G. H. Hardy and S. Ramanujan. Asymptotic formulae in combinatory analysis. Pro- ceedings of the London Mathematical Society, 17:75 -- 115, 1918. [15] G. D. James and A. Kerber. The representation theory of the symmetric group. Ency- clopedia of Mathematics and its Applications. Cambridge University Press, 1984. [16] M. Jerrum. Counting, Sampling and Integrating: Algorithms and Complexity. Lectures in Mathematics. ETH Zurich. Birkhauser Basel, 2003. [17] M. Jerrum and A. Sinclair. Approximate counting, uniform generation and rapidly mixing Markov chains. Information and Computation, 82:93 -- 133, 1989. [18] M. Jerrum and A. Sinclair. The Markov chain Monte Carlo method: an approach to approximate counting and integration. In D. S. Hochbaum, editor, Approximation Algorithms for NP-hard Problems, pages 482 -- 520. PWS Publishing, 1997. [19] M. R. Jerrum, A. J. Sinclair, and E. Vigoda. A polynomial-time approximation algo- rithm for the permanent of a matrix with nonnegative entries. Journal of the ACM, 41:671 -- 697, 2006. [20] R. Kenyon and A. Okounkov. Limit shapes and the complex Burgers equation. Acta Mathematica, 199:263 -- 302, 2007. [21] A. Kerber. Applied Finite Group Actions. Algorithms and Combinatorics. Springer Berlin Heidelberg, 2013. [22] D. H. Lehmer. On the series for the partition function. Transactions of the American Mathematical Society, 43(2):271 -- 295, 1938. [23] D. Levin and Y. Peres. Mixing of the exclusion process with small bias. Preprint available at https://arxiv.org/abs/1608.03633, 2016. [24] D. Levin, Y. Peres, and E. Wilmer. Markov chains and mixing times. American Math- ematical Society, 1st edition, 2008. [25] M. Luby, D. Randall, and A. J. Sinclair. Markov chain algorithms for planar lattice structures. SIAM Journal on Computing, 31:167 -- 192, 2001. [26] N. Metropolis, A. W. Rosenbluth, M. N. Rosenbluth, A. H. Teller, and E. Teller. Equa- tion of State Calculations by Fast Computing Machines. The Journal of Chemical Physics, 21(6):1087 -- 1092, 1953. [27] J. L. Nicolas. Sur les entiers n pour lesquels il y a beaucoup de groupes ab´eliens d'ordre n. Annales de l'institut Fourier, 28(4):1 -- 16, 1978. [28] A. Nijenhuis and H. S. Wilf. Combinatorial algorithms. Academic Press, 1978. 22 [29] A. Okounkov. Symmetric Functions and Random Partitions, pages 223 -- 252. Springer Netherlands, Dordrecht, 2002. [30] J. G. Propp and D. B. Wilson. Exact sampling with coupled markov chains and ap- plications to statistical mechanics. Random Structures & Algorithms, 9(1 -- 2):223 -- 252, 1996. [31] D. Randall. Mixing. In 44th Symposium on Foundations of Computer Science (FOCS), pages 4 -- 15, 2003. [32] A. Sinclair. Improved bounds for mixing rates of Markov chains and multicommodity flow. Combinatorics, Probability and Computing, 1:351 -- 370, 1992. [33] A. Sinclair. Algorithms for random generation and counting. Progress in theoretical computer science. Birkhauser, 1993. [34] M. Squire. Efficient generation of integer partitions. Unpublished manuscript, 1993. [35] D. B. Wilson. Mixing times of lozenge tiling and card shuffling Markov chains. The Annals of Applied Probability, 14(1):274 -- 325, 2004. 23